@tsocial/tvweb-sdk.dop 5.24.2 → 5.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,7 @@ import t,{useContext as r,useMemo as n,useRef as i,useCallback as o,useEffect as
|
|
|
12
12
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
|
-
***************************************************************************** */function i(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==("undefined"==typeof Reflect?"undefined":x(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function o(e,t){if("object"==("undefined"==typeof Reflect?"undefined":x(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var c=function(){function e(e){this.httpClient=e}return e.prototype.uploadImage=function(e,t){return this.httpClient.postFormData("/v1/images",e,t)},e.prototype.request=function(e,t){var r="application/pdf"===e.file.type;return this.httpClient.postFormData(r?"/v1/files":"/v1/images",e,t)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/images",e,t)},e.prototype.download=function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/images/"+e)];case 1:return t=r.sent(),[4,URL.createObjectURL(t)];case 2:return[2,r.sent()]}}))}))},e.prototype.updateMetadata=function(e,t){return this.httpClient.patch("/v1/images/"+e,t)},e}(),l=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/files",e,t)},e.prototype.uploadFile=function(e,t){return this.httpClient.postFormData("/v1/files",e,t)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/files",e,t)},e}(),u=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/compare_faces_sync",e,t)},e}(),d=function(){function e(e){this.httpClient=e}return e.prototype.getClientSettings=function(){return this.httpClient.get("/v1/client_settings")},e.prototype.request=function(e,t){return this.httpClient.get("/v1/client_settings",e,t)},e}(),f=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_face_liveness_sync",e,t)},e}(),p=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_id_card_sanity_sync",e,t)},e}(),h=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_portrait_sanity_sync",e,t)},e}(),m=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e.prototype.requestWithAuthHeaders=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e}(),g=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/search_faces_sync",e,t)},e.prototype.indexFaces=function(e,t){return this.httpClient.post("/v1/index_faces_sync",e,t)},e.prototype.deleteFaces=function(e,t){return this.httpClient.post("/v1/delete_faces",e,t)},e.prototype.detectFaces=function(e,t){return this.httpClient.post("/v1/detect_faces_sync",e,t)},e.prototype.downloadFaceImage=function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/face_images/"+e)];case 1:return t=r.sent(),[2,URL.createObjectURL(t)]}}))}))},e}(),v=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.postFormData("/v1/convert_pdf_sync",e,t)},e}(),y=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/ekyc_pdf",e,t)},e}(),b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==ve?ve:"undefined"!=typeof self?self:{};function _(e,t){return e(t={exports:{}},t.exports),t.exports}var C=_((function(e){var t,r;t=b,r=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<e.length;n++){var i=e[n];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(n>0&&(i=i.replace(/^[\/]+/,"")),i=n<e.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),t.push(i))}var o=t.join("/"),a=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return e("object"==x(arguments[0])?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=r():t.urljoin=r()}));function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var k=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var c=0;c<s;++c){var l,u,d,f,p=e[c].replace(o,"%20"),h=p.indexOf(r);h>=0?(l=p.substr(0,h),u=p.substr(h+1)):(l=p,u=""),d=decodeURIComponent(l),f=decodeURIComponent(u),w(i,d)?Array.isArray(i[d])?i[d].push(f):i[d]=[i[d],f]:i[d]=f}return i},S=function(e){switch(x(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},B=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==x(e)?Object.keys(e).map((function(n){var i=encodeURIComponent(S(n))+r;return Array.isArray(e[n])?e[n].map((function(e){return i+encodeURIComponent(S(e))})).join(t):i+encodeURIComponent(S(e[n]))})).join(t):n?encodeURIComponent(S(n))+r+encodeURIComponent(S(e)):""},E=_((function(e,t){t.decode=t.parse=k,t.encode=t.stringify=B})),I=(E.decode,E.parse,E.encode,E.stringify),A=function(){function e(e){this.authorizer=e.authorizer,this.domain=e.domain,this.onError=e.onError,this.configHeaders=e.headers}return e.prototype.get=function(e,t,r){var n=new URL(this.resolveUrl(e));return t&&(n.search=I(t)),this.request(n.toString(),{requestPath:e,method:"GET",headers:r})},e.prototype.post=function(e,t,r){var i=this.resolveUrl(e);return this.request(i,{requestPath:e,method:"POST",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.postFormData=function(e,t,r){var n,i=t instanceof FormData?t:(n=t,Object.entries(n).reduce((function(e,t){var r=t[0],n=t[1];return Array.isArray(n)?n.forEach((function(t,i){return e.append(r+"["+i+"]",n)})):!(n instanceof Object)||n instanceof File||n instanceof Date||n instanceof Blob?e.append(r,n):Object.entries(n).forEach((function(t,i){return e.append(r+"["+i+"]",n[i])})),e}),new FormData)),o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"POST",body:i,headers:r})},e.prototype.patch=function(e,t,r){var i=this.resolveUrl(e);return this.request(i,{requestPath:e,method:"PATCH",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.delete=function(e,t,r){var i=this.resolveUrl(e);return this.request(i,{requestPath:e,method:"DELETE",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.downloadFile=function(e){var t=this.resolveUrl(e);return this.request(t,{requestPath:e,method:"GET"},"blob")},e.prototype.request=function(e,t,r){return void 0===r&&(r="json"),a(this,void 0,void 0,(function(){var i,o,a,c;return s(this,(function(s){switch(s.label){case 0:return i={},o={},this.authorizer&&(i=this.authorizer.getHeaders(t)),this.configHeaders&&(o=this.configHeaders),t.headers=n(n(n({},t.headers),i),o),[4,fetch(e,t)];case 1:return a=s.sent(),[4,"blob"===r?a.blob():a.json()];case 2:if((c=s.sent()).errors&&this.onError)throw this.onError(c.errors),c;return[2,c]}}))}))},e.prototype.resolveUrl=function(e){return C(this.domain,e)},e}(),T=function(){function e(e){this.mocks=e}return e.prototype.get=function(e,t){return this.findInMocks(e,t)},e.prototype.post=function(e,t){return this.findInMocks(e)},e.prototype.postFormData=function(e,t){return this.findInMocks(e)},e.prototype.patch=function(e,t){return this.findInMocks(e)},e.prototype.delete=function(e,t){return this.findInMocks(e)},e.prototype.downloadFile=function(e){return this.findInMocks(e)},e.prototype.resolveUrl=function(e){return this.mocks.resolveUrl?this.mocks.resolveUrl(e):e},e.prototype.findInMocks=function(e,t){return a(this,void 0,void 0,(function(){return s(this,(function(r){return this.mocks[e]?"function"==typeof this.mocks[e]?[2,Promise.resolve(this.mocks[e](t))]:[2,Promise.resolve(this.mocks[e])]:[2,Promise.reject(new Error(e+" is not presented in mocks"))]}))}))},e}(),P=_((function(e,t){var r;e.exports=r=r||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},o=i.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(o=0;o<i;o+=4)t[n+o>>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){t=t;var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},o=0;o<t;o+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new a.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new a.init(r,t/2)}},l=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new a.init(r,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,o=this.blockSize,s=i/(4*o),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,l=e.min(4*c,i);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(n,u);var d=n.splice(0,c);r.sigBytes-=l}return new a.init(d,l)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(i.Hasher=d.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math)})),R=_((function(e,t){var r,n,i;e.exports=(n=(r=i=P).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return function(e,t,r){for(var i=[],o=0,a=0;a<t;a++)if(a%4){var s=r[e.charCodeAt(a-1)]<<a%4*2,c=r[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=(s|c)<<24-o%4*8,o++}return n.create(i,o)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)})),D=(_((function(e,t){var r;e.exports=(r=P,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var l=[],u=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=a+_|0,a=o,o=i,i=n,n=_+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(u),t.HmacSHA256=o._createHmacHelper(u)}(Math),r.SHA256)})),_((function(e,t){var r,n,i;e.exports=(n=(r=P).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,l=0;l<r;l++)s[l]^=1549556828,c[l]^=909522486;o.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))})),_((function(e,t){e.exports=P.HmacSHA256}))),L=function(){function e(e,t){this.accessKey=e,this.keySecret=t}return e.prototype.getHeaders=function(e){var t=function(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+(0===(r=e.getTimezoneOffset())?"Z":(n=r>0?"-":"+",r=Math.abs(r),n+t(Math.floor(r/60))+":"+t(r%60)));var r,n}(new Date);return{Authorization:this.generateAuthorization(e.requestPath,e.method,t),"X-TV-Timestamp":t}},e.prototype.generateAuthorization=function(e,t,r){var n=this.computeStringToSign(e,t,r),i=R.stringify(this.computeSignature(n));return this.formatAuthToken("TV",i)},e.prototype.formatAuthToken=function(e,t){return e+" "+this.accessKey+":"+t},e.prototype.computeStringToSign=function(e,t,r){return t+"\n"+e+"\n"+r},e.prototype.computeSignature=function(e){return D(e,this.keySecret)},e}();function N(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":return"https://vn-vision.trustingsocial.com/api";default:return e}}function O(e,t,r,n){void 0===r&&(r="production");var i=(void 0===n?{}:n).headers,o=new L(e,t),a=N(r);return new A({authorizer:o,domain:a,headers:i})}var F=function(){function e(e){void 0===e&&(e="production");var t=new A({domain:N(e)});this.imagesService=new c(t),this.detectIDTamperingService=new m(t)}return e.prototype.uploadImage=function(e,t){return this.imagesService.requestWithHeaders(e,t)},e.prototype.detectTampering=function(e,t){return this.detectIDTamperingService.requestWithAuthHeaders(e,t)},e}();function M(e){var t=e.headerIndex;return function(e,r,i){var o=i.value,c=n({},i);return c.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return a(this,void 0,void 0,(function(){var r,i,a,c;return s(this,(function(s){switch(s.label){case 0:return this.transactionEnabled?[4,this.transactionManager.begin()]:[3,4];case 1:return r=s.sent(),i=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n}(e),(a=n({},i[t]))["X-TV-Transaction"]=r,i[t]=a,[4,o.apply(this,i)];case 2:return c=s.sent(),[4,this.transactionManager.end()];case 3:return s.sent(),[2,c];case 4:return[4,o.apply(this,e)];case 5:return[2,s.sent()]}}))}))},c}}function V(e){return void 0===e&&(e={encryptedField:"data"}),function(t,r,i){var o=i.value,c=n({},i);return c.value=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return a(this,void 0,void 0,(function(){var r,n;return s(this,(function(i){switch(i.label){case 0:return[4,o.apply(this,t)];case 1:return r=i.sent(),this.encryptionEnabled&&"string"==typeof r[e.encryptedField]?(n=this.encryptionService.decrypt(r[e.encryptedField],{transactionID:this.transactionManager.currentTransactionID}),[2,JSON.parse(n)]):[2,r]}}))}))},c}}var U=function(){function e(e){this.httpClient=e,this.transactionID="",this.totalTransactions=0,this.currentTransaction=0}return Object.defineProperty(e.prototype,"currentTransactionID",{get:function(){return this.transactionID},enumerable:!1,configurable:!0}),e.prototype.begin=function(){return a(this,void 0,void 0,(function(){var e,t,r=this;return s(this,(function(n){switch(n.label){case 0:return e=this.totalTransactions++,[4,new Promise((function(t,n){var i=window.performance.now(),o=setInterval((function(){e===r.currentTransaction&&(clearInterval(o),t(!0)),window.performance.now()-i>=3e3&&(clearInterval(o),n(new Error("Transaction timeout")))}),100)}))];case 1:return n.sent(),[4,this.httpClient.post("/v1/transactions",{})];case 2:return t=n.sent().data,this.transactionID=t.id,[2,t.id]}}))}))},e.prototype.end=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,this.httpClient.post("/v1/transactions/"+this.transactionID+"/finish")];case 1:return e=t.sent(),this.transactionID="",this.currentTransaction++,[2,e]}}))}))},e}(),j={options:{usePureJavaScript:!1}},z={},q=z,H={};z.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,a=t.charAt(0),s=[0];for(i=0;i<e.length;++i){for(var c=0,l=e[i];c<s.length;++c)l+=s[c]<<8,s[c]=l%o,l=l/o|0;for(;l>0;)s.push(l%o),l=l/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=a;for(i=s.length-1;i>=0;--i)n+=t[s[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var a=0,s=e.at(r);a<o.length;++a)s+=o[a]<<8,o[a]=s%n,s=s/n|0;for(;s>0;)o.push(s%n),s=s/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=t[o[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},z.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=H[t];if(!r){r=H[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var i=t.length,o=t.charAt(0),a=[0];for(n=0;n<e.length;n++){var s=r[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,l=s;c<a.length;++c)l+=a[c]*i,a[c]=255&l,l>>=8;for(;l>0;)a.push(255&l),l>>=8}for(var u=0;e[u]===o&&u<e.length-1;++u)a.push(0);return"undefined"!=typeof Buffer?Buffer.from(a.reverse()):new Uint8Array(a.reverse())},_((function(e){var t=e.exports=j.util=j.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(t.isArrayBuffer(e)||t.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var r=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,r)}catch(e){for(var i=0;i<r.length;++i)this.putByte(r[i])}}else(e instanceof n||"object"==x(e)&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return t.nextTick=process.nextTick,void("function"==typeof setImmediate?t.setImmediate=setImmediate:t.setImmediate=t.nextTick);if("function"==typeof setImmediate)return t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(t.nextTick=function(e){return setImmediate(e)});if(t.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];t.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,o=document.createElement("div");r=[],new MutationObserver((function(){var e=r.slice();r.length=0,e.forEach((function(e){e()}))})).observe(o,{attributes:!0});var a=t.setImmediate;t.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),a(e)):(r.push(e),1===r.length&&o.setAttribute("a",i=!i))}}t.nextTick=t.setImmediate}(),t.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,t.globalScope=t.isNodejs?b:"undefined"==typeof self?window:self,t.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},t.isArrayBufferView=function(e){return e&&t.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},t.ByteBuffer=n,t.ByteStringBuffer=n,t.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},t.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},t.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},t.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(t.encodeUtf8(e))},t.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},t.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},t.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},t.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},t.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},t.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},t.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},t.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var e=t.createBuffer(this.data);return e.read=this.read,e},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())},t.DataBuffer=function(e,r){r=r||{},this.read=r.readOffset||0,this.growSize=r.growSize||1024;var n=t.isArrayBuffer(e),i=t.isArrayBufferView(e);if(n||i)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in r?r.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in r&&(this.write=r.writeOffset)},t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},t.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},t.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},t.DataBuffer.prototype.putBytes=function(e,r){if(t.isArrayBufferView(e)){var n=(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-i.byteOffset;return this.accommodate(n),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=n,this}if(t.isArrayBuffer(e)){var i=new Uint8Array(e);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(e instanceof t.DataBuffer||"object"==x(e)&&"number"==typeof e.read&&"number"==typeof e.write&&t.isArrayBufferView(e.data))return i=new Uint8Array(e.data.byteLength,e.read,e.length()),this.accommodate(i.byteLength),new Uint8Array(e.data.byteLength,this.write).set(i),this.write+=i.byteLength,this;if(e instanceof t.ByteStringBuffer&&(e=e.data,r="binary"),r=r||"binary","string"==typeof e){var o;if("hex"===r)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(e,o,this.write),this;if("base64"===r)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(e,o,this.write),this;if("utf8"===r&&(e=t.encodeUtf8(e),r="binary"),"binary"===r||"raw"===r)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(o),this;if("utf16"===r)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+r)}throw Error("Invalid parameter: "+e)},t.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},t.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},t.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},t.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},t.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},t.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},t.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},t.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},t.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},t.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},t.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},t.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.DataBuffer.prototype.toString=function(e){var r=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return t.binary.raw.encode(r);if("hex"===e)return t.binary.hex.encode(r);if("base64"===e)return t.binary.base64.encode(r);if("utf8"===e)return t.text.utf8.decode(r);if("utf16"===e)return t.text.utf16.decode(r);throw new Error("Invalid encoding: "+e)},t.createBuffer=function(e,r){return r=r||"raw",void 0!==e&&"utf8"===r&&(e=t.encodeUtf8(e)),new t.ByteBuffer(e)},t.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},t.xorBytes=function(e,t,r){for(var n="",i="",o="",a=0,s=0;r>0;--r,++a)i=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(n+=o,o="",s=0),o+=String.fromCharCode(i),++s;return n+o},t.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},t.bytesToHex=function(e){return t.createBuffer(e).toHex()},t.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(e,t){for(var r,n,o,a="",s="",c=0;c<e.length;)r=e.charCodeAt(c++),n=e.charCodeAt(c++),o=e.charCodeAt(c++),a+=i.charAt(r>>2),a+=i.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=i.charAt((15&n)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a},t.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",s=0;s<e.length;)t=o[e.charCodeAt(s++)-43],r=o[e.charCodeAt(s++)-43],n=o[e.charCodeAt(s++)-43],i=o[e.charCodeAt(s++)-43],a+=String.fromCharCode(t<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},t.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},t.decodeUtf8=function(e){return decodeURIComponent(escape(e))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:q.encode,decode:q.decode}},t.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},t.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,o=r=r||0;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},t.binary.base64.encode=function(e,t){for(var r,n,o,a="",s="",c=0;c<e.byteLength;)r=e[c++],n=e[c++],o=e[c++],a+=i.charAt(r>>2),a+=i.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=i.charAt((15&n)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a},t.binary.base64.decode=function(e,t,r){var n,i,a,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l=0,u=r=r||0;l<e.length;)n=o[e.charCodeAt(l++)-43],i=o[e.charCodeAt(l++)-43],a=o[e.charCodeAt(l++)-43],s=o[e.charCodeAt(l++)-43],c[u++]=n<<2|i>>4,64!==a&&(c[u++]=(15&i)<<4|a>>2,64!==s&&(c[u++]=(3&a)<<6|s));return t?u-r:c.subarray(0,u)},t.binary.base58.encode=function(e,r){return t.binary.baseN.encode(e,a,r)},t.binary.base58.decode=function(e,r){return t.binary.baseN.decode(e,a,r)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(e,r,n){e=t.encodeUtf8(e);var i=r;i||(i=new Uint8Array(e.length));for(var o=n=n||0,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a);return r?o-n:i},t.text.utf8.decode=function(e){return t.decodeUtf8(String.fromCharCode.apply(null,e))},t.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),o=r=r||0,a=r,s=0;s<e.length;++s)i[a++]=e.charCodeAt(s),o+=2;return t?o-r:n},t.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},t.deflate=function(e,r,n){if(r=t.decode64(e.deflate(t.encode64(r)).rval),n){var i=2;32&r.charCodeAt(1)&&(i=6),r=r.substring(i,r.length-4)}return r},t.inflate=function(e,r,n){var i=e.inflate(t.encode64(r)).rval;return null===i?null:t.decode64(i)};var s=function(e,r,n){if(!e)throw new Error("WebStorage not available.");var i;if(null===n?i=e.removeItem(r):(n=t.encode64(JSON.stringify(n)),i=e.setItem(r,n)),void 0!==i&&!0!==i.rval){var o=new Error(i.error.message);throw o.id=i.error.id,o.name=i.error.name,o}},c=function(e,r){if(!e)throw new Error("WebStorage not available.");var n=e.getItem(r);if(e.init)if(null===n.rval){if(n.error){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}n=null}else n=n.rval;return null!==n&&(n=JSON.parse(t.decode64(n))),n},l=function(e,t,r,n){var i=c(e,t);null===i&&(i={}),i[r]=n,s(e,t,i)},u=function(e,t,r){var n=c(e,t);return null!==n&&(n=r in n?n[r]:null),n},d=function(e,t,r){var n=c(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),s(e,t,n)}},f=function(e,t){s(e,t,null)},p=function(e,t,r){var n,i=null;void 0===r&&(r=["web","flash"]);var o=!1,a=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(e){a=e}if(o)break}if(!o)throw a;return i};t.setItem=function(e,t,r,n,i){p(l,arguments,i)},t.getItem=function(e,t,r,n){return p(u,arguments,n)},t.removeItem=function(e,t,r,n){p(d,arguments,n)},t.clearItems=function(e,t,r){p(f,arguments,r)},t.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(80!==n.port&&"http"===n.scheme||443!==n.port&&"https"===n.scheme)&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var h=null;t.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i,o,a=r[n].indexOf("=");a>0?(i=r[n].substring(0,a),o=r[n].substring(a+1)):(i=r[n],o=null),i in t||(t[i]=[]),i in Object.prototype||null===o||t[i].push(unescape(o))}return t};return void 0===e?(null===h&&(h="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=h):t=r(e),t},t.parseFragment=function(e){var r=e,n="",i=e.indexOf("?");i>0&&(r=e.substring(0,i),n=e.substring(i+1));var o=r.split("/");return o.length>0&&""===o[0]&&o.shift(),{pathString:r,queryString:n,path:o,query:""===n?{}:t.getQueryVariables(n)}},t.makeRequest=function(e){var r=t.parseFragment(e),n={path:r.pathString,query:r.queryString,getPath:function(e){return void 0===e?r.path:r.path[e]},getQuery:function(e,t){var n;return void 0===e?n=r.query:(n=r.query[e])&&void 0!==t&&(n=n[t]),n},getQueryLast:function(e,t){var r=n.getQuery(e);return r?r[r.length-1]:t}};return n},t.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},t.setPath=function(e,t,r){if("object"==x(e)&&null!==e)for(var n=0,i=t.length;n<i;){var o=t[n++];if(n==i)e[o]=r;else{var a=o in e;(!a||a&&"object"!=x(e[o])||a&&null===e[o])&&(e[o]={}),e=e[o]}}},t.getPath=function(e,t,r){for(var n=0,i=t.length,o=!0;o&&n<i&&"object"==x(e)&&null!==e;){var a=t[n++];(o=a in e)&&(e=e[a])}return o?e:r},t.deletePath=function(e,t){if("object"==x(e)&&null!==e)for(var r=0,n=t.length;r<n;){var i=t[r++];if(r==n)delete e[i];else{if(!(i in e)||"object"!=x(e[i])||null===e[i])break;e=e[i]}}},t.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.format=function(e){for(var t,r,n=/%./g,i=0,o=[],a=0;t=n.exec(e);){(r=e.substring(a,n.lastIndex-2)).length>0&&o.push(r),a=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+s+"?>")}}return o.push(e.substring(a)),o.join("")},t.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,a=void 0===r?",":r,s=void 0===n?".":n,c=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+s:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+s)+(o?a+Math.abs(i-l).toFixed(o).slice(2):"")},t.formatSize=function(e){return e>=1073741824?t.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?t.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?t.formatNumber(e/1024,0)+" KiB":t.formatNumber(e,0)+" bytes"},t.bytesFromIP=function(e){return-1!==e.indexOf(".")?t.bytesFromIPv4(e):-1!==e.indexOf(":")?t.bytesFromIPv6(e):null},t.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var r=t.createBuffer(),n=0;n<e.length;++n){var i=parseInt(e[n],10);if(isNaN(i))return null;r.putByte(i)}return r.getBytes()},t.bytesFromIPv6=function(e){for(var r=0,n=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++r,!0}))).length+r),i=t.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var a=t.hexToBytes(e[o]);a.length<2&&i.putByte(0),i.putBytes(a)}else i.fillWithByte(0,n),n=0;return i.getBytes()},t.bytesToIP=function(e){return 4===e.length?t.bytesToIPv4(e):16===e.length?t.bytesToIPv6(e):null},t.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},t.bytesToIPv6=function(e){if(16!==e.length)return null;for(var r=[],n=[],i=0,o=0;o<e.length;o+=2){for(var a=t.bytesToHex(e[o]+e[o+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=n[n.length-1],c=r.length;s&&c===s.end+1?(s.end=c,s.end-s.start>n[i].end-n[i].start&&(i=n.length-1)):n.push({start:c,end:c})}r.push(a)}if(n.length>0){var l=n[i];l.end-l.start>0&&(r.splice(l.start,l.end-l.start+1,""),0===l.start&&r.unshift(""),7===l.end&&r.push(""))}return r.join(":")},t.estimateCores=function(e,r){if("function"==typeof e&&(r=e,e={}),e=e||{},"cores"in t&&!e.update)return r(null,t.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,r(null,t.cores);if("undefined"==typeof Worker)return t.cores=1,r(null,t.cores);if("undefined"==typeof Blob)return t.cores=2,r(null,t.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(i,o,a){if(0===o){var s=Math.floor(i.reduce((function(e,t){return e+t}),0)/i.length);return t.cores=Math.max(1,s),URL.revokeObjectURL(n),r(null,t.cores)}!function(e,t){for(var r=[],i=[],o=0;o<e;++o){var a=new Worker(n);a.addEventListener("message",(function(n){if(i.push(n.data),i.length===e){for(var o=0;o<e;++o)r[o].terminate();t(null,i)}})),r.push(a)}for(o=0;o<e;++o)r[o].postMessage(o)}(a,(function(t,r){i.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],a=0;a<e;++a)if(n!==a){var s=t[a];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&o.push(a)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(a,r)),e(i,o-1,a)}))}([],5,16)}})),j.cipher=j.cipher||{},j.cipher.algorithms=j.cipher.algorithms||{},j.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=j.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new j.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},j.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=j.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new j.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},j.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),j.cipher.algorithms[e]=t},j.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in j.cipher.algorithms?j.cipher.algorithms[e]:null};var K=j.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};function W(e,t){j.cipher.registerAlgorithm(e,(function(){return new j.aes.Algorithm(e,t)}))}K.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=j.util.createBuffer(),this.output=e.output||j.util.createBuffer(),this.mode.start(t)},K.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},K.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},_((function(e){j.cipher=j.cipher||{};var t=e.exports=j.cipher.modes=j.cipher.modes||{};function r(e,t){if("string"==typeof e&&(e=j.util.createBuffer(e)),j.util.isArray(e)&&e.length>4){var r=e;e=j.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!j.util.isArray(e)){var i=[],o=t/4;for(n=0;n<o;++n)i.push(e.getInt32());e=i}return e}function n(e){e[e.length-1]=e[e.length-1]+1&4294967295}function i(e){return[e/4294967296|0,4294967295&e]}t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;for(o>0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;for(o>0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var o=(this.blockSize-n)%this.blockSize;for(o>0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]);else{var a=(this.blockSize-i)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}n(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=j.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?j.util.createBuffer(e.additionalData):j.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=j.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=r.length();if(12===o)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*o)))}this._inBlock=this._j0.slice(0),n(this._inBlock),this._partialBytes=0,t=j.util.createBuffer(t),this._aDataLength=i(8*t.length());var a=t.length()%this.blockSize;for(a&&t.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-i)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(a<=0||r){if(r){var s=i%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(o=0;o<this._ints;++o)this._outBlock[o]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),n(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var i=e.length();if(i<this.blockSize&&!(r&&i>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^this._hashBlock[o]);i<this.blockSize?this._cipherLength+=i%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=j.util.createBuffer();var n=this._aDataLength.concat(i(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var o=[];this.cipher.encrypt(this._j0,o);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^o[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i)e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),a=0;a<i;++a){var s=[0,0,0,0],c=(n-1-a%n)*t;s[a/n|0]=1<<t-1<<c,o[a]=this.generateSubHashTable(this.multiply(s,e),t)}return o},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var a=1;a<o;++a){var s=i[o],c=i[a];i[o+a]=[s[0]^c[0],s[1]^c[1],s[2]^c[2],s[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var l=i[o^n];i[o]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return i}})),j.aes=j.aes||{},j.aes.startEncrypting=function(e,t,r,n){var i=re({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},j.aes.createEncryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!1,mode:t})},j.aes.startDecrypting=function(e,t,r,n){var i=re({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},j.aes.createDecryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!0,mode:t})},j.aes.Algorithm=function(e,t){Z||J();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return te(r._w,e,t,!1)},decrypt:function(e,t){return te(r._w,e,t,!0)}}}),r._init=!1},j.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(j.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=j.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=j.util.createBuffer(r);if(!j.util.isArray(r)){t=r,r=[];var i=t.length();if(16===i||24===i||32===i)for(i>>>=2,n=0;n<i;++n)r.push(t.getInt32())}if(!j.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=ee(r,e.decrypt&&!a),this._init=!0}},j.aes._expandKey=function(e,t){return Z||J(),ee(e,t)},j.aes._updateBlock=te,W("AES-ECB",j.cipher.modes.ecb),W("AES-CBC",j.cipher.modes.cbc),W("AES-CFB",j.cipher.modes.cfb),W("AES-OFB",j.cipher.modes.ofb),W("AES-CTR",j.cipher.modes.ctr),W("AES-GCM",j.cipher.modes.gcm);var G,Q,X,Y,$,Z=!1;function J(){Z=!0,X=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;for(G=new Array(256),Q=new Array(256),Y=new Array(4),$=new Array(4),t=0;t<4;++t)Y[t]=new Array(256),$[t]=new Array(256);var r,n,i,o,a,s,c,l=0,u=0;for(t=0;t<256;++t){o=(o=u^u<<1^u<<2^u<<3^u<<4)>>8^255&o^99,G[l]=o,Q[o]=l,s=(a=e[o])<<24^o<<16^o<<8^o^a,c=((r=e[l])^(n=e[r])^(i=e[n]))<<24^(l^i)<<16^(l^n^i)<<8^l^r^i;for(var d=0;d<4;++d)Y[d][l]=s,$[d][o]=c,s=s<<24|s>>>8,c=c<<24|c>>>8;0===l?l=u=1:(l=r^e[e[e[r^i]]],u^=e[e[u]])}}function ee(e,t){for(var r,n=e.slice(0),i=1,o=n.length,a=4*(o+6+1),s=o;s<a;++s)r=n[s-1],s%o==0?(r=G[r>>>16&255]<<24^G[r>>>8&255]<<16^G[255&r]<<8^G[r>>>24]^X[i]<<24,i++):o>6&&s%o==4&&(r=G[r>>>24]<<24^G[r>>>16&255]<<16^G[r>>>8&255]<<8^G[255&r]),n[s]=n[s-o]^r;if(t){for(var c,l=$[0],u=$[1],d=$[2],f=$[3],p=n.slice(0),h=(s=0,(a=n.length)-4);s<a;s+=4,h-=4)if(0===s||s===a-4)p[s]=n[h],p[s+1]=n[h+3],p[s+2]=n[h+2],p[s+3]=n[h+1];else for(var m=0;m<4;++m)c=n[h+m],p[s+(3&-m)]=l[G[c>>>24]]^u[G[c>>>16&255]]^d[G[c>>>8&255]]^f[G[255&c]];n=p}return n}function te(e,t,r,n){var i,o,a,s,c,l,u,d,f,p,h,m,g=e.length/4-1;n?(i=$[0],o=$[1],a=$[2],s=$[3],c=Q):(i=Y[0],o=Y[1],a=Y[2],s=Y[3],c=G),l=t[0]^e[0],u=t[n?3:1]^e[1],d=t[2]^e[2],f=t[n?1:3]^e[3];for(var v=3,y=1;y<g;++y)p=i[l>>>24]^o[u>>>16&255]^a[d>>>8&255]^s[255&f]^e[++v],h=i[u>>>24]^o[d>>>16&255]^a[f>>>8&255]^s[255&l]^e[++v],m=i[d>>>24]^o[f>>>16&255]^a[l>>>8&255]^s[255&u]^e[++v],f=i[f>>>24]^o[l>>>16&255]^a[u>>>8&255]^s[255&d]^e[++v],l=p,u=h,d=m;r[0]=c[l>>>24]<<24^c[u>>>16&255]<<16^c[d>>>8&255]<<8^c[255&f]^e[++v],r[n?3:1]=c[u>>>24]<<24^c[d>>>16&255]<<16^c[f>>>8&255]<<8^c[255&l]^e[++v],r[2]=c[d>>>24]<<24^c[f>>>16&255]<<16^c[l>>>8&255]<<8^c[255&u]^e[++v],r[n?1:3]=c[f>>>24]<<24^c[l>>>16&255]<<16^c[u>>>8&255]<<8^c[255&d]^e[++v]}function re(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?j.cipher.createDecipher(r,e.key):j.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof j.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}function ne(e,t){j.cipher.registerAlgorithm(e,(function(){return new j.des.Algorithm(e,t)}))}_((function(e){j.pki=j.pki||{};var t=e.exports=j.pki.oids=j.oids=j.oids||{};function r(e,r){t[e]=r,t[r]=e}function n(e,r){t[e]=r}r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.5","serialName"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),n("2.5.29.1","authorityKeyIdentifier"),n("2.5.29.2","keyAttributes"),n("2.5.29.3","certificatePolicies"),n("2.5.29.4","keyUsageRestriction"),n("2.5.29.5","policyMapping"),n("2.5.29.6","subtreesConstraint"),n("2.5.29.7","subjectAltName"),n("2.5.29.8","issuerAltName"),n("2.5.29.9","subjectDirectoryAttributes"),n("2.5.29.10","basicConstraints"),n("2.5.29.11","nameConstraints"),n("2.5.29.12","policyConstraints"),n("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),n("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),n("2.5.29.20","cRLNumber"),n("2.5.29.21","cRLReason"),n("2.5.29.22","expirationDate"),n("2.5.29.23","instructionCode"),n("2.5.29.24","invalidityDate"),n("2.5.29.25","cRLDistributionPoints"),n("2.5.29.26","issuingDistributionPoint"),n("2.5.29.27","deltaCRLIndicator"),n("2.5.29.28","issuingDistributionPoint"),n("2.5.29.29","certificateIssuer"),n("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),n("2.5.29.33","policyMappings"),n("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),n("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),n("2.5.29.46","freshestCRL"),n("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping")})),_((function(e){var t=e.exports=j.asn1=j.asn1||{};function r(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.create=function(e,r,n,i,o){if(j.util.isArray(i)){for(var a=[],s=0;s<i.length;++s)void 0!==i[s]&&a.push(i[s]);i=a}var c={tagClass:e,type:r,constructed:n,composed:n||j.util.isArray(i),value:i};return o&&"bitStringContents"in o&&(c.bitStringContents=o.bitStringContents,c.original=t.copy(c)),c},t.copy=function(e,r){var n;if(j.util.isArray(e)){n=[];for(var i=0;i<e.length;++i)n.push(t.copy(e[i],r));return n}return"string"==typeof e?e:(n={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:t.copy(e.value,r)},r&&!r.excludeBitStringContents&&(n.bitStringContents=e.bitStringContents),n)},t.equals=function(e,r,n){if(j.util.isArray(e)){if(!j.util.isArray(r))return!1;if(e.length!==r.length)return!1;for(var i=0;i<e.length;++i)if(!t.equals(e[i],r[i]))return!1;return!0}if(x(e)!=x(r))return!1;if("string"==typeof e)return e===r;var o=e.tagClass===r.tagClass&&e.type===r.type&&e.constructed===r.constructed&&e.composed===r.composed&&t.equals(e.value,r.value);return n&&n.includeBitStringContents&&(o=o&&e.bitStringContents===r.bitStringContents),o},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};t.fromDer=function(e,n){return void 0===n&&(n={strict:!0,decodeBitStrings:!0}),"boolean"==typeof n&&(n={strict:n,decodeBitStrings:!0}),"strict"in n||(n.strict=!0),"decodeBitStrings"in n||(n.decodeBitStrings=!0),"string"==typeof e&&(e=j.util.createBuffer(e)),function e(n,i,o,a){var s;r(n,i,2);var c=n.getByte();i--;var l=192&c,u=31&c;s=n.length();var d,f,p=function(e,t){var n=e.getByte();if(t--,128!==n){var i;if(128&n){var o=127&n;r(e,t,o),i=e.getInt(o<<3)}else i=n;if(i<0)throw new Error("Negative length: "+i);return i}}(n,i);if(i-=s-n.length(),void 0!==p&&p>i){if(a.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=n.length(),h.remaining=i,h.requested=p,h}p=i}var m=32==(32&c);if(m)if(d=[],void 0===p)for(;;){if(r(n,i,2),n.bytes(2)===String.fromCharCode(0,0)){n.getBytes(2),i-=2;break}s=n.length(),d.push(e(n,i,o+1,a)),i-=s-n.length()}else for(;p>0;)s=n.length(),d.push(e(n,p,o+1,a)),i-=s-n.length(),p-=s-n.length();if(void 0===d&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(f=n.bytes(p)),void 0===d&&a.decodeBitStrings&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=n.read,v=i,y=0;if(u===t.Type.BITSTRING&&(r(n,i,1),y=n.getByte(),i--),0===y)try{s=n.length();var b=e(n,i,o+1,{verbose:a.verbose,strict:!0,decodeBitStrings:!0}),_=s-n.length();i-=_,u==t.Type.BITSTRING&&_++;var C=b.tagClass;_!==p||C!==t.Class.UNIVERSAL&&C!==t.Class.CONTEXT_SPECIFIC||(d=[b])}catch(e){}void 0===d&&(n.read=g,i=v)}if(void 0===d){if(void 0===p){if(a.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=i}if(u===t.Type.BMPSTRING)for(d="";p>0;p-=2)r(n,i,2),d+=String.fromCharCode(n.getInt16()),i-=2;else d=n.getBytes(p)}var w=void 0===f?null:{bitStringContents:f};return t.create(l,u,m,d,w)}(e,e.length(),0,n)},t.toDer=function(e){var r=j.util.createBuffer(),n=e.tagClass|e.type,i=j.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=t.equals(e,e.original))),o)i.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:i.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&i.putBuffer(t.toDer(e.value[a]))}else if(e.type===t.Type.BMPSTRING)for(a=0;a<e.value.length;++a)i.putInt16(e.value.charCodeAt(a));else e.type===t.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?i.putBytes(e.value.substr(1)):i.putBytes(e.value);if(r.putByte(n),i.length()<=127)r.putByte(127&i.length());else{var s=i.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);for(r.putByte(128|c.length),a=c.length-1;a>=0;--a)r.putByte(c.charCodeAt(a))}return r.putBuffer(i),r},t.oidToDer=function(e){var t,r,n,i,o=e.split("."),a=j.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var s=2;s<o.length;++s){t=!0,r=[],n=parseInt(o[s],10);do{i=127&n,n>>>=7,t||(i|=128),r.push(i),t=!1}while(n>0);for(var c=r.length-1;c>=0;--c)a.putByte(r[c])}return a},t.derToOid=function(e){var t;"string"==typeof e&&(e=j.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(s=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,a,s,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var d=e.length-5,f=e.charAt(d);return"+"!==f&&"-"!==f||(l=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),l*=6e4,"+"===f&&(l*=-1),u=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,a,s,c),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(o,a,s,c)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.integerToDer=function(e){var t=j.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},t.derToInteger=function(e){"string"==typeof e&&(e=j.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},t.validate=function(e,r,n,i){var o=!1;if(e.tagClass!==r.tagClass&&void 0!==r.tagClass||e.type!==r.type&&void 0!==r.type)i&&(e.tagClass!==r.tagClass&&i.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+e.tagClass+'"'),e.type!==r.type&&i.push("["+r.name+'] Expected type "'+r.type+'", got "'+e.type+'"'));else if(e.constructed===r.constructed||void 0===r.constructed){if(o=!0,r.value&&j.util.isArray(r.value))for(var a=0,s=0;o&&s<r.value.length;++s)o=r.value[s].optional||!1,e.value[a]&&((o=t.validate(e.value[a],r.value[s],n,i))?++a:r.value[s].optional&&(o=!0)),!o&&i&&i.push("["+r.name+'] Tag class "'+r.tagClass+'", type "'+r.type+'" expected value length "'+r.value.length+'", got "'+e.value.length+'"');if(o&&n&&(r.capture&&(n[r.capture]=e.value),r.captureAsn1&&(n[r.captureAsn1]=e),r.captureBitStringContents&&"bitStringContents"in e&&(n[r.captureBitStringContents]=e.bitStringContents),r.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)n[r.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[r.captureBitStringValue]=e.bitStringContents.slice(1)}}else i&&i.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+e.constructed+'"');return o};var n=/[^\\u0000-\\u00ff]/;t.prettyPrint=function(e,r,i){var o="";i=i||2,(r=r||0)>0&&(o+="\n");for(var a="",s=0;s<r*i;++s)a+=" ";switch(o+=a+"Tag: ",e.tagClass){case t.Class.UNIVERSAL:o+="Universal:";break;case t.Class.APPLICATION:o+="Application:";break;case t.Class.CONTEXT_SPECIFIC:o+="Context-Specific:";break;case t.Class.PRIVATE:o+="Private:"}if(e.tagClass===t.Class.UNIVERSAL)switch(o+=e.type,e.type){case t.Type.NONE:o+=" (None)";break;case t.Type.BOOLEAN:o+=" (Boolean)";break;case t.Type.INTEGER:o+=" (Integer)";break;case t.Type.BITSTRING:o+=" (Bit string)";break;case t.Type.OCTETSTRING:o+=" (Octet string)";break;case t.Type.NULL:o+=" (Null)";break;case t.Type.OID:o+=" (Object Identifier)";break;case t.Type.ODESC:o+=" (Object Descriptor)";break;case t.Type.EXTERNAL:o+=" (External or Instance of)";break;case t.Type.REAL:o+=" (Real)";break;case t.Type.ENUMERATED:o+=" (Enumerated)";break;case t.Type.EMBEDDED:o+=" (Embedded PDV)";break;case t.Type.UTF8:o+=" (UTF8)";break;case t.Type.ROID:o+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:o+=" (Sequence)";break;case t.Type.SET:o+=" (Set)";break;case t.Type.PRINTABLESTRING:o+=" (Printable String)";break;case t.Type.IA5String:o+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:o+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:o+=" (Generalized time)";break;case t.Type.BMPSTRING:o+=" (BMP String)"}else o+=e.type;if(o+="\n",o+=a+"Constructed: "+e.constructed+"\n",e.composed){var c=0,l="";for(s=0;s<e.value.length;++s)void 0!==e.value[s]&&(c+=1,l+=t.prettyPrint(e.value[s],r+1,i),s+1<e.value.length&&(l+=","));o+=a+"Sub values: "+c+l}else{if(o+=a+"Value: ",e.type===t.Type.OID){var u=t.derToOid(e.value);o+=u,j.pki&&j.pki.oids&&u in j.pki.oids&&(o+=" ("+j.pki.oids[u]+") ")}if(e.type===t.Type.INTEGER)try{o+=t.derToInteger(e.value)}catch(t){o+="0x"+j.util.bytesToHex(e.value)}else if(e.type===t.Type.BITSTRING){if(e.value.length>1?o+="0x"+j.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?o+=" (1 unused bit shown)":d>1&&(o+=" ("+d+" unused bits shown)")}}else e.type===t.Type.OCTETSTRING?(n.test(e.value)||(o+="("+e.value+") "),o+="0x"+j.util.bytesToHex(e.value)):e.type===t.Type.UTF8?o+=j.util.decodeUtf8(e.value):e.type===t.Type.PRINTABLESTRING||e.type===t.Type.IA5String?o+=e.value:n.test(e.value)?o+="0x"+j.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}})),j.md=j.md||{},j.md.algorithms=j.md.algorithms||{},_((function(e){(e.exports=j.hmac=j.hmac||{}).create=function(){var e=null,t=null,r=null,n=null,i={start:function(i,o){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in j.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');t=j.md.algorithms[i].create()}else t=i;if(null===o)o=e;else{if("string"==typeof o)o=j.util.createBuffer(o);else if(j.util.isArray(o)){var a=o;o=j.util.createBuffer();for(var s=0;s<a.length;++s)o.putByte(a[s])}var c=o.length();for(c>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=j.util.createBuffer(),n=j.util.createBuffer(),c=o.length(),s=0;s<c;++s)a=o.at(s),r.putByte(54^a),n.putByte(92^a);if(c<t.blockLength)for(a=t.blockLength-c,s=0;s<a;++s)r.putByte(54),n.putByte(92);e=o,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(n),t.update(e),t.digest()}};return i.digest=i.getMac,i}})),_((function(e){var t=e.exports=j.md5=j.md5||{};j.md.md5=j.md.algorithms.md5=t,t.create=function(){a||function(){r=String.fromCharCode(128),r+=j.util.fillString(String.fromCharCode(0),64),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],i=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],o=new Array(64);for(var e=0;e<64;++e)o[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));a=!0}();var e=null,t=j.util.createBuffer(),c=new Array(16),l={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,n=0;n<r;++n)l.fullMessageLength.push(0);return t=j.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},l}};return l.start(),l.update=function(r,n){"utf8"===n&&(r=j.util.encodeUtf8(r));var i=r.length;l.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=l.fullMessageLength.length-1;o>=0;--o)l.fullMessageLength[o]+=i[1],i[1]=i[0]+(l.fullMessageLength[o]/4294967296>>>0),l.fullMessageLength[o]=l.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(r),s(e,c,t),(t.read>2048||0===t.length())&&t.compact(),l},l.digest=function(){var n=j.util.createBuffer();n.putBytes(t.bytes());var i=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(r.substr(0,l.blockLength-i));for(var o,a=0,u=l.fullMessageLength.length-1;u>=0;--u)a=(o=8*l.fullMessageLength[u]+a)/4294967296>>>0,n.putInt32Le(o>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};s(d,c,n);var f=j.util.createBuffer();return f.putInt32Le(d.h0),f.putInt32Le(d.h1),f.putInt32Le(d.h2),f.putInt32Le(d.h3),f},l};var r=null,n=null,i=null,o=null,a=!1;function s(e,t,r){for(var a,s,c,l,u,d,f,p=r.length();p>=64;){for(s=e.h0,c=e.h1,l=e.h2,u=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),a=s+(u^c&(l^u))+o[f]+t[f],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;for(;f<32;++f)a=s+(l^u&(c^l))+o[f]+t[n[f]],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;for(;f<48;++f)a=s+(c^l^u)+o[f]+t[n[f]],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;for(;f<64;++f)a=s+(l^(c|~u))+o[f]+t[n[f]],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;e.h0=e.h0+s|0,e.h1=e.h1+c|0,e.h2=e.h2+l|0,e.h3=e.h3+u|0,p-=64}}})),_((function(e){var t=e.exports=j.pem=j.pem||{};function r(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var o=0,a=-1;for(i=0;i<t.length;++i,++o)if(o>65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),o=i-a-1,a=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(a=i);return t}function n(e){return e.replace(/^\s+/,"")}t.encode=function(e,t){t=t||{};var n,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=r(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=r(n={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),i+=r(n)),e.headers)for(var o=0;o<e.headers.length;++o)i+=r(e.headers[o]);return e.procType&&(i+="\r\n"),(i+=j.util.encode64(e.body,t.maxline||64)+"\r\n")+"-----END "+e.type+"-----\r\n"},t.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var s={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:j.util.decode64(t[3])};if(r.push(s),t[2]){for(var c=t[2].split(a),l=0;t&&l<c.length;){for(var u=c[l].replace(/\s+$/,""),d=l+1;d<c.length;++d){var f=c[d];if(!/\s/.test(f[0]))break;u+=f,l=d}if(t=u.match(o)){for(var p={name:t[1],values:[]},h=t[2].split(","),m=0;m<h.length;++m)p.values.push(n(h[m]));if(s.procType)if(s.contentDomain||"Content-Domain"!==p.name)if(s.dekInfo||"DEK-Info"!==p.name)s.headers.push(p);else{if(0===p.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');s.dekInfo={algorithm:h[0],parameters:h[1]||null}}else s.contentDomain=h[0]||"";else{if("Proc-Type"!==p.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==p.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');s.procType={version:h[0],type:h[1]}}}++l}if("ENCRYPTED"===s.procType&&!s.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}})),j.des=j.des||{},j.des.startEncrypting=function(e,t,r,n){var i=pe({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},j.des.createEncryptionCipher=function(e,t){return pe({key:e,output:null,decrypt:!1,mode:t})},j.des.startDecrypting=function(e,t,r,n){var i=pe({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},j.des.createDecryptionCipher=function(e,t){return pe({key:e,output:null,decrypt:!0,mode:t})},j.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return fe(r._keys,e,t,!1)},decrypt:function(e,t){return fe(r._keys,e,t,!0)}}}),r._init=!1},j.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=j.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],m=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,v=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,_=0;_<g;_++){var C=e.getInt32(),w=e.getInt32();C^=(t=252645135&(C>>>4^w))<<4,C^=t=65535&((w^=t)>>>-16^C),C^=(t=858993459&(C>>>2^(w^=t<<-16)))<<2,C^=t=65535&((w^=t)>>>-16^C),C^=(t=1431655765&(C>>>1^(w^=t<<-16)))<<1,C^=t=16711935&((w^=t)>>>8^C),t=(C^=(t=1431655765&(C>>>1^(w^=t<<8)))<<1)<<8|(w^=t)>>>20&240,C=w<<24|w<<8&16711680|w>>>8&65280|w>>>24&240,w=t;for(var k=0;k<y.length;++k){y[k]?(C=C<<2|C>>>26,w=w<<2|w>>>26):(C=C<<1|C>>>27,w=w<<1|w>>>27);var S=r[(C&=-15)>>>28]|n[C>>>24&15]|i[C>>>20&15]|o[C>>>16&15]|a[C>>>12&15]|s[C>>>8&15]|c[C>>>4&15],B=l[(w&=-15)>>>28]|u[w>>>24&15]|d[w>>>20&15]|f[w>>>16&15]|p[w>>>12&15]|h[w>>>8&15]|m[w>>>4&15];t=65535&(B>>>16^S),v[b++]=S^t,v[b++]=B^t<<16}}return v}(t),this._init=!0}},ne("DES-ECB",j.cipher.modes.ecb),ne("DES-CBC",j.cipher.modes.cbc),ne("DES-CFB",j.cipher.modes.cfb),ne("DES-OFB",j.cipher.modes.ofb),ne("DES-CTR",j.cipher.modes.ctr),ne("3DES-ECB",j.cipher.modes.ecb),ne("3DES-CBC",j.cipher.modes.cbc),ne("3DES-CFB",j.cipher.modes.cfb),ne("3DES-OFB",j.cipher.modes.ofb),ne("3DES-CTR",j.cipher.modes.ctr);var ie=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],oe=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],ae=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],se=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],ce=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],le=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],ue=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],de=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function fe(e,t,r,n){var i,o,a=32===e.length?3:9;i=3===a?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s=t[0],c=t[1];s^=(o=252645135&(s>>>4^c))<<4,s^=(o=65535&(s>>>16^(c^=o)))<<16,s^=o=858993459&((c^=o)>>>2^s),s^=o=16711935&((c^=o<<2)>>>8^s),s=(s^=(o=1431655765&(s>>>1^(c^=o<<8)))<<1)<<1|s>>>31,c=(c^=o)<<1|c>>>31;for(var l=0;l<a;l+=3){for(var u=i[l+1],d=i[l+2],f=i[l];f!=u;f+=d){var p=c^e[f],h=(c>>>4|c<<28)^e[f+1];o=s,s=c,c=o^(oe[p>>>24&63]|se[p>>>16&63]|le[p>>>8&63]|de[63&p]|ie[h>>>24&63]|ae[h>>>16&63]|ce[h>>>8&63]|ue[63&h])}o=s,s=c,c=o}c=c>>>1|c<<31,c^=o=1431655765&((s=s>>>1|s<<31)>>>1^c),c^=(o=16711935&(c>>>8^(s^=o<<1)))<<8,c^=(o=858993459&(c>>>2^(s^=o)))<<2,c^=o=65535&((s^=o)>>>16^c),c^=o=252645135&((s^=o<<16)>>>4^c),s^=o<<4,r[0]=s,r[1]=c}function pe(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?j.cipher.createDecipher(r,e.key):j.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof j.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}var he,me=j.pkcs5=j.pkcs5||{};j.util.isNodejs&&!j.options.usePureJavaScript&&(he=t),j.pbkdf2=me.pbkdf2=function(e,t,r,n,i,o){if("function"==typeof i&&(o=i,i=null),j.util.isNodejs&&!j.options.usePureJavaScript&&he.pbkdf2&&(null===i||"object"!=x(i))&&(he.pbkdf2Sync.length>4||!i||"sha1"===i))return"string"!=typeof i&&(i="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),o?4===he.pbkdf2Sync.length?he.pbkdf2(e,t,r,n,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):he.pbkdf2(e,t,r,n,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===he.pbkdf2Sync.length?he.pbkdf2Sync(e,t,r,n).toString("binary"):he.pbkdf2Sync(e,t,r,n,i).toString("binary");if(null==i&&(i="sha1"),"string"==typeof i){if(!(i in j.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=j.md[i].create()}var a=i.digestLength;if(n>4294967295*a){var s=new Error("Derived key is too long.");if(o)return o(s);throw s}var c=Math.ceil(n/a),l=n-(c-1)*a,u=j.hmac.create();u.start(i,e);var d,f,p,h="";if(!o){for(var m=1;m<=c;++m){u.start(null,null),u.update(t),u.update(j.util.int32ToBytes(m)),d=p=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(p),f=u.digest().getBytes(),d=j.util.xorBytes(d,f,a),p=f;h+=m<c?d:d.substr(0,l)}return h}function v(){if(m>c)return o(null,h);u.start(null,null),u.update(t),u.update(j.util.int32ToBytes(m)),d=p=u.digest().getBytes(),g=2,y()}function y(){if(g<=r)return u.start(null,null),u.update(p),f=u.digest().getBytes(),d=j.util.xorBytes(d,f,a),p=f,++g,j.util.setImmediate(y);h+=m<c?d:d.substr(0,l),++m,v()}m=1,v()},_((function(e){var t=e.exports=j.sha256=j.sha256||{};j.md.sha256=j.md.algorithms.sha256=t,t.create=function(){n||(r=String.fromCharCode(128),r+=j.util.fillString(String.fromCharCode(0),64),i=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=!0);var e=null,t=j.util.createBuffer(),a=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,n=0;n<r;++n)s.fullMessageLength.push(0);return t=j.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,n){"utf8"===n&&(r=j.util.encodeUtf8(r));var i=r.length;s.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=i[1],i[1]=i[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(r),o(e,a,t),(t.read>2048||0===t.length())&&t.compact(),s},s.digest=function(){var n=j.util.createBuffer();n.putBytes(t.bytes());var i,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;n.putBytes(r.substr(0,s.blockLength-c));for(var l=8*s.fullMessageLength[0],u=0;u<s.fullMessageLength.length-1;++u)l+=(i=8*s.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=i>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};o(d,a,n);var f=j.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},s};var r=null,n=!1,i=null;function o(e,t,r){for(var n,o,a,s,c,l,u,d,f,p,h,m,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,o=((o=t[c-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[c]=n+t[c-7]+o+t[c-16]|0;for(l=e.h0,u=e.h1,d=e.h2,f=e.h3,p=e.h4,h=e.h5,m=e.h6,g=e.h7,c=0;c<64;++c)a=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&u|d&(l^u),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(m^p&(h^m))+i[c]+t[c],g=m,m=h,h=p,p=f+n>>>0,f=d,d=u,u=l,l=n+(o=a+s)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+d|0,e.h3=e.h3+f|0,e.h4=e.h4+p|0,e.h5=e.h5+h|0,e.h6=e.h6+m|0,e.h7=e.h7+g|0,v-=64}}})),_((function(e){var r=null;!j.util.isNodejs||j.options.usePureJavaScript||process.versions["node-webkit"]||(r=t),(e.exports=j.prng=j.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,i=new Array(32),o=0;o<32;++o)i[o]=n.create();function a(){if(t.pools[0].messageLength>=32)return s();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),s()}function s(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null,r=j.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var i=j.util.createBuffer();if(t)for(;i.length()<e;){var o=Math.max(1,Math.min(e-i.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var s=0;s<a.length;++s)i.putInt32(a[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(i.length()<e)for(var c,l,u,d=Math.floor(65536*Math.random());i.length()<e;)for(l=16807*(65535&d),l+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(l=(2147483647&(l+=c>>15))+(l>>31)),s=0;s<3;++s)u=d>>>(s<<3),u^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&u));return i.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,c=j.util.createBuffer();t.key=null,function l(u){if(u)return r(u);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return j.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return s(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),s(),e()}))}(l)}));var d=n(t.key,t.seed);t.generated+=d.length,c.putBytes(d),t.key=o(n(t.key,i(t.seed))),t.seed=a(n(t.key,t.seed)),j.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,i=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var s=j.util.createBuffer();s.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var c=r(t.key,t.seed);t.generated+=c.length,s.putBytes(c),t.key=i(r(t.key,n(t.seed))),t.seed=o(r(t.key,t.seed))}return s.getBytes(e)},r?(t.seedFile=function(e,t){r.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return r.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))},t}})),_((function(e){j.random&&j.random.getBytes?e.exports=j.random:function(t){var r={},n=new Array(4),i=j.util.createBuffer();function o(){var e=j.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=j.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),j.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=j.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return j.aes._updateBlock(e,t,n,!1),i.putInt32(n[0]),i.putInt32(n[1]),i.putInt32(n[2]),i.putInt32(n[3]),i.getBytes()},r.increment=function(e){return++e[3],e},r.md=j.md.sha256;var a=o(),s=null,c=j.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(s=function(e){return l.getRandomValues(e)}),!j.util.isNodejs&&!s){if(a.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var d in navigator)try{"string"==typeof navigator[d]&&(u+=navigator[d])}catch(e){}a.collect(u),u=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(j.random)for(var d in a)j.random[d]=a[d];else j.random=a;j.random.createInstance=o,e.exports=j.random}("undefined"!=typeof jQuery?jQuery:null)}));var ge=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],ye=[1,2,3,5],be=function(e,t){return e<<t&65535|(65535&e)>>16-t},_e=function(e,t){return(65535&e)>>t|e<<16-t&65535};j.rc2=j.rc2||{},j.rc2.expandKey=function(e,t){"string"==typeof e&&(e=j.util.createBuffer(e)),t=t||128;var r,n=e,i=e.length(),o=t,a=Math.ceil(o/8),s=255>>(7&o);for(r=i;r<128;r++)n.putByte(ge[n.at(r-1)+n.at(r-i)&255]);for(n.setAt(128-a,ge[n.at(128-a)&s]),r=127-a;r>=0;r--)n.setAt(r,ge[n.at(r+1)^n.at(r+a)]);return n};var Ce,we=function(e,t,r){var n,i,o,a,s=!1,c=null,l=null,u=null,d=[];for(e=j.rc2.expandKey(e,t),o=0;o<64;o++)d.push(e.getInt16Le());r?(n=function(e){for(o=0;o<4;o++)e[o]+=d[a]+(e[(o+3)%4]&e[(o+2)%4])+(~e[(o+3)%4]&e[(o+1)%4]),e[o]=be(e[o],ye[o]),a++},i=function(e){for(o=0;o<4;o++)e[o]+=d[63&e[(o+3)%4]]}):(n=function(e){for(o=3;o>=0;o--)e[o]=_e(e[o],ye[o]),e[o]-=d[a]+(e[(o+3)%4]&e[(o+2)%4])+(~e[(o+3)%4]&e[(o+1)%4]),a--},i=function(e){for(o=3;o>=0;o--)e[o]-=d[63&e[(o+3)%4]]});var f=function(e){var t=[];for(o=0;o<4;o++){var n=c.getInt16Le();null!==u&&(r?n^=u.getInt16Le():u.putInt16Le(n)),t.push(65535&n)}a=r?0:63;for(var i=0;i<e.length;i++)for(var s=0;s<e[i][0];s++)e[i][1](t);for(o=0;o<4;o++)null!==u&&(r?u.putInt16Le(t[o]):t[o]^=u.getInt16Le()),l.putInt16Le(t[o])},p=null;return p={start:function(e,t){e&&"string"==typeof e&&(e=j.util.createBuffer(e)),s=!1,c=j.util.createBuffer(),l=t||new j.util.createBuffer,u=e,p.output=l},update:function(e){for(s||c.putBuffer(e);c.length()>=8;)f([[5,n],[1,i],[6,n],[1,i],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,c,!r);else{var n=8===c.length()?8:8-c.length();c.fillWithByte(n,n)}if(t&&(s=!0,p.update()),!r&&(t=0===c.length()))if(e)t=e(8,l,!r);else{var i=l.length(),o=l.at(i-1);o>i?t=!1:l.truncate(o)}return t}}};function ke(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function Se(){return new ke(null)}function Be(e,t,r,n,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=s*c+l*a;i=((c=a*c+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+s*l,r.data[n++]=268435455&c}return i}j.rc2.startEncrypting=function(e,t,r){var n=j.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},j.rc2.createEncryptionCipher=function(e,t){return we(e,t,!0)},j.rc2.startDecrypting=function(e,t,r){var n=j.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},j.rc2.createDecryptionCipher=function(e,t){return we(e,t,!1)},j.jsbn=j.jsbn||{},j.jsbn.BigInteger=ke,"undefined"==typeof navigator?(ke.prototype.am=Be,Ce=28):"Microsoft Internet Explorer"==navigator.appName?(ke.prototype.am=function(e,t,r,n,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=s*c+l*a;i=((c=a*c+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+s*l+(i>>>30),r.data[n++]=1073741823&c}return i},Ce=30):"Netscape"!=navigator.appName?(ke.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var a=t*this.data[e++]+r.data[n]+i;i=Math.floor(a/67108864),r.data[n++]=67108863&a}return i},Ce=26):(ke.prototype.am=Be,Ce=28),ke.prototype.DB=Ce,ke.prototype.DM=(1<<Ce)-1,ke.prototype.DV=1<<Ce,ke.prototype.FV=Math.pow(2,52),ke.prototype.F1=52-Ce,ke.prototype.F2=2*Ce-52;var Ee,Ie,Ae=new Array;for(Ee="0".charCodeAt(0),Ie=0;Ie<=9;++Ie)Ae[Ee++]=Ie;for(Ee="a".charCodeAt(0),Ie=10;Ie<36;++Ie)Ae[Ee++]=Ie;for(Ee="A".charCodeAt(0),Ie=10;Ie<36;++Ie)Ae[Ee++]=Ie;function xe(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Te(e,t){var r=Ae[e.charCodeAt(t)];return null==r?-1:r}function Pe(e){var t=Se();return t.fromInt(e),t}function Re(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function De(e){this.m=e}function Le(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Ne(e,t){return e&t}function Oe(e,t){return e|t}function Fe(e,t){return e^t}function Me(e,t){return e&~t}function Ve(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ue(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function je(){}function ze(e){return e}function qe(e){this.r2=Se(),this.q3=Se(),ke.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}De.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},De.prototype.revert=function(e){return e},De.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},De.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},De.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Le.prototype.convert=function(e){var t=Se();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ke.ZERO)>0&&this.m.subTo(t,t),t},Le.prototype.revert=function(e){var t=Se();return e.copyTo(t),this.reduce(t),t},Le.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},Le.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Le.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},ke.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},ke.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},ke.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var a=8==r?255&e[n]:Te(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&ke.ZERO.subTo(this,this)},ke.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},ke.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},ke.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},ke.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+a+1]=this.data[r]>>i|s,s=(this.data[r]&o)<<n;for(r=a-1;r>=0;--r)t.data[r]=0;t.data[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},ke.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var a=r+1;a<this.t;++a)t.data[a-r-1]|=(this.data[a]&o)<<i,t.data[a-r]=this.data[a]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},ke.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},ke.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&ke.ZERO.subTo(t,t)},ke.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},ke.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=Se());var o=Se(),a=this.s,s=e.s,c=this.DB-Re(n.data[n.t-1]);c>0?(n.lShiftTo(c,o),i.lShiftTo(c,r)):(n.copyTo(o),i.copyTo(r));var l=o.t,u=o.data[l-1];if(0!=u){var d=u*(1<<this.F1)+(l>1?o.data[l-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,h=1<<this.F2,m=r.t,g=m-l,v=null==t?Se():t;for(o.dlShiftTo(g,v),r.compareTo(v)>=0&&(r.data[r.t++]=1,r.subTo(v,r)),ke.ONE.dlShiftTo(l,v),v.subTo(o,o);o.t<l;)o.data[o.t++]=0;for(;--g>=0;){var y=r.data[--m]==u?this.DM:Math.floor(r.data[m]*f+(r.data[m-1]+h)*p);if((r.data[m]+=o.am(0,y,r,g,0,l))<y)for(o.dlShiftTo(g,v),r.subTo(v,r);r.data[m]<--y;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),a!=s&&ke.ZERO.subTo(t,t)),r.t=l,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&ke.ZERO.subTo(r,r)}}},ke.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},ke.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},ke.prototype.exp=function(e,t){if(e>4294967295||e<1)return ke.ONE;var r=Se(),n=Se(),i=t.convert(this),o=Re(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var a=r;r=n,n=a}return t.revert(r)},ke.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this.data[a]>>s)>0&&(i=!0,o=xe(r));a>=0;)s<t?(r=(this.data[a]&(1<<s)-1)<<t-s,r|=this.data[--a]>>(s+=this.DB-t)):(r=this.data[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(i=!0),i&&(o+=xe(r));return i?o:"0"},ke.prototype.negate=function(){var e=Se();return ke.ZERO.subTo(this,e),e},ke.prototype.abs=function(){return this.s<0?this.negate():this},ke.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},ke.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Re(this.data[this.t-1]^this.s&this.DM)},ke.prototype.mod=function(e){var t=Se();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ke.ZERO)>0&&e.subTo(t,t),t},ke.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new De(t):new Le(t),this.exp(e,r)},ke.ZERO=Pe(0),ke.ONE=Pe(1),je.prototype.convert=ze,je.prototype.revert=ze,je.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},je.prototype.sqrTo=function(e,t){e.squareTo(t)},qe.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Se();return e.copyTo(t),this.reduce(t),t},qe.prototype.revert=function(e){return e},qe.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},qe.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},qe.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var He=[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],Ke=(1<<26)/He[He.length-1];if(ke.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},ke.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Pe(r),i=Se(),o=Se(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},ke.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,a=0,s=0;s<e.length;++s){var c=Te(e,s);c<0?"-"==e.charAt(s)&&0==this.signum()&&(i=!0):(a=t*a+c,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&ke.ZERO.subTo(this,this)},ke.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(ke.ONE.shiftLeft(e-1),Oe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(ke.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},ke.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},ke.prototype.changeBit=function(e,t){var r=ke.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},ke.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},ke.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},ke.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},ke.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},ke.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},ke.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},ke.prototype.millerRabin=function(e){var t=this.subtract(ke.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new ke(this.bitLength(),o)}while(n.compareTo(ke.ONE)<=0||n.compareTo(t)>=0);var s=n.modPow(i,this);if(0!=s.compareTo(ke.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(ke.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},ke.prototype.clone=function(){var e=Se();return this.copyTo(e),e},ke.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},ke.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},ke.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},ke.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},ke.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},ke.prototype.equals=function(e){return 0==this.compareTo(e)},ke.prototype.min=function(e){return this.compareTo(e)<0?this:e},ke.prototype.max=function(e){return this.compareTo(e)>0?this:e},ke.prototype.and=function(e){var t=Se();return this.bitwiseTo(e,Ne,t),t},ke.prototype.or=function(e){var t=Se();return this.bitwiseTo(e,Oe,t),t},ke.prototype.xor=function(e){var t=Se();return this.bitwiseTo(e,Fe,t),t},ke.prototype.andNot=function(e){var t=Se();return this.bitwiseTo(e,Me,t),t},ke.prototype.not=function(){for(var e=Se(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},ke.prototype.shiftLeft=function(e){var t=Se();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},ke.prototype.shiftRight=function(e){var t=Se();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},ke.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+Ve(this.data[e]);return this.s<0?this.t*this.DB:-1},ke.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Ue(this.data[r]^t);return e},ke.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},ke.prototype.setBit=function(e){return this.changeBit(e,Oe)},ke.prototype.clearBit=function(e){return this.changeBit(e,Me)},ke.prototype.flipBit=function(e){return this.changeBit(e,Fe)},ke.prototype.add=function(e){var t=Se();return this.addTo(e,t),t},ke.prototype.subtract=function(e){var t=Se();return this.subTo(e,t),t},ke.prototype.multiply=function(e){var t=Se();return this.multiplyTo(e,t),t},ke.prototype.divide=function(e){var t=Se();return this.divRemTo(e,t,null),t},ke.prototype.remainder=function(e){var t=Se();return this.divRemTo(e,null,t),t},ke.prototype.divideAndRemainder=function(e){var t=Se(),r=Se();return this.divRemTo(e,t,r),new Array(t,r)},ke.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),o=Pe(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new De(t):t.isEven()?new qe(t):new Le(t);var a=new Array,s=3,c=r-1,l=(1<<r)-1;if(a[1]=n.convert(this),r>1){var u=Se();for(n.sqrTo(a[1],u);s<=l;)a[s]=Se(),n.mulTo(u,a[s-2],a[s]),s+=2}var d,f,p=e.t-1,h=!0,m=Se();for(i=Re(e.data[p])-1;p>=0;){for(i>=c?d=e.data[p]>>i-c&l:(d=(e.data[p]&(1<<i+1)-1)<<c-i,p>0&&(d|=e.data[p-1]>>this.DB+i-c)),s=r;0==(1&d);)d>>=1,--s;if((i-=s)<0&&(i+=this.DB,--p),h)a[d].copyTo(o),h=!1;else{for(;s>1;)n.sqrTo(o,m),n.sqrTo(m,o),s-=2;s>0?n.sqrTo(o,m):(f=o,o=m,m=f),n.mulTo(m,a[d],o)}for(;p>=0&&0==(e.data[p]&1<<i);)n.sqrTo(o,m),f=o,o=m,m=f,--i<0&&(i=this.DB-1,--p)}return n.revert(o)},ke.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return ke.ZERO;for(var r=e.clone(),n=this.clone(),i=Pe(1),o=Pe(0),a=Pe(0),s=Pe(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&s.isEven()||(a.addTo(this,a),s.subTo(e,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(s,o)):(n.subTo(r,n),t&&a.subTo(i,a),s.subTo(o,s))}return 0!=n.compareTo(ke.ONE)?ke.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},ke.prototype.pow=function(e){return this.exp(e,new je)},ke.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},ke.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=He[He.length-1]){for(t=0;t<He.length;++t)if(r.data[0]==He[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<He.length;){for(var n=He[t],i=t+1;i<He.length&&n<Ke;)n*=He[i++];for(n=r.modInt(n);t<i;)if(n%He[t++]==0)return!1}return r.millerRabin(e)},_((function(e){var t=e.exports=j.sha1=j.sha1||{};j.md.sha1=j.md.algorithms.sha1=t,t.create=function(){n||(r=String.fromCharCode(128),r+=j.util.fillString(String.fromCharCode(0),64),n=!0);var e=null,t=j.util.createBuffer(),o=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=j.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(r,n){"utf8"===n&&(r=j.util.encodeUtf8(r));var s=r.length;a.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=s[1],s[1]=s[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(r),i(e,o,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=j.util.createBuffer();n.putBytes(t.bytes());var s,c=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;n.putBytes(r.substr(0,a.blockLength-c));for(var l=8*a.fullMessageLength[0],u=0;u<a.fullMessageLength.length-1;++u)l+=(s=8*a.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=s>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};i(d,o,n);var f=j.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},a};var r=null,n=!1;function i(e,t,r){for(var n,i,o,a,s,c,l,u=r.length();u>=64;){for(i=e.h0,o=e.h1,a=e.h2,s=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(o^a^s)+c+1859775393+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^a^s)+c+1859775393+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o&a|s&(o^a))+c+2400959708+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^a^s)+c+3395469782+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,e.h4=e.h4+c|0,u-=64}}})),_((function(e){var t=e.exports=j.pkcs1=j.pkcs1||{};function r(e,t,r){r||(r=j.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),o=0;o<i;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),n+=r.digest().getBytes()}return n.substring(0,t)}t.encode_rsa_oaep=function(e,t,n){var i,o,a,s;"string"==typeof n?(i=n,o=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,o=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(s=n.mgf1.md)),a?a.start():a=j.md.sha1.create(),s||(s=a);var c=Math.ceil(e.n.bitLength()/8),l=c-2*a.digestLength-2;if(t.length>l)throw(h=new Error("RSAES-OAEP input message length is too long.")).length=t.length,h.maxLength=l,h;i||(i=""),a.update(i,"raw");for(var u=a.digest(),d="",f=l-t.length,p=0;p<f;p++)d+="\0";var h,m=u.getBytes()+d+""+t;if(o){if(o.length!==a.digestLength)throw(h=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,h.digestLength=a.digestLength,h}else o=j.random.getBytes(a.digestLength);var g=r(o,c-a.digestLength-1,s),v=j.util.xorBytes(m,g,m.length),y=r(v,a.digestLength,s);return"\0"+j.util.xorBytes(o,y,o.length)+v},t.decode_rsa_oaep=function(e,t,n){var i,o,a;"string"==typeof n?(i=n,o=arguments[3]||void 0):n&&(i=n.label||void 0,o=n.md||void 0,n.mgf1&&n.mgf1.md&&(a=n.mgf1.md));var s=Math.ceil(e.n.bitLength()/8);if(t.length!==s)throw(g=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,g.expectedLength=s,g;if(void 0===o?o=j.md.sha1.create():o.start(),a||(a=o),s<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),o.update(i,"raw");for(var c=o.digest().getBytes(),l=t.charAt(0),u=t.substring(1,o.digestLength+1),d=t.substring(1+o.digestLength),f=r(d,o.digestLength,a),p=r(j.util.xorBytes(u,f,u.length),s-o.digestLength-1,a),h=j.util.xorBytes(d,p,d.length),m=h.substring(0,o.digestLength),g="\0"!==l,v=0;v<o.digestLength;++v)g|=c.charAt(v)!==m.charAt(v);for(var y=1,b=o.digestLength,_=o.digestLength;_<h.length;_++){var C=h.charCodeAt(_);g|=C&(y?65534:0),b+=y&=1&C^1}if(g||1!==h.charCodeAt(b))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)}})),_((function(e){!function(){if(j.prime)e.exports=j.prime;else{var t=e.exports=j.prime=j.prime||{},r=j.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],i=new r(null);i.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={});var i=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||j.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return function(e,t,n,i){return"workers"in n?function(e,t,n,i){if("undefined"==typeof Worker)return a(e,t,n,i);var o=s(e,t),c=n.workers,l=n.workLoad||100,u=30*l/8,d=n.workerScript||"forge/prime.worker.js";if(-1===c)return j.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],a=0;a<c;++a)n[a]=new Worker(d);for(a=0;a<c;++a)n[a].addEventListener("message",p);var f=!1;function p(a){if(!f){var c=a.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return f=!0,i(null,new r(c.prime,16))}o.bitLength()>e&&(o=s(e,t));var p=o.toString(16);a.target.postMessage({hex:p,workLoad:l}),o.dAddOffset(u,0)}}}f()}(e,t,n,i):a(e,t,n,i)}(e,c,i.options,n);throw new Error("Invalid prime generation algorithm: "+i.name)}}function a(e,t,r,i){var o=s(e,t),a=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(o.bitLength());"millerRabinTests"in r&&(a=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),function e(t,r,i,o,a,c,l){var u=+new Date;do{if(t.bitLength()>r&&(t=s(r,i)),t.isProbablePrime(a))return l(null,t);t.dAddOffset(n[o++%8],0)}while(c<0||+new Date-u<c);j.util.setImmediate((function(){e(t,r,i,o,a,c,l)}))}(o,e,t,0,a,c,i)}function s(e,t){var n=new r(e,t),a=e-1;return n.testBit(a)||n.bitwiseTo(r.ONE.shiftLeft(a),o,n),n.dAddOffset(31-n.mod(i).byteValue(),0),n}}()})),void 0===We)var We=j.jsbn.BigInteger;var Ge=j.util.isNodejs?t:null,Qe=j.asn1,Xe=j.util;j.pki=j.pki||{},j.pki.rsa=j.rsa=j.rsa||{};var Ye=j.pki,$e=[6,4,2,4,2,4,6,2],Ze={name:"PrivateKeyInfo",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Je={name:"RSAPrivateKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},et={name:"RSAPublicKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},tt=j.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},rt=function(e){var t;if(!(e.algorithm in Ye.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=Ye.oids[e.algorithm];var n=Qe.oidToDer(t).getBytes(),i=Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[]),o=Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[]);o.value.push(Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OID,!1,n)),o.value.push(Qe.create(Qe.Class.UNIVERSAL,Qe.Type.NULL,!1,""));var a=Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),Qe.toDer(i).getBytes()},nt=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var n;t.dP||(t.dP=t.d.mod(t.p.subtract(We.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(We.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{n=new We(j.util.bytesToHex(j.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(We.ONE));for(var i=(e=e.multiply(n.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(o)<0;)i=i.add(t.p);return i.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o).multiply(n.modInverse(t.n)).mod(t.n)};function it(e,t,r){var n=j.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=i-11,o}n.putByte(0),n.putByte(r);var a,s=i-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var c=0;c<s;++c)n.putByte(a)}else for(;s>0;){var l=0,u=j.random.getBytes(s);for(c=0;c<s;++c)0===(a=u.charCodeAt(c))?++l:n.putByte(a);s=l}return n.putByte(0),n.putBytes(e),n}function ot(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),o=j.util.createBuffer(e),a=o.getByte(),s=o.getByte();if(0!==a||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=i-3-n;for(var l=0;l<c;++l)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++c}else if(2===s)for(c=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++c}if(0!==o.getByte()||c!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function at(e,t,r){"function"==typeof t&&(r=t,t={});var n={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function i(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?a(t,e.q):void o(e.qBits,a))}))}function o(e,t){j.prime.generateProbablePrime(e,n,t)}function a(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(We.ONE).gcd(e.e).compareTo(We.ONE))return e.p=null,void i();if(0!==e.q.subtract(We.ONE).gcd(e.e).compareTo(We.ONE))return e.q=null,void o(e.qBits,a);if(e.p1=e.p.subtract(We.ONE),e.q1=e.q.subtract(We.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(We.ONE))return e.p=e.q=null,void i();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,a);var c=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(n.prng=t.prng),i()}function st(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=j.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function ct(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function lt(e){return j.util.isNodejs&&"function"==typeof Ge[e]}function ut(e){return void 0!==Xe.globalScope&&"object"==x(Xe.globalScope.crypto)&&"object"==x(Xe.globalScope.crypto.subtle)&&"function"==typeof Xe.globalScope.crypto.subtle[e]}function dt(e){return void 0!==Xe.globalScope&&"object"==x(Xe.globalScope.msCrypto)&&"object"==x(Xe.globalScope.msCrypto.subtle)&&"function"==typeof Xe.globalScope.msCrypto.subtle[e]}function ft(e){for(var t=j.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}if(Ye.rsa.encrypt=function(e,t,r){var n,i=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,n=it(e,t,r)):(n=j.util.createBuffer()).putBytes(e);for(var a=new We(n.toHex(),16),s=nt(a,t,i).toString(16),c=j.util.createBuffer(),l=o-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(j.util.hexToBytes(s)),c.getBytes()},Ye.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=i,o}var a=new We(j.util.createBuffer(e).toHex(),16);if(a.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=nt(a,t,r).toString(16),c=j.util.createBuffer(),l=i-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(j.util.hexToBytes(s)),!1!==n?ot(c.getBytes(),t,r):c.getBytes()},Ye.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var n,i=(r=r||{}).prng||j.random,o={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},a=r.algorithm||"PRIMEINC";if("PRIMEINC"!==a)throw new Error("Invalid key generation algorithm: "+a);return(n={algorithm:a,state:0,bits:e,rng:o,eInt:t||65537,e:new We(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(n.eInt),n},Ye.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new We(null);r.fromInt(30);for(var n,i=0,o=function(e,t){return e|t},a=+new Date,s=0;null===e.keys&&(t<=0||s<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new We(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(We.ONE.shiftLeft(l),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),i=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(ct(e.num.bitLength()))?++e.pqState:e.num.dAddOffset($e[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(We.ONE).gcd(e.e).compareTo(We.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(We.ONE),e.q1=e.q.subtract(We.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(We.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var u=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)}}s+=(n=+new Date)-a,a=n}return null!==e.keys},Ye.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==x(e)?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(lt("generateKeyPair"))return Ge.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:Ye.privateKeyFromPem(r),publicKey:Ye.publicKeyFromPem(t)})}));if(ut("generateKey")&&ut("exportKey"))return Xe.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return Xe.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=Ye.privateKeyFromAsn1(Qe.fromDer(j.util.createBuffer(e)));n(null,{privateKey:t,publicKey:Ye.setRsaPublicKey(t.n,t.e)})}}));if(dt("generateKey")&&dt("exportKey")){var i=Xe.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return i.oncomplete=function(e){var t=e.target.result,r=Xe.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=Ye.privateKeyFromAsn1(Qe.fromDer(j.util.createBuffer(t)));n(null,{privateKey:r,publicKey:Ye.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(i.onerror=function(e){n(e)})}}else if(lt("generateKeyPairSync")){var o=Ge.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Ye.privateKeyFromPem(o.privateKey),publicKey:Ye.publicKeyFromPem(o.publicKey)}}var a=Ye.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Ye.rsa.stepKeyPairGenerationState(a,0),a.keys;at(a,r,n)},Ye.setRsaPublicKey=Ye.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return it(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return j.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return Ye.rsa.encrypt(i,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=ot(t,r,!0),e===Qe.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===ot(t,r,!0)}});var i=Ye.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},Ye.setRsaPrivateKey=Ye.rsa.setPrivateKey=function(e,t,r,n,i,o,a,s){var c={n:e,e:t,d:r,p:n,q:i,dP:o,dQ:a,qInv:s,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=Ye.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:ot};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return j.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:rt},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return Ye.rsa.encrypt(n,c,r)}};return c},Ye.wrapRsaPrivateKey=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,Qe.integerToDer(0).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OID,!1,Qe.oidToDer(Ye.oids.rsaEncryption).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.NULL,!1,"")]),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OCTETSTRING,!1,Qe.toDer(e).getBytes())])},Ye.privateKeyFromAsn1=function(e){var t,r,n,i,o,a,s,c,l={},u=[];if(Qe.validate(e,Ze,l,u)&&(e=Qe.fromDer(j.util.createBuffer(l.privateKey))),l={},u=[],!Qe.validate(e,Je,l,u)){var d=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw d.errors=u,d}return t=j.util.createBuffer(l.privateKeyModulus).toHex(),r=j.util.createBuffer(l.privateKeyPublicExponent).toHex(),n=j.util.createBuffer(l.privateKeyPrivateExponent).toHex(),i=j.util.createBuffer(l.privateKeyPrime1).toHex(),o=j.util.createBuffer(l.privateKeyPrime2).toHex(),a=j.util.createBuffer(l.privateKeyExponent1).toHex(),s=j.util.createBuffer(l.privateKeyExponent2).toHex(),c=j.util.createBuffer(l.privateKeyCoefficient).toHex(),Ye.setRsaPrivateKey(new We(t,16),new We(r,16),new We(n,16),new We(i,16),new We(o,16),new We(a,16),new We(s,16),new We(c,16))},Ye.privateKeyToAsn1=Ye.privateKeyToRSAPrivateKey=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,Qe.integerToDer(0).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.n)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.e)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.d)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.p)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.q)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.dP)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.dQ)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.qInv))])},Ye.publicKeyFromAsn1=function(e){var t={},r=[];if(Qe.validate(e,tt,t,r)){var n,i=Qe.derToOid(t.publicKeyOid);if(i!==Ye.oids.rsaEncryption)throw(n=new Error("Cannot read public key. Unknown OID.")).oid=i,n;e=t.rsaPublicKey}if(r=[],!Qe.validate(e,et,t,r))throw(n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,n;var o=j.util.createBuffer(t.publicKeyModulus).toHex(),a=j.util.createBuffer(t.publicKeyExponent).toHex();return Ye.setRsaPublicKey(new We(o,16),new We(a,16))},Ye.publicKeyToAsn1=Ye.publicKeyToSubjectPublicKeyInfo=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OID,!1,Qe.oidToDer(Ye.oids.rsaEncryption).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.NULL,!1,"")]),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.BITSTRING,!1,[Ye.publicKeyToRSAPublicKey(e)])])},Ye.publicKeyToRSAPublicKey=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.n)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.e))])},void 0===pt)var pt=j.jsbn.BigInteger;var ht=j.asn1,mt=j.pki=j.pki||{},gt=(mt.pbe=j.pbe=j.pbe||{},mt.oids),vt={name:"EncryptedPrivateKeyInfo",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},yt={name:"PBES2Algorithms",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bt={name:"pkcs-12PbeParams",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"iterations"}]};function _t(e,t){return e.start().update(t).digest().getBytes()}function Ct(e){var t;if(e){if(!(t=mt.oids[ht.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return wt(t)}function wt(e){var t=j.md;switch(e){case"hmacWithSHA224":t=j.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}mt.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,i,o,a=j.random.getBytesSync(r.saltSize),s=r.count,c=ht.integerToDer(s);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var l,u,d;switch(r.algorithm){case"aes128":n=16,l=16,u=gt["aes128-CBC"],d=j.aes.createEncryptionCipher;break;case"aes192":n=24,l=16,u=gt["aes192-CBC"],d=j.aes.createEncryptionCipher;break;case"aes256":n=32,l=16,u=gt["aes256-CBC"],d=j.aes.createEncryptionCipher;break;case"des":n=8,l=8,u=gt.desCBC,d=j.des.createEncryptionCipher;break;default:throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v}var f="hmacWith"+r.prfAlgorithm.toUpperCase(),p=wt(f),h=j.pkcs5.pbkdf2(t,a,s,n,p),m=j.random.getBytesSync(l);(y=d(h)).start(m),y.update(ht.toDer(e)),y.finish(),o=y.output.getBytes();var g=function(e,t,r,n){var i=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,e),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&i.value.push(ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,j.util.hexToBytes(r.toString(16))),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(mt.oids[n]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.NULL,!1,"")])),i}(a,c,n,f);i=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBES2).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBKDF2).getBytes()),g]),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(u).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,m)])])])}else{var v;if("3des"!==r.algorithm)throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v;n=24;var y,b=new j.util.ByteBuffer(a);h=mt.pbe.generatePkcs12Key(t,b,1,s,n),m=mt.pbe.generatePkcs12Key(t,b,2,s,n),(y=j.des.createEncryptionCipher(h)).start(m),y.update(ht.toDer(e)),y.finish(),o=y.output.getBytes(),i=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,a),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,c.getBytes())])])}return ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[i,ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,o)])},mt.decryptPrivateKeyInfo=function(e,t){var r=null,n={},i=[];if(!ht.validate(e,vt,n,i)){var o=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var a=ht.derToOid(n.encryptionOid),s=mt.pbe.getCipher(a,n.encryptionParams,t),c=j.util.createBuffer(n.encryptedData);return s.update(c),s.finish()&&(r=ht.fromDer(s.output)),r},mt.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:ht.toDer(e).getBytes()};return j.pem.encode(r,{maxline:t})},mt.encryptedPrivateKeyFromPem=function(e){var t=j.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return ht.fromDer(t.body)},mt.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var n=mt.wrapRsaPrivateKey(mt.privateKeyToAsn1(e));return n=mt.encryptPrivateKeyInfo(n,t,r),mt.encryptedPrivateKeyToPem(n)}var i,o,a,s;switch(r.algorithm){case"aes128":i="AES-128-CBC",a=16,o=j.random.getBytesSync(16),s=j.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",a=24,o=j.random.getBytesSync(16),s=j.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",a=32,o=j.random.getBytesSync(16),s=j.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",a=24,o=j.random.getBytesSync(8),s=j.des.createEncryptionCipher;break;case"des":i="DES-CBC",a=8,o=j.random.getBytesSync(8),s=j.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var l=s(j.pbe.opensslDeriveBytes(t,o.substr(0,8),a));l.start(o),l.update(ht.toDer(mt.privateKeyToAsn1(e))),l.finish();var u={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:j.util.bytesToHex(o).toUpperCase()},body:l.output.getBytes()};return j.pem.encode(u)},mt.decryptRsaPrivateKey=function(e,t){var r=null,n=j.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type)throw(a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=a,a;if(n.procType&&"ENCRYPTED"===n.procType.type){var i,o;switch(n.dekInfo.algorithm){case"DES-CBC":i=8,o=j.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,o=j.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,o=j.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,o=j.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,o=j.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,o=function(e){return j.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":i=8,o=function(e){return j.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":i=16,o=function(e){return j.rc2.createDecryptionCipher(e,128)};break;default:var a;throw(a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".')).algorithm=n.dekInfo.algorithm,a}var s=j.util.hexToBytes(n.dekInfo.parameters),c=o(j.pbe.opensslDeriveBytes(t,s.substr(0,8),i));if(c.start(s),c.update(j.util.createBuffer(n.body)),!c.finish())return r;r=c.output.getBytes()}else r=n.body;return null!==(r="ENCRYPTED PRIVATE KEY"===n.type?mt.decryptPrivateKeyInfo(ht.fromDer(r),t):ht.fromDer(r))&&(r=mt.privateKeyFromAsn1(r)),r},mt.pbe.generatePkcs12Key=function(e,t,r,n,i,o){var a,s;if(null==o){if(!("sha1"in j.md))throw new Error('"sha1" hash algorithm unavailable.');o=j.md.sha1.create()}var c=o.digestLength,l=o.blockLength,u=new j.util.ByteBuffer,d=new j.util.ByteBuffer;if(null!=e){for(s=0;s<e.length;s++)d.putInt16(e.charCodeAt(s));d.putInt16(0)}var f=d.length(),p=t.length(),h=new j.util.ByteBuffer;h.fillWithByte(r,l);var m=l*Math.ceil(p/l),g=new j.util.ByteBuffer;for(s=0;s<m;s++)g.putByte(t.at(s%p));var v=l*Math.ceil(f/l),y=new j.util.ByteBuffer;for(s=0;s<v;s++)y.putByte(d.at(s%f));var b=g;b.putBuffer(y);for(var _=Math.ceil(i/c),C=1;C<=_;C++){var w=new j.util.ByteBuffer;w.putBytes(h.bytes()),w.putBytes(b.bytes());for(var k=0;k<n;k++)o.start(),o.update(w.getBytes()),w=o.digest();var S=new j.util.ByteBuffer;for(s=0;s<l;s++)S.putByte(w.at(s%c));var B=Math.ceil(p/l)+Math.ceil(f/l),E=new j.util.ByteBuffer;for(a=0;a<B;a++){var I=new j.util.ByteBuffer(b.getBytes(l)),A=511;for(s=S.length()-1;s>=0;s--)A>>=8,A+=S.at(s)+I.at(s),I.setAt(s,255&A);E.putBuffer(I)}b=E,u.putBuffer(w)}return u.truncate(u.length()-i),u},mt.pbe.getCipher=function(e,t,r){switch(e){case mt.oids.pkcs5PBES2:return mt.pbe.getCipherForPBES2(e,t,r);case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:return mt.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},mt.pbe.getCipherForPBES2=function(e,t,r){var n,i={},o=[];if(!ht.validate(t,yt,i,o))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,n;if((e=ht.derToOid(i.kdfOid))!==mt.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=ht.derToOid(i.encOid))!==mt.oids["aes128-CBC"]&&e!==mt.oids["aes192-CBC"]&&e!==mt.oids["aes256-CBC"]&&e!==mt.oids["des-EDE3-CBC"]&&e!==mt.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var a,s,c=i.kdfSalt,l=j.util.createBuffer(i.kdfIterationCount);switch(l=l.getInt(l.length()<<3),mt.oids[e]){case"aes128-CBC":a=16,s=j.aes.createDecryptionCipher;break;case"aes192-CBC":a=24,s=j.aes.createDecryptionCipher;break;case"aes256-CBC":a=32,s=j.aes.createDecryptionCipher;break;case"des-EDE3-CBC":a=24,s=j.des.createDecryptionCipher;break;case"desCBC":a=8,s=j.des.createDecryptionCipher}var u=Ct(i.prfOid),d=j.pkcs5.pbkdf2(r,c,l,a,u),f=i.encIv,p=s(d);return p.start(f),p},mt.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!ht.validate(t,bt,n,i))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=i,u;var o,a,s,c=j.util.createBuffer(n.salt),l=j.util.createBuffer(n.iterations);switch(l=l.getInt(l.length()<<3),e){case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:o=24,a=8,s=j.des.startDecrypting;break;case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:o=5,a=8,s=function(e,t){var r=j.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,u}var d=Ct(n.prfOid),f=mt.pbe.generatePkcs12Key(r,c,1,l,o,d);return d.start(),s(f,mt.pbe.generatePkcs12Key(r,c,2,l,a,d))},mt.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in j.md))throw new Error('"md5" hash algorithm unavailable.');n=j.md.md5.create()}null===t&&(t="");for(var i=[_t(n,e+t)],o=16,a=1;o<r;++a,o+=16)i.push(_t(n,i[a-1]+e+t));return i.join("").substr(0,r)},_((function(e){var t=j.asn1,r=e.exports=j.pkcs7asn1=j.pkcs7asn1||{};j.pkcs7=j.pkcs7||{},j.pkcs7.asn1=r;var n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=n;var i={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(i)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(i)};var o={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},n,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[o]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}})),_((function(e){j.mgf=j.mgf||{},(e.exports=j.mgf.mgf1=j.mgf1=j.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new j.util.ByteBuffer,i=Math.ceil(r/e.digestLength),o=0;o<i;o++){var a=new j.util.ByteBuffer;a.putInt32(o),e.start(),e.update(t+a.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}}}})),j.mgf=j.mgf||{},j.mgf.mgf1=j.mgf1,_((function(e){(e.exports=j.pss=j.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,i=r.digestLength,o=e.salt||null;if("string"==typeof o&&(o=j.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||j.random;return{encode:function(e,s){var c,l,u=s-1,d=Math.ceil(u/8),f=e.digest().getBytes();if(d<i+t+2)throw new Error("Message is too long to encrypt.");l=null===o?a.getBytesSync(t):o.bytes();var p=new j.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(l),r.start(),r.update(p.getBytes());var h=r.digest().getBytes(),m=new j.util.ByteBuffer;m.fillWithByte(0,d-t-i-2),m.putByte(1),m.putBytes(l);var g=m.getBytes(),v=d-i-1,y=n.generate(h,v),b="";for(c=0;c<v;c++)b+=String.fromCharCode(g.charCodeAt(c)^y.charCodeAt(c));var _=65280>>8*d-u&255;return(b=String.fromCharCode(b.charCodeAt(0)&~_)+b.substr(1))+h+String.fromCharCode(188)},verify:function(e,o,a){var s,c=a-1,l=Math.ceil(c/8);if(o=o.substr(-l),l<i+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var u=l-i-1,d=o.substr(0,u),f=o.substr(u,i),p=65280>>8*l-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var h=n.generate(f,u),m="";for(s=0;s<u;s++)m+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));m=String.fromCharCode(m.charCodeAt(0)&~p)+m.substr(1);var g=l-i-t-2;for(s=0;s<g;s++)if(0!==m.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==m.charCodeAt(g))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=m.substr(-t),y=new j.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(e),y.putBytes(v),r.start(),r.update(y.getBytes()),f===r.digest().getBytes()}}}})),_((function(e){var t=j.asn1,r=e.exports=j.pki=j.pki||{},n=r.oids,i={};i.CN=n.commonName,i.commonName="CN",i.C=n.countryName,i.countryName="C",i.L=n.localityName,i.localityName="L",i.ST=n.stateOrProvinceName,i.stateOrProvinceName="ST",i.O=n.organizationName,i.organizationName="O",i.OU=n.organizationalUnitName,i.organizationalUnitName="OU",i.E=n.emailAddress,i.emailAddress="E";var o=j.pki.rsa.publicKeyValidator,a={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},o,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},s={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},o,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}r.RDNAttributesAsArray=function(e,r){for(var o,a,s,c=[],l=0;l<e.value.length;++l){o=e.value[l];for(var u=0;u<o.value.length;++u)s={},a=o.value[u],s.type=t.derToOid(a.value[0].value),s.value=a.value[1].value,s.valueTagClass=a.value[1].type,s.type in n&&(s.name=n[s.type],s.name in i&&(s.shortName=i[s.name])),r&&(r.update(s.type),r.update(s.value)),c.push(s)}return c},r.CRIAttributesAsArray=function(e){for(var o=[],a=0;a<e.length;++a)for(var s=e[a],c=t.derToOid(s.value[0].value),l=s.value[1].value,u=0;u<l.length;++u){var d={};if(d.type=c,d.value=l[u].value,d.valueTagClass=l[u].type,d.type in n&&(d.name=n[d.type],d.name in i&&(d.shortName=i[d.name])),d.type===n.extensionRequest){d.extensions=[];for(var f=0;f<d.value.length;++f)d.extensions.push(r.certificateExtensionFromAsn1(d.value[f]))}o.push(d)}return o};var d=function(e,r,i){var o={};if(e!==n["RSASSA-PSS"])return o;i&&(o={hash:{algorithmOid:n.sha1},mgf:{algorithmOid:n.mgf1,hash:{algorithmOid:n.sha1}},saltLength:20});var a={},c=[];if(!t.validate(r,s,a,c)){var l=new Error("Cannot read RSASSA-PSS parameter block.");throw l.errors=c,l}return void 0!==a.hashOid&&(o.hash=o.hash||{},o.hash.algorithmOid=t.derToOid(a.hashOid)),void 0!==a.maskGenOid&&(o.mgf=o.mgf||{},o.mgf.algorithmOid=t.derToOid(a.maskGenOid),o.mgf.hash=o.mgf.hash||{},o.mgf.hash.algorithmOid=t.derToOid(a.maskGenHashOid)),void 0!==a.saltLength&&(o.saltLength=a.saltLength.charCodeAt(0)),o};function f(e){for(var r,n,i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),o=e.attributes,a=0;a<o.length;++a){var s=(r=o[a]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in r&&(c=r.valueTagClass)===t.Type.UTF8&&(s=j.util.encodeUtf8(s)),n=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),i.value.push(n)}return i}function p(e){for(var o,a=0;a<e.length;++a){if(void 0===(o=e[a]).name&&(o.type&&o.type in r.oids?o.name=r.oids[o.type]:o.shortName&&o.shortName in i&&(o.name=r.oids[i[o.shortName]])),void 0===o.type){if(!o.name||!(o.name in r.oids))throw(c=new Error("Attribute type not specified.")).attribute=o,c;o.type=r.oids[o.name]}if(void 0===o.shortName&&o.name&&o.name in i&&(o.shortName=i[o.name]),o.type===n.extensionRequest&&(o.valueConstructed=!0,o.valueTagClass=t.Type.SEQUENCE,!o.value&&o.extensions)){o.value=[];for(var s=0;s<o.extensions.length;++s)o.value.push(r.certificateExtensionToAsn1(h(o.extensions[s])))}var c;if(void 0===o.value)throw(c=new Error("Attribute value not specified.")).attribute=o,c}}function h(e,i){if(i=i||{},void 0===e.name&&e.id&&e.id in r.oids&&(e.name=r.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in r.oids))throw(_=new Error("Extension ID not specified.")).extension=e,_;e.id=r.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var o=0,a=0,s=0;e.digitalSignature&&(a|=128,o=7),e.nonRepudiation&&(a|=64,o=6),e.keyEncipherment&&(a|=32,o=5),e.dataEncipherment&&(a|=16,o=4),e.keyAgreement&&(a|=8,o=3),e.keyCertSign&&(a|=4,o=2),e.cRLSign&&(a|=2,o=1),e.encipherOnly&&(a|=1,o=0),e.decipherOnly&&(s|=128,o=7);var c=String.fromCharCode(o);0!==s?c+=String.fromCharCode(a)+String.fromCharCode(s):0!==a&&(c+=String.fromCharCode(a)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var u in e)!0===e[u]&&(u in n?l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n[u]).getBytes())):-1!==u.indexOf(".")&&l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(u).getBytes())))}else if("nsCertType"===e.name)o=0,a=0,e.client&&(a|=128,o=7),e.server&&(a|=64,o=6),e.email&&(a|=32,o=5),e.objsign&&(a|=16,o=4),e.reserved&&(a|=8,o=3),e.sslCA&&(a|=4,o=2),e.emailCA&&(a|=2,o=1),e.objCA&&(a|=1,o=0),c=String.fromCharCode(o),0!==a&&(c+=String.fromCharCode(a)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c);else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=j.util.bytesFromIP(v.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));e.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}}else if("nsComment"===e.name&&i.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&i.cert){var p=i.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&i.cert){if(e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value,e.keyIdentifier){var h=!0===e.keyIdentifier?i.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(e.authorityCertIssuer){var m=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===e.authorityCertIssuer?i.cert.issuer:e.authorityCertIssuer)])];l.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var g=j.util.hexToBytes(!0===e.serialNumber?i.cert.serialNumber:e.serialNumber);l.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value;var v,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),b=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=j.util.bytesFromIP(v.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));b.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[b])),l.push(y)}var _;if(void 0===e.value)throw(_=new Error("Extension value not specified.")).extension=e,_;return e}function m(e,r){switch(e){case n["RSASSA-PSS"]:var i=[];return void 0!==r.hash.algorithmOid&&i.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&i.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&i.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,i);default:return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}}function g(e){var r=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return r;for(var n=e.attributes,i=0;i<n.length;++i){var o=n[i],a=o.value,s=t.Type.UTF8;"valueTagClass"in o&&(s=o.valueTagClass),s===t.Type.UTF8&&(a=j.util.encodeUtf8(a));var c=!1;"valueConstructed"in o&&(c=o.valueConstructed);var l=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(o.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,a)])]);r.value.push(l)}return r}r.certificateFromPem=function(e,n,i){var o=j.pem.decode(e)[0];if("CERTIFICATE"!==o.type&&"X509 CERTIFICATE"!==o.type&&"TRUSTED CERTIFICATE"!==o.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(o.body,i);return r.certificateFromAsn1(s,n)},r.certificateToPem=function(e,n){var i={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.publicKeyFromPem=function(e){var n=j.pem.decode(e)[0];if("PUBLIC KEY"!==n.type&&"RSA PUBLIC KEY"!==n.type){var i=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var o=t.fromDer(n.body);return r.publicKeyFromAsn1(o)},r.publicKeyToPem=function(e,n){var i={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.publicKeyToRSAPublicKeyPem=function(e,n){var i={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.getPublicKeyFingerprint=function(e,n){var i,o=(n=n||{}).md||j.md.sha1.create();switch(n.type||"RSAPublicKey"){case"RSAPublicKey":i=t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":i=t.toDer(r.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}o.start(),o.update(i);var a=o.digest();if("hex"===n.encoding){var s=a.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return a.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return a},r.certificationRequestFromPem=function(e,n,i){var o=j.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==o.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(o.body,i);return r.certificationRequestFromAsn1(s,n)},r.certificationRequestToPem=function(e,n){var i={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return u(e.issuer,t)},e.issuer.addField=function(t){p([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){p(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){p(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)h(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(i,o){e.md=o||j.md.sha1.create();var a=n[e.md.algorithm+"WithRSAEncryption"];if(!a){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=r.getTBSCertificate(e);var c=t.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=i.sign(e.md)},e.verify=function(i){var o=!1;if(!e.issued(i)){var a=i.issuer,s=e.subject;throw(h=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=a.attributes,h.actualIssuer=s.attributes,h}var c=i.md;if(null===c){if(i.signatureOid in n)switch(n[i.signatureOid]){case"sha1WithRSAEncryption":c=j.md.sha1.create();break;case"md5WithRSAEncryption":c=j.md.md5.create();break;case"sha256WithRSAEncryption":c=j.md.sha256.create();break;case"sha384WithRSAEncryption":c=j.md.sha384.create();break;case"sha512WithRSAEncryption":c=j.md.sha512.create();break;case"RSASSA-PSS":c=j.md.sha256.create()}if(null===c)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=i.signatureOid,h;var l=i.tbsCertificate||r.getTBSCertificate(i),u=t.toDer(l);c.update(u.getBytes())}if(null!==c){var d;switch(i.signatureOid){case n.sha1WithRSAEncryption:d=void 0;break;case n["RSASSA-PSS"]:var f,p,h;if(void 0===(f=n[i.signatureParameters.mgf.hash.algorithmOid])||void 0===j.md[f])throw(h=new Error("Unsupported MGF hash function.")).oid=i.signatureParameters.mgf.hash.algorithmOid,h.name=f,h;if(void 0===(p=n[i.signatureParameters.mgf.algorithmOid])||void 0===j.mgf[p])throw(h=new Error("Unsupported MGF function.")).oid=i.signatureParameters.mgf.algorithmOid,h.name=p,h;if(p=j.mgf[p].create(j.md[f].create()),void 0===(f=n[i.signatureParameters.hash.algorithmOid])||void 0===j.md[f])throw{message:"Unsupported RSASSA-PSS hash function.",oid:i.signatureParameters.hash.algorithmOid,name:f};d=j.pss.create(j.md[f].create(),p,i.signatureParameters.saltLength)}o=e.publicKey.verify(c.digest().getBytes(),i.signature,d)}return o},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var o,a;r=!0;for(var s=0;r&&s<n.attributes.length;++s)o=n.attributes[s],a=i.attributes[s],o.type===a.type&&o.value===a.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=n.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return j.util.hexToBytes(i.subjectKeyIdentifier)===o}}return!1},e},r.certificateFromAsn1=function(e,i){var o={},s=[];if(!t.validate(e,a,o,s))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=s,h;if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=o.certVersion?o.certVersion.charCodeAt(0):0;var l=j.util.createBuffer(o.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=j.asn1.derToOid(o.certSignatureOid),c.signatureParameters=d(c.signatureOid,o.certSignatureParams,!0),c.siginfo.algorithmOid=j.asn1.derToOid(o.certinfoSignatureOid),c.siginfo.parameters=d(c.siginfo.algorithmOid,o.certinfoSignatureParams,!1),c.signature=o.certSignature;var f=[];if(void 0!==o.certValidity1UTCTime&&f.push(t.utcTimeToDate(o.certValidity1UTCTime)),void 0!==o.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity2GeneralizedTime)),void 0!==o.certValidity3UTCTime&&f.push(t.utcTimeToDate(o.certValidity3UTCTime)),void 0!==o.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=o.tbsCertificate,i){var h;if(c.md=null,c.signatureOid in n)switch(n[c.signatureOid]){case"sha1WithRSAEncryption":c.md=j.md.sha1.create();break;case"md5WithRSAEncryption":c.md=j.md.md5.create();break;case"sha256WithRSAEncryption":c.md=j.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=j.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=j.md.sha512.create();break;case"RSASSA-PSS":c.md=j.md.sha256.create()}if(null===c.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,h;var m=t.toDer(c.tbsCertificate);c.md.update(m.getBytes())}var g=j.md.sha1.create();c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){p([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(o.certIssuer,g),o.certIssuerUniqueId&&(c.issuer.uniqueId=o.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var v=j.md.sha1.create();return c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){p([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(o.certSubject,v),o.certSubjectUniqueId&&(c.subject.uniqueId=o.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),o.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(o.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n<e.value.length;++n)for(var i=e.value[n],o=0;o<i.value.length;++o)t.push(r.certificateExtensionFromAsn1(i.value[o]));return t},r.certificateExtensionFromAsn1=function(e){var r={};if(r.id=t.derToOid(e.value[0].value),r.critical=!1,e.value[1].type===t.Type.BOOLEAN?(r.critical=0!==e.value[1].value.charCodeAt(0),r.value=e.value[2].value):r.value=e.value[1].value,r.id in n)if(r.name=n[r.id],"keyUsage"===r.name){var i=0,o=0;(s=t.fromDer(r.value)).value.length>1&&(i=s.value.charCodeAt(1),o=s.value.length>2?s.value.charCodeAt(2):0),r.digitalSignature=128==(128&i),r.nonRepudiation=64==(64&i),r.keyEncipherment=32==(32&i),r.dataEncipherment=16==(16&i),r.keyAgreement=8==(8&i),r.keyCertSign=4==(4&i),r.cRLSign=2==(2&i),r.encipherOnly=1==(1&i),r.decipherOnly=128==(128&o)}else if("basicConstraints"===r.name){(s=t.fromDer(r.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?r.cA=0!==s.value[0].value.charCodeAt(0):r.cA=!1;var a=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?a=s.value[0].value:s.value.length>1&&(a=s.value[1].value),null!==a&&(r.pathLenConstraint=t.derToInteger(a))}else if("extKeyUsage"===r.name)for(var s=t.fromDer(r.value),c=0;c<s.value.length;++c){var l=t.derToOid(s.value[c].value);l in n?r[n[l]]=!0:r[l]=!0}else if("nsCertType"===r.name)i=0,(s=t.fromDer(r.value)).value.length>1&&(i=s.value.charCodeAt(1)),r.client=128==(128&i),r.server=64==(64&i),r.email=32==(32&i),r.objsign=16==(16&i),r.reserved=8==(8&i),r.sslCA=4==(4&i),r.emailCA=2==(2&i),r.objCA=1==(1&i);else if("subjectAltName"===r.name||"issuerAltName"===r.name){var u;r.altNames=[],s=t.fromDer(r.value);for(var d=0;d<s.value.length;++d){var f={type:(u=s.value[d]).type,value:u.value};switch(r.altNames.push(f),u.type){case 1:case 2:case 6:break;case 7:f.ip=j.util.bytesToIP(u.value);break;case 8:f.oid=t.derToOid(u.value)}}}else"subjectKeyIdentifier"===r.name&&(s=t.fromDer(r.value),r.subjectKeyIdentifier=j.util.bytesToHex(s.value));return r},r.certificationRequestFromAsn1=function(e,i){var o={},a=[];if(!t.validate(e,l,o,a))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=a,c;if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=o.csrVersion?o.csrVersion.charCodeAt(0):0,s.signatureOid=j.asn1.derToOid(o.csrSignatureOid),s.signatureParameters=d(s.signatureOid,o.csrSignatureParams,!0),s.siginfo.algorithmOid=j.asn1.derToOid(o.csrSignatureOid),s.siginfo.parameters=d(s.siginfo.algorithmOid,o.csrSignatureParams,!1),s.signature=o.csrSignature,s.certificationRequestInfo=o.certificationRequestInfo,i){var c;if(s.md=null,s.signatureOid in n)switch(n[s.signatureOid]){case"sha1WithRSAEncryption":s.md=j.md.sha1.create();break;case"md5WithRSAEncryption":s.md=j.md.md5.create();break;case"sha256WithRSAEncryption":s.md=j.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=j.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=j.md.sha512.create();break;case"RSASSA-PSS":s.md=j.md.sha256.create()}if(null===s.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=s.signatureOid,c;var f=t.toDer(s.certificationRequestInfo);s.md.update(f.getBytes())}var h=j.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){p([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(o.certificationRequestInfoSubject,h),s.subject.hash=h.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){p([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(o.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return u(e,t)},e.addAttribute=function(t){p([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){p(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){p(t),e.attributes=t},e.sign=function(i,o){e.md=o||j.md.sha1.create();var a=n[e.md.algorithm+"WithRSAEncryption"];if(!a){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=r.getCertificationRequestInfo(e);var c=t.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=i.sign(e.md)},e.verify=function(){var i=!1,o=e.md;if(null===o){if(e.signatureOid in n)switch(n[e.signatureOid]){case"sha1WithRSAEncryption":o=j.md.sha1.create();break;case"md5WithRSAEncryption":o=j.md.md5.create();break;case"sha256WithRSAEncryption":o=j.md.sha256.create();break;case"sha384WithRSAEncryption":o=j.md.sha384.create();break;case"sha512WithRSAEncryption":o=j.md.sha512.create();break;case"RSASSA-PSS":o=j.md.sha256.create()}if(null===o)throw(d=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,d;var a=e.certificationRequestInfo||r.getCertificationRequestInfo(e),s=t.toDer(a);o.update(s.getBytes())}if(null!==o){var c;switch(e.signatureOid){case n.sha1WithRSAEncryption:break;case n["RSASSA-PSS"]:var l,u,d;if(void 0===(l=n[e.signatureParameters.mgf.hash.algorithmOid])||void 0===j.md[l])throw(d=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,d.name=l,d;if(void 0===(u=n[e.signatureParameters.mgf.algorithmOid])||void 0===j.mgf[u])throw(d=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,d.name=u,d;if(u=j.mgf[u].create(j.md[l].create()),void 0===(l=n[e.signatureParameters.hash.algorithmOid])||void 0===j.md[l])throw(d=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,d.name=l,d;c=j.pss.create(j.md[l].create(),u,e.signatureParameters.saltLength)}i=e.publicKey.verify(o.digest().getBytes(),e.signature,c)}return i},e};var v=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z");function b(e){return e>=v&&e<y?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}r.getTBSCertificate=function(e){var n=b(e.validity.notBefore),i=b(e.validity.notAfter),o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,j.util.hexToBytes(e.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.siginfo.algorithmOid).getBytes()),m(e.siginfo.algorithmOid,e.siginfo.parameters)]),f(e.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,i]),f(e.subject),r.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(r.certificateExtensionsToAsn1(e.extensions)),o},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),g(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var n=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var n=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);n.value.push(i);for(var o=0;o<e.length;++o)i.value.push(r.certificateExtensionToAsn1(e[o]));return n},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var n=e.value;return"string"!=typeof e.value&&(n=t.toDer(n).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)),r},r.certificationRequestToAsn1=function(e){var n=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(e){var n={certs:{}};function i(e){return o(e),n.certs[e.hash]||null}function o(e){if(!e.hash){var t=j.md.sha1.create();e.attributes=r.RDNAttributesAsArray(f(e),t),e.hash=t.digest().toHex()}}if(n.getIssuer=function(e){return i(e.issuer)},n.addCertificate=function(e){if("string"==typeof e&&(e=j.pki.certificateFromPem(e)),o(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];j.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},n.hasCertificate=function(e){"string"==typeof e&&(e=j.pki.certificateFromPem(e));var n=i(e.subject);if(!n)return!1;j.util.isArray(n)||(n=[n]);for(var o=t.toDer(r.certificateToAsn1(e)).getBytes(),a=0;a<n.length;++a)if(o===t.toDer(r.certificateToAsn1(n[a])).getBytes())return!0;return!1},n.listAllCertificates=function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(j.util.isArray(r))for(var i=0;i<r.length;++i)e.push(r[i]);else e.push(r)}return e},n.removeCertificate=function(e){var a;if("string"==typeof e&&(e=j.pki.certificateFromPem(e)),o(e.subject),!n.hasCertificate(e))return null;var s=i(e.subject);if(!j.util.isArray(s))return a=n.certs[e.subject.hash],delete n.certs[e.subject.hash],a;for(var c=t.toDer(r.certificateToAsn1(e)).getBytes(),l=0;l<s.length;++l)c===t.toDer(r.certificateToAsn1(s[l])).getBytes()&&(a=s[l],s.splice(l,1));return 0===s.length&&delete n.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var s=e[a];n.addCertificate(s)}return n},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(e,t,n){"function"==typeof n&&(n={verify:n}),n=n||{};var i=(t=t.slice(0)).slice(0),o=n.validityCheckDate;void 0===o&&(o=new Date);var a=!0,s=null,c=0;do{var l=t.shift(),u=null,d=!1;if(o&&(o<l.validity.notBefore||o>l.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:o}),null===s){if(null===(u=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(d=!0,u=l),u){var f=u;j.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){u=f.shift();try{p=u.verify(l)}catch(e){}}p||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||u&&!d||e.hasCertificate(l)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&u&&!l.isIssuer(u)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},m=0;null===s&&m<l.extensions.length;++m){var g=l.extensions[m];!g.critical||g.name in h||(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!a||0===t.length&&(!u||d))){var v=l.getExtension("basicConstraints"),y=l.getExtension("keyUsage");null!==y&&(y.keyCertSign&&null!==v||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===v||v.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in v&&c-1>v.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var b=null===s||s.error,_=n.verify?n.verify(b,c,i):b;if(!0!==_)throw!0===b&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(_||0===_)&&("object"!=x(_)||j.util.isArray(_)?"string"==typeof _&&(s.error=_):(_.message&&(s.message=_.message),_.error&&(s.error=_.error))),s;s=null,a=!1,++c}while(t.length>0);return!0}})),_((function(e){var t=j.asn1,r=j.pki,n=e.exports=j.pkcs12=j.pkcs12||{},i={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},o={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},i,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},a={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},s={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(e,t,r,n){for(var i=[],o=0;o<e.length;o++)for(var a=0;a<e[o].safeBags.length;a++){var s=e[o].safeBags[a];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&i.push(s):i.push(s))}return i}function u(e){if(e.composed||e.constructed){for(var t=j.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function d(e,n){var i={},o=[];if(!t.validate(e,j.pkcs7.asn1.encryptedDataValidator,i,o))throw(a=new Error("Cannot read EncryptedContentInfo.")).errors=o,a;var a,s=t.derToOid(i.contentType);if(s!==r.oids.data)throw(a=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,a;s=t.derToOid(i.encAlgorithm);var c=r.pbe.getCipher(s,i.encParameter,n),l=u(i.encryptedContentAsn1),d=j.util.createBuffer(l.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function f(e,n,i){if(!n&&0===e.length)return[];if((e=t.fromDer(e,n)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var o=[],s=0;s<e.value.length;s++){var l=e.value[s],u={},d=[];if(!t.validate(l,a,u,d))throw(v=new Error("Cannot read SafeBag.")).errors=d,v;var f,h,m={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};o.push(m);var g=u.bagValue.value[0];switch(m.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,i)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{m.key=r.privateKeyFromAsn1(g)}catch(e){m.key=null,m.asn1=g}continue;case r.oids.certBag:f=c,h=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var i=t.fromDer(u.cert,n);try{m.cert=r.certificateFromAsn1(i,!0)}catch(e){m.cert=null,m.asn1=i}};break;default:var v;throw(v=new Error("Unsupported PKCS#12 SafeBag type.")).oid=m.type,v}if(void 0!==f&&!t.validate(g,f,u,d))throw(v=new Error("Cannot read PKCS#12 "+f.name)).errors=d,v;h()}return o}function p(e){var n={};if(void 0!==e)for(var i=0;i<e.length;++i){var o={},a=[];if(!t.validate(e[i],s,o,a)){var c=new Error("Cannot read PKCS#12 BagAttribute.");throw c.errors=a,c}var l=t.derToOid(o.oid);if(void 0!==r.oids[l]){n[r.oids[l]]=[];for(var u=0;u<o.values.length;++u)n[r.oids[l]].push(o.values[u].value)}}return n}n.pkcs12FromAsn1=function(e,a,s){"string"==typeof a?(s=a,a=!0):void 0===a&&(a=!0);var c={};if(!t.validate(e,o,c,[]))throw(p=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=p,p;var p,h={version:c.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=j.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=l(h.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=l(h.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=l(h.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return l(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return l(h.safeContents,"localKeyId",e,t)}};if(3!==c.version.charCodeAt(0))throw(p=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=c.version.charCodeAt(0),p;if(t.derToOid(c.contentType)!==r.oids.data)throw(p=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(c.contentType),p;var m=c.content.value[0];if(m.tagClass!==t.Class.UNIVERSAL||m.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(m=u(m),c.mac){var g=null,v=0,y=t.derToOid(c.macAlgorithm);switch(y){case r.oids.sha1:g=j.md.sha1.create(),v=20;break;case r.oids.sha256:g=j.md.sha256.create(),v=32;break;case r.oids.sha384:g=j.md.sha384.create(),v=48;break;case r.oids.sha512:g=j.md.sha512.create(),v=64;break;case r.oids.md5:g=j.md.md5.create(),v=16}if(null===g)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var b=new j.util.ByteBuffer(c.macSalt),_="macIterations"in c?parseInt(j.util.bytesToHex(c.macIterations),16):1,C=n.generateKey(s,b,3,_,v,g),w=j.hmac.create();if(w.start(g,C),w.update(m.value),w.getMac().getBytes()!==c.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,n,o,a){if((n=t.fromDer(n,o)).tagClass!==t.Class.UNIVERSAL||n.type!==t.Type.SEQUENCE||!0!==n.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<n.value.length;s++){var c=n.value[s],l={},p=[];if(!t.validate(c,i,l,p))throw(v=new Error("Cannot read ContentInfo.")).errors=p,v;var h={encrypted:!1},m=null,g=l.content.value[0];switch(t.derToOid(l.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");m=u(g).value;break;case r.oids.encryptedData:m=d(g,a),h.encrypted=!0;break;default:var v;throw(v=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(l.contentType),v}h.safeBags=f(m,o,a),e.safeContents.push(h)}}(h,m.value,a,s),h},n.toPkcs12Asn1=function(e,i,o,a){(a=a||{}).saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||a.encAlgorithm||"aes128","useMac"in a||(a.useMac=!0),"localKeyId"in a||(a.localKeyId=null),"generateLocalKeyId"in a||(a.generateLocalKeyId=!0);var s,c=a.localKeyId;if(null!==c)c=j.util.hexToBytes(c);else if(a.generateLocalKeyId)if(i){var l=j.util.isArray(i)?i[0]:i;"string"==typeof l&&(l=r.certificateFromPem(l)),(E=j.md.sha1.create()).update(t.toDer(r.certificateToAsn1(l)).getBytes()),c=E.digest().getBytes()}else c=j.random.getBytes(20);var u=[];null!==c&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in a&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,a.friendlyName)])])),u.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,u));var d=[],f=[];null!==i&&(f=j.util.isArray(i)?i:[i]);for(var p=[],h=0;h<f.length;++h){"string"==typeof(i=f[h])&&(i=r.certificateFromPem(i));var m=0===h?s:void 0,g=r.certificateToAsn1(i),v=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(g).getBytes())])])]),m]);p.push(v)}if(p.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,p),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(b)}var _=null;if(null!==e){var C=r.wrapRsaPrivateKey(r.privateKeyToAsn1(e));_=null===o?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[C]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(C,o,a)]),s]);var w=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[_]),k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(w).getBytes())])]);d.push(k)}var S,B=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(a.useMac){var E=j.md.sha1.create(),I=new j.util.ByteBuffer(j.random.getBytes(a.saltSize)),A=a.count,x=(e=n.generateKey(o,I,3,A,20),j.hmac.create());x.start(E,e),x.update(t.toDer(B).getBytes());var T=x.getMac();S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,T.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,I.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(A).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(B).getBytes())])]),S])},n.generateKey=j.pbe.generatePkcs12Key})),_((function(e){var t=j.asn1,r=e.exports=j.pki=j.pki||{};r.pemToDer=function(e){var t=j.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return j.util.createBuffer(t.body)},r.privateKeyFromPem=function(e){var n=j.pem.decode(e)[0];if("PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var i=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=t.fromDer(n.body);return r.privateKeyFromAsn1(o)},r.privateKeyToPem=function(e,n){var i={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.privateKeyInfoToPem=function(e,r){var n={type:"PRIVATE KEY",body:t.toDer(e).getBytes()};return j.pem.encode(n,{maxline:r})}}));var kt=function(e,t,r,n){var i=j.util.createBuffer(),o=e.length>>1,a=o+(1&e.length),s=e.substr(0,a),c=e.substr(o,a),l=j.util.createBuffer(),u=j.hmac.create();r=t+r;var d=Math.ceil(n/16),f=Math.ceil(n/20);u.start("MD5",s);var p=j.util.createBuffer();l.putBytes(r);for(var h=0;h<d;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),p.putBuffer(u.digest());u.start("SHA1",c);var m=j.util.createBuffer();for(l.clear(),l.putBytes(r),h=0;h<f;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),m.putBuffer(u.digest());return i.putBytes(j.util.xorBytes(p.getBytes(),m.getBytes(),n)),i},St=function(e,t,r){var n=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=j.util.createBuffer(i),t.length=i.length,n=!0}catch(e){}return n},Bt=function(e,t,r){var n=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=j.util.createBuffer(i),t.length=i.length,n=!0}catch(e){}return n},Et=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return j.util.createBuffer(e.getBytes(r))},It=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},At={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};At.SupportedVersions=[At.Versions.TLS_1_1,At.Versions.TLS_1_0],At.Version=At.SupportedVersions[0],At.MaxFragment=15360,At.ConnectionEnd={server:0,client:1},At.PRFAlgorithm={tls_prf_sha256:0},At.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},At.CipherType={stream:0,block:1,aead:2},At.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},At.CompressionMethod={none:0,deflate:1},At.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},At.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},At.Alert={},At.Alert.Level={warning:1,fatal:2},At.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},At.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},At.CipherSuites={},At.getCipherSuite=function(e){var t=null;for(var r in At.CipherSuites){var n=At.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},At.handleUnexpected=function(e,t){!e.open&&e.entity===At.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unexpected_message}})},At.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(At.queue(e,At.createAlert(e,{level:At.Alert.Level.warning,description:At.Alert.Description.no_renegotiation})),At.flush(e)),e.process()},At.parseHelloMessage=function(e,t,r){var n=null,i=e.entity===At.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});else{var o=t.fragment,a=o.length();if(n={version:{major:o.getByte(),minor:o.getByte()},random:j.util.createBuffer(o.getBytes(32)),session_id:Et(o,1),extensions:[]},i?(n.cipher_suite=o.getBytes(2),n.compression_method=o.getByte()):(n.cipher_suites=Et(o,2),n.compression_methods=Et(o,1)),(a=r-(a-o.length()))>0){for(var s=Et(o,2);s.length()>0;)n.extensions.push({type:[s.getByte(),s.getByte()],data:Et(s,2)});if(!i)for(var c=0;c<n.extensions.length;++c){var l=n.extensions[c];if(0===l.type[0]&&0===l.type[1])for(var u=Et(l.data,2);u.length()>0&&0===u.getByte();)e.session.extensions.server_name.serverNameList.push(Et(u,2).getBytes())}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=At.getCipherSuite(n.cipher_suite);else for(var d=j.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=At.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.handshake_failure},cipherSuite:j.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=i?n.compression_method:At.CompressionMethod.none}return n},At.createSecurityParameters=function(e,t){var r=e.entity===At.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,o=r?n:At.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:At.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:o}},At.handleServerHello=function(e,t,r){var n=At.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=Dt,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=xt,e.session.resuming=!1,At.createSecurityParameters(e,n)),e.session.id=i,e.process()}},At.handleClientHello=function(e,t,r){var n=At.parseHelloMessage(e,t,r);if(!e.fail){var i=n.session_id.bytes(),o=null;if(e.sessionCache&&(null===(o=e.sessionCache.getSession(i))?i="":(o.version.major!==n.version.major||o.version.minor>n.version.minor)&&(o=null,i="")),0===i.length&&(i=j.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=n.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var a,s=1;s<At.SupportedVersions.length&&!((a=At.SupportedVersions[s]).minor<=n.version.minor);++s);e.version={major:a.major,minor:a.minor},e.session.version=e.version}null!==o?(e.expect=Ut,e.session.resuming=!0,e.session.sp.client_random=n.random.bytes()):(e.expect=!1!==e.verifyClient?Ft:Mt,e.session.resuming=!1,At.createSecurityParameters(e,n)),e.open=!0,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createServerHello(e)})),e.session.resuming?(At.queue(e,At.createRecord(e,{type:At.ContentType.change_cipher_spec,data:At.createChangeCipherSpec()})),e.state.pending=At.createConnectionState(e),e.state.current.write=e.state.pending.write,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createFinished(e)}))):(At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificate(e)})),e.fail||(At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createServerKeyExchange(e)})),!1!==e.verifyClient&&At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificateRequest(e)})),At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createServerHelloDone(e)})))),At.flush(e),e.process()}},At.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var n,i,o=t.fragment,a={certificate_list:Et(o,3)},s=[];try{for(;a.certificate_list.length()>0;)n=Et(a.certificate_list,3),i=j.asn1.fromDer(n),n=j.pki.certificateFromAsn1(i,!0),s.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.bad_certificate}})}var c=e.entity===At.ConnectionEnd.client;!c&&!0!==e.verifyClient||0!==s.length?0===s.length?e.expect=c?Tt:Mt:(c?e.session.serverCertificate=s[0]:e.session.clientCertificate=s[0],At.verifyCertificateChain(e,s)&&(e.expect=c?Tt:Mt)):e.error(e,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}}),e.process()},At.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unsupported_certificate}});e.expect=Pt,e.process()},At.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unsupported_certificate}});var n=t.fragment,i={enc_pre_master_secret:Et(n,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=j.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}});try{var a=e.session.sp;a.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var s=e.session.clientHelloVersion;if(s.major!==a.pre_master_secret.charCodeAt(0)||s.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){a.pre_master_secret=j.random.getBytes(48)}e.expect=Ut,null!==e.session.clientCertificate&&(e.expect=Vt),e.process()},At.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:Et(n,1),certificate_authorities:Et(n,2)};e.session.certificateRequest=i,e.expect=Rt,e.process()},At.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var o={signature:Et(n,2).getBytes()},a=j.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(a,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.handshake_failure}})}e.expect=Ut,e.process()},At.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.insufficient_security}},i=e.verify(e,n.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=x(i)||j.util.isArray(i)?"number"==typeof i&&(n.alert.description=i):(i.message&&(n.message=i.message),i.alert&&(n.alert.description=i.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificate(e)}),At.queue(e,t)),t=At.createRecord(e,{type:At.ContentType.handshake,data:At.createClientKeyExchange(e)}),At.queue(e,t),e.expect=Ot;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificateVerify(e,t)})),At.queue(e,At.createRecord(e,{type:At.ContentType.change_cipher_spec,data:At.createChangeCipherSpec()})),e.state.pending=At.createConnectionState(e),e.state.current.write=e.state.pending.write,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createFinished(e)})),e.expect=Dt,At.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);At.getClientSignature(e,o)},At.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var r=e.entity===At.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=At.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?Lt:jt,e.process()},At.handleFinished=function(e,t,r){var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var o=t.fragment.getBytes();(n=j.util.createBuffer()).putBuffer(e.session.md5.digest()),n.putBuffer(e.session.sha1.digest());var a=e.entity===At.ConnectionEnd.client,s=a?"server finished":"client finished",c=e.session.sp;if((n=kt(c.master_secret,s,n.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.decrypt_error}});e.session.md5.update(i),e.session.sha1.update(i),(e.session.resuming&&a||!e.session.resuming&&!a)&&(At.queue(e,At.createRecord(e,{type:At.ContentType.change_cipher_spec,data:At.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createFinished(e)}))),e.expect=a?Nt:zt,e.handshaking=!1,++e.handshakes,e.peerCertificate=a?e.session.serverCertificate:e.session.clientCertificate,At.flush(e),e.isConnected=!0,e.connected(e),e.process()},At.handleAlert=function(e,t){var r,n=t.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case At.Alert.Description.close_notify:r="Connection closed.";break;case At.Alert.Description.unexpected_message:r="Unexpected message.";break;case At.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case At.Alert.Description.decryption_failed:r="Decryption failed.";break;case At.Alert.Description.record_overflow:r="Record overflow.";break;case At.Alert.Description.decompression_failure:r="Decompression failed.";break;case At.Alert.Description.handshake_failure:r="Handshake failure.";break;case At.Alert.Description.bad_certificate:r="Bad certificate.";break;case At.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case At.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case At.Alert.Description.certificate_expired:r="Certificate expired.";break;case At.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case At.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case At.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case At.Alert.Description.access_denied:r="Access denied.";break;case At.Alert.Description.decode_error:r="Decode error.";break;case At.Alert.Description.decrypt_error:r="Decrypt error.";break;case At.Alert.Description.export_restriction:r="Export restriction.";break;case At.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case At.Alert.Description.insufficient_security:r="Insufficient security.";break;case At.Alert.Description.internal_error:r="Internal error.";break;case At.Alert.Description.user_canceled:r="User canceled.";break;case At.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(i.description===At.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===At.ConnectionEnd.client?"server":"client",alert:i}),e.process()},At.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=j.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,n in nr[e.entity][e.expect]?(e.entity!==At.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:j.md.md5.create(),sha1:j.md.sha1.create()}),n!==At.HandshakeType.hello_request&&n!==At.HandshakeType.certificate_verify&&n!==At.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),nr[e.entity][e.expect][n](e,t,i)):At.handleUnexpected(e,t)},At.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},At.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(n===At.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();At.queue(e,At.createRecord(e,{type:At.ContentType.heartbeat,data:At.createHeartbeat(At.HeartbeatMessageType.heartbeat_response,o)})),At.flush(e)}else if(n===At.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,j.util.createBuffer(o))}e.process()};var xt=1,Tt=2,Pt=3,Rt=4,Dt=5,Lt=6,Nt=7,Ot=8,Ft=1,Mt=2,Vt=3,Ut=4,jt=5,zt=6,qt=At.handleUnexpected,Ht=At.handleChangeCipherSpec,Kt=At.handleAlert,Wt=At.handleHandshake,Gt=At.handleApplicationData,Qt=At.handleHeartbeat,Xt=[];Xt[At.ConnectionEnd.client]=[[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[Ht,Kt,qt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,Gt,Qt],[qt,Kt,Wt,qt,Qt]],Xt[At.ConnectionEnd.server]=[[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[Ht,Kt,qt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,Gt,Qt],[qt,Kt,Wt,qt,Qt]];var Yt=At.handleHelloRequest,$t=At.handleServerHello,Zt=At.handleCertificate,Jt=At.handleServerKeyExchange,er=At.handleCertificateRequest,tr=At.handleServerHelloDone,rr=At.handleFinished,nr=[];nr[At.ConnectionEnd.client]=[[qt,qt,$t,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,Zt,Jt,er,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,Jt,er,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,er,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,rr],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt]];var ir=At.handleClientHello,or=At.handleClientKeyExchange,ar=At.handleCertificateVerify;nr[At.ConnectionEnd.server]=[[qt,ir,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,Zt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,or,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,ar,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,rr],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt]],At.generateKeys=function(e,t){var r=kt,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===At.Versions.TLS_1_0.major&&e.version.minor===At.Versions.TLS_1_0.minor;o&&(i+=2*t.fixed_iv_length);var a=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:a.getBytes(t.mac_key_length),server_write_MAC_key:a.getBytes(t.mac_key_length),client_write_key:a.getBytes(t.enc_key_length),server_write_key:a.getBytes(t.enc_key_length)};return o&&(s.client_write_IV=a.getBytes(t.fixed_iv_length),s.server_write_IV=a.getBytes(t.fixed_iv_length)),s},At.createConnectionState=function(e){var t=e.entity===At.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=At.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case At.CompressionMethod.none:break;case At.CompressionMethod.deflate:n.read.compressFunction=Bt,n.write.compressFunction=St;break;default:throw new Error("Unsupported compression algorithm.")}}return n},At.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=j.util.createBuffer();return r.putInt32(t),r.putBytes(j.random.getBytes(28)),r},At.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},At.createAlert=function(e,t){var r=j.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),At.createRecord(e,{type:At.ContentType.alert,data:r})},At.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=j.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var n=e.cipherSuites[r];t.putByte(n.id[0]),t.putByte(n.id[1])}var i=t.length(),o=j.util.createBuffer();o.putByte(At.CompressionMethod.none);var a=o.length(),s=j.util.createBuffer();if(e.virtualHost){var c=j.util.createBuffer();c.putByte(0),c.putByte(0);var l=j.util.createBuffer();l.putByte(0),It(l,2,j.util.createBuffer(e.virtualHost));var u=j.util.createBuffer();It(u,2,l),It(c,2,u),s.putBuffer(c)}var d=s.length();d>0&&(d+=2);var f=e.session.id,p=f.length+1+2+4+28+2+i+1+a+d,h=j.util.createBuffer();return h.putByte(At.HandshakeType.client_hello),h.putInt24(p),h.putByte(e.version.major),h.putByte(e.version.minor),h.putBytes(e.session.sp.client_random),It(h,1,j.util.createBuffer(f)),It(h,2,t),It(h,1,o),d>0&&It(h,2,s),h},At.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=j.util.createBuffer();return n.putByte(At.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),It(n,1,j.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},At.createCertificate=function(e){var t,r=e.entity===At.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var i=j.util.createBuffer();if(null!==n)try{j.util.isArray(n)||(n=[n]);for(var o=null,a=0;a<n.length;++a){var s=j.pem.decode(n[a])[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=s.type,c}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var l=j.util.createBuffer(s.body);null===o&&(o=j.asn1.fromDer(l.bytes(),!1));var u=j.util.createBuffer();It(u,3,l),i.putBuffer(u)}n=j.pki.certificateFromAsn1(o),r?e.session.clientCertificate=n:e.session.serverCertificate=n}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.bad_certificate}})}var d=3+i.length(),f=j.util.createBuffer();return f.putByte(At.HandshakeType.certificate),f.putInt24(d),It(f,3,i),f},At.createClientKeyExchange=function(e){var t=j.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(j.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var n=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,i=j.util.createBuffer();return i.putByte(At.HandshakeType.client_key_exchange),i.putInt24(n),i.putInt16(t.length),i.putBytes(t),i},At.createServerKeyExchange=function(e){return j.util.createBuffer()},At.getClientSignature=function(e,t){var r=j.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var n=null;if(e.getPrivateKey)try{n=e.getPrivateKey(e,e.session.clientCertificate),n=j.pki.privateKeyFromPem(n)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}})}null===n?e.error(e,{message:"No private key set.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}}):t=n.sign(t,null),r(e,t)},e.getSignature(e,r,t)},At.createCertificateVerify=function(e,t){var r=t.length+2,n=j.util.createBuffer();return n.putByte(At.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(t.length),n.putBytes(t),n},At.createCertificateRequest=function(e){var t=j.util.createBuffer();t.putByte(1);var r=j.util.createBuffer();for(var n in e.caStore.certs){var i=e.caStore.certs[n],o=j.pki.distinguishedNameToAsn1(i.subject),a=j.asn1.toDer(o);r.putInt16(a.length()),r.putBuffer(a)}var s=1+t.length()+2+r.length(),c=j.util.createBuffer();return c.putByte(At.HandshakeType.certificate_request),c.putInt24(s),It(c,1,t),It(c,2,r),c},At.createServerHelloDone=function(e){var t=j.util.createBuffer();return t.putByte(At.HandshakeType.server_hello_done),t.putInt24(0),t},At.createChangeCipherSpec=function(){var e=j.util.createBuffer();return e.putByte(1),e},At.createFinished=function(e){var t=j.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===At.ConnectionEnd.client,n=e.session.sp,i=r?"client finished":"server finished";t=kt(n.master_secret,i,t.getBytes(),12);var o=j.util.createBuffer();return o.putByte(At.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o},At.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var n=j.util.createBuffer();n.putByte(e),n.putInt16(r),n.putBytes(t);var i=n.length(),o=Math.max(16,i-r-3);return n.putBytes(j.random.getBytes(o)),n},At.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==At.ContentType.handshake&&t.type!==At.ContentType.alert&&t.type!==At.ContentType.change_cipher_spec)){if(t.type===At.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var n;if(t.fragment.length()<=At.MaxFragment)n=[t];else{n=[];for(var i=t.fragment.bytes();i.length>At.MaxFragment;)n.push(At.createRecord(e,{type:t.type,data:j.util.createBuffer(i.slice(0,At.MaxFragment))})),i=i.slice(At.MaxFragment);i.length>0&&n.push(At.createRecord(e,{type:t.type,data:j.util.createBuffer(i)}))}for(var o=0;o<n.length&&!e.fail;++o){var a=n[o];e.state.current.write.update(e,a)&&e.records.push(a)}}},At.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var sr=function(e){switch(e){case!0:return!0;case j.pki.certificateError.bad_certificate:return At.Alert.Description.bad_certificate;case j.pki.certificateError.unsupported_certificate:return At.Alert.Description.unsupported_certificate;case j.pki.certificateError.certificate_revoked:return At.Alert.Description.certificate_revoked;case j.pki.certificateError.certificate_expired:return At.Alert.Description.certificate_expired;case j.pki.certificateError.certificate_unknown:return At.Alert.Description.certificate_unknown;case j.pki.certificateError.unknown_ca:return At.Alert.Description.unknown_ca;default:return At.Alert.Description.bad_certificate}};for(var cr in At.verifyCertificateChain=function(e,t){try{var r={};for(var n in e.verifyOptions)r[n]=e.verifyOptions[n];r.verify=function(t,r,n){sr(t);var i=e.verify(e,t,r,n);if(!0!==i){if("object"==x(i)&&!j.util.isArray(i)){var o=new Error("The application rejected the certificate.");throw o.send=!0,o.alert={level:At.Alert.Level.fatal,description:At.Alert.Description.bad_certificate},i.message&&(o.message=i.message),i.alert&&(o.alert.description=i.alert),o}i!==t&&(i=function(e){switch(e){case!0:return!0;case At.Alert.Description.bad_certificate:return j.pki.certificateError.bad_certificate;case At.Alert.Description.unsupported_certificate:return j.pki.certificateError.unsupported_certificate;case At.Alert.Description.certificate_revoked:return j.pki.certificateError.certificate_revoked;case At.Alert.Description.certificate_expired:return j.pki.certificateError.certificate_expired;case At.Alert.Description.certificate_unknown:return j.pki.certificateError.certificate_unknown;case At.Alert.Description.unknown_ca:return j.pki.certificateError.unknown_ca;default:return j.pki.certificateError.bad_certificate}}(i))}return i},j.pki.verifyCertificateChain(e.caStore,t,r)}catch(t){var i=t;("object"!=x(i)||j.util.isArray(i))&&(i={send:!0,alert:{level:At.Alert.Level.fatal,description:sr(t)}}),"send"in i||(i.send=!0),"alert"in i||(i.alert={level:At.Alert.Level.fatal,description:sr(i.error)}),e.error(e,i)}return!e.fail},At.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var n in(r={}).cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(n):delete e[n];r.getSession=function(e){var t=null,n=null;if(e?n=j.util.bytesToHex(e):r.order.length>0&&(n=r.order[0]),null!==n&&n in r.cache)for(var i in t=r.cache[n],delete r.cache[n],r.order)if(r.order[i]===n){r.order.splice(i,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=j.util.bytesToHex(e),r.order.push(n),r.cache[n]=t}}return r},At.createConnection=function(e){var t;t=e.caStore?j.util.isArray(e.caStore)?j.pki.createCaStore(e.caStore):e.caStore:j.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],At.CipherSuites)r.push(At.CipherSuites[n]);var i=e.server?At.ConnectionEnd.server:At.ConnectionEnd.client,o=e.sessionCache?At.createSessionCache(e.sessionCache):null,a={version:{major:At.Version.major,minor:At.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:o,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:j.util.createBuffer(),tlsData:j.util.createBuffer(),data:j.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===At.ConnectionEnd.client?"client":"server"),r.send&&(At.queue(t,At.createAlert(t,r.alert)),At.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){a.version={major:At.Version.major,minor:At.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=(At.ConnectionEnd.client,0),a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(e||void 0===e),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=At.createConnectionState(a)}};return a.reset(),a.handshake=function(e){if(a.entity!==At.ConnectionEnd.client)a.error(a,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(a.handshaking)a.error(a,{message:"Handshake already in progress.",fatal:!1});else{a.fail&&!a.open&&0===a.handshakes&&(a.fail=!1),a.handshaking=!0;var t=null;(e=e||"").length>0&&(a.sessionCache&&(t=a.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&a.sessionCache&&null!==(t=a.sessionCache.getSession())&&(e=t.id),a.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:j.md.md5.create(),sha1:j.md.sha1.create()},t&&(a.version=t.version,a.session.sp=t.sp),a.session.sp.client_random=At.createRandom().getBytes(),a.open=!0,At.queue(a,At.createRecord(a,{type:At.ContentType.handshake,data:At.createClientHello(a)})),At.flush(a)}},a.process=function(e){var t=0;return e&&a.input.putBytes(e),a.fail||(null!==a.record&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),null===a.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:j.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.protocol_version}})}return t}(a)),a.fail||null===a.record||a.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(a)),!a.fail&&null!==a.record&&a.record.ready&&function(e,t){var r=t.type-At.ContentType.change_cipher_spec,n=Xt[e.entity][e.expect];r in n?n[r](e,t):At.handleUnexpected(e,t)}(a,a.record)),t},a.prepare=function(e){return At.queue(a,At.createRecord(a,{type:At.ContentType.application_data,data:j.util.createBuffer(e)})),At.flush(a)},a.prepareHeartbeatRequest=function(e,t){return e instanceof j.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),a.expectedHeartbeatPayload=e,At.queue(a,At.createRecord(a,{type:At.ContentType.heartbeat,data:At.createHeartbeat(At.HeartbeatMessageType.heartbeat_request,e,t)})),At.flush(a)},a.close=function(e){if(!a.fail&&a.sessionCache&&a.session){var t={id:a.session.id,version:a.session.version,sp:a.session.sp};t.sp.keys=null,a.sessionCache.setSession(t.id,t)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,At.queue(a,At.createAlert(a,{level:At.Alert.Level.warning,description:At.Alert.Description.close_notify})),At.flush(a)),a.closed(a)),a.reset(e)},a},j.tls=j.tls||{},At)"function"!=typeof At[cr]&&(j.tls[cr]=At[cr]);j.tls.prf_tls1=kt,j.tls.hmac_sha1=function(e,t,r){var n=j.hmac.create();n.start("SHA1",e);var i=j.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(r.type),i.putByte(r.version.major),i.putByte(r.version.minor),i.putInt16(r.length),i.putBytes(r.fragment.bytes()),n.update(i.getBytes()),n.digest().getBytes()},j.tls.createSessionCache=At.createSessionCache,j.tls.createConnection=At.createConnection,_((function(e){var t=e.exports=j.tls;function r(e,r,i){var o=r.entity===j.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:j.cipher.createDecipher("AES-CBC",o?i.keys.server_write_key:i.keys.client_write_key),iv:o?i.keys.server_write_IV:i.keys.client_write_IV},e.write.cipherState={init:!1,cipher:j.cipher.createCipher("AES-CBC",o?i.keys.client_write_key:i.keys.server_write_key),iv:o?i.keys.client_write_IV:i.keys.server_write_IV},e.read.cipherFunction=a,e.write.cipherFunction=n,e.read.macLength=e.write.macLength=i.mac_length,e.read.macFunction=e.write.macFunction=t.hmac_sha1}function n(e,r){var n,o=!1,a=r.macFunction(r.macKey,r.sequenceNumber,e);e.fragment.putBytes(a),r.updateSequenceNumber(),n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:j.random.getBytesSync(16),r.cipherState.init=!0;var s=r.cipherState.cipher;return s.start({iv:n}),e.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(i)&&(e.fragment=s.output,e.length=e.fragment.length(),o=!0),o}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var i=t.length(),o=t.last(),a=i-1-o;a<i-1;++a)n=n&&t.at(a)==o;n&&t.truncate(o+1)}return n}function a(e,r){var n,i;n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:e.fragment.getBytes(16),r.cipherState.init=!0;var a=r.cipherState.cipher;a.start({iv:n}),a.update(e.fragment),i=a.finish(o);var s=r.macLength,c=j.random.getBytesSync(s),l=a.output.length();l>=s?(e.fragment=a.output.getBytes(l-s),c=a.output.getBytes(s)):e.fragment=a.output.getBytes(),e.fragment=j.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=r.macFunction(r.macKey,r.sequenceNumber,e);return r.updateSequenceNumber(),function(e,t,r){var n=j.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),t===n.digest().getBytes()}(r.macKey,c,u)&&i}t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r}})),j.debug=j.debug||{},j.debug.storage={},j.debug.get=function(e,t){var r;return void 0===e?r=j.debug.storage:e in j.debug.storage&&(r=void 0===t?j.debug.storage[e]:j.debug.storage[e][t]),r},j.debug.set=function(e,t,r){e in j.debug.storage||(j.debug.storage[e]={}),j.debug.storage[e][t]=r},j.debug.clear=function(e,t){void 0===e?j.debug.storage={}:e in j.debug.storage&&(void 0===t?delete j.debug.storage[e]:delete j.debug.storage[e][t])},_((function(e){var t=e.exports=j.sha512=j.sha512||{};j.md.sha512=j.md.algorithms.sha512=t;var r=j.sha384=j.sha512.sha384=j.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},j.md.sha384=j.md.algorithms.sha384=r,j.sha512.sha256=j.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},j.md["sha512/256"]=j.md.algorithms["sha512/256"]=j.sha512.sha256,j.sha512.sha224=j.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},j.md["sha512/224"]=j.md.algorithms["sha512/224"]=j.sha512.sha224,t.create=function(e){if(i||(n=String.fromCharCode(128),n+=j.util.fillString(String.fromCharCode(0),128),o=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(a={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],a["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],a["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],a["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],i=!0),void 0===e&&(e="SHA-512"),!(e in a))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=a[e],r=null,c=j.util.createBuffer(),l=new Array(80),u=0;u<80;++u)l[u]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,n=0;n<e;++n)f.fullMessageLength.push(0);for(c=j.util.createBuffer(),r=new Array(t.length),n=0;n<t.length;++n)r[n]=t[n].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=j.util.encodeUtf8(e));var n=e.length;f.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var i=f.fullMessageLength.length-1;i>=0;--i)f.fullMessageLength[i]+=n[1],n[1]=n[0]+(f.fullMessageLength[i]/4294967296>>>0),f.fullMessageLength[i]=f.fullMessageLength[i]>>>0,n[0]=n[1]/4294967296>>>0;return c.putBytes(e),s(r,l,c),(c.read>2048||0===c.length())&&c.compact(),f},f.digest=function(){var t=j.util.createBuffer();t.putBytes(c.bytes());var i,o=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(n.substr(0,f.blockLength-o));for(var a=8*f.fullMessageLength[0],u=0;u<f.fullMessageLength.length-1;++u)a+=(i=8*f.fullMessageLength[u+1])/4294967296>>>0,t.putInt32(a>>>0),a=i>>>0;t.putInt32(a);var d=new Array(r.length);for(u=0;u<r.length;++u)d[u]=r[u].slice(0);s(d,l,t);var p,h=j.util.createBuffer();for(p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4,u=0;u<p;++u)h.putInt32(d[u][0]),u===p-1&&"SHA-512/224"===e||h.putInt32(d[u][1]);return h},f};var n=null,i=!1,o=null,a=null;function s(e,t,r){for(var n,i,a,s,c,l,u,d,f,p,h,m,g,v,y,b,_,C,w,k,S,B,E,I,A,x,T,P,R,D,L,N,O,F=r.length();F>=128;){for(T=0;T<16;++T)t[T][0]=r.getInt32()>>>0,t[T][1]=r.getInt32()>>>0;for(;T<80;++T)n=(((P=(D=t[T-2])[0])>>>19|(R=D[1])<<13)^(R>>>29|P<<3)^P>>>6)>>>0,i=((P<<13|R>>>19)^(R<<3|P>>>29)^(P<<26|R>>>6))>>>0,a=(((P=(N=t[T-15])[0])>>>1|(R=N[1])<<31)^(P>>>8|R<<24)^P>>>7)>>>0,s=((P<<31|R>>>1)^(P<<24|R>>>8)^(P<<25|R>>>7))>>>0,L=t[T-7],O=t[T-16],R=i+L[1]+s+O[1],t[T][0]=n+L[0]+a+O[0]+(R/4294967296>>>0)>>>0,t[T][1]=R>>>0;for(h=e[0][0],m=e[0][1],g=e[1][0],v=e[1][1],y=e[2][0],b=e[2][1],_=e[3][0],C=e[3][1],w=e[4][0],k=e[4][1],S=e[5][0],B=e[5][1],E=e[6][0],I=e[6][1],A=e[7][0],x=e[7][1],T=0;T<80;++T)u=((w>>>14|k<<18)^(w>>>18|k<<14)^(k>>>9|w<<23))>>>0,d=(E^w&(S^E))>>>0,c=((h>>>28|m<<4)^(m>>>2|h<<30)^(m>>>7|h<<25))>>>0,l=((h<<4|m>>>28)^(m<<30|h>>>2)^(m<<25|h>>>7))>>>0,f=(h&g|y&(h^g))>>>0,p=(m&v|b&(m^v))>>>0,R=x+(((w<<18|k>>>14)^(w<<14|k>>>18)^(k<<23|w>>>9))>>>0)+((I^k&(B^I))>>>0)+o[T][1]+t[T][1],n=A+u+d+o[T][0]+t[T][0]+(R/4294967296>>>0)>>>0,i=R>>>0,a=c+f+((R=l+p)/4294967296>>>0)>>>0,s=R>>>0,A=E,x=I,E=S,I=B,S=w,B=k,w=_+n+((R=C+i)/4294967296>>>0)>>>0,k=R>>>0,_=y,C=b,y=g,b=v,g=h,v=m,h=n+a+((R=i+s)/4294967296>>>0)>>>0,m=R>>>0;R=e[0][1]+m,e[0][0]=e[0][0]+h+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+v,e[1][0]=e[1][0]+g+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+b,e[2][0]=e[2][0]+y+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+C,e[3][0]=e[3][0]+_+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+k,e[4][0]=e[4][0]+w+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+B,e[5][0]=e[5][0]+S+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+I,e[6][0]=e[6][0]+E+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+x,e[7][0]=e[7][0]+A+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,F-=128}}}));var lr=j.asn1,ur={privateKeyValidator:{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:lr.Class.UNIVERSAL,type:lr.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},publicKeyValidator:{name:"SubjectPublicKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:lr.Class.UNIVERSAL,type:lr.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},dr=ur.publicKeyValidator,fr=ur.privateKeyValidator;if(void 0===pr)var pr=j.jsbn.BigInteger;var hr=j.util.ByteBuffer,mr="undefined"==typeof Buffer?Uint8Array:Buffer;j.pki=j.pki||{},j.pki.ed25519=j.ed25519=j.ed25519||{};var gr=j.ed25519;function vr(e){var t=e.message;if(t instanceof Uint8Array||t instanceof mr)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new hr(t,r)}else if(!(t instanceof hr))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new mr(t.length()),i=0;i<n.length;++i)n[i]=t.at(i);return n}gr.constants={},gr.constants.PUBLIC_KEY_BYTE_LENGTH=32,gr.constants.PRIVATE_KEY_BYTE_LENGTH=64,gr.constants.SEED_BYTE_LENGTH=32,gr.constants.SIGN_BYTE_LENGTH=64,gr.constants.HASH_BYTE_LENGTH=64,gr.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=j.random.getBytesSync(gr.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==gr.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+gr.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=vr({message:t,encoding:"binary"});for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=new mr(gr.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)n[i]=t[i];return function(e,t){var r,n=[jr(),jr(),jr(),jr()],i=Er(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,Fr(n,i),Pr(e,n),r=0;r<32;++r)t[r+32]=e[r]}(r,n),{publicKey:r,privateKey:n}},gr.privateKeyFromAsn1=function(e){var t={},r=[];if(!j.asn1.validate(e,fr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var i=j.asn1.derToOid(t.privateKeyOid),o=j.oids.EdDSA25519;if(i!==o)throw new Error('Invalid OID "'+i+'"; OID must be "'+o+'".');var a=t.privateKey;return{privateKeyBytes:vr({message:j.asn1.fromDer(a).value,encoding:"binary"})}},gr.publicKeyFromAsn1=function(e){var t={},r=[];if(!j.asn1.validate(e,dr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var i=j.asn1.derToOid(t.publicKeyOid),o=j.oids.EdDSA25519;if(i!==o)throw new Error('Invalid OID "'+i+'"; OID must be "'+o+'".');var a=t.ed25519PublicKey;if(a.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return vr({message:a,encoding:"binary"})},gr.publicKeyFromPrivateKey=function(e){var t=vr({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},gr.sign=function(e){var t=vr(e=e||{}),r=vr({message:e.privateKey,encoding:"binary"});if(r.length===gr.constants.SEED_BYTE_LENGTH)r=gr.generateKeyPair({seed:r}).privateKey;else if(r.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.SEED_BYTE_LENGTH+" or "+gr.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var i,o,a=new Float64Array(64),s=[jr(),jr(),jr(),jr()],c=Er(n,32);for(c[0]&=248,c[31]&=127,c[31]|=64,i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=c[32+i];var l=Er(e.subarray(32),r+32);for(Ar(l),Fr(s,l),Pr(e,s),i=32;i<64;++i)e[i]=n[i];var u=Er(e,r+64);for(Ar(u),i=32;i<64;++i)a[i]=0;for(i=0;i<32;++i)a[i]=l[i];for(i=0;i<32;++i)for(o=0;o<32;o++)a[i+o]+=u[i]*c[o];Ir(e.subarray(32),a)}(n,t,t.length,r);for(var i=new mr(gr.constants.SIGN_BYTE_LENGTH),o=0;o<i.length;++o)i[o]=n[o];return i},gr.verify=function(e){var t=vr(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=vr({message:e.signature,encoding:"binary"});if(r.length!==gr.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+gr.constants.SIGN_BYTE_LENGTH);var n=vr({message:e.publicKey,encoding:"binary"});if(n.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+gr.constants.PUBLIC_KEY_BYTE_LENGTH);var i,o=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length),a=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);for(i=0;i<gr.constants.SIGN_BYTE_LENGTH;++i)o[i]=r[i];for(i=0;i<t.length;++i)o[i+gr.constants.SIGN_BYTE_LENGTH]=t[i];return function(e,t,r,n){var i,o=new mr(32),a=[jr(),jr(),jr(),jr()],s=[jr(),jr(),jr(),jr()];if(r<64)return-1;if(function(e,t){var r=jr(),n=jr(),i=jr(),o=jr(),a=jr(),s=jr(),c=jr();return Mr(e[2],br),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),Hr(i,e[1]),Kr(o,i,_r),qr(i,i,e[2]),zr(o,e[2],o),Hr(a,o),Hr(s,a),Kr(c,s,a),Kr(r,c,i),Kr(r,r,o),function(e,t){var r,n=jr();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)Hr(n,n),1!==r&&Kr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),Kr(r,r,i),Kr(r,r,o),Kr(r,r,o),Kr(e[0],r,o),Hr(n,e[0]),Kr(n,n,o),Dr(n,i)&&Kr(e[0],e[0],Br),Hr(n,e[0]),Kr(n,n,o),Dr(n,i)?-1:(Nr(e[0])===t[31]>>7&&qr(e[0],yr,e[0]),Kr(e[3],e[0],e[1]),0)}(s,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var c=Er(e,r);if(Ar(c),Or(a,s,c),Fr(s,t.subarray(32)),xr(a,s),Pr(o,a),r-=64,Lr(t,0,o,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return r}(a,o,o.length,n)>=0};var yr=jr(),br=jr([1]),_r=jr([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Cr=jr([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),wr=jr([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),kr=jr([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Sr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Br=jr([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Er(e,t){var r=j.md.sha512.create(),n=new hr(e);r.update(n.getBytes(t),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var o=new mr(gr.constants.HASH_BYTE_LENGTH),a=0;a<64;++a)o[a]=i.charCodeAt(a);return o}function Ir(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)t[i]+=r-16*t[n]*Sr[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*Sr[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*Sr[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function Ar(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;Ir(e,t)}function xr(e,t){var r=jr(),n=jr(),i=jr(),o=jr(),a=jr(),s=jr(),c=jr(),l=jr(),u=jr();qr(r,e[1],e[0]),qr(u,t[1],t[0]),Kr(r,r,u),zr(n,e[0],e[1]),zr(u,t[0],t[1]),Kr(n,n,u),Kr(i,e[3],t[3]),Kr(i,i,Cr),Kr(o,e[2],t[2]),zr(o,o,o),qr(a,n,r),qr(s,o,i),zr(c,o,i),zr(l,n,r),Kr(e[0],a,s),Kr(e[1],l,c),Kr(e[2],c,s),Kr(e[3],a,l)}function Tr(e,t,r){for(var n=0;n<4;++n)Ur(e[n],t[n],r)}function Pr(e,t){var r=jr(),n=jr(),i=jr();!function(e,t){var r,n=jr();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)Hr(n,n),2!==r&&4!==r&&Kr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(i,t[2]),Kr(r,t[0],i),Kr(n,t[1],i),Rr(e,n),e[31]^=Nr(r)<<7}function Rr(e,t){var r,n,i,o=jr(),a=jr();for(r=0;r<16;++r)a[r]=t[r];for(Vr(a),Vr(a),Vr(a),n=0;n<2;++n){for(o[0]=a[0]-65517,r=1;r<15;++r)o[r]=a[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=a[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,Ur(a,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function Dr(e,t){var r=new mr(32),n=new mr(32);return Rr(r,e),Rr(n,t),Lr(r,0,n,0)}function Lr(e,t,r,n){return function(e,t,r,n,i){var o,a=0;for(o=0;o<32;++o)a|=e[t+o]^r[n+o];return(1&a-1>>>8)-1}(e,t,r,n)}function Nr(e){var t=new mr(32);return Rr(t,e),1&t[0]}function Or(e,t,r){var n,i;for(Mr(e[0],yr),Mr(e[1],br),Mr(e[2],br),Mr(e[3],yr),i=255;i>=0;--i)Tr(e,t,n=r[i/8|0]>>(7&i)&1),xr(t,e),xr(e,e),Tr(e,t,n)}function Fr(e,t){var r=[jr(),jr(),jr(),jr()];Mr(r[0],wr),Mr(r[1],kr),Mr(r[2],br),Kr(r[3],wr,kr),Or(e,r,t)}function Mr(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function Vr(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function Ur(e,t,r){for(var n,i=~(r-1),o=0;o<16;++o)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function jr(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function zr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function qr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function Hr(e,t){Kr(e,t,t)}function Kr(e,t,r){var n,i,o=0,a=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,h=0,m=0,g=0,v=0,y=0,b=0,_=0,C=0,w=0,k=0,S=0,B=0,E=0,I=0,A=0,x=0,T=0,P=0,R=0,D=0,L=0,N=0,O=r[0],F=r[1],M=r[2],V=r[3],U=r[4],j=r[5],z=r[6],q=r[7],H=r[8],K=r[9],W=r[10],G=r[11],Q=r[12],X=r[13],Y=r[14],$=r[15];o+=(n=t[0])*O,a+=n*F,s+=n*M,c+=n*V,l+=n*U,u+=n*j,d+=n*z,f+=n*q,p+=n*H,h+=n*K,m+=n*W,g+=n*G,v+=n*Q,y+=n*X,b+=n*Y,_+=n*$,a+=(n=t[1])*O,s+=n*F,c+=n*M,l+=n*V,u+=n*U,d+=n*j,f+=n*z,p+=n*q,h+=n*H,m+=n*K,g+=n*W,v+=n*G,y+=n*Q,b+=n*X,_+=n*Y,C+=n*$,s+=(n=t[2])*O,c+=n*F,l+=n*M,u+=n*V,d+=n*U,f+=n*j,p+=n*z,h+=n*q,m+=n*H,g+=n*K,v+=n*W,y+=n*G,b+=n*Q,_+=n*X,C+=n*Y,w+=n*$,c+=(n=t[3])*O,l+=n*F,u+=n*M,d+=n*V,f+=n*U,p+=n*j,h+=n*z,m+=n*q,g+=n*H,v+=n*K,y+=n*W,b+=n*G,_+=n*Q,C+=n*X,w+=n*Y,k+=n*$,l+=(n=t[4])*O,u+=n*F,d+=n*M,f+=n*V,p+=n*U,h+=n*j,m+=n*z,g+=n*q,v+=n*H,y+=n*K,b+=n*W,_+=n*G,C+=n*Q,w+=n*X,k+=n*Y,S+=n*$,u+=(n=t[5])*O,d+=n*F,f+=n*M,p+=n*V,h+=n*U,m+=n*j,g+=n*z,v+=n*q,y+=n*H,b+=n*K,_+=n*W,C+=n*G,w+=n*Q,k+=n*X,S+=n*Y,B+=n*$,d+=(n=t[6])*O,f+=n*F,p+=n*M,h+=n*V,m+=n*U,g+=n*j,v+=n*z,y+=n*q,b+=n*H,_+=n*K,C+=n*W,w+=n*G,k+=n*Q,S+=n*X,B+=n*Y,E+=n*$,f+=(n=t[7])*O,p+=n*F,h+=n*M,m+=n*V,g+=n*U,v+=n*j,y+=n*z,b+=n*q,_+=n*H,C+=n*K,w+=n*W,k+=n*G,S+=n*Q,B+=n*X,E+=n*Y,I+=n*$,p+=(n=t[8])*O,h+=n*F,m+=n*M,g+=n*V,v+=n*U,y+=n*j,b+=n*z,_+=n*q,C+=n*H,w+=n*K,k+=n*W,S+=n*G,B+=n*Q,E+=n*X,I+=n*Y,A+=n*$,h+=(n=t[9])*O,m+=n*F,g+=n*M,v+=n*V,y+=n*U,b+=n*j,_+=n*z,C+=n*q,w+=n*H,k+=n*K,S+=n*W,B+=n*G,E+=n*Q,I+=n*X,A+=n*Y,x+=n*$,m+=(n=t[10])*O,g+=n*F,v+=n*M,y+=n*V,b+=n*U,_+=n*j,C+=n*z,w+=n*q,k+=n*H,S+=n*K,B+=n*W,E+=n*G,I+=n*Q,A+=n*X,x+=n*Y,T+=n*$,g+=(n=t[11])*O,v+=n*F,y+=n*M,b+=n*V,_+=n*U,C+=n*j,w+=n*z,k+=n*q,S+=n*H,B+=n*K,E+=n*W,I+=n*G,A+=n*Q,x+=n*X,T+=n*Y,P+=n*$,v+=(n=t[12])*O,y+=n*F,b+=n*M,_+=n*V,C+=n*U,w+=n*j,k+=n*z,S+=n*q,B+=n*H,E+=n*K,I+=n*W,A+=n*G,x+=n*Q,T+=n*X,P+=n*Y,R+=n*$,y+=(n=t[13])*O,b+=n*F,_+=n*M,C+=n*V,w+=n*U,k+=n*j,S+=n*z,B+=n*q,E+=n*H,I+=n*K,A+=n*W,x+=n*G,T+=n*Q,P+=n*X,R+=n*Y,D+=n*$,b+=(n=t[14])*O,_+=n*F,C+=n*M,w+=n*V,k+=n*U,S+=n*j,B+=n*z,E+=n*q,I+=n*H,A+=n*K,x+=n*W,T+=n*G,P+=n*Q,R+=n*X,D+=n*Y,L+=n*$,_+=(n=t[15])*O,a+=38*(w+=n*M),s+=38*(k+=n*V),c+=38*(S+=n*U),l+=38*(B+=n*j),u+=38*(E+=n*z),d+=38*(I+=n*q),f+=38*(A+=n*H),p+=38*(x+=n*K),h+=38*(T+=n*W),m+=38*(P+=n*G),g+=38*(R+=n*Q),v+=38*(D+=n*X),y+=38*(L+=n*Y),b+=38*(N+=n*$),o=(n=(o+=38*(C+=n*F))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=h,e[10]=m,e[11]=g,e[12]=v,e[13]=y,e[14]=b,e[15]=_}j.kem=j.kem||{};var Wr=j.jsbn.BigInteger;function Gr(e,t,r,n){e.generate=function(e,i){for(var o=new j.util.ByteBuffer,a=Math.ceil(i/n)+r,s=new j.util.ByteBuffer,c=r;c<a;++c){s.putInt32(c),t.start(),t.update(e+s.getBytes());var l=t.digest();o.putBytes(l.getBytes(n))}return o.truncate(o.length()-i),o.getBytes()}}j.kem.rsa={},j.kem.rsa.create=function(e,t){var r=(t=t||{}).prng||j.random;return{encrypt:function(t,n){var i,o=Math.ceil(t.n.bitLength()/8);do{i=new Wr(j.util.bytesToHex(r.getBytesSync(o)),16).mod(t.n)}while(i.compareTo(Wr.ONE)<=0);var a=o-(i=j.util.hexToBytes(i.toString(16))).length;return a>0&&(i=j.util.fillString(String.fromCharCode(0),a)+i),{encapsulation:t.encrypt(i,"NONE"),key:e.generate(i,n)}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}}},j.kem.kdf1=function(e,t){Gr(this,e,0,t||e.digestLength)},j.kem.kdf2=function(e,t){Gr(this,e,1,t||e.digestLength)},j.log=j.log||{},j.log.levels=["none","error","warning","info","debug","verbose","max"];var Qr={},Xr=[],Yr=null;j.log.LEVEL_LOCKED=2,j.log.NO_LEVEL_CHECK=4,j.log.INTERPOLATE=8;for(var $r=0;$r<j.log.levels.length;++$r){var Zr=j.log.levels[$r];Qr[Zr]={index:$r,name:Zr.toUpperCase()}}j.log.logMessage=function(e){for(var t=Qr[e.level].index,r=0;r<Xr.length;++r){var n=Xr[r];n.flags&j.log.NO_LEVEL_CHECK?n.f(e):t<=Qr[n.level].index&&n.f(n,e)}},j.log.prepareStandard=function(e){"standard"in e||(e.standard=Qr[e.level].name+" ["+e.category+"] "+e.message)},j.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=j.util.format.apply(this,t)}},j.log.prepareStandardFull=function(e){"standardFull"in e||(j.log.prepareStandard(e),e.standardFull=e.standard)};var Jr=["error","warning","info","debug","verbose"];for($r=0;$r<Jr.length;++$r)!function(e){j.log[e]=function(t,r){var n=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:e,category:t,message:r,arguments:n};j.log.logMessage(i)}}(Jr[$r]);if(j.log.makeLogger=function(e){var t={flags:0,f:e};return j.log.setLevel(t,"none"),t},j.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&j.log.LEVEL_LOCKED))for(var n=0;n<j.log.levels.length;++n)if(t==j.log.levels[n]){e.level=t,r=!0;break}return r},j.log.lock=function(e,t){void 0===t||t?e.flags|=j.log.LEVEL_LOCKED:e.flags&=~j.log.LEVEL_LOCKED},j.log.addLogger=function(e){Xr.push(e)},"undefined"!=typeof console&&"log"in console){var en;if(console.error&&console.warn&&console.info&&console.debug){var tn={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},rn=function(e,t){j.log.prepareStandard(t);var r=tn[t.level],n=[t.standard];n=n.concat(t.arguments.slice()),r.apply(console,n)};en=j.log.makeLogger(rn)}else rn=function(e,t){j.log.prepareStandardFull(t),console.log(t.standardFull)},en=j.log.makeLogger(rn);j.log.setLevel(en,"debug"),j.log.addLogger(en),Yr=en}else console={log:function(){}};if(null!==Yr){var nn=j.util.getQueryVariables();"console.level"in nn&&j.log.setLevel(Yr,nn["console.level"].slice(-1)[0]),"console.lock"in nn&&"true"==nn["console.lock"].slice(-1)[0]&&j.log.lock(Yr)}j.log.consoleLogger=Yr,_((function(e){var t=j.asn1,r=e.exports=j.pkcs7=j.pkcs7||{};function n(e){var n={},i=[];if(!t.validate(e,r.asn1.recipientInfoValidator,n,i)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=i,o}return{version:n.version.charCodeAt(0),issuer:j.pki.RDNAttributesAsArray(n.issuer),serialNumber:j.util.createBuffer(n.serial).toHex(),encryptedContent:{algorithm:t.derToOid(n.encAlgorithm),parameter:n.encParameter.value,content:n.encKey}}}function i(e){for(var r,n=[],i=0;i<e.length;++i)n.push((r=e[i],t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[j.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,j.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])));return n}function o(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[j.pki.distinguishedNameToAsn1({attributes:e.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,j.util.hexToBytes(e.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&r.value.push(e.authenticatedAttributesAsn1),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var n=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i<e.unauthenticatedAttributes.length;++i){var o=e.unauthenticatedAttributes[i];n.values.push(a(o))}r.value.push(n)}return r}function a(e){var r;if(e.type===j.pki.oids.contentType)r=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.value).getBytes());else if(e.type===j.pki.oids.messageDigest)r=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===j.pki.oids.signingTime){var n=new Date("1950-01-01T00:00:00Z"),i=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"==typeof o){var a=Date.parse(o);o=isNaN(a)?13===o.length?t.utcTimeToDate(o):t.generalizedTimeToDate(o):new Date(a)}r=o>=n&&o<i?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(o)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(o))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[r])])}function s(e,r,n){var i={};if(!t.validate(r,n,i,[])){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw o.errors=o,o}if(t.derToOid(i.contentType)!==j.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(i.encryptedContent){var a="";if(j.util.isArray(i.encryptedContent))for(var s=0;s<i.encryptedContent.length;++s){if(i.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=i.encryptedContent[s].value}else a=i.encryptedContent;e.encryptedContent={algorithm:t.derToOid(i.encAlgorithm),parameter:j.util.createBuffer(i.encParameter.value),content:j.util.createBuffer(a)}}if(i.content){if(a="",j.util.isArray(i.content))for(s=0;s<i.content.length;++s){if(i.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=i.content[s].value}else a=i.content;e.content=j.util.createBuffer(a)}return e.version=i.version.charCodeAt(0),e.rawCapture=i,i}function c(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case j.pki.oids["aes128-CBC"]:case j.pki.oids["aes192-CBC"]:case j.pki.oids["aes256-CBC"]:t=j.aes.createDecryptionCipher(e.encryptedContent.key);break;case j.pki.oids.desCBC:case j.pki.oids["des-EDE3-CBC"]:t=j.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}r.messageFromPem=function(e){var n=j.pem.decode(e)[0];if("PKCS7"!==n.type){var i=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=t.fromDer(n.body);return r.messageFromAsn1(o)},r.messageToPem=function(e,r){var n={type:"PKCS7",body:t.toDer(e.toAsn1()).getBytes()};return j.pem.encode(n,{maxline:r})},r.messageFromAsn1=function(e){var n={},i=[];if(!t.validate(e,r.asn1.contentInfoValidator,n,i)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=i,o}var a,s=t.derToOid(n.contentType);switch(s){case j.pki.oids.envelopedData:a=r.createEnvelopedData();break;case j.pki.oids.encryptedData:a=r.createEncryptedData();break;case j.pki.oids.signedData:a=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return a.fromAsn1(n.content.value[0]),a},r.createSignedData=function(){var e=null;return e={type:j.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(e,t,r.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,i=0;i<n.length;++i)e.certificates.push(j.pki.certificateFromAsn1(n[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(j.pki.certificateToAsn1(e.certificates[n]));var i=[],o=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&o.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),i.length>0&&o.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,i)),o.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),o])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=j.pki.certificateFromPem(i)),r=i.issuer.attributes,n=i.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=j.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||j.pki.oids.sha1;switch(a){case j.pki.oids.sha1:case j.pki.oids.sha256:case j.pki.oids.sha384:case j.pki.oids.sha512:case j.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,l=!1,u=0;u<s.length;++u){var d=s[u];if(c||d.type!==j.pki.oids.contentType){if(l||d.type!==j.pki.oids.messageDigest);else if(l=!0,c)break}else if(c=!0,l)break}if(!c||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:r,serialNumber:n,digestAlgorithm:a,signatureAlgorithm:j.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var n;r=r||{},("object"!=x(e.content)||null===e.contentInfo)&&(e.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(j.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof j.util.ByteBuffer?n=e.content.bytes():"string"==typeof e.content&&(n=j.util.encodeUtf8(e.content)),r.detached?e.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)])))),0!==e.signers.length&&function(r){var n;if(!(n=e.detachedContent?e.detachedContent:(n=e.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var i=t.derToOid(e.contentInfo.value[0].value),s=t.toDer(n);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var l=new Date,u=0;u<e.signers.length;++u){var d=e.signers[u];if(0===d.authenticatedAttributes.length){if(i!==j.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var h=d.authenticatedAttributes[p];h.type===j.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===j.pki.oids.signingTime&&(h.value||(h.value=l)),f.value.push(a(h)),d.authenticatedAttributesAsn1.value.push(a(h))}s=t.toDer(f).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}(e.signers)}(function(){for(var r={},n=0;n<e.signers.length;++n){var i=e.signers[n];(o=i.digestAlgorithm)in r||(r[o]=j.md[j.pki.oids[o]].create()),0===i.authenticatedAttributes.length?i.md=r[o]:i.md=j.md[j.pki.oids[o]].create()}for(var o in e.digestAlgorithmIdentifiers=[],r)e.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(o).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=j.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var e=null;return e={type:j.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:j.pki.oids["aes256-CBC"]},fromAsn1:function(t){s(e,t,r.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),c(e)}}},r.createEnvelopedData=function(){var e=null;return e={type:j.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:j.pki.oids["aes256-CBC"]},fromAsn1:function(t){var i=s(e,t,r.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}(i.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,i(e.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=e.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(j.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes())]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],o=i.issuer;if(i.serialNumber===t.serialNumber&&o.length===r.length){for(var a=!0,s=0;s<r.length;++s)if(o[s].type!==r[s].type||o[s].value!==r[s].value){a=!1;break}if(a)return i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case j.pki.oids.rsaEncryption:case j.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=j.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:j.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var n,i,o;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case j.pki.oids["aes128-CBC"]:n=16,i=16,o=j.aes.createEncryptionCipher;break;case j.pki.oids["aes192-CBC"]:n=24,i=16,o=j.aes.createEncryptionCipher;break;case j.pki.oids["aes256-CBC"]:n=32,i=16,o=j.aes.createEncryptionCipher;break;case j.pki.oids["des-EDE3-CBC"]:n=24,i=8,o=j.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=j.util.createBuffer(j.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=j.util.createBuffer(j.random.getBytes(i));var a=o(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var s=0;s<e.recipients.length;++s){var c=e.recipients[s];if(void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case j.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}}}})),_((function(e){var t=e.exports=j.ssh=j.ssh||{};function r(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=j.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function n(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=j.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}t.privateKeyToPutty=function(e,t,o){var a=""===(t=t||"")?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: ssh-rsa\r\n";s+="Encryption: "+a+"\r\n",s+="Comment: "+(o=o||"")+"\r\n";var c=j.util.createBuffer();n(c,"ssh-rsa"),r(c,e.e),r(c,e.n);var l=j.util.encode64(c.bytes(),64),u=Math.floor(l.length/66)+1;s+="Public-Lines: "+u+"\r\n",s+=l;var d,f=j.util.createBuffer();if(r(f,e.d),r(f,e.p),r(f,e.q),r(f,e.qInv),t){var p=f.length()+16-1;p-=p%16;var h=i(f.bytes());h.truncate(h.length()-p+f.length()),f.putBuffer(h);var m=j.util.createBuffer();m.putBuffer(i("\0\0\0\0",t)),m.putBuffer(i("\0\0\0",t));var g=j.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(j.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var v=g.output;v.truncate(16),d=j.util.encode64(v.bytes(),64)}else d=j.util.encode64(f.bytes(),64);s+="\r\nPrivate-Lines: "+(u=Math.floor(d.length/66)+1)+"\r\n",s+=d;var y=i("putty-private-key-file-mac-key",t),b=j.util.createBuffer();n(b,"ssh-rsa"),n(b,a),n(b,o),b.putInt32(c.length()),b.putBuffer(c),b.putInt32(f.length()),b.putBuffer(f);var _=j.hmac.create();return _.start("sha1",y),_.update(b.bytes()),s+"\r\nPrivate-MAC: "+_.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(e,t){t=t||"";var i=j.util.createBuffer();return n(i,"ssh-rsa"),r(i,e.e),r(i,e.n),"ssh-rsa "+j.util.encode64(i.bytes())+" "+t},t.privateKeyToOpenSSH=function(e,t){return t?j.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):j.pki.privateKeyToPem(e)},t.getPublicKeyFingerprint=function(e,t){var i=(t=t||{}).md||j.md.md5.create(),o=j.util.createBuffer();n(o,"ssh-rsa"),r(o,e.e),r(o,e.n),i.start(),i.update(o.getBytes());var a=i.digest();if("hex"===t.encoding){var s=a.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a}}));var on="forge.task",an={},sn=0;j.debug.set(on,"tasks",an);var cn={};j.debug.set(on,"queues",cn);var ln="ready",un="running",dn="blocked",fn="sleeping",pn="done",hn="error",mn={ready:{}};mn.ready.stop=ln,mn.ready.start=un,mn.ready.cancel=pn,mn.ready.fail=hn,mn.running={},mn.running.stop=ln,mn.running.start=un,mn.running.block=dn,mn.running.unblock=un,mn.running.sleep=fn,mn.running.wakeup=un,mn.running.cancel=pn,mn.running.fail=hn,mn.blocked={},mn.blocked.stop=dn,mn.blocked.start=dn,mn.blocked.block=dn,mn.blocked.unblock=dn,mn.blocked.sleep=dn,mn.blocked.wakeup=dn,mn.blocked.cancel=pn,mn.blocked.fail=hn,mn.sleeping={},mn.sleeping.stop=fn,mn.sleeping.start=fn,mn.sleeping.block=fn,mn.sleeping.unblock=fn,mn.sleeping.sleep=fn,mn.sleeping.wakeup=fn,mn.sleeping.cancel=pn,mn.sleeping.fail=hn,mn.done={},mn.done.stop=pn,mn.done.start=pn,mn.done.block=pn,mn.done.unblock=pn,mn.done.sleep=pn,mn.done.wakeup=pn,mn.done.cancel=pn,mn.done.fail=hn,mn.error={},mn.error.stop=hn,mn.error.start=hn,mn.error.block=hn,mn.error.unblock=hn,mn.error.sleep=hn,mn.error.wakeup=hn,mn.error.cancel=hn,mn.error.fail=hn;var gn=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=ln,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=sn++,an[this.id]=this};gn.prototype.debug=function(e){e=e||"",j.log.debug(on,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",cn)},gn.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new gn({run:t,name:e,parent:this});return r.state=un,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},gn.prototype.parallel=function(e,t){return j.util.isArray(e)&&(t=e,e=this.name),this.next(e,(function(r){var n=r;n.block(t.length);for(var i=function(e,r){j.task.start({type:e,run:function(e){t[r](e)},success:function(e){n.unblock()},failure:function(e){n.unblock()}})},o=0;o<t.length;o++)i(e+"__parallel-"+r.id+"-"+o,o)}))},gn.prototype.stop=function(){this.state=mn[this.state].stop},gn.prototype.start=function(){this.error=!1,this.state=mn[this.state].start,this.state===un&&(this.start=new Date,this.run(this),vn(this,0))},gn.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=mn[this.state].block)},gn.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==pn&&(this.state=un,vn(this,0)),this.blocks},gn.prototype.sleep=function(e){e=void 0===e?0:e,this.state=mn[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=un,vn(t,0)}),e)},gn.prototype.wait=function(e){e.wait(this)},gn.prototype.wakeup=function(){this.state===fn&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=un,vn(this,0))},gn.prototype.cancel=function(){this.state=mn[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},gn.prototype.fail=function(e){if(this.error=!0,yn(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,vn(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;yn(t,!0)}this.failureCallback&&this.failureCallback(this)}};var vn=function e(t,r){var n=r>30||+new Date-t.swapTime>20,i=function(r){if(r++,t.state===un)if(n&&(t.swapTime=+new Date),t.subtasks.length>0){var i=t.subtasks.shift();i.error=t.error,i.swapTime=t.swapTime,i.userData=t.userData,i.run(i),i.error||e(i,r)}else yn(t),t.error||null!==t.parent&&(t.parent.error=t.error,t.parent.swapTime=t.swapTime,t.parent.userData=t.userData,e(t.parent,r))};n?setTimeout(i,0):i(r)},yn=function(e,t){e.state=pn,delete an[e.id],null===e.parent&&(e.type in cn?0===cn[e.type].length?j.log.error(on,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):cn[e.type][0]!==e?j.log.error(on,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(cn[e.type].shift(),0===cn[e.type].length?delete cn[e.type]:cn[e.type][0].start()):j.log.error(on,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};j.task=j.task||{},j.task.start=function(e){var t=new gn({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in cn?cn[e.type].push(t):(cn[t.type]=[t],function(e){e.error=!1,e.state=mn[e.state].start,setTimeout((function(){e.state===un&&(e.swapTime=+new Date,e.run(e),vn(e,0))}),0)}(t))},j.task.cancel=function(e){e in cn&&(cn[e]=[cn[e][0]])},j.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e};var bn=j,_n=function(){function e(e){this.secretKey=e}return e.prototype.encrypt=function(e,t){throw new Error("Method not implemented.")},e.prototype.decrypt=function(e,t){return function(e,t,r){void 0===r&&(r=bn.util.createBuffer(Uint8Array.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer));var n,i,o=bn.cipher.createDecipher("AES-CBC",t);return o.start({iv:r}),o.update(bn.util.createBuffer(bn.util.hexToBytes(e))),i=(n=o.output.data).charCodeAt(n.length-1),n.slice(0,-i)}(e,(r=this.secretKey,n=t.transactionID,""+r.slice(0,16)+n.slice(0,16)));var r,n},e}(),Cn=function(){function e(e,t,n,i){void 0===n&&(n="production"),void 0===i&&(i={supportTransaction:!1,enableEncryption:!1}),this.transactionEnabled=i.supportTransaction||!1,this.encryptionEnabled=i.enableEncryption||!1;var o=O(e,t,n,{headers:i.httpHeaders});this.transactionManager=new U(o),this.encryptionService=new _n(t),this.compareFaceService=new u(o),this.clientSettingsService=new d(o),this.convertPDFService=new v(o),this.ekycPDFService=new y(o),this.readIDCardService=new r(o),this.requestVerifyIDCardService=new p(o),this.requestVerifyPortraitSerivce=new h(o),this.imagesService=new c(o),this.fileService=new l(o),this.verifyFaceLivenessService=new f(o),this.searchFaceService=new g(o),this.detectIDTamperingService=new m(o),this.httpClient=o}return e.prototype.enableTransaction=function(){this.transactionEnabled=!0},e.prototype.disableTransaction=function(){this.transactionEnabled=!1},e.prototype.enableEncryption=function(){this.encryptionEnabled=!0},e.prototype.disableEncryption=function(){this.encryptionEnabled=!1},e.prototype.compareFaces=function(e,t){return this.compareFaceService.request(e,t)},e.prototype.clientSettings=function(e,t){return this.clientSettingsService.request(e,t)},e.prototype.uploadImage=function(e,t){return this.imagesService.request(e,t)},e.prototype.uploadFile=function(e,t){return this.fileService.uploadFile(e,t)},e.prototype.convertPDF=function(e,t){return this.convertPDFService.request(e,t)},e.prototype.ekycPDF=function(e,t){return this.ekycPDFService.request(e,t)},e.prototype.readIDCard=function(e,t){return this.readIDCardService.request(e,t)},e.prototype.requestVerifyIDCard=function(e,t){return this.requestVerifyIDCardService.request(e,t)},e.prototype.requestVerifyPortrait=function(e,t){return this.requestVerifyPortraitSerivce.request(e,t)},e.prototype.verifyFaceLiveness=function(e,t){return this.verifyFaceLivenessService.request(e,t)},e.prototype.searchFaces=function(e,t){return this.searchFaceService.request(e,t)},e.prototype.deleteFaces=function(e,t){return this.searchFaceService.deleteFaces(e,t)},e.prototype.indexFaces=function(e,t){return this.searchFaceService.indexFaces(e,t)},e.prototype.detectFaces=function(e,t){return this.searchFaceService.detectFaces(e,t)},e.prototype.downloadFaceImage=function(e){return this.searchFaceService.downloadFaceImage(e)},e.prototype.downloadImage=function(e){return this.imagesService.download(e)},e.prototype.updateMetadata=function(e,t){return this.imagesService.updateMetadata(e,t)},e.prototype.detectIDTampering=function(e,t){return this.detectIDTamperingService.request(e,t)},i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"compareFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"convertPDF",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"readIDCard",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"requestVerifyIDCard",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"requestVerifyPortrait",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"verifyFaceLiveness",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"searchFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"deleteFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"indexFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"detectFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"detectIDTampering",null),e}();e.ReadIDCard=r,e.UploadImage=c,e.UploadFile=l,e.CompareFaces=u,e.ClientSettings=d,e.VerifyFaceLiveness=f,e.RequestVerifyIDCard=p,e.RequestVerifyPortrait=h,e.DetectIDTampering=m,e.SearchFaces=g,e.ConvertPDF=v,e.EkycPDF=y,e.HttpClient=A,e.MockClient=T,e.TVAuthorizer=L,e.createHelpers=function(e,t,r){void 0===r&&(r="production");var n=new L(e,t),i=function(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":default:return"https://vn-vision.trustingsocial.com/api"}}(r);return new A({authorizer:n,domain:i})},e.createHttpClient=O,e.SimpleTrustVisionAPI=F,e.default=Cn,Object.defineProperty(e,"__esModule",{value:!0})}(t,hn)}))),gn=new Uint8Array(16);function vn(){if(!fn&&!(fn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fn(gn)}var yn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function bn(e){return"string"==typeof e&&yn.test(e)}for(var _n=[],Cn=0;Cn<256;++Cn)_n.push((Cn+256).toString(16).substr(1));function wn(e,t,r){var n=(e=e||{}).random||(e.rng||vn)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(_n[e[t+0]]+_n[e[t+1]]+_n[e[t+2]]+_n[e[t+3]]+"-"+_n[e[t+4]]+_n[e[t+5]]+"-"+_n[e[t+6]]+_n[e[t+7]]+"-"+_n[e[t+8]]+_n[e[t+9]]+"-"+_n[e[t+10]]+_n[e[t+11]]+_n[e[t+12]]+_n[e[t+13]]+_n[e[t+14]]+_n[e[t+15]]).toLowerCase();if(!bn(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var kn=function(e){return Cr(e,5)},Sn=ye((function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",c="model",l="name",u="type",d="vendor",f="version",p="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",b="embedded",_="Amazon",C="Apple",w="ASUS",k="BlackBerry",S="Google",B="Huawei",E="LG",I="Microsoft",A="Motorola",T="Samsung",P="Sharp",R="Sony",D="Xiaomi",L="Zebra",N="Facebook",O="Chromium OS",F="Mac OS",M=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},V=function(e,t){return x(e)===s&&-1!==U(t).indexOf(U(e))},U=function(e){return e.toLowerCase()},j=function(e,t){if(x(e)===s)return e=e.replace(/^\s\s*/,""),x(t)===o?e:e.substring(0,500)},z=function(e,t){for(var r,o,s,c,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!l&&f[r];)if(l=f[r++].exec(e))for(s=0;s<p.length;s++)u=l[++o],x(c=p[s])===a&&c.length>0?2===c.length?x(c[1])==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?x(c[1])!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;d+=2}},q=function(e,t){for(var r in t)if(x(t[r])===a&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(V(t[r][i],e))return"?"===r?n:r}else if(V(t[r],e))return"?"===r?n:r;return e},H={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,f],[/opios[\/ ]+([\w\.]+)/i],[f,[l,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[f,[l,"Opera"]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[l,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[l,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[l,"Smart Lenovo Browser"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure Browser"],f],[/\bfocus\/([\w\.]+)/i],[f,[l,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[f,[l,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[l,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[l,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[f,[l,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 Browser"]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 Browser"],f],[/samsungbrowser\/([\w\.]+)/i],[f,[l,"Samsung Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[l,f],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,N],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[l,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,"Chrome WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[l,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[f,q,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[l,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[l,f],[/(cobalt)\/([\w\.]+)/i],[l,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,U]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",U]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,U]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[d,T],[u,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,T],[u,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[c,[d,C],[u,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,C],[u,g]],[/(macintosh);/i],[c,[d,C]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,P],[u,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,B],[u,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[d,B],[u,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,D],[u,m]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,D],[u,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[u,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[u,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[u,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[d,A],[u,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,A],[u,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,E],[u,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,E],[u,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[u,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[u,m]],[/(pixel c)\b/i],[c,[d,S],[u,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,S],[u,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[d,R],[u,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,R],[u,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[u,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,_],[u,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,_],[u,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[u,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,k],[u,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,w],[u,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,w],[u,m]],[/(nexus 9)/i],[c,[d,"HTC"],[u,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[u,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[u,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[u,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[c,[d,"Ulefone"],[u,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[u,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,c,[u,g]],[/(surface duo)/i],[c,[d,I],[u,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[u,m]],[/(u304aa)/i],[c,[d,"AT&T"],[u,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[u,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[u,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[u,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[u,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[u,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[u,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[u,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[u,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[u,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[u,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[u,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[u,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[u,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[u,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[u,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[u,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[u,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[u,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[u,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[u,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[u,g]],[/(sprint) (\w+)/i],[d,c,[u,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,I],[u,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,L],[u,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,L],[u,m]],[/smart-tv.+(samsung)/i],[d,[u,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,T],[u,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,E],[u,v]],[/(apple) ?tv/i],[d,[c,"Apple TV"],[u,v]],[/crkey/i],[[c,"Chromecast"],[d,S],[u,v]],[/droid.+aft(\w+)( bui|\))/i],[c,[d,_],[u,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[d,P],[u,v]],[/(bravia[\w ]+)( bui|\))/i],[c,[d,R],[u,v]],[/(mitv-\w{5}) bui/i],[c,[d,D],[u,v]],[/Hbbtv.*(technisat) (.*);/i],[d,c,[u,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,j],[c,j],[u,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[u,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[u,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[u,h]],[/(playstation [345portablevi]+)/i],[c,[d,R],[u,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,I],[u,h]],[/((pebble))app/i],[d,c,[u,y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[c,[d,C],[u,y]],[/droid.+; (glass) \d/i],[c,[d,S],[u,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,L],[u,y]],[/(quest( 2| pro)?)/i],[c,[d,N],[u,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[u,b]],[/(aeobc)\b/i],[c,[d,_],[u,b]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[c,[u,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[u,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[u,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[u,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[l,[f,q,H]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,q,H],[l,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,F],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,f],[/\(bb(10);/i],[f,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[l,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[l,"Chromecast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,O],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,f],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,f]]},W=function e(t,c){if(x(t)===a&&(c=t,t=n),!(this instanceof e))return new e(t,c).getResult();var l=x(r)!==o&&r.navigator?r.navigator:n,u=t||(l&&l.userAgent?l.userAgent:""),d=l&&l.userAgentData?l.userAgentData:n,f=c?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(K,c):K,p=l&&l.userAgent==u;return this.getBrowser=function(){var e={};return e.name=n,e.version=n,z.call(e,u,f.browser),e.major=function(e){return x(e)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),p&&l&&l.brave&&x(l.brave.isBrave)==i&&(e.name="Brave"),e},this.getCPU=function(){var e={};return e.architecture=n,z.call(e,u,f.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,z.call(e,u,f.device),p&&!e.type&&d&&d.mobile&&(e.type=m),p&&"Macintosh"==e.model&&l&&x(l.standalone)!==o&&l.maxTouchPoints&&l.maxTouchPoints>2&&(e.model="iPad",e.type=g),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,z.call(e,u,f.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,z.call(e,u,f.os),p&&!e.name&&d&&"Unknown"!=d.platform&&(e.name=d.platform.replace(/chrome os/i,O).replace(/macos/i,F)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return u},this.setUA=function(e){return u=x(e)===s&&e.length>500?j(e,500):e,this},this.setUA(u),this};W.VERSION="1.0.37",W.BROWSER=M([l,f,"major"]),W.CPU=M([p]),W.DEVICE=M([c,d,u,h,m,v,g,y,b]),W.ENGINE=W.OS=M([l,f]),e.exports&&(t=e.exports=W),t.UAParser=W;var G=x(r)!==o&&(r.jQuery||r.Zepto);if(G&&!G.ua){var Q=new W;G.ua=Q.getResult(),G.ua.get=function(){return Q.getUA()},G.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==("undefined"==typeof window?"undefined":x(window))?window:ve)})),Bn=ye((function(e,r){Object.defineProperty(r,"__esModule",{value:!0});var n,i=(n=t)&&"object"==x(n)&&"default"in n?n.default:n,o=new Sn,a=o.getBrowser(),s=o.getCPU(),c=o.getDevice(),l=o.getEngine(),u=o.getOS(),d=o.getUA(),f=function(e){return o.setUA(e)},p=function(e){if(e){var t=new Sn(e);return{UA:t,browser:t.getBrowser(),cpu:t.getCPU(),device:t.getDevice(),engine:t.getEngine(),os:t.getOS(),ua:t.getUA(),setUserAgent:function(e){return t.setUA(e)}}}console.error("No userAgent string was provided")},h=Object.freeze({ClientUAInstance:o,browser:a,cpu:s,device:c,engine:l,os:u,ua:d,setUa:f,parseUserAgent:p});function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){return(g="function"==typeof Symbol&&"symbol"==x(Symbol.iterator)?function(e){return x(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":x(e)})(e)}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var S="mobile",B="tablet",E="smarttv",I="console",A="wearable",T="embedded",P=void 0,R={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},D={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},L={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";return e||t},O=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},F=function(e){var t=O();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},M=function(e,t,r,n){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){v(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{vendor:N(t.vendor),model:N(t.model),os:N(r.name),osVersion:N(r.version),ua:N(n)})},V=function(e){return e.type===S},U=function(e){return e.type===B},j=function(e){var t=e.type;return t===S||t===B},z=function(e){return e.type===E},q=function(e){return e.type===P},H=function(e){return e.type===A},K=function(e){return e.type===I},W=function(e){return e.type===T},G=function(e){var t=e.vendor;return N(t)},Q=function(e){var t=e.model;return N(t)},X=function(e){var t=e.type;return N(t,"browser")},Y=function(e){return e.name===D.Android},$=function(e){return e.name===D.Windows},Z=function(e){return e.name===D.MAC_OS},J=function(e){return e.name===D.WindowsPhone},ee=function(e){return e.name===D.IOS},te=function(e){var t=e.version;return N(t)},re=function(e){var t=e.name;return N(t)},ne=function(e){return e.name===R.Chrome},ie=function(e){return e.name===R.Firefox},oe=function(e){return e.name===R.Chromium},ae=function(e){return e.name===R.Edge},se=function(e){return e.name===R.Yandex},ce=function(e){var t=e.name;return t===R.Safari||t===R.MobileSafari},le=function(e){return e.name===R.MobileSafari},ue=function(e){return e.name===R.Opera},de=function(e){var t=e.name;return t===R.InternetExplorer||t===R.Ie},fe=function(e){return e.name===R.MIUI},pe=function(e){return e.name===R.SamsungBrowser},he=function(e){var t=e.version;return N(t)},me=function(e){var t=e.major;return N(t)},ge=function(e){var t=e.name;return N(t)},ve=function(e){var t=e.name;return N(t)},ye=function(e){var t=e.version;return N(t)},be=function(){var e=O(),t=e&&e.userAgent&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)},_e=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},Ce=function(){var e=O();return e&&(/iPad|iPhone|iPod/.test(e.platform)||"MacIntel"===e.platform&&e.maxTouchPoints>1)&&!window.MSStream},we=function(){return F("iPad")},ke=function(){return F("iPhone")},Se=function(){return F("iPod")},Be=function(e){return N(e)};function Ee(e){var t=e||h,r=t.device,n=t.browser,i=t.os,o=t.engine,a=t.ua;return{isSmartTV:z(r),isConsole:K(r),isWearable:H(r),isEmbedded:W(r),isMobileSafari:le(n)||we(),isChromium:oe(n),isMobile:j(r)||we(),isMobileOnly:V(r),isTablet:U(r)||we(),isBrowser:q(r),isDesktop:q(r),isAndroid:Y(i),isWinPhone:J(i),isIOS:ee(i)||we(),isChrome:ne(n),isFirefox:ie(n),isSafari:ce(n),isOpera:ue(n),isIE:de(n),osVersion:te(i),osName:re(i),fullBrowserVersion:he(n),browserVersion:me(n),browserName:ge(n),mobileVendor:G(r),mobileModel:Q(r),engineName:ve(o),engineVersion:ye(o),getUA:Be(a),isEdge:ae(n)||_e(a),isYandex:se(n),deviceType:X(r),isIOS13:Ce(),isIPad13:we(),isIPhone13:ke(),isIPod13:Se(),isElectron:be(),isEdgeChromium:_e(a),isLegacyEdge:ae(n)&&!_e(a),isWindows:$(i),isMacOs:Z(i),isMIUI:fe(n),isSamsungBrowser:pe(n)}}var Ie=z(c),Ae=K(c),xe=H(c),Te=W(c),Pe=le(a)||we(),Re=oe(a),De=j(c)||we(),Le=V(c),Ne=U(c)||we(),Oe=q(c),Fe=q(c),Me=Y(u),Ve=J(u),Ue=ee(u)||we(),je=ne(a),ze=ie(a),qe=ce(a),He=ue(a),Ke=de(a),We=te(u),Ge=re(u),Qe=he(a),Xe=me(a),Ye=ge(a),$e=G(c),Ze=Q(c),Je=ve(l),et=ye(l),tt=Be(d),rt=ae(a)||_e(d),nt=se(a),it=X(c),ot=Ce(),at=we(),st=ke(),ct=Se(),lt=be(),ut=_e(d),dt=ae(a)&&!_e(d),ft=$(u),pt=Z(u),ht=fe(a),mt=pe(a);function gt(e){var t=e||window.navigator.userAgent;return p(t)}r.AndroidView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Me?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.BrowserTypes=R,r.BrowserView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Oe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.ConsoleView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ae?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.CustomView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,e.condition),a=C(e,["renderWithFragment","children","viewClassName","style","condition"]);return o?r?i.createElement(t.Fragment,null,n):i.createElement("div",a,n):null},r.IEView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ke?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.IOSView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ue?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileOnlyView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,C(e,["renderWithFragment","children","viewClassName","style"]));return Le?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return De?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.OsTypes=D,r.SmartTVView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ie?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.TabletView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ne?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WearableView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return xe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WinPhoneView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ve?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.browserName=Ye,r.browserVersion=Xe,r.deviceDetect=function(e){var t=e?p(e):h,r=t.device,n=t.browser,i=t.engine,o=t.os,a=t.ua,s=function(e){switch(e){case S:return{isMobile:!0};case B:return{isTablet:!0};case E:return{isSmartTV:!0};case I:return{isConsole:!0};case A:return{isWearable:!0};case P:return{isBrowser:!0};case T:return{isEmbedded:!0};default:return L}}(r.type),c=s.isBrowser,l=s.isMobile,u=s.isTablet,d=s.isSmartTV,f=s.isConsole,m=s.isWearable,g=s.isEmbedded;return c?function(e,t,r,n,i){return{isBrowser:e,browserMajorVersion:N(t.major),browserFullVersion:N(t.version),browserName:N(t.name),engineName:N(r.name),engineVersion:N(r.version),osName:N(n.name),osVersion:N(n.version),userAgent:N(i)}}(c,n,i,o,a):d?function(e,t,r,n){return{isSmartTV:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(n)}}(d,i,o,a):f?function(e,t,r,n){return{isConsole:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(n)}}(f,i,o,a):l||u?M(s,r,o,a):m?function(e,t,r,n){return{isWearable:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(n)}}(m,i,o,a):g?function(e,t,r,n,i){return{isEmbedded:e,vendor:N(t.vendor),model:N(t.model),engineName:N(r.name),engineVersion:N(r.version),osName:N(n.name),osVersion:N(n.version),userAgent:N(i)}}(g,r,i,o,a):void 0},r.deviceType=it,r.engineName=Je,r.engineVersion=et,r.fullBrowserVersion=Qe,r.getSelectorsByUserAgent=function(e){if(e&&"string"==typeof e){var t=p(e);return Ee({device:t.device,browser:t.browser,os:t.os,engine:t.engine,ua:t.ua})}console.error("No valid user agent string was provided")},r.getUA=tt,r.isAndroid=Me,r.isBrowser=Oe,r.isChrome=je,r.isChromium=Re,r.isConsole=Ae,r.isDesktop=Fe,r.isEdge=rt,r.isEdgeChromium=ut,r.isElectron=lt,r.isEmbedded=Te,r.isFirefox=ze,r.isIE=Ke,r.isIOS=Ue,r.isIOS13=ot,r.isIPad13=at,r.isIPhone13=st,r.isIPod13=ct,r.isLegacyEdge=dt,r.isMIUI=ht,r.isMacOs=pt,r.isMobile=De,r.isMobileOnly=Le,r.isMobileSafari=Pe,r.isOpera=He,r.isSafari=qe,r.isSamsungBrowser=mt,r.isSmartTV=Ie,r.isTablet=Ne,r.isWearable=xe,r.isWinPhone=Ve,r.isWindows=ft,r.isYandex=nt,r.mobileModel=Ze,r.mobileVendor=$e,r.osName=Ge,r.osVersion=We,r.parseUserAgent=p,r.setUserAgent=function(e){return f(e)},r.useDeviceData=gt,r.useDeviceSelectors=function(e){var t=gt(e||window.navigator.userAgent);return[Ee(t),t]},r.useMobileOrientation=function(){var e=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.useState((function(){var e=window.innerWidth>window.innerHeight?90:0;return{isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"}})),2),r=e[0],n=e[1],i=t.useCallback((function(){var e=window.innerWidth>window.innerHeight?90:0,t={isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"};r.orientation!==t.orientation&&n(t)}),[r.orientation]);return t.useEffect((function(){return void 0!==("undefined"==typeof window?"undefined":g(window))&&De&&(i(),window.addEventListener("load",i,!1),window.addEventListener("resize",i,!1)),function(){window.removeEventListener("resize",i,!1),window.removeEventListener("load",i,!1)}}),[i]),r},r.withOrientationChange=function(e){return function(t){function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(e,t){if(t&&("object"==x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return w(e)}(this,b(r).call(this,e))).isEventListenerAdded=!1,t.handleOrientationChange=t.handleOrientationChange.bind(w(t)),t.onOrientationChange=t.onOrientationChange.bind(w(t)),t.onPageLoad=t.onPageLoad.bind(w(t)),t.state={isLandscape:!1,isPortrait:!1},t}var n;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}(r,t),(n=[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var e=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:0===e,isLandscape:90===e})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){void 0!==("undefined"==typeof window?"undefined":g(window))&&De&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return i.createElement(e,y({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,n),r}(i.Component)}}));function En(){return"5.24.2"}function In(){return{"X-TV-Device-Model":"".concat(Bn.browserName," ").concat(Bn.browserVersion),"X-TV-OS-Version":"".concat(Bn.osName," ").concat(Bn.osVersion),"X-TV-OS-Platform":Bn.isMobile?"".concat(Bn.osName.toLowerCase(),"_web"):"web","X-TV-SDK-Version":"5.24.2"}}function An(){return"none"!==Bn.mobileVendor?Bn.mobileVendor:null}function xn(){return"none"!==Bn.mobileModel?Bn.mobileModel:null}var Tn=Object.freeze({__proto__:null,getUAMetadata:In,getManufacturer:An,getDeviceName:xn});function Pn(e){return e<10?"0".concat(e):e}function Rn(e){return"".concat(e.getFullYear(),"-").concat(Pn(e.getMonth()+1),"-").concat(Pn(e.getDate()),"T").concat(Pn(e.getHours()),":").concat(Pn(e.getMinutes()),":").concat(Pn(e.getSeconds())).concat(function(e){if(0===e)return"Z";var t=e>0?"-":"+";return e=Math.abs(e),"".concat(t+Pn(Math.floor(e/60)),":").concat(Pn(e%60))}(e.getTimezoneOffset()))}var Dn=Object.freeze({__proto__:null,rfc3339:Rn});function Ln(e,t){window.localStorage&&window.JSON&&t&&localStorage.setItem(t,JSON.stringify(e))}function Nn(e){if(window.localStorage&&window.JSON&&e){var t=localStorage.getItem(e);if(t)return JSON.parse(t)}}var On=Object.freeze({__proto__:null,storeData:Ln,getData:Nn,removeData:function(e){window.localStorage&&window.JSON&&e&&localStorage.removeItem(e)}}),Fn=ye((function(e,t){var r;e.exports=r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==ve&&ve.crypto&&(r=ve.crypto),!r)try{r=hn}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},a=o.lib={},s=a.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=o.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},f=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*l,o);if(l){for(var d=0;d<l;d+=a)this._doProcessBlock(i,d);r=i.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(a.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}}),o.algo={});return o}(Math)})),Mn=(ye((function(e,t){var r,n,i,o,a,s;e.exports=(n=(r=s=Fn).lib,i=n.Base,o=n.WordArray,(a=r.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),s)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.WordArray,n=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var o=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var a=i(t[o>>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64url={stringify:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a<n;a+=3)for(var s=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c<n;c++)o.push(i.charAt(s>>>6*(3-c)&63));var l=i.charAt(64);if(l)for(;o.length%4;)o.push(l);return o.join("")},parse:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<i.length;a++)o[i.charCodeAt(a)]=a}var s=i.charAt(64);if(s){var c=e.indexOf(s);-1!==c&&(r=c)}return n(e,r,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),r.enc.Base64url)})),ye((function(e,t){var r;e.exports=(r=Fn,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],g=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],_=e[t+9],C=e[t+10],w=e[t+11],k=e[t+12],S=e[t+13],B=e[t+14],E=e[t+15],I=o[0],A=o[1],x=o[2],T=o[3];I=l(I,A,x,T,a,7,s[0]),T=l(T,I,A,x,c,12,s[1]),x=l(x,T,I,A,p,17,s[2]),A=l(A,x,T,I,h,22,s[3]),I=l(I,A,x,T,m,7,s[4]),T=l(T,I,A,x,g,12,s[5]),x=l(x,T,I,A,v,17,s[6]),A=l(A,x,T,I,y,22,s[7]),I=l(I,A,x,T,b,7,s[8]),T=l(T,I,A,x,_,12,s[9]),x=l(x,T,I,A,C,17,s[10]),A=l(A,x,T,I,w,22,s[11]),I=l(I,A,x,T,k,7,s[12]),T=l(T,I,A,x,S,12,s[13]),x=l(x,T,I,A,B,17,s[14]),I=u(I,A=l(A,x,T,I,E,22,s[15]),x,T,c,5,s[16]),T=u(T,I,A,x,v,9,s[17]),x=u(x,T,I,A,w,14,s[18]),A=u(A,x,T,I,a,20,s[19]),I=u(I,A,x,T,g,5,s[20]),T=u(T,I,A,x,C,9,s[21]),x=u(x,T,I,A,E,14,s[22]),A=u(A,x,T,I,m,20,s[23]),I=u(I,A,x,T,_,5,s[24]),T=u(T,I,A,x,B,9,s[25]),x=u(x,T,I,A,h,14,s[26]),A=u(A,x,T,I,b,20,s[27]),I=u(I,A,x,T,S,5,s[28]),T=u(T,I,A,x,p,9,s[29]),x=u(x,T,I,A,y,14,s[30]),I=d(I,A=u(A,x,T,I,k,20,s[31]),x,T,g,4,s[32]),T=d(T,I,A,x,b,11,s[33]),x=d(x,T,I,A,w,16,s[34]),A=d(A,x,T,I,B,23,s[35]),I=d(I,A,x,T,c,4,s[36]),T=d(T,I,A,x,m,11,s[37]),x=d(x,T,I,A,y,16,s[38]),A=d(A,x,T,I,C,23,s[39]),I=d(I,A,x,T,S,4,s[40]),T=d(T,I,A,x,a,11,s[41]),x=d(x,T,I,A,h,16,s[42]),A=d(A,x,T,I,v,23,s[43]),I=d(I,A,x,T,_,4,s[44]),T=d(T,I,A,x,k,11,s[45]),x=d(x,T,I,A,E,16,s[46]),I=f(I,A=d(A,x,T,I,p,23,s[47]),x,T,a,6,s[48]),T=f(T,I,A,x,y,10,s[49]),x=f(x,T,I,A,B,15,s[50]),A=f(A,x,T,I,g,21,s[51]),I=f(I,A,x,T,k,6,s[52]),T=f(T,I,A,x,h,10,s[53]),x=f(x,T,I,A,C,15,s[54]),A=f(A,x,T,I,c,21,s[55]),I=f(I,A,x,T,b,6,s[56]),T=f(T,I,A,x,E,10,s[57]),x=f(x,T,I,A,v,15,s[58]),A=f(A,x,T,I,S,21,s[59]),I=f(I,A,x,T,m,6,s[60]),T=f(T,I,A,x,w,10,s[61]),x=f(x,T,I,A,p,15,s[62]),A=f(A,x,T,I,_,21,s[63]),o[0]=o[0]+I|0,o[1]=o[1]+A|0,o[2]=o[2]+x|0,o[3]=o[3]+T|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<<o|s>>>32-o)+t}function u(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<<o|s>>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<<o|s>>>32-o)+t}function f(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<<o|s>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),r.MD5)})),ye((function(e,t){var r,n,i,o,a,s,c,l;e.exports=(n=(r=l=Fn).lib,i=n.WordArray,o=n.Hasher,a=r.algo,s=[],c=a.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+s[l];d+=l<20?1518500249+(i&o|~i&a):l<40?1859775393+(i^o^a):l<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,c=a,a=o,o=i<<30|i>>>2,i=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=o._createHelper(c),r.HmacSHA1=o._createHmacHelper(c),l.SHA1)})),ye((function(e,t){var r;e.exports=(r=Fn,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var l=[],u=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=a+_|0,a=o,o=i,i=n,n=_+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(u),t.HmacSHA256=o._createHmacHelper(u)}(Math),r.SHA256)})),ye((function(e,t){var r,n,i,o,a,s;e.exports=(n=(r=s=Fn).lib.WordArray,i=r.algo,o=i.SHA256,a=i.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=o._createHelper(a),r.HmacSHA224=o._createHmacHelper(a),s.SHA224)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.Hasher,n=e.x64,i=n.Word,o=n.WordArray,a=e.algo;function s(){return i.create.apply(i,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=s()}();var u=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=n.high,h=n.low,m=i.high,g=i.low,v=o.high,y=o.low,b=a.high,_=a.low,C=s.high,w=s.low,k=u.high,S=u.low,B=d.high,E=d.low,I=f.high,A=f.low,x=p,T=h,P=m,R=g,D=v,L=y,N=b,O=_,F=C,M=w,V=k,U=S,j=B,z=E,q=I,H=A,K=0;K<80;K++){var W,G,Q=l[K];if(K<16)G=Q.high=0|e[t+2*K],W=Q.low=0|e[t+2*K+1];else{var X=l[K-15],Y=X.high,$=X.low,Z=(Y>>>1|$<<31)^(Y>>>8|$<<24)^Y>>>7,J=($>>>1|Y<<31)^($>>>8|Y<<24)^($>>>7|Y<<25),ee=l[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=l[K-7],ae=oe.high,se=oe.low,ce=l[K-16],le=ce.high,ue=ce.low;G=(G=(G=Z+ae+((W=J+se)>>>0<J>>>0?1:0))+ne+((W+=ie)>>>0<ie>>>0?1:0))+le+((W+=ue)>>>0<ue>>>0?1:0),Q.high=G,Q.low=W}var de,fe=F&V^~F&j,pe=M&U^~M&z,he=x&P^x&D^P&D,me=T&R^T&L^R&L,ge=(x>>>28|T<<4)^(x<<30|T>>>2)^(x<<25|T>>>7),ve=(T>>>28|x<<4)^(T<<30|x>>>2)^(T<<25|x>>>7),ye=(F>>>14|M<<18)^(F>>>18|M<<14)^(F<<23|M>>>9),be=(M>>>14|F<<18)^(M>>>18|F<<14)^(M<<23|F>>>9),_e=c[K],Ce=_e.high,we=_e.low,ke=q+ye+((de=H+be)>>>0<H>>>0?1:0),Se=ve+me;q=j,H=z,j=V,z=U,V=F,U=M,F=N+(ke=(ke=(ke=ke+fe+((de+=pe)>>>0<pe>>>0?1:0))+Ce+((de+=we)>>>0<we>>>0?1:0))+G+((de+=W)>>>0<W>>>0?1:0))+((M=O+de|0)>>>0<O>>>0?1:0)|0,N=D,O=L,D=P,L=R,P=x,R=T,x=ke+(ge+he+(Se>>>0<ve>>>0?1:0))+((T=de+Se|0)>>>0<de>>>0?1:0)|0}h=n.low=h+T,n.high=p+x+(h>>>0<T>>>0?1:0),g=i.low=g+R,i.high=m+P+(g>>>0<R>>>0?1:0),y=o.low=y+L,o.high=v+D+(y>>>0<L>>>0?1:0),_=a.low=_+O,a.high=b+N+(_>>>0<O>>>0?1:0),w=s.low=w+M,s.high=C+F+(w>>>0<M>>>0?1:0),S=u.low=S+U,u.high=k+V+(S>>>0<U>>>0?1:0),E=d.low=E+z,d.high=B+j+(E>>>0<z>>>0?1:0),A=f.low=A+H,f.high=I+q+(A>>>0<H>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(u),e.HmacSHA512=t._createHmacHelper(u)}(),r.SHA512)})),ye((function(e,t){var r,n,i,o,a,s,c,l;e.exports=(n=(r=l=Fn).x64,i=n.Word,o=n.WordArray,a=r.algo,s=a.SHA512,c=a.SHA384=s.extend({_doReset:function(){this._hash=new o.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(c),r.HmacSHA384=s._createHmacHelper(c),l.SHA384)})),ye((function(e,t){var r;e.exports=(r=Fn,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.x64.Word,s=t.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var s=0,d=0,f=0;f<7;f++){if(1&i){var p=(1<<f)-1;p<32?d^=1<<p:s^=1<<p-32}128&i?i=i<<1^113:i<<=1}u[o]=a.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=a.create()}();var f=s.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var o=e[t+2*i],a=e[t+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(A=r[i]).high^=a,A.low^=o}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,h=0,m=0;m<5;m++)p^=(A=r[f+5*m]).high,h^=A.low;var g=d[f];g.high=p,g.low=h}for(f=0;f<5;f++){var v=d[(f+4)%5],y=d[(f+1)%5],b=y.high,_=y.low;for(p=v.high^(b<<1|_>>>31),h=v.low^(_<<1|b>>>31),m=0;m<5;m++)(A=r[f+5*m]).high^=p,A.low^=h}for(var C=1;C<25;C++){var w=(A=r[C]).high,k=A.low,S=c[C];S<32?(p=w<<S|k>>>32-S,h=k<<S|w>>>32-S):(p=k<<S-32|w>>>64-S,h=w<<S-32|k>>>64-S);var B=d[l[C]];B.high=p,B.low=h}var E=d[0],I=r[0];for(E.high=I.high,E.low=I.low,f=0;f<5;f++)for(m=0;m<5;m++){var A=r[C=f+5*m],x=d[C],T=d[(f+1)%5+5*m],P=d[(f+2)%5+5*m];A.high=x.high^~T.high&P.high,A.low=x.low^~T.low&P.low}A=r[0];var R=u[s];A.high^=R.high,A.low^=R.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,l=[],u=0;u<c;u++){var d=a[u],f=d.high,p=d.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),l.push(p),l.push(f)}return new i.init(l,s)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(f),t.HmacSHA3=o._createHmacHelper(f)}(Math),r.SHA3)})),ye((function(e,t){var r;e.exports=(r=Fn,
|
|
15
|
+
***************************************************************************** */function i(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==("undefined"==typeof Reflect?"undefined":x(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function o(e,t){if("object"==("undefined"==typeof Reflect?"undefined":x(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var c=function(){function e(e){this.httpClient=e}return e.prototype.uploadImage=function(e,t){return this.httpClient.postFormData("/v1/images",e,t)},e.prototype.request=function(e,t){var r="application/pdf"===e.file.type;return this.httpClient.postFormData(r?"/v1/files":"/v1/images",e,t)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/images",e,t)},e.prototype.download=function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/images/"+e)];case 1:return t=r.sent(),[4,URL.createObjectURL(t)];case 2:return[2,r.sent()]}}))}))},e.prototype.updateMetadata=function(e,t){return this.httpClient.patch("/v1/images/"+e,t)},e}(),l=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/files",e,t)},e.prototype.uploadFile=function(e,t){return this.httpClient.postFormData("/v1/files",e,t)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/files",e,t)},e}(),u=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/compare_faces_sync",e,t)},e}(),d=function(){function e(e){this.httpClient=e}return e.prototype.getClientSettings=function(){return this.httpClient.get("/v1/client_settings")},e.prototype.request=function(e,t){return this.httpClient.get("/v1/client_settings",e,t)},e}(),f=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_face_liveness_sync",e,t)},e}(),p=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_id_card_sanity_sync",e,t)},e}(),h=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_portrait_sanity_sync",e,t)},e}(),m=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e.prototype.requestWithAuthHeaders=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e}(),g=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/search_faces_sync",e,t)},e.prototype.indexFaces=function(e,t){return this.httpClient.post("/v1/index_faces_sync",e,t)},e.prototype.deleteFaces=function(e,t){return this.httpClient.post("/v1/delete_faces",e,t)},e.prototype.detectFaces=function(e,t){return this.httpClient.post("/v1/detect_faces_sync",e,t)},e.prototype.downloadFaceImage=function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/face_images/"+e)];case 1:return t=r.sent(),[2,URL.createObjectURL(t)]}}))}))},e}(),v=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.postFormData("/v1/convert_pdf_sync",e,t)},e}(),y=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/ekyc_pdf",e,t)},e}(),b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==ve?ve:"undefined"!=typeof self?self:{};function _(e,t){return e(t={exports:{}},t.exports),t.exports}var C=_((function(e){var t,r;t=b,r=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<e.length;n++){var i=e[n];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(n>0&&(i=i.replace(/^[\/]+/,"")),i=n<e.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),t.push(i))}var o=t.join("/"),a=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return e("object"==x(arguments[0])?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=r():t.urljoin=r()}));function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var k=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var c=0;c<s;++c){var l,u,d,f,p=e[c].replace(o,"%20"),h=p.indexOf(r);h>=0?(l=p.substr(0,h),u=p.substr(h+1)):(l=p,u=""),d=decodeURIComponent(l),f=decodeURIComponent(u),w(i,d)?Array.isArray(i[d])?i[d].push(f):i[d]=[i[d],f]:i[d]=f}return i},S=function(e){switch(x(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},B=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==x(e)?Object.keys(e).map((function(n){var i=encodeURIComponent(S(n))+r;return Array.isArray(e[n])?e[n].map((function(e){return i+encodeURIComponent(S(e))})).join(t):i+encodeURIComponent(S(e[n]))})).join(t):n?encodeURIComponent(S(n))+r+encodeURIComponent(S(e)):""},E=_((function(e,t){t.decode=t.parse=k,t.encode=t.stringify=B})),I=(E.decode,E.parse,E.encode,E.stringify),A=function(){function e(e){this.authorizer=e.authorizer,this.domain=e.domain,this.onError=e.onError,this.configHeaders=e.headers}return e.prototype.get=function(e,t,r){var n=new URL(this.resolveUrl(e));return t&&(n.search=I(t)),this.request(n.toString(),{requestPath:e,method:"GET",headers:r})},e.prototype.post=function(e,t,r){var i=this.resolveUrl(e);return this.request(i,{requestPath:e,method:"POST",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.postFormData=function(e,t,r){var n,i=t instanceof FormData?t:(n=t,Object.entries(n).reduce((function(e,t){var r=t[0],n=t[1];return Array.isArray(n)?n.forEach((function(t,i){return e.append(r+"["+i+"]",n)})):!(n instanceof Object)||n instanceof File||n instanceof Date||n instanceof Blob?e.append(r,n):Object.entries(n).forEach((function(t,i){return e.append(r+"["+i+"]",n[i])})),e}),new FormData)),o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"POST",body:i,headers:r})},e.prototype.patch=function(e,t,r){var i=this.resolveUrl(e);return this.request(i,{requestPath:e,method:"PATCH",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.delete=function(e,t,r){var i=this.resolveUrl(e);return this.request(i,{requestPath:e,method:"DELETE",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.downloadFile=function(e){var t=this.resolveUrl(e);return this.request(t,{requestPath:e,method:"GET"},"blob")},e.prototype.request=function(e,t,r){return void 0===r&&(r="json"),a(this,void 0,void 0,(function(){var i,o,a,c;return s(this,(function(s){switch(s.label){case 0:return i={},o={},this.authorizer&&(i=this.authorizer.getHeaders(t)),this.configHeaders&&(o=this.configHeaders),t.headers=n(n(n({},t.headers),i),o),[4,fetch(e,t)];case 1:return a=s.sent(),[4,"blob"===r?a.blob():a.json()];case 2:if((c=s.sent()).errors&&this.onError)throw this.onError(c.errors),c;return[2,c]}}))}))},e.prototype.resolveUrl=function(e){return C(this.domain,e)},e}(),T=function(){function e(e){this.mocks=e}return e.prototype.get=function(e,t){return this.findInMocks(e,t)},e.prototype.post=function(e,t){return this.findInMocks(e)},e.prototype.postFormData=function(e,t){return this.findInMocks(e)},e.prototype.patch=function(e,t){return this.findInMocks(e)},e.prototype.delete=function(e,t){return this.findInMocks(e)},e.prototype.downloadFile=function(e){return this.findInMocks(e)},e.prototype.resolveUrl=function(e){return this.mocks.resolveUrl?this.mocks.resolveUrl(e):e},e.prototype.findInMocks=function(e,t){return a(this,void 0,void 0,(function(){return s(this,(function(r){return this.mocks[e]?"function"==typeof this.mocks[e]?[2,Promise.resolve(this.mocks[e](t))]:[2,Promise.resolve(this.mocks[e])]:[2,Promise.reject(new Error(e+" is not presented in mocks"))]}))}))},e}(),P=_((function(e,t){var r;e.exports=r=r||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},o=i.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(o=0;o<i;o+=4)t[n+o>>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){t=t;var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},o=0;o<t;o+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new a.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new a.init(r,t/2)}},l=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new a.init(r,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,o=this.blockSize,s=i/(4*o),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,l=e.min(4*c,i);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(n,u);var d=n.splice(0,c);r.sigBytes-=l}return new a.init(d,l)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(i.Hasher=d.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math)})),R=_((function(e,t){var r,n,i;e.exports=(n=(r=i=P).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return function(e,t,r){for(var i=[],o=0,a=0;a<t;a++)if(a%4){var s=r[e.charCodeAt(a-1)]<<a%4*2,c=r[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=(s|c)<<24-o%4*8,o++}return n.create(i,o)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)})),D=(_((function(e,t){var r;e.exports=(r=P,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var l=[],u=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=a+_|0,a=o,o=i,i=n,n=_+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(u),t.HmacSHA256=o._createHmacHelper(u)}(Math),r.SHA256)})),_((function(e,t){var r,n,i;e.exports=(n=(r=P).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,l=0;l<r;l++)s[l]^=1549556828,c[l]^=909522486;o.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))})),_((function(e,t){e.exports=P.HmacSHA256}))),L=function(){function e(e,t){this.accessKey=e,this.keySecret=t}return e.prototype.getHeaders=function(e){var t=function(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+(0===(r=e.getTimezoneOffset())?"Z":(n=r>0?"-":"+",r=Math.abs(r),n+t(Math.floor(r/60))+":"+t(r%60)));var r,n}(new Date);return{Authorization:this.generateAuthorization(e.requestPath,e.method,t),"X-TV-Timestamp":t}},e.prototype.generateAuthorization=function(e,t,r){var n=this.computeStringToSign(e,t,r),i=R.stringify(this.computeSignature(n));return this.formatAuthToken("TV",i)},e.prototype.formatAuthToken=function(e,t){return e+" "+this.accessKey+":"+t},e.prototype.computeStringToSign=function(e,t,r){return t+"\n"+e+"\n"+r},e.prototype.computeSignature=function(e){return D(e,this.keySecret)},e}();function N(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":return"https://vn-vision.trustingsocial.com/api";default:return e}}function O(e,t,r,n){void 0===r&&(r="production");var i=(void 0===n?{}:n).headers,o=new L(e,t),a=N(r);return new A({authorizer:o,domain:a,headers:i})}var F=function(){function e(e){void 0===e&&(e="production");var t=new A({domain:N(e)});this.imagesService=new c(t),this.detectIDTamperingService=new m(t)}return e.prototype.uploadImage=function(e,t){return this.imagesService.requestWithHeaders(e,t)},e.prototype.detectTampering=function(e,t){return this.detectIDTamperingService.requestWithAuthHeaders(e,t)},e}();function M(e){var t=e.headerIndex;return function(e,r,i){var o=i.value,c=n({},i);return c.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return a(this,void 0,void 0,(function(){var r,i,a,c;return s(this,(function(s){switch(s.label){case 0:return this.transactionEnabled?[4,this.transactionManager.begin()]:[3,4];case 1:return r=s.sent(),i=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n}(e),(a=n({},i[t]))["X-TV-Transaction"]=r,i[t]=a,[4,o.apply(this,i)];case 2:return c=s.sent(),[4,this.transactionManager.end()];case 3:return s.sent(),[2,c];case 4:return[4,o.apply(this,e)];case 5:return[2,s.sent()]}}))}))},c}}function V(e){return void 0===e&&(e={encryptedField:"data"}),function(t,r,i){var o=i.value,c=n({},i);return c.value=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return a(this,void 0,void 0,(function(){var r,n;return s(this,(function(i){switch(i.label){case 0:return[4,o.apply(this,t)];case 1:return r=i.sent(),this.encryptionEnabled&&"string"==typeof r[e.encryptedField]?(n=this.encryptionService.decrypt(r[e.encryptedField],{transactionID:this.transactionManager.currentTransactionID}),[2,JSON.parse(n)]):[2,r]}}))}))},c}}var U=function(){function e(e){this.httpClient=e,this.transactionID="",this.totalTransactions=0,this.currentTransaction=0}return Object.defineProperty(e.prototype,"currentTransactionID",{get:function(){return this.transactionID},enumerable:!1,configurable:!0}),e.prototype.begin=function(){return a(this,void 0,void 0,(function(){var e,t,r=this;return s(this,(function(n){switch(n.label){case 0:return e=this.totalTransactions++,[4,new Promise((function(t,n){var i=window.performance.now(),o=setInterval((function(){e===r.currentTransaction&&(clearInterval(o),t(!0)),window.performance.now()-i>=3e3&&(clearInterval(o),n(new Error("Transaction timeout")))}),100)}))];case 1:return n.sent(),[4,this.httpClient.post("/v1/transactions",{})];case 2:return t=n.sent().data,this.transactionID=t.id,[2,t.id]}}))}))},e.prototype.end=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,this.httpClient.post("/v1/transactions/"+this.transactionID+"/finish")];case 1:return e=t.sent(),this.transactionID="",this.currentTransaction++,[2,e]}}))}))},e}(),j={options:{usePureJavaScript:!1}},z={},q=z,H={};z.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,a=t.charAt(0),s=[0];for(i=0;i<e.length;++i){for(var c=0,l=e[i];c<s.length;++c)l+=s[c]<<8,s[c]=l%o,l=l/o|0;for(;l>0;)s.push(l%o),l=l/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=a;for(i=s.length-1;i>=0;--i)n+=t[s[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var a=0,s=e.at(r);a<o.length;++a)s+=o[a]<<8,o[a]=s%n,s=s/n|0;for(;s>0;)o.push(s%n),s=s/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=t[o[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},z.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=H[t];if(!r){r=H[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var i=t.length,o=t.charAt(0),a=[0];for(n=0;n<e.length;n++){var s=r[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,l=s;c<a.length;++c)l+=a[c]*i,a[c]=255&l,l>>=8;for(;l>0;)a.push(255&l),l>>=8}for(var u=0;e[u]===o&&u<e.length-1;++u)a.push(0);return"undefined"!=typeof Buffer?Buffer.from(a.reverse()):new Uint8Array(a.reverse())},_((function(e){var t=e.exports=j.util=j.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(t.isArrayBuffer(e)||t.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var r=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,r)}catch(e){for(var i=0;i<r.length;++i)this.putByte(r[i])}}else(e instanceof n||"object"==x(e)&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return t.nextTick=process.nextTick,void("function"==typeof setImmediate?t.setImmediate=setImmediate:t.setImmediate=t.nextTick);if("function"==typeof setImmediate)return t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(t.nextTick=function(e){return setImmediate(e)});if(t.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];t.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,o=document.createElement("div");r=[],new MutationObserver((function(){var e=r.slice();r.length=0,e.forEach((function(e){e()}))})).observe(o,{attributes:!0});var a=t.setImmediate;t.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),a(e)):(r.push(e),1===r.length&&o.setAttribute("a",i=!i))}}t.nextTick=t.setImmediate}(),t.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,t.globalScope=t.isNodejs?b:"undefined"==typeof self?window:self,t.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},t.isArrayBufferView=function(e){return e&&t.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},t.ByteBuffer=n,t.ByteStringBuffer=n,t.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},t.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},t.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},t.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(t.encodeUtf8(e))},t.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},t.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},t.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},t.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},t.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},t.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},t.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},t.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var e=t.createBuffer(this.data);return e.read=this.read,e},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())},t.DataBuffer=function(e,r){r=r||{},this.read=r.readOffset||0,this.growSize=r.growSize||1024;var n=t.isArrayBuffer(e),i=t.isArrayBufferView(e);if(n||i)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in r?r.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in r&&(this.write=r.writeOffset)},t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},t.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},t.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},t.DataBuffer.prototype.putBytes=function(e,r){if(t.isArrayBufferView(e)){var n=(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-i.byteOffset;return this.accommodate(n),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=n,this}if(t.isArrayBuffer(e)){var i=new Uint8Array(e);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(e instanceof t.DataBuffer||"object"==x(e)&&"number"==typeof e.read&&"number"==typeof e.write&&t.isArrayBufferView(e.data))return i=new Uint8Array(e.data.byteLength,e.read,e.length()),this.accommodate(i.byteLength),new Uint8Array(e.data.byteLength,this.write).set(i),this.write+=i.byteLength,this;if(e instanceof t.ByteStringBuffer&&(e=e.data,r="binary"),r=r||"binary","string"==typeof e){var o;if("hex"===r)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(e,o,this.write),this;if("base64"===r)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(e,o,this.write),this;if("utf8"===r&&(e=t.encodeUtf8(e),r="binary"),"binary"===r||"raw"===r)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(o),this;if("utf16"===r)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+r)}throw Error("Invalid parameter: "+e)},t.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},t.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},t.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},t.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},t.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},t.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},t.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},t.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},t.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},t.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},t.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},t.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.DataBuffer.prototype.toString=function(e){var r=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return t.binary.raw.encode(r);if("hex"===e)return t.binary.hex.encode(r);if("base64"===e)return t.binary.base64.encode(r);if("utf8"===e)return t.text.utf8.decode(r);if("utf16"===e)return t.text.utf16.decode(r);throw new Error("Invalid encoding: "+e)},t.createBuffer=function(e,r){return r=r||"raw",void 0!==e&&"utf8"===r&&(e=t.encodeUtf8(e)),new t.ByteBuffer(e)},t.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},t.xorBytes=function(e,t,r){for(var n="",i="",o="",a=0,s=0;r>0;--r,++a)i=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(n+=o,o="",s=0),o+=String.fromCharCode(i),++s;return n+o},t.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},t.bytesToHex=function(e){return t.createBuffer(e).toHex()},t.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(e,t){for(var r,n,o,a="",s="",c=0;c<e.length;)r=e.charCodeAt(c++),n=e.charCodeAt(c++),o=e.charCodeAt(c++),a+=i.charAt(r>>2),a+=i.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=i.charAt((15&n)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a},t.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",s=0;s<e.length;)t=o[e.charCodeAt(s++)-43],r=o[e.charCodeAt(s++)-43],n=o[e.charCodeAt(s++)-43],i=o[e.charCodeAt(s++)-43],a+=String.fromCharCode(t<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},t.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},t.decodeUtf8=function(e){return decodeURIComponent(escape(e))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:q.encode,decode:q.decode}},t.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},t.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,o=r=r||0;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},t.binary.base64.encode=function(e,t){for(var r,n,o,a="",s="",c=0;c<e.byteLength;)r=e[c++],n=e[c++],o=e[c++],a+=i.charAt(r>>2),a+=i.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=i.charAt((15&n)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a},t.binary.base64.decode=function(e,t,r){var n,i,a,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l=0,u=r=r||0;l<e.length;)n=o[e.charCodeAt(l++)-43],i=o[e.charCodeAt(l++)-43],a=o[e.charCodeAt(l++)-43],s=o[e.charCodeAt(l++)-43],c[u++]=n<<2|i>>4,64!==a&&(c[u++]=(15&i)<<4|a>>2,64!==s&&(c[u++]=(3&a)<<6|s));return t?u-r:c.subarray(0,u)},t.binary.base58.encode=function(e,r){return t.binary.baseN.encode(e,a,r)},t.binary.base58.decode=function(e,r){return t.binary.baseN.decode(e,a,r)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(e,r,n){e=t.encodeUtf8(e);var i=r;i||(i=new Uint8Array(e.length));for(var o=n=n||0,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a);return r?o-n:i},t.text.utf8.decode=function(e){return t.decodeUtf8(String.fromCharCode.apply(null,e))},t.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),o=r=r||0,a=r,s=0;s<e.length;++s)i[a++]=e.charCodeAt(s),o+=2;return t?o-r:n},t.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},t.deflate=function(e,r,n){if(r=t.decode64(e.deflate(t.encode64(r)).rval),n){var i=2;32&r.charCodeAt(1)&&(i=6),r=r.substring(i,r.length-4)}return r},t.inflate=function(e,r,n){var i=e.inflate(t.encode64(r)).rval;return null===i?null:t.decode64(i)};var s=function(e,r,n){if(!e)throw new Error("WebStorage not available.");var i;if(null===n?i=e.removeItem(r):(n=t.encode64(JSON.stringify(n)),i=e.setItem(r,n)),void 0!==i&&!0!==i.rval){var o=new Error(i.error.message);throw o.id=i.error.id,o.name=i.error.name,o}},c=function(e,r){if(!e)throw new Error("WebStorage not available.");var n=e.getItem(r);if(e.init)if(null===n.rval){if(n.error){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}n=null}else n=n.rval;return null!==n&&(n=JSON.parse(t.decode64(n))),n},l=function(e,t,r,n){var i=c(e,t);null===i&&(i={}),i[r]=n,s(e,t,i)},u=function(e,t,r){var n=c(e,t);return null!==n&&(n=r in n?n[r]:null),n},d=function(e,t,r){var n=c(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),s(e,t,n)}},f=function(e,t){s(e,t,null)},p=function(e,t,r){var n,i=null;void 0===r&&(r=["web","flash"]);var o=!1,a=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(e){a=e}if(o)break}if(!o)throw a;return i};t.setItem=function(e,t,r,n,i){p(l,arguments,i)},t.getItem=function(e,t,r,n){return p(u,arguments,n)},t.removeItem=function(e,t,r,n){p(d,arguments,n)},t.clearItems=function(e,t,r){p(f,arguments,r)},t.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(80!==n.port&&"http"===n.scheme||443!==n.port&&"https"===n.scheme)&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var h=null;t.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i,o,a=r[n].indexOf("=");a>0?(i=r[n].substring(0,a),o=r[n].substring(a+1)):(i=r[n],o=null),i in t||(t[i]=[]),i in Object.prototype||null===o||t[i].push(unescape(o))}return t};return void 0===e?(null===h&&(h="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=h):t=r(e),t},t.parseFragment=function(e){var r=e,n="",i=e.indexOf("?");i>0&&(r=e.substring(0,i),n=e.substring(i+1));var o=r.split("/");return o.length>0&&""===o[0]&&o.shift(),{pathString:r,queryString:n,path:o,query:""===n?{}:t.getQueryVariables(n)}},t.makeRequest=function(e){var r=t.parseFragment(e),n={path:r.pathString,query:r.queryString,getPath:function(e){return void 0===e?r.path:r.path[e]},getQuery:function(e,t){var n;return void 0===e?n=r.query:(n=r.query[e])&&void 0!==t&&(n=n[t]),n},getQueryLast:function(e,t){var r=n.getQuery(e);return r?r[r.length-1]:t}};return n},t.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},t.setPath=function(e,t,r){if("object"==x(e)&&null!==e)for(var n=0,i=t.length;n<i;){var o=t[n++];if(n==i)e[o]=r;else{var a=o in e;(!a||a&&"object"!=x(e[o])||a&&null===e[o])&&(e[o]={}),e=e[o]}}},t.getPath=function(e,t,r){for(var n=0,i=t.length,o=!0;o&&n<i&&"object"==x(e)&&null!==e;){var a=t[n++];(o=a in e)&&(e=e[a])}return o?e:r},t.deletePath=function(e,t){if("object"==x(e)&&null!==e)for(var r=0,n=t.length;r<n;){var i=t[r++];if(r==n)delete e[i];else{if(!(i in e)||"object"!=x(e[i])||null===e[i])break;e=e[i]}}},t.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.format=function(e){for(var t,r,n=/%./g,i=0,o=[],a=0;t=n.exec(e);){(r=e.substring(a,n.lastIndex-2)).length>0&&o.push(r),a=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+s+"?>")}}return o.push(e.substring(a)),o.join("")},t.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,a=void 0===r?",":r,s=void 0===n?".":n,c=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+s:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+s)+(o?a+Math.abs(i-l).toFixed(o).slice(2):"")},t.formatSize=function(e){return e>=1073741824?t.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?t.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?t.formatNumber(e/1024,0)+" KiB":t.formatNumber(e,0)+" bytes"},t.bytesFromIP=function(e){return-1!==e.indexOf(".")?t.bytesFromIPv4(e):-1!==e.indexOf(":")?t.bytesFromIPv6(e):null},t.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var r=t.createBuffer(),n=0;n<e.length;++n){var i=parseInt(e[n],10);if(isNaN(i))return null;r.putByte(i)}return r.getBytes()},t.bytesFromIPv6=function(e){for(var r=0,n=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++r,!0}))).length+r),i=t.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var a=t.hexToBytes(e[o]);a.length<2&&i.putByte(0),i.putBytes(a)}else i.fillWithByte(0,n),n=0;return i.getBytes()},t.bytesToIP=function(e){return 4===e.length?t.bytesToIPv4(e):16===e.length?t.bytesToIPv6(e):null},t.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},t.bytesToIPv6=function(e){if(16!==e.length)return null;for(var r=[],n=[],i=0,o=0;o<e.length;o+=2){for(var a=t.bytesToHex(e[o]+e[o+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=n[n.length-1],c=r.length;s&&c===s.end+1?(s.end=c,s.end-s.start>n[i].end-n[i].start&&(i=n.length-1)):n.push({start:c,end:c})}r.push(a)}if(n.length>0){var l=n[i];l.end-l.start>0&&(r.splice(l.start,l.end-l.start+1,""),0===l.start&&r.unshift(""),7===l.end&&r.push(""))}return r.join(":")},t.estimateCores=function(e,r){if("function"==typeof e&&(r=e,e={}),e=e||{},"cores"in t&&!e.update)return r(null,t.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,r(null,t.cores);if("undefined"==typeof Worker)return t.cores=1,r(null,t.cores);if("undefined"==typeof Blob)return t.cores=2,r(null,t.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(i,o,a){if(0===o){var s=Math.floor(i.reduce((function(e,t){return e+t}),0)/i.length);return t.cores=Math.max(1,s),URL.revokeObjectURL(n),r(null,t.cores)}!function(e,t){for(var r=[],i=[],o=0;o<e;++o){var a=new Worker(n);a.addEventListener("message",(function(n){if(i.push(n.data),i.length===e){for(var o=0;o<e;++o)r[o].terminate();t(null,i)}})),r.push(a)}for(o=0;o<e;++o)r[o].postMessage(o)}(a,(function(t,r){i.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],a=0;a<e;++a)if(n!==a){var s=t[a];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&o.push(a)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(a,r)),e(i,o-1,a)}))}([],5,16)}})),j.cipher=j.cipher||{},j.cipher.algorithms=j.cipher.algorithms||{},j.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=j.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new j.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},j.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=j.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new j.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},j.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),j.cipher.algorithms[e]=t},j.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in j.cipher.algorithms?j.cipher.algorithms[e]:null};var K=j.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};function W(e,t){j.cipher.registerAlgorithm(e,(function(){return new j.aes.Algorithm(e,t)}))}K.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=j.util.createBuffer(),this.output=e.output||j.util.createBuffer(),this.mode.start(t)},K.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},K.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},_((function(e){j.cipher=j.cipher||{};var t=e.exports=j.cipher.modes=j.cipher.modes||{};function r(e,t){if("string"==typeof e&&(e=j.util.createBuffer(e)),j.util.isArray(e)&&e.length>4){var r=e;e=j.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!j.util.isArray(e)){var i=[],o=t/4;for(n=0;n<o;++n)i.push(e.getInt32());e=i}return e}function n(e){e[e.length-1]=e[e.length-1]+1&4294967295}function i(e){return[e/4294967296|0,4294967295&e]}t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;for(o>0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;for(o>0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var o=(this.blockSize-n)%this.blockSize;for(o>0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]);else{var a=(this.blockSize-i)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}n(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=j.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=j.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?j.util.createBuffer(e.additionalData):j.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=j.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=r.length();if(12===o)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*o)))}this._inBlock=this._j0.slice(0),n(this._inBlock),this._partialBytes=0,t=j.util.createBuffer(t),this._aDataLength=i(8*t.length());var a=t.length()%this.blockSize;for(a&&t.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-i)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(a<=0||r){if(r){var s=i%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(o=0;o<this._ints;++o)this._outBlock[o]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),n(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var i=e.length();if(i<this.blockSize&&!(r&&i>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^this._hashBlock[o]);i<this.blockSize?this._cipherLength+=i%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=j.util.createBuffer();var n=this._aDataLength.concat(i(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var o=[];this.cipher.encrypt(this._j0,o);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^o[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i)e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),a=0;a<i;++a){var s=[0,0,0,0],c=(n-1-a%n)*t;s[a/n|0]=1<<t-1<<c,o[a]=this.generateSubHashTable(this.multiply(s,e),t)}return o},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var a=1;a<o;++a){var s=i[o],c=i[a];i[o+a]=[s[0]^c[0],s[1]^c[1],s[2]^c[2],s[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var l=i[o^n];i[o]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return i}})),j.aes=j.aes||{},j.aes.startEncrypting=function(e,t,r,n){var i=re({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},j.aes.createEncryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!1,mode:t})},j.aes.startDecrypting=function(e,t,r,n){var i=re({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},j.aes.createDecryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!0,mode:t})},j.aes.Algorithm=function(e,t){Z||J();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return te(r._w,e,t,!1)},decrypt:function(e,t){return te(r._w,e,t,!0)}}}),r._init=!1},j.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(j.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=j.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=j.util.createBuffer(r);if(!j.util.isArray(r)){t=r,r=[];var i=t.length();if(16===i||24===i||32===i)for(i>>>=2,n=0;n<i;++n)r.push(t.getInt32())}if(!j.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=ee(r,e.decrypt&&!a),this._init=!0}},j.aes._expandKey=function(e,t){return Z||J(),ee(e,t)},j.aes._updateBlock=te,W("AES-ECB",j.cipher.modes.ecb),W("AES-CBC",j.cipher.modes.cbc),W("AES-CFB",j.cipher.modes.cfb),W("AES-OFB",j.cipher.modes.ofb),W("AES-CTR",j.cipher.modes.ctr),W("AES-GCM",j.cipher.modes.gcm);var G,Q,X,Y,$,Z=!1;function J(){Z=!0,X=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;for(G=new Array(256),Q=new Array(256),Y=new Array(4),$=new Array(4),t=0;t<4;++t)Y[t]=new Array(256),$[t]=new Array(256);var r,n,i,o,a,s,c,l=0,u=0;for(t=0;t<256;++t){o=(o=u^u<<1^u<<2^u<<3^u<<4)>>8^255&o^99,G[l]=o,Q[o]=l,s=(a=e[o])<<24^o<<16^o<<8^o^a,c=((r=e[l])^(n=e[r])^(i=e[n]))<<24^(l^i)<<16^(l^n^i)<<8^l^r^i;for(var d=0;d<4;++d)Y[d][l]=s,$[d][o]=c,s=s<<24|s>>>8,c=c<<24|c>>>8;0===l?l=u=1:(l=r^e[e[e[r^i]]],u^=e[e[u]])}}function ee(e,t){for(var r,n=e.slice(0),i=1,o=n.length,a=4*(o+6+1),s=o;s<a;++s)r=n[s-1],s%o==0?(r=G[r>>>16&255]<<24^G[r>>>8&255]<<16^G[255&r]<<8^G[r>>>24]^X[i]<<24,i++):o>6&&s%o==4&&(r=G[r>>>24]<<24^G[r>>>16&255]<<16^G[r>>>8&255]<<8^G[255&r]),n[s]=n[s-o]^r;if(t){for(var c,l=$[0],u=$[1],d=$[2],f=$[3],p=n.slice(0),h=(s=0,(a=n.length)-4);s<a;s+=4,h-=4)if(0===s||s===a-4)p[s]=n[h],p[s+1]=n[h+3],p[s+2]=n[h+2],p[s+3]=n[h+1];else for(var m=0;m<4;++m)c=n[h+m],p[s+(3&-m)]=l[G[c>>>24]]^u[G[c>>>16&255]]^d[G[c>>>8&255]]^f[G[255&c]];n=p}return n}function te(e,t,r,n){var i,o,a,s,c,l,u,d,f,p,h,m,g=e.length/4-1;n?(i=$[0],o=$[1],a=$[2],s=$[3],c=Q):(i=Y[0],o=Y[1],a=Y[2],s=Y[3],c=G),l=t[0]^e[0],u=t[n?3:1]^e[1],d=t[2]^e[2],f=t[n?1:3]^e[3];for(var v=3,y=1;y<g;++y)p=i[l>>>24]^o[u>>>16&255]^a[d>>>8&255]^s[255&f]^e[++v],h=i[u>>>24]^o[d>>>16&255]^a[f>>>8&255]^s[255&l]^e[++v],m=i[d>>>24]^o[f>>>16&255]^a[l>>>8&255]^s[255&u]^e[++v],f=i[f>>>24]^o[l>>>16&255]^a[u>>>8&255]^s[255&d]^e[++v],l=p,u=h,d=m;r[0]=c[l>>>24]<<24^c[u>>>16&255]<<16^c[d>>>8&255]<<8^c[255&f]^e[++v],r[n?3:1]=c[u>>>24]<<24^c[d>>>16&255]<<16^c[f>>>8&255]<<8^c[255&l]^e[++v],r[2]=c[d>>>24]<<24^c[f>>>16&255]<<16^c[l>>>8&255]<<8^c[255&u]^e[++v],r[n?1:3]=c[f>>>24]<<24^c[l>>>16&255]<<16^c[u>>>8&255]<<8^c[255&d]^e[++v]}function re(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?j.cipher.createDecipher(r,e.key):j.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof j.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}function ne(e,t){j.cipher.registerAlgorithm(e,(function(){return new j.des.Algorithm(e,t)}))}_((function(e){j.pki=j.pki||{};var t=e.exports=j.pki.oids=j.oids=j.oids||{};function r(e,r){t[e]=r,t[r]=e}function n(e,r){t[e]=r}r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.5","serialName"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),n("2.5.29.1","authorityKeyIdentifier"),n("2.5.29.2","keyAttributes"),n("2.5.29.3","certificatePolicies"),n("2.5.29.4","keyUsageRestriction"),n("2.5.29.5","policyMapping"),n("2.5.29.6","subtreesConstraint"),n("2.5.29.7","subjectAltName"),n("2.5.29.8","issuerAltName"),n("2.5.29.9","subjectDirectoryAttributes"),n("2.5.29.10","basicConstraints"),n("2.5.29.11","nameConstraints"),n("2.5.29.12","policyConstraints"),n("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),n("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),n("2.5.29.20","cRLNumber"),n("2.5.29.21","cRLReason"),n("2.5.29.22","expirationDate"),n("2.5.29.23","instructionCode"),n("2.5.29.24","invalidityDate"),n("2.5.29.25","cRLDistributionPoints"),n("2.5.29.26","issuingDistributionPoint"),n("2.5.29.27","deltaCRLIndicator"),n("2.5.29.28","issuingDistributionPoint"),n("2.5.29.29","certificateIssuer"),n("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),n("2.5.29.33","policyMappings"),n("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),n("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),n("2.5.29.46","freshestCRL"),n("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping")})),_((function(e){var t=e.exports=j.asn1=j.asn1||{};function r(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.create=function(e,r,n,i,o){if(j.util.isArray(i)){for(var a=[],s=0;s<i.length;++s)void 0!==i[s]&&a.push(i[s]);i=a}var c={tagClass:e,type:r,constructed:n,composed:n||j.util.isArray(i),value:i};return o&&"bitStringContents"in o&&(c.bitStringContents=o.bitStringContents,c.original=t.copy(c)),c},t.copy=function(e,r){var n;if(j.util.isArray(e)){n=[];for(var i=0;i<e.length;++i)n.push(t.copy(e[i],r));return n}return"string"==typeof e?e:(n={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:t.copy(e.value,r)},r&&!r.excludeBitStringContents&&(n.bitStringContents=e.bitStringContents),n)},t.equals=function(e,r,n){if(j.util.isArray(e)){if(!j.util.isArray(r))return!1;if(e.length!==r.length)return!1;for(var i=0;i<e.length;++i)if(!t.equals(e[i],r[i]))return!1;return!0}if(x(e)!=x(r))return!1;if("string"==typeof e)return e===r;var o=e.tagClass===r.tagClass&&e.type===r.type&&e.constructed===r.constructed&&e.composed===r.composed&&t.equals(e.value,r.value);return n&&n.includeBitStringContents&&(o=o&&e.bitStringContents===r.bitStringContents),o},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};t.fromDer=function(e,n){return void 0===n&&(n={strict:!0,decodeBitStrings:!0}),"boolean"==typeof n&&(n={strict:n,decodeBitStrings:!0}),"strict"in n||(n.strict=!0),"decodeBitStrings"in n||(n.decodeBitStrings=!0),"string"==typeof e&&(e=j.util.createBuffer(e)),function e(n,i,o,a){var s;r(n,i,2);var c=n.getByte();i--;var l=192&c,u=31&c;s=n.length();var d,f,p=function(e,t){var n=e.getByte();if(t--,128!==n){var i;if(128&n){var o=127&n;r(e,t,o),i=e.getInt(o<<3)}else i=n;if(i<0)throw new Error("Negative length: "+i);return i}}(n,i);if(i-=s-n.length(),void 0!==p&&p>i){if(a.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=n.length(),h.remaining=i,h.requested=p,h}p=i}var m=32==(32&c);if(m)if(d=[],void 0===p)for(;;){if(r(n,i,2),n.bytes(2)===String.fromCharCode(0,0)){n.getBytes(2),i-=2;break}s=n.length(),d.push(e(n,i,o+1,a)),i-=s-n.length()}else for(;p>0;)s=n.length(),d.push(e(n,p,o+1,a)),i-=s-n.length(),p-=s-n.length();if(void 0===d&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(f=n.bytes(p)),void 0===d&&a.decodeBitStrings&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=n.read,v=i,y=0;if(u===t.Type.BITSTRING&&(r(n,i,1),y=n.getByte(),i--),0===y)try{s=n.length();var b=e(n,i,o+1,{verbose:a.verbose,strict:!0,decodeBitStrings:!0}),_=s-n.length();i-=_,u==t.Type.BITSTRING&&_++;var C=b.tagClass;_!==p||C!==t.Class.UNIVERSAL&&C!==t.Class.CONTEXT_SPECIFIC||(d=[b])}catch(e){}void 0===d&&(n.read=g,i=v)}if(void 0===d){if(void 0===p){if(a.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=i}if(u===t.Type.BMPSTRING)for(d="";p>0;p-=2)r(n,i,2),d+=String.fromCharCode(n.getInt16()),i-=2;else d=n.getBytes(p)}var w=void 0===f?null:{bitStringContents:f};return t.create(l,u,m,d,w)}(e,e.length(),0,n)},t.toDer=function(e){var r=j.util.createBuffer(),n=e.tagClass|e.type,i=j.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=t.equals(e,e.original))),o)i.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:i.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&i.putBuffer(t.toDer(e.value[a]))}else if(e.type===t.Type.BMPSTRING)for(a=0;a<e.value.length;++a)i.putInt16(e.value.charCodeAt(a));else e.type===t.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?i.putBytes(e.value.substr(1)):i.putBytes(e.value);if(r.putByte(n),i.length()<=127)r.putByte(127&i.length());else{var s=i.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);for(r.putByte(128|c.length),a=c.length-1;a>=0;--a)r.putByte(c.charCodeAt(a))}return r.putBuffer(i),r},t.oidToDer=function(e){var t,r,n,i,o=e.split("."),a=j.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var s=2;s<o.length;++s){t=!0,r=[],n=parseInt(o[s],10);do{i=127&n,n>>>=7,t||(i|=128),r.push(i),t=!1}while(n>0);for(var c=r.length-1;c>=0;--c)a.putByte(r[c])}return a},t.derToOid=function(e){var t;"string"==typeof e&&(e=j.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(s=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,a,s,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var d=e.length-5,f=e.charAt(d);return"+"!==f&&"-"!==f||(l=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),l*=6e4,"+"===f&&(l*=-1),u=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,a,s,c),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(o,a,s,c)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.integerToDer=function(e){var t=j.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},t.derToInteger=function(e){"string"==typeof e&&(e=j.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},t.validate=function(e,r,n,i){var o=!1;if(e.tagClass!==r.tagClass&&void 0!==r.tagClass||e.type!==r.type&&void 0!==r.type)i&&(e.tagClass!==r.tagClass&&i.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+e.tagClass+'"'),e.type!==r.type&&i.push("["+r.name+'] Expected type "'+r.type+'", got "'+e.type+'"'));else if(e.constructed===r.constructed||void 0===r.constructed){if(o=!0,r.value&&j.util.isArray(r.value))for(var a=0,s=0;o&&s<r.value.length;++s)o=r.value[s].optional||!1,e.value[a]&&((o=t.validate(e.value[a],r.value[s],n,i))?++a:r.value[s].optional&&(o=!0)),!o&&i&&i.push("["+r.name+'] Tag class "'+r.tagClass+'", type "'+r.type+'" expected value length "'+r.value.length+'", got "'+e.value.length+'"');if(o&&n&&(r.capture&&(n[r.capture]=e.value),r.captureAsn1&&(n[r.captureAsn1]=e),r.captureBitStringContents&&"bitStringContents"in e&&(n[r.captureBitStringContents]=e.bitStringContents),r.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)n[r.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[r.captureBitStringValue]=e.bitStringContents.slice(1)}}else i&&i.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+e.constructed+'"');return o};var n=/[^\\u0000-\\u00ff]/;t.prettyPrint=function(e,r,i){var o="";i=i||2,(r=r||0)>0&&(o+="\n");for(var a="",s=0;s<r*i;++s)a+=" ";switch(o+=a+"Tag: ",e.tagClass){case t.Class.UNIVERSAL:o+="Universal:";break;case t.Class.APPLICATION:o+="Application:";break;case t.Class.CONTEXT_SPECIFIC:o+="Context-Specific:";break;case t.Class.PRIVATE:o+="Private:"}if(e.tagClass===t.Class.UNIVERSAL)switch(o+=e.type,e.type){case t.Type.NONE:o+=" (None)";break;case t.Type.BOOLEAN:o+=" (Boolean)";break;case t.Type.INTEGER:o+=" (Integer)";break;case t.Type.BITSTRING:o+=" (Bit string)";break;case t.Type.OCTETSTRING:o+=" (Octet string)";break;case t.Type.NULL:o+=" (Null)";break;case t.Type.OID:o+=" (Object Identifier)";break;case t.Type.ODESC:o+=" (Object Descriptor)";break;case t.Type.EXTERNAL:o+=" (External or Instance of)";break;case t.Type.REAL:o+=" (Real)";break;case t.Type.ENUMERATED:o+=" (Enumerated)";break;case t.Type.EMBEDDED:o+=" (Embedded PDV)";break;case t.Type.UTF8:o+=" (UTF8)";break;case t.Type.ROID:o+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:o+=" (Sequence)";break;case t.Type.SET:o+=" (Set)";break;case t.Type.PRINTABLESTRING:o+=" (Printable String)";break;case t.Type.IA5String:o+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:o+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:o+=" (Generalized time)";break;case t.Type.BMPSTRING:o+=" (BMP String)"}else o+=e.type;if(o+="\n",o+=a+"Constructed: "+e.constructed+"\n",e.composed){var c=0,l="";for(s=0;s<e.value.length;++s)void 0!==e.value[s]&&(c+=1,l+=t.prettyPrint(e.value[s],r+1,i),s+1<e.value.length&&(l+=","));o+=a+"Sub values: "+c+l}else{if(o+=a+"Value: ",e.type===t.Type.OID){var u=t.derToOid(e.value);o+=u,j.pki&&j.pki.oids&&u in j.pki.oids&&(o+=" ("+j.pki.oids[u]+") ")}if(e.type===t.Type.INTEGER)try{o+=t.derToInteger(e.value)}catch(t){o+="0x"+j.util.bytesToHex(e.value)}else if(e.type===t.Type.BITSTRING){if(e.value.length>1?o+="0x"+j.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?o+=" (1 unused bit shown)":d>1&&(o+=" ("+d+" unused bits shown)")}}else e.type===t.Type.OCTETSTRING?(n.test(e.value)||(o+="("+e.value+") "),o+="0x"+j.util.bytesToHex(e.value)):e.type===t.Type.UTF8?o+=j.util.decodeUtf8(e.value):e.type===t.Type.PRINTABLESTRING||e.type===t.Type.IA5String?o+=e.value:n.test(e.value)?o+="0x"+j.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}})),j.md=j.md||{},j.md.algorithms=j.md.algorithms||{},_((function(e){(e.exports=j.hmac=j.hmac||{}).create=function(){var e=null,t=null,r=null,n=null,i={start:function(i,o){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in j.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');t=j.md.algorithms[i].create()}else t=i;if(null===o)o=e;else{if("string"==typeof o)o=j.util.createBuffer(o);else if(j.util.isArray(o)){var a=o;o=j.util.createBuffer();for(var s=0;s<a.length;++s)o.putByte(a[s])}var c=o.length();for(c>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=j.util.createBuffer(),n=j.util.createBuffer(),c=o.length(),s=0;s<c;++s)a=o.at(s),r.putByte(54^a),n.putByte(92^a);if(c<t.blockLength)for(a=t.blockLength-c,s=0;s<a;++s)r.putByte(54),n.putByte(92);e=o,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(n),t.update(e),t.digest()}};return i.digest=i.getMac,i}})),_((function(e){var t=e.exports=j.md5=j.md5||{};j.md.md5=j.md.algorithms.md5=t,t.create=function(){a||function(){r=String.fromCharCode(128),r+=j.util.fillString(String.fromCharCode(0),64),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],i=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],o=new Array(64);for(var e=0;e<64;++e)o[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));a=!0}();var e=null,t=j.util.createBuffer(),c=new Array(16),l={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,n=0;n<r;++n)l.fullMessageLength.push(0);return t=j.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},l}};return l.start(),l.update=function(r,n){"utf8"===n&&(r=j.util.encodeUtf8(r));var i=r.length;l.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=l.fullMessageLength.length-1;o>=0;--o)l.fullMessageLength[o]+=i[1],i[1]=i[0]+(l.fullMessageLength[o]/4294967296>>>0),l.fullMessageLength[o]=l.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(r),s(e,c,t),(t.read>2048||0===t.length())&&t.compact(),l},l.digest=function(){var n=j.util.createBuffer();n.putBytes(t.bytes());var i=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(r.substr(0,l.blockLength-i));for(var o,a=0,u=l.fullMessageLength.length-1;u>=0;--u)a=(o=8*l.fullMessageLength[u]+a)/4294967296>>>0,n.putInt32Le(o>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};s(d,c,n);var f=j.util.createBuffer();return f.putInt32Le(d.h0),f.putInt32Le(d.h1),f.putInt32Le(d.h2),f.putInt32Le(d.h3),f},l};var r=null,n=null,i=null,o=null,a=!1;function s(e,t,r){for(var a,s,c,l,u,d,f,p=r.length();p>=64;){for(s=e.h0,c=e.h1,l=e.h2,u=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),a=s+(u^c&(l^u))+o[f]+t[f],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;for(;f<32;++f)a=s+(l^u&(c^l))+o[f]+t[n[f]],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;for(;f<48;++f)a=s+(c^l^u)+o[f]+t[n[f]],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;for(;f<64;++f)a=s+(l^(c|~u))+o[f]+t[n[f]],s=u,u=l,l=c,c+=a<<(d=i[f])|a>>>32-d;e.h0=e.h0+s|0,e.h1=e.h1+c|0,e.h2=e.h2+l|0,e.h3=e.h3+u|0,p-=64}}})),_((function(e){var t=e.exports=j.pem=j.pem||{};function r(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var o=0,a=-1;for(i=0;i<t.length;++i,++o)if(o>65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),o=i-a-1,a=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(a=i);return t}function n(e){return e.replace(/^\s+/,"")}t.encode=function(e,t){t=t||{};var n,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=r(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=r(n={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),i+=r(n)),e.headers)for(var o=0;o<e.headers.length;++o)i+=r(e.headers[o]);return e.procType&&(i+="\r\n"),(i+=j.util.encode64(e.body,t.maxline||64)+"\r\n")+"-----END "+e.type+"-----\r\n"},t.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var s={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:j.util.decode64(t[3])};if(r.push(s),t[2]){for(var c=t[2].split(a),l=0;t&&l<c.length;){for(var u=c[l].replace(/\s+$/,""),d=l+1;d<c.length;++d){var f=c[d];if(!/\s/.test(f[0]))break;u+=f,l=d}if(t=u.match(o)){for(var p={name:t[1],values:[]},h=t[2].split(","),m=0;m<h.length;++m)p.values.push(n(h[m]));if(s.procType)if(s.contentDomain||"Content-Domain"!==p.name)if(s.dekInfo||"DEK-Info"!==p.name)s.headers.push(p);else{if(0===p.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');s.dekInfo={algorithm:h[0],parameters:h[1]||null}}else s.contentDomain=h[0]||"";else{if("Proc-Type"!==p.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==p.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');s.procType={version:h[0],type:h[1]}}}++l}if("ENCRYPTED"===s.procType&&!s.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}})),j.des=j.des||{},j.des.startEncrypting=function(e,t,r,n){var i=pe({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},j.des.createEncryptionCipher=function(e,t){return pe({key:e,output:null,decrypt:!1,mode:t})},j.des.startDecrypting=function(e,t,r,n){var i=pe({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},j.des.createDecryptionCipher=function(e,t){return pe({key:e,output:null,decrypt:!0,mode:t})},j.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return fe(r._keys,e,t,!1)},decrypt:function(e,t){return fe(r._keys,e,t,!0)}}}),r._init=!1},j.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=j.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],m=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,v=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,_=0;_<g;_++){var C=e.getInt32(),w=e.getInt32();C^=(t=252645135&(C>>>4^w))<<4,C^=t=65535&((w^=t)>>>-16^C),C^=(t=858993459&(C>>>2^(w^=t<<-16)))<<2,C^=t=65535&((w^=t)>>>-16^C),C^=(t=1431655765&(C>>>1^(w^=t<<-16)))<<1,C^=t=16711935&((w^=t)>>>8^C),t=(C^=(t=1431655765&(C>>>1^(w^=t<<8)))<<1)<<8|(w^=t)>>>20&240,C=w<<24|w<<8&16711680|w>>>8&65280|w>>>24&240,w=t;for(var k=0;k<y.length;++k){y[k]?(C=C<<2|C>>>26,w=w<<2|w>>>26):(C=C<<1|C>>>27,w=w<<1|w>>>27);var S=r[(C&=-15)>>>28]|n[C>>>24&15]|i[C>>>20&15]|o[C>>>16&15]|a[C>>>12&15]|s[C>>>8&15]|c[C>>>4&15],B=l[(w&=-15)>>>28]|u[w>>>24&15]|d[w>>>20&15]|f[w>>>16&15]|p[w>>>12&15]|h[w>>>8&15]|m[w>>>4&15];t=65535&(B>>>16^S),v[b++]=S^t,v[b++]=B^t<<16}}return v}(t),this._init=!0}},ne("DES-ECB",j.cipher.modes.ecb),ne("DES-CBC",j.cipher.modes.cbc),ne("DES-CFB",j.cipher.modes.cfb),ne("DES-OFB",j.cipher.modes.ofb),ne("DES-CTR",j.cipher.modes.ctr),ne("3DES-ECB",j.cipher.modes.ecb),ne("3DES-CBC",j.cipher.modes.cbc),ne("3DES-CFB",j.cipher.modes.cfb),ne("3DES-OFB",j.cipher.modes.ofb),ne("3DES-CTR",j.cipher.modes.ctr);var ie=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],oe=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],ae=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],se=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],ce=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],le=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],ue=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],de=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function fe(e,t,r,n){var i,o,a=32===e.length?3:9;i=3===a?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s=t[0],c=t[1];s^=(o=252645135&(s>>>4^c))<<4,s^=(o=65535&(s>>>16^(c^=o)))<<16,s^=o=858993459&((c^=o)>>>2^s),s^=o=16711935&((c^=o<<2)>>>8^s),s=(s^=(o=1431655765&(s>>>1^(c^=o<<8)))<<1)<<1|s>>>31,c=(c^=o)<<1|c>>>31;for(var l=0;l<a;l+=3){for(var u=i[l+1],d=i[l+2],f=i[l];f!=u;f+=d){var p=c^e[f],h=(c>>>4|c<<28)^e[f+1];o=s,s=c,c=o^(oe[p>>>24&63]|se[p>>>16&63]|le[p>>>8&63]|de[63&p]|ie[h>>>24&63]|ae[h>>>16&63]|ce[h>>>8&63]|ue[63&h])}o=s,s=c,c=o}c=c>>>1|c<<31,c^=o=1431655765&((s=s>>>1|s<<31)>>>1^c),c^=(o=16711935&(c>>>8^(s^=o<<1)))<<8,c^=(o=858993459&(c>>>2^(s^=o)))<<2,c^=o=65535&((s^=o)>>>16^c),c^=o=252645135&((s^=o<<16)>>>4^c),s^=o<<4,r[0]=s,r[1]=c}function pe(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?j.cipher.createDecipher(r,e.key):j.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof j.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}var he,me=j.pkcs5=j.pkcs5||{};j.util.isNodejs&&!j.options.usePureJavaScript&&(he=t),j.pbkdf2=me.pbkdf2=function(e,t,r,n,i,o){if("function"==typeof i&&(o=i,i=null),j.util.isNodejs&&!j.options.usePureJavaScript&&he.pbkdf2&&(null===i||"object"!=x(i))&&(he.pbkdf2Sync.length>4||!i||"sha1"===i))return"string"!=typeof i&&(i="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),o?4===he.pbkdf2Sync.length?he.pbkdf2(e,t,r,n,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):he.pbkdf2(e,t,r,n,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===he.pbkdf2Sync.length?he.pbkdf2Sync(e,t,r,n).toString("binary"):he.pbkdf2Sync(e,t,r,n,i).toString("binary");if(null==i&&(i="sha1"),"string"==typeof i){if(!(i in j.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=j.md[i].create()}var a=i.digestLength;if(n>4294967295*a){var s=new Error("Derived key is too long.");if(o)return o(s);throw s}var c=Math.ceil(n/a),l=n-(c-1)*a,u=j.hmac.create();u.start(i,e);var d,f,p,h="";if(!o){for(var m=1;m<=c;++m){u.start(null,null),u.update(t),u.update(j.util.int32ToBytes(m)),d=p=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(p),f=u.digest().getBytes(),d=j.util.xorBytes(d,f,a),p=f;h+=m<c?d:d.substr(0,l)}return h}function v(){if(m>c)return o(null,h);u.start(null,null),u.update(t),u.update(j.util.int32ToBytes(m)),d=p=u.digest().getBytes(),g=2,y()}function y(){if(g<=r)return u.start(null,null),u.update(p),f=u.digest().getBytes(),d=j.util.xorBytes(d,f,a),p=f,++g,j.util.setImmediate(y);h+=m<c?d:d.substr(0,l),++m,v()}m=1,v()},_((function(e){var t=e.exports=j.sha256=j.sha256||{};j.md.sha256=j.md.algorithms.sha256=t,t.create=function(){n||(r=String.fromCharCode(128),r+=j.util.fillString(String.fromCharCode(0),64),i=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=!0);var e=null,t=j.util.createBuffer(),a=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,n=0;n<r;++n)s.fullMessageLength.push(0);return t=j.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,n){"utf8"===n&&(r=j.util.encodeUtf8(r));var i=r.length;s.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=i[1],i[1]=i[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(r),o(e,a,t),(t.read>2048||0===t.length())&&t.compact(),s},s.digest=function(){var n=j.util.createBuffer();n.putBytes(t.bytes());var i,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;n.putBytes(r.substr(0,s.blockLength-c));for(var l=8*s.fullMessageLength[0],u=0;u<s.fullMessageLength.length-1;++u)l+=(i=8*s.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=i>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};o(d,a,n);var f=j.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},s};var r=null,n=!1,i=null;function o(e,t,r){for(var n,o,a,s,c,l,u,d,f,p,h,m,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,o=((o=t[c-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[c]=n+t[c-7]+o+t[c-16]|0;for(l=e.h0,u=e.h1,d=e.h2,f=e.h3,p=e.h4,h=e.h5,m=e.h6,g=e.h7,c=0;c<64;++c)a=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&u|d&(l^u),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(m^p&(h^m))+i[c]+t[c],g=m,m=h,h=p,p=f+n>>>0,f=d,d=u,u=l,l=n+(o=a+s)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+d|0,e.h3=e.h3+f|0,e.h4=e.h4+p|0,e.h5=e.h5+h|0,e.h6=e.h6+m|0,e.h7=e.h7+g|0,v-=64}}})),_((function(e){var r=null;!j.util.isNodejs||j.options.usePureJavaScript||process.versions["node-webkit"]||(r=t),(e.exports=j.prng=j.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,i=new Array(32),o=0;o<32;++o)i[o]=n.create();function a(){if(t.pools[0].messageLength>=32)return s();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),s()}function s(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null,r=j.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var i=j.util.createBuffer();if(t)for(;i.length()<e;){var o=Math.max(1,Math.min(e-i.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var s=0;s<a.length;++s)i.putInt32(a[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(i.length()<e)for(var c,l,u,d=Math.floor(65536*Math.random());i.length()<e;)for(l=16807*(65535&d),l+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(l=(2147483647&(l+=c>>15))+(l>>31)),s=0;s<3;++s)u=d>>>(s<<3),u^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&u));return i.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,c=j.util.createBuffer();t.key=null,function l(u){if(u)return r(u);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return j.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return s(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),s(),e()}))}(l)}));var d=n(t.key,t.seed);t.generated+=d.length,c.putBytes(d),t.key=o(n(t.key,i(t.seed))),t.seed=a(n(t.key,t.seed)),j.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,i=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var s=j.util.createBuffer();s.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var c=r(t.key,t.seed);t.generated+=c.length,s.putBytes(c),t.key=i(r(t.key,n(t.seed))),t.seed=o(r(t.key,t.seed))}return s.getBytes(e)},r?(t.seedFile=function(e,t){r.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return r.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))},t}})),_((function(e){j.random&&j.random.getBytes?e.exports=j.random:function(t){var r={},n=new Array(4),i=j.util.createBuffer();function o(){var e=j.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=j.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),j.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=j.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return j.aes._updateBlock(e,t,n,!1),i.putInt32(n[0]),i.putInt32(n[1]),i.putInt32(n[2]),i.putInt32(n[3]),i.getBytes()},r.increment=function(e){return++e[3],e},r.md=j.md.sha256;var a=o(),s=null,c=j.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(s=function(e){return l.getRandomValues(e)}),!j.util.isNodejs&&!s){if(a.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var d in navigator)try{"string"==typeof navigator[d]&&(u+=navigator[d])}catch(e){}a.collect(u),u=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(j.random)for(var d in a)j.random[d]=a[d];else j.random=a;j.random.createInstance=o,e.exports=j.random}("undefined"!=typeof jQuery?jQuery:null)}));var ge=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],ye=[1,2,3,5],be=function(e,t){return e<<t&65535|(65535&e)>>16-t},_e=function(e,t){return(65535&e)>>t|e<<16-t&65535};j.rc2=j.rc2||{},j.rc2.expandKey=function(e,t){"string"==typeof e&&(e=j.util.createBuffer(e)),t=t||128;var r,n=e,i=e.length(),o=t,a=Math.ceil(o/8),s=255>>(7&o);for(r=i;r<128;r++)n.putByte(ge[n.at(r-1)+n.at(r-i)&255]);for(n.setAt(128-a,ge[n.at(128-a)&s]),r=127-a;r>=0;r--)n.setAt(r,ge[n.at(r+1)^n.at(r+a)]);return n};var Ce,we=function(e,t,r){var n,i,o,a,s=!1,c=null,l=null,u=null,d=[];for(e=j.rc2.expandKey(e,t),o=0;o<64;o++)d.push(e.getInt16Le());r?(n=function(e){for(o=0;o<4;o++)e[o]+=d[a]+(e[(o+3)%4]&e[(o+2)%4])+(~e[(o+3)%4]&e[(o+1)%4]),e[o]=be(e[o],ye[o]),a++},i=function(e){for(o=0;o<4;o++)e[o]+=d[63&e[(o+3)%4]]}):(n=function(e){for(o=3;o>=0;o--)e[o]=_e(e[o],ye[o]),e[o]-=d[a]+(e[(o+3)%4]&e[(o+2)%4])+(~e[(o+3)%4]&e[(o+1)%4]),a--},i=function(e){for(o=3;o>=0;o--)e[o]-=d[63&e[(o+3)%4]]});var f=function(e){var t=[];for(o=0;o<4;o++){var n=c.getInt16Le();null!==u&&(r?n^=u.getInt16Le():u.putInt16Le(n)),t.push(65535&n)}a=r?0:63;for(var i=0;i<e.length;i++)for(var s=0;s<e[i][0];s++)e[i][1](t);for(o=0;o<4;o++)null!==u&&(r?u.putInt16Le(t[o]):t[o]^=u.getInt16Le()),l.putInt16Le(t[o])},p=null;return p={start:function(e,t){e&&"string"==typeof e&&(e=j.util.createBuffer(e)),s=!1,c=j.util.createBuffer(),l=t||new j.util.createBuffer,u=e,p.output=l},update:function(e){for(s||c.putBuffer(e);c.length()>=8;)f([[5,n],[1,i],[6,n],[1,i],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,c,!r);else{var n=8===c.length()?8:8-c.length();c.fillWithByte(n,n)}if(t&&(s=!0,p.update()),!r&&(t=0===c.length()))if(e)t=e(8,l,!r);else{var i=l.length(),o=l.at(i-1);o>i?t=!1:l.truncate(o)}return t}}};function ke(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function Se(){return new ke(null)}function Be(e,t,r,n,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=s*c+l*a;i=((c=a*c+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+s*l,r.data[n++]=268435455&c}return i}j.rc2.startEncrypting=function(e,t,r){var n=j.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},j.rc2.createEncryptionCipher=function(e,t){return we(e,t,!0)},j.rc2.startDecrypting=function(e,t,r){var n=j.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},j.rc2.createDecryptionCipher=function(e,t){return we(e,t,!1)},j.jsbn=j.jsbn||{},j.jsbn.BigInteger=ke,"undefined"==typeof navigator?(ke.prototype.am=Be,Ce=28):"Microsoft Internet Explorer"==navigator.appName?(ke.prototype.am=function(e,t,r,n,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=s*c+l*a;i=((c=a*c+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+s*l+(i>>>30),r.data[n++]=1073741823&c}return i},Ce=30):"Netscape"!=navigator.appName?(ke.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var a=t*this.data[e++]+r.data[n]+i;i=Math.floor(a/67108864),r.data[n++]=67108863&a}return i},Ce=26):(ke.prototype.am=Be,Ce=28),ke.prototype.DB=Ce,ke.prototype.DM=(1<<Ce)-1,ke.prototype.DV=1<<Ce,ke.prototype.FV=Math.pow(2,52),ke.prototype.F1=52-Ce,ke.prototype.F2=2*Ce-52;var Ee,Ie,Ae=new Array;for(Ee="0".charCodeAt(0),Ie=0;Ie<=9;++Ie)Ae[Ee++]=Ie;for(Ee="a".charCodeAt(0),Ie=10;Ie<36;++Ie)Ae[Ee++]=Ie;for(Ee="A".charCodeAt(0),Ie=10;Ie<36;++Ie)Ae[Ee++]=Ie;function xe(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Te(e,t){var r=Ae[e.charCodeAt(t)];return null==r?-1:r}function Pe(e){var t=Se();return t.fromInt(e),t}function Re(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function De(e){this.m=e}function Le(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Ne(e,t){return e&t}function Oe(e,t){return e|t}function Fe(e,t){return e^t}function Me(e,t){return e&~t}function Ve(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ue(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function je(){}function ze(e){return e}function qe(e){this.r2=Se(),this.q3=Se(),ke.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}De.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},De.prototype.revert=function(e){return e},De.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},De.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},De.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Le.prototype.convert=function(e){var t=Se();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ke.ZERO)>0&&this.m.subTo(t,t),t},Le.prototype.revert=function(e){var t=Se();return e.copyTo(t),this.reduce(t),t},Le.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},Le.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Le.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},ke.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},ke.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},ke.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var a=8==r?255&e[n]:Te(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&ke.ZERO.subTo(this,this)},ke.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},ke.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},ke.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},ke.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+a+1]=this.data[r]>>i|s,s=(this.data[r]&o)<<n;for(r=a-1;r>=0;--r)t.data[r]=0;t.data[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},ke.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var a=r+1;a<this.t;++a)t.data[a-r-1]|=(this.data[a]&o)<<i,t.data[a-r]=this.data[a]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},ke.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},ke.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&ke.ZERO.subTo(t,t)},ke.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},ke.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=Se());var o=Se(),a=this.s,s=e.s,c=this.DB-Re(n.data[n.t-1]);c>0?(n.lShiftTo(c,o),i.lShiftTo(c,r)):(n.copyTo(o),i.copyTo(r));var l=o.t,u=o.data[l-1];if(0!=u){var d=u*(1<<this.F1)+(l>1?o.data[l-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,h=1<<this.F2,m=r.t,g=m-l,v=null==t?Se():t;for(o.dlShiftTo(g,v),r.compareTo(v)>=0&&(r.data[r.t++]=1,r.subTo(v,r)),ke.ONE.dlShiftTo(l,v),v.subTo(o,o);o.t<l;)o.data[o.t++]=0;for(;--g>=0;){var y=r.data[--m]==u?this.DM:Math.floor(r.data[m]*f+(r.data[m-1]+h)*p);if((r.data[m]+=o.am(0,y,r,g,0,l))<y)for(o.dlShiftTo(g,v),r.subTo(v,r);r.data[m]<--y;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),a!=s&&ke.ZERO.subTo(t,t)),r.t=l,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&ke.ZERO.subTo(r,r)}}},ke.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},ke.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},ke.prototype.exp=function(e,t){if(e>4294967295||e<1)return ke.ONE;var r=Se(),n=Se(),i=t.convert(this),o=Re(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var a=r;r=n,n=a}return t.revert(r)},ke.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this.data[a]>>s)>0&&(i=!0,o=xe(r));a>=0;)s<t?(r=(this.data[a]&(1<<s)-1)<<t-s,r|=this.data[--a]>>(s+=this.DB-t)):(r=this.data[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(i=!0),i&&(o+=xe(r));return i?o:"0"},ke.prototype.negate=function(){var e=Se();return ke.ZERO.subTo(this,e),e},ke.prototype.abs=function(){return this.s<0?this.negate():this},ke.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},ke.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Re(this.data[this.t-1]^this.s&this.DM)},ke.prototype.mod=function(e){var t=Se();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ke.ZERO)>0&&e.subTo(t,t),t},ke.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new De(t):new Le(t),this.exp(e,r)},ke.ZERO=Pe(0),ke.ONE=Pe(1),je.prototype.convert=ze,je.prototype.revert=ze,je.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},je.prototype.sqrTo=function(e,t){e.squareTo(t)},qe.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Se();return e.copyTo(t),this.reduce(t),t},qe.prototype.revert=function(e){return e},qe.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},qe.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},qe.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var He=[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],Ke=(1<<26)/He[He.length-1];if(ke.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},ke.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Pe(r),i=Se(),o=Se(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},ke.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,a=0,s=0;s<e.length;++s){var c=Te(e,s);c<0?"-"==e.charAt(s)&&0==this.signum()&&(i=!0):(a=t*a+c,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&ke.ZERO.subTo(this,this)},ke.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(ke.ONE.shiftLeft(e-1),Oe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(ke.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},ke.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},ke.prototype.changeBit=function(e,t){var r=ke.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},ke.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},ke.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},ke.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},ke.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},ke.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},ke.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},ke.prototype.millerRabin=function(e){var t=this.subtract(ke.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new ke(this.bitLength(),o)}while(n.compareTo(ke.ONE)<=0||n.compareTo(t)>=0);var s=n.modPow(i,this);if(0!=s.compareTo(ke.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(ke.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},ke.prototype.clone=function(){var e=Se();return this.copyTo(e),e},ke.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},ke.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},ke.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},ke.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},ke.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},ke.prototype.equals=function(e){return 0==this.compareTo(e)},ke.prototype.min=function(e){return this.compareTo(e)<0?this:e},ke.prototype.max=function(e){return this.compareTo(e)>0?this:e},ke.prototype.and=function(e){var t=Se();return this.bitwiseTo(e,Ne,t),t},ke.prototype.or=function(e){var t=Se();return this.bitwiseTo(e,Oe,t),t},ke.prototype.xor=function(e){var t=Se();return this.bitwiseTo(e,Fe,t),t},ke.prototype.andNot=function(e){var t=Se();return this.bitwiseTo(e,Me,t),t},ke.prototype.not=function(){for(var e=Se(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},ke.prototype.shiftLeft=function(e){var t=Se();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},ke.prototype.shiftRight=function(e){var t=Se();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},ke.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+Ve(this.data[e]);return this.s<0?this.t*this.DB:-1},ke.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Ue(this.data[r]^t);return e},ke.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},ke.prototype.setBit=function(e){return this.changeBit(e,Oe)},ke.prototype.clearBit=function(e){return this.changeBit(e,Me)},ke.prototype.flipBit=function(e){return this.changeBit(e,Fe)},ke.prototype.add=function(e){var t=Se();return this.addTo(e,t),t},ke.prototype.subtract=function(e){var t=Se();return this.subTo(e,t),t},ke.prototype.multiply=function(e){var t=Se();return this.multiplyTo(e,t),t},ke.prototype.divide=function(e){var t=Se();return this.divRemTo(e,t,null),t},ke.prototype.remainder=function(e){var t=Se();return this.divRemTo(e,null,t),t},ke.prototype.divideAndRemainder=function(e){var t=Se(),r=Se();return this.divRemTo(e,t,r),new Array(t,r)},ke.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),o=Pe(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new De(t):t.isEven()?new qe(t):new Le(t);var a=new Array,s=3,c=r-1,l=(1<<r)-1;if(a[1]=n.convert(this),r>1){var u=Se();for(n.sqrTo(a[1],u);s<=l;)a[s]=Se(),n.mulTo(u,a[s-2],a[s]),s+=2}var d,f,p=e.t-1,h=!0,m=Se();for(i=Re(e.data[p])-1;p>=0;){for(i>=c?d=e.data[p]>>i-c&l:(d=(e.data[p]&(1<<i+1)-1)<<c-i,p>0&&(d|=e.data[p-1]>>this.DB+i-c)),s=r;0==(1&d);)d>>=1,--s;if((i-=s)<0&&(i+=this.DB,--p),h)a[d].copyTo(o),h=!1;else{for(;s>1;)n.sqrTo(o,m),n.sqrTo(m,o),s-=2;s>0?n.sqrTo(o,m):(f=o,o=m,m=f),n.mulTo(m,a[d],o)}for(;p>=0&&0==(e.data[p]&1<<i);)n.sqrTo(o,m),f=o,o=m,m=f,--i<0&&(i=this.DB-1,--p)}return n.revert(o)},ke.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return ke.ZERO;for(var r=e.clone(),n=this.clone(),i=Pe(1),o=Pe(0),a=Pe(0),s=Pe(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&s.isEven()||(a.addTo(this,a),s.subTo(e,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(s,o)):(n.subTo(r,n),t&&a.subTo(i,a),s.subTo(o,s))}return 0!=n.compareTo(ke.ONE)?ke.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},ke.prototype.pow=function(e){return this.exp(e,new je)},ke.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},ke.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=He[He.length-1]){for(t=0;t<He.length;++t)if(r.data[0]==He[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<He.length;){for(var n=He[t],i=t+1;i<He.length&&n<Ke;)n*=He[i++];for(n=r.modInt(n);t<i;)if(n%He[t++]==0)return!1}return r.millerRabin(e)},_((function(e){var t=e.exports=j.sha1=j.sha1||{};j.md.sha1=j.md.algorithms.sha1=t,t.create=function(){n||(r=String.fromCharCode(128),r+=j.util.fillString(String.fromCharCode(0),64),n=!0);var e=null,t=j.util.createBuffer(),o=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=j.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(r,n){"utf8"===n&&(r=j.util.encodeUtf8(r));var s=r.length;a.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=s[1],s[1]=s[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(r),i(e,o,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=j.util.createBuffer();n.putBytes(t.bytes());var s,c=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;n.putBytes(r.substr(0,a.blockLength-c));for(var l=8*a.fullMessageLength[0],u=0;u<a.fullMessageLength.length-1;++u)l+=(s=8*a.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=s>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};i(d,o,n);var f=j.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},a};var r=null,n=!1;function i(e,t,r){for(var n,i,o,a,s,c,l,u=r.length();u>=64;){for(i=e.h0,o=e.h1,a=e.h2,s=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(o^a^s)+c+1859775393+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^a^s)+c+1859775393+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o&a|s&(o^a))+c+2400959708+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^a^s)+c+3395469782+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,e.h4=e.h4+c|0,u-=64}}})),_((function(e){var t=e.exports=j.pkcs1=j.pkcs1||{};function r(e,t,r){r||(r=j.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),o=0;o<i;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),n+=r.digest().getBytes()}return n.substring(0,t)}t.encode_rsa_oaep=function(e,t,n){var i,o,a,s;"string"==typeof n?(i=n,o=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,o=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(s=n.mgf1.md)),a?a.start():a=j.md.sha1.create(),s||(s=a);var c=Math.ceil(e.n.bitLength()/8),l=c-2*a.digestLength-2;if(t.length>l)throw(h=new Error("RSAES-OAEP input message length is too long.")).length=t.length,h.maxLength=l,h;i||(i=""),a.update(i,"raw");for(var u=a.digest(),d="",f=l-t.length,p=0;p<f;p++)d+="\0";var h,m=u.getBytes()+d+""+t;if(o){if(o.length!==a.digestLength)throw(h=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,h.digestLength=a.digestLength,h}else o=j.random.getBytes(a.digestLength);var g=r(o,c-a.digestLength-1,s),v=j.util.xorBytes(m,g,m.length),y=r(v,a.digestLength,s);return"\0"+j.util.xorBytes(o,y,o.length)+v},t.decode_rsa_oaep=function(e,t,n){var i,o,a;"string"==typeof n?(i=n,o=arguments[3]||void 0):n&&(i=n.label||void 0,o=n.md||void 0,n.mgf1&&n.mgf1.md&&(a=n.mgf1.md));var s=Math.ceil(e.n.bitLength()/8);if(t.length!==s)throw(g=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,g.expectedLength=s,g;if(void 0===o?o=j.md.sha1.create():o.start(),a||(a=o),s<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),o.update(i,"raw");for(var c=o.digest().getBytes(),l=t.charAt(0),u=t.substring(1,o.digestLength+1),d=t.substring(1+o.digestLength),f=r(d,o.digestLength,a),p=r(j.util.xorBytes(u,f,u.length),s-o.digestLength-1,a),h=j.util.xorBytes(d,p,d.length),m=h.substring(0,o.digestLength),g="\0"!==l,v=0;v<o.digestLength;++v)g|=c.charAt(v)!==m.charAt(v);for(var y=1,b=o.digestLength,_=o.digestLength;_<h.length;_++){var C=h.charCodeAt(_);g|=C&(y?65534:0),b+=y&=1&C^1}if(g||1!==h.charCodeAt(b))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)}})),_((function(e){!function(){if(j.prime)e.exports=j.prime;else{var t=e.exports=j.prime=j.prime||{},r=j.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],i=new r(null);i.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={});var i=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||j.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return function(e,t,n,i){return"workers"in n?function(e,t,n,i){if("undefined"==typeof Worker)return a(e,t,n,i);var o=s(e,t),c=n.workers,l=n.workLoad||100,u=30*l/8,d=n.workerScript||"forge/prime.worker.js";if(-1===c)return j.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],a=0;a<c;++a)n[a]=new Worker(d);for(a=0;a<c;++a)n[a].addEventListener("message",p);var f=!1;function p(a){if(!f){var c=a.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return f=!0,i(null,new r(c.prime,16))}o.bitLength()>e&&(o=s(e,t));var p=o.toString(16);a.target.postMessage({hex:p,workLoad:l}),o.dAddOffset(u,0)}}}f()}(e,t,n,i):a(e,t,n,i)}(e,c,i.options,n);throw new Error("Invalid prime generation algorithm: "+i.name)}}function a(e,t,r,i){var o=s(e,t),a=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(o.bitLength());"millerRabinTests"in r&&(a=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),function e(t,r,i,o,a,c,l){var u=+new Date;do{if(t.bitLength()>r&&(t=s(r,i)),t.isProbablePrime(a))return l(null,t);t.dAddOffset(n[o++%8],0)}while(c<0||+new Date-u<c);j.util.setImmediate((function(){e(t,r,i,o,a,c,l)}))}(o,e,t,0,a,c,i)}function s(e,t){var n=new r(e,t),a=e-1;return n.testBit(a)||n.bitwiseTo(r.ONE.shiftLeft(a),o,n),n.dAddOffset(31-n.mod(i).byteValue(),0),n}}()})),void 0===We)var We=j.jsbn.BigInteger;var Ge=j.util.isNodejs?t:null,Qe=j.asn1,Xe=j.util;j.pki=j.pki||{},j.pki.rsa=j.rsa=j.rsa||{};var Ye=j.pki,$e=[6,4,2,4,2,4,6,2],Ze={name:"PrivateKeyInfo",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Je={name:"RSAPrivateKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},et={name:"RSAPublicKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},tt=j.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:Qe.Class.UNIVERSAL,type:Qe.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},rt=function(e){var t;if(!(e.algorithm in Ye.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=Ye.oids[e.algorithm];var n=Qe.oidToDer(t).getBytes(),i=Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[]),o=Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[]);o.value.push(Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OID,!1,n)),o.value.push(Qe.create(Qe.Class.UNIVERSAL,Qe.Type.NULL,!1,""));var a=Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),Qe.toDer(i).getBytes()},nt=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var n;t.dP||(t.dP=t.d.mod(t.p.subtract(We.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(We.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{n=new We(j.util.bytesToHex(j.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(We.ONE));for(var i=(e=e.multiply(n.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(o)<0;)i=i.add(t.p);return i.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o).multiply(n.modInverse(t.n)).mod(t.n)};function it(e,t,r){var n=j.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=i-11,o}n.putByte(0),n.putByte(r);var a,s=i-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var c=0;c<s;++c)n.putByte(a)}else for(;s>0;){var l=0,u=j.random.getBytes(s);for(c=0;c<s;++c)0===(a=u.charCodeAt(c))?++l:n.putByte(a);s=l}return n.putByte(0),n.putBytes(e),n}function ot(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),o=j.util.createBuffer(e),a=o.getByte(),s=o.getByte();if(0!==a||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=i-3-n;for(var l=0;l<c;++l)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++c}else if(2===s)for(c=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++c}if(0!==o.getByte()||c!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function at(e,t,r){"function"==typeof t&&(r=t,t={});var n={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function i(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?a(t,e.q):void o(e.qBits,a))}))}function o(e,t){j.prime.generateProbablePrime(e,n,t)}function a(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(We.ONE).gcd(e.e).compareTo(We.ONE))return e.p=null,void i();if(0!==e.q.subtract(We.ONE).gcd(e.e).compareTo(We.ONE))return e.q=null,void o(e.qBits,a);if(e.p1=e.p.subtract(We.ONE),e.q1=e.q.subtract(We.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(We.ONE))return e.p=e.q=null,void i();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,a);var c=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(n.prng=t.prng),i()}function st(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=j.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function ct(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function lt(e){return j.util.isNodejs&&"function"==typeof Ge[e]}function ut(e){return void 0!==Xe.globalScope&&"object"==x(Xe.globalScope.crypto)&&"object"==x(Xe.globalScope.crypto.subtle)&&"function"==typeof Xe.globalScope.crypto.subtle[e]}function dt(e){return void 0!==Xe.globalScope&&"object"==x(Xe.globalScope.msCrypto)&&"object"==x(Xe.globalScope.msCrypto.subtle)&&"function"==typeof Xe.globalScope.msCrypto.subtle[e]}function ft(e){for(var t=j.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}if(Ye.rsa.encrypt=function(e,t,r){var n,i=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,n=it(e,t,r)):(n=j.util.createBuffer()).putBytes(e);for(var a=new We(n.toHex(),16),s=nt(a,t,i).toString(16),c=j.util.createBuffer(),l=o-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(j.util.hexToBytes(s)),c.getBytes()},Ye.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=i,o}var a=new We(j.util.createBuffer(e).toHex(),16);if(a.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=nt(a,t,r).toString(16),c=j.util.createBuffer(),l=i-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(j.util.hexToBytes(s)),!1!==n?ot(c.getBytes(),t,r):c.getBytes()},Ye.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var n,i=(r=r||{}).prng||j.random,o={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},a=r.algorithm||"PRIMEINC";if("PRIMEINC"!==a)throw new Error("Invalid key generation algorithm: "+a);return(n={algorithm:a,state:0,bits:e,rng:o,eInt:t||65537,e:new We(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(n.eInt),n},Ye.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new We(null);r.fromInt(30);for(var n,i=0,o=function(e,t){return e|t},a=+new Date,s=0;null===e.keys&&(t<=0||s<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new We(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(We.ONE.shiftLeft(l),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),i=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(ct(e.num.bitLength()))?++e.pqState:e.num.dAddOffset($e[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(We.ONE).gcd(e.e).compareTo(We.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(We.ONE),e.q1=e.q.subtract(We.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(We.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var u=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)}}s+=(n=+new Date)-a,a=n}return null!==e.keys},Ye.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==x(e)?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(lt("generateKeyPair"))return Ge.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:Ye.privateKeyFromPem(r),publicKey:Ye.publicKeyFromPem(t)})}));if(ut("generateKey")&&ut("exportKey"))return Xe.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return Xe.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=Ye.privateKeyFromAsn1(Qe.fromDer(j.util.createBuffer(e)));n(null,{privateKey:t,publicKey:Ye.setRsaPublicKey(t.n,t.e)})}}));if(dt("generateKey")&&dt("exportKey")){var i=Xe.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return i.oncomplete=function(e){var t=e.target.result,r=Xe.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=Ye.privateKeyFromAsn1(Qe.fromDer(j.util.createBuffer(t)));n(null,{privateKey:r,publicKey:Ye.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(i.onerror=function(e){n(e)})}}else if(lt("generateKeyPairSync")){var o=Ge.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Ye.privateKeyFromPem(o.privateKey),publicKey:Ye.publicKeyFromPem(o.publicKey)}}var a=Ye.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Ye.rsa.stepKeyPairGenerationState(a,0),a.keys;at(a,r,n)},Ye.setRsaPublicKey=Ye.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return it(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return j.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return Ye.rsa.encrypt(i,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=ot(t,r,!0),e===Qe.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===ot(t,r,!0)}});var i=Ye.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},Ye.setRsaPrivateKey=Ye.rsa.setPrivateKey=function(e,t,r,n,i,o,a,s){var c={n:e,e:t,d:r,p:n,q:i,dP:o,dQ:a,qInv:s,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=Ye.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:ot};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return j.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:rt},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return Ye.rsa.encrypt(n,c,r)}};return c},Ye.wrapRsaPrivateKey=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,Qe.integerToDer(0).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OID,!1,Qe.oidToDer(Ye.oids.rsaEncryption).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.NULL,!1,"")]),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OCTETSTRING,!1,Qe.toDer(e).getBytes())])},Ye.privateKeyFromAsn1=function(e){var t,r,n,i,o,a,s,c,l={},u=[];if(Qe.validate(e,Ze,l,u)&&(e=Qe.fromDer(j.util.createBuffer(l.privateKey))),l={},u=[],!Qe.validate(e,Je,l,u)){var d=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw d.errors=u,d}return t=j.util.createBuffer(l.privateKeyModulus).toHex(),r=j.util.createBuffer(l.privateKeyPublicExponent).toHex(),n=j.util.createBuffer(l.privateKeyPrivateExponent).toHex(),i=j.util.createBuffer(l.privateKeyPrime1).toHex(),o=j.util.createBuffer(l.privateKeyPrime2).toHex(),a=j.util.createBuffer(l.privateKeyExponent1).toHex(),s=j.util.createBuffer(l.privateKeyExponent2).toHex(),c=j.util.createBuffer(l.privateKeyCoefficient).toHex(),Ye.setRsaPrivateKey(new We(t,16),new We(r,16),new We(n,16),new We(i,16),new We(o,16),new We(a,16),new We(s,16),new We(c,16))},Ye.privateKeyToAsn1=Ye.privateKeyToRSAPrivateKey=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,Qe.integerToDer(0).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.n)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.e)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.d)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.p)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.q)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.dP)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.dQ)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.qInv))])},Ye.publicKeyFromAsn1=function(e){var t={},r=[];if(Qe.validate(e,tt,t,r)){var n,i=Qe.derToOid(t.publicKeyOid);if(i!==Ye.oids.rsaEncryption)throw(n=new Error("Cannot read public key. Unknown OID.")).oid=i,n;e=t.rsaPublicKey}if(r=[],!Qe.validate(e,et,t,r))throw(n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,n;var o=j.util.createBuffer(t.publicKeyModulus).toHex(),a=j.util.createBuffer(t.publicKeyExponent).toHex();return Ye.setRsaPublicKey(new We(o,16),new We(a,16))},Ye.publicKeyToAsn1=Ye.publicKeyToSubjectPublicKeyInfo=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.OID,!1,Qe.oidToDer(Ye.oids.rsaEncryption).getBytes()),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.NULL,!1,"")]),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.BITSTRING,!1,[Ye.publicKeyToRSAPublicKey(e)])])},Ye.publicKeyToRSAPublicKey=function(e){return Qe.create(Qe.Class.UNIVERSAL,Qe.Type.SEQUENCE,!0,[Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.n)),Qe.create(Qe.Class.UNIVERSAL,Qe.Type.INTEGER,!1,st(e.e))])},void 0===pt)var pt=j.jsbn.BigInteger;var ht=j.asn1,mt=j.pki=j.pki||{},gt=(mt.pbe=j.pbe=j.pbe||{},mt.oids),vt={name:"EncryptedPrivateKeyInfo",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},yt={name:"PBES2Algorithms",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bt={name:"pkcs-12PbeParams",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"iterations"}]};function _t(e,t){return e.start().update(t).digest().getBytes()}function Ct(e){var t;if(e){if(!(t=mt.oids[ht.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return wt(t)}function wt(e){var t=j.md;switch(e){case"hmacWithSHA224":t=j.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}mt.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,i,o,a=j.random.getBytesSync(r.saltSize),s=r.count,c=ht.integerToDer(s);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var l,u,d;switch(r.algorithm){case"aes128":n=16,l=16,u=gt["aes128-CBC"],d=j.aes.createEncryptionCipher;break;case"aes192":n=24,l=16,u=gt["aes192-CBC"],d=j.aes.createEncryptionCipher;break;case"aes256":n=32,l=16,u=gt["aes256-CBC"],d=j.aes.createEncryptionCipher;break;case"des":n=8,l=8,u=gt.desCBC,d=j.des.createEncryptionCipher;break;default:throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v}var f="hmacWith"+r.prfAlgorithm.toUpperCase(),p=wt(f),h=j.pkcs5.pbkdf2(t,a,s,n,p),m=j.random.getBytesSync(l);(y=d(h)).start(m),y.update(ht.toDer(e)),y.finish(),o=y.output.getBytes();var g=function(e,t,r,n){var i=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,e),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&i.value.push(ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,j.util.hexToBytes(r.toString(16))),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(mt.oids[n]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.NULL,!1,"")])),i}(a,c,n,f);i=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBES2).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBKDF2).getBytes()),g]),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(u).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,m)])])])}else{var v;if("3des"!==r.algorithm)throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v;n=24;var y,b=new j.util.ByteBuffer(a);h=mt.pbe.generatePkcs12Key(t,b,1,s,n),m=mt.pbe.generatePkcs12Key(t,b,2,s,n),(y=j.des.createEncryptionCipher(h)).start(m),y.update(ht.toDer(e)),y.finish(),o=y.output.getBytes(),i=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,a),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,c.getBytes())])])}return ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[i,ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,o)])},mt.decryptPrivateKeyInfo=function(e,t){var r=null,n={},i=[];if(!ht.validate(e,vt,n,i)){var o=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var a=ht.derToOid(n.encryptionOid),s=mt.pbe.getCipher(a,n.encryptionParams,t),c=j.util.createBuffer(n.encryptedData);return s.update(c),s.finish()&&(r=ht.fromDer(s.output)),r},mt.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:ht.toDer(e).getBytes()};return j.pem.encode(r,{maxline:t})},mt.encryptedPrivateKeyFromPem=function(e){var t=j.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return ht.fromDer(t.body)},mt.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var n=mt.wrapRsaPrivateKey(mt.privateKeyToAsn1(e));return n=mt.encryptPrivateKeyInfo(n,t,r),mt.encryptedPrivateKeyToPem(n)}var i,o,a,s;switch(r.algorithm){case"aes128":i="AES-128-CBC",a=16,o=j.random.getBytesSync(16),s=j.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",a=24,o=j.random.getBytesSync(16),s=j.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",a=32,o=j.random.getBytesSync(16),s=j.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",a=24,o=j.random.getBytesSync(8),s=j.des.createEncryptionCipher;break;case"des":i="DES-CBC",a=8,o=j.random.getBytesSync(8),s=j.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var l=s(j.pbe.opensslDeriveBytes(t,o.substr(0,8),a));l.start(o),l.update(ht.toDer(mt.privateKeyToAsn1(e))),l.finish();var u={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:j.util.bytesToHex(o).toUpperCase()},body:l.output.getBytes()};return j.pem.encode(u)},mt.decryptRsaPrivateKey=function(e,t){var r=null,n=j.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type)throw(a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=a,a;if(n.procType&&"ENCRYPTED"===n.procType.type){var i,o;switch(n.dekInfo.algorithm){case"DES-CBC":i=8,o=j.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,o=j.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,o=j.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,o=j.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,o=j.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,o=function(e){return j.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":i=8,o=function(e){return j.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":i=16,o=function(e){return j.rc2.createDecryptionCipher(e,128)};break;default:var a;throw(a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".')).algorithm=n.dekInfo.algorithm,a}var s=j.util.hexToBytes(n.dekInfo.parameters),c=o(j.pbe.opensslDeriveBytes(t,s.substr(0,8),i));if(c.start(s),c.update(j.util.createBuffer(n.body)),!c.finish())return r;r=c.output.getBytes()}else r=n.body;return null!==(r="ENCRYPTED PRIVATE KEY"===n.type?mt.decryptPrivateKeyInfo(ht.fromDer(r),t):ht.fromDer(r))&&(r=mt.privateKeyFromAsn1(r)),r},mt.pbe.generatePkcs12Key=function(e,t,r,n,i,o){var a,s;if(null==o){if(!("sha1"in j.md))throw new Error('"sha1" hash algorithm unavailable.');o=j.md.sha1.create()}var c=o.digestLength,l=o.blockLength,u=new j.util.ByteBuffer,d=new j.util.ByteBuffer;if(null!=e){for(s=0;s<e.length;s++)d.putInt16(e.charCodeAt(s));d.putInt16(0)}var f=d.length(),p=t.length(),h=new j.util.ByteBuffer;h.fillWithByte(r,l);var m=l*Math.ceil(p/l),g=new j.util.ByteBuffer;for(s=0;s<m;s++)g.putByte(t.at(s%p));var v=l*Math.ceil(f/l),y=new j.util.ByteBuffer;for(s=0;s<v;s++)y.putByte(d.at(s%f));var b=g;b.putBuffer(y);for(var _=Math.ceil(i/c),C=1;C<=_;C++){var w=new j.util.ByteBuffer;w.putBytes(h.bytes()),w.putBytes(b.bytes());for(var k=0;k<n;k++)o.start(),o.update(w.getBytes()),w=o.digest();var S=new j.util.ByteBuffer;for(s=0;s<l;s++)S.putByte(w.at(s%c));var B=Math.ceil(p/l)+Math.ceil(f/l),E=new j.util.ByteBuffer;for(a=0;a<B;a++){var I=new j.util.ByteBuffer(b.getBytes(l)),A=511;for(s=S.length()-1;s>=0;s--)A>>=8,A+=S.at(s)+I.at(s),I.setAt(s,255&A);E.putBuffer(I)}b=E,u.putBuffer(w)}return u.truncate(u.length()-i),u},mt.pbe.getCipher=function(e,t,r){switch(e){case mt.oids.pkcs5PBES2:return mt.pbe.getCipherForPBES2(e,t,r);case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:return mt.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},mt.pbe.getCipherForPBES2=function(e,t,r){var n,i={},o=[];if(!ht.validate(t,yt,i,o))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,n;if((e=ht.derToOid(i.kdfOid))!==mt.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=ht.derToOid(i.encOid))!==mt.oids["aes128-CBC"]&&e!==mt.oids["aes192-CBC"]&&e!==mt.oids["aes256-CBC"]&&e!==mt.oids["des-EDE3-CBC"]&&e!==mt.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var a,s,c=i.kdfSalt,l=j.util.createBuffer(i.kdfIterationCount);switch(l=l.getInt(l.length()<<3),mt.oids[e]){case"aes128-CBC":a=16,s=j.aes.createDecryptionCipher;break;case"aes192-CBC":a=24,s=j.aes.createDecryptionCipher;break;case"aes256-CBC":a=32,s=j.aes.createDecryptionCipher;break;case"des-EDE3-CBC":a=24,s=j.des.createDecryptionCipher;break;case"desCBC":a=8,s=j.des.createDecryptionCipher}var u=Ct(i.prfOid),d=j.pkcs5.pbkdf2(r,c,l,a,u),f=i.encIv,p=s(d);return p.start(f),p},mt.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!ht.validate(t,bt,n,i))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=i,u;var o,a,s,c=j.util.createBuffer(n.salt),l=j.util.createBuffer(n.iterations);switch(l=l.getInt(l.length()<<3),e){case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:o=24,a=8,s=j.des.startDecrypting;break;case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:o=5,a=8,s=function(e,t){var r=j.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,u}var d=Ct(n.prfOid),f=mt.pbe.generatePkcs12Key(r,c,1,l,o,d);return d.start(),s(f,mt.pbe.generatePkcs12Key(r,c,2,l,a,d))},mt.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in j.md))throw new Error('"md5" hash algorithm unavailable.');n=j.md.md5.create()}null===t&&(t="");for(var i=[_t(n,e+t)],o=16,a=1;o<r;++a,o+=16)i.push(_t(n,i[a-1]+e+t));return i.join("").substr(0,r)},_((function(e){var t=j.asn1,r=e.exports=j.pkcs7asn1=j.pkcs7asn1||{};j.pkcs7=j.pkcs7||{},j.pkcs7.asn1=r;var n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=n;var i={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(i)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(i)};var o={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},n,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[o]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}})),_((function(e){j.mgf=j.mgf||{},(e.exports=j.mgf.mgf1=j.mgf1=j.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new j.util.ByteBuffer,i=Math.ceil(r/e.digestLength),o=0;o<i;o++){var a=new j.util.ByteBuffer;a.putInt32(o),e.start(),e.update(t+a.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}}}})),j.mgf=j.mgf||{},j.mgf.mgf1=j.mgf1,_((function(e){(e.exports=j.pss=j.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,i=r.digestLength,o=e.salt||null;if("string"==typeof o&&(o=j.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||j.random;return{encode:function(e,s){var c,l,u=s-1,d=Math.ceil(u/8),f=e.digest().getBytes();if(d<i+t+2)throw new Error("Message is too long to encrypt.");l=null===o?a.getBytesSync(t):o.bytes();var p=new j.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(l),r.start(),r.update(p.getBytes());var h=r.digest().getBytes(),m=new j.util.ByteBuffer;m.fillWithByte(0,d-t-i-2),m.putByte(1),m.putBytes(l);var g=m.getBytes(),v=d-i-1,y=n.generate(h,v),b="";for(c=0;c<v;c++)b+=String.fromCharCode(g.charCodeAt(c)^y.charCodeAt(c));var _=65280>>8*d-u&255;return(b=String.fromCharCode(b.charCodeAt(0)&~_)+b.substr(1))+h+String.fromCharCode(188)},verify:function(e,o,a){var s,c=a-1,l=Math.ceil(c/8);if(o=o.substr(-l),l<i+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var u=l-i-1,d=o.substr(0,u),f=o.substr(u,i),p=65280>>8*l-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var h=n.generate(f,u),m="";for(s=0;s<u;s++)m+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));m=String.fromCharCode(m.charCodeAt(0)&~p)+m.substr(1);var g=l-i-t-2;for(s=0;s<g;s++)if(0!==m.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==m.charCodeAt(g))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=m.substr(-t),y=new j.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(e),y.putBytes(v),r.start(),r.update(y.getBytes()),f===r.digest().getBytes()}}}})),_((function(e){var t=j.asn1,r=e.exports=j.pki=j.pki||{},n=r.oids,i={};i.CN=n.commonName,i.commonName="CN",i.C=n.countryName,i.countryName="C",i.L=n.localityName,i.localityName="L",i.ST=n.stateOrProvinceName,i.stateOrProvinceName="ST",i.O=n.organizationName,i.organizationName="O",i.OU=n.organizationalUnitName,i.organizationalUnitName="OU",i.E=n.emailAddress,i.emailAddress="E";var o=j.pki.rsa.publicKeyValidator,a={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},o,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},s={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},o,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}r.RDNAttributesAsArray=function(e,r){for(var o,a,s,c=[],l=0;l<e.value.length;++l){o=e.value[l];for(var u=0;u<o.value.length;++u)s={},a=o.value[u],s.type=t.derToOid(a.value[0].value),s.value=a.value[1].value,s.valueTagClass=a.value[1].type,s.type in n&&(s.name=n[s.type],s.name in i&&(s.shortName=i[s.name])),r&&(r.update(s.type),r.update(s.value)),c.push(s)}return c},r.CRIAttributesAsArray=function(e){for(var o=[],a=0;a<e.length;++a)for(var s=e[a],c=t.derToOid(s.value[0].value),l=s.value[1].value,u=0;u<l.length;++u){var d={};if(d.type=c,d.value=l[u].value,d.valueTagClass=l[u].type,d.type in n&&(d.name=n[d.type],d.name in i&&(d.shortName=i[d.name])),d.type===n.extensionRequest){d.extensions=[];for(var f=0;f<d.value.length;++f)d.extensions.push(r.certificateExtensionFromAsn1(d.value[f]))}o.push(d)}return o};var d=function(e,r,i){var o={};if(e!==n["RSASSA-PSS"])return o;i&&(o={hash:{algorithmOid:n.sha1},mgf:{algorithmOid:n.mgf1,hash:{algorithmOid:n.sha1}},saltLength:20});var a={},c=[];if(!t.validate(r,s,a,c)){var l=new Error("Cannot read RSASSA-PSS parameter block.");throw l.errors=c,l}return void 0!==a.hashOid&&(o.hash=o.hash||{},o.hash.algorithmOid=t.derToOid(a.hashOid)),void 0!==a.maskGenOid&&(o.mgf=o.mgf||{},o.mgf.algorithmOid=t.derToOid(a.maskGenOid),o.mgf.hash=o.mgf.hash||{},o.mgf.hash.algorithmOid=t.derToOid(a.maskGenHashOid)),void 0!==a.saltLength&&(o.saltLength=a.saltLength.charCodeAt(0)),o};function f(e){for(var r,n,i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),o=e.attributes,a=0;a<o.length;++a){var s=(r=o[a]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in r&&(c=r.valueTagClass)===t.Type.UTF8&&(s=j.util.encodeUtf8(s)),n=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),i.value.push(n)}return i}function p(e){for(var o,a=0;a<e.length;++a){if(void 0===(o=e[a]).name&&(o.type&&o.type in r.oids?o.name=r.oids[o.type]:o.shortName&&o.shortName in i&&(o.name=r.oids[i[o.shortName]])),void 0===o.type){if(!o.name||!(o.name in r.oids))throw(c=new Error("Attribute type not specified.")).attribute=o,c;o.type=r.oids[o.name]}if(void 0===o.shortName&&o.name&&o.name in i&&(o.shortName=i[o.name]),o.type===n.extensionRequest&&(o.valueConstructed=!0,o.valueTagClass=t.Type.SEQUENCE,!o.value&&o.extensions)){o.value=[];for(var s=0;s<o.extensions.length;++s)o.value.push(r.certificateExtensionToAsn1(h(o.extensions[s])))}var c;if(void 0===o.value)throw(c=new Error("Attribute value not specified.")).attribute=o,c}}function h(e,i){if(i=i||{},void 0===e.name&&e.id&&e.id in r.oids&&(e.name=r.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in r.oids))throw(_=new Error("Extension ID not specified.")).extension=e,_;e.id=r.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var o=0,a=0,s=0;e.digitalSignature&&(a|=128,o=7),e.nonRepudiation&&(a|=64,o=6),e.keyEncipherment&&(a|=32,o=5),e.dataEncipherment&&(a|=16,o=4),e.keyAgreement&&(a|=8,o=3),e.keyCertSign&&(a|=4,o=2),e.cRLSign&&(a|=2,o=1),e.encipherOnly&&(a|=1,o=0),e.decipherOnly&&(s|=128,o=7);var c=String.fromCharCode(o);0!==s?c+=String.fromCharCode(a)+String.fromCharCode(s):0!==a&&(c+=String.fromCharCode(a)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var u in e)!0===e[u]&&(u in n?l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n[u]).getBytes())):-1!==u.indexOf(".")&&l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(u).getBytes())))}else if("nsCertType"===e.name)o=0,a=0,e.client&&(a|=128,o=7),e.server&&(a|=64,o=6),e.email&&(a|=32,o=5),e.objsign&&(a|=16,o=4),e.reserved&&(a|=8,o=3),e.sslCA&&(a|=4,o=2),e.emailCA&&(a|=2,o=1),e.objCA&&(a|=1,o=0),c=String.fromCharCode(o),0!==a&&(c+=String.fromCharCode(a)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c);else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=j.util.bytesFromIP(v.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));e.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}}else if("nsComment"===e.name&&i.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&i.cert){var p=i.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&i.cert){if(e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value,e.keyIdentifier){var h=!0===e.keyIdentifier?i.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(e.authorityCertIssuer){var m=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===e.authorityCertIssuer?i.cert.issuer:e.authorityCertIssuer)])];l.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var g=j.util.hexToBytes(!0===e.serialNumber?i.cert.serialNumber:e.serialNumber);l.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value;var v,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),b=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=j.util.bytesFromIP(v.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));b.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[b])),l.push(y)}var _;if(void 0===e.value)throw(_=new Error("Extension value not specified.")).extension=e,_;return e}function m(e,r){switch(e){case n["RSASSA-PSS"]:var i=[];return void 0!==r.hash.algorithmOid&&i.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&i.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&i.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,i);default:return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}}function g(e){var r=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return r;for(var n=e.attributes,i=0;i<n.length;++i){var o=n[i],a=o.value,s=t.Type.UTF8;"valueTagClass"in o&&(s=o.valueTagClass),s===t.Type.UTF8&&(a=j.util.encodeUtf8(a));var c=!1;"valueConstructed"in o&&(c=o.valueConstructed);var l=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(o.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,a)])]);r.value.push(l)}return r}r.certificateFromPem=function(e,n,i){var o=j.pem.decode(e)[0];if("CERTIFICATE"!==o.type&&"X509 CERTIFICATE"!==o.type&&"TRUSTED CERTIFICATE"!==o.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(o.body,i);return r.certificateFromAsn1(s,n)},r.certificateToPem=function(e,n){var i={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.publicKeyFromPem=function(e){var n=j.pem.decode(e)[0];if("PUBLIC KEY"!==n.type&&"RSA PUBLIC KEY"!==n.type){var i=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var o=t.fromDer(n.body);return r.publicKeyFromAsn1(o)},r.publicKeyToPem=function(e,n){var i={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.publicKeyToRSAPublicKeyPem=function(e,n){var i={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.getPublicKeyFingerprint=function(e,n){var i,o=(n=n||{}).md||j.md.sha1.create();switch(n.type||"RSAPublicKey"){case"RSAPublicKey":i=t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":i=t.toDer(r.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}o.start(),o.update(i);var a=o.digest();if("hex"===n.encoding){var s=a.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return a.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return a},r.certificationRequestFromPem=function(e,n,i){var o=j.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==o.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(o.body,i);return r.certificationRequestFromAsn1(s,n)},r.certificationRequestToPem=function(e,n){var i={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return u(e.issuer,t)},e.issuer.addField=function(t){p([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){p(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){p(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)h(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(i,o){e.md=o||j.md.sha1.create();var a=n[e.md.algorithm+"WithRSAEncryption"];if(!a){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=r.getTBSCertificate(e);var c=t.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=i.sign(e.md)},e.verify=function(i){var o=!1;if(!e.issued(i)){var a=i.issuer,s=e.subject;throw(h=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=a.attributes,h.actualIssuer=s.attributes,h}var c=i.md;if(null===c){if(i.signatureOid in n)switch(n[i.signatureOid]){case"sha1WithRSAEncryption":c=j.md.sha1.create();break;case"md5WithRSAEncryption":c=j.md.md5.create();break;case"sha256WithRSAEncryption":c=j.md.sha256.create();break;case"sha384WithRSAEncryption":c=j.md.sha384.create();break;case"sha512WithRSAEncryption":c=j.md.sha512.create();break;case"RSASSA-PSS":c=j.md.sha256.create()}if(null===c)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=i.signatureOid,h;var l=i.tbsCertificate||r.getTBSCertificate(i),u=t.toDer(l);c.update(u.getBytes())}if(null!==c){var d;switch(i.signatureOid){case n.sha1WithRSAEncryption:d=void 0;break;case n["RSASSA-PSS"]:var f,p,h;if(void 0===(f=n[i.signatureParameters.mgf.hash.algorithmOid])||void 0===j.md[f])throw(h=new Error("Unsupported MGF hash function.")).oid=i.signatureParameters.mgf.hash.algorithmOid,h.name=f,h;if(void 0===(p=n[i.signatureParameters.mgf.algorithmOid])||void 0===j.mgf[p])throw(h=new Error("Unsupported MGF function.")).oid=i.signatureParameters.mgf.algorithmOid,h.name=p,h;if(p=j.mgf[p].create(j.md[f].create()),void 0===(f=n[i.signatureParameters.hash.algorithmOid])||void 0===j.md[f])throw{message:"Unsupported RSASSA-PSS hash function.",oid:i.signatureParameters.hash.algorithmOid,name:f};d=j.pss.create(j.md[f].create(),p,i.signatureParameters.saltLength)}o=e.publicKey.verify(c.digest().getBytes(),i.signature,d)}return o},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var o,a;r=!0;for(var s=0;r&&s<n.attributes.length;++s)o=n.attributes[s],a=i.attributes[s],o.type===a.type&&o.value===a.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=n.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return j.util.hexToBytes(i.subjectKeyIdentifier)===o}}return!1},e},r.certificateFromAsn1=function(e,i){var o={},s=[];if(!t.validate(e,a,o,s))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=s,h;if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=o.certVersion?o.certVersion.charCodeAt(0):0;var l=j.util.createBuffer(o.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=j.asn1.derToOid(o.certSignatureOid),c.signatureParameters=d(c.signatureOid,o.certSignatureParams,!0),c.siginfo.algorithmOid=j.asn1.derToOid(o.certinfoSignatureOid),c.siginfo.parameters=d(c.siginfo.algorithmOid,o.certinfoSignatureParams,!1),c.signature=o.certSignature;var f=[];if(void 0!==o.certValidity1UTCTime&&f.push(t.utcTimeToDate(o.certValidity1UTCTime)),void 0!==o.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity2GeneralizedTime)),void 0!==o.certValidity3UTCTime&&f.push(t.utcTimeToDate(o.certValidity3UTCTime)),void 0!==o.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=o.tbsCertificate,i){var h;if(c.md=null,c.signatureOid in n)switch(n[c.signatureOid]){case"sha1WithRSAEncryption":c.md=j.md.sha1.create();break;case"md5WithRSAEncryption":c.md=j.md.md5.create();break;case"sha256WithRSAEncryption":c.md=j.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=j.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=j.md.sha512.create();break;case"RSASSA-PSS":c.md=j.md.sha256.create()}if(null===c.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,h;var m=t.toDer(c.tbsCertificate);c.md.update(m.getBytes())}var g=j.md.sha1.create();c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){p([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(o.certIssuer,g),o.certIssuerUniqueId&&(c.issuer.uniqueId=o.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var v=j.md.sha1.create();return c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){p([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(o.certSubject,v),o.certSubjectUniqueId&&(c.subject.uniqueId=o.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),o.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(o.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n<e.value.length;++n)for(var i=e.value[n],o=0;o<i.value.length;++o)t.push(r.certificateExtensionFromAsn1(i.value[o]));return t},r.certificateExtensionFromAsn1=function(e){var r={};if(r.id=t.derToOid(e.value[0].value),r.critical=!1,e.value[1].type===t.Type.BOOLEAN?(r.critical=0!==e.value[1].value.charCodeAt(0),r.value=e.value[2].value):r.value=e.value[1].value,r.id in n)if(r.name=n[r.id],"keyUsage"===r.name){var i=0,o=0;(s=t.fromDer(r.value)).value.length>1&&(i=s.value.charCodeAt(1),o=s.value.length>2?s.value.charCodeAt(2):0),r.digitalSignature=128==(128&i),r.nonRepudiation=64==(64&i),r.keyEncipherment=32==(32&i),r.dataEncipherment=16==(16&i),r.keyAgreement=8==(8&i),r.keyCertSign=4==(4&i),r.cRLSign=2==(2&i),r.encipherOnly=1==(1&i),r.decipherOnly=128==(128&o)}else if("basicConstraints"===r.name){(s=t.fromDer(r.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?r.cA=0!==s.value[0].value.charCodeAt(0):r.cA=!1;var a=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?a=s.value[0].value:s.value.length>1&&(a=s.value[1].value),null!==a&&(r.pathLenConstraint=t.derToInteger(a))}else if("extKeyUsage"===r.name)for(var s=t.fromDer(r.value),c=0;c<s.value.length;++c){var l=t.derToOid(s.value[c].value);l in n?r[n[l]]=!0:r[l]=!0}else if("nsCertType"===r.name)i=0,(s=t.fromDer(r.value)).value.length>1&&(i=s.value.charCodeAt(1)),r.client=128==(128&i),r.server=64==(64&i),r.email=32==(32&i),r.objsign=16==(16&i),r.reserved=8==(8&i),r.sslCA=4==(4&i),r.emailCA=2==(2&i),r.objCA=1==(1&i);else if("subjectAltName"===r.name||"issuerAltName"===r.name){var u;r.altNames=[],s=t.fromDer(r.value);for(var d=0;d<s.value.length;++d){var f={type:(u=s.value[d]).type,value:u.value};switch(r.altNames.push(f),u.type){case 1:case 2:case 6:break;case 7:f.ip=j.util.bytesToIP(u.value);break;case 8:f.oid=t.derToOid(u.value)}}}else"subjectKeyIdentifier"===r.name&&(s=t.fromDer(r.value),r.subjectKeyIdentifier=j.util.bytesToHex(s.value));return r},r.certificationRequestFromAsn1=function(e,i){var o={},a=[];if(!t.validate(e,l,o,a))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=a,c;if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=o.csrVersion?o.csrVersion.charCodeAt(0):0,s.signatureOid=j.asn1.derToOid(o.csrSignatureOid),s.signatureParameters=d(s.signatureOid,o.csrSignatureParams,!0),s.siginfo.algorithmOid=j.asn1.derToOid(o.csrSignatureOid),s.siginfo.parameters=d(s.siginfo.algorithmOid,o.csrSignatureParams,!1),s.signature=o.csrSignature,s.certificationRequestInfo=o.certificationRequestInfo,i){var c;if(s.md=null,s.signatureOid in n)switch(n[s.signatureOid]){case"sha1WithRSAEncryption":s.md=j.md.sha1.create();break;case"md5WithRSAEncryption":s.md=j.md.md5.create();break;case"sha256WithRSAEncryption":s.md=j.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=j.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=j.md.sha512.create();break;case"RSASSA-PSS":s.md=j.md.sha256.create()}if(null===s.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=s.signatureOid,c;var f=t.toDer(s.certificationRequestInfo);s.md.update(f.getBytes())}var h=j.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){p([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(o.certificationRequestInfoSubject,h),s.subject.hash=h.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){p([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(o.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return u(e,t)},e.addAttribute=function(t){p([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){p(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){p(t),e.attributes=t},e.sign=function(i,o){e.md=o||j.md.sha1.create();var a=n[e.md.algorithm+"WithRSAEncryption"];if(!a){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=r.getCertificationRequestInfo(e);var c=t.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=i.sign(e.md)},e.verify=function(){var i=!1,o=e.md;if(null===o){if(e.signatureOid in n)switch(n[e.signatureOid]){case"sha1WithRSAEncryption":o=j.md.sha1.create();break;case"md5WithRSAEncryption":o=j.md.md5.create();break;case"sha256WithRSAEncryption":o=j.md.sha256.create();break;case"sha384WithRSAEncryption":o=j.md.sha384.create();break;case"sha512WithRSAEncryption":o=j.md.sha512.create();break;case"RSASSA-PSS":o=j.md.sha256.create()}if(null===o)throw(d=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,d;var a=e.certificationRequestInfo||r.getCertificationRequestInfo(e),s=t.toDer(a);o.update(s.getBytes())}if(null!==o){var c;switch(e.signatureOid){case n.sha1WithRSAEncryption:break;case n["RSASSA-PSS"]:var l,u,d;if(void 0===(l=n[e.signatureParameters.mgf.hash.algorithmOid])||void 0===j.md[l])throw(d=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,d.name=l,d;if(void 0===(u=n[e.signatureParameters.mgf.algorithmOid])||void 0===j.mgf[u])throw(d=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,d.name=u,d;if(u=j.mgf[u].create(j.md[l].create()),void 0===(l=n[e.signatureParameters.hash.algorithmOid])||void 0===j.md[l])throw(d=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,d.name=l,d;c=j.pss.create(j.md[l].create(),u,e.signatureParameters.saltLength)}i=e.publicKey.verify(o.digest().getBytes(),e.signature,c)}return i},e};var v=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z");function b(e){return e>=v&&e<y?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}r.getTBSCertificate=function(e){var n=b(e.validity.notBefore),i=b(e.validity.notAfter),o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,j.util.hexToBytes(e.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.siginfo.algorithmOid).getBytes()),m(e.siginfo.algorithmOid,e.siginfo.parameters)]),f(e.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,i]),f(e.subject),r.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(r.certificateExtensionsToAsn1(e.extensions)),o},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),g(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var n=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var n=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);n.value.push(i);for(var o=0;o<e.length;++o)i.value.push(r.certificateExtensionToAsn1(e[o]));return n},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var n=e.value;return"string"!=typeof e.value&&(n=t.toDer(n).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)),r},r.certificationRequestToAsn1=function(e){var n=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(e){var n={certs:{}};function i(e){return o(e),n.certs[e.hash]||null}function o(e){if(!e.hash){var t=j.md.sha1.create();e.attributes=r.RDNAttributesAsArray(f(e),t),e.hash=t.digest().toHex()}}if(n.getIssuer=function(e){return i(e.issuer)},n.addCertificate=function(e){if("string"==typeof e&&(e=j.pki.certificateFromPem(e)),o(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];j.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},n.hasCertificate=function(e){"string"==typeof e&&(e=j.pki.certificateFromPem(e));var n=i(e.subject);if(!n)return!1;j.util.isArray(n)||(n=[n]);for(var o=t.toDer(r.certificateToAsn1(e)).getBytes(),a=0;a<n.length;++a)if(o===t.toDer(r.certificateToAsn1(n[a])).getBytes())return!0;return!1},n.listAllCertificates=function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(j.util.isArray(r))for(var i=0;i<r.length;++i)e.push(r[i]);else e.push(r)}return e},n.removeCertificate=function(e){var a;if("string"==typeof e&&(e=j.pki.certificateFromPem(e)),o(e.subject),!n.hasCertificate(e))return null;var s=i(e.subject);if(!j.util.isArray(s))return a=n.certs[e.subject.hash],delete n.certs[e.subject.hash],a;for(var c=t.toDer(r.certificateToAsn1(e)).getBytes(),l=0;l<s.length;++l)c===t.toDer(r.certificateToAsn1(s[l])).getBytes()&&(a=s[l],s.splice(l,1));return 0===s.length&&delete n.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var s=e[a];n.addCertificate(s)}return n},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(e,t,n){"function"==typeof n&&(n={verify:n}),n=n||{};var i=(t=t.slice(0)).slice(0),o=n.validityCheckDate;void 0===o&&(o=new Date);var a=!0,s=null,c=0;do{var l=t.shift(),u=null,d=!1;if(o&&(o<l.validity.notBefore||o>l.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:o}),null===s){if(null===(u=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(d=!0,u=l),u){var f=u;j.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){u=f.shift();try{p=u.verify(l)}catch(e){}}p||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||u&&!d||e.hasCertificate(l)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&u&&!l.isIssuer(u)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},m=0;null===s&&m<l.extensions.length;++m){var g=l.extensions[m];!g.critical||g.name in h||(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!a||0===t.length&&(!u||d))){var v=l.getExtension("basicConstraints"),y=l.getExtension("keyUsage");null!==y&&(y.keyCertSign&&null!==v||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===v||v.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in v&&c-1>v.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var b=null===s||s.error,_=n.verify?n.verify(b,c,i):b;if(!0!==_)throw!0===b&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(_||0===_)&&("object"!=x(_)||j.util.isArray(_)?"string"==typeof _&&(s.error=_):(_.message&&(s.message=_.message),_.error&&(s.error=_.error))),s;s=null,a=!1,++c}while(t.length>0);return!0}})),_((function(e){var t=j.asn1,r=j.pki,n=e.exports=j.pkcs12=j.pkcs12||{},i={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},o={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},i,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},a={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},s={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(e,t,r,n){for(var i=[],o=0;o<e.length;o++)for(var a=0;a<e[o].safeBags.length;a++){var s=e[o].safeBags[a];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&i.push(s):i.push(s))}return i}function u(e){if(e.composed||e.constructed){for(var t=j.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function d(e,n){var i={},o=[];if(!t.validate(e,j.pkcs7.asn1.encryptedDataValidator,i,o))throw(a=new Error("Cannot read EncryptedContentInfo.")).errors=o,a;var a,s=t.derToOid(i.contentType);if(s!==r.oids.data)throw(a=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,a;s=t.derToOid(i.encAlgorithm);var c=r.pbe.getCipher(s,i.encParameter,n),l=u(i.encryptedContentAsn1),d=j.util.createBuffer(l.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function f(e,n,i){if(!n&&0===e.length)return[];if((e=t.fromDer(e,n)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var o=[],s=0;s<e.value.length;s++){var l=e.value[s],u={},d=[];if(!t.validate(l,a,u,d))throw(v=new Error("Cannot read SafeBag.")).errors=d,v;var f,h,m={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};o.push(m);var g=u.bagValue.value[0];switch(m.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,i)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{m.key=r.privateKeyFromAsn1(g)}catch(e){m.key=null,m.asn1=g}continue;case r.oids.certBag:f=c,h=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var i=t.fromDer(u.cert,n);try{m.cert=r.certificateFromAsn1(i,!0)}catch(e){m.cert=null,m.asn1=i}};break;default:var v;throw(v=new Error("Unsupported PKCS#12 SafeBag type.")).oid=m.type,v}if(void 0!==f&&!t.validate(g,f,u,d))throw(v=new Error("Cannot read PKCS#12 "+f.name)).errors=d,v;h()}return o}function p(e){var n={};if(void 0!==e)for(var i=0;i<e.length;++i){var o={},a=[];if(!t.validate(e[i],s,o,a)){var c=new Error("Cannot read PKCS#12 BagAttribute.");throw c.errors=a,c}var l=t.derToOid(o.oid);if(void 0!==r.oids[l]){n[r.oids[l]]=[];for(var u=0;u<o.values.length;++u)n[r.oids[l]].push(o.values[u].value)}}return n}n.pkcs12FromAsn1=function(e,a,s){"string"==typeof a?(s=a,a=!0):void 0===a&&(a=!0);var c={};if(!t.validate(e,o,c,[]))throw(p=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=p,p;var p,h={version:c.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=j.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=l(h.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=l(h.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=l(h.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return l(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return l(h.safeContents,"localKeyId",e,t)}};if(3!==c.version.charCodeAt(0))throw(p=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=c.version.charCodeAt(0),p;if(t.derToOid(c.contentType)!==r.oids.data)throw(p=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(c.contentType),p;var m=c.content.value[0];if(m.tagClass!==t.Class.UNIVERSAL||m.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(m=u(m),c.mac){var g=null,v=0,y=t.derToOid(c.macAlgorithm);switch(y){case r.oids.sha1:g=j.md.sha1.create(),v=20;break;case r.oids.sha256:g=j.md.sha256.create(),v=32;break;case r.oids.sha384:g=j.md.sha384.create(),v=48;break;case r.oids.sha512:g=j.md.sha512.create(),v=64;break;case r.oids.md5:g=j.md.md5.create(),v=16}if(null===g)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var b=new j.util.ByteBuffer(c.macSalt),_="macIterations"in c?parseInt(j.util.bytesToHex(c.macIterations),16):1,C=n.generateKey(s,b,3,_,v,g),w=j.hmac.create();if(w.start(g,C),w.update(m.value),w.getMac().getBytes()!==c.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,n,o,a){if((n=t.fromDer(n,o)).tagClass!==t.Class.UNIVERSAL||n.type!==t.Type.SEQUENCE||!0!==n.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<n.value.length;s++){var c=n.value[s],l={},p=[];if(!t.validate(c,i,l,p))throw(v=new Error("Cannot read ContentInfo.")).errors=p,v;var h={encrypted:!1},m=null,g=l.content.value[0];switch(t.derToOid(l.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");m=u(g).value;break;case r.oids.encryptedData:m=d(g,a),h.encrypted=!0;break;default:var v;throw(v=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(l.contentType),v}h.safeBags=f(m,o,a),e.safeContents.push(h)}}(h,m.value,a,s),h},n.toPkcs12Asn1=function(e,i,o,a){(a=a||{}).saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||a.encAlgorithm||"aes128","useMac"in a||(a.useMac=!0),"localKeyId"in a||(a.localKeyId=null),"generateLocalKeyId"in a||(a.generateLocalKeyId=!0);var s,c=a.localKeyId;if(null!==c)c=j.util.hexToBytes(c);else if(a.generateLocalKeyId)if(i){var l=j.util.isArray(i)?i[0]:i;"string"==typeof l&&(l=r.certificateFromPem(l)),(E=j.md.sha1.create()).update(t.toDer(r.certificateToAsn1(l)).getBytes()),c=E.digest().getBytes()}else c=j.random.getBytes(20);var u=[];null!==c&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in a&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,a.friendlyName)])])),u.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,u));var d=[],f=[];null!==i&&(f=j.util.isArray(i)?i:[i]);for(var p=[],h=0;h<f.length;++h){"string"==typeof(i=f[h])&&(i=r.certificateFromPem(i));var m=0===h?s:void 0,g=r.certificateToAsn1(i),v=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(g).getBytes())])])]),m]);p.push(v)}if(p.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,p),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(b)}var _=null;if(null!==e){var C=r.wrapRsaPrivateKey(r.privateKeyToAsn1(e));_=null===o?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[C]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(C,o,a)]),s]);var w=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[_]),k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(w).getBytes())])]);d.push(k)}var S,B=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(a.useMac){var E=j.md.sha1.create(),I=new j.util.ByteBuffer(j.random.getBytes(a.saltSize)),A=a.count,x=(e=n.generateKey(o,I,3,A,20),j.hmac.create());x.start(E,e),x.update(t.toDer(B).getBytes());var T=x.getMac();S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,T.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,I.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(A).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(B).getBytes())])]),S])},n.generateKey=j.pbe.generatePkcs12Key})),_((function(e){var t=j.asn1,r=e.exports=j.pki=j.pki||{};r.pemToDer=function(e){var t=j.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return j.util.createBuffer(t.body)},r.privateKeyFromPem=function(e){var n=j.pem.decode(e)[0];if("PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var i=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=t.fromDer(n.body);return r.privateKeyFromAsn1(o)},r.privateKeyToPem=function(e,n){var i={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(e)).getBytes()};return j.pem.encode(i,{maxline:n})},r.privateKeyInfoToPem=function(e,r){var n={type:"PRIVATE KEY",body:t.toDer(e).getBytes()};return j.pem.encode(n,{maxline:r})}}));var kt=function(e,t,r,n){var i=j.util.createBuffer(),o=e.length>>1,a=o+(1&e.length),s=e.substr(0,a),c=e.substr(o,a),l=j.util.createBuffer(),u=j.hmac.create();r=t+r;var d=Math.ceil(n/16),f=Math.ceil(n/20);u.start("MD5",s);var p=j.util.createBuffer();l.putBytes(r);for(var h=0;h<d;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),p.putBuffer(u.digest());u.start("SHA1",c);var m=j.util.createBuffer();for(l.clear(),l.putBytes(r),h=0;h<f;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),m.putBuffer(u.digest());return i.putBytes(j.util.xorBytes(p.getBytes(),m.getBytes(),n)),i},St=function(e,t,r){var n=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=j.util.createBuffer(i),t.length=i.length,n=!0}catch(e){}return n},Bt=function(e,t,r){var n=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=j.util.createBuffer(i),t.length=i.length,n=!0}catch(e){}return n},Et=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return j.util.createBuffer(e.getBytes(r))},It=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},At={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};At.SupportedVersions=[At.Versions.TLS_1_1,At.Versions.TLS_1_0],At.Version=At.SupportedVersions[0],At.MaxFragment=15360,At.ConnectionEnd={server:0,client:1},At.PRFAlgorithm={tls_prf_sha256:0},At.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},At.CipherType={stream:0,block:1,aead:2},At.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},At.CompressionMethod={none:0,deflate:1},At.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},At.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},At.Alert={},At.Alert.Level={warning:1,fatal:2},At.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},At.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},At.CipherSuites={},At.getCipherSuite=function(e){var t=null;for(var r in At.CipherSuites){var n=At.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},At.handleUnexpected=function(e,t){!e.open&&e.entity===At.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unexpected_message}})},At.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(At.queue(e,At.createAlert(e,{level:At.Alert.Level.warning,description:At.Alert.Description.no_renegotiation})),At.flush(e)),e.process()},At.parseHelloMessage=function(e,t,r){var n=null,i=e.entity===At.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});else{var o=t.fragment,a=o.length();if(n={version:{major:o.getByte(),minor:o.getByte()},random:j.util.createBuffer(o.getBytes(32)),session_id:Et(o,1),extensions:[]},i?(n.cipher_suite=o.getBytes(2),n.compression_method=o.getByte()):(n.cipher_suites=Et(o,2),n.compression_methods=Et(o,1)),(a=r-(a-o.length()))>0){for(var s=Et(o,2);s.length()>0;)n.extensions.push({type:[s.getByte(),s.getByte()],data:Et(s,2)});if(!i)for(var c=0;c<n.extensions.length;++c){var l=n.extensions[c];if(0===l.type[0]&&0===l.type[1])for(var u=Et(l.data,2);u.length()>0&&0===u.getByte();)e.session.extensions.server_name.serverNameList.push(Et(u,2).getBytes())}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=At.getCipherSuite(n.cipher_suite);else for(var d=j.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=At.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.handshake_failure},cipherSuite:j.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=i?n.compression_method:At.CompressionMethod.none}return n},At.createSecurityParameters=function(e,t){var r=e.entity===At.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,o=r?n:At.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:At.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:o}},At.handleServerHello=function(e,t,r){var n=At.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=Dt,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=xt,e.session.resuming=!1,At.createSecurityParameters(e,n)),e.session.id=i,e.process()}},At.handleClientHello=function(e,t,r){var n=At.parseHelloMessage(e,t,r);if(!e.fail){var i=n.session_id.bytes(),o=null;if(e.sessionCache&&(null===(o=e.sessionCache.getSession(i))?i="":(o.version.major!==n.version.major||o.version.minor>n.version.minor)&&(o=null,i="")),0===i.length&&(i=j.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=n.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var a,s=1;s<At.SupportedVersions.length&&!((a=At.SupportedVersions[s]).minor<=n.version.minor);++s);e.version={major:a.major,minor:a.minor},e.session.version=e.version}null!==o?(e.expect=Ut,e.session.resuming=!0,e.session.sp.client_random=n.random.bytes()):(e.expect=!1!==e.verifyClient?Ft:Mt,e.session.resuming=!1,At.createSecurityParameters(e,n)),e.open=!0,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createServerHello(e)})),e.session.resuming?(At.queue(e,At.createRecord(e,{type:At.ContentType.change_cipher_spec,data:At.createChangeCipherSpec()})),e.state.pending=At.createConnectionState(e),e.state.current.write=e.state.pending.write,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createFinished(e)}))):(At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificate(e)})),e.fail||(At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createServerKeyExchange(e)})),!1!==e.verifyClient&&At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificateRequest(e)})),At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createServerHelloDone(e)})))),At.flush(e),e.process()}},At.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var n,i,o=t.fragment,a={certificate_list:Et(o,3)},s=[];try{for(;a.certificate_list.length()>0;)n=Et(a.certificate_list,3),i=j.asn1.fromDer(n),n=j.pki.certificateFromAsn1(i,!0),s.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.bad_certificate}})}var c=e.entity===At.ConnectionEnd.client;!c&&!0!==e.verifyClient||0!==s.length?0===s.length?e.expect=c?Tt:Mt:(c?e.session.serverCertificate=s[0]:e.session.clientCertificate=s[0],At.verifyCertificateChain(e,s)&&(e.expect=c?Tt:Mt)):e.error(e,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}}),e.process()},At.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unsupported_certificate}});e.expect=Pt,e.process()},At.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unsupported_certificate}});var n=t.fragment,i={enc_pre_master_secret:Et(n,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=j.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}});try{var a=e.session.sp;a.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var s=e.session.clientHelloVersion;if(s.major!==a.pre_master_secret.charCodeAt(0)||s.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){a.pre_master_secret=j.random.getBytes(48)}e.expect=Ut,null!==e.session.clientCertificate&&(e.expect=Vt),e.process()},At.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:Et(n,1),certificate_authorities:Et(n,2)};e.session.certificateRequest=i,e.expect=Rt,e.process()},At.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var o={signature:Et(n,2).getBytes()},a=j.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(a,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.handshake_failure}})}e.expect=Ut,e.process()},At.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.insufficient_security}},i=e.verify(e,n.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=x(i)||j.util.isArray(i)?"number"==typeof i&&(n.alert.description=i):(i.message&&(n.message=i.message),i.alert&&(n.alert.description=i.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificate(e)}),At.queue(e,t)),t=At.createRecord(e,{type:At.ContentType.handshake,data:At.createClientKeyExchange(e)}),At.queue(e,t),e.expect=Ot;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createCertificateVerify(e,t)})),At.queue(e,At.createRecord(e,{type:At.ContentType.change_cipher_spec,data:At.createChangeCipherSpec()})),e.state.pending=At.createConnectionState(e),e.state.current.write=e.state.pending.write,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createFinished(e)})),e.expect=Dt,At.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);At.getClientSignature(e,o)},At.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.illegal_parameter}});var r=e.entity===At.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=At.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?Lt:jt,e.process()},At.handleFinished=function(e,t,r){var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var o=t.fragment.getBytes();(n=j.util.createBuffer()).putBuffer(e.session.md5.digest()),n.putBuffer(e.session.sha1.digest());var a=e.entity===At.ConnectionEnd.client,s=a?"server finished":"client finished",c=e.session.sp;if((n=kt(c.master_secret,s,n.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.decrypt_error}});e.session.md5.update(i),e.session.sha1.update(i),(e.session.resuming&&a||!e.session.resuming&&!a)&&(At.queue(e,At.createRecord(e,{type:At.ContentType.change_cipher_spec,data:At.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,At.queue(e,At.createRecord(e,{type:At.ContentType.handshake,data:At.createFinished(e)}))),e.expect=a?Nt:zt,e.handshaking=!1,++e.handshakes,e.peerCertificate=a?e.session.serverCertificate:e.session.clientCertificate,At.flush(e),e.isConnected=!0,e.connected(e),e.process()},At.handleAlert=function(e,t){var r,n=t.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case At.Alert.Description.close_notify:r="Connection closed.";break;case At.Alert.Description.unexpected_message:r="Unexpected message.";break;case At.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case At.Alert.Description.decryption_failed:r="Decryption failed.";break;case At.Alert.Description.record_overflow:r="Record overflow.";break;case At.Alert.Description.decompression_failure:r="Decompression failed.";break;case At.Alert.Description.handshake_failure:r="Handshake failure.";break;case At.Alert.Description.bad_certificate:r="Bad certificate.";break;case At.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case At.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case At.Alert.Description.certificate_expired:r="Certificate expired.";break;case At.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case At.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case At.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case At.Alert.Description.access_denied:r="Access denied.";break;case At.Alert.Description.decode_error:r="Decode error.";break;case At.Alert.Description.decrypt_error:r="Decrypt error.";break;case At.Alert.Description.export_restriction:r="Export restriction.";break;case At.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case At.Alert.Description.insufficient_security:r="Insufficient security.";break;case At.Alert.Description.internal_error:r="Internal error.";break;case At.Alert.Description.user_canceled:r="User canceled.";break;case At.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(i.description===At.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===At.ConnectionEnd.client?"server":"client",alert:i}),e.process()},At.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=j.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,n in nr[e.entity][e.expect]?(e.entity!==At.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:j.md.md5.create(),sha1:j.md.sha1.create()}),n!==At.HandshakeType.hello_request&&n!==At.HandshakeType.certificate_verify&&n!==At.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),nr[e.entity][e.expect][n](e,t,i)):At.handleUnexpected(e,t)},At.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},At.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(n===At.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();At.queue(e,At.createRecord(e,{type:At.ContentType.heartbeat,data:At.createHeartbeat(At.HeartbeatMessageType.heartbeat_response,o)})),At.flush(e)}else if(n===At.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,j.util.createBuffer(o))}e.process()};var xt=1,Tt=2,Pt=3,Rt=4,Dt=5,Lt=6,Nt=7,Ot=8,Ft=1,Mt=2,Vt=3,Ut=4,jt=5,zt=6,qt=At.handleUnexpected,Ht=At.handleChangeCipherSpec,Kt=At.handleAlert,Wt=At.handleHandshake,Gt=At.handleApplicationData,Qt=At.handleHeartbeat,Xt=[];Xt[At.ConnectionEnd.client]=[[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[Ht,Kt,qt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,Gt,Qt],[qt,Kt,Wt,qt,Qt]],Xt[At.ConnectionEnd.server]=[[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,qt,Qt],[Ht,Kt,qt,qt,Qt],[qt,Kt,Wt,qt,Qt],[qt,Kt,Wt,Gt,Qt],[qt,Kt,Wt,qt,Qt]];var Yt=At.handleHelloRequest,$t=At.handleServerHello,Zt=At.handleCertificate,Jt=At.handleServerKeyExchange,er=At.handleCertificateRequest,tr=At.handleServerHelloDone,rr=At.handleFinished,nr=[];nr[At.ConnectionEnd.client]=[[qt,qt,$t,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,Zt,Jt,er,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,Jt,er,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,er,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,tr,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,rr],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[Yt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt]];var ir=At.handleClientHello,or=At.handleClientKeyExchange,ar=At.handleCertificateVerify;nr[At.ConnectionEnd.server]=[[qt,ir,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,Zt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,or,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,ar,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,rr],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt],[qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt,qt]],At.generateKeys=function(e,t){var r=kt,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===At.Versions.TLS_1_0.major&&e.version.minor===At.Versions.TLS_1_0.minor;o&&(i+=2*t.fixed_iv_length);var a=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:a.getBytes(t.mac_key_length),server_write_MAC_key:a.getBytes(t.mac_key_length),client_write_key:a.getBytes(t.enc_key_length),server_write_key:a.getBytes(t.enc_key_length)};return o&&(s.client_write_IV=a.getBytes(t.fixed_iv_length),s.server_write_IV=a.getBytes(t.fixed_iv_length)),s},At.createConnectionState=function(e){var t=e.entity===At.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=At.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case At.CompressionMethod.none:break;case At.CompressionMethod.deflate:n.read.compressFunction=Bt,n.write.compressFunction=St;break;default:throw new Error("Unsupported compression algorithm.")}}return n},At.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=j.util.createBuffer();return r.putInt32(t),r.putBytes(j.random.getBytes(28)),r},At.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},At.createAlert=function(e,t){var r=j.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),At.createRecord(e,{type:At.ContentType.alert,data:r})},At.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=j.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var n=e.cipherSuites[r];t.putByte(n.id[0]),t.putByte(n.id[1])}var i=t.length(),o=j.util.createBuffer();o.putByte(At.CompressionMethod.none);var a=o.length(),s=j.util.createBuffer();if(e.virtualHost){var c=j.util.createBuffer();c.putByte(0),c.putByte(0);var l=j.util.createBuffer();l.putByte(0),It(l,2,j.util.createBuffer(e.virtualHost));var u=j.util.createBuffer();It(u,2,l),It(c,2,u),s.putBuffer(c)}var d=s.length();d>0&&(d+=2);var f=e.session.id,p=f.length+1+2+4+28+2+i+1+a+d,h=j.util.createBuffer();return h.putByte(At.HandshakeType.client_hello),h.putInt24(p),h.putByte(e.version.major),h.putByte(e.version.minor),h.putBytes(e.session.sp.client_random),It(h,1,j.util.createBuffer(f)),It(h,2,t),It(h,1,o),d>0&&It(h,2,s),h},At.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=j.util.createBuffer();return n.putByte(At.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),It(n,1,j.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},At.createCertificate=function(e){var t,r=e.entity===At.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var i=j.util.createBuffer();if(null!==n)try{j.util.isArray(n)||(n=[n]);for(var o=null,a=0;a<n.length;++a){var s=j.pem.decode(n[a])[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=s.type,c}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var l=j.util.createBuffer(s.body);null===o&&(o=j.asn1.fromDer(l.bytes(),!1));var u=j.util.createBuffer();It(u,3,l),i.putBuffer(u)}n=j.pki.certificateFromAsn1(o),r?e.session.clientCertificate=n:e.session.serverCertificate=n}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.bad_certificate}})}var d=3+i.length(),f=j.util.createBuffer();return f.putByte(At.HandshakeType.certificate),f.putInt24(d),It(f,3,i),f},At.createClientKeyExchange=function(e){var t=j.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(j.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var n=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,i=j.util.createBuffer();return i.putByte(At.HandshakeType.client_key_exchange),i.putInt24(n),i.putInt16(t.length),i.putBytes(t),i},At.createServerKeyExchange=function(e){return j.util.createBuffer()},At.getClientSignature=function(e,t){var r=j.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var n=null;if(e.getPrivateKey)try{n=e.getPrivateKey(e,e.session.clientCertificate),n=j.pki.privateKeyFromPem(n)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}})}null===n?e.error(e,{message:"No private key set.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.internal_error}}):t=n.sign(t,null),r(e,t)},e.getSignature(e,r,t)},At.createCertificateVerify=function(e,t){var r=t.length+2,n=j.util.createBuffer();return n.putByte(At.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(t.length),n.putBytes(t),n},At.createCertificateRequest=function(e){var t=j.util.createBuffer();t.putByte(1);var r=j.util.createBuffer();for(var n in e.caStore.certs){var i=e.caStore.certs[n],o=j.pki.distinguishedNameToAsn1(i.subject),a=j.asn1.toDer(o);r.putInt16(a.length()),r.putBuffer(a)}var s=1+t.length()+2+r.length(),c=j.util.createBuffer();return c.putByte(At.HandshakeType.certificate_request),c.putInt24(s),It(c,1,t),It(c,2,r),c},At.createServerHelloDone=function(e){var t=j.util.createBuffer();return t.putByte(At.HandshakeType.server_hello_done),t.putInt24(0),t},At.createChangeCipherSpec=function(){var e=j.util.createBuffer();return e.putByte(1),e},At.createFinished=function(e){var t=j.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===At.ConnectionEnd.client,n=e.session.sp,i=r?"client finished":"server finished";t=kt(n.master_secret,i,t.getBytes(),12);var o=j.util.createBuffer();return o.putByte(At.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o},At.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var n=j.util.createBuffer();n.putByte(e),n.putInt16(r),n.putBytes(t);var i=n.length(),o=Math.max(16,i-r-3);return n.putBytes(j.random.getBytes(o)),n},At.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==At.ContentType.handshake&&t.type!==At.ContentType.alert&&t.type!==At.ContentType.change_cipher_spec)){if(t.type===At.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var n;if(t.fragment.length()<=At.MaxFragment)n=[t];else{n=[];for(var i=t.fragment.bytes();i.length>At.MaxFragment;)n.push(At.createRecord(e,{type:t.type,data:j.util.createBuffer(i.slice(0,At.MaxFragment))})),i=i.slice(At.MaxFragment);i.length>0&&n.push(At.createRecord(e,{type:t.type,data:j.util.createBuffer(i)}))}for(var o=0;o<n.length&&!e.fail;++o){var a=n[o];e.state.current.write.update(e,a)&&e.records.push(a)}}},At.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var sr=function(e){switch(e){case!0:return!0;case j.pki.certificateError.bad_certificate:return At.Alert.Description.bad_certificate;case j.pki.certificateError.unsupported_certificate:return At.Alert.Description.unsupported_certificate;case j.pki.certificateError.certificate_revoked:return At.Alert.Description.certificate_revoked;case j.pki.certificateError.certificate_expired:return At.Alert.Description.certificate_expired;case j.pki.certificateError.certificate_unknown:return At.Alert.Description.certificate_unknown;case j.pki.certificateError.unknown_ca:return At.Alert.Description.unknown_ca;default:return At.Alert.Description.bad_certificate}};for(var cr in At.verifyCertificateChain=function(e,t){try{var r={};for(var n in e.verifyOptions)r[n]=e.verifyOptions[n];r.verify=function(t,r,n){sr(t);var i=e.verify(e,t,r,n);if(!0!==i){if("object"==x(i)&&!j.util.isArray(i)){var o=new Error("The application rejected the certificate.");throw o.send=!0,o.alert={level:At.Alert.Level.fatal,description:At.Alert.Description.bad_certificate},i.message&&(o.message=i.message),i.alert&&(o.alert.description=i.alert),o}i!==t&&(i=function(e){switch(e){case!0:return!0;case At.Alert.Description.bad_certificate:return j.pki.certificateError.bad_certificate;case At.Alert.Description.unsupported_certificate:return j.pki.certificateError.unsupported_certificate;case At.Alert.Description.certificate_revoked:return j.pki.certificateError.certificate_revoked;case At.Alert.Description.certificate_expired:return j.pki.certificateError.certificate_expired;case At.Alert.Description.certificate_unknown:return j.pki.certificateError.certificate_unknown;case At.Alert.Description.unknown_ca:return j.pki.certificateError.unknown_ca;default:return j.pki.certificateError.bad_certificate}}(i))}return i},j.pki.verifyCertificateChain(e.caStore,t,r)}catch(t){var i=t;("object"!=x(i)||j.util.isArray(i))&&(i={send:!0,alert:{level:At.Alert.Level.fatal,description:sr(t)}}),"send"in i||(i.send=!0),"alert"in i||(i.alert={level:At.Alert.Level.fatal,description:sr(i.error)}),e.error(e,i)}return!e.fail},At.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var n in(r={}).cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(n):delete e[n];r.getSession=function(e){var t=null,n=null;if(e?n=j.util.bytesToHex(e):r.order.length>0&&(n=r.order[0]),null!==n&&n in r.cache)for(var i in t=r.cache[n],delete r.cache[n],r.order)if(r.order[i]===n){r.order.splice(i,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=j.util.bytesToHex(e),r.order.push(n),r.cache[n]=t}}return r},At.createConnection=function(e){var t;t=e.caStore?j.util.isArray(e.caStore)?j.pki.createCaStore(e.caStore):e.caStore:j.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],At.CipherSuites)r.push(At.CipherSuites[n]);var i=e.server?At.ConnectionEnd.server:At.ConnectionEnd.client,o=e.sessionCache?At.createSessionCache(e.sessionCache):null,a={version:{major:At.Version.major,minor:At.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:o,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:j.util.createBuffer(),tlsData:j.util.createBuffer(),data:j.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===At.ConnectionEnd.client?"client":"server"),r.send&&(At.queue(t,At.createAlert(t,r.alert)),At.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){a.version={major:At.Version.major,minor:At.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=(At.ConnectionEnd.client,0),a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(e||void 0===e),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=At.createConnectionState(a)}};return a.reset(),a.handshake=function(e){if(a.entity!==At.ConnectionEnd.client)a.error(a,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(a.handshaking)a.error(a,{message:"Handshake already in progress.",fatal:!1});else{a.fail&&!a.open&&0===a.handshakes&&(a.fail=!1),a.handshaking=!0;var t=null;(e=e||"").length>0&&(a.sessionCache&&(t=a.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&a.sessionCache&&null!==(t=a.sessionCache.getSession())&&(e=t.id),a.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:j.md.md5.create(),sha1:j.md.sha1.create()},t&&(a.version=t.version,a.session.sp=t.sp),a.session.sp.client_random=At.createRandom().getBytes(),a.open=!0,At.queue(a,At.createRecord(a,{type:At.ContentType.handshake,data:At.createClientHello(a)})),At.flush(a)}},a.process=function(e){var t=0;return e&&a.input.putBytes(e),a.fail||(null!==a.record&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),null===a.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:j.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.protocol_version}})}return t}(a)),a.fail||null===a.record||a.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:At.Alert.Level.fatal,description:At.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(a)),!a.fail&&null!==a.record&&a.record.ready&&function(e,t){var r=t.type-At.ContentType.change_cipher_spec,n=Xt[e.entity][e.expect];r in n?n[r](e,t):At.handleUnexpected(e,t)}(a,a.record)),t},a.prepare=function(e){return At.queue(a,At.createRecord(a,{type:At.ContentType.application_data,data:j.util.createBuffer(e)})),At.flush(a)},a.prepareHeartbeatRequest=function(e,t){return e instanceof j.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),a.expectedHeartbeatPayload=e,At.queue(a,At.createRecord(a,{type:At.ContentType.heartbeat,data:At.createHeartbeat(At.HeartbeatMessageType.heartbeat_request,e,t)})),At.flush(a)},a.close=function(e){if(!a.fail&&a.sessionCache&&a.session){var t={id:a.session.id,version:a.session.version,sp:a.session.sp};t.sp.keys=null,a.sessionCache.setSession(t.id,t)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,At.queue(a,At.createAlert(a,{level:At.Alert.Level.warning,description:At.Alert.Description.close_notify})),At.flush(a)),a.closed(a)),a.reset(e)},a},j.tls=j.tls||{},At)"function"!=typeof At[cr]&&(j.tls[cr]=At[cr]);j.tls.prf_tls1=kt,j.tls.hmac_sha1=function(e,t,r){var n=j.hmac.create();n.start("SHA1",e);var i=j.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(r.type),i.putByte(r.version.major),i.putByte(r.version.minor),i.putInt16(r.length),i.putBytes(r.fragment.bytes()),n.update(i.getBytes()),n.digest().getBytes()},j.tls.createSessionCache=At.createSessionCache,j.tls.createConnection=At.createConnection,_((function(e){var t=e.exports=j.tls;function r(e,r,i){var o=r.entity===j.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:j.cipher.createDecipher("AES-CBC",o?i.keys.server_write_key:i.keys.client_write_key),iv:o?i.keys.server_write_IV:i.keys.client_write_IV},e.write.cipherState={init:!1,cipher:j.cipher.createCipher("AES-CBC",o?i.keys.client_write_key:i.keys.server_write_key),iv:o?i.keys.client_write_IV:i.keys.server_write_IV},e.read.cipherFunction=a,e.write.cipherFunction=n,e.read.macLength=e.write.macLength=i.mac_length,e.read.macFunction=e.write.macFunction=t.hmac_sha1}function n(e,r){var n,o=!1,a=r.macFunction(r.macKey,r.sequenceNumber,e);e.fragment.putBytes(a),r.updateSequenceNumber(),n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:j.random.getBytesSync(16),r.cipherState.init=!0;var s=r.cipherState.cipher;return s.start({iv:n}),e.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(i)&&(e.fragment=s.output,e.length=e.fragment.length(),o=!0),o}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var i=t.length(),o=t.last(),a=i-1-o;a<i-1;++a)n=n&&t.at(a)==o;n&&t.truncate(o+1)}return n}function a(e,r){var n,i;n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:e.fragment.getBytes(16),r.cipherState.init=!0;var a=r.cipherState.cipher;a.start({iv:n}),a.update(e.fragment),i=a.finish(o);var s=r.macLength,c=j.random.getBytesSync(s),l=a.output.length();l>=s?(e.fragment=a.output.getBytes(l-s),c=a.output.getBytes(s)):e.fragment=a.output.getBytes(),e.fragment=j.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=r.macFunction(r.macKey,r.sequenceNumber,e);return r.updateSequenceNumber(),function(e,t,r){var n=j.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),t===n.digest().getBytes()}(r.macKey,c,u)&&i}t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r}})),j.debug=j.debug||{},j.debug.storage={},j.debug.get=function(e,t){var r;return void 0===e?r=j.debug.storage:e in j.debug.storage&&(r=void 0===t?j.debug.storage[e]:j.debug.storage[e][t]),r},j.debug.set=function(e,t,r){e in j.debug.storage||(j.debug.storage[e]={}),j.debug.storage[e][t]=r},j.debug.clear=function(e,t){void 0===e?j.debug.storage={}:e in j.debug.storage&&(void 0===t?delete j.debug.storage[e]:delete j.debug.storage[e][t])},_((function(e){var t=e.exports=j.sha512=j.sha512||{};j.md.sha512=j.md.algorithms.sha512=t;var r=j.sha384=j.sha512.sha384=j.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},j.md.sha384=j.md.algorithms.sha384=r,j.sha512.sha256=j.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},j.md["sha512/256"]=j.md.algorithms["sha512/256"]=j.sha512.sha256,j.sha512.sha224=j.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},j.md["sha512/224"]=j.md.algorithms["sha512/224"]=j.sha512.sha224,t.create=function(e){if(i||(n=String.fromCharCode(128),n+=j.util.fillString(String.fromCharCode(0),128),o=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(a={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],a["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],a["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],a["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],i=!0),void 0===e&&(e="SHA-512"),!(e in a))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=a[e],r=null,c=j.util.createBuffer(),l=new Array(80),u=0;u<80;++u)l[u]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,n=0;n<e;++n)f.fullMessageLength.push(0);for(c=j.util.createBuffer(),r=new Array(t.length),n=0;n<t.length;++n)r[n]=t[n].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=j.util.encodeUtf8(e));var n=e.length;f.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var i=f.fullMessageLength.length-1;i>=0;--i)f.fullMessageLength[i]+=n[1],n[1]=n[0]+(f.fullMessageLength[i]/4294967296>>>0),f.fullMessageLength[i]=f.fullMessageLength[i]>>>0,n[0]=n[1]/4294967296>>>0;return c.putBytes(e),s(r,l,c),(c.read>2048||0===c.length())&&c.compact(),f},f.digest=function(){var t=j.util.createBuffer();t.putBytes(c.bytes());var i,o=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(n.substr(0,f.blockLength-o));for(var a=8*f.fullMessageLength[0],u=0;u<f.fullMessageLength.length-1;++u)a+=(i=8*f.fullMessageLength[u+1])/4294967296>>>0,t.putInt32(a>>>0),a=i>>>0;t.putInt32(a);var d=new Array(r.length);for(u=0;u<r.length;++u)d[u]=r[u].slice(0);s(d,l,t);var p,h=j.util.createBuffer();for(p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4,u=0;u<p;++u)h.putInt32(d[u][0]),u===p-1&&"SHA-512/224"===e||h.putInt32(d[u][1]);return h},f};var n=null,i=!1,o=null,a=null;function s(e,t,r){for(var n,i,a,s,c,l,u,d,f,p,h,m,g,v,y,b,_,C,w,k,S,B,E,I,A,x,T,P,R,D,L,N,O,F=r.length();F>=128;){for(T=0;T<16;++T)t[T][0]=r.getInt32()>>>0,t[T][1]=r.getInt32()>>>0;for(;T<80;++T)n=(((P=(D=t[T-2])[0])>>>19|(R=D[1])<<13)^(R>>>29|P<<3)^P>>>6)>>>0,i=((P<<13|R>>>19)^(R<<3|P>>>29)^(P<<26|R>>>6))>>>0,a=(((P=(N=t[T-15])[0])>>>1|(R=N[1])<<31)^(P>>>8|R<<24)^P>>>7)>>>0,s=((P<<31|R>>>1)^(P<<24|R>>>8)^(P<<25|R>>>7))>>>0,L=t[T-7],O=t[T-16],R=i+L[1]+s+O[1],t[T][0]=n+L[0]+a+O[0]+(R/4294967296>>>0)>>>0,t[T][1]=R>>>0;for(h=e[0][0],m=e[0][1],g=e[1][0],v=e[1][1],y=e[2][0],b=e[2][1],_=e[3][0],C=e[3][1],w=e[4][0],k=e[4][1],S=e[5][0],B=e[5][1],E=e[6][0],I=e[6][1],A=e[7][0],x=e[7][1],T=0;T<80;++T)u=((w>>>14|k<<18)^(w>>>18|k<<14)^(k>>>9|w<<23))>>>0,d=(E^w&(S^E))>>>0,c=((h>>>28|m<<4)^(m>>>2|h<<30)^(m>>>7|h<<25))>>>0,l=((h<<4|m>>>28)^(m<<30|h>>>2)^(m<<25|h>>>7))>>>0,f=(h&g|y&(h^g))>>>0,p=(m&v|b&(m^v))>>>0,R=x+(((w<<18|k>>>14)^(w<<14|k>>>18)^(k<<23|w>>>9))>>>0)+((I^k&(B^I))>>>0)+o[T][1]+t[T][1],n=A+u+d+o[T][0]+t[T][0]+(R/4294967296>>>0)>>>0,i=R>>>0,a=c+f+((R=l+p)/4294967296>>>0)>>>0,s=R>>>0,A=E,x=I,E=S,I=B,S=w,B=k,w=_+n+((R=C+i)/4294967296>>>0)>>>0,k=R>>>0,_=y,C=b,y=g,b=v,g=h,v=m,h=n+a+((R=i+s)/4294967296>>>0)>>>0,m=R>>>0;R=e[0][1]+m,e[0][0]=e[0][0]+h+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+v,e[1][0]=e[1][0]+g+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+b,e[2][0]=e[2][0]+y+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+C,e[3][0]=e[3][0]+_+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+k,e[4][0]=e[4][0]+w+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+B,e[5][0]=e[5][0]+S+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+I,e[6][0]=e[6][0]+E+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+x,e[7][0]=e[7][0]+A+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,F-=128}}}));var lr=j.asn1,ur={privateKeyValidator:{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:lr.Class.UNIVERSAL,type:lr.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},publicKeyValidator:{name:"SubjectPublicKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:lr.Class.UNIVERSAL,type:lr.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},dr=ur.publicKeyValidator,fr=ur.privateKeyValidator;if(void 0===pr)var pr=j.jsbn.BigInteger;var hr=j.util.ByteBuffer,mr="undefined"==typeof Buffer?Uint8Array:Buffer;j.pki=j.pki||{},j.pki.ed25519=j.ed25519=j.ed25519||{};var gr=j.ed25519;function vr(e){var t=e.message;if(t instanceof Uint8Array||t instanceof mr)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new hr(t,r)}else if(!(t instanceof hr))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new mr(t.length()),i=0;i<n.length;++i)n[i]=t.at(i);return n}gr.constants={},gr.constants.PUBLIC_KEY_BYTE_LENGTH=32,gr.constants.PRIVATE_KEY_BYTE_LENGTH=64,gr.constants.SEED_BYTE_LENGTH=32,gr.constants.SIGN_BYTE_LENGTH=64,gr.constants.HASH_BYTE_LENGTH=64,gr.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=j.random.getBytesSync(gr.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==gr.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+gr.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=vr({message:t,encoding:"binary"});for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=new mr(gr.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)n[i]=t[i];return function(e,t){var r,n=[jr(),jr(),jr(),jr()],i=Er(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,Fr(n,i),Pr(e,n),r=0;r<32;++r)t[r+32]=e[r]}(r,n),{publicKey:r,privateKey:n}},gr.privateKeyFromAsn1=function(e){var t={},r=[];if(!j.asn1.validate(e,fr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var i=j.asn1.derToOid(t.privateKeyOid),o=j.oids.EdDSA25519;if(i!==o)throw new Error('Invalid OID "'+i+'"; OID must be "'+o+'".');var a=t.privateKey;return{privateKeyBytes:vr({message:j.asn1.fromDer(a).value,encoding:"binary"})}},gr.publicKeyFromAsn1=function(e){var t={},r=[];if(!j.asn1.validate(e,dr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var i=j.asn1.derToOid(t.publicKeyOid),o=j.oids.EdDSA25519;if(i!==o)throw new Error('Invalid OID "'+i+'"; OID must be "'+o+'".');var a=t.ed25519PublicKey;if(a.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return vr({message:a,encoding:"binary"})},gr.publicKeyFromPrivateKey=function(e){var t=vr({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},gr.sign=function(e){var t=vr(e=e||{}),r=vr({message:e.privateKey,encoding:"binary"});if(r.length===gr.constants.SEED_BYTE_LENGTH)r=gr.generateKeyPair({seed:r}).privateKey;else if(r.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.SEED_BYTE_LENGTH+" or "+gr.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var i,o,a=new Float64Array(64),s=[jr(),jr(),jr(),jr()],c=Er(n,32);for(c[0]&=248,c[31]&=127,c[31]|=64,i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=c[32+i];var l=Er(e.subarray(32),r+32);for(Ar(l),Fr(s,l),Pr(e,s),i=32;i<64;++i)e[i]=n[i];var u=Er(e,r+64);for(Ar(u),i=32;i<64;++i)a[i]=0;for(i=0;i<32;++i)a[i]=l[i];for(i=0;i<32;++i)for(o=0;o<32;o++)a[i+o]+=u[i]*c[o];Ir(e.subarray(32),a)}(n,t,t.length,r);for(var i=new mr(gr.constants.SIGN_BYTE_LENGTH),o=0;o<i.length;++o)i[o]=n[o];return i},gr.verify=function(e){var t=vr(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=vr({message:e.signature,encoding:"binary"});if(r.length!==gr.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+gr.constants.SIGN_BYTE_LENGTH);var n=vr({message:e.publicKey,encoding:"binary"});if(n.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+gr.constants.PUBLIC_KEY_BYTE_LENGTH);var i,o=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length),a=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);for(i=0;i<gr.constants.SIGN_BYTE_LENGTH;++i)o[i]=r[i];for(i=0;i<t.length;++i)o[i+gr.constants.SIGN_BYTE_LENGTH]=t[i];return function(e,t,r,n){var i,o=new mr(32),a=[jr(),jr(),jr(),jr()],s=[jr(),jr(),jr(),jr()];if(r<64)return-1;if(function(e,t){var r=jr(),n=jr(),i=jr(),o=jr(),a=jr(),s=jr(),c=jr();return Mr(e[2],br),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),Hr(i,e[1]),Kr(o,i,_r),qr(i,i,e[2]),zr(o,e[2],o),Hr(a,o),Hr(s,a),Kr(c,s,a),Kr(r,c,i),Kr(r,r,o),function(e,t){var r,n=jr();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)Hr(n,n),1!==r&&Kr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),Kr(r,r,i),Kr(r,r,o),Kr(r,r,o),Kr(e[0],r,o),Hr(n,e[0]),Kr(n,n,o),Dr(n,i)&&Kr(e[0],e[0],Br),Hr(n,e[0]),Kr(n,n,o),Dr(n,i)?-1:(Nr(e[0])===t[31]>>7&&qr(e[0],yr,e[0]),Kr(e[3],e[0],e[1]),0)}(s,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var c=Er(e,r);if(Ar(c),Or(a,s,c),Fr(s,t.subarray(32)),xr(a,s),Pr(o,a),r-=64,Lr(t,0,o,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return r}(a,o,o.length,n)>=0};var yr=jr(),br=jr([1]),_r=jr([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Cr=jr([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),wr=jr([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),kr=jr([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Sr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Br=jr([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Er(e,t){var r=j.md.sha512.create(),n=new hr(e);r.update(n.getBytes(t),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var o=new mr(gr.constants.HASH_BYTE_LENGTH),a=0;a<64;++a)o[a]=i.charCodeAt(a);return o}function Ir(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)t[i]+=r-16*t[n]*Sr[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*Sr[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*Sr[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function Ar(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;Ir(e,t)}function xr(e,t){var r=jr(),n=jr(),i=jr(),o=jr(),a=jr(),s=jr(),c=jr(),l=jr(),u=jr();qr(r,e[1],e[0]),qr(u,t[1],t[0]),Kr(r,r,u),zr(n,e[0],e[1]),zr(u,t[0],t[1]),Kr(n,n,u),Kr(i,e[3],t[3]),Kr(i,i,Cr),Kr(o,e[2],t[2]),zr(o,o,o),qr(a,n,r),qr(s,o,i),zr(c,o,i),zr(l,n,r),Kr(e[0],a,s),Kr(e[1],l,c),Kr(e[2],c,s),Kr(e[3],a,l)}function Tr(e,t,r){for(var n=0;n<4;++n)Ur(e[n],t[n],r)}function Pr(e,t){var r=jr(),n=jr(),i=jr();!function(e,t){var r,n=jr();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)Hr(n,n),2!==r&&4!==r&&Kr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(i,t[2]),Kr(r,t[0],i),Kr(n,t[1],i),Rr(e,n),e[31]^=Nr(r)<<7}function Rr(e,t){var r,n,i,o=jr(),a=jr();for(r=0;r<16;++r)a[r]=t[r];for(Vr(a),Vr(a),Vr(a),n=0;n<2;++n){for(o[0]=a[0]-65517,r=1;r<15;++r)o[r]=a[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=a[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,Ur(a,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function Dr(e,t){var r=new mr(32),n=new mr(32);return Rr(r,e),Rr(n,t),Lr(r,0,n,0)}function Lr(e,t,r,n){return function(e,t,r,n,i){var o,a=0;for(o=0;o<32;++o)a|=e[t+o]^r[n+o];return(1&a-1>>>8)-1}(e,t,r,n)}function Nr(e){var t=new mr(32);return Rr(t,e),1&t[0]}function Or(e,t,r){var n,i;for(Mr(e[0],yr),Mr(e[1],br),Mr(e[2],br),Mr(e[3],yr),i=255;i>=0;--i)Tr(e,t,n=r[i/8|0]>>(7&i)&1),xr(t,e),xr(e,e),Tr(e,t,n)}function Fr(e,t){var r=[jr(),jr(),jr(),jr()];Mr(r[0],wr),Mr(r[1],kr),Mr(r[2],br),Kr(r[3],wr,kr),Or(e,r,t)}function Mr(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function Vr(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function Ur(e,t,r){for(var n,i=~(r-1),o=0;o<16;++o)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function jr(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function zr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function qr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function Hr(e,t){Kr(e,t,t)}function Kr(e,t,r){var n,i,o=0,a=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,h=0,m=0,g=0,v=0,y=0,b=0,_=0,C=0,w=0,k=0,S=0,B=0,E=0,I=0,A=0,x=0,T=0,P=0,R=0,D=0,L=0,N=0,O=r[0],F=r[1],M=r[2],V=r[3],U=r[4],j=r[5],z=r[6],q=r[7],H=r[8],K=r[9],W=r[10],G=r[11],Q=r[12],X=r[13],Y=r[14],$=r[15];o+=(n=t[0])*O,a+=n*F,s+=n*M,c+=n*V,l+=n*U,u+=n*j,d+=n*z,f+=n*q,p+=n*H,h+=n*K,m+=n*W,g+=n*G,v+=n*Q,y+=n*X,b+=n*Y,_+=n*$,a+=(n=t[1])*O,s+=n*F,c+=n*M,l+=n*V,u+=n*U,d+=n*j,f+=n*z,p+=n*q,h+=n*H,m+=n*K,g+=n*W,v+=n*G,y+=n*Q,b+=n*X,_+=n*Y,C+=n*$,s+=(n=t[2])*O,c+=n*F,l+=n*M,u+=n*V,d+=n*U,f+=n*j,p+=n*z,h+=n*q,m+=n*H,g+=n*K,v+=n*W,y+=n*G,b+=n*Q,_+=n*X,C+=n*Y,w+=n*$,c+=(n=t[3])*O,l+=n*F,u+=n*M,d+=n*V,f+=n*U,p+=n*j,h+=n*z,m+=n*q,g+=n*H,v+=n*K,y+=n*W,b+=n*G,_+=n*Q,C+=n*X,w+=n*Y,k+=n*$,l+=(n=t[4])*O,u+=n*F,d+=n*M,f+=n*V,p+=n*U,h+=n*j,m+=n*z,g+=n*q,v+=n*H,y+=n*K,b+=n*W,_+=n*G,C+=n*Q,w+=n*X,k+=n*Y,S+=n*$,u+=(n=t[5])*O,d+=n*F,f+=n*M,p+=n*V,h+=n*U,m+=n*j,g+=n*z,v+=n*q,y+=n*H,b+=n*K,_+=n*W,C+=n*G,w+=n*Q,k+=n*X,S+=n*Y,B+=n*$,d+=(n=t[6])*O,f+=n*F,p+=n*M,h+=n*V,m+=n*U,g+=n*j,v+=n*z,y+=n*q,b+=n*H,_+=n*K,C+=n*W,w+=n*G,k+=n*Q,S+=n*X,B+=n*Y,E+=n*$,f+=(n=t[7])*O,p+=n*F,h+=n*M,m+=n*V,g+=n*U,v+=n*j,y+=n*z,b+=n*q,_+=n*H,C+=n*K,w+=n*W,k+=n*G,S+=n*Q,B+=n*X,E+=n*Y,I+=n*$,p+=(n=t[8])*O,h+=n*F,m+=n*M,g+=n*V,v+=n*U,y+=n*j,b+=n*z,_+=n*q,C+=n*H,w+=n*K,k+=n*W,S+=n*G,B+=n*Q,E+=n*X,I+=n*Y,A+=n*$,h+=(n=t[9])*O,m+=n*F,g+=n*M,v+=n*V,y+=n*U,b+=n*j,_+=n*z,C+=n*q,w+=n*H,k+=n*K,S+=n*W,B+=n*G,E+=n*Q,I+=n*X,A+=n*Y,x+=n*$,m+=(n=t[10])*O,g+=n*F,v+=n*M,y+=n*V,b+=n*U,_+=n*j,C+=n*z,w+=n*q,k+=n*H,S+=n*K,B+=n*W,E+=n*G,I+=n*Q,A+=n*X,x+=n*Y,T+=n*$,g+=(n=t[11])*O,v+=n*F,y+=n*M,b+=n*V,_+=n*U,C+=n*j,w+=n*z,k+=n*q,S+=n*H,B+=n*K,E+=n*W,I+=n*G,A+=n*Q,x+=n*X,T+=n*Y,P+=n*$,v+=(n=t[12])*O,y+=n*F,b+=n*M,_+=n*V,C+=n*U,w+=n*j,k+=n*z,S+=n*q,B+=n*H,E+=n*K,I+=n*W,A+=n*G,x+=n*Q,T+=n*X,P+=n*Y,R+=n*$,y+=(n=t[13])*O,b+=n*F,_+=n*M,C+=n*V,w+=n*U,k+=n*j,S+=n*z,B+=n*q,E+=n*H,I+=n*K,A+=n*W,x+=n*G,T+=n*Q,P+=n*X,R+=n*Y,D+=n*$,b+=(n=t[14])*O,_+=n*F,C+=n*M,w+=n*V,k+=n*U,S+=n*j,B+=n*z,E+=n*q,I+=n*H,A+=n*K,x+=n*W,T+=n*G,P+=n*Q,R+=n*X,D+=n*Y,L+=n*$,_+=(n=t[15])*O,a+=38*(w+=n*M),s+=38*(k+=n*V),c+=38*(S+=n*U),l+=38*(B+=n*j),u+=38*(E+=n*z),d+=38*(I+=n*q),f+=38*(A+=n*H),p+=38*(x+=n*K),h+=38*(T+=n*W),m+=38*(P+=n*G),g+=38*(R+=n*Q),v+=38*(D+=n*X),y+=38*(L+=n*Y),b+=38*(N+=n*$),o=(n=(o+=38*(C+=n*F))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=h,e[10]=m,e[11]=g,e[12]=v,e[13]=y,e[14]=b,e[15]=_}j.kem=j.kem||{};var Wr=j.jsbn.BigInteger;function Gr(e,t,r,n){e.generate=function(e,i){for(var o=new j.util.ByteBuffer,a=Math.ceil(i/n)+r,s=new j.util.ByteBuffer,c=r;c<a;++c){s.putInt32(c),t.start(),t.update(e+s.getBytes());var l=t.digest();o.putBytes(l.getBytes(n))}return o.truncate(o.length()-i),o.getBytes()}}j.kem.rsa={},j.kem.rsa.create=function(e,t){var r=(t=t||{}).prng||j.random;return{encrypt:function(t,n){var i,o=Math.ceil(t.n.bitLength()/8);do{i=new Wr(j.util.bytesToHex(r.getBytesSync(o)),16).mod(t.n)}while(i.compareTo(Wr.ONE)<=0);var a=o-(i=j.util.hexToBytes(i.toString(16))).length;return a>0&&(i=j.util.fillString(String.fromCharCode(0),a)+i),{encapsulation:t.encrypt(i,"NONE"),key:e.generate(i,n)}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}}},j.kem.kdf1=function(e,t){Gr(this,e,0,t||e.digestLength)},j.kem.kdf2=function(e,t){Gr(this,e,1,t||e.digestLength)},j.log=j.log||{},j.log.levels=["none","error","warning","info","debug","verbose","max"];var Qr={},Xr=[],Yr=null;j.log.LEVEL_LOCKED=2,j.log.NO_LEVEL_CHECK=4,j.log.INTERPOLATE=8;for(var $r=0;$r<j.log.levels.length;++$r){var Zr=j.log.levels[$r];Qr[Zr]={index:$r,name:Zr.toUpperCase()}}j.log.logMessage=function(e){for(var t=Qr[e.level].index,r=0;r<Xr.length;++r){var n=Xr[r];n.flags&j.log.NO_LEVEL_CHECK?n.f(e):t<=Qr[n.level].index&&n.f(n,e)}},j.log.prepareStandard=function(e){"standard"in e||(e.standard=Qr[e.level].name+" ["+e.category+"] "+e.message)},j.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=j.util.format.apply(this,t)}},j.log.prepareStandardFull=function(e){"standardFull"in e||(j.log.prepareStandard(e),e.standardFull=e.standard)};var Jr=["error","warning","info","debug","verbose"];for($r=0;$r<Jr.length;++$r)!function(e){j.log[e]=function(t,r){var n=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:e,category:t,message:r,arguments:n};j.log.logMessage(i)}}(Jr[$r]);if(j.log.makeLogger=function(e){var t={flags:0,f:e};return j.log.setLevel(t,"none"),t},j.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&j.log.LEVEL_LOCKED))for(var n=0;n<j.log.levels.length;++n)if(t==j.log.levels[n]){e.level=t,r=!0;break}return r},j.log.lock=function(e,t){void 0===t||t?e.flags|=j.log.LEVEL_LOCKED:e.flags&=~j.log.LEVEL_LOCKED},j.log.addLogger=function(e){Xr.push(e)},"undefined"!=typeof console&&"log"in console){var en;if(console.error&&console.warn&&console.info&&console.debug){var tn={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},rn=function(e,t){j.log.prepareStandard(t);var r=tn[t.level],n=[t.standard];n=n.concat(t.arguments.slice()),r.apply(console,n)};en=j.log.makeLogger(rn)}else rn=function(e,t){j.log.prepareStandardFull(t),console.log(t.standardFull)},en=j.log.makeLogger(rn);j.log.setLevel(en,"debug"),j.log.addLogger(en),Yr=en}else console={log:function(){}};if(null!==Yr){var nn=j.util.getQueryVariables();"console.level"in nn&&j.log.setLevel(Yr,nn["console.level"].slice(-1)[0]),"console.lock"in nn&&"true"==nn["console.lock"].slice(-1)[0]&&j.log.lock(Yr)}j.log.consoleLogger=Yr,_((function(e){var t=j.asn1,r=e.exports=j.pkcs7=j.pkcs7||{};function n(e){var n={},i=[];if(!t.validate(e,r.asn1.recipientInfoValidator,n,i)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=i,o}return{version:n.version.charCodeAt(0),issuer:j.pki.RDNAttributesAsArray(n.issuer),serialNumber:j.util.createBuffer(n.serial).toHex(),encryptedContent:{algorithm:t.derToOid(n.encAlgorithm),parameter:n.encParameter.value,content:n.encKey}}}function i(e){for(var r,n=[],i=0;i<e.length;++i)n.push((r=e[i],t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[j.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,j.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])));return n}function o(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[j.pki.distinguishedNameToAsn1({attributes:e.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,j.util.hexToBytes(e.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&r.value.push(e.authenticatedAttributesAsn1),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var n=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i<e.unauthenticatedAttributes.length;++i){var o=e.unauthenticatedAttributes[i];n.values.push(a(o))}r.value.push(n)}return r}function a(e){var r;if(e.type===j.pki.oids.contentType)r=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.value).getBytes());else if(e.type===j.pki.oids.messageDigest)r=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===j.pki.oids.signingTime){var n=new Date("1950-01-01T00:00:00Z"),i=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"==typeof o){var a=Date.parse(o);o=isNaN(a)?13===o.length?t.utcTimeToDate(o):t.generalizedTimeToDate(o):new Date(a)}r=o>=n&&o<i?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(o)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(o))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[r])])}function s(e,r,n){var i={};if(!t.validate(r,n,i,[])){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw o.errors=o,o}if(t.derToOid(i.contentType)!==j.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(i.encryptedContent){var a="";if(j.util.isArray(i.encryptedContent))for(var s=0;s<i.encryptedContent.length;++s){if(i.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=i.encryptedContent[s].value}else a=i.encryptedContent;e.encryptedContent={algorithm:t.derToOid(i.encAlgorithm),parameter:j.util.createBuffer(i.encParameter.value),content:j.util.createBuffer(a)}}if(i.content){if(a="",j.util.isArray(i.content))for(s=0;s<i.content.length;++s){if(i.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=i.content[s].value}else a=i.content;e.content=j.util.createBuffer(a)}return e.version=i.version.charCodeAt(0),e.rawCapture=i,i}function c(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case j.pki.oids["aes128-CBC"]:case j.pki.oids["aes192-CBC"]:case j.pki.oids["aes256-CBC"]:t=j.aes.createDecryptionCipher(e.encryptedContent.key);break;case j.pki.oids.desCBC:case j.pki.oids["des-EDE3-CBC"]:t=j.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}r.messageFromPem=function(e){var n=j.pem.decode(e)[0];if("PKCS7"!==n.type){var i=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=t.fromDer(n.body);return r.messageFromAsn1(o)},r.messageToPem=function(e,r){var n={type:"PKCS7",body:t.toDer(e.toAsn1()).getBytes()};return j.pem.encode(n,{maxline:r})},r.messageFromAsn1=function(e){var n={},i=[];if(!t.validate(e,r.asn1.contentInfoValidator,n,i)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=i,o}var a,s=t.derToOid(n.contentType);switch(s){case j.pki.oids.envelopedData:a=r.createEnvelopedData();break;case j.pki.oids.encryptedData:a=r.createEncryptedData();break;case j.pki.oids.signedData:a=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return a.fromAsn1(n.content.value[0]),a},r.createSignedData=function(){var e=null;return e={type:j.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(e,t,r.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,i=0;i<n.length;++i)e.certificates.push(j.pki.certificateFromAsn1(n[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(j.pki.certificateToAsn1(e.certificates[n]));var i=[],o=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&o.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),i.length>0&&o.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,i)),o.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),o])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=j.pki.certificateFromPem(i)),r=i.issuer.attributes,n=i.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=j.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||j.pki.oids.sha1;switch(a){case j.pki.oids.sha1:case j.pki.oids.sha256:case j.pki.oids.sha384:case j.pki.oids.sha512:case j.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,l=!1,u=0;u<s.length;++u){var d=s[u];if(c||d.type!==j.pki.oids.contentType){if(l||d.type!==j.pki.oids.messageDigest);else if(l=!0,c)break}else if(c=!0,l)break}if(!c||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:r,serialNumber:n,digestAlgorithm:a,signatureAlgorithm:j.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var n;r=r||{},("object"!=x(e.content)||null===e.contentInfo)&&(e.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(j.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof j.util.ByteBuffer?n=e.content.bytes():"string"==typeof e.content&&(n=j.util.encodeUtf8(e.content)),r.detached?e.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)])))),0!==e.signers.length&&function(r){var n;if(!(n=e.detachedContent?e.detachedContent:(n=e.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var i=t.derToOid(e.contentInfo.value[0].value),s=t.toDer(n);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var l=new Date,u=0;u<e.signers.length;++u){var d=e.signers[u];if(0===d.authenticatedAttributes.length){if(i!==j.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var h=d.authenticatedAttributes[p];h.type===j.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===j.pki.oids.signingTime&&(h.value||(h.value=l)),f.value.push(a(h)),d.authenticatedAttributesAsn1.value.push(a(h))}s=t.toDer(f).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}(e.signers)}(function(){for(var r={},n=0;n<e.signers.length;++n){var i=e.signers[n];(o=i.digestAlgorithm)in r||(r[o]=j.md[j.pki.oids[o]].create()),0===i.authenticatedAttributes.length?i.md=r[o]:i.md=j.md[j.pki.oids[o]].create()}for(var o in e.digestAlgorithmIdentifiers=[],r)e.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(o).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=j.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var e=null;return e={type:j.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:j.pki.oids["aes256-CBC"]},fromAsn1:function(t){s(e,t,r.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),c(e)}}},r.createEnvelopedData=function(){var e=null;return e={type:j.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:j.pki.oids["aes256-CBC"]},fromAsn1:function(t){var i=s(e,t,r.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}(i.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,i(e.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=e.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(j.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes())]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],o=i.issuer;if(i.serialNumber===t.serialNumber&&o.length===r.length){for(var a=!0,s=0;s<r.length;++s)if(o[s].type!==r[s].type||o[s].value!==r[s].value){a=!1;break}if(a)return i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case j.pki.oids.rsaEncryption:case j.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=j.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:j.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var n,i,o;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case j.pki.oids["aes128-CBC"]:n=16,i=16,o=j.aes.createEncryptionCipher;break;case j.pki.oids["aes192-CBC"]:n=24,i=16,o=j.aes.createEncryptionCipher;break;case j.pki.oids["aes256-CBC"]:n=32,i=16,o=j.aes.createEncryptionCipher;break;case j.pki.oids["des-EDE3-CBC"]:n=24,i=8,o=j.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=j.util.createBuffer(j.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=j.util.createBuffer(j.random.getBytes(i));var a=o(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var s=0;s<e.recipients.length;++s){var c=e.recipients[s];if(void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case j.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}}}})),_((function(e){var t=e.exports=j.ssh=j.ssh||{};function r(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=j.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function n(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=j.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}t.privateKeyToPutty=function(e,t,o){var a=""===(t=t||"")?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: ssh-rsa\r\n";s+="Encryption: "+a+"\r\n",s+="Comment: "+(o=o||"")+"\r\n";var c=j.util.createBuffer();n(c,"ssh-rsa"),r(c,e.e),r(c,e.n);var l=j.util.encode64(c.bytes(),64),u=Math.floor(l.length/66)+1;s+="Public-Lines: "+u+"\r\n",s+=l;var d,f=j.util.createBuffer();if(r(f,e.d),r(f,e.p),r(f,e.q),r(f,e.qInv),t){var p=f.length()+16-1;p-=p%16;var h=i(f.bytes());h.truncate(h.length()-p+f.length()),f.putBuffer(h);var m=j.util.createBuffer();m.putBuffer(i("\0\0\0\0",t)),m.putBuffer(i("\0\0\0",t));var g=j.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(j.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var v=g.output;v.truncate(16),d=j.util.encode64(v.bytes(),64)}else d=j.util.encode64(f.bytes(),64);s+="\r\nPrivate-Lines: "+(u=Math.floor(d.length/66)+1)+"\r\n",s+=d;var y=i("putty-private-key-file-mac-key",t),b=j.util.createBuffer();n(b,"ssh-rsa"),n(b,a),n(b,o),b.putInt32(c.length()),b.putBuffer(c),b.putInt32(f.length()),b.putBuffer(f);var _=j.hmac.create();return _.start("sha1",y),_.update(b.bytes()),s+"\r\nPrivate-MAC: "+_.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(e,t){t=t||"";var i=j.util.createBuffer();return n(i,"ssh-rsa"),r(i,e.e),r(i,e.n),"ssh-rsa "+j.util.encode64(i.bytes())+" "+t},t.privateKeyToOpenSSH=function(e,t){return t?j.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):j.pki.privateKeyToPem(e)},t.getPublicKeyFingerprint=function(e,t){var i=(t=t||{}).md||j.md.md5.create(),o=j.util.createBuffer();n(o,"ssh-rsa"),r(o,e.e),r(o,e.n),i.start(),i.update(o.getBytes());var a=i.digest();if("hex"===t.encoding){var s=a.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a}}));var on="forge.task",an={},sn=0;j.debug.set(on,"tasks",an);var cn={};j.debug.set(on,"queues",cn);var ln="ready",un="running",dn="blocked",fn="sleeping",pn="done",hn="error",mn={ready:{}};mn.ready.stop=ln,mn.ready.start=un,mn.ready.cancel=pn,mn.ready.fail=hn,mn.running={},mn.running.stop=ln,mn.running.start=un,mn.running.block=dn,mn.running.unblock=un,mn.running.sleep=fn,mn.running.wakeup=un,mn.running.cancel=pn,mn.running.fail=hn,mn.blocked={},mn.blocked.stop=dn,mn.blocked.start=dn,mn.blocked.block=dn,mn.blocked.unblock=dn,mn.blocked.sleep=dn,mn.blocked.wakeup=dn,mn.blocked.cancel=pn,mn.blocked.fail=hn,mn.sleeping={},mn.sleeping.stop=fn,mn.sleeping.start=fn,mn.sleeping.block=fn,mn.sleeping.unblock=fn,mn.sleeping.sleep=fn,mn.sleeping.wakeup=fn,mn.sleeping.cancel=pn,mn.sleeping.fail=hn,mn.done={},mn.done.stop=pn,mn.done.start=pn,mn.done.block=pn,mn.done.unblock=pn,mn.done.sleep=pn,mn.done.wakeup=pn,mn.done.cancel=pn,mn.done.fail=hn,mn.error={},mn.error.stop=hn,mn.error.start=hn,mn.error.block=hn,mn.error.unblock=hn,mn.error.sleep=hn,mn.error.wakeup=hn,mn.error.cancel=hn,mn.error.fail=hn;var gn=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=ln,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=sn++,an[this.id]=this};gn.prototype.debug=function(e){e=e||"",j.log.debug(on,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",cn)},gn.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new gn({run:t,name:e,parent:this});return r.state=un,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},gn.prototype.parallel=function(e,t){return j.util.isArray(e)&&(t=e,e=this.name),this.next(e,(function(r){var n=r;n.block(t.length);for(var i=function(e,r){j.task.start({type:e,run:function(e){t[r](e)},success:function(e){n.unblock()},failure:function(e){n.unblock()}})},o=0;o<t.length;o++)i(e+"__parallel-"+r.id+"-"+o,o)}))},gn.prototype.stop=function(){this.state=mn[this.state].stop},gn.prototype.start=function(){this.error=!1,this.state=mn[this.state].start,this.state===un&&(this.start=new Date,this.run(this),vn(this,0))},gn.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=mn[this.state].block)},gn.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==pn&&(this.state=un,vn(this,0)),this.blocks},gn.prototype.sleep=function(e){e=void 0===e?0:e,this.state=mn[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=un,vn(t,0)}),e)},gn.prototype.wait=function(e){e.wait(this)},gn.prototype.wakeup=function(){this.state===fn&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=un,vn(this,0))},gn.prototype.cancel=function(){this.state=mn[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},gn.prototype.fail=function(e){if(this.error=!0,yn(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,vn(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;yn(t,!0)}this.failureCallback&&this.failureCallback(this)}};var vn=function e(t,r){var n=r>30||+new Date-t.swapTime>20,i=function(r){if(r++,t.state===un)if(n&&(t.swapTime=+new Date),t.subtasks.length>0){var i=t.subtasks.shift();i.error=t.error,i.swapTime=t.swapTime,i.userData=t.userData,i.run(i),i.error||e(i,r)}else yn(t),t.error||null!==t.parent&&(t.parent.error=t.error,t.parent.swapTime=t.swapTime,t.parent.userData=t.userData,e(t.parent,r))};n?setTimeout(i,0):i(r)},yn=function(e,t){e.state=pn,delete an[e.id],null===e.parent&&(e.type in cn?0===cn[e.type].length?j.log.error(on,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):cn[e.type][0]!==e?j.log.error(on,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(cn[e.type].shift(),0===cn[e.type].length?delete cn[e.type]:cn[e.type][0].start()):j.log.error(on,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};j.task=j.task||{},j.task.start=function(e){var t=new gn({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in cn?cn[e.type].push(t):(cn[t.type]=[t],function(e){e.error=!1,e.state=mn[e.state].start,setTimeout((function(){e.state===un&&(e.swapTime=+new Date,e.run(e),vn(e,0))}),0)}(t))},j.task.cancel=function(e){e in cn&&(cn[e]=[cn[e][0]])},j.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e};var bn=j,_n=function(){function e(e){this.secretKey=e}return e.prototype.encrypt=function(e,t){throw new Error("Method not implemented.")},e.prototype.decrypt=function(e,t){return function(e,t,r){void 0===r&&(r=bn.util.createBuffer(Uint8Array.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer));var n,i,o=bn.cipher.createDecipher("AES-CBC",t);return o.start({iv:r}),o.update(bn.util.createBuffer(bn.util.hexToBytes(e))),i=(n=o.output.data).charCodeAt(n.length-1),n.slice(0,-i)}(e,(r=this.secretKey,n=t.transactionID,""+r.slice(0,16)+n.slice(0,16)));var r,n},e}(),Cn=function(){function e(e,t,n,i){void 0===n&&(n="production"),void 0===i&&(i={supportTransaction:!1,enableEncryption:!1}),this.transactionEnabled=i.supportTransaction||!1,this.encryptionEnabled=i.enableEncryption||!1;var o=O(e,t,n,{headers:i.httpHeaders});this.transactionManager=new U(o),this.encryptionService=new _n(t),this.compareFaceService=new u(o),this.clientSettingsService=new d(o),this.convertPDFService=new v(o),this.ekycPDFService=new y(o),this.readIDCardService=new r(o),this.requestVerifyIDCardService=new p(o),this.requestVerifyPortraitSerivce=new h(o),this.imagesService=new c(o),this.fileService=new l(o),this.verifyFaceLivenessService=new f(o),this.searchFaceService=new g(o),this.detectIDTamperingService=new m(o),this.httpClient=o}return e.prototype.enableTransaction=function(){this.transactionEnabled=!0},e.prototype.disableTransaction=function(){this.transactionEnabled=!1},e.prototype.enableEncryption=function(){this.encryptionEnabled=!0},e.prototype.disableEncryption=function(){this.encryptionEnabled=!1},e.prototype.compareFaces=function(e,t){return this.compareFaceService.request(e,t)},e.prototype.clientSettings=function(e,t){return this.clientSettingsService.request(e,t)},e.prototype.uploadImage=function(e,t){return this.imagesService.request(e,t)},e.prototype.uploadFile=function(e,t){return this.fileService.uploadFile(e,t)},e.prototype.convertPDF=function(e,t){return this.convertPDFService.request(e,t)},e.prototype.ekycPDF=function(e,t){return this.ekycPDFService.request(e,t)},e.prototype.readIDCard=function(e,t){return this.readIDCardService.request(e,t)},e.prototype.requestVerifyIDCard=function(e,t){return this.requestVerifyIDCardService.request(e,t)},e.prototype.requestVerifyPortrait=function(e,t){return this.requestVerifyPortraitSerivce.request(e,t)},e.prototype.verifyFaceLiveness=function(e,t){return this.verifyFaceLivenessService.request(e,t)},e.prototype.searchFaces=function(e,t){return this.searchFaceService.request(e,t)},e.prototype.deleteFaces=function(e,t){return this.searchFaceService.deleteFaces(e,t)},e.prototype.indexFaces=function(e,t){return this.searchFaceService.indexFaces(e,t)},e.prototype.detectFaces=function(e,t){return this.searchFaceService.detectFaces(e,t)},e.prototype.downloadFaceImage=function(e){return this.searchFaceService.downloadFaceImage(e)},e.prototype.downloadImage=function(e){return this.imagesService.download(e)},e.prototype.updateMetadata=function(e,t){return this.imagesService.updateMetadata(e,t)},e.prototype.detectIDTampering=function(e,t){return this.detectIDTamperingService.request(e,t)},i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"compareFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"convertPDF",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"readIDCard",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"requestVerifyIDCard",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"requestVerifyPortrait",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"verifyFaceLiveness",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"searchFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"deleteFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"indexFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"detectFaces",null),i([M({headerIndex:1}),V(),o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",Promise)],e.prototype,"detectIDTampering",null),e}();e.ReadIDCard=r,e.UploadImage=c,e.UploadFile=l,e.CompareFaces=u,e.ClientSettings=d,e.VerifyFaceLiveness=f,e.RequestVerifyIDCard=p,e.RequestVerifyPortrait=h,e.DetectIDTampering=m,e.SearchFaces=g,e.ConvertPDF=v,e.EkycPDF=y,e.HttpClient=A,e.MockClient=T,e.TVAuthorizer=L,e.createHelpers=function(e,t,r){void 0===r&&(r="production");var n=new L(e,t),i=function(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":default:return"https://vn-vision.trustingsocial.com/api"}}(r);return new A({authorizer:n,domain:i})},e.createHttpClient=O,e.SimpleTrustVisionAPI=F,e.default=Cn,Object.defineProperty(e,"__esModule",{value:!0})}(t,hn)}))),gn=new Uint8Array(16);function vn(){if(!fn&&!(fn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fn(gn)}var yn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function bn(e){return"string"==typeof e&&yn.test(e)}for(var _n=[],Cn=0;Cn<256;++Cn)_n.push((Cn+256).toString(16).substr(1));function wn(e,t,r){var n=(e=e||{}).random||(e.rng||vn)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(_n[e[t+0]]+_n[e[t+1]]+_n[e[t+2]]+_n[e[t+3]]+"-"+_n[e[t+4]]+_n[e[t+5]]+"-"+_n[e[t+6]]+_n[e[t+7]]+"-"+_n[e[t+8]]+_n[e[t+9]]+"-"+_n[e[t+10]]+_n[e[t+11]]+_n[e[t+12]]+_n[e[t+13]]+_n[e[t+14]]+_n[e[t+15]]).toLowerCase();if(!bn(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var kn=function(e){return Cr(e,5)},Sn=ye((function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",c="model",l="name",u="type",d="vendor",f="version",p="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",b="embedded",_="Amazon",C="Apple",w="ASUS",k="BlackBerry",S="Google",B="Huawei",E="LG",I="Microsoft",A="Motorola",T="Samsung",P="Sharp",R="Sony",D="Xiaomi",L="Zebra",N="Facebook",O="Chromium OS",F="Mac OS",M=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},V=function(e,t){return x(e)===s&&-1!==U(t).indexOf(U(e))},U=function(e){return e.toLowerCase()},j=function(e,t){if(x(e)===s)return e=e.replace(/^\s\s*/,""),x(t)===o?e:e.substring(0,500)},z=function(e,t){for(var r,o,s,c,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!l&&f[r];)if(l=f[r++].exec(e))for(s=0;s<p.length;s++)u=l[++o],x(c=p[s])===a&&c.length>0?2===c.length?x(c[1])==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?x(c[1])!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;d+=2}},q=function(e,t){for(var r in t)if(x(t[r])===a&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(V(t[r][i],e))return"?"===r?n:r}else if(V(t[r],e))return"?"===r?n:r;return e},H={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,f],[/opios[\/ ]+([\w\.]+)/i],[f,[l,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[f,[l,"Opera"]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[l,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[l,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[l,"Smart Lenovo Browser"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure Browser"],f],[/\bfocus\/([\w\.]+)/i],[f,[l,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[f,[l,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[l,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[l,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[f,[l,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 Browser"]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 Browser"],f],[/samsungbrowser\/([\w\.]+)/i],[f,[l,"Samsung Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[l,f],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,N],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[l,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,"Chrome WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[l,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[f,q,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[l,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[l,f],[/(cobalt)\/([\w\.]+)/i],[l,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,U]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",U]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,U]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[d,T],[u,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,T],[u,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[c,[d,C],[u,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,C],[u,g]],[/(macintosh);/i],[c,[d,C]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,P],[u,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,B],[u,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[d,B],[u,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,D],[u,m]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,D],[u,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[u,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[u,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[u,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[d,A],[u,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,A],[u,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,E],[u,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,E],[u,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[u,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[u,m]],[/(pixel c)\b/i],[c,[d,S],[u,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,S],[u,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[d,R],[u,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,R],[u,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[u,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,_],[u,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,_],[u,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[u,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,k],[u,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,w],[u,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,w],[u,m]],[/(nexus 9)/i],[c,[d,"HTC"],[u,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[u,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[u,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[u,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[c,[d,"Ulefone"],[u,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[u,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,c,[u,g]],[/(surface duo)/i],[c,[d,I],[u,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[u,m]],[/(u304aa)/i],[c,[d,"AT&T"],[u,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[u,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[u,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[u,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[u,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[u,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[u,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[u,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[u,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[u,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[u,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[u,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[u,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[u,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[u,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[u,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[u,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[u,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[u,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[u,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[u,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[u,g]],[/(sprint) (\w+)/i],[d,c,[u,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,I],[u,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,L],[u,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,L],[u,m]],[/smart-tv.+(samsung)/i],[d,[u,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,T],[u,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,E],[u,v]],[/(apple) ?tv/i],[d,[c,"Apple TV"],[u,v]],[/crkey/i],[[c,"Chromecast"],[d,S],[u,v]],[/droid.+aft(\w+)( bui|\))/i],[c,[d,_],[u,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[d,P],[u,v]],[/(bravia[\w ]+)( bui|\))/i],[c,[d,R],[u,v]],[/(mitv-\w{5}) bui/i],[c,[d,D],[u,v]],[/Hbbtv.*(technisat) (.*);/i],[d,c,[u,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,j],[c,j],[u,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[u,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[u,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[u,h]],[/(playstation [345portablevi]+)/i],[c,[d,R],[u,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,I],[u,h]],[/((pebble))app/i],[d,c,[u,y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[c,[d,C],[u,y]],[/droid.+; (glass) \d/i],[c,[d,S],[u,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,L],[u,y]],[/(quest( 2| pro)?)/i],[c,[d,N],[u,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[u,b]],[/(aeobc)\b/i],[c,[d,_],[u,b]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[c,[u,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[u,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[u,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[u,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[l,[f,q,H]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,q,H],[l,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,F],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,f],[/\(bb(10);/i],[f,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[l,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[l,"Chromecast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,O],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,f],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,f]]},W=function e(t,c){if(x(t)===a&&(c=t,t=n),!(this instanceof e))return new e(t,c).getResult();var l=x(r)!==o&&r.navigator?r.navigator:n,u=t||(l&&l.userAgent?l.userAgent:""),d=l&&l.userAgentData?l.userAgentData:n,f=c?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(K,c):K,p=l&&l.userAgent==u;return this.getBrowser=function(){var e={};return e.name=n,e.version=n,z.call(e,u,f.browser),e.major=function(e){return x(e)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),p&&l&&l.brave&&x(l.brave.isBrave)==i&&(e.name="Brave"),e},this.getCPU=function(){var e={};return e.architecture=n,z.call(e,u,f.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,z.call(e,u,f.device),p&&!e.type&&d&&d.mobile&&(e.type=m),p&&"Macintosh"==e.model&&l&&x(l.standalone)!==o&&l.maxTouchPoints&&l.maxTouchPoints>2&&(e.model="iPad",e.type=g),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,z.call(e,u,f.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,z.call(e,u,f.os),p&&!e.name&&d&&"Unknown"!=d.platform&&(e.name=d.platform.replace(/chrome os/i,O).replace(/macos/i,F)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return u},this.setUA=function(e){return u=x(e)===s&&e.length>500?j(e,500):e,this},this.setUA(u),this};W.VERSION="1.0.37",W.BROWSER=M([l,f,"major"]),W.CPU=M([p]),W.DEVICE=M([c,d,u,h,m,v,g,y,b]),W.ENGINE=W.OS=M([l,f]),e.exports&&(t=e.exports=W),t.UAParser=W;var G=x(r)!==o&&(r.jQuery||r.Zepto);if(G&&!G.ua){var Q=new W;G.ua=Q.getResult(),G.ua.get=function(){return Q.getUA()},G.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==("undefined"==typeof window?"undefined":x(window))?window:ve)})),Bn=ye((function(e,r){Object.defineProperty(r,"__esModule",{value:!0});var n,i=(n=t)&&"object"==x(n)&&"default"in n?n.default:n,o=new Sn,a=o.getBrowser(),s=o.getCPU(),c=o.getDevice(),l=o.getEngine(),u=o.getOS(),d=o.getUA(),f=function(e){return o.setUA(e)},p=function(e){if(e){var t=new Sn(e);return{UA:t,browser:t.getBrowser(),cpu:t.getCPU(),device:t.getDevice(),engine:t.getEngine(),os:t.getOS(),ua:t.getUA(),setUserAgent:function(e){return t.setUA(e)}}}console.error("No userAgent string was provided")},h=Object.freeze({ClientUAInstance:o,browser:a,cpu:s,device:c,engine:l,os:u,ua:d,setUa:f,parseUserAgent:p});function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){return(g="function"==typeof Symbol&&"symbol"==x(Symbol.iterator)?function(e){return x(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":x(e)})(e)}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var S="mobile",B="tablet",E="smarttv",I="console",A="wearable",T="embedded",P=void 0,R={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},D={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},L={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";return e||t},O=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},F=function(e){var t=O();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},M=function(e,t,r,n){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){v(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{vendor:N(t.vendor),model:N(t.model),os:N(r.name),osVersion:N(r.version),ua:N(n)})},V=function(e){return e.type===S},U=function(e){return e.type===B},j=function(e){var t=e.type;return t===S||t===B},z=function(e){return e.type===E},q=function(e){return e.type===P},H=function(e){return e.type===A},K=function(e){return e.type===I},W=function(e){return e.type===T},G=function(e){var t=e.vendor;return N(t)},Q=function(e){var t=e.model;return N(t)},X=function(e){var t=e.type;return N(t,"browser")},Y=function(e){return e.name===D.Android},$=function(e){return e.name===D.Windows},Z=function(e){return e.name===D.MAC_OS},J=function(e){return e.name===D.WindowsPhone},ee=function(e){return e.name===D.IOS},te=function(e){var t=e.version;return N(t)},re=function(e){var t=e.name;return N(t)},ne=function(e){return e.name===R.Chrome},ie=function(e){return e.name===R.Firefox},oe=function(e){return e.name===R.Chromium},ae=function(e){return e.name===R.Edge},se=function(e){return e.name===R.Yandex},ce=function(e){var t=e.name;return t===R.Safari||t===R.MobileSafari},le=function(e){return e.name===R.MobileSafari},ue=function(e){return e.name===R.Opera},de=function(e){var t=e.name;return t===R.InternetExplorer||t===R.Ie},fe=function(e){return e.name===R.MIUI},pe=function(e){return e.name===R.SamsungBrowser},he=function(e){var t=e.version;return N(t)},me=function(e){var t=e.major;return N(t)},ge=function(e){var t=e.name;return N(t)},ve=function(e){var t=e.name;return N(t)},ye=function(e){var t=e.version;return N(t)},be=function(){var e=O(),t=e&&e.userAgent&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)},_e=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},Ce=function(){var e=O();return e&&(/iPad|iPhone|iPod/.test(e.platform)||"MacIntel"===e.platform&&e.maxTouchPoints>1)&&!window.MSStream},we=function(){return F("iPad")},ke=function(){return F("iPhone")},Se=function(){return F("iPod")},Be=function(e){return N(e)};function Ee(e){var t=e||h,r=t.device,n=t.browser,i=t.os,o=t.engine,a=t.ua;return{isSmartTV:z(r),isConsole:K(r),isWearable:H(r),isEmbedded:W(r),isMobileSafari:le(n)||we(),isChromium:oe(n),isMobile:j(r)||we(),isMobileOnly:V(r),isTablet:U(r)||we(),isBrowser:q(r),isDesktop:q(r),isAndroid:Y(i),isWinPhone:J(i),isIOS:ee(i)||we(),isChrome:ne(n),isFirefox:ie(n),isSafari:ce(n),isOpera:ue(n),isIE:de(n),osVersion:te(i),osName:re(i),fullBrowserVersion:he(n),browserVersion:me(n),browserName:ge(n),mobileVendor:G(r),mobileModel:Q(r),engineName:ve(o),engineVersion:ye(o),getUA:Be(a),isEdge:ae(n)||_e(a),isYandex:se(n),deviceType:X(r),isIOS13:Ce(),isIPad13:we(),isIPhone13:ke(),isIPod13:Se(),isElectron:be(),isEdgeChromium:_e(a),isLegacyEdge:ae(n)&&!_e(a),isWindows:$(i),isMacOs:Z(i),isMIUI:fe(n),isSamsungBrowser:pe(n)}}var Ie=z(c),Ae=K(c),xe=H(c),Te=W(c),Pe=le(a)||we(),Re=oe(a),De=j(c)||we(),Le=V(c),Ne=U(c)||we(),Oe=q(c),Fe=q(c),Me=Y(u),Ve=J(u),Ue=ee(u)||we(),je=ne(a),ze=ie(a),qe=ce(a),He=ue(a),Ke=de(a),We=te(u),Ge=re(u),Qe=he(a),Xe=me(a),Ye=ge(a),$e=G(c),Ze=Q(c),Je=ve(l),et=ye(l),tt=Be(d),rt=ae(a)||_e(d),nt=se(a),it=X(c),ot=Ce(),at=we(),st=ke(),ct=Se(),lt=be(),ut=_e(d),dt=ae(a)&&!_e(d),ft=$(u),pt=Z(u),ht=fe(a),mt=pe(a);function gt(e){var t=e||window.navigator.userAgent;return p(t)}r.AndroidView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Me?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.BrowserTypes=R,r.BrowserView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Oe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.ConsoleView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ae?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.CustomView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,e.condition),a=C(e,["renderWithFragment","children","viewClassName","style","condition"]);return o?r?i.createElement(t.Fragment,null,n):i.createElement("div",a,n):null},r.IEView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ke?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.IOSView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ue?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileOnlyView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,C(e,["renderWithFragment","children","viewClassName","style"]));return Le?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return De?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.OsTypes=D,r.SmartTVView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ie?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.TabletView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ne?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WearableView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return xe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WinPhoneView=function(e){var r=e.renderWithFragment,n=e.children,o=C(e,["renderWithFragment","children"]);return Ve?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.browserName=Ye,r.browserVersion=Xe,r.deviceDetect=function(e){var t=e?p(e):h,r=t.device,n=t.browser,i=t.engine,o=t.os,a=t.ua,s=function(e){switch(e){case S:return{isMobile:!0};case B:return{isTablet:!0};case E:return{isSmartTV:!0};case I:return{isConsole:!0};case A:return{isWearable:!0};case P:return{isBrowser:!0};case T:return{isEmbedded:!0};default:return L}}(r.type),c=s.isBrowser,l=s.isMobile,u=s.isTablet,d=s.isSmartTV,f=s.isConsole,m=s.isWearable,g=s.isEmbedded;return c?function(e,t,r,n,i){return{isBrowser:e,browserMajorVersion:N(t.major),browserFullVersion:N(t.version),browserName:N(t.name),engineName:N(r.name),engineVersion:N(r.version),osName:N(n.name),osVersion:N(n.version),userAgent:N(i)}}(c,n,i,o,a):d?function(e,t,r,n){return{isSmartTV:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(n)}}(d,i,o,a):f?function(e,t,r,n){return{isConsole:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(n)}}(f,i,o,a):l||u?M(s,r,o,a):m?function(e,t,r,n){return{isWearable:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(n)}}(m,i,o,a):g?function(e,t,r,n,i){return{isEmbedded:e,vendor:N(t.vendor),model:N(t.model),engineName:N(r.name),engineVersion:N(r.version),osName:N(n.name),osVersion:N(n.version),userAgent:N(i)}}(g,r,i,o,a):void 0},r.deviceType=it,r.engineName=Je,r.engineVersion=et,r.fullBrowserVersion=Qe,r.getSelectorsByUserAgent=function(e){if(e&&"string"==typeof e){var t=p(e);return Ee({device:t.device,browser:t.browser,os:t.os,engine:t.engine,ua:t.ua})}console.error("No valid user agent string was provided")},r.getUA=tt,r.isAndroid=Me,r.isBrowser=Oe,r.isChrome=je,r.isChromium=Re,r.isConsole=Ae,r.isDesktop=Fe,r.isEdge=rt,r.isEdgeChromium=ut,r.isElectron=lt,r.isEmbedded=Te,r.isFirefox=ze,r.isIE=Ke,r.isIOS=Ue,r.isIOS13=ot,r.isIPad13=at,r.isIPhone13=st,r.isIPod13=ct,r.isLegacyEdge=dt,r.isMIUI=ht,r.isMacOs=pt,r.isMobile=De,r.isMobileOnly=Le,r.isMobileSafari=Pe,r.isOpera=He,r.isSafari=qe,r.isSamsungBrowser=mt,r.isSmartTV=Ie,r.isTablet=Ne,r.isWearable=xe,r.isWinPhone=Ve,r.isWindows=ft,r.isYandex=nt,r.mobileModel=Ze,r.mobileVendor=$e,r.osName=Ge,r.osVersion=We,r.parseUserAgent=p,r.setUserAgent=function(e){return f(e)},r.useDeviceData=gt,r.useDeviceSelectors=function(e){var t=gt(e||window.navigator.userAgent);return[Ee(t),t]},r.useMobileOrientation=function(){var e=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.useState((function(){var e=window.innerWidth>window.innerHeight?90:0;return{isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"}})),2),r=e[0],n=e[1],i=t.useCallback((function(){var e=window.innerWidth>window.innerHeight?90:0,t={isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"};r.orientation!==t.orientation&&n(t)}),[r.orientation]);return t.useEffect((function(){return void 0!==("undefined"==typeof window?"undefined":g(window))&&De&&(i(),window.addEventListener("load",i,!1),window.addEventListener("resize",i,!1)),function(){window.removeEventListener("resize",i,!1),window.removeEventListener("load",i,!1)}}),[i]),r},r.withOrientationChange=function(e){return function(t){function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(e,t){if(t&&("object"==x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return w(e)}(this,b(r).call(this,e))).isEventListenerAdded=!1,t.handleOrientationChange=t.handleOrientationChange.bind(w(t)),t.onOrientationChange=t.onOrientationChange.bind(w(t)),t.onPageLoad=t.onPageLoad.bind(w(t)),t.state={isLandscape:!1,isPortrait:!1},t}var n;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}(r,t),(n=[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var e=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:0===e,isLandscape:90===e})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){void 0!==("undefined"==typeof window?"undefined":g(window))&&De&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return i.createElement(e,y({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,n),r}(i.Component)}}));function En(){return"5.24.3"}function In(){return{"X-TV-Device-Model":"".concat(Bn.browserName," ").concat(Bn.browserVersion),"X-TV-OS-Version":"".concat(Bn.osName," ").concat(Bn.osVersion),"X-TV-OS-Platform":Bn.isMobile?"".concat(Bn.osName.toLowerCase(),"_web"):"web","X-TV-SDK-Version":"5.24.3"}}function An(){return"none"!==Bn.mobileVendor?Bn.mobileVendor:null}function xn(){return"none"!==Bn.mobileModel?Bn.mobileModel:null}var Tn=Object.freeze({__proto__:null,getUAMetadata:In,getManufacturer:An,getDeviceName:xn});function Pn(e){return e<10?"0".concat(e):e}function Rn(e){return"".concat(e.getFullYear(),"-").concat(Pn(e.getMonth()+1),"-").concat(Pn(e.getDate()),"T").concat(Pn(e.getHours()),":").concat(Pn(e.getMinutes()),":").concat(Pn(e.getSeconds())).concat(function(e){if(0===e)return"Z";var t=e>0?"-":"+";return e=Math.abs(e),"".concat(t+Pn(Math.floor(e/60)),":").concat(Pn(e%60))}(e.getTimezoneOffset()))}var Dn=Object.freeze({__proto__:null,rfc3339:Rn});function Ln(e,t){window.localStorage&&window.JSON&&t&&localStorage.setItem(t,JSON.stringify(e))}function Nn(e){if(window.localStorage&&window.JSON&&e){var t=localStorage.getItem(e);if(t)return JSON.parse(t)}}var On=Object.freeze({__proto__:null,storeData:Ln,getData:Nn,removeData:function(e){window.localStorage&&window.JSON&&e&&localStorage.removeItem(e)}}),Fn=ye((function(e,t){var r;e.exports=r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==ve&&ve.crypto&&(r=ve.crypto),!r)try{r=hn}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},a=o.lib={},s=a.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=o.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},f=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*l,o);if(l){for(var d=0;d<l;d+=a)this._doProcessBlock(i,d);r=i.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(a.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}}),o.algo={});return o}(Math)})),Mn=(ye((function(e,t){var r,n,i,o,a,s;e.exports=(n=(r=s=Fn).lib,i=n.Base,o=n.WordArray,(a=r.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),s)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.WordArray,n=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var o=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var a=i(t[o>>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64url={stringify:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a<n;a+=3)for(var s=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c<n;c++)o.push(i.charAt(s>>>6*(3-c)&63));var l=i.charAt(64);if(l)for(;o.length%4;)o.push(l);return o.join("")},parse:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<i.length;a++)o[i.charCodeAt(a)]=a}var s=i.charAt(64);if(s){var c=e.indexOf(s);-1!==c&&(r=c)}return n(e,r,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),r.enc.Base64url)})),ye((function(e,t){var r;e.exports=(r=Fn,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],g=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],_=e[t+9],C=e[t+10],w=e[t+11],k=e[t+12],S=e[t+13],B=e[t+14],E=e[t+15],I=o[0],A=o[1],x=o[2],T=o[3];I=l(I,A,x,T,a,7,s[0]),T=l(T,I,A,x,c,12,s[1]),x=l(x,T,I,A,p,17,s[2]),A=l(A,x,T,I,h,22,s[3]),I=l(I,A,x,T,m,7,s[4]),T=l(T,I,A,x,g,12,s[5]),x=l(x,T,I,A,v,17,s[6]),A=l(A,x,T,I,y,22,s[7]),I=l(I,A,x,T,b,7,s[8]),T=l(T,I,A,x,_,12,s[9]),x=l(x,T,I,A,C,17,s[10]),A=l(A,x,T,I,w,22,s[11]),I=l(I,A,x,T,k,7,s[12]),T=l(T,I,A,x,S,12,s[13]),x=l(x,T,I,A,B,17,s[14]),I=u(I,A=l(A,x,T,I,E,22,s[15]),x,T,c,5,s[16]),T=u(T,I,A,x,v,9,s[17]),x=u(x,T,I,A,w,14,s[18]),A=u(A,x,T,I,a,20,s[19]),I=u(I,A,x,T,g,5,s[20]),T=u(T,I,A,x,C,9,s[21]),x=u(x,T,I,A,E,14,s[22]),A=u(A,x,T,I,m,20,s[23]),I=u(I,A,x,T,_,5,s[24]),T=u(T,I,A,x,B,9,s[25]),x=u(x,T,I,A,h,14,s[26]),A=u(A,x,T,I,b,20,s[27]),I=u(I,A,x,T,S,5,s[28]),T=u(T,I,A,x,p,9,s[29]),x=u(x,T,I,A,y,14,s[30]),I=d(I,A=u(A,x,T,I,k,20,s[31]),x,T,g,4,s[32]),T=d(T,I,A,x,b,11,s[33]),x=d(x,T,I,A,w,16,s[34]),A=d(A,x,T,I,B,23,s[35]),I=d(I,A,x,T,c,4,s[36]),T=d(T,I,A,x,m,11,s[37]),x=d(x,T,I,A,y,16,s[38]),A=d(A,x,T,I,C,23,s[39]),I=d(I,A,x,T,S,4,s[40]),T=d(T,I,A,x,a,11,s[41]),x=d(x,T,I,A,h,16,s[42]),A=d(A,x,T,I,v,23,s[43]),I=d(I,A,x,T,_,4,s[44]),T=d(T,I,A,x,k,11,s[45]),x=d(x,T,I,A,E,16,s[46]),I=f(I,A=d(A,x,T,I,p,23,s[47]),x,T,a,6,s[48]),T=f(T,I,A,x,y,10,s[49]),x=f(x,T,I,A,B,15,s[50]),A=f(A,x,T,I,g,21,s[51]),I=f(I,A,x,T,k,6,s[52]),T=f(T,I,A,x,h,10,s[53]),x=f(x,T,I,A,C,15,s[54]),A=f(A,x,T,I,c,21,s[55]),I=f(I,A,x,T,b,6,s[56]),T=f(T,I,A,x,E,10,s[57]),x=f(x,T,I,A,v,15,s[58]),A=f(A,x,T,I,S,21,s[59]),I=f(I,A,x,T,m,6,s[60]),T=f(T,I,A,x,w,10,s[61]),x=f(x,T,I,A,p,15,s[62]),A=f(A,x,T,I,_,21,s[63]),o[0]=o[0]+I|0,o[1]=o[1]+A|0,o[2]=o[2]+x|0,o[3]=o[3]+T|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<<o|s>>>32-o)+t}function u(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<<o|s>>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<<o|s>>>32-o)+t}function f(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<<o|s>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),r.MD5)})),ye((function(e,t){var r,n,i,o,a,s,c,l;e.exports=(n=(r=l=Fn).lib,i=n.WordArray,o=n.Hasher,a=r.algo,s=[],c=a.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+s[l];d+=l<20?1518500249+(i&o|~i&a):l<40?1859775393+(i^o^a):l<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,c=a,a=o,o=i<<30|i>>>2,i=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=o._createHelper(c),r.HmacSHA1=o._createHmacHelper(c),l.SHA1)})),ye((function(e,t){var r;e.exports=(r=Fn,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var l=[],u=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=a+_|0,a=o,o=i,i=n,n=_+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(u),t.HmacSHA256=o._createHmacHelper(u)}(Math),r.SHA256)})),ye((function(e,t){var r,n,i,o,a,s;e.exports=(n=(r=s=Fn).lib.WordArray,i=r.algo,o=i.SHA256,a=i.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=o._createHelper(a),r.HmacSHA224=o._createHmacHelper(a),s.SHA224)})),ye((function(e,t){var r;e.exports=(r=Fn,function(){var e=r,t=e.lib.Hasher,n=e.x64,i=n.Word,o=n.WordArray,a=e.algo;function s(){return i.create.apply(i,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=s()}();var u=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=n.high,h=n.low,m=i.high,g=i.low,v=o.high,y=o.low,b=a.high,_=a.low,C=s.high,w=s.low,k=u.high,S=u.low,B=d.high,E=d.low,I=f.high,A=f.low,x=p,T=h,P=m,R=g,D=v,L=y,N=b,O=_,F=C,M=w,V=k,U=S,j=B,z=E,q=I,H=A,K=0;K<80;K++){var W,G,Q=l[K];if(K<16)G=Q.high=0|e[t+2*K],W=Q.low=0|e[t+2*K+1];else{var X=l[K-15],Y=X.high,$=X.low,Z=(Y>>>1|$<<31)^(Y>>>8|$<<24)^Y>>>7,J=($>>>1|Y<<31)^($>>>8|Y<<24)^($>>>7|Y<<25),ee=l[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=l[K-7],ae=oe.high,se=oe.low,ce=l[K-16],le=ce.high,ue=ce.low;G=(G=(G=Z+ae+((W=J+se)>>>0<J>>>0?1:0))+ne+((W+=ie)>>>0<ie>>>0?1:0))+le+((W+=ue)>>>0<ue>>>0?1:0),Q.high=G,Q.low=W}var de,fe=F&V^~F&j,pe=M&U^~M&z,he=x&P^x&D^P&D,me=T&R^T&L^R&L,ge=(x>>>28|T<<4)^(x<<30|T>>>2)^(x<<25|T>>>7),ve=(T>>>28|x<<4)^(T<<30|x>>>2)^(T<<25|x>>>7),ye=(F>>>14|M<<18)^(F>>>18|M<<14)^(F<<23|M>>>9),be=(M>>>14|F<<18)^(M>>>18|F<<14)^(M<<23|F>>>9),_e=c[K],Ce=_e.high,we=_e.low,ke=q+ye+((de=H+be)>>>0<H>>>0?1:0),Se=ve+me;q=j,H=z,j=V,z=U,V=F,U=M,F=N+(ke=(ke=(ke=ke+fe+((de+=pe)>>>0<pe>>>0?1:0))+Ce+((de+=we)>>>0<we>>>0?1:0))+G+((de+=W)>>>0<W>>>0?1:0))+((M=O+de|0)>>>0<O>>>0?1:0)|0,N=D,O=L,D=P,L=R,P=x,R=T,x=ke+(ge+he+(Se>>>0<ve>>>0?1:0))+((T=de+Se|0)>>>0<de>>>0?1:0)|0}h=n.low=h+T,n.high=p+x+(h>>>0<T>>>0?1:0),g=i.low=g+R,i.high=m+P+(g>>>0<R>>>0?1:0),y=o.low=y+L,o.high=v+D+(y>>>0<L>>>0?1:0),_=a.low=_+O,a.high=b+N+(_>>>0<O>>>0?1:0),w=s.low=w+M,s.high=C+F+(w>>>0<M>>>0?1:0),S=u.low=S+U,u.high=k+V+(S>>>0<U>>>0?1:0),E=d.low=E+z,d.high=B+j+(E>>>0<z>>>0?1:0),A=f.low=A+H,f.high=I+q+(A>>>0<H>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(u),e.HmacSHA512=t._createHmacHelper(u)}(),r.SHA512)})),ye((function(e,t){var r,n,i,o,a,s,c,l;e.exports=(n=(r=l=Fn).x64,i=n.Word,o=n.WordArray,a=r.algo,s=a.SHA512,c=a.SHA384=s.extend({_doReset:function(){this._hash=new o.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(c),r.HmacSHA384=s._createHmacHelper(c),l.SHA384)})),ye((function(e,t){var r;e.exports=(r=Fn,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.x64.Word,s=t.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var s=0,d=0,f=0;f<7;f++){if(1&i){var p=(1<<f)-1;p<32?d^=1<<p:s^=1<<p-32}128&i?i=i<<1^113:i<<=1}u[o]=a.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=a.create()}();var f=s.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var o=e[t+2*i],a=e[t+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(A=r[i]).high^=a,A.low^=o}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,h=0,m=0;m<5;m++)p^=(A=r[f+5*m]).high,h^=A.low;var g=d[f];g.high=p,g.low=h}for(f=0;f<5;f++){var v=d[(f+4)%5],y=d[(f+1)%5],b=y.high,_=y.low;for(p=v.high^(b<<1|_>>>31),h=v.low^(_<<1|b>>>31),m=0;m<5;m++)(A=r[f+5*m]).high^=p,A.low^=h}for(var C=1;C<25;C++){var w=(A=r[C]).high,k=A.low,S=c[C];S<32?(p=w<<S|k>>>32-S,h=k<<S|w>>>32-S):(p=k<<S-32|w>>>64-S,h=w<<S-32|k>>>64-S);var B=d[l[C]];B.high=p,B.low=h}var E=d[0],I=r[0];for(E.high=I.high,E.low=I.low,f=0;f<5;f++)for(m=0;m<5;m++){var A=r[C=f+5*m],x=d[C],T=d[(f+1)%5+5*m],P=d[(f+2)%5+5*m];A.high=x.high^~T.high&P.high,A.low=x.low^~T.low&P.low}A=r[0];var R=u[s];A.high^=R.high,A.low^=R.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,l=[],u=0;u<c;u++){var d=a[u],f=d.high,p=d.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),l.push(p),l.push(f)}return new i.init(l,s)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(f),t.HmacSHA3=o._createHmacHelper(f)}(Math),r.SHA3)})),ye((function(e,t){var r;e.exports=(r=Fn,
|
|
16
16
|
/** @preserve
|
|
17
17
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=i.create([0,1,2,
|
|
|
44
44
|
* @since jsrsasign 2.1
|
|
45
45
|
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
46
46
|
*/
|
|
47
|
-
var sc={};void 0!==sc.asn1&&sc.asn1||(sc.asn1={}),sc.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var r=t.substr(1).length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";t=new Ls(n,16).xor(e).add(Ls.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=sc.asn1,r=t.DERBoolean,n=t.DERInteger,i=t.DERBitString,o=t.DEROctetString,a=t.DERNull,s=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,u=t.DERNumericString,d=t.DERPrintableString,f=t.DERTeletexString,p=t.DERIA5String,h=t.DERUTCTime,m=t.DERGeneralizedTime,g=t.DERSequence,v=t.DERSet,y=t.DERTaggedObject,b=t.ASN1Util.newObject,_=Object.keys(e);if(1!=_.length)throw"key of param shall be only one.";var C=_[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+C+":"))throw"undefined key: "+C;if("bool"==C)return new r(e[C]);if("int"==C)return new n(e[C]);if("bitstr"==C)return new i(e[C]);if("octstr"==C)return new o(e[C]);if("null"==C)return new a(e[C]);if("oid"==C)return new s(e[C]);if("enum"==C)return new c(e[C]);if("utf8str"==C)return new l(e[C]);if("numstr"==C)return new u(e[C]);if("prnstr"==C)return new d(e[C]);if("telstr"==C)return new f(e[C]);if("ia5str"==C)return new p(e[C]);if("utctime"==C)return new h(e[C]);if("gentime"==C)return new m(e[C]);if("seq"==C){for(var w=e[C],k=[],S=0;S<w.length;S++){var B=b(w[S]);k.push(B)}return new g({array:k})}if("set"==C){for(w=e[C],k=[],S=0;S<w.length;S++)B=b(w[S]),k.push(B);return new v({array:k})}if("tag"==C){var E=e[C];if("[object Array]"===Object.prototype.toString.call(E)&&3==E.length){var I=b(E[2]);return new y({tag:E[0],explicit:E[1],obj:I})}var A={};if(void 0!==E.explicit&&(A.explicit=E.explicit),void 0!==E.tag&&(A.tag=E.tag),void 0===E.obj)throw"obj shall be specified for 'tag'.";return A.obj=b(E.obj),new y(A)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},sc.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",r=parseInt(e.substr(0,2),16),n=(t=Math.floor(r/40)+"."+r%40,""),i=2;i<e.length;i+=2){var o=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);n+=o.substr(1,7),"0"==o.substr(0,1)&&(t=t+"."+new Ls(n,2).toString(10),n="")}return t},sc.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},r=function(e){var r="",n=new Ls(e,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=t(parseInt(s,2))}return r};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=t(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},sc.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 e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var r=t.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+r).toString(16)+t},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""}},sc.asn1.DERAbstractString=function(e){sc.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},ac.lang.extend(sc.asn1.DERAbstractString,sc.asn1.ASN1Object),sc.asn1.DERAbstractTime=function(e){sc.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+6e4*e.getTimezoneOffset(),new Date(utc)},this.formatDate=function(e,t,r){var n=this.zeroPadding,i=this.localDateToUTC(e),o=String(i.getFullYear());"utc"==t&&(o=o.substr(2,2));var a=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var s=i.getMilliseconds();if(0!=s){var c=n(String(s),3);a=a+"."+(c=c.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,r,n,i,o){var a=new Date(Date.UTC(e,t-1,r,n,i,o,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},ac.lang.extend(sc.asn1.DERAbstractTime,sc.asn1.ASN1Object),sc.asn1.DERAbstractStructured=function(e){sc.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},ac.lang.extend(sc.asn1.DERAbstractStructured,sc.asn1.ASN1Object),sc.asn1.DERBoolean=function(){sc.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},ac.lang.extend(sc.asn1.DERBoolean,sc.asn1.ASN1Object),sc.asn1.DERInteger=function(e){sc.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=sc.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Ls(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},ac.lang.extend(sc.asn1.DERInteger,sc.asn1.ASN1Object),sc.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=sc.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}sc.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var r="0"+e;this.hTLV=null,this.isModified=!0,this.hV=r+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var r=0;r<=t;r++)e+="0";var n="";for(r=0;r<e.length-1;r+=8){var i=e.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+n},this.setByBooleanArray=function(e){for(var t="",r=0;r<e.length;r++)1==e[r]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},ac.lang.extend(sc.asn1.DERBitString,sc.asn1.ASN1Object),sc.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=sc.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}sc.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},ac.lang.extend(sc.asn1.DEROctetString,sc.asn1.DERAbstractString),sc.asn1.DERNull=function(){sc.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},ac.lang.extend(sc.asn1.DERNull,sc.asn1.ASN1Object),sc.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},r=function(e){var r="",n=new Ls(e,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=t(parseInt(s,2))}return r};sc.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=t(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(e){var t=sc.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},ac.lang.extend(sc.asn1.DERObjectIdentifier,sc.asn1.ASN1Object),sc.asn1.DEREnumerated=function(e){sc.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=sc.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Ls(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},ac.lang.extend(sc.asn1.DEREnumerated,sc.asn1.ASN1Object),sc.asn1.DERUTF8String=function(e){sc.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},ac.lang.extend(sc.asn1.DERUTF8String,sc.asn1.DERAbstractString),sc.asn1.DERNumericString=function(e){sc.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},ac.lang.extend(sc.asn1.DERNumericString,sc.asn1.DERAbstractString),sc.asn1.DERPrintableString=function(e){sc.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},ac.lang.extend(sc.asn1.DERPrintableString,sc.asn1.DERAbstractString),sc.asn1.DERTeletexString=function(e){sc.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},ac.lang.extend(sc.asn1.DERTeletexString,sc.asn1.DERAbstractString),sc.asn1.DERIA5String=function(e){sc.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},ac.lang.extend(sc.asn1.DERIA5String,sc.asn1.DERAbstractString),sc.asn1.DERUTCTime=function(e){sc.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(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=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},ac.lang.extend(sc.asn1.DERUTCTime,sc.asn1.DERAbstractTime),sc.asn1.DERGeneralizedTime=function(e){sc.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(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=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},ac.lang.extend(sc.asn1.DERGeneralizedTime,sc.asn1.DERAbstractTime),sc.asn1.DERSequence=function(e){sc.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++)e+=this.asn1Array[t].getEncodedHex();return this.hV=e,this.hV}},ac.lang.extend(sc.asn1.DERSequence,sc.asn1.DERAbstractStructured),sc.asn1.DERSet=function(e){sc.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var r=this.asn1Array[t];e.push(r.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},ac.lang.extend(sc.asn1.DERSet,sc.asn1.DERAbstractStructured),sc.asn1.DERTaggedObject=function(e){sc.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,r){this.hT=t,this.isExplicit=e,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.tag&&(this.hT=e.tag),void 0!==e.explicit&&(this.isExplicit=e.explicit),void 0!==e.obj&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},ac.lang.extend(sc.asn1.DERTaggedObject,sc.asn1.ASN1Object);var cc,lc=(cc=function(e,t){return(cc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}cc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),uc=function(e){function t(r){var n=e.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(t.hasPrivateKeyProperty(r)||t.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}return lc(t,e),t.prototype.parseKey=function(e){try{var t=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?function(e){var t;if(void 0===vs){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(vs={},t=0;t<16;++t)vs[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)vs[r.charAt(t)]=t;for(t=0;t<n.length;++t)vs[n.charAt(t)]=-1}var i=[],o=0,a=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if("="==s)break;if(-1!=(s=vs[s])){if(void 0===s)throw new Error("Illegal character at offset "+t);o|=s,++a>=2?(i[i.length]=o,o=0,a=0):o<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return i}(e):ws.unarmor(e),i=Ts.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){t=i.sub[1].getHexStringValue(),this.n=Us(t,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=Us(o,16);var a=i.sub[4].getHexStringValue();this.p=Us(a,16);var s=i.sub[5].getHexStringValue();this.q=Us(s,16);var c=i.sub[6].getHexStringValue();this.dmp1=Us(c,16);var l=i.sub[7].getHexStringValue();this.dmq1=Us(l,16);var u=i.sub[8].getHexStringValue();this.coeff=Us(u,16)}else{if(2!==i.sub.length)return!1;if(i.sub[0].sub){var d=i.sub[1].sub[0];t=d.sub[0].getHexStringValue(),this.n=Us(t,16),r=d.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else t=i.sub[0].getHexStringValue(),this.n=Us(t,16),r=i.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new sc.asn1.DERInteger({int:0}),new sc.asn1.DERInteger({bigint:this.n}),new sc.asn1.DERInteger({int:this.e}),new sc.asn1.DERInteger({bigint:this.d}),new sc.asn1.DERInteger({bigint:this.p}),new sc.asn1.DERInteger({bigint:this.q}),new sc.asn1.DERInteger({bigint:this.dmp1}),new sc.asn1.DERInteger({bigint:this.dmq1}),new sc.asn1.DERInteger({bigint:this.coeff})]};return new sc.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return bs(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new sc.asn1.DERSequence({array:[new sc.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new sc.asn1.DERNull]}),t=new sc.asn1.DERSequence({array:[new sc.asn1.DERInteger({bigint:this.n}),new sc.asn1.DERInteger({int:this.e})]}),r=new sc.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new sc.asn1.DERSequence({array:[e,r]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return bs(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(!e)return e;var r="(.{1,"+(t=t||64)+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(r,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return(e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return(e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},t.hasPublicKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(ic),dc=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new uc(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(_s(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return bs(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,r){try{return bs(this.getKey().sign(e,t,r))}catch(e){return!1}},e.prototype.verify=function(e,t,r){try{return this.getKey().verify(e,_s(t),r)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new uc,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version="3.3.0",e}(),fc=["-","-","-","-","-","B","E","G","I","N"," ","P","U","B","L","I","C"," ","K","E","Y","-","-","-","-","-","\n"," "," ","M","I","I","B","I","j","A","N","B","g","k","q","h","k","i","G","9","w","0","B","A","Q","E","F","A","A","O","C","A","Q","8","A","M","I","I","B","C","g","K","C","A","Q","E","A","z","7","v","7","a","s","x","M","n","j","L","3","/","j","G","E","d","M","3","T","\n"," "," ","j","0","h","X","b","h","r","/","m","N","2","B","m","j","/","Y","e","6","I","y","1","T","t","g","E","S","W","j","r","V","Y","Z","J","k","a","+","T","L","+","L","0","U","n","h","i","8","l","W","x","2","w","R","s","+","N","i","u","Y","f","g","+","B","U","b","\n"," "," ","s","e","y","L","j","G","B","q","N","t","z","x","H","Z","K","v","d","h","d","i","r","o","y","R","y","C","S","f","p","m","f","h","Q","C","P","s","K","q","/","y","k","1","m","A","e","/","9","1","W","Y","J","b","l","K","h","W","Y","q","W","0","2","I","G","/","\n"," "," ","g","h","r","z","0","b","i","Y","X","C","b","5","m","6","s","R","o","7","e","J","p","4","F","e","2","1","U","N","Q","W","O","o","y","V","2","M","9","o","+","n","G","l","0","P","+","V","A","I","z","q","Z","m","l","P","w","w","v","w","B","i","l","f","X","e","\n"," "," ","W","V","P","x","9","6","f","2","c","A","I","h","S","2","b","W","f","f","d","X","3","w","p","c","1","C","E","m","c","v","9","V","E","f","o","j","j","i","X","O","7","I","n","k","u","P","t","H","4","W","2","E","P","Z","0","8","C","z","3","+","e","Q","2","k","\n"," "," ","D","z","c","j","P","9","8","Q","T","p","u","w","2","E","X","C","S","1","w","s","k","Z","C","2","1","j","L","8","j","z","X","H","a","W","3","B","q","O","h","s","V","G","9","T","F","S","y","c","l","F","g","e","n","r","G","s","Z","i","t","h","l","l","K","/","\n"," "," ","t","Q","I","D","A","Q","A","B","\n"," "," ","-","-","-","-","-","E","N","D"," ","P","U","B","L","I","C"," ","K","E","Y","-","-","-","-","-"];function pc(e){return hc.apply(this,arguments)}function hc(){return(hc=ee($().mark((function e(t){var r,n,i;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.key,n=new TextEncoder,(i=n.encode(r)).reverse(),e.abrupt("return",crypto.subtle.digest("SHA-256",i));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mc(e){return se(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")}var gc=function(e){var t=e.base64,r=e.key;return new Promise((function(e){pc({key:r}).then((function(r){var n=function(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)})).buffer}(t);window.crypto.subtle.importKey("raw",r,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(t){e({hex:mc(t)})}))}))})).catch((function(t){console.error("EncryptBase64 error: ",t),e(t)}))}))},vc=function(e){var t=new dc,r=fc.join("");return t.setPublicKey(r),_s(t.encrypt(e))},yc=function(e,t){return new Promise((function(r){var n=(new TextEncoder).encode(e);window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(e){r({hex:mc(e)})})).catch((function(t){console.error("EncryptString error: ",t),r(e)}))}))};function bc(e,t){return _c.apply(this,arguments)}function _c(){return(_c=ee($().mark((function e(t,r){var n,i,o;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=t.slice(0,16),i=r.slice(-16),(o=new Uint8Array(32)).set(new Uint8Array(n),0),o.set(new Uint8Array(i),n.byteLength),e.abrupt("return",window.crypto.subtle.importKey("raw",o,"AES-GCM",!0,["encrypt","decrypt"]));case 9:return e.prev=9,e.t0=e.catch(0),console.error("combineKeys error: ",e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}var Cc,wc,kc,Sc=Object.freeze({__proto__:null,processKey:pc,encryptBase64:gc,encrypt:function(e){var t=e.blob,r=e.key;return new Promise((function(e){var n=new FileReader;n.onload=function(t){var n=t.target.result;pc({key:r}).then((function(t){window.crypto.subtle.importKey("raw",t,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(t){e({hex:mc(t)})}))}))}))},n.readAsArrayBuffer(t)}))},encryptWithRSAPublicKey:vc,encryptString:yc,combineKeys:bc}),Bc=function(){var e=ee($().mark((function e(t,r){var n,i,o,a,s,c,l,u,d;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",new Promise((function(e){return e(null)})));case 2:return e.prev=2,e.next=5,pc({key:r});case 5:return n=e.sent,e.next=8,window.crypto.subtle.importKey("raw",n,"AES-GCM",!0,["encrypt","decrypt"]);case 8:return i=e.sent,e.next=11,window.crypto.subtle.exportKey("raw",i);case 11:return o=e.sent,a=wn().replace(/-/g,""),s=new TextEncoder,c=s.encode(a),e.next=17,bc(o,c);case 17:return l=e.sent,e.next=20,yc(t,l);case 20:return u=e.sent,e.next=23,vc(a);case 23:return d=e.sent,e.abrupt("return","".concat(u.hex,"::").concat(d));case 27:return e.prev=27,e.t0=e.catch(2),console.error("encryptFrameMetadata error: ",e.t0),e.abrupt("return",t);case 31:case"end":return e.stop()}}),e,null,[[2,27]])})));return function(t,r){return e.apply(this,arguments)}}(),Ec=Object.freeze({__proto__:null,encryptFrameBase64:function(e,t){return new Promise(e?function(r){gc({base64:e,key:t}).then((function(e){r(e.hex)})).catch((function(t){console.error("encryptFrameBase64 error: ",t),r(e)}))}:function(e){return e(null)})},encryptFrameMetadata:Bc}),Ic=ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;te(this,e),this.interval=t,this.second=0,this.timeStone={origin:0},this.callbacks={}}),[{key:"duration",value:function(e){return Object.prototype.hasOwnProperty.call(this.timeStone,e)?this.second-this.timeStone[e]:-1}},{key:"start",value:function(e,t){var r=this;e||this.timerID||(this.callbacks.origin=t,this.timerID=setInterval((function(){r.second++,Object.keys(r.timeStone).map((function(e){return"function"==typeof r.callbacks[e]&&r.callbacks[e](r.duration(e)),0}))}),this.interval)),Object.prototype.hasOwnProperty.call(this.timeStone,e)||e&&(this.timeStone[e]=this.second,this.callbacks[e]=t)}},{key:"stop",value:function(){clearInterval(this.timerID),this.timerID=void 0,this.second=0,this.timeStone={origin:0},this.callbacks={}}}]),Ac=ye((function(e,t){!function(){var r={};function n(e){return d(">"+p("B",e.length),e)}function i(e){return d(">"+p("H",e.length),e)}function o(e){return d(">"+p("L",e.length),e)}function a(e,t,r){var a,s,c,l,u="",f="";if("Byte"==t)(a=e.length)<=4?f=n(e)+p("\0",4-a):(f=d(">L",[r]),u=n(e));else if("Short"==t)(a=e.length)<=2?f=i(e)+p("\0\0",2-a):(f=d(">L",[r]),u=i(e));else if("Long"==t)(a=e.length)<=1?f=o(e):(f=d(">L",[r]),u=o(e));else if("Ascii"==t)(a=(s=e+"\0").length)>4?(f=d(">L",[r]),u=s):f=s+p("\0",4-a);else if("Rational"==t){if("number"==typeof e[0])a=1,c=e[0],l=e[1],s=d(">L",[c])+d(">L",[l]);else{a=e.length,s="";for(var h=0;h<a;h++)c=e[h][0],l=e[h][1],s+=d(">L",[c])+d(">L",[l])}f=d(">L",[r]),u=s}else if("SRational"==t){if("number"==typeof e[0])a=1,c=e[0],l=e[1],s=d(">l",[c])+d(">l",[l]);else for(a=e.length,s="",h=0;h<a;h++)c=e[h][0],l=e[h][1],s+=d(">l",[c])+d(">l",[l]);f=d(">L",[r]),u=s}else"Undefined"==t&&((a=e.length)>4?(f=d(">L",[r]),u=e):f=e+p("\0",4-a));return[d(">L",[a]),f,u]}function s(e,t,r){var n,i=Object.keys(e).length,o=d(">H",[i]);n=["0th","1st"].indexOf(t)>-1?2+12*i+4:2+12*i;var s="",c="";for(var l in e)if("string"==typeof l&&(l=parseInt(l)),!("0th"==t&&[34665,34853].indexOf(l)>-1||"Exif"==t&&40965==l||"1st"==t&&[513,514].indexOf(l)>-1)){var u=e[l],f=d(">H",[l]),p=g[t][l].type,h=d(">H",[m[p]]);"number"==typeof u&&(u=[u]);var v=a(u,p,8+n+r+c.length);s+=f+h+v[0]+v[1],c+=v[2]}return[o+s,c]}function c(e){var t;if("ÿØ"==e.slice(0,2))t=function(e){for(var t,r=0;r<e.length;r++)if("ÿá"==(t=e[r]).slice(0,2)&&"Exif\0\0"==t.slice(4,10))return t;return null}(h(e)),this.tiftag=t?t.slice(10):null;else if(["II","MM"].indexOf(e.slice(0,2))>-1)this.tiftag=e;else{if("Exif"!=e.slice(0,4))throw new Error("Given file is neither JPEG nor TIFF.");this.tiftag=e.slice(6)}}if(r.version="1.0.4",r.remove=function(e){var t=!1;if("ÿØ"==e.slice(0,2));else{if("data:image/jpeg;base64,"!=e.slice(0,23)&&"data:image/jpg;base64,"!=e.slice(0,22))throw new Error("Given data is not jpeg.");e=u(e.split(",")[1]),t=!0}var r=h(e).filter((function(e){return!("ÿá"==e.slice(0,2)&&"Exif\0\0"==e.slice(4,10))})).join("");return t&&(r="data:image/jpeg;base64,"+l(r)),r},r.insert=function(e,t){var r=!1;if("Exif\0\0"!=e.slice(0,6))throw new Error("Given data is not exif.");if("ÿØ"==t.slice(0,2));else{if("data:image/jpeg;base64,"!=t.slice(0,23)&&"data:image/jpg;base64,"!=t.slice(0,22))throw new Error("Given data is not jpeg.");t=u(t.split(",")[1]),r=!0}var n="ÿá"+d(">H",[e.length+2])+e,i=function(e,t){var r=!1,n=[];return e.forEach((function(i,o){"ÿá"==i.slice(0,2)&&"Exif\0\0"==i.slice(4,10)&&(r?n.unshift(o):(e[o]=t,r=!0))})),n.forEach((function(t){e.splice(t,1)})),!r&&t&&(e=[e[0],t].concat(e.slice(1))),e.join("")}(h(t),n);return r&&(i="data:image/jpeg;base64,"+l(i)),i},r.load=function(e){var t;if("string"!=typeof e)throw new Error("'load' gots invalid type argument.");if("ÿØ"==e.slice(0,2))t=e;else if("data:image/jpeg;base64,"==e.slice(0,23)||"data:image/jpg;base64,"==e.slice(0,22))t=u(e.split(",")[1]);else{if("Exif"!=e.slice(0,4))throw new Error("'load' gots invalid file data.");t=e.slice(6)}var r={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null},n=new c(t);if(null===n.tiftag)return r;"II"==n.tiftag.slice(0,2)?n.endian_mark="<":n.endian_mark=">";var i=f(n.endian_mark+"L",n.tiftag.slice(4,8))[0];r["0th"]=n.get_ifd(i,"0th");var o=r["0th"].first_ifd_pointer;if(delete r["0th"].first_ifd_pointer,34665 in r["0th"]&&(i=r["0th"][34665],r.Exif=n.get_ifd(i,"Exif")),34853 in r["0th"]&&(i=r["0th"][34853],r.GPS=n.get_ifd(i,"GPS")),40965 in r.Exif&&(i=r.Exif[40965],r.Interop=n.get_ifd(i,"Interop")),"\0\0\0\0"!=o&&(i=f(n.endian_mark+"L",o)[0],r["1st"]=n.get_ifd(i,"1st"),513 in r["1st"]&&514 in r["1st"])){var a=r["1st"][513]+r["1st"][514],s=n.tiftag.slice(r["1st"][513],a);r.thumbnail=s}return r},r.dump=function(e){var t,n,i,o,a,c,l=(t=e,JSON.parse(JSON.stringify(t))),u=!1,f=!1,p=!1,g=!1;n="0th"in l?l["0th"]:{},"Exif"in l&&Object.keys(l.Exif).length||"Interop"in l&&Object.keys(l.Interop).length?(n[34665]=1,u=!0,i=l.Exif,"Interop"in l&&Object.keys(l.Interop).length?(i[40965]=1,p=!0,o=l.Interop):Object.keys(i).indexOf(r.ExifIFD.InteroperabilityTag.toString())>-1&&delete i[40965]):Object.keys(n).indexOf(r.ImageIFD.ExifTag.toString())>-1&&delete n[34665],"GPS"in l&&Object.keys(l.GPS).length?(n[r.ImageIFD.GPSTag]=1,f=!0,a=l.GPS):Object.keys(n).indexOf(r.ImageIFD.GPSTag.toString())>-1&&delete n[r.ImageIFD.GPSTag],"1st"in l&&"thumbnail"in l&&null!=l.thumbnail&&(g=!0,l["1st"][513]=1,l["1st"][514]=1,c=l["1st"]);var v,y,b,_=s(n,"0th",0),C=_[0].length+12*u+12*f+4+_[1].length,w="",k=0,S="",B=0,E="",I=0,A="";if(u&&(k=(v=s(i,"Exif",C))[0].length+12*p+v[1].length),f&&(B=(S=s(a,"GPS",C+k).join("")).length),p&&(I=(E=s(o,"Interop",C+k+B).join("")).length),g&&(y=s(c,"1st",C+k+B+I),(b=function(e){for(var t=h(e);"ÿà"<=t[1].slice(0,2)&&t[1].slice(0,2)<="ÿï";)t=[t[0]].concat(t.slice(2));return t.join("")}(l.thumbnail)).length>64e3))throw new Error("Given thumbnail is too large. max 64kB");var x="",T="",P="",R="\0\0\0\0";if(u){var D=d(">L",[L=8+C]);x=d(">H",[34665])+d(">H",[m.Long])+d(">L",[1])+D}if(f&&(D=d(">L",[L=8+C+k]),T=d(">H",[34853])+d(">H",[m.Long])+d(">L",[1])+D),p&&(D=d(">L",[L=8+C+k+B]),P=d(">H",[40965])+d(">H",[m.Long])+d(">L",[1])+D),g){var L;R=d(">L",[L=8+C+k+B+I]);var N="\0\0\0\0"+d(">L",[L+y[0].length+24+4+y[1].length]),O="\0\0\0\0"+d(">L",[b.length]);A=y[0]+N+O+"\0\0\0\0"+y[1]+b}var F=_[0]+x+T+R+_[1];return u&&(w=v[0]+P+v[1]),"Exif\0\0MM\0*\0\0\0\b"+F+w+S+E+A},c.prototype={get_ifd:function(e,t){var r,n={},i=f(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],o=e+2;r=["0th","1st"].indexOf(t)>-1?"Image":t;for(var a=0;a<i;a++){e=o+12*a;var s=f(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],c=[f(this.endian_mark+"H",this.tiftag.slice(e+2,e+4))[0],f(this.endian_mark+"L",this.tiftag.slice(e+4,e+8))[0],this.tiftag.slice(e+8,e+12)];s in g[r]&&(n[s]=this.convert_value(c))}return"0th"==t&&(e=o+12*i,n.first_ifd_pointer=this.tiftag.slice(e,e+4)),n},convert_value:function(e){var t,r=null,n=e[0],i=e[1],o=e[2];if(1==n)i>4?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("B",i),this.tiftag.slice(t,t+i))):r=f(this.endian_mark+p("B",i),o.slice(0,i));else if(2==n)i>4?(t=f(this.endian_mark+"L",o)[0],r=this.tiftag.slice(t,t+i-1)):r=o.slice(0,i-1);else if(3==n)i>2?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("H",i),this.tiftag.slice(t,t+2*i))):r=f(this.endian_mark+p("H",i),o.slice(0,2*i));else if(4==n)i>1?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("L",i),this.tiftag.slice(t,t+4*i))):r=f(this.endian_mark+p("L",i),o);else if(5==n)if(t=f(this.endian_mark+"L",o)[0],i>1){r=[];for(var a=0;a<i;a++)r.push([f(this.endian_mark+"L",this.tiftag.slice(t+8*a,t+4+8*a))[0],f(this.endian_mark+"L",this.tiftag.slice(t+4+8*a,t+8+8*a))[0]])}else r=[f(this.endian_mark+"L",this.tiftag.slice(t,t+4))[0],f(this.endian_mark+"L",this.tiftag.slice(t+4,t+8))[0]];else if(7==n)i>4?(t=f(this.endian_mark+"L",o)[0],r=this.tiftag.slice(t,t+i)):r=o.slice(0,i);else if(9==n)i>1?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("l",i),this.tiftag.slice(t,t+4*i))):r=f(this.endian_mark+p("l",i),o);else{if(10!=n)throw new Error("Exif might be wrong. Got incorrect value type to decode. type:"+n);if(t=f(this.endian_mark+"L",o)[0],i>1)for(r=[],a=0;a<i;a++)r.push([f(this.endian_mark+"l",this.tiftag.slice(t+8*a,t+4+8*a))[0],f(this.endian_mark+"l",this.tiftag.slice(t+4+8*a,t+8+8*a))[0]]);else r=[f(this.endian_mark+"l",this.tiftag.slice(t,t+4))[0],f(this.endian_mark+"l",this.tiftag.slice(t+4,t+8))[0]]}return r instanceof Array&&1==r.length?r[0]:r}},"undefined"!=typeof window&&"function"==typeof window.btoa)var l=window.btoa;if(void 0===l&&(l=function(e){for(var t,r,n,i,o,a,s,c="",l=0,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";l<e.length;)i=(t=e.charCodeAt(l++))>>2,o=(3&t)<<4|(r=e.charCodeAt(l++))>>4,a=(15&r)<<2|(n=e.charCodeAt(l++))>>6,s=63&n,isNaN(r)?a=s=64:isNaN(n)&&(s=64),c=c+u.charAt(i)+u.charAt(o)+u.charAt(a)+u.charAt(s);return c}),"undefined"!=typeof window&&"function"==typeof window.atob)var u=window.atob;function d(e,t){if(!(t instanceof Array))throw new Error("'pack' error. Got invalid type argument.");if(e.length-1!=t.length)throw new Error("'pack' error. "+(e.length-1)+" marks, "+t.length+" elements.");var r;if("<"==e[0])r=!0;else{if(">"!=e[0])throw new Error("");r=!1}for(var n="",i=1,o=null,a=null,s=null;a=e[i];){if("b"==a.toLowerCase()){if(o=t[i-1],"b"==a&&o<0&&(o+=256),o>255||o<0)throw new Error("'pack' error.");s=String.fromCharCode(o)}else if("H"==a){if((o=t[i-1])>65535||o<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256),r&&(s=s.split("").reverse().join(""))}else{if("l"!=a.toLowerCase())throw new Error("'pack' error.");if(o=t[i-1],"l"==a&&o<0&&(o+=4294967296),o>4294967295||o<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(o/16777216))+String.fromCharCode(Math.floor(o%16777216/65536))+String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256),r&&(s=s.split("").reverse().join(""))}n+=s,i+=1}return n}function f(e,t){if("string"!=typeof t)throw new Error("'unpack' error. Got invalid type argument.");for(var r,n=0,i=1;i<e.length;i++)if("b"==e[i].toLowerCase())n+=1;else if("h"==e[i].toLowerCase())n+=2;else{if("l"!=e[i].toLowerCase())throw new Error("'unpack' error. Got invalid mark.");n+=4}if(n!=t.length)throw new Error("'unpack' error. Mismatch between symbol and string length. "+n+":"+t.length);if("<"==e[0])r=!0;else{if(">"!=e[0])throw new Error("'unpack' error.");r=!1}for(var o=[],a=0,s=1,c=null,l=null,u=null,d="";l=e[s];){if("b"==l.toLowerCase())u=1,c=(d=t.slice(a,a+u)).charCodeAt(0),"b"==l&&c>=128&&(c-=256);else if("H"==l)u=2,d=t.slice(a,a+u),r&&(d=d.split("").reverse().join("")),c=256*d.charCodeAt(0)+d.charCodeAt(1);else{if("l"!=l.toLowerCase())throw new Error("'unpack' error. "+l);u=4,d=t.slice(a,a+u),r&&(d=d.split("").reverse().join("")),c=16777216*d.charCodeAt(0)+65536*d.charCodeAt(1)+256*d.charCodeAt(2)+d.charCodeAt(3),"l"==l&&c>=2147483648&&(c-=4294967296)}o.push(c),a+=u,s+=1}return o}function p(e,t){for(var r="",n=0;n<t;n++)r+=e;return r}function h(e){if("ÿØ"!=e.slice(0,2))throw new Error("Given data isn't JPEG.");for(var t=2,r=["ÿØ"];;){if("ÿÚ"==e.slice(t,t+2)){r.push(e.slice(t));break}var n=t+f(">H",e.slice(t+2,t+4))[0]+2;if(r.push(e.slice(t,n)),(t=n)>=e.length)throw new Error("Wrong JPEG data.")}return r}void 0===u&&(u=function(e){var t,r,n,i,o,a,s="",c=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<e.length;)t=l.indexOf(e.charAt(c++))<<2|(i=l.indexOf(e.charAt(c++)))>>4,r=(15&i)<<4|(o=l.indexOf(e.charAt(c++)))>>2,n=(3&o)<<6|(a=l.indexOf(e.charAt(c++))),s+=String.fromCharCode(t),64!=o&&(s+=String.fromCharCode(r)),64!=a&&(s+=String.fromCharCode(n));return s});var m={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10},g={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};g["0th"]=g.Image,g["1st"]=g.Image,r.TAGS=g,r.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041},r.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240},r.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31},r.InteropIFD={InteroperabilityIndex:1},r.GPSHelper={degToDmsRational:function(e){var t=Math.abs(e),r=t%1*60,n=r%1*60;return[[Math.floor(t),1],[Math.floor(r),1],[Math.round(100*n),100]]},dmsRationalToDeg:function(e,t){var r="S"===t||"W"===t?-1:1;return(e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600)*r}},e.exports&&(t=e.exports=r),t.piexif=r}()})),xc=function(e,t,r){return null==e?e:function(e,t,r,n){if(!Pe(e))return e;for(var i=-1,o=(t=Lr(t,e)).length,a=o-1,s=e;null!=s&&++i<o;){var c=Nr(t[i]),l=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=a){var u=s[c];void 0===(l=n?n(u,c,s):void 0)&&(l=Pe(u)?u:vt(t[i+1])?[]:{})}ot(s,c,l),s=s[c]}return e}(e,t,r)},Tc={},Pc={SELFIE:"selfie",ID_CARD:"id_card"},Rc=es((function(e){var t=new dc,r=e||fc.join("");return t.setPublicKey(r),t})),Dc=function(e){var t=e.gesture,r=e.captureTime,n=e.frames,i=e.blurScore,o=e.selfieLabel,a=e.brightnessScore,s=e.accelerometer,c=e.gyroscope;return{capture_time:r,type:t,frames:n,blur_score:i,selfie_label:o,qualify_score:e.qualifyScore,accelerometer:s,gyroscope:c,brightness_score:a}},Lc=function(e){var t=e.detectedCard,r=e.captureTime,n=e.vCam,i=e.captureCount,o=e.captureDuration,a=e.captureType,s=e.cardTracking;return{capture_time:r,type:null==t?void 0:t.label,v_cam:n,capture_count:i,capture_duration:o,capture_type:a,card_tracking:s}},Nc=function(){var e=ee($().mark((function e(t,r){var n;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(e){return se(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")},e.abrupt("return",new Promise((function(e){var i=new TextEncoder,o=i.encode(t),a=i.encode(r);window.crypto.subtle.importKey("raw",a,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,o).then((function(t){e("".concat(kc,".").concat(n(t)))}))}))})));case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),Oc=function(){var e=ee($().mark((function e(t){var r,n,i,o,a,s,c,l,u;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.mode,i=t.imageData,t.enableExifData){e.next=3;break}return e.abrupt("return",new Promise((function(e){return e(i.blob)})));case 3:return o=Y(Y({},Tc),n===Pc.SELFIE?Dc(i):Lc(i)),a=Y(Y({},o),{},{sensor_data:"sensor data exceed 64KB"}),null!=i&&null!==(r=i.type)&&void 0!==r&&r.includes("qr")&&(o={capture_time:null==i?void 0:i.captureTime,type:null==i?void 0:i.type,qr_string:null==i?void 0:i.result}),e.next=8,Nc(JSON.stringify(a),wc);case 8:return s=e.sent,e.next=11,Nc(JSON.stringify(o),wc);case 11:return c=e.sent,l=Ac.dump({Exif:ie({},Ac.ExifIFD.MakerNote,c)}),u=Ac.dump({Exif:ie({},Ac.ExifIFD.MakerNote,s)}),e.abrupt("return",new Promise((function(e){var t=new FileReader;t.onload=function(){var t=ee($().mark((function t(r){var n,o,a;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{n=Ac.insert(l,r.target.result)}catch(t){try{n=Ac.insert(u,r.target.result)}catch(t){e(i.blob)}}return t.prev=1,t.next=4,fetch(n);case 4:return o=t.sent,t.next=7,o.blob();case 7:a=t.sent,URL.revokeObjectURL(n),e(a),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(1),e(i.blob);case 15:case"end":return t.stop()}}),t,null,[[1,12]])})));return function(e){return t.apply(this,arguments)}}(),t.readAsDataURL(i.blob)})));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Fc=Object.freeze({__proto__:null,MODE:Pc,initExifData:function(){Tc={device_info:{device_brand_name:"".concat("none"===Bn.mobileVendor?"null":Bn.mobileVendor),device_model:"".concat("none"===Bn.mobileModel?"null":Bn.mobileModel),browser_version:"".concat(Bn.browserName," ").concat(Bn.browserVersion),browser_userAgent:"".concat(Bn.getUA),os:Bn.osName,os_version:Bn.osVersion},sdk_version:"5.24.2",model_score:{id_blurry_score:"null",id_glare_score:"null"},user_action:{}}},addExifData:function(e,t){xc(Tc,e,t)},preWriteExif:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mode,r=(e.motionData,e.orientationData,e.startTime),n=e.endTime,i=e.exifKey,o=void 0===i?"":i;Tc.user_action=Y({},t===Pc.SELFIE?{start_selfie:r,end_selfie:n}:{start_id_card:r,end_id_card:n}),wc=wn().replace(/-/g,""),Cc||(Cc=Rc(o)),kc=_s(Cc.encrypt(wc))},writeExif:Oc}),Mc=function(e,t,r){var n=null==e?void 0:Or(e,t);return void 0===n?r:n},Vc=function(e,t,r){(void 0!==r&&!fe(e[t],r)||void 0===r&&!(t in e))&&nt(e,t,r)},Uc=function(e,t,r){for(var n=-1,i=Object(e),o=r(e),a=o.length;a--;){var s=o[++n];if(!1===t(i[s],s,i))break}return e},jc=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},zc=function(e,t,r,n,i,o,a){var s=jc(e,r),c=jc(t,r),l=a.get(c);if(l)Vc(e,r,l);else{var u=o?o(s,c,r+"",e,t,a):void 0,d=void 0===u;if(d){var f=pt(c),p=!f&&mt(c),h=!f&&!p&&kt(c);u=c,f||p||h?pt(s)?u=s:function(e){return st(e)&&Pt(e)}(s)?u=Ft(s):p?(d=!1,u=Ot(c,!0)):h?(d=!1,u=dr(c,!0)):u=[]:Hr(c)||ft(c)?(u=s,ft(s)?u=function(e){return at(e,Nt(e))}(s):Pe(s)&&!Re(s)||(u=mr(c))):d=!1}d&&(a.set(c,u),i(u,c,n,o,a),a.delete(c)),Vc(e,r,u)}},qc=function e(t,r,n,i,o){t!==r&&Uc(r,(function(a,s){if(o||(o=new tt),Pe(a))zc(t,r,s,n,e,i,o);else{var c=i?i(jc(t,s),a,s+"",t,r,o):void 0;void 0===c&&(c=a),Vc(t,s,c)}}),Nt)},Hc=function(e,t){return nn(Zr(e,t,en),e+"")},Kc=function(e,t,r){if(!Pe(r))return!1;var n=x(t);return!!("number"==n?Pt(r)&&vt(t,r.length):"string"==n&&t in r)&&fe(r[t],e)},Wc=function(e){return Hc((function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&Kc(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t}))},Gc=Wc((function(e,t,r,n){qc(e,t,r,n)})),Qc={enableGetClientSettings:!0,enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0,enableRegisterFace:!0,enableAuthenticateFace:!0},Xc=Object.freeze({__proto__:null,getEnabledServices:function(e,t){var r=function(e){if(!e)return Qc;var t=e.enableUploadFrames,r=e.enableUploadImages,n=void 0===r||r,i=e.enableGetClientSettings,o=n&&e.enableVerifySanityPortrait,a=n&&e.enableVerifySanityIDCard,s=n&&e.enableDetectIDCardTampering,c=n&&e.enableReadIDCardInfo;return{enableGetClientSettings:i,enableUploadFrames:t,enableUploadImages:n,enableVerifySanityPortrait:o,enableVerifySanityIDCard:a,enableVerifyFaceLiveness:n&&e.enableVerifyFaceLiveness,enableDetectIDCardTampering:s,enableReadIDCardInfo:c,enableRegisterFace:n&&e.enableRegisterFace,enableAuthenticateFace:n&&e.enableAuthenticateFace}}(e),n=function(e){return{enableGetClientSettings:!0,enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:Mc(e,"data.settings.enable_verify_portrait_sanity",!0),enableVerifySanityIDCard:Mc(e,"data.settings.enable_verify_id_card_sanity",!0),enableVerifyFaceLiveness:Mc(e,"data.settings.enable_verify_face_liveness",!0),enableDetectIDCardTampering:Mc(e,"data.settings.enable_detect_id_card_tampering",!0),enableReadIDCardInfo:Mc(e,"data.settings.enable_read_id_card_info",!0),enableRegisterFace:Mc(e,"data.settings.enable_face_registration",!0),enableAuthenticateFace:Mc(e,"data.settings.enable_face_authentication",!0)}}(t),i=Y({},Qc);return Gc(i,r,n,(function(e,t){return(null==e||e)&&(null==t||t)}))}}),Yc=function(e){var t=e.slice(0,2),r=e.slice(2,4),n=e.slice(4,8);return new Date("".concat(n,"-").concat(r,"-").concat(t))},$c=function(e){return!Number.isNaN(e.getTime())&&e<=new Date},Zc={CCCD:{validate:function(e){var t=e.split("|"),r=Yc(t[3]),n=Yc(t[6]);return 7===t.length&&Boolean(e.match(/^\d{12}\|(\d{9})?\|.+\|\d{8}\|((Nam)|(Nữ))\|.+\|\d{8}$/g))&&$c(r)&&$c(n)&&r<n}},TCC:{validate:function(e){var t=e.split("|"),r=Yc(t[3]),n=Yc(t[6]);return 11===t.length&&Boolean(e.match(/^\d{12}\|(\d{9})?\|.+\|\d{8}\|((Nam)|(Nữ))\|.+\|\d{8}/g))&&$c(r)&&$c(n)&&r<n}}},Jc=Object.freeze({__proto__:null,validateIdQRContent:function(e){var t=function(e){var t=e[6];if(!t||8!==t.length)return null;var r=Yc(t);return $c(r)?r>=new Date("2024-07-01")?Zc.TCC:Zc.CCCD:null}(e.split("|"));return t?{valid:t.validate(e)}:{valid:!1}}}),el="https://cdn.jsdelivr.net/npm/@tsocial/tv_web_sdk_resources@2.0.2/models/close-eyes/closed_eye_detector.tflite",tl=function(){return ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:el,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.342,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:368,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;te(this,e),this.model_path=t,this.threshold=r,this.size=Math.round(n/2),this.enable_profiling=i,this.num_threads=o}),[{key:"load",value:(t=ee($().mark((function e(){var t,r,n,i=this;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window,r=t.tf,e.next=3,os({modelUrl:this.model_path,options:{numThreads:this.num_threads,enableProfiling:this.enable_profiling}});case 3:this.model=e.sent,n=this.model.inputs[0],this.input_width=n.shape[1],this.input_height=n.shape[2],r.tidy((function(){var e=r.randomNormal([1,i.input_width,i.input_height,3]);i.model.predict(e)}));case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"crop_eyes",value:function(e,t){var r=this,n=window.tf,i=t[0].map((function(e){return Math.round(e)})),o=t[1].map((function(e){return Math.round(e)}));i[0]>o[0]&&(i=t[1].map((function(e){return Math.round(e)})),o=t[0].map((function(e){return Math.round(e)})));var a=Math.round((i[0]+o[0])/2),s=a-i[0],c=o[0]-a;s>=this.size&&(s=this.size),c>=this.size&&(c=this.size);var l=Math.max(i[0]-s,0),u=Math.max(i[1]-s,0),d=Math.max(o[0]-c,0),f=Math.max(o[1]-c,0);return n.tidy((function(){var t=e.slice([u,l,0],[2*s,2*s,3]),i=e.slice([f,d,0],[2*c,2*c,3]);return{l_img:t=n.expandDims(n.image.resizeBilinear(t,[r.input_width,r.input_height])),r_img:i=n.expandDims(n.image.resizeBilinear(i,[r.input_width,r.input_height]))}}))}},{key:"predict",value:(e=ee($().mark((function e(t,r){var n,i,o,a,s,c,l,u,d,f=this,p=arguments;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=p.length>2&&void 0!==p[2]?p[2]:this.threshold,i=window,o=i.tf,a=t.getContext("2d"),s=a.getImageData(0,0,t.height,t.width),c=o.tidy((function(){var e=o.browser.fromPixels(s),t=f.crop_eyes(e,r),i=t.l_img,a=t.r_img,c=f.model.predict(i).arraySync()[0],l=f.model.predict(a).arraySync()[0];return[c>n,l>n]})),l=ae(c,2),u=l[0],d=l[1],e.abrupt("return",{isEyeClose:u||d});case 6:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]);var e,t}(),rl=function(){var e=ee($().mark((function e(){return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!DeviceMotionEvent||"function"!=typeof DeviceMotionEvent.requestPermission){e.next=2;break}return e.abrupt("return",DeviceMotionEvent.requestPermission());case 2:return e.abrupt("return",new Promise((function(e){return e("granted")})));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function nl(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.dataRate,r=void 0===t?100:t,n=i([]),s=i([]),c=(i(!1),i({})),l=o((function(e){var t=Date.now(),n=e.type;return!!(c.current[n]&&t-c.current[n]<r)||(c.current[n]=t,!1)}),[r]),u=o((function(e){l(e)||s.current.push({time:Date.now(),alpha:null==e?void 0:e.alpha,beta:null==e?void 0:e.beta,gamma:null==e?void 0:e.gamma})}),[l]),d=o((function(e){var t,r,i,o,a,s;l(e)||n.current.push({time:Date.now(),Accelerometer:{x:null==e||null===(t=e.acceleration)||void 0===t?void 0:t.x,y:null==e||null===(r=e.acceleration)||void 0===r?void 0:r.y,z:null==e||null===(i=e.acceleration)||void 0===i?void 0:i.z},Gyroscope:{z:null==e||null===(o=e.rotationRate)||void 0===o?void 0:o.alpha,x:null==e||null===(a=e.rotationRate)||void 0===a?void 0:a.beta,y:null==e||null===(s=e.rotationRate)||void 0===s?void 0:s.gamma}})}),[l]),f=o((function(){}),[d,u]),p=o((function(){}),[d,u]);return a((function(){return function(){p()}}),[p]),{motionData:n.current,orientationData:s.current,startMotion:f,stopMotion:p}}var il=Wc((function(e,t,r,n){at(t,Nt(t),e,n)})),ol=function(e){if(!st(e))return!1;var t=Te(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Hr(e)},al=Hc((function(e,t){try{return Yr(e,void 0,t)}catch(e){return ol(e)?e:new Error(e)}})),sl=Object.prototype,cl=sl.hasOwnProperty,ll=function(e,t,r,n){return void 0===e||fe(e,sl[r])&&!cl.call(n,r)?t:e},ul={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dl=function(e){return"\\"+ul[e]},fl=/<%=([\s\S]+?)%>/g,pl=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),hl=/[&<>"']/g,ml=RegExp(hl.source),gl={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:fl,variable:"",imports:{_:{escape:function(e){return(e=Dr(e))&&ml.test(e)?e.replace(hl,pl):e}}}},vl=/\b__p \+= '';/g,yl=/\b(__p \+=) '' \+/g,bl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_l=/[()=,{}\[\]\/\s]/,Cl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,wl=/($^)/,kl=/['\n\r\u2028\u2029\\]/g,Sl=Object.prototype.hasOwnProperty,Bl=function(e,t,r){var n=gl.imports._.templateSettings||gl;r&&Kc(e,t,r)&&(t=void 0),e=Dr(e),t=il({},t,n,ll);var i,o,a=il({},t.imports,n.imports,ll),s=Rt(a),c=function(e,t){return de(t,(function(t){return e[t]}))}(a,s),l=0,u=t.interpolate||wl,d="__p += '",f=RegExp((t.escape||wl).source+"|"+u.source+"|"+(u===fl?Cl:wl).source+"|"+(t.evaluate||wl).source+"|$","g"),p=Sl.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(f,(function(t,r,n,a,s,c){return n||(n=a),d+=e.slice(l,c).replace(kl,dl),r&&(i=!0,d+="' +\n__e("+r+") +\n'"),s&&(o=!0,d+="';\n"+s+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),d+="';\n";var h=Sl.call(t,"variable")&&t.variable;if(h){if(_l.test(h))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(vl,""):d).replace(yl,"$1").replace(bl,"$1;"),d="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=al((function(){return Function(s,p+"return "+d).apply(void 0,c)}));if(m.source=d,ol(m))throw m;return m},El=function(){var e=wi();return o((function(t,r){var n,i;return r?Bl(null!==(i=e[t])&&void 0!==i?i:t)(r):null!==(n=e[t])&&void 0!==n?n:t}),[e])},Il=function(e){a((function(){!function(e){new Promise((function(t,r){var n=new Image;n.onload=t,n.onerror=r,n.src=e}))}(e)}),[e])},Al=function(){return URL.createObjectURL(new Blob(['\'use strict\';(function(){function T(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let d=0;d<b;d++){let b=a.readBits(8);c.push(b)}try{d+=decodeURIComponent(c.map(a=>`%${("0"+a.toString(16)).substr(-2)}`).join(""))}catch(e){}return{bytes:c,text:d}}function U(a,b){a=new V(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===t.Terminator)return b;if(d===t.ECI)0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(7)}):\n0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:r.ECI,assignmentNumber:-1});else if(d===t.Numeric){var e=a;d=[];for(var f="",g=e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),n=Math.floor(h/10)%10;h%=10;d.push(48+k,48+n,48+h);f+=k.toString()+n.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);\nif(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;d.push(48+e,48+g);f+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");d.push(48+e);f+=e.toString()}d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Numeric,text:d.text})}else if(d===t.Alphanumeric){e=a;d=[];f="";for(g=e.readBits([9,11,13][c]);2<=g;)n=e.readBits(11),k=Math.floor(n/45),n%=45,d.push(B[k].charCodeAt(0),B[n].charCodeAt(0)),\nf+=B[k]+B[n],g-=2;1===g&&(e=e.readBits(6),d.push(B[e].charCodeAt(0)),f+=B[e]);d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Alphanumeric,text:d.text})}else if(d===t.Byte)d=T(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:r.Byte,bytes:d.bytes,text:d.text});else if(d===t.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d));\nd={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Kanji,bytes:d.bytes,text:d.text})}else d===t.StructuredAppend&&b.chunks.push({type:r.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}function J(a,b){return a^b}function W(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let d=e;b=c;e=f;if(b.isZero())return null;\nc=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let d=c.degree()-b.degree(),e=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(d,e));c=c.addOrSubtract(b.multiplyByMonomial(d,e))}f=f.multiplyPoly(e).addOrSubtract(d);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}function X(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new Y(285,\n256,0);var d=new w(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c;d=new w(a,e);d=W(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;d=d[1];e=b.length;f=Array(e);for(g=0;g<e;g++){h=a.inverse(b[g]);let c=1;for(let d=\n0;d<e;d++)g!==d&&(c=a.multiply(c,J(1,a.multiply(b[d],h))));f[g]=a.multiply(d.evaluateAt(h),a.inverse(c));0!==a.generatorBase&&(f[g]=a.multiply(f[g],h))}d=f;for(e=0;e<b.length;e++){f=c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}function E(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function C(a,b){return b<<1|a}function Z(a,b,c){c=aa[c.dataMask];let d=a.height;var e=17+4*b.versionNumber,f=A.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===\ng&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=f;g=[];e=h=0;f=!0;for(let k=d-1;0<k;k-=2){6===k&&k--;for(let n=0;n<d;n++){let m=f?d-1-n:n;for(let d=0;2>d;d++){let f=k-d;if(!b.get(f,m)){e++;let b=a.get(f,m);c({y:m,x:f})&&(b=!b);h=h<<1|b;8===e&&(g.push(h),h=e=0)}}}f=!f}return g}function ba(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return K[c-\n1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=C(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let c=b-9;c>=b-11;c--)d=C(a.get(e,c),d);a=Infinity;let f;for(let e of K){if(e.infoBits===c||e.infoBits===d)return e;b=E(c,e.infoBits);b<a&&(f=e,a=b);b=E(d,e.infoBits);b<a&&(f=e,a=b)}if(3>=a)return f}function ca(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=C(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=C(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=C(a.get(8,e),c);for(e=d-8;e<d;e++)c=C(a.get(e,\n8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of da){if(f===b||f===c)return g;e=E(b,f);e<a&&(d=g,a=e);b!==c&&(e=E(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}function ea(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(a=>{for(let b=0;b<a.numBlocks;b++)e.push({numDataCodewords:a.dataCodewordsPerBlock,codewords:[]}),f+=a.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());\nif(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c<b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let b of e)b.codewords.push(a.shift());return e}function L(a){let b=ba(a);if(!b)return null;var c=ca(a);if(!c)return null;a=Z(a,b,c);var d=ea(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((a,b)=>a+b.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let b of d){d=X(b.codewords,b.codewords.length-b.numDataCodewords);if(!d)return null;for(let e=\n0;e<b.numDataCodewords;e++)c[a++]=d[e]}try{return U(c,b.versionNumber)}catch(e){return null}}function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};{let h=b.x-c.x;var g=d.x-c.x;let k=b.y-c.y,n=d.y-c.y;c=h*n-g*k;g=(e*n-g*f)/c;e=(h*f-e*k)/c;return{a11:b.x-a.x+g*b.x,a12:b.y-a.y+g*b.y,a13:g,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}}function fa(a,b,c,d){a=M(a,b,c,d);\nreturn{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}function ha(a,b){var c=fa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+\nd.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31*c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,n=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,m=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,l=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,p=d.a13*c.a31+d.a23*c.a32+d.a33*c.a33;c=A.createEmpty(b.dimension,b.dimension);d=(a,b)=>{const c=g*a+n*b+p;return{x:(e*a+h*b+m)/c,y:(f*a+k*b+l)/c}};for(let e=0;e<b.dimension;e++)for(let f=0;f<b.dimension;f++){let b=d(f+.5,e+.5);c.set(f,e,a.get(Math.floor(b.x),\nMath.floor(b.y)))}return{matrix:c,mappingFunction:d}}function x(a){return a.reduce((a,c)=>a+c)}function ia(a,b,c){let d=y(a,b),e=y(b,c),f=y(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}function ja(a,b,c,d){d=(x(z(a,c,d,5))/7+x(z(a,b,d,5))/7+x(z(c,a,d,5))/7+x(z(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(y(a,b)/d);a=Math.round(y(a,c)/d);a=\nMath.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}function N(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),n=Math.abs(b-h),m=Math.floor(-k/2),l=g<a?1:-1,p=h<b?1:-1,q=!0;for(let v=g,u=h;v!==a+l;v+=l){g=f?u:v;h=f?v:u;if(c.get(g,\nh)!==q&&(q=!q,e.push({x:g,y:h}),e.length===d+1))break;m+=n;if(0<m){if(u===b)break;u+=p;m-=k}}c=[];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(y(e[f],e[f+1])):c.push(0);return c}function z(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=N(a,b,c,Math.ceil(d/2));a=N(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function F(a,b){let c=x(a)/x(b),d=0;b.forEach((b,f)=>{d+=Math.pow(a[f]-b*c,2)});return{averageSize:c,error:d}}function O(a,b,c){try{let d=z(a,{x:-1,y:a.y},c,b.length),\ne=z(a,{x:a.x,y:-1},c,b.length),f=z(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=z(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=F(d,b),k=F(e,b),n=F(f,b),m=F(g,b),l=(h.averageSize+k.averageSize+n.averageSize+m.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+n.error*n.error+m.error*m.error)+(Math.pow(h.averageSize-l,2)+Math.pow(k.averageSize-l,2)+Math.pow(n.averageSize-l,2)+Math.pow(m.averageSize-l,2))/l}catch(d){return Infinity}}\nfunction H(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}function ka(a){var b=[],c=[];let d=[];var e=[];for(let m=0;m<=a.height;m++){var f=0,g=!1;let l=[0,0,0,0,0];for(let b=-1;b<=a.width;b++){var h=a.get(b,m);if(h===g)f++;else{l=[l[1],l[2],l[3],l[4],f];f=1;g=h;var k=x(l)/7;k=Math.abs(l[0]-k)<k&&Math.abs(l[1]-\nk)<k&&Math.abs(l[2]-3*k)<3*k&&Math.abs(l[3]-k)<k&&Math.abs(l[4]-k)<k&&!h;var n=x(l.slice(-3))/3;h=Math.abs(l[2]-n)<n&&Math.abs(l[3]-n)<n&&Math.abs(l[4]-n)<n&&h;if(k){let a=b-l[3]-l[4],d=a-l[2];k={startX:d,endX:a,y:m};n=c.filter(b=>d>=b.bottom.startX&&d<=b.bottom.endX||a>=b.bottom.startX&&d<=b.bottom.endX||d<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<n.length?n[0].bottom=k:c.push({top:k,bottom:k})}if(h){let a=b-l[4],c=a-\nl[3];h={startX:c,y:m,endX:a};k=e.filter(b=>c>=b.bottom.startX&&c<=b.bottom.endX||a>=b.bottom.startX&&c<=b.bottom.endX||c<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<k.length?k[0].bottom=h:e.push({top:h,bottom:h})}}}b.push(...c.filter(a=>a.bottom.y!==m&&2<=a.bottom.y-a.top.y));c=c.filter(a=>a.bottom.y===m);d.push(...e.filter(a=>a.bottom.y!==m));e=e.filter(a=>a.bottom.y===m)}b.push(...c.filter(a=>2<=a.bottom.y-a.top.y));d.push(...e);\nc=[];for(var m of b)2>m.bottom.y-m.top.y||(b=(m.top.startX+m.top.endX+m.bottom.startX+m.bottom.endX)/4,e=(m.top.y+m.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[m.top.endX-m.top.startX,m.bottom.endX-m.bottom.startX,m.bottom.y-m.top.y+1],f=x(f)/f.length,g=O({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((a,b)=>a.score-b.score);m=[];for(b=0;b<Math.min(c.length,5);++b){e=c[b];f=[];for(var l of c)l!==e&&f.push(Object.assign(Object.assign({},\nl),{score:l.score+Math.pow(l.size-e.size,2)/e.size}));f.sort((a,b)=>a.score-b.score);m.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}m.sort((a,b)=>a.score-b.score);let {topRight:p,topLeft:q,bottomLeft:v}=ia(...m[0].points);m=P(a,d,p,q,v);l=[];m&&l.push({alignmentPattern:{x:m.alignmentPattern.x,y:m.alignmentPattern.y},bottomLeft:{x:v.x,y:v.y},dimension:m.dimension,topLeft:{x:q.x,y:q.y},topRight:{x:p.x,y:p.y}});m=H(a,p);b=H(a,q);c=H(a,v);(a=P(a,d,m,b,c))&&l.push({alignmentPattern:{x:a.alignmentPattern.x,\ny:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:m.x,y:m.y},dimension:a.dimension});return 0===l.length?null:l}function P(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ja(d,c,e,a))}catch(m){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(y(d,e)+y(d,c))/2/g;e=1-3/c;let n={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/4;b=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.floor(c),Math.floor(b))){var d=O({x:Math.floor(c),\ny:Math.floor(b)},[1,1,1],a)+y({x:c,y:b},n);return{x:c,y:b,score:d}}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);return{alignmentPattern:15<=c&&b.length?b[0]:n,dimension:f}}function Q(a){var b=ka(a);if(!b)return null;for(let e of b){b=ha(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let a=d+1;a<c.height;a++)c.get(d,a)!==c.get(a,d)&&(c.set(d,a,!c.get(d,a)),c.set(a,d,!c.get(a,d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,version:c.version,\nlocation:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}function R(a,b){Object.keys(b).forEach(c=>{a[c]=b[c]})}function I(a,b,c,d={}){let e=Object.create(null);R(e,la);R(e,d);\nd="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var n=0;if(h){var m=new Uint8ClampedArray(a.buffer,n,k);n+=k}m=new S(b,c,m);if(g.useIntegerApproximation)for(var l=0;l<c;l++)for(var p=0;p<b;p++){var q=4*(l*b+p);m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]+128>>8)}else for(l=0;l<c;l++)for(p=0;p<b;p++)q=4*\n(l*b+p),m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]);g=Math.ceil(b/8);l=Math.ceil(c/8);p=g*l;if(h){var v=new Uint8ClampedArray(a.buffer,n,p);n+=p}v=new S(g,l,v);for(p=0;p<l;p++)for(q=0;q<g;q++){var u=Infinity,r=0;for(var t=0;8>t;t++)for(let a=0;8>a;a++){let b=m.get(8*q+a,8*p+t);u=Math.min(u,b);r=Math.max(r,b)}t=(u+r)/2;t=Math.min(255,1.11*t);24>=r-u&&(t=u/2,0<p&&0<q&&(r=(v.get(q,p-1)+2*v.get(q-1,p)+v.get(q-1,p-1))/4,u<r&&(t=r)));v.set(q,p,t)}h?(p=new Uint8ClampedArray(a.buffer,n,k),n+=k,p=new A(p,\nb)):p=A.createEmpty(b,c);q=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,n,k),q=new A(a,b)):q=A.createEmpty(b,c));for(b=0;b<l;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=l-3;h=2>b?2:b>h?h:b;k=0;for(n=-2;2>=n;n++)for(u=-2;2>=u;u++)k+=v.get(c+n,h+u);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)n=8*a+h,u=8*b+k,r=m.get(n,u),p.set(n,u,r<=c),f&&q.set(n,u,!(r<=c))}f=f?{binarized:p,inverted:q}:{binarized:p};let {binarized:w,inverted:x}=f;(f=Q(d?x:w))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||\n(f=Q(d?w:x));return f}class A{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new A(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let b=a;b<a+c;b++)this.set(b,f,!!e)}}class S{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,\nb){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}class V{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,\na-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var r;(function(a){a.Numeric="numeric";a.Alphanumeric="alphanumeric";a.Byte="byte";a.Kanji="kanji";a.ECI="eci";a.StructuredAppend="structuredappend"})(r||(r={}));var t;(function(a){a[a.Terminator=0]="Terminator";a[a.Numeric=1]="Numeric";a[a.Alphanumeric=2]="Alphanumeric";a[a.Byte=4]="Byte";a[a.Kanji=8]="Kanji";a[a.ECI=7]="ECI";a[a.StructuredAppend=\n3]="StructuredAppend"})(t||(t={}));let B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");class w{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length-1}isZero(){return 0===\nthis.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new w(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length,c=new Uint8ClampedArray(b);\nfor(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new w(this.field,c)}multiplyPoly(a){if(this.isZero()||a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let h=0;h<c;h++){let c=b[h];for(let b=0;b<d;b++){var f=h+b,g=this.field.multiply(c,a[b]);e[f]=e[h+b]^g}}return new w(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero;\nlet c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new w(this.field,a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(a=>{b^=a}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=J(this.field.multiply(a,b),this.coefficients[d]);return b}}class Y{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase=c;this.expTable=Array(this.size);\nthis.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new w(this,Uint8ClampedArray.from([0]));this.one=new w(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===a)throw Error("Can\'t invert 0");return this.expTable[this.size-this.logTable[a]-1]}buildMonomial(a,\nb){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new w(this,a)}log(a){if(0===a)throw Error("Can\'t take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}let K=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},\n{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,\ndataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},\n{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},\n{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},\n{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,\ndataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},\n{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},\n{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},\n{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,\necBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,\ndataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,\ndataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,\n32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},\n{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},\n{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,\ndataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},\n{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},\n{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,\n30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},\n{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,\ndataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,\ndataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,\ndataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}],da=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,\ndataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,\nformatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,\ndataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,\ndataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],aa=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2],y=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2)),la={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1},\ncanOverwriteImage:!0};I.default=I;let G="dontInvert",D={red:77,green:150,blue:29,useIntegerApproximation:!0};self.onmessage=a=>{let b=a.data.data;switch(a.data.type){case "decode":a=I(b.data,b.width,b.height,{inversionAttempts:G,greyScaleWeights:D});self.postMessage({type:"qrResult",data:a?a.data:null});break;case "grayscaleWeights":D.red=b.red;D.green=b.green;D.blue=b.blue;D.useIntegerApproximation=b.useIntegerApproximation;break;case "inversionMode":switch(b){case "original":G="dontInvert";break;\ncase "invert":G="onlyInvert";break;case "both":G="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}})()\n\n']))},xl=Wc((function(e,t,r){qc(e,t,r)})),Tl=In(),Pl=ne((function e(r){var n=this,i=r.container,o=r.lang,a=void 0===o?"vi":o,s=r.assetRoot,c=r.resourceRoot,l=r.customUrls,u=void 0===l?{}:l,d=r.enableAntiDebug,f=void 0===d||d,p=r.warmupMessage,h=r.baseComponent,m=r.component,g=void 0===m?{}:m,v=r.country,y=void 0===v?"vn":v,b=r.idCardContext,_=r.exifKey,C=void 0===_?"":_,k=r.themeVersion,S=void 0===k?"v2":k;te(this,e),ie(this,"getDeviceInfo",ee($().mark((function e(){var t,r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={id:null,udid:null,sn:null,imei:null,manufacturer:An(),deviceName:xn(),wlanMac:null,phoneNumber:null,location:{latitude:null,longitude:null}},e.next=3,Ba();case 3:return r=e.sent,t.location.latitude=(null==r?void 0:r.lat)||null,t.location.longitude=(null==r?void 0:r.long)||null,e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})))),ie(this,"initNativeCamera",(function(e){var r=document.createElement("div");document.body.appendChild(r);var i=t.createRef(),o=n.component.NativeCamera;return w.render(t.createElement(o,oe({},e,{ref:i})),r),{openCamera:function(){i.current.click()}}})),ie(this,"runWarmUpReadIDCard",ee($().mark((function e(){var t;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.commonSettings.customUrls,e.abrupt("return",n.component.warmUpReadIdCard(t));case 2:case"end":return e.stop()}}),e)})))),ie(this,"runPreloadEKYCResources",ee($().mark((function e(){var t;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.commonSettings.customUrls,n.component.preloadEKYCResources(t);case 2:case"end":return e.stop()}}),e)})))),ie(this,"destroyView",(function(){w.unmountComponentAtNode(n.container)})),function(e,t,r,n,i,o,a,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,i,o,a,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}(i,"container is a required parameter"),this.container=i,this.container.style="touch-action: none; -ms-touch-action: none;";var B=cn({resourceRoot:c,initCustomUrls:u,country:y});this.commonSettings=Y({lang:a,assetRoot:s,customUrls:B,enableAntiDebug:f,debug:!1,warmupMessage:p,country:y,exifKey:C,themeVersion:S},b),this.component=xl({},h,g)}),[{key:"checkCamera",value:function(){return(0,this.component.checkCamera)()}},{key:"getListCamera",value:function(){return(0,this.component.getListCamera)()}},{key:"readIDCardWithApiCall",value:function(e){var r=this.component.ReadIDCardWithApiCall,n=Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{});w.render(t.createElement(un,{value:Y({},this.commonSettings)},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:n}},t.createElement(r,oe({onClose:this.destroyView},e)))),this.container)}},{key:"readIDCardUIOnly",value:function(e){var r=this.component.ReadIDCardUIOnly,n=Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{});w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:n}},t.createElement(r,oe({onClose:this.destroyView},e)))),this.container)}},{key:"livenessDetection",value:function(e){var r=this.component,n=r.LivenessDetection,i=r.CustomComponent,o=Y(Y(Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{}),(null==e?void 0:e.customInstructions)||{}),(null==e?void 0:e.customMessages)||{});w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:o}},t.createElement(n,oe({onClose:this.destroyView},e,{customComponent:i})))),this.container)}},{key:"ekycFlow",value:function(e){var r=this.component.EkycFlow,n=(null==e?void 0:e.customTexts)||{};w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:n}},t.createElement(r,oe({onClose:this.destroyView},e)))),this.container)}},{key:"flashLiveness",value:function(e){var r=this.component.FlashLiveness;w.render(t.createElement(un,{value:this.commonSettings},t.createElement(r,oe({onClose:this.destroyView},e))),this.container)}},{key:"faceAuthentication",value:function(e){var r=this.component,n=r.FaceAuthentication,i=r.LivenessDetection,o=r.CustomComponent,a=Y(Y(Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{}),(null==e?void 0:e.customInstructions)||{}),(null==e?void 0:e.customMessages)||{});w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:a}},t.createElement(n,oe({onClose:this.destroyView},e,{livenessDetectionComponent:i,customComponent:o})))),this.container)}},{key:"compareFaces",value:function(e){var t=e.accessKey,r=e.secretKey,n=e.apiUrl,i=e.image1,o=e.image2,a=e.onSuccess,s=e.onError;La(new mn(t,r,n,{httpHeaders:Tl})).compareFaces({image1:{id:i},image2:{id:o}}).then((function(e){a(e)})).catch((function(e){s(e)}))}}]),Rl=In(),Dl=function(){return ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(te(this,e),t&&r&&n){var i=Wn({userId:""});this.apiClient=La(new mn(t,r,n,{httpHeaders:Y(Y({},Rl),{},{"x-request-id":i})}))}else this.apiClient=null;this.clientSettings=this.clientSettings.bind(this),this.uploadImage=this.uploadImage.bind(this),this.uploadFiles=this.uploadFiles.bind(this),this.requestVerifyIDCard=this.requestVerifyIDCard.bind(this),this.detectIDTampering=this.detectIDTampering.bind(this),this.readIDCard=this.readIDCard.bind(this),this.requestVerifyPortrait=this.requestVerifyPortrait.bind(this),this.verifyFaceLiveness=this.verifyFaceLiveness.bind(this),this.compareFaces=this.compareFaces.bind(this),this.searchFaces=this.searchFaces.bind(this),this.indexFaces=this.indexFaces.bind(this)}),[{key:"clientSettings",value:(u=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.clientSettings(t);case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"uploadImage",value:(l=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.uploadImage(t);case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"uploadFiles",value:(c=ee($().mark((function e(t){var r,n,i=arguments;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]?i[1]:{},!this.apiClient){e.next=6;break}return e.next=4,this.apiClient.httpClient.post("/v1/files",t,r);case 4:return n=e.sent,e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"requestVerifyIDCard",value:(s=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.requestVerifyIDCard(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"detectIDTampering",value:(a=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.detectIDTampering(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"readIDCard",value:(o=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.readIDCard(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"requestVerifyPortrait",value:(i=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.requestVerifyPortrait(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"verifyFaceLiveness",value:(n=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.verifyFaceLiveness(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"compareFaces",value:(r=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.compareFaces(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchFaces",value:(t=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.searchFaces(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"indexFaces",value:(e=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.indexFaces(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e,t,r,n,i,o,a,s,c,l,u}(),Ll="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Nl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ol(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var Fl=Ol((function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",c="major",l="model",u="name",d="type",f="vendor",p="version",h="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",_="embedded",C="Amazon",w="Apple",k="ASUS",S="BlackBerry",B="Firefox",E="Google",I="Huawei",A="LG",x="Microsoft",T="Motorola",P="Opera",R="Samsung",D="Sharp",L="Sony",N="Xiaomi",O="Zebra",F="Facebook",M="Chromium OS",V="Mac OS",U=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},j=function(e,t){return typeof e===s&&-1!==z(t).indexOf(z(e))},z=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,500)},H=function(e,t){for(var r,o,s,c,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!l&&f[r];)if(l=f[r++].exec(e))for(s=0;s<p.length;s++)u=l[++o],typeof(c=p[s])===a&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;d+=2}},K=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(j(t[r][i],e))return"?"===r?n:r}else if(j(t[r],e))return"?"===r?n:r;return e},W={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,P]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[u,"Smart Lenovo Browser"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure Browser"],p],[/\bfocus\/([\w\.]+)/i],[p,[u,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[p,[u,B]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 Browser"]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 Browser"],p],[/samsungbrowser\/([\w\.]+)/i],[p,[u,"Samsung Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/metasr[\/ ]?([\d\.]+)/i],[p,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,"Chrome WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,z]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[f,R],[d,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[f,R],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[f,w],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[f,w],[d,v]],[/(macintosh);/i],[l,[f,w]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[f,D],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[f,I],[d,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[f,I],[d,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[f,N],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[f,N],[d,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[f,"OPPO"],[d,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[f,"Vivo"],[d,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[f,"Realme"],[d,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[f,T],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[f,T],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[f,A],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[f,A],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[f,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[f,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[f,E],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[f,E],[d,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[f,L],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[f,L],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[f,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[f,C],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[f,C],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,f,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[f,S],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[f,k],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[f,k],[d,g]],[/(nexus 9)/i],[l,[f,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[l,/_/g," "],[d,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[f,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[f,"Meizu"],[d,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[f,"Ulefone"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,l,[d,g]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,l,[d,v]],[/(surface duo)/i],[l,[f,x],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[f,"Fairphone"],[d,g]],[/(u304aa)/i],[l,[f,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[l,[f,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[l,[f,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[l,[f,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[f,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[l,[f,"NuVision"],[d,v]],[/\b(k88) b/i],[l,[f,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[l,[f,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[l,[f,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[l,[f,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[l,[f,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],l,[d,v]],[/\b(ns-?\w{0,9}) b/i],[l,[f,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[f,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],l,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],l,[d,g]],[/\b(ph-1) /i],[l,[f,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[f,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[l,[f,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[l,[f,"Rotor"],[d,v]],[/(shield[\w ]+) b/i],[l,[f,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[f,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,x],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[f,O],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[f,O],[d,g]],[/smart-tv.+(samsung)/i],[f,[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,R],[d,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,A],[d,y]],[/(apple) ?tv/i],[f,[l,"Apple TV"],[d,y]],[/crkey/i],[[l,"Chromecast"],[f,E],[d,y]],[/droid.+aft(\w+)( bui|\))/i],[l,[f,C],[d,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[f,D],[d,y]],[/(bravia[\w ]+)( bui|\))/i],[l,[f,L],[d,y]],[/(mitv-\w{5}) bui/i],[l,[f,N],[d,y]],[/Hbbtv.*(technisat) (.*);/i],[f,l,[d,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[f,q],[l,q],[d,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,l,[d,m]],[/droid.+; (shield) bui/i],[l,[f,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[l,[f,L],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[f,x],[d,m]],[/((pebble))app/i],[f,l,[d,b]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[f,w],[d,b]],[/droid.+; (glass) \d/i],[l,[f,E],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[l,[f,O],[d,b]],[/(quest( 2| pro)?)/i],[l,[f,F],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,_]],[/(aeobc)\b/i],[l,[f,C],[d,_]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[p,K,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,K,W],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,V],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,"Chromecast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,M],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,p]]},Q=function(e,t){if(typeof e===a&&(t=e,e=n),!(this instanceof Q))return new Q(e,t).getResult();var c=typeof r!==o&&r.navigator?r.navigator:n,l=e||(c&&c.userAgent?c.userAgent:""),u=c&&c.userAgentData?c.userAgentData:n,d=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(G,t):G,f=c&&c.userAgent==l;return this.getBrowser=function(){var e,t={};return t.name=n,t.version=n,H.call(t,l,d.browser),t.major=typeof(e=t.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:n,f&&c&&c.brave&&typeof c.brave.isBrave==i&&(t.name="Brave"),t},this.getCPU=function(){var e={};return e.architecture=n,H.call(e,l,d.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,H.call(e,l,d.device),f&&!e.type&&u&&u.mobile&&(e.type=g),f&&"Macintosh"==e.model&&c&&typeof c.standalone!==o&&c.maxTouchPoints&&c.maxTouchPoints>2&&(e.model="iPad",e.type=v),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,H.call(e,l,d.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,H.call(e,l,d.os),f&&!e.name&&u&&"Unknown"!=u.platform&&(e.name=u.platform.replace(/chrome os/i,M).replace(/macos/i,V)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return l},this.setUA=function(e){return l=typeof e===s&&e.length>500?q(e,500):e,this},this.setUA(l),this};Q.VERSION="1.0.37",Q.BROWSER=U([u,p,c]),Q.CPU=U([h]),Q.DEVICE=U([l,f,d,m,g,y,v,b,_]),Q.ENGINE=Q.OS=U([u,p]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var X=typeof r!==o&&(r.jQuery||r.Zepto);if(X&&!X.ua){var Y=new Q;X.ua=Y.getResult(),X.ua.get=function(){return Y.getUA()},X.ua.set=function(e){Y.setUA(e);var t=Y.getResult();for(var r in t)X.ua[r]=t[r]}}}("object"==typeof window?window:Ll)})),Ml=Ol((function(e,r){Object.defineProperty(r,"__esModule",{value:!0});var n,i=(n=t)&&"object"==typeof n&&"default"in n?n.default:n,o=new Fl,a=o.getBrowser(),s=o.getCPU(),c=o.getDevice(),l=o.getEngine(),u=o.getOS(),d=o.getUA(),f=function(e){return o.setUA(e)},p=function(e){if(e){var t=new Fl(e);return{UA:t,browser:t.getBrowser(),cpu:t.getCPU(),device:t.getDevice(),engine:t.getEngine(),os:t.getOS(),ua:t.getUA(),setUserAgent:function(e){return t.setUA(e)}}}console.error("No userAgent string was provided")},h=Object.freeze({ClientUAInstance:o,browser:a,cpu:s,device:c,engine:l,os:u,ua:d,setUa:f,parseUserAgent:p});function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E="mobile",I="tablet",A="smarttv",x="console",T="wearable",P="embedded",R=void 0,D={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},L={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},N={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";return e||t},F=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},M=function(e){var t=F();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},V=function(e,t,r,n){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{vendor:O(t.vendor),model:O(t.model),os:O(r.name),osVersion:O(r.version),ua:O(n)})};var U=function(e){return e.type===E},j=function(e){return e.type===I},z=function(e){var t=e.type;return t===E||t===I},q=function(e){return e.type===A},H=function(e){return e.type===R},K=function(e){return e.type===T},W=function(e){return e.type===x},G=function(e){return e.type===P},Q=function(e){var t=e.vendor;return O(t)},X=function(e){var t=e.model;return O(t)},Y=function(e){var t=e.type;return O(t,"browser")},$=function(e){return e.name===L.Android},Z=function(e){return e.name===L.Windows},J=function(e){return e.name===L.MAC_OS},ee=function(e){return e.name===L.WindowsPhone},te=function(e){return e.name===L.IOS},re=function(e){var t=e.version;return O(t)},ne=function(e){var t=e.name;return O(t)},ie=function(e){return e.name===D.Chrome},oe=function(e){return e.name===D.Firefox},ae=function(e){return e.name===D.Chromium},se=function(e){return e.name===D.Edge},ce=function(e){return e.name===D.Yandex},le=function(e){var t=e.name;return t===D.Safari||t===D.MobileSafari},ue=function(e){return e.name===D.MobileSafari},de=function(e){return e.name===D.Opera},fe=function(e){var t=e.name;return t===D.InternetExplorer||t===D.Ie},pe=function(e){return e.name===D.MIUI},he=function(e){return e.name===D.SamsungBrowser},me=function(e){var t=e.version;return O(t)},ge=function(e){var t=e.major;return O(t)},ve=function(e){var t=e.name;return O(t)},ye=function(e){var t=e.name;return O(t)},be=function(e){var t=e.version;return O(t)},_e=function(){var e=F(),t=e&&e.userAgent&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)},Ce=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},we=function(){var e=F();return e&&(/iPad|iPhone|iPod/.test(e.platform)||"MacIntel"===e.platform&&e.maxTouchPoints>1)&&!window.MSStream},ke=function(){return M("iPad")},Se=function(){return M("iPhone")},Be=function(){return M("iPod")},Ee=function(e){return O(e)};function Ie(e){var t=e||h,r=t.device,n=t.browser,i=t.os,o=t.engine,a=t.ua;return{isSmartTV:q(r),isConsole:W(r),isWearable:K(r),isEmbedded:G(r),isMobileSafari:ue(n)||ke(),isChromium:ae(n),isMobile:z(r)||ke(),isMobileOnly:U(r),isTablet:j(r)||ke(),isBrowser:H(r),isDesktop:H(r),isAndroid:$(i),isWinPhone:ee(i),isIOS:te(i)||ke(),isChrome:ie(n),isFirefox:oe(n),isSafari:le(n),isOpera:de(n),isIE:fe(n),osVersion:re(i),osName:ne(i),fullBrowserVersion:me(n),browserVersion:ge(n),browserName:ve(n),mobileVendor:Q(r),mobileModel:X(r),engineName:ye(o),engineVersion:be(o),getUA:Ee(a),isEdge:se(n)||Ce(a),isYandex:ce(n),deviceType:Y(r),isIOS13:we(),isIPad13:ke(),isIPhone13:Se(),isIPod13:Be(),isElectron:_e(),isEdgeChromium:Ce(a),isLegacyEdge:se(n)&&!Ce(a),isWindows:Z(i),isMacOs:J(i),isMIUI:pe(n),isSamsungBrowser:he(n)}}var Ae=q(c),xe=W(c),Te=K(c),Pe=G(c),Re=ue(a)||ke(),De=ae(a),Le=z(c)||ke(),Ne=U(c),Oe=j(c)||ke(),Fe=H(c),Me=H(c),Ve=$(u),Ue=ee(u),je=te(u)||ke(),ze=ie(a),qe=oe(a),He=le(a),Ke=de(a),We=fe(a),Ge=re(u),Qe=ne(u),Xe=me(a),Ye=ge(a),$e=ve(a),Ze=Q(c),Je=X(c),et=ye(l),tt=be(l),rt=Ee(d),nt=se(a)||Ce(d),it=ce(a),ot=Y(c),at=we(),st=ke(),ct=Se(),lt=Be(),ut=_e(),dt=Ce(d),ft=se(a)&&!Ce(d),pt=Z(u),ht=J(u),mt=pe(a),gt=he(a);function vt(e){var t=e||window.navigator.userAgent;return p(t)}r.AndroidView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Ve?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.BrowserTypes=D,r.BrowserView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Fe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.ConsoleView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return xe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.CustomView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,e.condition),a=w(e,["renderWithFragment","children","viewClassName","style","condition"]);return o?r?i.createElement(t.Fragment,null,n):i.createElement("div",a,n):null},r.IEView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return We?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.IOSView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return je?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileOnlyView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,w(e,["renderWithFragment","children","viewClassName","style"]));return Ne?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Le?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.OsTypes=L,r.SmartTVView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Ae?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.TabletView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Oe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WearableView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Te?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WinPhoneView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Ue?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.browserName=$e,r.browserVersion=Ye,r.deviceDetect=function(e){var t=e?p(e):h,r=t.device,n=t.browser,i=t.engine,o=t.os,a=t.ua,s=function(e){switch(e){case E:return{isMobile:!0};case I:return{isTablet:!0};case A:return{isSmartTV:!0};case x:return{isConsole:!0};case T:return{isWearable:!0};case R:return{isBrowser:!0};case P:return{isEmbedded:!0};default:return N}}(r.type),c=s.isBrowser,l=s.isMobile,u=s.isTablet,d=s.isSmartTV,f=s.isConsole,m=s.isWearable,g=s.isEmbedded;return c?function(e,t,r,n,i){return{isBrowser:e,browserMajorVersion:O(t.major),browserFullVersion:O(t.version),browserName:O(t.name),engineName:O(r.name),engineVersion:O(r.version),osName:O(n.name),osVersion:O(n.version),userAgent:O(i)}}(c,n,i,o,a):d?function(e,t,r,n){return{isSmartTV:e,engineName:O(t.name),engineVersion:O(t.version),osName:O(r.name),osVersion:O(r.version),userAgent:O(n)}}(d,i,o,a):f?function(e,t,r,n){return{isConsole:e,engineName:O(t.name),engineVersion:O(t.version),osName:O(r.name),osVersion:O(r.version),userAgent:O(n)}}(f,i,o,a):l||u?V(s,r,o,a):m?function(e,t,r,n){return{isWearable:e,engineName:O(t.name),engineVersion:O(t.version),osName:O(r.name),osVersion:O(r.version),userAgent:O(n)}}(m,i,o,a):g?function(e,t,r,n,i){return{isEmbedded:e,vendor:O(t.vendor),model:O(t.model),engineName:O(r.name),engineVersion:O(r.version),osName:O(n.name),osVersion:O(n.version),userAgent:O(i)}}(g,r,i,o,a):void 0},r.deviceType=ot,r.engineName=et,r.engineVersion=tt,r.fullBrowserVersion=Xe,r.getSelectorsByUserAgent=function(e){if(e&&"string"==typeof e){var t=p(e);return Ie({device:t.device,browser:t.browser,os:t.os,engine:t.engine,ua:t.ua})}console.error("No valid user agent string was provided")},r.getUA=rt,r.isAndroid=Ve,r.isBrowser=Fe,r.isChrome=ze,r.isChromium=De,r.isConsole=xe,r.isDesktop=Me,r.isEdge=nt,r.isEdgeChromium=dt,r.isElectron=ut,r.isEmbedded=Pe,r.isFirefox=qe,r.isIE=We,r.isIOS=je,r.isIOS13=at,r.isIPad13=st,r.isIPhone13=ct,r.isIPod13=lt,r.isLegacyEdge=ft,r.isMIUI=mt,r.isMacOs=ht,r.isMobile=Le,r.isMobileOnly=Ne,r.isMobileSafari=Re,r.isOpera=Ke,r.isSafari=He,r.isSamsungBrowser=gt,r.isSmartTV=Ae,r.isTablet=Oe,r.isWearable=Te,r.isWinPhone=Ue,r.isWindows=pt,r.isYandex=it,r.mobileModel=Je,r.mobileVendor=Ze,r.osName=Qe,r.osVersion=Ge,r.parseUserAgent=p,r.setUserAgent=function(e){return f(e)},r.useDeviceData=vt,r.useDeviceSelectors=function(e){var t=vt(e||window.navigator.userAgent);return[Ie(t),t]},r.useMobileOrientation=function(){var e=S(t.useState((function(){var e=window.innerWidth>window.innerHeight?90:0;return{isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"}})),2),r=e[0],n=e[1],i=t.useCallback((function(){var e=window.innerWidth>window.innerHeight?90:0,t={isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"};r.orientation!==t.orientation&&n(t)}),[r.orientation]);return t.useEffect((function(){return void 0!==("undefined"==typeof window?"undefined":g(window))&&Le&&(i(),window.addEventListener("load",i,!1),window.addEventListener("resize",i,!1)),function(){window.removeEventListener("resize",i,!1),window.removeEventListener("load",i,!1)}}),[i]),r},r.withOrientationChange=function(e){return function(t){function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}(this,_(r).call(this,e))).isEventListenerAdded=!1,t.handleOrientationChange=t.handleOrientationChange.bind(k(t)),t.onOrientationChange=t.onOrientationChange.bind(k(t)),t.onPageLoad=t.onPageLoad.bind(k(t)),t.state={isLandscape:!1,isPortrait:!1},t}var n,o,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(r,t),n=r,(o=[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var e=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:0===e,isLandscape:90===e})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){void 0!==("undefined"==typeof window?"undefined":g(window))&&Le&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return i.createElement(e,b({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}])&&v(n.prototype,o),a&&v(n,a),r}(i.Component)}})),Vl=Nl(Ml),Ul=Object.freeze(Object.assign(Object.create(null),Ml,{default:Vl})),jl=Array.isArray,zl="object"==typeof Ll&&Ll&&Ll.Object===Object&&Ll,ql="object"==typeof self&&self&&self.Object===Object&&self,Hl=zl||ql||Function("return this")(),Kl=Hl.Symbol,Wl=Object.prototype,Gl=Wl.hasOwnProperty,Ql=Wl.toString,Xl=Kl?Kl.toStringTag:void 0;var Yl=function(e){var t=Gl.call(e,Xl),r=e[Xl];try{e[Xl]=void 0;var n=!0}catch(e){}var i=Ql.call(e);return n&&(t?e[Xl]=r:delete e[Xl]),i},$l=Object.prototype.toString;var Zl=function(e){return $l.call(e)},Jl=Kl?Kl.toStringTag:void 0;var eu=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Jl&&Jl in Object(e)?Yl(e):Zl(e)};var tu=function(e){return null!=e&&"object"==typeof e};var ru=function(e){return"symbol"==typeof e||tu(e)&&"[object Symbol]"==eu(e)},nu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iu=/^\w*$/;var ou=function(e,t){if(jl(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ru(e))||(iu.test(e)||!nu.test(e)||null!=t&&e in Object(t))};var au=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var su,cu=function(e){if(!au(e))return!1;var t=eu(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},lu=Hl["__core-js_shared__"],uu=(su=/[^.]+$/.exec(lu&&lu.keys&&lu.keys.IE_PROTO||""))?"Symbol(src)_1."+su:"";var du=function(e){return!!uu&&uu in e},fu=Function.prototype.toString;var pu=function(e){if(null!=e){try{return fu.call(e)}catch(e){}try{return e+""}catch(e){}}return""},hu=/^\[object .+?Constructor\]$/,mu=Function.prototype,gu=Object.prototype,vu=mu.toString,yu=gu.hasOwnProperty,bu=RegExp("^"+vu.call(yu).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _u=function(e){return!(!au(e)||du(e))&&(cu(e)?bu:hu).test(pu(e))};var Cu=function(e,t){return null==e?void 0:e[t]};var wu=function(e,t){var r=Cu(e,t);return _u(r)?r:void 0},ku=wu(Object,"create");var Su=function(){this.__data__=ku?ku(null):{},this.size=0};var Bu=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Eu=Object.prototype.hasOwnProperty;var Iu=function(e){var t=this.__data__;if(ku){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Eu.call(t,e)?t[e]:void 0},Au=Object.prototype.hasOwnProperty;var xu=function(e){var t=this.__data__;return ku?void 0!==t[e]:Au.call(t,e)};var Tu=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ku&&void 0===t?"__lodash_hash_undefined__":t,this};function Pu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Pu.prototype.clear=Su,Pu.prototype.delete=Bu,Pu.prototype.get=Iu,Pu.prototype.has=xu,Pu.prototype.set=Tu;var Ru=Pu;var Du=function(){this.__data__=[],this.size=0};var Lu=function(e,t){return e===t||e!=e&&t!=t};var Nu=function(e,t){for(var r=e.length;r--;)if(Lu(e[r][0],t))return r;return-1},Ou=Array.prototype.splice;var Fu=function(e){var t=this.__data__,r=Nu(t,e);return!(r<0)&&(r==t.length-1?t.pop():Ou.call(t,r,1),--this.size,!0)};var Mu=function(e){var t=this.__data__,r=Nu(t,e);return r<0?void 0:t[r][1]};var Vu=function(e){return Nu(this.__data__,e)>-1};var Uu=function(e,t){var r=this.__data__,n=Nu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function ju(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ju.prototype.clear=Du,ju.prototype.delete=Fu,ju.prototype.get=Mu,ju.prototype.has=Vu,ju.prototype.set=Uu;var zu=ju,qu=wu(Hl,"Map");var Hu=function(){this.size=0,this.__data__={hash:new Ru,map:new(qu||zu),string:new Ru}};var Ku=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Wu=function(e,t){var r=e.__data__;return Ku(t)?r["string"==typeof t?"string":"hash"]:r.map};var Gu=function(e){var t=Wu(this,e).delete(e);return this.size-=t?1:0,t};var Qu=function(e){return Wu(this,e).get(e)};var Xu=function(e){return Wu(this,e).has(e)};var Yu=function(e,t){var r=Wu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function $u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$u.prototype.clear=Hu,$u.prototype.delete=Gu,$u.prototype.get=Qu,$u.prototype.has=Xu,$u.prototype.set=Yu;var Zu=$u;function Ju(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Ju.Cache||Zu),r}Ju.Cache=Zu;var ed=Ju;var td=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rd=/\\(\\)?/g,nd=function(e){var t=ed(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(td,(function(e,r,n,i){t.push(n?i.replace(rd,"$1"):r||e)})),t}));var id=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},od=Kl?Kl.prototype:void 0,ad=od?od.toString:void 0;var sd=function e(t){if("string"==typeof t)return t;if(jl(t))return id(t,e)+"";if(ru(t))return ad?ad.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r};var cd=function(e){return null==e?"":sd(e)};var ld=function(e,t){return jl(e)?e:ou(e,t)?[e]:nd(cd(e))};var ud=function(e){if("string"==typeof e||ru(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var dd=function(e,t){for(var r=0,n=(t=ld(t,e)).length;null!=e&&r<n;)e=e[ud(t[r++])];return r&&r==n?e:void 0};var fd=function(e,t,r){var n=null==e?void 0:dd(e,t);return void 0===n?r:n},pd=/^\s+|\s+$/g,hd=/^[-+]0x[0-9a-f]+$/i,md=/^0b[01]+$/i,gd=/^0o[0-7]+$/i,vd=parseInt,yd="object"==typeof Ll&&Ll&&Ll.Object===Object&&Ll,bd="object"==typeof self&&self&&self.Object===Object&&self,_d=yd||bd||Function("return this")(),Cd=Object.prototype.toString,wd=Math.max,kd=Math.min,Sd=function(){return _d.Date.now()};function Bd(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ed(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Cd.call(e)}(e))return NaN;if(Bd(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Bd(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(pd,"");var r=md.test(e);return r||gd.test(e)?vd(e.slice(2),r?2:8):hd.test(e)?NaN:+e}var Id=function(e,t,r){var n,i,o,a,s,c,l=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,o=i;return n=i=void 0,l=t,a=e.apply(o,r)}function h(e){return l=e,s=setTimeout(g,t),u?p(e):a}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-l>=o}function g(){var e=Sd();if(m(e))return v(e);s=setTimeout(g,function(e){var r=t-(e-c);return d?kd(r,o-(e-l)):r}(e))}function v(e){return s=void 0,f&&n?p(e):(n=i=void 0,a)}function y(){var e=Sd(),r=m(e);if(n=arguments,i=this,c=e,r){if(void 0===s)return h(c);if(d)return s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),a}return t=Ed(t)||0,Bd(r)&&(u=!!r.leading,o=(d="maxWait"in r)?wd(Ed(r.maxWait)||0,t):o,f="trailing"in r?!!r.trailing:f),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,n=c=i=s=void 0},y.flush=function(){return void 0===s?a:v(Sd())},y},Ad="function"==typeof Symbol&&Symbol.for,xd=Ad?Symbol.for("react.element"):60103,Td=Ad?Symbol.for("react.portal"):60106,Pd=Ad?Symbol.for("react.fragment"):60107,Rd=Ad?Symbol.for("react.strict_mode"):60108,Dd=Ad?Symbol.for("react.profiler"):60114,Ld=Ad?Symbol.for("react.provider"):60109,Nd=Ad?Symbol.for("react.context"):60110,Od=Ad?Symbol.for("react.async_mode"):60111,Fd=Ad?Symbol.for("react.concurrent_mode"):60111,Md=Ad?Symbol.for("react.forward_ref"):60112,Vd=Ad?Symbol.for("react.suspense"):60113,Ud=Ad?Symbol.for("react.suspense_list"):60120,jd=Ad?Symbol.for("react.memo"):60115,zd=Ad?Symbol.for("react.lazy"):60116,qd=Ad?Symbol.for("react.block"):60121,Hd=Ad?Symbol.for("react.fundamental"):60117,Kd=Ad?Symbol.for("react.responder"):60118,Wd=Ad?Symbol.for("react.scope"):60119;
|
|
47
|
+
var sc={};void 0!==sc.asn1&&sc.asn1||(sc.asn1={}),sc.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var r=t.substr(1).length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";t=new Ls(n,16).xor(e).add(Ls.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=sc.asn1,r=t.DERBoolean,n=t.DERInteger,i=t.DERBitString,o=t.DEROctetString,a=t.DERNull,s=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,u=t.DERNumericString,d=t.DERPrintableString,f=t.DERTeletexString,p=t.DERIA5String,h=t.DERUTCTime,m=t.DERGeneralizedTime,g=t.DERSequence,v=t.DERSet,y=t.DERTaggedObject,b=t.ASN1Util.newObject,_=Object.keys(e);if(1!=_.length)throw"key of param shall be only one.";var C=_[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+C+":"))throw"undefined key: "+C;if("bool"==C)return new r(e[C]);if("int"==C)return new n(e[C]);if("bitstr"==C)return new i(e[C]);if("octstr"==C)return new o(e[C]);if("null"==C)return new a(e[C]);if("oid"==C)return new s(e[C]);if("enum"==C)return new c(e[C]);if("utf8str"==C)return new l(e[C]);if("numstr"==C)return new u(e[C]);if("prnstr"==C)return new d(e[C]);if("telstr"==C)return new f(e[C]);if("ia5str"==C)return new p(e[C]);if("utctime"==C)return new h(e[C]);if("gentime"==C)return new m(e[C]);if("seq"==C){for(var w=e[C],k=[],S=0;S<w.length;S++){var B=b(w[S]);k.push(B)}return new g({array:k})}if("set"==C){for(w=e[C],k=[],S=0;S<w.length;S++)B=b(w[S]),k.push(B);return new v({array:k})}if("tag"==C){var E=e[C];if("[object Array]"===Object.prototype.toString.call(E)&&3==E.length){var I=b(E[2]);return new y({tag:E[0],explicit:E[1],obj:I})}var A={};if(void 0!==E.explicit&&(A.explicit=E.explicit),void 0!==E.tag&&(A.tag=E.tag),void 0===E.obj)throw"obj shall be specified for 'tag'.";return A.obj=b(E.obj),new y(A)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},sc.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",r=parseInt(e.substr(0,2),16),n=(t=Math.floor(r/40)+"."+r%40,""),i=2;i<e.length;i+=2){var o=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);n+=o.substr(1,7),"0"==o.substr(0,1)&&(t=t+"."+new Ls(n,2).toString(10),n="")}return t},sc.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},r=function(e){var r="",n=new Ls(e,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=t(parseInt(s,2))}return r};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=t(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},sc.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 e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var r=t.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+r).toString(16)+t},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""}},sc.asn1.DERAbstractString=function(e){sc.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},ac.lang.extend(sc.asn1.DERAbstractString,sc.asn1.ASN1Object),sc.asn1.DERAbstractTime=function(e){sc.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+6e4*e.getTimezoneOffset(),new Date(utc)},this.formatDate=function(e,t,r){var n=this.zeroPadding,i=this.localDateToUTC(e),o=String(i.getFullYear());"utc"==t&&(o=o.substr(2,2));var a=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var s=i.getMilliseconds();if(0!=s){var c=n(String(s),3);a=a+"."+(c=c.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,r,n,i,o){var a=new Date(Date.UTC(e,t-1,r,n,i,o,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},ac.lang.extend(sc.asn1.DERAbstractTime,sc.asn1.ASN1Object),sc.asn1.DERAbstractStructured=function(e){sc.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},ac.lang.extend(sc.asn1.DERAbstractStructured,sc.asn1.ASN1Object),sc.asn1.DERBoolean=function(){sc.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},ac.lang.extend(sc.asn1.DERBoolean,sc.asn1.ASN1Object),sc.asn1.DERInteger=function(e){sc.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=sc.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Ls(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},ac.lang.extend(sc.asn1.DERInteger,sc.asn1.ASN1Object),sc.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=sc.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}sc.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var r="0"+e;this.hTLV=null,this.isModified=!0,this.hV=r+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var r=0;r<=t;r++)e+="0";var n="";for(r=0;r<e.length-1;r+=8){var i=e.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+n},this.setByBooleanArray=function(e){for(var t="",r=0;r<e.length;r++)1==e[r]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},ac.lang.extend(sc.asn1.DERBitString,sc.asn1.ASN1Object),sc.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=sc.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}sc.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},ac.lang.extend(sc.asn1.DEROctetString,sc.asn1.DERAbstractString),sc.asn1.DERNull=function(){sc.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},ac.lang.extend(sc.asn1.DERNull,sc.asn1.ASN1Object),sc.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},r=function(e){var r="",n=new Ls(e,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",a=0;a<i;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),r+=t(parseInt(s,2))}return r};sc.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=t(o),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(e){var t=sc.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},ac.lang.extend(sc.asn1.DERObjectIdentifier,sc.asn1.ASN1Object),sc.asn1.DEREnumerated=function(e){sc.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=sc.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Ls(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},ac.lang.extend(sc.asn1.DEREnumerated,sc.asn1.ASN1Object),sc.asn1.DERUTF8String=function(e){sc.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},ac.lang.extend(sc.asn1.DERUTF8String,sc.asn1.DERAbstractString),sc.asn1.DERNumericString=function(e){sc.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},ac.lang.extend(sc.asn1.DERNumericString,sc.asn1.DERAbstractString),sc.asn1.DERPrintableString=function(e){sc.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},ac.lang.extend(sc.asn1.DERPrintableString,sc.asn1.DERAbstractString),sc.asn1.DERTeletexString=function(e){sc.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},ac.lang.extend(sc.asn1.DERTeletexString,sc.asn1.DERAbstractString),sc.asn1.DERIA5String=function(e){sc.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},ac.lang.extend(sc.asn1.DERIA5String,sc.asn1.DERAbstractString),sc.asn1.DERUTCTime=function(e){sc.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(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=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},ac.lang.extend(sc.asn1.DERUTCTime,sc.asn1.DERAbstractTime),sc.asn1.DERGeneralizedTime=function(e){sc.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(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=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},ac.lang.extend(sc.asn1.DERGeneralizedTime,sc.asn1.DERAbstractTime),sc.asn1.DERSequence=function(e){sc.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++)e+=this.asn1Array[t].getEncodedHex();return this.hV=e,this.hV}},ac.lang.extend(sc.asn1.DERSequence,sc.asn1.DERAbstractStructured),sc.asn1.DERSet=function(e){sc.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var r=this.asn1Array[t];e.push(r.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},ac.lang.extend(sc.asn1.DERSet,sc.asn1.DERAbstractStructured),sc.asn1.DERTaggedObject=function(e){sc.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,r){this.hT=t,this.isExplicit=e,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.tag&&(this.hT=e.tag),void 0!==e.explicit&&(this.isExplicit=e.explicit),void 0!==e.obj&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},ac.lang.extend(sc.asn1.DERTaggedObject,sc.asn1.ASN1Object);var cc,lc=(cc=function(e,t){return(cc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}cc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),uc=function(e){function t(r){var n=e.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(t.hasPrivateKeyProperty(r)||t.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}return lc(t,e),t.prototype.parseKey=function(e){try{var t=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?function(e){var t;if(void 0===vs){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(vs={},t=0;t<16;++t)vs[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)vs[r.charAt(t)]=t;for(t=0;t<n.length;++t)vs[n.charAt(t)]=-1}var i=[],o=0,a=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if("="==s)break;if(-1!=(s=vs[s])){if(void 0===s)throw new Error("Illegal character at offset "+t);o|=s,++a>=2?(i[i.length]=o,o=0,a=0):o<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return i}(e):ws.unarmor(e),i=Ts.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){t=i.sub[1].getHexStringValue(),this.n=Us(t,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=Us(o,16);var a=i.sub[4].getHexStringValue();this.p=Us(a,16);var s=i.sub[5].getHexStringValue();this.q=Us(s,16);var c=i.sub[6].getHexStringValue();this.dmp1=Us(c,16);var l=i.sub[7].getHexStringValue();this.dmq1=Us(l,16);var u=i.sub[8].getHexStringValue();this.coeff=Us(u,16)}else{if(2!==i.sub.length)return!1;if(i.sub[0].sub){var d=i.sub[1].sub[0];t=d.sub[0].getHexStringValue(),this.n=Us(t,16),r=d.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else t=i.sub[0].getHexStringValue(),this.n=Us(t,16),r=i.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new sc.asn1.DERInteger({int:0}),new sc.asn1.DERInteger({bigint:this.n}),new sc.asn1.DERInteger({int:this.e}),new sc.asn1.DERInteger({bigint:this.d}),new sc.asn1.DERInteger({bigint:this.p}),new sc.asn1.DERInteger({bigint:this.q}),new sc.asn1.DERInteger({bigint:this.dmp1}),new sc.asn1.DERInteger({bigint:this.dmq1}),new sc.asn1.DERInteger({bigint:this.coeff})]};return new sc.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return bs(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new sc.asn1.DERSequence({array:[new sc.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new sc.asn1.DERNull]}),t=new sc.asn1.DERSequence({array:[new sc.asn1.DERInteger({bigint:this.n}),new sc.asn1.DERInteger({int:this.e})]}),r=new sc.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new sc.asn1.DERSequence({array:[e,r]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return bs(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(!e)return e;var r="(.{1,"+(t=t||64)+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(r,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return(e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return(e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},t.hasPublicKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(ic),dc=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new uc(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(_s(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return bs(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,r){try{return bs(this.getKey().sign(e,t,r))}catch(e){return!1}},e.prototype.verify=function(e,t,r){try{return this.getKey().verify(e,_s(t),r)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new uc,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version="3.3.0",e}(),fc=["-","-","-","-","-","B","E","G","I","N"," ","P","U","B","L","I","C"," ","K","E","Y","-","-","-","-","-","\n"," "," ","M","I","I","B","I","j","A","N","B","g","k","q","h","k","i","G","9","w","0","B","A","Q","E","F","A","A","O","C","A","Q","8","A","M","I","I","B","C","g","K","C","A","Q","E","A","z","7","v","7","a","s","x","M","n","j","L","3","/","j","G","E","d","M","3","T","\n"," "," ","j","0","h","X","b","h","r","/","m","N","2","B","m","j","/","Y","e","6","I","y","1","T","t","g","E","S","W","j","r","V","Y","Z","J","k","a","+","T","L","+","L","0","U","n","h","i","8","l","W","x","2","w","R","s","+","N","i","u","Y","f","g","+","B","U","b","\n"," "," ","s","e","y","L","j","G","B","q","N","t","z","x","H","Z","K","v","d","h","d","i","r","o","y","R","y","C","S","f","p","m","f","h","Q","C","P","s","K","q","/","y","k","1","m","A","e","/","9","1","W","Y","J","b","l","K","h","W","Y","q","W","0","2","I","G","/","\n"," "," ","g","h","r","z","0","b","i","Y","X","C","b","5","m","6","s","R","o","7","e","J","p","4","F","e","2","1","U","N","Q","W","O","o","y","V","2","M","9","o","+","n","G","l","0","P","+","V","A","I","z","q","Z","m","l","P","w","w","v","w","B","i","l","f","X","e","\n"," "," ","W","V","P","x","9","6","f","2","c","A","I","h","S","2","b","W","f","f","d","X","3","w","p","c","1","C","E","m","c","v","9","V","E","f","o","j","j","i","X","O","7","I","n","k","u","P","t","H","4","W","2","E","P","Z","0","8","C","z","3","+","e","Q","2","k","\n"," "," ","D","z","c","j","P","9","8","Q","T","p","u","w","2","E","X","C","S","1","w","s","k","Z","C","2","1","j","L","8","j","z","X","H","a","W","3","B","q","O","h","s","V","G","9","T","F","S","y","c","l","F","g","e","n","r","G","s","Z","i","t","h","l","l","K","/","\n"," "," ","t","Q","I","D","A","Q","A","B","\n"," "," ","-","-","-","-","-","E","N","D"," ","P","U","B","L","I","C"," ","K","E","Y","-","-","-","-","-"];function pc(e){return hc.apply(this,arguments)}function hc(){return(hc=ee($().mark((function e(t){var r,n,i;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.key,n=new TextEncoder,(i=n.encode(r)).reverse(),e.abrupt("return",crypto.subtle.digest("SHA-256",i));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mc(e){return se(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")}var gc=function(e){var t=e.base64,r=e.key;return new Promise((function(e){pc({key:r}).then((function(r){var n=function(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)})).buffer}(t);window.crypto.subtle.importKey("raw",r,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(t){e({hex:mc(t)})}))}))})).catch((function(t){console.error("EncryptBase64 error: ",t),e(t)}))}))},vc=function(e){var t=new dc,r=fc.join("");return t.setPublicKey(r),_s(t.encrypt(e))},yc=function(e,t){return new Promise((function(r){var n=(new TextEncoder).encode(e);window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(e){r({hex:mc(e)})})).catch((function(t){console.error("EncryptString error: ",t),r(e)}))}))};function bc(e,t){return _c.apply(this,arguments)}function _c(){return(_c=ee($().mark((function e(t,r){var n,i,o;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=t.slice(0,16),i=r.slice(-16),(o=new Uint8Array(32)).set(new Uint8Array(n),0),o.set(new Uint8Array(i),n.byteLength),e.abrupt("return",window.crypto.subtle.importKey("raw",o,"AES-GCM",!0,["encrypt","decrypt"]));case 9:return e.prev=9,e.t0=e.catch(0),console.error("combineKeys error: ",e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}var Cc,wc,kc,Sc=Object.freeze({__proto__:null,processKey:pc,encryptBase64:gc,encrypt:function(e){var t=e.blob,r=e.key;return new Promise((function(e){var n=new FileReader;n.onload=function(t){var n=t.target.result;pc({key:r}).then((function(t){window.crypto.subtle.importKey("raw",t,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(t){e({hex:mc(t)})}))}))}))},n.readAsArrayBuffer(t)}))},encryptWithRSAPublicKey:vc,encryptString:yc,combineKeys:bc}),Bc=function(){var e=ee($().mark((function e(t,r){var n,i,o,a,s,c,l,u,d;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",new Promise((function(e){return e(null)})));case 2:return e.prev=2,e.next=5,pc({key:r});case 5:return n=e.sent,e.next=8,window.crypto.subtle.importKey("raw",n,"AES-GCM",!0,["encrypt","decrypt"]);case 8:return i=e.sent,e.next=11,window.crypto.subtle.exportKey("raw",i);case 11:return o=e.sent,a=wn().replace(/-/g,""),s=new TextEncoder,c=s.encode(a),e.next=17,bc(o,c);case 17:return l=e.sent,e.next=20,yc(t,l);case 20:return u=e.sent,e.next=23,vc(a);case 23:return d=e.sent,e.abrupt("return","".concat(u.hex,"::").concat(d));case 27:return e.prev=27,e.t0=e.catch(2),console.error("encryptFrameMetadata error: ",e.t0),e.abrupt("return",t);case 31:case"end":return e.stop()}}),e,null,[[2,27]])})));return function(t,r){return e.apply(this,arguments)}}(),Ec=Object.freeze({__proto__:null,encryptFrameBase64:function(e,t){return new Promise(e?function(r){gc({base64:e,key:t}).then((function(e){r(e.hex)})).catch((function(t){console.error("encryptFrameBase64 error: ",t),r(e)}))}:function(e){return e(null)})},encryptFrameMetadata:Bc}),Ic=ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;te(this,e),this.interval=t,this.second=0,this.timeStone={origin:0},this.callbacks={}}),[{key:"duration",value:function(e){return Object.prototype.hasOwnProperty.call(this.timeStone,e)?this.second-this.timeStone[e]:-1}},{key:"start",value:function(e,t){var r=this;e||this.timerID||(this.callbacks.origin=t,this.timerID=setInterval((function(){r.second++,Object.keys(r.timeStone).map((function(e){return"function"==typeof r.callbacks[e]&&r.callbacks[e](r.duration(e)),0}))}),this.interval)),Object.prototype.hasOwnProperty.call(this.timeStone,e)||e&&(this.timeStone[e]=this.second,this.callbacks[e]=t)}},{key:"stop",value:function(){clearInterval(this.timerID),this.timerID=void 0,this.second=0,this.timeStone={origin:0},this.callbacks={}}}]),Ac=ye((function(e,t){!function(){var r={};function n(e){return d(">"+p("B",e.length),e)}function i(e){return d(">"+p("H",e.length),e)}function o(e){return d(">"+p("L",e.length),e)}function a(e,t,r){var a,s,c,l,u="",f="";if("Byte"==t)(a=e.length)<=4?f=n(e)+p("\0",4-a):(f=d(">L",[r]),u=n(e));else if("Short"==t)(a=e.length)<=2?f=i(e)+p("\0\0",2-a):(f=d(">L",[r]),u=i(e));else if("Long"==t)(a=e.length)<=1?f=o(e):(f=d(">L",[r]),u=o(e));else if("Ascii"==t)(a=(s=e+"\0").length)>4?(f=d(">L",[r]),u=s):f=s+p("\0",4-a);else if("Rational"==t){if("number"==typeof e[0])a=1,c=e[0],l=e[1],s=d(">L",[c])+d(">L",[l]);else{a=e.length,s="";for(var h=0;h<a;h++)c=e[h][0],l=e[h][1],s+=d(">L",[c])+d(">L",[l])}f=d(">L",[r]),u=s}else if("SRational"==t){if("number"==typeof e[0])a=1,c=e[0],l=e[1],s=d(">l",[c])+d(">l",[l]);else for(a=e.length,s="",h=0;h<a;h++)c=e[h][0],l=e[h][1],s+=d(">l",[c])+d(">l",[l]);f=d(">L",[r]),u=s}else"Undefined"==t&&((a=e.length)>4?(f=d(">L",[r]),u=e):f=e+p("\0",4-a));return[d(">L",[a]),f,u]}function s(e,t,r){var n,i=Object.keys(e).length,o=d(">H",[i]);n=["0th","1st"].indexOf(t)>-1?2+12*i+4:2+12*i;var s="",c="";for(var l in e)if("string"==typeof l&&(l=parseInt(l)),!("0th"==t&&[34665,34853].indexOf(l)>-1||"Exif"==t&&40965==l||"1st"==t&&[513,514].indexOf(l)>-1)){var u=e[l],f=d(">H",[l]),p=g[t][l].type,h=d(">H",[m[p]]);"number"==typeof u&&(u=[u]);var v=a(u,p,8+n+r+c.length);s+=f+h+v[0]+v[1],c+=v[2]}return[o+s,c]}function c(e){var t;if("ÿØ"==e.slice(0,2))t=function(e){for(var t,r=0;r<e.length;r++)if("ÿá"==(t=e[r]).slice(0,2)&&"Exif\0\0"==t.slice(4,10))return t;return null}(h(e)),this.tiftag=t?t.slice(10):null;else if(["II","MM"].indexOf(e.slice(0,2))>-1)this.tiftag=e;else{if("Exif"!=e.slice(0,4))throw new Error("Given file is neither JPEG nor TIFF.");this.tiftag=e.slice(6)}}if(r.version="1.0.4",r.remove=function(e){var t=!1;if("ÿØ"==e.slice(0,2));else{if("data:image/jpeg;base64,"!=e.slice(0,23)&&"data:image/jpg;base64,"!=e.slice(0,22))throw new Error("Given data is not jpeg.");e=u(e.split(",")[1]),t=!0}var r=h(e).filter((function(e){return!("ÿá"==e.slice(0,2)&&"Exif\0\0"==e.slice(4,10))})).join("");return t&&(r="data:image/jpeg;base64,"+l(r)),r},r.insert=function(e,t){var r=!1;if("Exif\0\0"!=e.slice(0,6))throw new Error("Given data is not exif.");if("ÿØ"==t.slice(0,2));else{if("data:image/jpeg;base64,"!=t.slice(0,23)&&"data:image/jpg;base64,"!=t.slice(0,22))throw new Error("Given data is not jpeg.");t=u(t.split(",")[1]),r=!0}var n="ÿá"+d(">H",[e.length+2])+e,i=function(e,t){var r=!1,n=[];return e.forEach((function(i,o){"ÿá"==i.slice(0,2)&&"Exif\0\0"==i.slice(4,10)&&(r?n.unshift(o):(e[o]=t,r=!0))})),n.forEach((function(t){e.splice(t,1)})),!r&&t&&(e=[e[0],t].concat(e.slice(1))),e.join("")}(h(t),n);return r&&(i="data:image/jpeg;base64,"+l(i)),i},r.load=function(e){var t;if("string"!=typeof e)throw new Error("'load' gots invalid type argument.");if("ÿØ"==e.slice(0,2))t=e;else if("data:image/jpeg;base64,"==e.slice(0,23)||"data:image/jpg;base64,"==e.slice(0,22))t=u(e.split(",")[1]);else{if("Exif"!=e.slice(0,4))throw new Error("'load' gots invalid file data.");t=e.slice(6)}var r={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null},n=new c(t);if(null===n.tiftag)return r;"II"==n.tiftag.slice(0,2)?n.endian_mark="<":n.endian_mark=">";var i=f(n.endian_mark+"L",n.tiftag.slice(4,8))[0];r["0th"]=n.get_ifd(i,"0th");var o=r["0th"].first_ifd_pointer;if(delete r["0th"].first_ifd_pointer,34665 in r["0th"]&&(i=r["0th"][34665],r.Exif=n.get_ifd(i,"Exif")),34853 in r["0th"]&&(i=r["0th"][34853],r.GPS=n.get_ifd(i,"GPS")),40965 in r.Exif&&(i=r.Exif[40965],r.Interop=n.get_ifd(i,"Interop")),"\0\0\0\0"!=o&&(i=f(n.endian_mark+"L",o)[0],r["1st"]=n.get_ifd(i,"1st"),513 in r["1st"]&&514 in r["1st"])){var a=r["1st"][513]+r["1st"][514],s=n.tiftag.slice(r["1st"][513],a);r.thumbnail=s}return r},r.dump=function(e){var t,n,i,o,a,c,l=(t=e,JSON.parse(JSON.stringify(t))),u=!1,f=!1,p=!1,g=!1;n="0th"in l?l["0th"]:{},"Exif"in l&&Object.keys(l.Exif).length||"Interop"in l&&Object.keys(l.Interop).length?(n[34665]=1,u=!0,i=l.Exif,"Interop"in l&&Object.keys(l.Interop).length?(i[40965]=1,p=!0,o=l.Interop):Object.keys(i).indexOf(r.ExifIFD.InteroperabilityTag.toString())>-1&&delete i[40965]):Object.keys(n).indexOf(r.ImageIFD.ExifTag.toString())>-1&&delete n[34665],"GPS"in l&&Object.keys(l.GPS).length?(n[r.ImageIFD.GPSTag]=1,f=!0,a=l.GPS):Object.keys(n).indexOf(r.ImageIFD.GPSTag.toString())>-1&&delete n[r.ImageIFD.GPSTag],"1st"in l&&"thumbnail"in l&&null!=l.thumbnail&&(g=!0,l["1st"][513]=1,l["1st"][514]=1,c=l["1st"]);var v,y,b,_=s(n,"0th",0),C=_[0].length+12*u+12*f+4+_[1].length,w="",k=0,S="",B=0,E="",I=0,A="";if(u&&(k=(v=s(i,"Exif",C))[0].length+12*p+v[1].length),f&&(B=(S=s(a,"GPS",C+k).join("")).length),p&&(I=(E=s(o,"Interop",C+k+B).join("")).length),g&&(y=s(c,"1st",C+k+B+I),(b=function(e){for(var t=h(e);"ÿà"<=t[1].slice(0,2)&&t[1].slice(0,2)<="ÿï";)t=[t[0]].concat(t.slice(2));return t.join("")}(l.thumbnail)).length>64e3))throw new Error("Given thumbnail is too large. max 64kB");var x="",T="",P="",R="\0\0\0\0";if(u){var D=d(">L",[L=8+C]);x=d(">H",[34665])+d(">H",[m.Long])+d(">L",[1])+D}if(f&&(D=d(">L",[L=8+C+k]),T=d(">H",[34853])+d(">H",[m.Long])+d(">L",[1])+D),p&&(D=d(">L",[L=8+C+k+B]),P=d(">H",[40965])+d(">H",[m.Long])+d(">L",[1])+D),g){var L;R=d(">L",[L=8+C+k+B+I]);var N="\0\0\0\0"+d(">L",[L+y[0].length+24+4+y[1].length]),O="\0\0\0\0"+d(">L",[b.length]);A=y[0]+N+O+"\0\0\0\0"+y[1]+b}var F=_[0]+x+T+R+_[1];return u&&(w=v[0]+P+v[1]),"Exif\0\0MM\0*\0\0\0\b"+F+w+S+E+A},c.prototype={get_ifd:function(e,t){var r,n={},i=f(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],o=e+2;r=["0th","1st"].indexOf(t)>-1?"Image":t;for(var a=0;a<i;a++){e=o+12*a;var s=f(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],c=[f(this.endian_mark+"H",this.tiftag.slice(e+2,e+4))[0],f(this.endian_mark+"L",this.tiftag.slice(e+4,e+8))[0],this.tiftag.slice(e+8,e+12)];s in g[r]&&(n[s]=this.convert_value(c))}return"0th"==t&&(e=o+12*i,n.first_ifd_pointer=this.tiftag.slice(e,e+4)),n},convert_value:function(e){var t,r=null,n=e[0],i=e[1],o=e[2];if(1==n)i>4?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("B",i),this.tiftag.slice(t,t+i))):r=f(this.endian_mark+p("B",i),o.slice(0,i));else if(2==n)i>4?(t=f(this.endian_mark+"L",o)[0],r=this.tiftag.slice(t,t+i-1)):r=o.slice(0,i-1);else if(3==n)i>2?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("H",i),this.tiftag.slice(t,t+2*i))):r=f(this.endian_mark+p("H",i),o.slice(0,2*i));else if(4==n)i>1?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("L",i),this.tiftag.slice(t,t+4*i))):r=f(this.endian_mark+p("L",i),o);else if(5==n)if(t=f(this.endian_mark+"L",o)[0],i>1){r=[];for(var a=0;a<i;a++)r.push([f(this.endian_mark+"L",this.tiftag.slice(t+8*a,t+4+8*a))[0],f(this.endian_mark+"L",this.tiftag.slice(t+4+8*a,t+8+8*a))[0]])}else r=[f(this.endian_mark+"L",this.tiftag.slice(t,t+4))[0],f(this.endian_mark+"L",this.tiftag.slice(t+4,t+8))[0]];else if(7==n)i>4?(t=f(this.endian_mark+"L",o)[0],r=this.tiftag.slice(t,t+i)):r=o.slice(0,i);else if(9==n)i>1?(t=f(this.endian_mark+"L",o)[0],r=f(this.endian_mark+p("l",i),this.tiftag.slice(t,t+4*i))):r=f(this.endian_mark+p("l",i),o);else{if(10!=n)throw new Error("Exif might be wrong. Got incorrect value type to decode. type:"+n);if(t=f(this.endian_mark+"L",o)[0],i>1)for(r=[],a=0;a<i;a++)r.push([f(this.endian_mark+"l",this.tiftag.slice(t+8*a,t+4+8*a))[0],f(this.endian_mark+"l",this.tiftag.slice(t+4+8*a,t+8+8*a))[0]]);else r=[f(this.endian_mark+"l",this.tiftag.slice(t,t+4))[0],f(this.endian_mark+"l",this.tiftag.slice(t+4,t+8))[0]]}return r instanceof Array&&1==r.length?r[0]:r}},"undefined"!=typeof window&&"function"==typeof window.btoa)var l=window.btoa;if(void 0===l&&(l=function(e){for(var t,r,n,i,o,a,s,c="",l=0,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";l<e.length;)i=(t=e.charCodeAt(l++))>>2,o=(3&t)<<4|(r=e.charCodeAt(l++))>>4,a=(15&r)<<2|(n=e.charCodeAt(l++))>>6,s=63&n,isNaN(r)?a=s=64:isNaN(n)&&(s=64),c=c+u.charAt(i)+u.charAt(o)+u.charAt(a)+u.charAt(s);return c}),"undefined"!=typeof window&&"function"==typeof window.atob)var u=window.atob;function d(e,t){if(!(t instanceof Array))throw new Error("'pack' error. Got invalid type argument.");if(e.length-1!=t.length)throw new Error("'pack' error. "+(e.length-1)+" marks, "+t.length+" elements.");var r;if("<"==e[0])r=!0;else{if(">"!=e[0])throw new Error("");r=!1}for(var n="",i=1,o=null,a=null,s=null;a=e[i];){if("b"==a.toLowerCase()){if(o=t[i-1],"b"==a&&o<0&&(o+=256),o>255||o<0)throw new Error("'pack' error.");s=String.fromCharCode(o)}else if("H"==a){if((o=t[i-1])>65535||o<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256),r&&(s=s.split("").reverse().join(""))}else{if("l"!=a.toLowerCase())throw new Error("'pack' error.");if(o=t[i-1],"l"==a&&o<0&&(o+=4294967296),o>4294967295||o<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(o/16777216))+String.fromCharCode(Math.floor(o%16777216/65536))+String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256),r&&(s=s.split("").reverse().join(""))}n+=s,i+=1}return n}function f(e,t){if("string"!=typeof t)throw new Error("'unpack' error. Got invalid type argument.");for(var r,n=0,i=1;i<e.length;i++)if("b"==e[i].toLowerCase())n+=1;else if("h"==e[i].toLowerCase())n+=2;else{if("l"!=e[i].toLowerCase())throw new Error("'unpack' error. Got invalid mark.");n+=4}if(n!=t.length)throw new Error("'unpack' error. Mismatch between symbol and string length. "+n+":"+t.length);if("<"==e[0])r=!0;else{if(">"!=e[0])throw new Error("'unpack' error.");r=!1}for(var o=[],a=0,s=1,c=null,l=null,u=null,d="";l=e[s];){if("b"==l.toLowerCase())u=1,c=(d=t.slice(a,a+u)).charCodeAt(0),"b"==l&&c>=128&&(c-=256);else if("H"==l)u=2,d=t.slice(a,a+u),r&&(d=d.split("").reverse().join("")),c=256*d.charCodeAt(0)+d.charCodeAt(1);else{if("l"!=l.toLowerCase())throw new Error("'unpack' error. "+l);u=4,d=t.slice(a,a+u),r&&(d=d.split("").reverse().join("")),c=16777216*d.charCodeAt(0)+65536*d.charCodeAt(1)+256*d.charCodeAt(2)+d.charCodeAt(3),"l"==l&&c>=2147483648&&(c-=4294967296)}o.push(c),a+=u,s+=1}return o}function p(e,t){for(var r="",n=0;n<t;n++)r+=e;return r}function h(e){if("ÿØ"!=e.slice(0,2))throw new Error("Given data isn't JPEG.");for(var t=2,r=["ÿØ"];;){if("ÿÚ"==e.slice(t,t+2)){r.push(e.slice(t));break}var n=t+f(">H",e.slice(t+2,t+4))[0]+2;if(r.push(e.slice(t,n)),(t=n)>=e.length)throw new Error("Wrong JPEG data.")}return r}void 0===u&&(u=function(e){var t,r,n,i,o,a,s="",c=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<e.length;)t=l.indexOf(e.charAt(c++))<<2|(i=l.indexOf(e.charAt(c++)))>>4,r=(15&i)<<4|(o=l.indexOf(e.charAt(c++)))>>2,n=(3&o)<<6|(a=l.indexOf(e.charAt(c++))),s+=String.fromCharCode(t),64!=o&&(s+=String.fromCharCode(r)),64!=a&&(s+=String.fromCharCode(n));return s});var m={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10},g={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};g["0th"]=g.Image,g["1st"]=g.Image,r.TAGS=g,r.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041},r.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240},r.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31},r.InteropIFD={InteroperabilityIndex:1},r.GPSHelper={degToDmsRational:function(e){var t=Math.abs(e),r=t%1*60,n=r%1*60;return[[Math.floor(t),1],[Math.floor(r),1],[Math.round(100*n),100]]},dmsRationalToDeg:function(e,t){var r="S"===t||"W"===t?-1:1;return(e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600)*r}},e.exports&&(t=e.exports=r),t.piexif=r}()})),xc=function(e,t,r){return null==e?e:function(e,t,r,n){if(!Pe(e))return e;for(var i=-1,o=(t=Lr(t,e)).length,a=o-1,s=e;null!=s&&++i<o;){var c=Nr(t[i]),l=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=a){var u=s[c];void 0===(l=n?n(u,c,s):void 0)&&(l=Pe(u)?u:vt(t[i+1])?[]:{})}ot(s,c,l),s=s[c]}return e}(e,t,r)},Tc={},Pc={SELFIE:"selfie",ID_CARD:"id_card"},Rc=es((function(e){var t=new dc,r=e||fc.join("");return t.setPublicKey(r),t})),Dc=function(e){var t=e.gesture,r=e.captureTime,n=e.frames,i=e.blurScore,o=e.selfieLabel,a=e.brightnessScore,s=e.accelerometer,c=e.gyroscope;return{capture_time:r,type:t,frames:n,blur_score:i,selfie_label:o,qualify_score:e.qualifyScore,accelerometer:s,gyroscope:c,brightness_score:a}},Lc=function(e){var t=e.detectedCard,r=e.captureTime,n=e.vCam,i=e.captureCount,o=e.captureDuration,a=e.captureType,s=e.cardTracking;return{capture_time:r,type:null==t?void 0:t.label,v_cam:n,capture_count:i,capture_duration:o,capture_type:a,card_tracking:s}},Nc=function(){var e=ee($().mark((function e(t,r){var n;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(e){return se(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")},e.abrupt("return",new Promise((function(e){var i=new TextEncoder,o=i.encode(t),a=i.encode(r);window.crypto.subtle.importKey("raw",a,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,o).then((function(t){e("".concat(kc,".").concat(n(t)))}))}))})));case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),Oc=function(){var e=ee($().mark((function e(t){var r,n,i,o,a,s,c,l,u;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.mode,i=t.imageData,t.enableExifData){e.next=3;break}return e.abrupt("return",new Promise((function(e){return e(i.blob)})));case 3:return o=Y(Y({},Tc),n===Pc.SELFIE?Dc(i):Lc(i)),a=Y(Y({},o),{},{sensor_data:"sensor data exceed 64KB"}),null!=i&&null!==(r=i.type)&&void 0!==r&&r.includes("qr")&&(o={capture_time:null==i?void 0:i.captureTime,type:null==i?void 0:i.type,qr_string:null==i?void 0:i.result}),e.next=8,Nc(JSON.stringify(a),wc);case 8:return s=e.sent,e.next=11,Nc(JSON.stringify(o),wc);case 11:return c=e.sent,l=Ac.dump({Exif:ie({},Ac.ExifIFD.MakerNote,c)}),u=Ac.dump({Exif:ie({},Ac.ExifIFD.MakerNote,s)}),e.abrupt("return",new Promise((function(e){var t=new FileReader;t.onload=function(){var t=ee($().mark((function t(r){var n,o,a;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{n=Ac.insert(l,r.target.result)}catch(t){try{n=Ac.insert(u,r.target.result)}catch(t){e(i.blob)}}return t.prev=1,t.next=4,fetch(n);case 4:return o=t.sent,t.next=7,o.blob();case 7:a=t.sent,URL.revokeObjectURL(n),e(a),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(1),e(i.blob);case 15:case"end":return t.stop()}}),t,null,[[1,12]])})));return function(e){return t.apply(this,arguments)}}(),t.readAsDataURL(i.blob)})));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Fc=Object.freeze({__proto__:null,MODE:Pc,initExifData:function(){Tc={device_info:{device_brand_name:"".concat("none"===Bn.mobileVendor?"null":Bn.mobileVendor),device_model:"".concat("none"===Bn.mobileModel?"null":Bn.mobileModel),browser_version:"".concat(Bn.browserName," ").concat(Bn.browserVersion),browser_userAgent:"".concat(Bn.getUA),os:Bn.osName,os_version:Bn.osVersion},sdk_version:"5.24.3",model_score:{id_blurry_score:"null",id_glare_score:"null"},user_action:{}}},addExifData:function(e,t){xc(Tc,e,t)},preWriteExif:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mode,r=(e.motionData,e.orientationData,e.startTime),n=e.endTime,i=e.exifKey,o=void 0===i?"":i;Tc.user_action=Y({},t===Pc.SELFIE?{start_selfie:r,end_selfie:n}:{start_id_card:r,end_id_card:n}),wc=wn().replace(/-/g,""),Cc||(Cc=Rc(o)),kc=_s(Cc.encrypt(wc))},writeExif:Oc}),Mc=function(e,t,r){var n=null==e?void 0:Or(e,t);return void 0===n?r:n},Vc=function(e,t,r){(void 0!==r&&!fe(e[t],r)||void 0===r&&!(t in e))&&nt(e,t,r)},Uc=function(e,t,r){for(var n=-1,i=Object(e),o=r(e),a=o.length;a--;){var s=o[++n];if(!1===t(i[s],s,i))break}return e},jc=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},zc=function(e,t,r,n,i,o,a){var s=jc(e,r),c=jc(t,r),l=a.get(c);if(l)Vc(e,r,l);else{var u=o?o(s,c,r+"",e,t,a):void 0,d=void 0===u;if(d){var f=pt(c),p=!f&&mt(c),h=!f&&!p&&kt(c);u=c,f||p||h?pt(s)?u=s:function(e){return st(e)&&Pt(e)}(s)?u=Ft(s):p?(d=!1,u=Ot(c,!0)):h?(d=!1,u=dr(c,!0)):u=[]:Hr(c)||ft(c)?(u=s,ft(s)?u=function(e){return at(e,Nt(e))}(s):Pe(s)&&!Re(s)||(u=mr(c))):d=!1}d&&(a.set(c,u),i(u,c,n,o,a),a.delete(c)),Vc(e,r,u)}},qc=function e(t,r,n,i,o){t!==r&&Uc(r,(function(a,s){if(o||(o=new tt),Pe(a))zc(t,r,s,n,e,i,o);else{var c=i?i(jc(t,s),a,s+"",t,r,o):void 0;void 0===c&&(c=a),Vc(t,s,c)}}),Nt)},Hc=function(e,t){return nn(Zr(e,t,en),e+"")},Kc=function(e,t,r){if(!Pe(r))return!1;var n=x(t);return!!("number"==n?Pt(r)&&vt(t,r.length):"string"==n&&t in r)&&fe(r[t],e)},Wc=function(e){return Hc((function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&Kc(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t}))},Gc=Wc((function(e,t,r,n){qc(e,t,r,n)})),Qc={enableGetClientSettings:!0,enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0,enableRegisterFace:!0,enableAuthenticateFace:!0},Xc=Object.freeze({__proto__:null,getEnabledServices:function(e,t){var r=function(e){if(!e)return Qc;var t=e.enableUploadFrames,r=e.enableUploadImages,n=void 0===r||r,i=e.enableGetClientSettings,o=n&&e.enableVerifySanityPortrait,a=n&&e.enableVerifySanityIDCard,s=n&&e.enableDetectIDCardTampering,c=n&&e.enableReadIDCardInfo;return{enableGetClientSettings:i,enableUploadFrames:t,enableUploadImages:n,enableVerifySanityPortrait:o,enableVerifySanityIDCard:a,enableVerifyFaceLiveness:n&&e.enableVerifyFaceLiveness,enableDetectIDCardTampering:s,enableReadIDCardInfo:c,enableRegisterFace:n&&e.enableRegisterFace,enableAuthenticateFace:n&&e.enableAuthenticateFace}}(e),n=function(e){return{enableGetClientSettings:!0,enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:Mc(e,"data.settings.enable_verify_portrait_sanity",!0),enableVerifySanityIDCard:Mc(e,"data.settings.enable_verify_id_card_sanity",!0),enableVerifyFaceLiveness:Mc(e,"data.settings.enable_verify_face_liveness",!0),enableDetectIDCardTampering:Mc(e,"data.settings.enable_detect_id_card_tampering",!0),enableReadIDCardInfo:Mc(e,"data.settings.enable_read_id_card_info",!0),enableRegisterFace:Mc(e,"data.settings.enable_face_registration",!0),enableAuthenticateFace:Mc(e,"data.settings.enable_face_authentication",!0)}}(t),i=Y({},Qc);return Gc(i,r,n,(function(e,t){return(null==e||e)&&(null==t||t)}))}}),Yc=function(e){var t=e.slice(0,2),r=e.slice(2,4),n=e.slice(4,8);return new Date("".concat(n,"-").concat(r,"-").concat(t))},$c=function(e){return!Number.isNaN(e.getTime())&&e<=new Date},Zc={CCCD:{validate:function(e){var t=e.split("|"),r=Yc(t[3]),n=Yc(t[6]);return 7===t.length&&Boolean(e.match(/^\d{12}\|(\d{9})?\|.+\|\d{8}\|((Nam)|(Nữ))\|.+\|\d{8}$/g))&&$c(r)&&$c(n)&&r<n}},TCC:{validate:function(e){var t=e.split("|"),r=Yc(t[3]),n=Yc(t[6]);return 11===t.length&&Boolean(e.match(/^\d{12}\|(\d{9})?\|.+\|\d{8}\|((Nam)|(Nữ))\|.+\|\d{8}/g))&&$c(r)&&$c(n)&&r<n}}},Jc=Object.freeze({__proto__:null,validateIdQRContent:function(e){var t=function(e){var t=e[6];if(!t||8!==t.length)return null;var r=Yc(t);return $c(r)?r>=new Date("2024-07-01")?Zc.TCC:Zc.CCCD:null}(e.split("|"));return t?{valid:t.validate(e)}:{valid:!1}}}),el="https://cdn.jsdelivr.net/npm/@tsocial/tv_web_sdk_resources@2.0.2/models/close-eyes/closed_eye_detector.tflite",tl=function(){return ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:el,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.342,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:368,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;te(this,e),this.model_path=t,this.threshold=r,this.size=Math.round(n/2),this.enable_profiling=i,this.num_threads=o}),[{key:"load",value:(t=ee($().mark((function e(){var t,r,n,i=this;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window,r=t.tf,e.next=3,os({modelUrl:this.model_path,options:{numThreads:this.num_threads,enableProfiling:this.enable_profiling}});case 3:this.model=e.sent,n=this.model.inputs[0],this.input_width=n.shape[1],this.input_height=n.shape[2],r.tidy((function(){var e=r.randomNormal([1,i.input_width,i.input_height,3]);i.model.predict(e)}));case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"crop_eyes",value:function(e,t){var r=this,n=window.tf,i=t[0].map((function(e){return Math.round(e)})),o=t[1].map((function(e){return Math.round(e)}));i[0]>o[0]&&(i=t[1].map((function(e){return Math.round(e)})),o=t[0].map((function(e){return Math.round(e)})));var a=Math.round((i[0]+o[0])/2),s=a-i[0],c=o[0]-a;s>=this.size&&(s=this.size),c>=this.size&&(c=this.size);var l=Math.max(i[0]-s,0),u=Math.max(i[1]-s,0),d=Math.max(o[0]-c,0),f=Math.max(o[1]-c,0);return n.tidy((function(){var t=e.slice([u,l,0],[2*s,2*s,3]),i=e.slice([f,d,0],[2*c,2*c,3]);return{l_img:t=n.expandDims(n.image.resizeBilinear(t,[r.input_width,r.input_height])),r_img:i=n.expandDims(n.image.resizeBilinear(i,[r.input_width,r.input_height]))}}))}},{key:"predict",value:(e=ee($().mark((function e(t,r){var n,i,o,a,s,c,l,u,d,f=this,p=arguments;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=p.length>2&&void 0!==p[2]?p[2]:this.threshold,i=window,o=i.tf,a=t.getContext("2d"),s=a.getImageData(0,0,t.height,t.width),c=o.tidy((function(){var e=o.browser.fromPixels(s),t=f.crop_eyes(e,r),i=t.l_img,a=t.r_img,c=f.model.predict(i).arraySync()[0],l=f.model.predict(a).arraySync()[0];return[c>n,l>n]})),l=ae(c,2),u=l[0],d=l[1],e.abrupt("return",{isEyeClose:u||d});case 6:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]);var e,t}(),rl=function(){var e=ee($().mark((function e(){return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!DeviceMotionEvent||"function"!=typeof DeviceMotionEvent.requestPermission){e.next=2;break}return e.abrupt("return",DeviceMotionEvent.requestPermission());case 2:return e.abrupt("return",new Promise((function(e){return e("granted")})));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function nl(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.dataRate,r=void 0===t?100:t,n=i([]),s=i([]),c=(i(!1),i({})),l=o((function(e){var t=Date.now(),n=e.type;return!!(c.current[n]&&t-c.current[n]<r)||(c.current[n]=t,!1)}),[r]),u=o((function(e){l(e)||s.current.push({time:Date.now(),alpha:null==e?void 0:e.alpha,beta:null==e?void 0:e.beta,gamma:null==e?void 0:e.gamma})}),[l]),d=o((function(e){var t,r,i,o,a,s;l(e)||n.current.push({time:Date.now(),Accelerometer:{x:null==e||null===(t=e.acceleration)||void 0===t?void 0:t.x,y:null==e||null===(r=e.acceleration)||void 0===r?void 0:r.y,z:null==e||null===(i=e.acceleration)||void 0===i?void 0:i.z},Gyroscope:{z:null==e||null===(o=e.rotationRate)||void 0===o?void 0:o.alpha,x:null==e||null===(a=e.rotationRate)||void 0===a?void 0:a.beta,y:null==e||null===(s=e.rotationRate)||void 0===s?void 0:s.gamma}})}),[l]),f=o((function(){}),[d,u]),p=o((function(){}),[d,u]);return a((function(){return function(){p()}}),[p]),{motionData:n.current,orientationData:s.current,startMotion:f,stopMotion:p}}var il=Wc((function(e,t,r,n){at(t,Nt(t),e,n)})),ol=function(e){if(!st(e))return!1;var t=Te(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Hr(e)},al=Hc((function(e,t){try{return Yr(e,void 0,t)}catch(e){return ol(e)?e:new Error(e)}})),sl=Object.prototype,cl=sl.hasOwnProperty,ll=function(e,t,r,n){return void 0===e||fe(e,sl[r])&&!cl.call(n,r)?t:e},ul={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dl=function(e){return"\\"+ul[e]},fl=/<%=([\s\S]+?)%>/g,pl=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),hl=/[&<>"']/g,ml=RegExp(hl.source),gl={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:fl,variable:"",imports:{_:{escape:function(e){return(e=Dr(e))&&ml.test(e)?e.replace(hl,pl):e}}}},vl=/\b__p \+= '';/g,yl=/\b(__p \+=) '' \+/g,bl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_l=/[()=,{}\[\]\/\s]/,Cl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,wl=/($^)/,kl=/['\n\r\u2028\u2029\\]/g,Sl=Object.prototype.hasOwnProperty,Bl=function(e,t,r){var n=gl.imports._.templateSettings||gl;r&&Kc(e,t,r)&&(t=void 0),e=Dr(e),t=il({},t,n,ll);var i,o,a=il({},t.imports,n.imports,ll),s=Rt(a),c=function(e,t){return de(t,(function(t){return e[t]}))}(a,s),l=0,u=t.interpolate||wl,d="__p += '",f=RegExp((t.escape||wl).source+"|"+u.source+"|"+(u===fl?Cl:wl).source+"|"+(t.evaluate||wl).source+"|$","g"),p=Sl.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(f,(function(t,r,n,a,s,c){return n||(n=a),d+=e.slice(l,c).replace(kl,dl),r&&(i=!0,d+="' +\n__e("+r+") +\n'"),s&&(o=!0,d+="';\n"+s+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),d+="';\n";var h=Sl.call(t,"variable")&&t.variable;if(h){if(_l.test(h))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(vl,""):d).replace(yl,"$1").replace(bl,"$1;"),d="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=al((function(){return Function(s,p+"return "+d).apply(void 0,c)}));if(m.source=d,ol(m))throw m;return m},El=function(){var e=wi();return o((function(t,r){var n,i;return r?Bl(null!==(i=e[t])&&void 0!==i?i:t)(r):null!==(n=e[t])&&void 0!==n?n:t}),[e])},Il=function(e){a((function(){!function(e){new Promise((function(t,r){var n=new Image;n.onload=t,n.onerror=r,n.src=e}))}(e)}),[e])},Al=function(){return URL.createObjectURL(new Blob(['\'use strict\';(function(){function T(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let d=0;d<b;d++){let b=a.readBits(8);c.push(b)}try{d+=decodeURIComponent(c.map(a=>`%${("0"+a.toString(16)).substr(-2)}`).join(""))}catch(e){}return{bytes:c,text:d}}function U(a,b){a=new V(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===t.Terminator)return b;if(d===t.ECI)0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(7)}):\n0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:r.ECI,assignmentNumber:-1});else if(d===t.Numeric){var e=a;d=[];for(var f="",g=e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),n=Math.floor(h/10)%10;h%=10;d.push(48+k,48+n,48+h);f+=k.toString()+n.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);\nif(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;d.push(48+e,48+g);f+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");d.push(48+e);f+=e.toString()}d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Numeric,text:d.text})}else if(d===t.Alphanumeric){e=a;d=[];f="";for(g=e.readBits([9,11,13][c]);2<=g;)n=e.readBits(11),k=Math.floor(n/45),n%=45,d.push(B[k].charCodeAt(0),B[n].charCodeAt(0)),\nf+=B[k]+B[n],g-=2;1===g&&(e=e.readBits(6),d.push(B[e].charCodeAt(0)),f+=B[e]);d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Alphanumeric,text:d.text})}else if(d===t.Byte)d=T(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:r.Byte,bytes:d.bytes,text:d.text});else if(d===t.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d));\nd={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Kanji,bytes:d.bytes,text:d.text})}else d===t.StructuredAppend&&b.chunks.push({type:r.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}function J(a,b){return a^b}function W(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let d=e;b=c;e=f;if(b.isZero())return null;\nc=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let d=c.degree()-b.degree(),e=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(d,e));c=c.addOrSubtract(b.multiplyByMonomial(d,e))}f=f.multiplyPoly(e).addOrSubtract(d);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}function X(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new Y(285,\n256,0);var d=new w(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c;d=new w(a,e);d=W(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;d=d[1];e=b.length;f=Array(e);for(g=0;g<e;g++){h=a.inverse(b[g]);let c=1;for(let d=\n0;d<e;d++)g!==d&&(c=a.multiply(c,J(1,a.multiply(b[d],h))));f[g]=a.multiply(d.evaluateAt(h),a.inverse(c));0!==a.generatorBase&&(f[g]=a.multiply(f[g],h))}d=f;for(e=0;e<b.length;e++){f=c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}function E(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function C(a,b){return b<<1|a}function Z(a,b,c){c=aa[c.dataMask];let d=a.height;var e=17+4*b.versionNumber,f=A.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===\ng&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=f;g=[];e=h=0;f=!0;for(let k=d-1;0<k;k-=2){6===k&&k--;for(let n=0;n<d;n++){let m=f?d-1-n:n;for(let d=0;2>d;d++){let f=k-d;if(!b.get(f,m)){e++;let b=a.get(f,m);c({y:m,x:f})&&(b=!b);h=h<<1|b;8===e&&(g.push(h),h=e=0)}}}f=!f}return g}function ba(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return K[c-\n1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=C(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let c=b-9;c>=b-11;c--)d=C(a.get(e,c),d);a=Infinity;let f;for(let e of K){if(e.infoBits===c||e.infoBits===d)return e;b=E(c,e.infoBits);b<a&&(f=e,a=b);b=E(d,e.infoBits);b<a&&(f=e,a=b)}if(3>=a)return f}function ca(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=C(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=C(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=C(a.get(8,e),c);for(e=d-8;e<d;e++)c=C(a.get(e,\n8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of da){if(f===b||f===c)return g;e=E(b,f);e<a&&(d=g,a=e);b!==c&&(e=E(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}function ea(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(a=>{for(let b=0;b<a.numBlocks;b++)e.push({numDataCodewords:a.dataCodewordsPerBlock,codewords:[]}),f+=a.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());\nif(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c<b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let b of e)b.codewords.push(a.shift());return e}function L(a){let b=ba(a);if(!b)return null;var c=ca(a);if(!c)return null;a=Z(a,b,c);var d=ea(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((a,b)=>a+b.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let b of d){d=X(b.codewords,b.codewords.length-b.numDataCodewords);if(!d)return null;for(let e=\n0;e<b.numDataCodewords;e++)c[a++]=d[e]}try{return U(c,b.versionNumber)}catch(e){return null}}function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};{let h=b.x-c.x;var g=d.x-c.x;let k=b.y-c.y,n=d.y-c.y;c=h*n-g*k;g=(e*n-g*f)/c;e=(h*f-e*k)/c;return{a11:b.x-a.x+g*b.x,a12:b.y-a.y+g*b.y,a13:g,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}}function fa(a,b,c,d){a=M(a,b,c,d);\nreturn{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}function ha(a,b){var c=fa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+\nd.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31*c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,n=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,m=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,l=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,p=d.a13*c.a31+d.a23*c.a32+d.a33*c.a33;c=A.createEmpty(b.dimension,b.dimension);d=(a,b)=>{const c=g*a+n*b+p;return{x:(e*a+h*b+m)/c,y:(f*a+k*b+l)/c}};for(let e=0;e<b.dimension;e++)for(let f=0;f<b.dimension;f++){let b=d(f+.5,e+.5);c.set(f,e,a.get(Math.floor(b.x),\nMath.floor(b.y)))}return{matrix:c,mappingFunction:d}}function x(a){return a.reduce((a,c)=>a+c)}function ia(a,b,c){let d=y(a,b),e=y(b,c),f=y(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}function ja(a,b,c,d){d=(x(z(a,c,d,5))/7+x(z(a,b,d,5))/7+x(z(c,a,d,5))/7+x(z(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(y(a,b)/d);a=Math.round(y(a,c)/d);a=\nMath.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}function N(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),n=Math.abs(b-h),m=Math.floor(-k/2),l=g<a?1:-1,p=h<b?1:-1,q=!0;for(let v=g,u=h;v!==a+l;v+=l){g=f?u:v;h=f?v:u;if(c.get(g,\nh)!==q&&(q=!q,e.push({x:g,y:h}),e.length===d+1))break;m+=n;if(0<m){if(u===b)break;u+=p;m-=k}}c=[];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(y(e[f],e[f+1])):c.push(0);return c}function z(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=N(a,b,c,Math.ceil(d/2));a=N(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function F(a,b){let c=x(a)/x(b),d=0;b.forEach((b,f)=>{d+=Math.pow(a[f]-b*c,2)});return{averageSize:c,error:d}}function O(a,b,c){try{let d=z(a,{x:-1,y:a.y},c,b.length),\ne=z(a,{x:a.x,y:-1},c,b.length),f=z(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=z(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=F(d,b),k=F(e,b),n=F(f,b),m=F(g,b),l=(h.averageSize+k.averageSize+n.averageSize+m.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+n.error*n.error+m.error*m.error)+(Math.pow(h.averageSize-l,2)+Math.pow(k.averageSize-l,2)+Math.pow(n.averageSize-l,2)+Math.pow(m.averageSize-l,2))/l}catch(d){return Infinity}}\nfunction H(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}function ka(a){var b=[],c=[];let d=[];var e=[];for(let m=0;m<=a.height;m++){var f=0,g=!1;let l=[0,0,0,0,0];for(let b=-1;b<=a.width;b++){var h=a.get(b,m);if(h===g)f++;else{l=[l[1],l[2],l[3],l[4],f];f=1;g=h;var k=x(l)/7;k=Math.abs(l[0]-k)<k&&Math.abs(l[1]-\nk)<k&&Math.abs(l[2]-3*k)<3*k&&Math.abs(l[3]-k)<k&&Math.abs(l[4]-k)<k&&!h;var n=x(l.slice(-3))/3;h=Math.abs(l[2]-n)<n&&Math.abs(l[3]-n)<n&&Math.abs(l[4]-n)<n&&h;if(k){let a=b-l[3]-l[4],d=a-l[2];k={startX:d,endX:a,y:m};n=c.filter(b=>d>=b.bottom.startX&&d<=b.bottom.endX||a>=b.bottom.startX&&d<=b.bottom.endX||d<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<n.length?n[0].bottom=k:c.push({top:k,bottom:k})}if(h){let a=b-l[4],c=a-\nl[3];h={startX:c,y:m,endX:a};k=e.filter(b=>c>=b.bottom.startX&&c<=b.bottom.endX||a>=b.bottom.startX&&c<=b.bottom.endX||c<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<k.length?k[0].bottom=h:e.push({top:h,bottom:h})}}}b.push(...c.filter(a=>a.bottom.y!==m&&2<=a.bottom.y-a.top.y));c=c.filter(a=>a.bottom.y===m);d.push(...e.filter(a=>a.bottom.y!==m));e=e.filter(a=>a.bottom.y===m)}b.push(...c.filter(a=>2<=a.bottom.y-a.top.y));d.push(...e);\nc=[];for(var m of b)2>m.bottom.y-m.top.y||(b=(m.top.startX+m.top.endX+m.bottom.startX+m.bottom.endX)/4,e=(m.top.y+m.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[m.top.endX-m.top.startX,m.bottom.endX-m.bottom.startX,m.bottom.y-m.top.y+1],f=x(f)/f.length,g=O({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((a,b)=>a.score-b.score);m=[];for(b=0;b<Math.min(c.length,5);++b){e=c[b];f=[];for(var l of c)l!==e&&f.push(Object.assign(Object.assign({},\nl),{score:l.score+Math.pow(l.size-e.size,2)/e.size}));f.sort((a,b)=>a.score-b.score);m.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}m.sort((a,b)=>a.score-b.score);let {topRight:p,topLeft:q,bottomLeft:v}=ia(...m[0].points);m=P(a,d,p,q,v);l=[];m&&l.push({alignmentPattern:{x:m.alignmentPattern.x,y:m.alignmentPattern.y},bottomLeft:{x:v.x,y:v.y},dimension:m.dimension,topLeft:{x:q.x,y:q.y},topRight:{x:p.x,y:p.y}});m=H(a,p);b=H(a,q);c=H(a,v);(a=P(a,d,m,b,c))&&l.push({alignmentPattern:{x:a.alignmentPattern.x,\ny:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:m.x,y:m.y},dimension:a.dimension});return 0===l.length?null:l}function P(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ja(d,c,e,a))}catch(m){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(y(d,e)+y(d,c))/2/g;e=1-3/c;let n={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/4;b=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.floor(c),Math.floor(b))){var d=O({x:Math.floor(c),\ny:Math.floor(b)},[1,1,1],a)+y({x:c,y:b},n);return{x:c,y:b,score:d}}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);return{alignmentPattern:15<=c&&b.length?b[0]:n,dimension:f}}function Q(a){var b=ka(a);if(!b)return null;for(let e of b){b=ha(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let a=d+1;a<c.height;a++)c.get(d,a)!==c.get(a,d)&&(c.set(d,a,!c.get(d,a)),c.set(a,d,!c.get(a,d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,version:c.version,\nlocation:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}function R(a,b){Object.keys(b).forEach(c=>{a[c]=b[c]})}function I(a,b,c,d={}){let e=Object.create(null);R(e,la);R(e,d);\nd="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var n=0;if(h){var m=new Uint8ClampedArray(a.buffer,n,k);n+=k}m=new S(b,c,m);if(g.useIntegerApproximation)for(var l=0;l<c;l++)for(var p=0;p<b;p++){var q=4*(l*b+p);m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]+128>>8)}else for(l=0;l<c;l++)for(p=0;p<b;p++)q=4*\n(l*b+p),m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]);g=Math.ceil(b/8);l=Math.ceil(c/8);p=g*l;if(h){var v=new Uint8ClampedArray(a.buffer,n,p);n+=p}v=new S(g,l,v);for(p=0;p<l;p++)for(q=0;q<g;q++){var u=Infinity,r=0;for(var t=0;8>t;t++)for(let a=0;8>a;a++){let b=m.get(8*q+a,8*p+t);u=Math.min(u,b);r=Math.max(r,b)}t=(u+r)/2;t=Math.min(255,1.11*t);24>=r-u&&(t=u/2,0<p&&0<q&&(r=(v.get(q,p-1)+2*v.get(q-1,p)+v.get(q-1,p-1))/4,u<r&&(t=r)));v.set(q,p,t)}h?(p=new Uint8ClampedArray(a.buffer,n,k),n+=k,p=new A(p,\nb)):p=A.createEmpty(b,c);q=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,n,k),q=new A(a,b)):q=A.createEmpty(b,c));for(b=0;b<l;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=l-3;h=2>b?2:b>h?h:b;k=0;for(n=-2;2>=n;n++)for(u=-2;2>=u;u++)k+=v.get(c+n,h+u);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)n=8*a+h,u=8*b+k,r=m.get(n,u),p.set(n,u,r<=c),f&&q.set(n,u,!(r<=c))}f=f?{binarized:p,inverted:q}:{binarized:p};let {binarized:w,inverted:x}=f;(f=Q(d?x:w))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||\n(f=Q(d?w:x));return f}class A{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new A(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let b=a;b<a+c;b++)this.set(b,f,!!e)}}class S{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,\nb){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}class V{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,\na-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var r;(function(a){a.Numeric="numeric";a.Alphanumeric="alphanumeric";a.Byte="byte";a.Kanji="kanji";a.ECI="eci";a.StructuredAppend="structuredappend"})(r||(r={}));var t;(function(a){a[a.Terminator=0]="Terminator";a[a.Numeric=1]="Numeric";a[a.Alphanumeric=2]="Alphanumeric";a[a.Byte=4]="Byte";a[a.Kanji=8]="Kanji";a[a.ECI=7]="ECI";a[a.StructuredAppend=\n3]="StructuredAppend"})(t||(t={}));let B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");class w{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length-1}isZero(){return 0===\nthis.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new w(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length,c=new Uint8ClampedArray(b);\nfor(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new w(this.field,c)}multiplyPoly(a){if(this.isZero()||a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let h=0;h<c;h++){let c=b[h];for(let b=0;b<d;b++){var f=h+b,g=this.field.multiply(c,a[b]);e[f]=e[h+b]^g}}return new w(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero;\nlet c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new w(this.field,a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(a=>{b^=a}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=J(this.field.multiply(a,b),this.coefficients[d]);return b}}class Y{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase=c;this.expTable=Array(this.size);\nthis.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new w(this,Uint8ClampedArray.from([0]));this.one=new w(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===a)throw Error("Can\'t invert 0");return this.expTable[this.size-this.logTable[a]-1]}buildMonomial(a,\nb){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new w(this,a)}log(a){if(0===a)throw Error("Can\'t take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}let K=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},\n{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,\ndataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},\n{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},\n{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},\n{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,\ndataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},\n{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},\n{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},\n{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,\necBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,\ndataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,\ndataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,\n32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},\n{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},\n{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,\ndataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},\n{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},\n{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,\n30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},\n{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,\ndataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,\ndataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,\ndataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}],da=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,\ndataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,\nformatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,\ndataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,\ndataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],aa=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2],y=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2)),la={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1},\ncanOverwriteImage:!0};I.default=I;let G="dontInvert",D={red:77,green:150,blue:29,useIntegerApproximation:!0};self.onmessage=a=>{let b=a.data.data;switch(a.data.type){case "decode":a=I(b.data,b.width,b.height,{inversionAttempts:G,greyScaleWeights:D});self.postMessage({type:"qrResult",data:a?a.data:null});break;case "grayscaleWeights":D.red=b.red;D.green=b.green;D.blue=b.blue;D.useIntegerApproximation=b.useIntegerApproximation;break;case "inversionMode":switch(b){case "original":G="dontInvert";break;\ncase "invert":G="onlyInvert";break;case "both":G="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}})()\n\n']))},xl=Wc((function(e,t,r){qc(e,t,r)})),Tl=In(),Pl=ne((function e(r){var n=this,i=r.container,o=r.lang,a=void 0===o?"vi":o,s=r.assetRoot,c=r.resourceRoot,l=r.customUrls,u=void 0===l?{}:l,d=r.enableAntiDebug,f=void 0===d||d,p=r.warmupMessage,h=r.baseComponent,m=r.component,g=void 0===m?{}:m,v=r.country,y=void 0===v?"vn":v,b=r.idCardContext,_=r.exifKey,C=void 0===_?"":_,k=r.themeVersion,S=void 0===k?"v2":k;te(this,e),ie(this,"getDeviceInfo",ee($().mark((function e(){var t,r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={id:null,udid:null,sn:null,imei:null,manufacturer:An(),deviceName:xn(),wlanMac:null,phoneNumber:null,location:{latitude:null,longitude:null}},e.next=3,Ba();case 3:return r=e.sent,t.location.latitude=(null==r?void 0:r.lat)||null,t.location.longitude=(null==r?void 0:r.long)||null,e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})))),ie(this,"initNativeCamera",(function(e){var r=document.createElement("div");document.body.appendChild(r);var i=t.createRef(),o=n.component.NativeCamera;return w.render(t.createElement(o,oe({},e,{ref:i})),r),{openCamera:function(){i.current.click()}}})),ie(this,"runWarmUpReadIDCard",ee($().mark((function e(){var t;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.commonSettings.customUrls,e.abrupt("return",n.component.warmUpReadIdCard(t));case 2:case"end":return e.stop()}}),e)})))),ie(this,"runPreloadEKYCResources",ee($().mark((function e(){var t;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.commonSettings.customUrls,n.component.preloadEKYCResources(t);case 2:case"end":return e.stop()}}),e)})))),ie(this,"destroyView",(function(){w.unmountComponentAtNode(n.container)})),function(e,t,r,n,i,o,a,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,i,o,a,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}(i,"container is a required parameter"),this.container=i,this.container.style="touch-action: none; -ms-touch-action: none;";var B=cn({resourceRoot:c,initCustomUrls:u,country:y});this.commonSettings=Y({lang:a,assetRoot:s,customUrls:B,enableAntiDebug:f,debug:!1,warmupMessage:p,country:y,exifKey:C,themeVersion:S},b),this.component=xl({},h,g)}),[{key:"checkCamera",value:function(){return(0,this.component.checkCamera)()}},{key:"getListCamera",value:function(){return(0,this.component.getListCamera)()}},{key:"readIDCardWithApiCall",value:function(e){var r=this.component.ReadIDCardWithApiCall,n=Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{});w.render(t.createElement(un,{value:Y({},this.commonSettings)},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:n}},t.createElement(r,oe({onClose:this.destroyView},e)))),this.container)}},{key:"readIDCardUIOnly",value:function(e){var r=this.component.ReadIDCardUIOnly,n=Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{});w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:n}},t.createElement(r,oe({onClose:this.destroyView},e)))),this.container)}},{key:"livenessDetection",value:function(e){var r=this.component,n=r.LivenessDetection,i=r.CustomComponent,o=Y(Y(Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{}),(null==e?void 0:e.customInstructions)||{}),(null==e?void 0:e.customMessages)||{});w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:o}},t.createElement(n,oe({onClose:this.destroyView},e,{customComponent:i})))),this.container)}},{key:"ekycFlow",value:function(e){var r=this.component.EkycFlow,n=(null==e?void 0:e.customTexts)||{};w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:n}},t.createElement(r,oe({onClose:this.destroyView},e)))),this.container)}},{key:"flashLiveness",value:function(e){var r=this.component.FlashLiveness;w.render(t.createElement(un,{value:this.commonSettings},t.createElement(r,oe({onClose:this.destroyView},e))),this.container)}},{key:"faceAuthentication",value:function(e){var r=this.component,n=r.FaceAuthentication,i=r.LivenessDetection,o=r.CustomComponent,a=Y(Y(Y(Y({},(null==e?void 0:e.customTexts)||{}),(null==e?void 0:e.customErrors)||{}),(null==e?void 0:e.customInstructions)||{}),(null==e?void 0:e.customMessages)||{});w.render(t.createElement(un,{value:this.commonSettings},t.createElement(_i,{value:{lang:this.commonSettings.lang,country:this.commonSettings.country,customTexts:a}},t.createElement(n,oe({onClose:this.destroyView},e,{livenessDetectionComponent:i,customComponent:o})))),this.container)}},{key:"compareFaces",value:function(e){var t=e.accessKey,r=e.secretKey,n=e.apiUrl,i=e.image1,o=e.image2,a=e.onSuccess,s=e.onError;La(new mn(t,r,n,{httpHeaders:Tl})).compareFaces({image1:{id:i},image2:{id:o}}).then((function(e){a(e)})).catch((function(e){s(e)}))}}]),Rl=In(),Dl=function(){return ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(te(this,e),t&&r&&n){var i=Wn({userId:""});this.apiClient=La(new mn(t,r,n,{httpHeaders:Y(Y({},Rl),{},{"x-request-id":i})}))}else this.apiClient=null;this.clientSettings=this.clientSettings.bind(this),this.uploadImage=this.uploadImage.bind(this),this.uploadFiles=this.uploadFiles.bind(this),this.requestVerifyIDCard=this.requestVerifyIDCard.bind(this),this.detectIDTampering=this.detectIDTampering.bind(this),this.readIDCard=this.readIDCard.bind(this),this.requestVerifyPortrait=this.requestVerifyPortrait.bind(this),this.verifyFaceLiveness=this.verifyFaceLiveness.bind(this),this.compareFaces=this.compareFaces.bind(this),this.searchFaces=this.searchFaces.bind(this),this.indexFaces=this.indexFaces.bind(this)}),[{key:"clientSettings",value:(u=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.clientSettings(t);case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"uploadImage",value:(l=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.uploadImage(t);case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"uploadFiles",value:(c=ee($().mark((function e(t){var r,n,i=arguments;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]?i[1]:{},!this.apiClient){e.next=6;break}return e.next=4,this.apiClient.httpClient.post("/v1/files",t,r);case 4:return n=e.sent,e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"requestVerifyIDCard",value:(s=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.requestVerifyIDCard(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"detectIDTampering",value:(a=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.detectIDTampering(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"readIDCard",value:(o=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.readIDCard(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"requestVerifyPortrait",value:(i=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.requestVerifyPortrait(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"verifyFaceLiveness",value:(n=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.verifyFaceLiveness(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"compareFaces",value:(r=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.compareFaces(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchFaces",value:(t=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.searchFaces(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"indexFaces",value:(e=ee($().mark((function e(t){var r;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.apiClient){e.next=5;break}return e.next=3,this.apiClient.indexFaces(t);case 3:return r=e.sent,e.abrupt("return",{result:r});case 5:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e,t,r,n,i,o,a,s,c,l,u}(),Ll="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Nl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ol(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var Fl=Ol((function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",c="major",l="model",u="name",d="type",f="vendor",p="version",h="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",_="embedded",C="Amazon",w="Apple",k="ASUS",S="BlackBerry",B="Firefox",E="Google",I="Huawei",A="LG",x="Microsoft",T="Motorola",P="Opera",R="Samsung",D="Sharp",L="Sony",N="Xiaomi",O="Zebra",F="Facebook",M="Chromium OS",V="Mac OS",U=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},j=function(e,t){return typeof e===s&&-1!==z(t).indexOf(z(e))},z=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,500)},H=function(e,t){for(var r,o,s,c,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!l&&f[r];)if(l=f[r++].exec(e))for(s=0;s<p.length;s++)u=l[++o],typeof(c=p[s])===a&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;d+=2}},K=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(j(t[r][i],e))return"?"===r?n:r}else if(j(t[r],e))return"?"===r?n:r;return e},W={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,P]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[u,"Smart Lenovo Browser"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure Browser"],p],[/\bfocus\/([\w\.]+)/i],[p,[u,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[p,[u,B]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 Browser"]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 Browser"],p],[/samsungbrowser\/([\w\.]+)/i],[p,[u,"Samsung Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/metasr[\/ ]?([\d\.]+)/i],[p,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,"Chrome WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,z]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[f,R],[d,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[f,R],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[f,w],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[f,w],[d,v]],[/(macintosh);/i],[l,[f,w]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[f,D],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[f,I],[d,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[f,I],[d,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[f,N],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[f,N],[d,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[f,"OPPO"],[d,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[f,"Vivo"],[d,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[f,"Realme"],[d,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[f,T],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[f,T],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[f,A],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[f,A],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[f,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[f,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[f,E],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[f,E],[d,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[f,L],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[f,L],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[f,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[f,C],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[f,C],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,f,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[f,S],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[f,k],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[f,k],[d,g]],[/(nexus 9)/i],[l,[f,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[l,/_/g," "],[d,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[f,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[f,"Meizu"],[d,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[f,"Ulefone"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,l,[d,g]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,l,[d,v]],[/(surface duo)/i],[l,[f,x],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[f,"Fairphone"],[d,g]],[/(u304aa)/i],[l,[f,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[l,[f,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[l,[f,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[l,[f,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[f,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[l,[f,"NuVision"],[d,v]],[/\b(k88) b/i],[l,[f,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[l,[f,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[l,[f,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[l,[f,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[l,[f,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],l,[d,v]],[/\b(ns-?\w{0,9}) b/i],[l,[f,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[f,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],l,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],l,[d,g]],[/\b(ph-1) /i],[l,[f,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[f,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[l,[f,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[l,[f,"Rotor"],[d,v]],[/(shield[\w ]+) b/i],[l,[f,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[f,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,x],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[f,O],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[f,O],[d,g]],[/smart-tv.+(samsung)/i],[f,[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,R],[d,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,A],[d,y]],[/(apple) ?tv/i],[f,[l,"Apple TV"],[d,y]],[/crkey/i],[[l,"Chromecast"],[f,E],[d,y]],[/droid.+aft(\w+)( bui|\))/i],[l,[f,C],[d,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[f,D],[d,y]],[/(bravia[\w ]+)( bui|\))/i],[l,[f,L],[d,y]],[/(mitv-\w{5}) bui/i],[l,[f,N],[d,y]],[/Hbbtv.*(technisat) (.*);/i],[f,l,[d,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[f,q],[l,q],[d,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,l,[d,m]],[/droid.+; (shield) bui/i],[l,[f,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[l,[f,L],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[f,x],[d,m]],[/((pebble))app/i],[f,l,[d,b]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[f,w],[d,b]],[/droid.+; (glass) \d/i],[l,[f,E],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[l,[f,O],[d,b]],[/(quest( 2| pro)?)/i],[l,[f,F],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,_]],[/(aeobc)\b/i],[l,[f,C],[d,_]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[p,K,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,K,W],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,V],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,"Chromecast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,M],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,p]]},Q=function(e,t){if(typeof e===a&&(t=e,e=n),!(this instanceof Q))return new Q(e,t).getResult();var c=typeof r!==o&&r.navigator?r.navigator:n,l=e||(c&&c.userAgent?c.userAgent:""),u=c&&c.userAgentData?c.userAgentData:n,d=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(G,t):G,f=c&&c.userAgent==l;return this.getBrowser=function(){var e,t={};return t.name=n,t.version=n,H.call(t,l,d.browser),t.major=typeof(e=t.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:n,f&&c&&c.brave&&typeof c.brave.isBrave==i&&(t.name="Brave"),t},this.getCPU=function(){var e={};return e.architecture=n,H.call(e,l,d.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,H.call(e,l,d.device),f&&!e.type&&u&&u.mobile&&(e.type=g),f&&"Macintosh"==e.model&&c&&typeof c.standalone!==o&&c.maxTouchPoints&&c.maxTouchPoints>2&&(e.model="iPad",e.type=v),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,H.call(e,l,d.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,H.call(e,l,d.os),f&&!e.name&&u&&"Unknown"!=u.platform&&(e.name=u.platform.replace(/chrome os/i,M).replace(/macos/i,V)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return l},this.setUA=function(e){return l=typeof e===s&&e.length>500?q(e,500):e,this},this.setUA(l),this};Q.VERSION="1.0.37",Q.BROWSER=U([u,p,c]),Q.CPU=U([h]),Q.DEVICE=U([l,f,d,m,g,y,v,b,_]),Q.ENGINE=Q.OS=U([u,p]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var X=typeof r!==o&&(r.jQuery||r.Zepto);if(X&&!X.ua){var Y=new Q;X.ua=Y.getResult(),X.ua.get=function(){return Y.getUA()},X.ua.set=function(e){Y.setUA(e);var t=Y.getResult();for(var r in t)X.ua[r]=t[r]}}}("object"==typeof window?window:Ll)})),Ml=Ol((function(e,r){Object.defineProperty(r,"__esModule",{value:!0});var n,i=(n=t)&&"object"==typeof n&&"default"in n?n.default:n,o=new Fl,a=o.getBrowser(),s=o.getCPU(),c=o.getDevice(),l=o.getEngine(),u=o.getOS(),d=o.getUA(),f=function(e){return o.setUA(e)},p=function(e){if(e){var t=new Fl(e);return{UA:t,browser:t.getBrowser(),cpu:t.getCPU(),device:t.getDevice(),engine:t.getEngine(),os:t.getOS(),ua:t.getUA(),setUserAgent:function(e){return t.setUA(e)}}}console.error("No userAgent string was provided")},h=Object.freeze({ClientUAInstance:o,browser:a,cpu:s,device:c,engine:l,os:u,ua:d,setUa:f,parseUserAgent:p});function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E="mobile",I="tablet",A="smarttv",x="console",T="wearable",P="embedded",R=void 0,D={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},L={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},N={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";return e||t},F=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},M=function(e){var t=F();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},V=function(e,t,r,n){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{vendor:O(t.vendor),model:O(t.model),os:O(r.name),osVersion:O(r.version),ua:O(n)})};var U=function(e){return e.type===E},j=function(e){return e.type===I},z=function(e){var t=e.type;return t===E||t===I},q=function(e){return e.type===A},H=function(e){return e.type===R},K=function(e){return e.type===T},W=function(e){return e.type===x},G=function(e){return e.type===P},Q=function(e){var t=e.vendor;return O(t)},X=function(e){var t=e.model;return O(t)},Y=function(e){var t=e.type;return O(t,"browser")},$=function(e){return e.name===L.Android},Z=function(e){return e.name===L.Windows},J=function(e){return e.name===L.MAC_OS},ee=function(e){return e.name===L.WindowsPhone},te=function(e){return e.name===L.IOS},re=function(e){var t=e.version;return O(t)},ne=function(e){var t=e.name;return O(t)},ie=function(e){return e.name===D.Chrome},oe=function(e){return e.name===D.Firefox},ae=function(e){return e.name===D.Chromium},se=function(e){return e.name===D.Edge},ce=function(e){return e.name===D.Yandex},le=function(e){var t=e.name;return t===D.Safari||t===D.MobileSafari},ue=function(e){return e.name===D.MobileSafari},de=function(e){return e.name===D.Opera},fe=function(e){var t=e.name;return t===D.InternetExplorer||t===D.Ie},pe=function(e){return e.name===D.MIUI},he=function(e){return e.name===D.SamsungBrowser},me=function(e){var t=e.version;return O(t)},ge=function(e){var t=e.major;return O(t)},ve=function(e){var t=e.name;return O(t)},ye=function(e){var t=e.name;return O(t)},be=function(e){var t=e.version;return O(t)},_e=function(){var e=F(),t=e&&e.userAgent&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)},Ce=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},we=function(){var e=F();return e&&(/iPad|iPhone|iPod/.test(e.platform)||"MacIntel"===e.platform&&e.maxTouchPoints>1)&&!window.MSStream},ke=function(){return M("iPad")},Se=function(){return M("iPhone")},Be=function(){return M("iPod")},Ee=function(e){return O(e)};function Ie(e){var t=e||h,r=t.device,n=t.browser,i=t.os,o=t.engine,a=t.ua;return{isSmartTV:q(r),isConsole:W(r),isWearable:K(r),isEmbedded:G(r),isMobileSafari:ue(n)||ke(),isChromium:ae(n),isMobile:z(r)||ke(),isMobileOnly:U(r),isTablet:j(r)||ke(),isBrowser:H(r),isDesktop:H(r),isAndroid:$(i),isWinPhone:ee(i),isIOS:te(i)||ke(),isChrome:ie(n),isFirefox:oe(n),isSafari:le(n),isOpera:de(n),isIE:fe(n),osVersion:re(i),osName:ne(i),fullBrowserVersion:me(n),browserVersion:ge(n),browserName:ve(n),mobileVendor:Q(r),mobileModel:X(r),engineName:ye(o),engineVersion:be(o),getUA:Ee(a),isEdge:se(n)||Ce(a),isYandex:ce(n),deviceType:Y(r),isIOS13:we(),isIPad13:ke(),isIPhone13:Se(),isIPod13:Be(),isElectron:_e(),isEdgeChromium:Ce(a),isLegacyEdge:se(n)&&!Ce(a),isWindows:Z(i),isMacOs:J(i),isMIUI:pe(n),isSamsungBrowser:he(n)}}var Ae=q(c),xe=W(c),Te=K(c),Pe=G(c),Re=ue(a)||ke(),De=ae(a),Le=z(c)||ke(),Ne=U(c),Oe=j(c)||ke(),Fe=H(c),Me=H(c),Ve=$(u),Ue=ee(u),je=te(u)||ke(),ze=ie(a),qe=oe(a),He=le(a),Ke=de(a),We=fe(a),Ge=re(u),Qe=ne(u),Xe=me(a),Ye=ge(a),$e=ve(a),Ze=Q(c),Je=X(c),et=ye(l),tt=be(l),rt=Ee(d),nt=se(a)||Ce(d),it=ce(a),ot=Y(c),at=we(),st=ke(),ct=Se(),lt=Be(),ut=_e(),dt=Ce(d),ft=se(a)&&!Ce(d),pt=Z(u),ht=J(u),mt=pe(a),gt=he(a);function vt(e){var t=e||window.navigator.userAgent;return p(t)}r.AndroidView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Ve?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.BrowserTypes=D,r.BrowserView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Fe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.ConsoleView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return xe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.CustomView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,e.condition),a=w(e,["renderWithFragment","children","viewClassName","style","condition"]);return o?r?i.createElement(t.Fragment,null,n):i.createElement("div",a,n):null},r.IEView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return We?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.IOSView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return je?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileOnlyView=function(e){var r=e.renderWithFragment,n=e.children,o=(e.viewClassName,e.style,w(e,["renderWithFragment","children","viewClassName","style"]));return Ne?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.MobileView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Le?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.OsTypes=L,r.SmartTVView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Ae?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.TabletView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Oe?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WearableView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Te?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.WinPhoneView=function(e){var r=e.renderWithFragment,n=e.children,o=w(e,["renderWithFragment","children"]);return Ue?r?i.createElement(t.Fragment,null,n):i.createElement("div",o,n):null},r.browserName=$e,r.browserVersion=Ye,r.deviceDetect=function(e){var t=e?p(e):h,r=t.device,n=t.browser,i=t.engine,o=t.os,a=t.ua,s=function(e){switch(e){case E:return{isMobile:!0};case I:return{isTablet:!0};case A:return{isSmartTV:!0};case x:return{isConsole:!0};case T:return{isWearable:!0};case R:return{isBrowser:!0};case P:return{isEmbedded:!0};default:return N}}(r.type),c=s.isBrowser,l=s.isMobile,u=s.isTablet,d=s.isSmartTV,f=s.isConsole,m=s.isWearable,g=s.isEmbedded;return c?function(e,t,r,n,i){return{isBrowser:e,browserMajorVersion:O(t.major),browserFullVersion:O(t.version),browserName:O(t.name),engineName:O(r.name),engineVersion:O(r.version),osName:O(n.name),osVersion:O(n.version),userAgent:O(i)}}(c,n,i,o,a):d?function(e,t,r,n){return{isSmartTV:e,engineName:O(t.name),engineVersion:O(t.version),osName:O(r.name),osVersion:O(r.version),userAgent:O(n)}}(d,i,o,a):f?function(e,t,r,n){return{isConsole:e,engineName:O(t.name),engineVersion:O(t.version),osName:O(r.name),osVersion:O(r.version),userAgent:O(n)}}(f,i,o,a):l||u?V(s,r,o,a):m?function(e,t,r,n){return{isWearable:e,engineName:O(t.name),engineVersion:O(t.version),osName:O(r.name),osVersion:O(r.version),userAgent:O(n)}}(m,i,o,a):g?function(e,t,r,n,i){return{isEmbedded:e,vendor:O(t.vendor),model:O(t.model),engineName:O(r.name),engineVersion:O(r.version),osName:O(n.name),osVersion:O(n.version),userAgent:O(i)}}(g,r,i,o,a):void 0},r.deviceType=ot,r.engineName=et,r.engineVersion=tt,r.fullBrowserVersion=Xe,r.getSelectorsByUserAgent=function(e){if(e&&"string"==typeof e){var t=p(e);return Ie({device:t.device,browser:t.browser,os:t.os,engine:t.engine,ua:t.ua})}console.error("No valid user agent string was provided")},r.getUA=rt,r.isAndroid=Ve,r.isBrowser=Fe,r.isChrome=ze,r.isChromium=De,r.isConsole=xe,r.isDesktop=Me,r.isEdge=nt,r.isEdgeChromium=dt,r.isElectron=ut,r.isEmbedded=Pe,r.isFirefox=qe,r.isIE=We,r.isIOS=je,r.isIOS13=at,r.isIPad13=st,r.isIPhone13=ct,r.isIPod13=lt,r.isLegacyEdge=ft,r.isMIUI=mt,r.isMacOs=ht,r.isMobile=Le,r.isMobileOnly=Ne,r.isMobileSafari=Re,r.isOpera=Ke,r.isSafari=He,r.isSamsungBrowser=gt,r.isSmartTV=Ae,r.isTablet=Oe,r.isWearable=Te,r.isWinPhone=Ue,r.isWindows=pt,r.isYandex=it,r.mobileModel=Je,r.mobileVendor=Ze,r.osName=Qe,r.osVersion=Ge,r.parseUserAgent=p,r.setUserAgent=function(e){return f(e)},r.useDeviceData=vt,r.useDeviceSelectors=function(e){var t=vt(e||window.navigator.userAgent);return[Ie(t),t]},r.useMobileOrientation=function(){var e=S(t.useState((function(){var e=window.innerWidth>window.innerHeight?90:0;return{isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"}})),2),r=e[0],n=e[1],i=t.useCallback((function(){var e=window.innerWidth>window.innerHeight?90:0,t={isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"};r.orientation!==t.orientation&&n(t)}),[r.orientation]);return t.useEffect((function(){return void 0!==("undefined"==typeof window?"undefined":g(window))&&Le&&(i(),window.addEventListener("load",i,!1),window.addEventListener("resize",i,!1)),function(){window.removeEventListener("resize",i,!1),window.removeEventListener("load",i,!1)}}),[i]),r},r.withOrientationChange=function(e){return function(t){function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}(this,_(r).call(this,e))).isEventListenerAdded=!1,t.handleOrientationChange=t.handleOrientationChange.bind(k(t)),t.onOrientationChange=t.onOrientationChange.bind(k(t)),t.onPageLoad=t.onPageLoad.bind(k(t)),t.state={isLandscape:!1,isPortrait:!1},t}var n,o,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(r,t),n=r,(o=[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var e=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:0===e,isLandscape:90===e})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){void 0!==("undefined"==typeof window?"undefined":g(window))&&Le&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return i.createElement(e,b({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}])&&v(n.prototype,o),a&&v(n,a),r}(i.Component)}})),Vl=Nl(Ml),Ul=Object.freeze(Object.assign(Object.create(null),Ml,{default:Vl})),jl=Array.isArray,zl="object"==typeof Ll&&Ll&&Ll.Object===Object&&Ll,ql="object"==typeof self&&self&&self.Object===Object&&self,Hl=zl||ql||Function("return this")(),Kl=Hl.Symbol,Wl=Object.prototype,Gl=Wl.hasOwnProperty,Ql=Wl.toString,Xl=Kl?Kl.toStringTag:void 0;var Yl=function(e){var t=Gl.call(e,Xl),r=e[Xl];try{e[Xl]=void 0;var n=!0}catch(e){}var i=Ql.call(e);return n&&(t?e[Xl]=r:delete e[Xl]),i},$l=Object.prototype.toString;var Zl=function(e){return $l.call(e)},Jl=Kl?Kl.toStringTag:void 0;var eu=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Jl&&Jl in Object(e)?Yl(e):Zl(e)};var tu=function(e){return null!=e&&"object"==typeof e};var ru=function(e){return"symbol"==typeof e||tu(e)&&"[object Symbol]"==eu(e)},nu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iu=/^\w*$/;var ou=function(e,t){if(jl(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ru(e))||(iu.test(e)||!nu.test(e)||null!=t&&e in Object(t))};var au=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var su,cu=function(e){if(!au(e))return!1;var t=eu(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},lu=Hl["__core-js_shared__"],uu=(su=/[^.]+$/.exec(lu&&lu.keys&&lu.keys.IE_PROTO||""))?"Symbol(src)_1."+su:"";var du=function(e){return!!uu&&uu in e},fu=Function.prototype.toString;var pu=function(e){if(null!=e){try{return fu.call(e)}catch(e){}try{return e+""}catch(e){}}return""},hu=/^\[object .+?Constructor\]$/,mu=Function.prototype,gu=Object.prototype,vu=mu.toString,yu=gu.hasOwnProperty,bu=RegExp("^"+vu.call(yu).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _u=function(e){return!(!au(e)||du(e))&&(cu(e)?bu:hu).test(pu(e))};var Cu=function(e,t){return null==e?void 0:e[t]};var wu=function(e,t){var r=Cu(e,t);return _u(r)?r:void 0},ku=wu(Object,"create");var Su=function(){this.__data__=ku?ku(null):{},this.size=0};var Bu=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Eu=Object.prototype.hasOwnProperty;var Iu=function(e){var t=this.__data__;if(ku){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Eu.call(t,e)?t[e]:void 0},Au=Object.prototype.hasOwnProperty;var xu=function(e){var t=this.__data__;return ku?void 0!==t[e]:Au.call(t,e)};var Tu=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ku&&void 0===t?"__lodash_hash_undefined__":t,this};function Pu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Pu.prototype.clear=Su,Pu.prototype.delete=Bu,Pu.prototype.get=Iu,Pu.prototype.has=xu,Pu.prototype.set=Tu;var Ru=Pu;var Du=function(){this.__data__=[],this.size=0};var Lu=function(e,t){return e===t||e!=e&&t!=t};var Nu=function(e,t){for(var r=e.length;r--;)if(Lu(e[r][0],t))return r;return-1},Ou=Array.prototype.splice;var Fu=function(e){var t=this.__data__,r=Nu(t,e);return!(r<0)&&(r==t.length-1?t.pop():Ou.call(t,r,1),--this.size,!0)};var Mu=function(e){var t=this.__data__,r=Nu(t,e);return r<0?void 0:t[r][1]};var Vu=function(e){return Nu(this.__data__,e)>-1};var Uu=function(e,t){var r=this.__data__,n=Nu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function ju(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ju.prototype.clear=Du,ju.prototype.delete=Fu,ju.prototype.get=Mu,ju.prototype.has=Vu,ju.prototype.set=Uu;var zu=ju,qu=wu(Hl,"Map");var Hu=function(){this.size=0,this.__data__={hash:new Ru,map:new(qu||zu),string:new Ru}};var Ku=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Wu=function(e,t){var r=e.__data__;return Ku(t)?r["string"==typeof t?"string":"hash"]:r.map};var Gu=function(e){var t=Wu(this,e).delete(e);return this.size-=t?1:0,t};var Qu=function(e){return Wu(this,e).get(e)};var Xu=function(e){return Wu(this,e).has(e)};var Yu=function(e,t){var r=Wu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function $u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$u.prototype.clear=Hu,$u.prototype.delete=Gu,$u.prototype.get=Qu,$u.prototype.has=Xu,$u.prototype.set=Yu;var Zu=$u;function Ju(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Ju.Cache||Zu),r}Ju.Cache=Zu;var ed=Ju;var td=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rd=/\\(\\)?/g,nd=function(e){var t=ed(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(td,(function(e,r,n,i){t.push(n?i.replace(rd,"$1"):r||e)})),t}));var id=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},od=Kl?Kl.prototype:void 0,ad=od?od.toString:void 0;var sd=function e(t){if("string"==typeof t)return t;if(jl(t))return id(t,e)+"";if(ru(t))return ad?ad.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r};var cd=function(e){return null==e?"":sd(e)};var ld=function(e,t){return jl(e)?e:ou(e,t)?[e]:nd(cd(e))};var ud=function(e){if("string"==typeof e||ru(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var dd=function(e,t){for(var r=0,n=(t=ld(t,e)).length;null!=e&&r<n;)e=e[ud(t[r++])];return r&&r==n?e:void 0};var fd=function(e,t,r){var n=null==e?void 0:dd(e,t);return void 0===n?r:n},pd=/^\s+|\s+$/g,hd=/^[-+]0x[0-9a-f]+$/i,md=/^0b[01]+$/i,gd=/^0o[0-7]+$/i,vd=parseInt,yd="object"==typeof Ll&&Ll&&Ll.Object===Object&&Ll,bd="object"==typeof self&&self&&self.Object===Object&&self,_d=yd||bd||Function("return this")(),Cd=Object.prototype.toString,wd=Math.max,kd=Math.min,Sd=function(){return _d.Date.now()};function Bd(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ed(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Cd.call(e)}(e))return NaN;if(Bd(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Bd(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(pd,"");var r=md.test(e);return r||gd.test(e)?vd(e.slice(2),r?2:8):hd.test(e)?NaN:+e}var Id=function(e,t,r){var n,i,o,a,s,c,l=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,o=i;return n=i=void 0,l=t,a=e.apply(o,r)}function h(e){return l=e,s=setTimeout(g,t),u?p(e):a}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-l>=o}function g(){var e=Sd();if(m(e))return v(e);s=setTimeout(g,function(e){var r=t-(e-c);return d?kd(r,o-(e-l)):r}(e))}function v(e){return s=void 0,f&&n?p(e):(n=i=void 0,a)}function y(){var e=Sd(),r=m(e);if(n=arguments,i=this,c=e,r){if(void 0===s)return h(c);if(d)return s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),a}return t=Ed(t)||0,Bd(r)&&(u=!!r.leading,o=(d="maxWait"in r)?wd(Ed(r.maxWait)||0,t):o,f="trailing"in r?!!r.trailing:f),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,n=c=i=s=void 0},y.flush=function(){return void 0===s?a:v(Sd())},y},Ad="function"==typeof Symbol&&Symbol.for,xd=Ad?Symbol.for("react.element"):60103,Td=Ad?Symbol.for("react.portal"):60106,Pd=Ad?Symbol.for("react.fragment"):60107,Rd=Ad?Symbol.for("react.strict_mode"):60108,Dd=Ad?Symbol.for("react.profiler"):60114,Ld=Ad?Symbol.for("react.provider"):60109,Nd=Ad?Symbol.for("react.context"):60110,Od=Ad?Symbol.for("react.async_mode"):60111,Fd=Ad?Symbol.for("react.concurrent_mode"):60111,Md=Ad?Symbol.for("react.forward_ref"):60112,Vd=Ad?Symbol.for("react.suspense"):60113,Ud=Ad?Symbol.for("react.suspense_list"):60120,jd=Ad?Symbol.for("react.memo"):60115,zd=Ad?Symbol.for("react.lazy"):60116,qd=Ad?Symbol.for("react.block"):60121,Hd=Ad?Symbol.for("react.fundamental"):60117,Kd=Ad?Symbol.for("react.responder"):60118,Wd=Ad?Symbol.for("react.scope"):60119;
|
|
48
48
|
/** @license React v16.13.1
|
|
49
49
|
* react-is.production.min.js
|
|
50
50
|
*
|