@transmitsecurity/platform-web-sdk 1.16.2 → 1.17.0

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/README.md +69 -48
  3. package/dist/drs.cjs +1 -1
  4. package/dist/drs.d.ts +1 -14
  5. package/dist/drs.js +1 -1
  6. package/dist/ido.cjs +2 -2
  7. package/dist/ido.d.ts +889 -6
  8. package/dist/ido.js +1 -1
  9. package/dist/idv.cjs +1 -1
  10. package/dist/idv.d.ts +1 -7
  11. package/dist/idv.js +1 -1
  12. package/dist/index.cjs +2 -2
  13. package/dist/index.esm.js +2 -2
  14. package/dist/index.umd.js +2 -2
  15. package/dist/ts-platform-websdk.js +2 -2
  16. package/dist/web-sdk-drs+idv+webauthn+ido.js +2 -2
  17. package/dist/web-sdk.d.ts +1 -1
  18. package/dist/webauthn.cjs +1 -1
  19. package/dist/webauthn.d.ts +1 -9
  20. package/dist/webauthn.js +1 -1
  21. package/package.json +11 -12
  22. package/build/drs-entry.d.ts +0 -20
  23. package/build/drs-entry.js +0 -19
  24. package/build/drs-only.d.ts +0 -22
  25. package/build/drs-only.js +0 -25
  26. package/build/drs.d.ts +0 -28
  27. package/build/drs.js +0 -45
  28. package/build/ido/idoImpl.d.ts +0 -2
  29. package/build/ido/idoImpl.js +0 -4
  30. package/build/ido/index.d.ts +0 -7
  31. package/build/ido/index.js +0 -9
  32. package/build/ido-entry.d.ts +0 -17
  33. package/build/ido-entry.js +0 -19
  34. package/build/ido.d.ts +0 -18
  35. package/build/ido.js +0 -27
  36. package/build/idv-entry.d.ts +0 -17
  37. package/build/idv-entry.js +0 -19
  38. package/build/idv.d.ts +0 -18
  39. package/build/idv.js +0 -27
  40. package/build/initialize-only.d.ts +0 -7
  41. package/build/initialize-only.js +0 -40
  42. package/build/initialize.d.ts +0 -1
  43. package/build/initialize.js +0 -2
  44. package/build/mainExport.d.ts +0 -16
  45. package/build/mainExport.js +0 -43
  46. package/build/sdk-factory.d.ts +0 -109
  47. package/build/sdk-factory.js +0 -108
  48. package/build/shared-state.d.ts +0 -4
  49. package/build/shared-state.js +0 -32
  50. package/build/webauthn-entry.d.ts +0 -19
  51. package/build/webauthn-entry.js +0 -19
  52. package/build/webauthn.d.ts +0 -24
  53. package/build/webauthn.js +0 -44
  54. package/bundler-config.json +0 -14
  55. package/dist/docs/.nojekyll +0 -1
  56. package/dist/docs/README.md +0 -72
  57. package/dist/docs/enums/ErrorCode.md +0 -113
  58. package/dist/docs/interfaces/ActionEventOptions.md +0 -44
  59. package/dist/docs/interfaces/ActionResponse.md +0 -9
  60. package/dist/docs/interfaces/AuthenticationAutofillActivateHandlers.md +0 -61
  61. package/dist/docs/interfaces/AutofillHandlers.md +0 -50
  62. package/dist/docs/interfaces/CrossDeviceController.md +0 -27
  63. package/dist/docs/interfaces/SdkError.md +0 -28
  64. package/dist/docs/interfaces/WebauthnApis.md +0 -73
  65. package/dist/docs/interfaces/WebauthnAuthenticationFlows.md +0 -52
  66. package/dist/docs/interfaces/WebauthnCrossDeviceFlows.md +0 -107
  67. package/dist/docs/interfaces/WebauthnCrossDeviceRegistrationOptions.md +0 -23
  68. package/dist/docs/interfaces/WebauthnRegistrationOptions.md +0 -55
  69. package/dist/docs/interfaces/initConfigParams.md +0 -7
  70. package/dist/docs/modules/drs.md +0 -92
  71. package/dist/docs/modules/idv.md +0 -106
  72. package/dist/docs/modules/webauthn.md +0 -197
  73. package/dist/docs/modules.md +0 -146
  74. package/scripts/make-semver-aliases.sh +0 -11
  75. package/scripts/upload-dist.sh +0 -9
  76. package/src/mainExport.ts +0 -75
  77. package/src/tsconfig.json +0 -14
package/dist/ido.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "undefined"==typeof globalThis&&("undefined"!=typeof window?(window.globalThis=window,window.global=window):"undefined"!=typeof self&&(self.globalThis=self,self.global=self));const e=Symbol("MODULE_INITIALIZED"),t=new Map;function r(e,r){var i,n;null===(i=t.get(e))||void 0===i||i.forEach((n=e=>e(r),function(){try{return n(...arguments)}catch(e){console.log(e)}}))}let i=null;function n(e){i=e}var a=Object.freeze({__proto__:null,getInitConfig:function(){return i},get initConfig(){return i},setInitConfig:n});function o(t){n(t),r(e,void 0)}var s=Object.freeze({__proto__:null,initialize:o});function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function l(e,t){return Object.entries(t).reduce(((t,r)=>{let[i,n]=r;return f(f({},t),{},{[i]:b.isPrototypeOf(n)?new n(e.slug):"function"==typeof n?n.bind(e):"object"==typeof n&&!Array.isArray(n)&&n?l(e,n):n})}),{})}class b{constructor(e){this.slug=e}static create(e){return class extends b{constructor(t){super(t),Object.assign(this,l(this,e(this)))}}}}var p=Object.freeze({__proto__:null,Agent:b}),g=Object.freeze({__proto__:null,MODULE_INITIALIZED:e,emit:r,off:function(e,r){const i=t.get(e);if(!i)return;const n=i.indexOf(r);-1!==n&&i.splice(n,1)},on:function(e,r){var i;t.has(e)?null===(i=t.get(e))||void 0===i||i.push(r):t.set(e,[r])}});function y(e,t){const r=!e||"object"!=typeof e||Array.isArray(e)?{}:e;return[t.reduce(((e,t)=>{if(t in e){const r=e[t];if(null!==r&&"object"==typeof r&&!Array.isArray(r))return r}const r={};return e[t]=r,r}),r),r]}function m(e,t){let r=e;return t.every((e=>!(!r||"object"!=typeof r||Array.isArray(r)||!(e in r))&&(r=r[e],!0)),e)}const v="tsec",w="general";function _(e){return e?w:i.clientId}function M(e){return function(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}((e?sessionStorage:localStorage).getItem(v))}function A(e,t){const r=e?sessionStorage:localStorage,i=t(M(e));r.setItem(v,JSON.stringify(i))}var S=Object.freeze({__proto__:null,COMMON_STORAGE_KEY:v,GENERAL_ID_KEY:w,getValue:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=_(!!t.isGeneral),i=M(!!t.sessionOnly),[n]=y(i,[this.slug.toString(),r]);return n[e]},hasValue:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=_(!!t.isGeneral),i=M(!!t.sessionOnly);return m(i,[this.slug.toString(),r,e])},removeValue:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=_(!!t.isGeneral);A(!!t.sessionOnly,(t=>{const[i,n]=y(t,[this.slug.toString(),r]);return delete i[e],n}))},setValue:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=_(!!r.isGeneral);A(!!r.sessionOnly,(r=>{const[n,a]=y(r,[this.slug.toString(),i]);return n[e]=t,a}))}});const I="RSA-PSS",R=async(e,t)=>await window.crypto.subtle.generateKey({name:e,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!1,t),x=async()=>await R("RSA-OAEP",["encrypt","decrypt"]),E=async()=>await R(I,["sign"]),P=async(e,t)=>{const r=(new TextEncoder).encode(t);return await window.crypto.subtle.sign({name:I,saltLength:32},e,r)};class k{constructor(e,t,r){this.slug=e,this.dbName=t,this.dbVersion=r}queryObjectStore(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.shimIndexedDB).open(`${this.slug}:${this.dbName}`,this.dbVersion||1);i.onupgradeneeded=()=>{var t;const r=i.result;(null===(t=null==r?void 0:r.objectStoreNames)||void 0===t?void 0:t.contains)&&!r.objectStoreNames.contains(e)&&r.createObjectStore(e,{keyPath:"key"})},i.onsuccess=()=>{const n=i.result,a=n.transaction(e,(null==r?void 0:r.operation)||"readwrite"),o=a.objectStore(e);t(o),a.oncomplete=()=>{n.close()}}}put(e,t,r){return new Promise(((i,n)=>{this.queryObjectStore(e,(e=>{const a=e.put({key:t,value:r});a.onsuccess=()=>{i(a.result)},a.onerror=e=>{n("Failed adding item to objectStore, err: "+e)}}))}))}add(e,t,r){return new Promise(((i,n)=>{this.queryObjectStore(e,(e=>{const a=e.add({key:t,value:r});a.onsuccess=()=>{i(a.result)},a.onerror=e=>{const t=e.target.error;n(t)}}))}))}get(e,t){return new Promise(((r,i)=>{this.queryObjectStore(e,(e=>{const n=e.get(t);n.onsuccess=()=>{var e;n.result?r(null===(e=n.result)||void 0===e?void 0:e.value):r(void 0)},n.onerror=e=>{i("Failed adding item to objectStore, err: "+e)}}))}))}getAll(e,t){return new Promise(((r,i)=>{this.queryObjectStore(e,(e=>{const n=e.getAll(null,t);n.onsuccess=()=>{if(n.result){const e=n.result;(null==e?void 0:e.length)?r(e.map((e=>null==e?void 0:e.value))):r(e)}else r([])},n.onerror=e=>{i("Failed getting items, err: "+e)}}))}))}delete(e,t){return new Promise(((r,i)=>{this.queryObjectStore(e,(e=>{const n=e.delete(t);n.onsuccess=()=>{r()},n.onerror=e=>{i(`Failed deleting key: '${t}' from objectStore, err: `+e)}}))}))}clear(e){return new Promise(((t,r)=>{this.queryObjectStore(e,(e=>{const i=e.clear();i.onsuccess=()=>{t()},i.onerror=e=>{r("Failed clearing objectStore, err: "+e)}}))}))}}const B="platform",C="init",j="completed",z="RSA2048",D=[C,j];class T{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sign",r=arguments.length>2?arguments[2]:void 0;var n,a,o,s;this.agent=e,this.keysType=t,this.options=r,this._extractingKeysPromise=null;const d=!(null===(n=this.options)||void 0===n?void 0:n.productScope);this.keysDatabaseName=d||!(null===(a=this.options)||void 0===a?void 0:a.indexedDBName)?"ts_crypto_binding":this.options.indexedDBName,this.dbVersion=d?1:(null===(o=this.options)||void 0===o?void 0:o.dbVersion)||1,this.keysStoreName=d||!(null===(s=this.options)||void 0===s?void 0:s.keysStoreName)?"identifiers_store":this.options.keysStoreName,this.indexedDBClient=new k(d?B:e.slug,this.keysDatabaseName,this.dbVersion),this.indexedDBClientFallback=new k((d?B:e.slug)+`:${i.clientId}`,this.keysDatabaseName,this.dbVersion)}getKeysRecordKey(){return`${this.keysType}_keys`}getRotatedKeysRecordKey(){return`rotated_${this.keysType}_keys`}getRotatedKeysRecordKeyPending(){return`rotated_pending_${this.keysType}_keys`}arrayBufferToBase64(e){return window.btoa(String.fromCharCode(...new Uint8Array(e)))}async getPKRepresentations(e){const t=await crypto.subtle.exportKey("spki",e);return{arrayBufferKey:t,base64Key:this.arrayBufferToBase64(t)}}async generateKeyPair(){return"sign"==this.keysType?await E():await x()}async calcKeyIdentifier(e){const t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map((e=>e.toString(16).padStart(2,"0"))).join("")}async extractKeysData(){if(this._extractingKeysPromise)return this._extractingKeysPromise;this._extractingKeysPromise=(async()=>{var e,t;const r=(null===(t=null===(e=this.options)||void 0===e?void 0:e.keyRotation)||void 0===t?void 0:t.isEnabled)?await this.getRotatedKeysData():await this.getKeysData(),{base64Key:i}=await this.getPKRepresentations(r.publicKey);return this.publicKeyBase64=i,this.keyIdentifier=r.keyIdentifier,r})();try{return await this._extractingKeysPromise}finally{this._extractingKeysPromise=null}}async generateKeyPairData(e){const t=await this.generateKeyPair(),{arrayBufferKey:r}=await this.getPKRepresentations(t.publicKey),i=e||await this.calcKeyIdentifier(r);return f(f({},t),{},{keyIdentifier:i,createdDate:Date.now()})}shouldKeyBeRotated(e){var t;const r=null===(t=this.options)||void 0===t?void 0:t.keyRotation;if(!(null==r?void 0:r.isEnabled)||!r.expiryDays||void 0===r.startedAt)return!1;const i=24*r.expiryDays*60*60*1e3,n=e.createdDate&&e.createdDate>=r.startedAt?e.createdDate:r.startedAt;return Date.now()-n>i-2592e6}async extractMainKeysData(){return await this.indexedDBClient.get(this.keysStoreName,this.getKeysRecordKey())}async extractFallbackMainKeysData(){return await this.indexedDBClientFallback.get(this.keysStoreName,this.getKeysRecordKey())}async extractRotatedKeysData(){return await this.indexedDBClient.get(this.keysStoreName,this.getRotatedKeysRecordKey())}async extractPendingRotatedKeysData(){return await this.indexedDBClient.get(this.keysStoreName,this.getRotatedKeysRecordKeyPending())}async saveKeyData(e,t){try{return await this.indexedDBClient.add(this.keysStoreName,e,t),t}catch(t){if(t instanceof DOMException&&"ConstraintError"===t.name){const t=await this.indexedDBClient.get(this.keysStoreName,e);if(t)return t}throw t}}async getKeysData(){const e=this.getKeysRecordKey();let t=await this.extractMainKeysData();if(t)return t;if(t=await this.extractFallbackMainKeysData(),t)return this.saveKeyData(e,t);const r=await this.generateKeyPairData();return this.saveKeyData(e,r)}async getOrCreateRotatedKeys(){let e=await this.extractRotatedKeysData();if(!e){const t=this.getRotatedKeysRecordKey(),r=await this.getKeysData(),i=f(f({},r),{},{createdDate:r.createdDate||Date.now()});e=await this.saveKeyData(t,i)}return e}async getRotatedKeysData(){const e=await this.getOrCreateRotatedKeys();if(this.shouldKeyBeRotated(e)){if(!await this.extractPendingRotatedKeysData()){const t=this.getRotatedKeysRecordKeyPending(),r=await this.generateKeyPairData(e.keyIdentifier);await this.saveKeyData(t,r)}}return e}async getPublicData(){return this.publicKeyBase64&&this.keyIdentifier||await this.extractKeysData(),{publicKey:this.publicKeyBase64,keyIdentifier:this.keyIdentifier}}async sign(e){if("sign"==this.keysType){const{privateKey:t}=await this.extractKeysData(),r=await P(t,e);return this.arrayBufferToBase64(r)}throw new Error("keysType must be 'sign' in order to use sign keys")}async clearKeys(){const e=this.getKeysRecordKey();await this.indexedDBClient.delete(this.keysStoreName,e)}getBaseRotationPayload(){return{keyIdentifier:this.keyIdentifier,slot:this.getRotatedKeysRecordKey(),publicKey:this.publicKeyBase64,publicKeyType:z,tenantId:this.options.keyRotation.tenantId}}async getRotationData(){var e,t;if(!(null===(t=null===(e=this.options)||void 0===e?void 0:e.keyRotation)||void 0===t?void 0:t.isEnabled))return;this.publicKeyBase64&&this.keyIdentifier||await this.extractKeysData();const r=await this.extractPendingRotatedKeysData();if(r){const{base64Key:e}=await this.getPKRepresentations(r.publicKey),{privateKey:t}=await this.extractKeysData(),i=f(f({},this.getBaseRotationPayload()),{},{newPublicKey:e,createdDate:r.createdDate,newPublicKeyType:z}),n=JSON.stringify(i);return{data:n,signature:await this.signPayload(n,t)}}const i=await this.extractRotatedKeysData();if(i&&!1===i.confirmed){await this.extractKeysData();const e=JSON.stringify(this.getBaseRotationPayload());return{data:e,signature:await this.signPayload(e,i.privateKey)}}}async signPayload(e,t){const r=await P(t,e);return this.arrayBufferToBase64(r)}async handleRotateResponse(e){if(D.includes(e))if(e===C){const e=await this.extractPendingRotatedKeysData();if(e){await this.indexedDBClient.delete(this.keysStoreName,this.getRotatedKeysRecordKey());const t=f(f({},e),{},{confirmed:!1});await this.indexedDBClient.put(this.keysStoreName,this.getRotatedKeysRecordKey(),t),await this.indexedDBClient.delete(this.keysStoreName,this.getRotatedKeysRecordKeyPending());const{base64Key:r}=await this.getPKRepresentations(e.publicKey);this.publicKeyBase64=r,this.keyIdentifier=e.keyIdentifier}}else if(e===j){const e=await this.extractRotatedKeysData();e&&!1===e.confirmed&&await this.indexedDBClient.put(this.keysStoreName,this.getRotatedKeysRecordKey(),f(f({},e),{},{confirmed:!0}))}}}var O=Object.freeze({__proto__:null,createCryptoBinding:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sign",t=arguments.length>1?arguments[1]:void 0;return new T(this,e,t)},generateRSAKeyPair:x,generateRSASignKeyPair:E,signAssymetric:P,verifyAssymetric:async(e,t,r)=>{const i=(new TextEncoder).encode(t);return await window.crypto.subtle.verify(I,e,r,i)}}),K=Object.freeze({__proto__:null});const N=b.create((e=>{class t extends Error{constructor(t,r){super(`${e.slug}-${t} ${r}`)}}return{TsError:t,TsInternalError:class extends t{constructor(e){super(e,"Internal error")}}}}));var q=b.create((()=>f({exceptions:N},p)));class L{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.agent=e,this.middlewares=t,this.logs=[]}info(e,t){this.pushLog(3,e,t)}warn(e,t){this.pushLog(4,e,t)}error(e,t){this.pushLog(5,e,t)}pushLog(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.logs.push({timestamp:Date.now(),module:this.agent.slug,severity:e,fields:r,message:t});const i=this.middlewares.map((e=>e(this)));Promise.all(i).catch((()=>{}))}}var J=Object.freeze({__proto__:null,consoleMiddleware:function(e){const t=e.logs[e.logs.length-1];console.log(`${t.severity} ${t.message}`,t.fields)},createSdkLogger:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new L(this,e)}});function U(e,t){if(!(null==e?void 0:e.trim()))return"";if(function(e){try{return new URL(e),!0}catch(e){return!1}}(e))return e;const r="http://mock.com",i=new URL(r);i.search=(null==t?void 0:t.toString())||"",i.pathname=e;return i.href.replace(r,"")}const F={"Content-Type":"application/json","X-TS-client-time":(new Date).toUTCString(),"X-TS-ua":navigator.userAgent};function H(e,t,r){var i;const n=(a=t||{},encodeURI(JSON.stringify(a)).split(/%..|./).length-1);var a;return{method:e,headers:f(f(f({},{"X-TS-body-size":String(n)}),F),r||{}),body:null!==(i=t&&JSON.stringify(t||{}))&&void 0!==i?i:void 0}}function Y(e,t,r,i,n){const a=U(e,i),o=H(t,r,n);return fetch(a,o)}async function V(e,t,r,i,n){let a;if(a=await Y(e,t,r,i,n),!a.ok)throw new Error("Request failed");return a}var Q=Object.freeze({__proto__:null,httpDelete:async function(e,t){const r=await V(e,"DELETE",void 0,void 0,t);return f(f({data:await r.json()},r),{},{headers:r.headers})},httpGet:async function(e,t,r){const i=await V(e,"GET",void 0,t,r);return f(f({data:await i.json()},i),{},{headers:i.headers})},httpPost:async function(e,t,r,i){const n=await V(e,"POST",t,r,i);return f(f({data:await n.json()},n),{},{headers:n.headers})},httpPut:async function(e,t,r,i){const n=await V(e,"PUT",t,r,i);return f(f({data:await n.json()},n),{},{headers:n.headers})},init:H}),W=b.create((()=>({events:g,moduleMetadata:a,mainEntry:s,utils:q,storage:S,crypto:O,indexedDB:K,logger:J,http:Q}))),G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];r.push.apply(r,arguments);var i=Function.bind.apply(t,r);return new i}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),r}var Z="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},$=[],ee=[],te="undefined"!=typeof Uint8Array?Uint8Array:Array,re=!1;function ie(){re=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)$[t]=e[t],ee[e.charCodeAt(t)]=t;ee["-".charCodeAt(0)]=62,ee["_".charCodeAt(0)]=63}function ne(e,t,r){for(var i,n,a=[],o=t;o<r;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push($[(n=i)>>18&63]+$[n>>12&63]+$[n>>6&63]+$[63&n]);return a.join("")}function ae(e){var t;re||ie();for(var r=e.length,i=r%3,n="",a=[],o=16383,s=0,d=r-i;s<d;s+=o)a.push(ne(e,s,s+o>d?d:s+o));return 1===i?(t=e[r-1],n+=$[t>>2],n+=$[t<<4&63],n+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],n+=$[t>>10],n+=$[t>>4&63],n+=$[t<<2&63],n+="="),a.push(n),a.join("")}function oe(e,t,r,i,n){var a,o,s=8*n-i-1,d=(1<<s)-1,f=d>>1,c=-7,h=r?n-1:0,u=r?-1:1,l=e[t+h];for(h+=u,a=l&(1<<-c)-1,l>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=u,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=i;c>0;o=256*o+e[t+h],h+=u,c-=8);if(0===a)a=1-f;else{if(a===d)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,i),a-=f}return(l?-1:1)*o*Math.pow(2,a-i)}function se(e,t,r,i,n,a){var o,s,d,f=8*a-n-1,c=(1<<f)-1,h=c>>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,l=i?0:a-1,b=i?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+h>=1?u/d:u*Math.pow(2,1-h))*d>=2&&(o++,d/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(t*d-1)*Math.pow(2,n),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),o=0));n>=8;e[r+l]=255&s,l+=b,s/=256,n-=8);for(o=o<<n|s,f+=n;f>0;e[r+l]=255&o,l+=b,o/=256,f-=8);e[r+l-b]|=128*p}var de={}.toString,fe=Array.isArray||function(e){return"[object Array]"==de.call(e)};le.TYPED_ARRAY_SUPPORT=void 0===Z.TYPED_ARRAY_SUPPORT||Z.TYPED_ARRAY_SUPPORT;var ce=he();function he(){return le.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ue(e,t){if(he()<t)throw new RangeError("Invalid typed array length");return le.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=le.prototype:(null===e&&(e=new le(t)),e.length=t),e}function le(e,t,r){if(!(le.TYPED_ARRAY_SUPPORT||this instanceof le))return new le(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ge(this,e)}return be(this,e,t,r)}function be(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);le.TYPED_ARRAY_SUPPORT?(e=t).__proto__=le.prototype:e=ye(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!le.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|we(t,r);e=ue(e,i);var n=e.write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(ve(t)){var r=0|me(t.length);return 0===(e=ue(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?ue(e,0):ye(e,t);if("Buffer"===t.type&&fe(t.data))return ye(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function pe(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ge(e,t){if(pe(t),e=ue(e,t<0?0:0|me(t)),!le.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function ye(e,t){var r=t.length<0?0:0|me(t.length);e=ue(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function me(e){if(e>=he())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+he().toString(16)+" bytes");return 0|e}function ve(e){return!(null==e||!e._isBuffer)}function we(e,t){if(ve(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Ve(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Qe(e).length;default:if(i)return Ve(e).length;t=(""+t).toLowerCase(),i=!0}}function _e(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Te(this,t,r);case"utf8":case"utf-8":return Ce(this,t,r);case"ascii":return ze(this,t,r);case"latin1":case"binary":return De(this,t,r);case"base64":return Be(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function Me(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function Ae(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=le.from(t,i)),ve(t))return 0===t.length?-1:Se(e,t,r,i,n);if("number"==typeof t)return t&=255,le.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Se(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Se(e,t,r,i,n){var a,o=1,s=e.length,d=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,s/=2,d/=2,r/=2}function f(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var c=-1;for(a=r;a<s;a++)if(f(e,a)===f(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===d)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(r+d>s&&(r=s-d),a=r;a>=0;a--){for(var h=!0,u=0;u<d;u++)if(f(e,a+u)!==f(t,u)){h=!1;break}if(h)return a}return-1}function Ie(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o<i;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function Re(e,t,r,i){return We(Ve(t,e.length-r),e,r,i)}function xe(e,t,r,i){return We(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function Ee(e,t,r,i){return xe(e,t,r,i)}function Pe(e,t,r,i){return We(Qe(t),e,r,i)}function ke(e,t,r,i){return We(function(e,t){for(var r,i,n,a=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(r=e.charCodeAt(o))>>8,n=r%256,a.push(n),a.push(i);return a}(t,e.length-r),e,r,i)}function Be(e,t,r){return 0===t&&r===e.length?ae(e):ae(e.slice(t,r))}function Ce(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var a,o,s,d,f=e[n],c=null,h=f>239?4:f>223?3:f>191?2:1;if(n+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(a=e[n+1]))&&(d=(31&f)<<6|63&a)>127&&(c=d);break;case 3:a=e[n+1],o=e[n+2],128==(192&a)&&128==(192&o)&&(d=(15&f)<<12|(63&a)<<6|63&o)>2047&&(d<55296||d>57343)&&(c=d);break;case 4:a=e[n+1],o=e[n+2],s=e[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(d=(15&f)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&d<1114112&&(c=d)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=h}return function(e){var t=e.length;if(t<=je)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=je));return r}(i)}le.poolSize=8192,le._augment=function(e){return e.__proto__=le.prototype,e},le.from=function(e,t,r){return be(null,e,t,r)},le.TYPED_ARRAY_SUPPORT&&(le.prototype.__proto__=Uint8Array.prototype,le.__proto__=Uint8Array),le.alloc=function(e,t,r){return function(e,t,r,i){return pe(t),t<=0?ue(e,t):void 0!==r?"string"==typeof i?ue(e,t).fill(r,i):ue(e,t).fill(r):ue(e,t)}(null,e,t,r)},le.allocUnsafe=function(e){return ge(null,e)},le.allocUnsafeSlow=function(e){return ge(null,e)},le.isBuffer=Ge,le.compare=function(e,t){if(!ve(e)||!ve(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,a=Math.min(r,i);n<a;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},le.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},le.concat=function(e,t){if(!fe(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return le.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=le.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var a=e[r];if(!ve(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,n),n+=a.length}return i},le.byteLength=we,le.prototype._isBuffer=!0,le.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Me(this,t,t+1);return this},le.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Me(this,t,t+3),Me(this,t+1,t+2);return this},le.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Me(this,t,t+7),Me(this,t+1,t+6),Me(this,t+2,t+5),Me(this,t+3,t+4);return this},le.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Ce(this,0,e):_e.apply(this,arguments)},le.prototype.equals=function(e){if(!ve(e))throw new TypeError("Argument must be a Buffer");return this===e||0===le.compare(this,e)},le.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},le.prototype.compare=function(e,t,r,i,n){if(!ve(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),d=this.slice(i,n),f=e.slice(t,r),c=0;c<s;++c)if(d[c]!==f[c]){a=d[c],o=f[c];break}return a<o?-1:o<a?1:0},le.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},le.prototype.indexOf=function(e,t,r){return Ae(this,e,t,r,!0)},le.prototype.lastIndexOf=function(e,t,r){return Ae(this,e,t,r,!1)},le.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ie(this,e,t,r);case"utf8":case"utf-8":return Re(this,e,t,r);case"ascii":return xe(this,e,t,r);case"latin1":case"binary":return Ee(this,e,t,r);case"base64":return Pe(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var je=4096;function ze(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function De(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function Te(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",a=t;a<r;++a)n+=Ye(e[a]);return n}function Oe(e,t,r){for(var i=e.slice(t,r),n="",a=0;a<i.length;a+=2)n+=String.fromCharCode(i[a]+256*i[a+1]);return n}function Ke(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Ne(e,t,r,i,n,a){if(!ve(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<a)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function qe(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);n<a;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function Le(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);n<a;++n)e[r+n]=t>>>8*(i?n:3-n)&255}function Je(e,t,r,i,n,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ue(e,t,r,i,n){return n||Je(e,0,r,4),se(e,t,r,i,23,4),r+4}function Fe(e,t,r,i,n){return n||Je(e,0,r,8),se(e,t,r,i,52,8),r+8}le.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),le.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=le.prototype;else{var n=t-e;r=new le(n,void 0);for(var a=0;a<n;++a)r[a]=this[a+e]}return r},le.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i},le.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},le.prototype.readUInt8=function(e,t){return t||Ke(e,1,this.length),this[e]},le.prototype.readUInt16LE=function(e,t){return t||Ke(e,2,this.length),this[e]|this[e+1]<<8},le.prototype.readUInt16BE=function(e,t){return t||Ke(e,2,this.length),this[e]<<8|this[e+1]},le.prototype.readUInt32LE=function(e,t){return t||Ke(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},le.prototype.readUInt32BE=function(e,t){return t||Ke(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},le.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},le.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},le.prototype.readInt8=function(e,t){return t||Ke(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},le.prototype.readInt16LE=function(e,t){t||Ke(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},le.prototype.readInt16BE=function(e,t){t||Ke(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},le.prototype.readInt32LE=function(e,t){return t||Ke(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},le.prototype.readInt32BE=function(e,t){return t||Ke(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},le.prototype.readFloatLE=function(e,t){return t||Ke(e,4,this.length),oe(this,e,!0,23,4)},le.prototype.readFloatBE=function(e,t){return t||Ke(e,4,this.length),oe(this,e,!1,23,4)},le.prototype.readDoubleLE=function(e,t){return t||Ke(e,8,this.length),oe(this,e,!0,52,8)},le.prototype.readDoubleBE=function(e,t){return t||Ke(e,8,this.length),oe(this,e,!1,52,8)},le.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||Ne(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a<r&&(n*=256);)this[t+a]=e/n&255;return t+r},le.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||Ne(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+r},le.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,1,255,0),le.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},le.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qe(this,e,t,!0),t+2},le.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qe(this,e,t,!1),t+2},le.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Le(this,e,t,!0),t+4},le.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Le(this,e,t,!1),t+4},le.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);Ne(this,e,t,r,n-1,-n)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},le.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);Ne(this,e,t,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},le.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,1,127,-128),le.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},le.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qe(this,e,t,!0),t+2},le.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qe(this,e,t,!1),t+2},le.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,2147483647,-2147483648),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Le(this,e,t,!0),t+4},le.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Le(this,e,t,!1),t+4},le.prototype.writeFloatLE=function(e,t,r){return Ue(this,e,t,!0,r)},le.prototype.writeFloatBE=function(e,t,r){return Ue(this,e,t,!1,r)},le.prototype.writeDoubleLE=function(e,t,r){return Fe(this,e,t,!0,r)},le.prototype.writeDoubleBE=function(e,t,r){return Fe(this,e,t,!1,r)},le.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,a=i-r;if(this===e&&r<t&&t<i)for(n=a-1;n>=0;--n)e[n+t]=this[n+r];else if(a<1e3||!le.TYPED_ARRAY_SUPPORT)for(n=0;n<a;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},le.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!le.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=ve(e)?e:Ve(new le(e,i).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var He=/[^+\/0-9A-Za-z-_]/g;function Ye(e){return e<16?"0"+e.toString(16):e.toString(16)}function Ve(e,t){var r;t=t||1/0;for(var i=e.length,n=null,a=[],o=0;o<i;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function Qe(e){return function(e){var t,r,i,n,a,o;re||ie();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new te(3*s/4-a),i=a>0?s-4:s;var d=0;for(t=0,r=0;t<i;t+=4,r+=3)n=ee[e.charCodeAt(t)]<<18|ee[e.charCodeAt(t+1)]<<12|ee[e.charCodeAt(t+2)]<<6|ee[e.charCodeAt(t+3)],o[d++]=n>>16&255,o[d++]=n>>8&255,o[d++]=255&n;return 2===a?(n=ee[e.charCodeAt(t)]<<2|ee[e.charCodeAt(t+1)]>>4,o[d++]=255&n):1===a&&(n=ee[e.charCodeAt(t)]<<10|ee[e.charCodeAt(t+1)]<<4|ee[e.charCodeAt(t+2)]>>2,o[d++]=n>>8&255,o[d++]=255&n),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(He,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function We(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function Ge(e){return null!=e&&(!!e._isBuffer||Xe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Xe(e.slice(0,0))}(e))}function Xe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Ze=Object.freeze({__proto__:null,Buffer:le,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),le.alloc(+e)},isBuffer:Ge,kMaxLength:ce});const $e=new W("ido");var et,tt,rt,it,nt;!function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(et||(et={})),function(e){e.InvalidInitOptions="invalid_initialization_options",e.NotInitialized="not_initialized",e.NoActiveJourney="no_active_journey",e.NetworkError="network_error",e.ClientResponseNotValid="client_response_not_valid",e.ServerError="server_error",e.InvalidState="invalid_state",e.InvalidCredentials="invalid_credentials",e.ExpiredOTPPasscode="expired_otp_passcode",e.ExpiredValidationPasscode="expired_validation_passcode",e.MaxResendReached="expired_otp_passcode"}(tt||(tt={})),function(e){e.ClientInput="client_input",e.Cancel="cancel",e.Fail="failure",e.Custom="custom",e.Resend="resend"}(rt||(rt={})),function(e){e.JourneySuccess="journey_success",e.ClientInputRequired="client_input_required",e.ClientInputUpdateRequired="client_input_update_required",e.JourneyRejection="journey_rejection"}(it||(it={})),function(e){e.Rejection="action:rejection",e.Success="action:success",e.Information="action:information",e.DebugBreak="action:debug_break",e.WaitForAnotherDevice="action:wait_for_another_device",e.CryptoBindingRegistration="action:crypto_binding_registration",e.CryptoBindingValidation="action:crypto_binding_validation",e.RegisterDeviceAction="transmit_platform_device_registration",e.ValidateDeviceAction="transmit_platform_device_validation",e.WebAuthnRegistration="action:webauthn_registration",e.DrsTriggerAction="action:drs_trigger_action",e.IdentityVerification="action:id_verification",e.EmailOTPAuthentication="transmit_platform_email_otp_authentication",e.SmsOTPAuthentication="transmit_platform_sms_otp_authentication",e.EmailValidation="transmit_platform_email_validation",e.SmsValidation="transmit_platform_sms_validation",e.TotpRegistration="transmit_platform_totp_registration",e.TransactionSigningTOTP="transmit_platform_transaction_signing_totp",e.InvokeIDP="invoke_idp",e.WebAuthnTransactionSigning="transmit_platform_transaction_signing_webauthn",e.SelectOrganization="transmit_platform_select_organization",e.MobileApproveAuthentication="transmit_platform_mobile_approve_authentication"}(nt||(nt={}));const at=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.Info;this.logLevel=e}setLogLevel(e){e<et.Debug||e>et.Error?this.error("Invalid log level"):this.logLevel=e}debug(e){this.logLevel<=et.Debug&&console.debug(`[DEBUG] ${e}`)}info(e){this.logLevel<=et.Info&&console.info(`[INFO] ${e}`)}warning(e){this.logLevel<=et.Warning&&console.warn(`[WARNING] ${e}`)}error(e){this.logLevel<=et.Error&&console.error(`[ERROR] ${e}`)}},ot={[nt.CryptoBindingRegistration]:"input",[nt.CryptoBindingValidation]:"input",[nt.RegisterDeviceAction]:"data",[nt.ValidateDeviceAction]:"data"},st="api/v2/",dt={path:"auth/sso"},ft={path:"auth/anonymous_invoke"},ct={path:"auth/assert"},ht={path:"auth/poll"},ut={path:"auth/create_debug_token"},lt={path:"auth/key_exchange"},bt={headers:{mandatory:!0,dummy:[{type:"correlation_id",correlation_id:"337BFFE6BEE7D694B8FA41F42B00742CA537DC398F79369A3A60E04D0EB2E8E1"}]},data:{mandatory:!0,dummy:{collection_result:{metadata:{timestamp:(new Date).getTime()},content:{}},policy_request_id:"LoginWithMenu"},large_dummy:{metadata:{timestamp:1679422144431},content:{device_details:{logged_users:1,persistence_mode:"persistent",device_id:"8951bd7b67a959e7b12b5018816f9ce4",os_type:"Mac OS",os_version:"10.15.7",device_model:"Chrome 111.0.0.0"},location:{enabled:!1},capabilities:{fido2_user_verifying_platform_authenticator_available:!0,audio_acquisition_supported:!0,finger_print_supported:!1,image_acquisition_supported:!1,persistent_keys_supported:!0,face_id_key_bio_protection_supported:!1,fido_client_present:!1,fido2_client_present:!0,dyadic_present:!1,installed_plugins:[]},collector_state:{accounts:"disabled",devicedetails:"active",contacts:"disabled",owner:"disabled",software:"disabled",location:"disabled",locationcountry:"disabled",bluetooth:"disabled",externalsdkdetails:"active",hwauthenticators:"active",capabilities:"active",fidoauthenticators:"disabled",largedata:"active",localenrollments:"active",devicefingerprint:"active",apppermissions:"disabled"},local_enrollments:{}},fp2:{user_agent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",webdriver:!0,language:"en-US",color_depth:30,device_memory:8,pixel_ratio:2,hardware_concurrency:12,screen_resolution:[1680,1050],available_screen_resolution:[1680,1025],timezone_offset:240,timezone:"America/New_York",session_storage:!0,local_storage:!0,indexed_db:!0,add_behavior:!1,open_database:!0,cpu_class:"not available",platform:"MacIntel",do_not_track:"not available",plugins:[["PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Chrome PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Chromium PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Microsoft Edge PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["WebKit built-in PDF","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]]],canvas:["canvas winding:yes","canvas fp:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB9AAAADICAYAAACwGnoBAAAAAXNSR0IArs4c6QAAIABJREFUeF7s3XeYXVW9//H3Omdaeu+FGgiE9BDAgmIBQRRQ4eIP0JCQmdC8YgHrZRQLAooSSjIpRMpVCZciiIAiKhoIpEMoUtILKaS3KWf/nu8+e0/2nDkzc+bMmckMfNbz8Ejm7L3W2q8zwT8++/tdjlY+PLz+wAhgKHA0MBjoB/QEDq9j+6uAzcAGYDXwFvA6sMzh1of3eHjtgWHA8ZH/7Qa0q+Mfu3VfHf9sA14Flof/63B7q/fn5fY5cAefo5V/hdqeBCQgAQlIQAISkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQggTYh4FrbLj2844BPAh8FTg4C81xucyewBygAeuRy4uhcrwF/6sx7Tw3lwMKT6LDtNDr7T2Sxf26GvRjwAvBP4G84Z0tmNLxivIwufJ9d5Mpodb/v7zNiPY4EJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkIAE2rRAqwgUPbyTgC8AnwMsQG+TYz7wEPAYUGeaPQr4MPCh4BWBQTl7VFvSln4I52wrdQ4F6Dkz10QSkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkMD7SOCQBegenlV/XwpMCtqzt0nWrcDdwKygR3yjH+IU4LPBqwPWqD43w8J029IcnLMt1hgK0HODrFkkIAEJSEACEpCABCQgAQlIQAISkIAEJCABCUhAAhKQgAQkIIH3l0D9AXppaR6lpZX+I0f/vQkGHt5w4EqgJJNprNf4GnYzgA7EcWxhPz0pyuTWjK7ZxgG6UehfW0mCchK0J6/Be18G7gCmN3ilPYER5jd4JacDnw/CdDvpPXXsPQDxOBQ2vL/IrdOAO3HOtuwPC9C3056uHDyiveHNte0rttCRXmW7c/PCSH1/F+r6LJt72ja5di8BCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkIAEJCCBNidQO1CcNPNo4lU/Ak7AeTvwXAc8twbnHUdl3jhmT9qVzVN6eFZf/W3g4kzvf43tXMW/6EIBf2Ud/+YcRvAgD3E653F4ptOkve6fbOBbvEARcZ7lc3ydefyW//AHPsWZ1N1XfRlwM3Bfg6sngEWA5dZ2lHsjOtPb+wHWzN7C9C8DO3fD3Bdg4Ttw3blwZO8GV09zwb3ALUyZftyR3pbfn83L/IY/ZDNPm7vnGYbyKa6BWGI40y5/JesHmDTzMPIqLwGOwnPjgd9QVlLmzze5bAKxxEA8Z9+Y/ZpcR1nJarK5J+sN6kYJSEACEpCABCQgAQlIQAISkIAEJCABCUhAAhKQgAQkIAEJSKApAjUD9MllZ+K8J/DcNLZ3/W/mXlBOaWmMDX2/h+duIBHry8zJ7zZmQQ+vF3B9UHXemFv5DE9QwvF+oD2L15nAMfyOt/3wvEcOqtBLeI632MEznM1G9tKP+3iCM9MG6JuAHwdV55k/hIXoM4PDzhsRoEcXOAGYAHxmG9w2tykBejjrHeNLrrvyZFa1ugB9PV1ZS1fGszJz4gyutGr7uYyluPD8IqZ+7UAGt6S/ZHLZTJx3P2Ulz/qBufPuJq+yH55rT2XeLGYUn+Z3aljfbwUwl7KSb5DNPVlvUDdKQAISkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAJNETgYoF9+Zzeq4quAFfTfMJrSUkt/D47JZc/iuYnMnGzhYEbDw7sK+CnQOaMbUi7qzN0NVoRnM294z38zD6tyf5qz2EE5XZmTNkC/Hfi+FYJntZidkN7ICvR06/TfBX1+B788F07LqgK9eta8kmv4CBt4thVVoO8jnzP4b67mWc5nYVbSDd3kymhaC/eSaU+SiC1hRvF3KJ4+FHgN532RRGwjzvs35QXdmHPpdoqn3w+Mo6zkWLK5p6EH0ecSkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkECzCBwMFIunX+6fle25S5lRPKfWapfNOI5YYj0wFRjmH/+diC3Eeb8hlojjuespK3ma4um39NhUOOL5x88teKRy5cfWsofx9OYuXuUIOvFTTuQJVnMfb/lnmc/k1Fpnmr/Bdn7CYu7jTT7NQAbRgV9wEovYwu94iy9zNKczkASeP6+1Y99DJcfSlR8yhnbEeYxVzOYNJnIsv+YVzmAgP2AMv+Zl/swaulHA62ynH+15MhKg38h4/sMO/sVGPs3R/IfR/IUYYDXo9u7APvDPDv8Y0A74D/AOcDzwFrANOBGqW8yHAfoQ8IPh7UBfwDrap+a5Nu/rwA7ACqUtKG8PWFZrnfN/B+3PhQsLoO+L0KcSThqS/OfNjfDnRfCpkbBtF7z4Fpx0DCx8GzZuh48Ng9NtTTt9/hpgC0f564xlLOuYzT104ABv+d/Vx/xK8G104G7mMMDfc3JUEqOEi1nCIE7jDW7hQd6hJ5O5hE/xOt/lz2yiE9/jPJYxgE/yOpfzDwbzHj/lLJ7jaH++…brB0xZVAGAtqpyy+87fNf4HUyf1sNzSz83GXvYnYKXM6qTDBVhJ29tL7uzrJF+rcOC5Dy8Hq5efB1QGSkNdigBLnWXzB/zn10h7RWRj1hcaCpHOK7cB1fwKc4cvBQCWL6UDjnPuTG//1SRguT7Vqy8CqoAWMXRFBQBWRaE0X3bu9kH/avgtoVv6ndkDVJq9tRY7wErc8bOvknxFBt+/csByS787LgGqxK1PMj2AlaStg6TOvmLQv3JLv9f+FVAlbnnS6QGspO0VOXerbBaF/PoNfwNUiVttIj2AlbjNZ2+W9l2XgVXiNptJD2CZsZpEUUC/AgBLv4dkgAJmFABYZqwmURTQrwDA0u8hGaCAGQUAlhmrSRQF9CsAsPR7SAYoYEYBgGXGahJFAf0K/B9qEBa1B23aowAAAABJRU5ErkJggg==","extensions:ANGLE_instanced_arrays;EXT_blend_minmax;EXT_color_buffer_half_float;EXT_disjoint_timer_query;EXT_float_blend;EXT_frag_depth;EXT_shader_texture_lod;EXT_texture_compression_rgtc;EXT_texture_filter_anisotropic;EXT_sRGB;KHR_parallel_shader_compile;OES_element_index_uint;OES_fbo_render_mipmap;OES_standard_derivatives;OES_texture_float;OES_texture_float_linear;OES_texture_half_float;OES_texture_half_float_linear;OES_vertex_array_object;WEBGL_color_buffer_float;WEBGL_compressed_texture_s3tc;WEBGL_compressed_texture_s3tc_srgb;WEBGL_debug_renderer_info;WEBGL_debug_shaders;WEBGL_depth_texture;WEBGL_draw_buffers;WEBGL_lose_context;WEBGL_multi_draw","webgl aliased line width range:[1, 1]","webgl aliased point size range:[1, 8191]","webgl alpha bits:8","webgl antialiasing:yes","webgl blue bits:8","webgl depth bits:24","webgl green bits:8","webgl max anisotropy:16","webgl max combined texture image units:32","webgl max cube map texture size:16384","webgl max fragment uniform vectors:1024","webgl max render buffer size:16384","webgl max texture image units:16","webgl max texture size:16384","webgl max varying vectors:32","webgl max vertex attribs:16","webgl max vertex texture image units:16","webgl max vertex uniform vectors:1024","webgl max viewport dims:[16384, 16384]","webgl red bits:8","webgl renderer:WebKit WebGL","webgl shading language version:WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)","webgl stencil bits:0","webgl vendor:WebKit","webgl version:WebGL 1.0 (OpenGL ES 2.0 Chromium)","webgl unmasked vendor:Google Inc. (ATI Technologies Inc.)","webgl unmasked renderer:ANGLE (ATI Technologies Inc., AMD Radeon Pro 560X OpenGL Engine, OpenGL 4.1)","webgl vertex shader high float precision:23","webgl vertex shader high float precision rangeMin:127","webgl vertex shader high float precision rangeMax:127","webgl vertex shader medium float precision:23","webgl vertex shader medium float precision rangeMin:127","webgl vertex shader medium float precision rangeMax:127","webgl vertex shader low float precision:23","webgl vertex shader low float precision rangeMin:127","webgl vertex shader low float precision rangeMax:127","webgl fragment shader high float precision:23","webgl fragment shader high float precision rangeMin:127","webgl fragment shader high float precision rangeMax:127","webgl fragment shader medium float precision:23","webgl fragment shader medium float precision rangeMin:127","webgl fragment shader medium float precision rangeMax:127","webgl fragment shader low float precision:23","webgl fragment shader low float precision rangeMin:127","webgl fragment shader low float precision rangeMax:127","webgl vertex shader high int precision:0","webgl vertex shader high int precision rangeMin:31","webgl vertex shader high int precision rangeMax:30","webgl vertex shader medium int precision:0","webgl vertex shader medium int precision rangeMin:31","webgl vertex shader medium int precision rangeMax:30","webgl vertex shader low int precision:0","webgl vertex shader low int precision rangeMin:31","webgl vertex shader low int precision rangeMax:30","webgl fragment shader high int precision:0","webgl fragment shader high int precision rangeMin:31","webgl fragment shader high int precision rangeMax:30","webgl fragment shader medium int precision:0","webgl fragment shader medium int precision rangeMin:31","webgl fragment shader medium int precision rangeMax:30","webgl fragment shader low int precision:0","webgl fragment shader low int precision rangeMin:31","webgl fragment shader low int precision rangeMax:30"],webgl_vendor_and_renderer:"Google Inc. (ATI Technologies Inc.)~ANGLE (ATI Technologies Inc., AMD Radeon Pro 560X OpenGL Engine, OpenGL 4.1)",ad_block:!1,has_lied_languages:!1,has_lied_resolution:!1,has_lied_os:!1,has_lied_browser:!1,touch_support:[0,!1,!1],fonts:["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Comic Sans MS","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","LUCIDA GRANDE","Microsoft Sans Serif","Monaco","Palatino","Tahoma","Times","Times New Roman","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"],fonts_flash:"swf object not loaded",audio:"124.04347657808103",enumerate_devices:["id=;gid=;audioinput;","id=;gid=;videoinput;","id=;gid=;audiooutput;"]}},policy_request_id:"LoginWithMenu",params:{}}},pt=[{"control_flow.0":["assertion_id","type"]}];class gt extends Error{constructor(e,t){at.error(`[ERROR] ${e}`),super(e),this.description=e,this.errorCode=t}static convertFromAssertionError(e){switch(e){case 28:return tt.ClientResponseNotValid;case 29:case 31:case 35:return tt.InvalidCredentials;case 30:return tt.ExpiredOTPPasscode;case 32:return tt.ExpiredValidationPasscode;case 33:return tt.MaxResendReached;default:return tt.ServerError}}}var yt,mt,vt;!function(e){e.JsonRejection="Json Rejection",e.TextRejection="Text Rejection",e.UpdateAction="Update Action",e.NextAction="Next Action",e.JourneyEnd="Journey End"}(yt||(yt={})),function(e){e.Pending="pending",e.Completed="completed",e.Rejected="rejected"}(mt||(mt={})),function(e){e.Form="form",e.LoginForm="login_form",e.Rejection="rejection",e.Information="information",e.DebugBreak="debug_break",e.WaitForTicket="wait_for_ticket",e.DrsTriggerAction="transmit_acp",e.IdentityVerification="kyc",e.WebAuthnRegistration="transmit_platform_web_authn_registration"}(vt||(vt={}));var wt={},_t="6.6.1",Mt={},At={},St={get exports(){return At},set exports(e){At=e}},It=X(Ze);!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function d(e,t,r,i){for(var n=0,a=Math.min(e.length,r),o=t;o<a;o++){var s=e.charCodeAt(o)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,i){if("number"==typeof e)return this._initNumber(e,t,i);if("object"==typeof e)return this._initArray(e,t,i);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,i):(this._parseBase(e,t,n),"le"===i&&this._initArray(this.toArray(),t,i)))},n.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),t,i)},n.prototype._initArray=function(e,t,i){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,o,s=0;if("be"===i)for(n=e.length-1,a=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===i)for(n=0,a=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=s(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=s(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,o=a%i,s=Math.min(a,a-o)+r,f=0,c=r;c<s;c+=i)f=d(e,c,c+i,t),this.imuln(n),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==o){var h=1;for(f=d(e,c,e.length,t),c=0;c<o;c++)h*=t;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},n.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],o=n*a,s=67108863&o,d=o/67108864|0;r.words[0]=s;for(var f=1;f<i;f++){for(var c=d>>>26,h=67108863&d,u=Math.min(f,t.length-1),l=Math.max(0,f-e.length+1);l<=u;l++){var b=f-l|0;c+=(o=(n=0|e.words[b])*(a=0|t.words[l])+h)/67108864|0,h=67108863&o}r.words[f]=0|h,d=0|c}return 0!==d?r.words[f]=0|d:r.length--,r.strip()}n.prototype.toString=function(e,t){var i;if(t=0|t||1,16===(e=e||10)||"hex"===e){i="";for(var n=0,a=0,o=0;o<this.length;o++){var s=this.words[o],d=(16777215&(s<<n|a)).toString(16);a=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),i=0!==a||o!==this.length-1?f[6-d.length]+d+i:d+i}for(0!==a&&(i=a.toString(16)+i);i.length%t!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(e===(0|e)&&e>=2&&e<=36){var u=c[e],l=h[e];i="";var b=this.clone();for(b.negative=0;!b.isZero();){var p=b.modn(l).toString(e);i=(b=b.idivn(l)).isZero()?p+i:f[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%t!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==a),this.toArrayLike(a,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,i){var n=this.byteLength(),a=i||Math.max(1,n);r(n<=a,"byte array longer than desired length"),r(a>0,"Requested array length <= 0"),this.strip();var o,s,d="le"===t,f=new e(a),c=this.clone();if(d){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),f[s]=o;for(;s<a;s++)f[s]=0}else{for(s=0;s<a-n;s++)f[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),f[a-s-1]=o}return f},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},n.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},n.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),i=e%26;this._expand(t),i>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var i=e/26|0,n=e%26;return this._expand(i+1),this.words[i]=t?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},n.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},n.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)a=(t=(0|r.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(e){return this.clone().isub(e)};var l=function(e,t,r){var i,n,a,o=e.words,s=t.words,d=r.words,f=0,c=0|o[0],h=8191&c,u=c>>>13,l=0|o[1],b=8191&l,p=l>>>13,g=0|o[2],y=8191&g,m=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],A=8191&M,S=M>>>13,I=0|o[5],R=8191&I,x=I>>>13,E=0|o[6],P=8191&E,k=E>>>13,B=0|o[7],C=8191&B,j=B>>>13,z=0|o[8],D=8191&z,T=z>>>13,O=0|o[9],K=8191&O,N=O>>>13,q=0|s[0],L=8191&q,J=q>>>13,U=0|s[1],F=8191&U,H=U>>>13,Y=0|s[2],V=8191&Y,Q=Y>>>13,W=0|s[3],G=8191&W,X=W>>>13,Z=0|s[4],$=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],ae=8191&ne,oe=ne>>>13,se=0|s[7],de=8191&se,fe=se>>>13,ce=0|s[8],he=8191&ce,ue=ce>>>13,le=0|s[9],be=8191&le,pe=le>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(f+(i=Math.imul(h,L))|0)+((8191&(n=(n=Math.imul(h,J))+Math.imul(u,L)|0))<<13)|0;f=((a=Math.imul(u,J))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(b,L),n=(n=Math.imul(b,J))+Math.imul(p,L)|0,a=Math.imul(p,J);var ye=(f+(i=i+Math.imul(h,F)|0)|0)+((8191&(n=(n=n+Math.imul(h,H)|0)+Math.imul(u,F)|0))<<13)|0;f=((a=a+Math.imul(u,H)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(y,L),n=(n=Math.imul(y,J))+Math.imul(m,L)|0,a=Math.imul(m,J),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(p,F)|0,a=a+Math.imul(p,H)|0;var me=(f+(i=i+Math.imul(h,V)|0)|0)+((8191&(n=(n=n+Math.imul(h,Q)|0)+Math.imul(u,V)|0))<<13)|0;f=((a=a+Math.imul(u,Q)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(w,L),n=(n=Math.imul(w,J))+Math.imul(_,L)|0,a=Math.imul(_,J),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(m,F)|0,a=a+Math.imul(m,H)|0,i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,Q)|0)+Math.imul(p,V)|0,a=a+Math.imul(p,Q)|0;var ve=(f+(i=i+Math.imul(h,G)|0)|0)+((8191&(n=(n=n+Math.imul(h,X)|0)+Math.imul(u,G)|0))<<13)|0;f=((a=a+Math.imul(u,X)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(A,L),n=(n=Math.imul(A,J))+Math.imul(S,L)|0,a=Math.imul(S,J),i=i+Math.imul(w,F)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,F)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,Q)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,X)|0)+Math.imul(p,G)|0,a=a+Math.imul(p,X)|0;var we=(f+(i=i+Math.imul(h,$)|0)|0)+((8191&(n=(n=n+Math.imul(h,ee)|0)+Math.imul(u,$)|0))<<13)|0;f=((a=a+Math.imul(u,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(R,L),n=(n=Math.imul(R,J))+Math.imul(x,L)|0,a=Math.imul(x,J),i=i+Math.imul(A,F)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(S,F)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,Q)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,X)|0,i=i+Math.imul(b,$)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(p,$)|0,a=a+Math.imul(p,ee)|0;var _e=(f+(i=i+Math.imul(h,re)|0)|0)+((8191&(n=(n=n+Math.imul(h,ie)|0)+Math.imul(u,re)|0))<<13)|0;f=((a=a+Math.imul(u,ie)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(P,L),n=(n=Math.imul(P,J))+Math.imul(k,L)|0,a=Math.imul(k,J),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(x,F)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,Q)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(p,re)|0,a=a+Math.imul(p,ie)|0;var Me=(f+(i=i+Math.imul(h,ae)|0)|0)+((8191&(n=(n=n+Math.imul(h,oe)|0)+Math.imul(u,ae)|0))<<13)|0;f=((a=a+Math.imul(u,oe)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(C,L),n=(n=Math.imul(C,J))+Math.imul(j,L)|0,a=Math.imul(j,J),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,H)|0)+Math.imul(k,F)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,Q)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,ee)|0,i=i+Math.imul(y,re)|0,n=(n=n+Math.imul(y,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0,i=i+Math.imul(b,ae)|0,n=(n=n+Math.imul(b,oe)|0)+Math.imul(p,ae)|0,a=a+Math.imul(p,oe)|0;var Ae=(f+(i=i+Math.imul(h,de)|0)|0)+((8191&(n=(n=n+Math.imul(h,fe)|0)+Math.imul(u,de)|0))<<13)|0;f=((a=a+Math.imul(u,fe)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(D,L),n=(n=Math.imul(D,J))+Math.imul(T,L)|0,a=Math.imul(T,J),i=i+Math.imul(C,F)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(j,F)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,Q)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,i=i+Math.imul(w,re)|0,n=(n=n+Math.imul(w,ie)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ie)|0,i=i+Math.imul(y,ae)|0,n=(n=n+Math.imul(y,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0,i=i+Math.imul(b,de)|0,n=(n=n+Math.imul(b,fe)|0)+Math.imul(p,de)|0,a=a+Math.imul(p,fe)|0;var Se=(f+(i=i+Math.imul(h,he)|0)|0)+((8191&(n=(n=n+Math.imul(h,ue)|0)+Math.imul(u,he)|0))<<13)|0;f=((a=a+Math.imul(u,ue)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(K,L),n=(n=Math.imul(K,J))+Math.imul(N,L)|0,a=Math.imul(N,J),i=i+Math.imul(D,F)|0,n=(n=n+Math.imul(D,H)|0)+Math.imul(T,F)|0,a=a+Math.imul(T,H)|0,i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,Q)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,Q)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(x,$)|0,a=a+Math.imul(x,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(S,re)|0,a=a+Math.imul(S,ie)|0,i=i+Math.imul(w,ae)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,i=i+Math.imul(y,de)|0,n=(n=n+Math.imul(y,fe)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,fe)|0,i=i+Math.imul(b,he)|0,n=(n=n+Math.imul(b,ue)|0)+Math.imul(p,he)|0,a=a+Math.imul(p,ue)|0;var Ie=(f+(i=i+Math.imul(h,be)|0)|0)+((8191&(n=(n=n+Math.imul(h,pe)|0)+Math.imul(u,be)|0))<<13)|0;f=((a=a+Math.imul(u,pe)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(K,F),n=(n=Math.imul(K,H))+Math.imul(N,F)|0,a=Math.imul(N,H),i=i+Math.imul(D,V)|0,n=(n=n+Math.imul(D,Q)|0)+Math.imul(T,V)|0,a=a+Math.imul(T,Q)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,X)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,X)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ie)|0,i=i+Math.imul(A,ae)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,i=i+Math.imul(w,de)|0,n=(n=n+Math.imul(w,fe)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,fe)|0,i=i+Math.imul(y,he)|0,n=(n=n+Math.imul(y,ue)|0)+Math.imul(m,he)|0,a=a+Math.imul(m,ue)|0;var Re=(f+(i=i+Math.imul(b,be)|0)|0)+((8191&(n=(n=n+Math.imul(b,pe)|0)+Math.imul(p,be)|0))<<13)|0;f=((a=a+Math.imul(p,pe)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(K,V),n=(n=Math.imul(K,Q))+Math.imul(N,V)|0,a=Math.imul(N,Q),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(T,G)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(j,$)|0,a=a+Math.imul(j,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(k,re)|0,a=a+Math.imul(k,ie)|0,i=i+Math.imul(R,ae)|0,n=(n=n+Math.imul(R,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,i=i+Math.imul(A,de)|0,n=(n=n+Math.imul(A,fe)|0)+Math.imul(S,de)|0,a=a+Math.imul(S,fe)|0,i=i+Math.imul(w,he)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul(_,he)|0,a=a+Math.imul(_,ue)|0;var xe=(f+(i=i+Math.imul(y,be)|0)|0)+((8191&(n=(n=n+Math.imul(y,pe)|0)+Math.imul(m,be)|0))<<13)|0;f=((a=a+Math.imul(m,pe)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(K,G),n=(n=Math.imul(K,X))+Math.imul(N,G)|0,a=Math.imul(N,X),i=i+Math.imul(D,$)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,ee)|0,i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ie)|0,i=i+Math.imul(P,ae)|0,n=(n=n+Math.imul(P,oe)|0)+Math.imul(k,ae)|0,a=a+Math.imul(k,oe)|0,i=i+Math.imul(R,de)|0,n=(n=n+Math.imul(R,fe)|0)+Math.imul(x,de)|0,a=a+Math.imul(x,fe)|0,i=i+Math.imul(A,he)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(S,he)|0,a=a+Math.imul(S,ue)|0;var Ee=(f+(i=i+Math.imul(w,be)|0)|0)+((8191&(n=(n=n+Math.imul(w,pe)|0)+Math.imul(_,be)|0))<<13)|0;f=((a=a+Math.imul(_,pe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(K,$),n=(n=Math.imul(K,ee))+Math.imul(N,$)|0,a=Math.imul(N,ee),i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(T,re)|0,a=a+Math.imul(T,ie)|0,i=i+Math.imul(C,ae)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,oe)|0,i=i+Math.imul(P,de)|0,n=(n=n+Math.imul(P,fe)|0)+Math.imul(k,de)|0,a=a+Math.imul(k,fe)|0,i=i+Math.imul(R,he)|0,n=(n=n+Math.imul(R,ue)|0)+Math.imul(x,he)|0,a=a+Math.imul(x,ue)|0;var Pe=(f+(i=i+Math.imul(A,be)|0)|0)+((8191&(n=(n=n+Math.imul(A,pe)|0)+Math.imul(S,be)|0))<<13)|0;f=((a=a+Math.imul(S,pe)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(K,re),n=(n=Math.imul(K,ie))+Math.imul(N,re)|0,a=Math.imul(N,ie),i=i+Math.imul(D,ae)|0,n=(n=n+Math.imul(D,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,oe)|0,i=i+Math.imul(C,de)|0,n=(n=n+Math.imul(C,fe)|0)+Math.imul(j,de)|0,a=a+Math.imul(j,fe)|0,i=i+Math.imul(P,he)|0,n=(n=n+Math.imul(P,ue)|0)+Math.imul(k,he)|0,a=a+Math.imul(k,ue)|0;var ke=(f+(i=i+Math.imul(R,be)|0)|0)+((8191&(n=(n=n+Math.imul(R,pe)|0)+Math.imul(x,be)|0))<<13)|0;f=((a=a+Math.imul(x,pe)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(K,ae),n=(n=Math.imul(K,oe))+Math.imul(N,ae)|0,a=Math.imul(N,oe),i=i+Math.imul(D,de)|0,n=(n=n+Math.imul(D,fe)|0)+Math.imul(T,de)|0,a=a+Math.imul(T,fe)|0,i=i+Math.imul(C,he)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(j,he)|0,a=a+Math.imul(j,ue)|0;var Be=(f+(i=i+Math.imul(P,be)|0)|0)+((8191&(n=(n=n+Math.imul(P,pe)|0)+Math.imul(k,be)|0))<<13)|0;f=((a=a+Math.imul(k,pe)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863,i=Math.imul(K,de),n=(n=Math.imul(K,fe))+Math.imul(N,de)|0,a=Math.imul(N,fe),i=i+Math.imul(D,he)|0,n=(n=n+Math.imul(D,ue)|0)+Math.imul(T,he)|0,a=a+Math.imul(T,ue)|0;var Ce=(f+(i=i+Math.imul(C,be)|0)|0)+((8191&(n=(n=n+Math.imul(C,pe)|0)+Math.imul(j,be)|0))<<13)|0;f=((a=a+Math.imul(j,pe)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(K,he),n=(n=Math.imul(K,ue))+Math.imul(N,he)|0,a=Math.imul(N,ue);var je=(f+(i=i+Math.imul(D,be)|0)|0)+((8191&(n=(n=n+Math.imul(D,pe)|0)+Math.imul(T,be)|0))<<13)|0;f=((a=a+Math.imul(T,pe)|0)+(n>>>13)|0)+(je>>>26)|0,je&=67108863;var ze=(f+(i=Math.imul(K,be))|0)+((8191&(n=(n=Math.imul(K,pe))+Math.imul(N,be)|0))<<13)|0;return f=((a=Math.imul(N,pe))+(n>>>13)|0)+(ze>>>26)|0,ze&=67108863,d[0]=ge,d[1]=ye,d[2]=me,d[3]=ve,d[4]=we,d[5]=_e,d[6]=Me,d[7]=Ae,d[8]=Se,d[9]=Ie,d[10]=Re,d[11]=xe,d[12]=Ee,d[13]=Pe,d[14]=ke,d[15]=Be,d[16]=Ce,d[17]=je,d[18]=ze,0!==f&&(d[19]=f,r.length++),r};function b(e,t,r){return(new p).mulp(e,t,r)}function p(e,t){this.x=e,this.y=t}Math.imul||(l=u),n.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return r=10===this.length&&10===e.length?l(this,e,t):i<63?u(this,e,t):i<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var o=n;n=0;for(var s=67108863&i,d=Math.min(a,t.length-1),f=Math.max(0,a-e.length+1);f<=d;f++){var c=a-f,h=(0|e.words[c])*(0|t.words[f]),u=67108863&h;s=67108863&(u=u+s|0),n+=(o=(o=o+(h/67108864|0)|0)+(u>>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,e,t):b(this,e,t),r},p.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},p.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},p.prototype.permute=function(e,t,r,i,n,a){for(var o=0;o<a;o++)i[o]=t[e[o]],n[o]=r[e[o]]},p.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,d=Math.cos(2*Math.PI/s),f=Math.sin(2*Math.PI/s),c=0;c<n;c+=s)for(var h=d,u=f,l=0;l<o;l++){var b=r[c+l],p=i[c+l],g=r[c+l+o],y=i[c+l+o],m=h*g-u*y;y=h*y+u*g,g=m,r[c+l]=b+g,i[c+l]=p+y,r[c+l+o]=b-g,i[c+l+o]=p-y,l!==s&&(m=d*h-f*u,u=d*u+f*h,h=m)}},p.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},p.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},p.prototype.convert13b=function(e,t,i,n){for(var a=0,o=0;o<t;o++)a+=0|e[o],i[2*o]=8191&a,a>>>=13,i[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<n;++o)i[o]=0;r(0===a),r(0==(-8192&a))},p.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},p.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),o=new Array(i),s=new Array(i),d=new Array(i),f=new Array(i),c=new Array(i),h=new Array(i),u=r.words;u.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,f,i),this.transform(o,a,s,d,i,n),this.transform(f,a,c,h,i,n);for(var l=0;l<i;l++){var b=s[l]*c[l]-d[l]*h[l];d[l]=s[l]*h[l]+d[l]*c[l],s[l]=b}return this.conjugate(s,d,i),this.transform(s,d,u,a,i,n),this.conjugate(u,a,i),this.normalize13b(u,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),b(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,i=0;i<this.length;i++){var n=(0|this.words[i])*e,a=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=a>>>26,this.words[i]=67108863&a}return 0!==t&&(this.words[i]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var a=r.sqr();i<t.length;i++,a=a.sqr())0!==t[i]&&(r=r.mul(a));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,i=e%26,n=(e-i)/26,a=67108863>>>26-i<<26-i;if(0!==i){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,d=(0|this.words[t])-s<<i;this.words[t]=d|o,o=s>>>26-i}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,i){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,d=i;if(n-=o,n=Math.max(0,n),d){for(var f=0;f<o;f++)d.words[f]=this.words[f];d.length=o}if(0===o);else if(this.length>o)for(this.length-=o,f=0;f<this.length;f++)this.words[f]=this.words[f+o];else this.words[0]=0,this.length=1;var c=0;for(f=this.length-1;f>=0&&(0!==c||f>=n);f--){var h=0|this.words[f];this.words[f]=c<<26-a|h>>>a,c=h&s}return d&&0!==c&&(d.words[d.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,i){return r(0===this.negative),this.iushrn(e,t,i)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26,n=1<<t;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==t&&i++,this.length=Math.min(i,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},n.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},n.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,i){var n,a,o=e.length+i;this._expand(o);var s=0;for(n=0;n<e.length;n++){a=(0|this.words[n+i])+s;var d=(0|e.words[n])*t;s=((a-=67108863&d)>>26)-(d/67108864|0),this.words[n+i]=67108863&a}for(;n<this.length-i;n++)s=(a=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&a;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(a=-(0|this.words[n])+s)>>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),a=e,o=0|a.words[a.length-1];0!=(r=26-this._countBits(o))&&(a=a.ushln(r),i.iushln(r),o=0|a.words[a.length-1]);var s,d=i.length-a.length;if("mod"!==t){(s=new n(null)).length=d+1,s.words=new Array(s.length);for(var f=0;f<s.length;f++)s.words[f]=0}var c=i.clone()._ishlnsubmul(a,1,d);0===c.negative&&(i=c,s&&(s.words[d]=1));for(var h=d-1;h>=0;h--){var u=67108864*(0|i.words[a.length+h])+(0|i.words[a.length+h-1]);for(u=Math.min(u/o|0,67108863),i._ishlnsubmul(a,u,h);0!==i.negative;)u--,i.negative=0,i._ishlnsubmul(a,1,h),i.isZero()||(i.negative^=1);s&&(s.words[h]=u)}return s&&s.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(e,t,i){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),i&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),i&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,i=0,n=this.length-1;n>=0;n--)i=(t*i+(0|this.words[n]))%e;return i},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*t;this.words[i]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,i=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new n(1),o=new n(0),s=new n(0),d=new n(1),f=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++f;for(var c=i.clone(),h=t.clone();!t.isZero();){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(h)),a.iushrn(1),o.iushrn(1);for(var b=0,p=1;0==(i.words[0]&p)&&b<26;++b,p<<=1);if(b>0)for(i.iushrn(b);b-- >0;)(s.isOdd()||d.isOdd())&&(s.iadd(c),d.isub(h)),s.iushrn(1),d.iushrn(1);t.cmp(i)>=0?(t.isub(i),a.isub(s),o.isub(d)):(i.isub(t),s.isub(a),d.isub(o))}return{a:s,b:d,gcd:i.iushln(f)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,i=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new n(1),s=new n(0),d=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(d),o.iushrn(1);for(var h=0,u=1;0==(i.words[0]&u)&&h<26;++h,u<<=1);if(h>0)for(i.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(d),s.iushrn(1);t.cmp(i)>=0?(t.isub(i),o.isub(s)):(i.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},n.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,i=(e-t)/26,n=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var a=n,o=i;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,i=e<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)t=1;else{i&&(e=-e),r(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},n.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},n.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new M(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(m,y),m.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},m.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new m;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return g[e]=t,t},M.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var i=this.m.add(new n(1)).iushrn(2);return this.pow(e,i)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new n(1).toRed(this),d=s.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);0!==this.pow(c,f).cmp(d);)c.redIAdd(d);for(var h=this.pow(c,a),u=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=o;0!==l.cmp(s);){for(var p=l,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<b);var y=this.pow(h,new n(1).iushln(b-g-1));u=u.redMul(y),h=y.redSqr(),l=l.redMul(h),b=g}return u},M.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},M.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var a=r[0],o=0,s=0,d=t.bitLength()%26;for(0===d&&(d=26),i=t.length-1;i>=0;i--){for(var f=t.words[i],c=d-1;c>=0;c--){var h=f>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==h||0!==o?(o<<=1,o|=h,(4==++s||0===i&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}d=26}return a},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new A(e)},i(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(i).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(St,G);var Rt=xt;function xt(e,t){if(!e)throw new Error(t||"Assertion failed")}xt.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Et={};!function(e){var t=Et;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",i=0;i<e.length;i++)t+=r(e[i].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),a=n>>8,o=255&n;a?r.push(a,o):r.push(o)}return r},t.zero2=r,t.toHex=i,t.encode=function(e,t){return"hex"===t?i(e):e}}(),function(e){var t=Mt,r=At,i=Rt,n=Et;t.assert=i,t.toArray=n.toArray,t.zero2=n.zero2,t.toHex=n.toHex,t.encode=n.encode,t.getNAF=function(e,t,r){var i,n=new Array(Math.max(e.bitLength(),r)+1);for(i=0;i<n.length;i+=1)n[i]=0;var a=1<<t+1,o=e.clone();for(i=0;i<n.length;i++){var s,d=o.andln(a-1);o.isOdd()?(s=d>(a>>1)-1?(a>>1)-d:d,o.isubn(s)):s=0,n[i]=s,o.iushrn(1)}return n},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,a=0;e.cmpn(-n)>0||t.cmpn(-a)>0;){var o,s,d=e.andln(3)+n&3,f=t.andln(3)+a&3;3===d&&(d=-1),3===f&&(f=-1),o=0==(1&d)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==f?d:-d,r[0].push(o),s=0==(1&f)?0:3!==(i=t.andln(7)+a&7)&&5!==i||2!==d?f:-f,r[1].push(s),2*n===o+1&&(n=1-n),2*a===s+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}();var Pt,kt={},Bt={get exports(){return kt},set exports(e){kt=e}},Ct=X(Object.freeze({__proto__:null,default:{}}));function jt(e){this.rand=e}if(Bt.exports=function(e){return Pt||(Pt=new jt(null)),Pt.generate(e)},kt.Rand=jt,jt.prototype.generate=function(e){return this._rand(e)},jt.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?jt.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?jt.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(jt.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var zt=Ct;if("function"!=typeof zt.randomBytes)throw new Error("Not supported");jt.prototype._rand=function(e){return zt.randomBytes(e)}}catch(e){}var Dt={},Tt=At,Ot=Mt,Kt=Ot.getNAF,Nt=Ot.getJSF,qt=Ot.assert;function Lt(e,t){this.type=e,this.p=new Tt(t.p,16),this.red=t.prime?Tt.red(t.prime):Tt.mont(this.p),this.zero=new Tt(0).toRed(this.red),this.one=new Tt(1).toRed(this.red),this.two=new Tt(2).toRed(this.red),this.n=t.n&&new Tt(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Jt=Lt;function Ut(e,t){this.curve=e,this.type=t,this.precomputed=null}Lt.prototype.point=function(){throw new Error("Not implemented")},Lt.prototype.validate=function(){throw new Error("Not implemented")},Lt.prototype._fixedNafMul=function(e,t){qt(e.precomputed);var r=e._getDoubles(),i=Kt(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var a,o,s=[];for(a=0;a<i.length;a+=r.step){o=0;for(var d=a+r.step-1;d>=a;d--)o=(o<<1)+i[d];s.push(o)}for(var f=this.jpoint(null,null,null),c=this.jpoint(null,null,null),h=n;h>0;h--){for(a=0;a<s.length;a++)(o=s[a])===h?c=c.mixedAdd(r.points[a]):o===-h&&(c=c.mixedAdd(r.points[a].neg()));f=f.add(c)}return f.toP()},Lt.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,a=Kt(t,r,this._bitLength),o=this.jpoint(null,null,null),s=a.length-1;s>=0;s--){for(var d=0;s>=0&&0===a[s];s--)d++;if(s>=0&&d++,o=o.dblp(d),s<0)break;var f=a[s];qt(0!==f),o="affine"===e.type?f>0?o.mixedAdd(n[f-1>>1]):o.mixedAdd(n[-f-1>>1].neg()):f>0?o.add(n[f-1>>1]):o.add(n[-f-1>>1].neg())}return"affine"===e.type?o.toP():o},Lt.prototype._wnafMulAdd=function(e,t,r,i,n){var a,o,s,d=this._wnafT1,f=this._wnafT2,c=this._wnafT3,h=0;for(a=0;a<i;a++){var u=(s=t[a])._getNAFPoints(e);d[a]=u.wnd,f[a]=u.points}for(a=i-1;a>=1;a-=2){var l=a-1,b=a;if(1===d[l]&&1===d[b]){var p=[t[l],null,null,t[b]];0===t[l].y.cmp(t[b].y)?(p[1]=t[l].add(t[b]),p[2]=t[l].toJ().mixedAdd(t[b].neg())):0===t[l].y.cmp(t[b].y.redNeg())?(p[1]=t[l].toJ().mixedAdd(t[b]),p[2]=t[l].add(t[b].neg())):(p[1]=t[l].toJ().mixedAdd(t[b]),p[2]=t[l].toJ().mixedAdd(t[b].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Nt(r[l],r[b]);for(h=Math.max(y[0].length,h),c[l]=new Array(h),c[b]=new Array(h),o=0;o<h;o++){var m=0|y[0][o],v=0|y[1][o];c[l][o]=g[3*(m+1)+(v+1)],c[b][o]=0,f[l]=p}}else c[l]=Kt(r[l],d[l],this._bitLength),c[b]=Kt(r[b],d[b],this._bitLength),h=Math.max(c[l].length,h),h=Math.max(c[b].length,h)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(a=h;a>=0;a--){for(var M=0;a>=0;){var A=!0;for(o=0;o<i;o++)_[o]=0|c[o][a],0!==_[o]&&(A=!1);if(!A)break;M++,a--}if(a>=0&&M++,w=w.dblp(M),a<0)break;for(o=0;o<i;o++){var S=_[o];0!==S&&(S>0?s=f[o][S-1>>1]:S<0&&(s=f[o][-S-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(a=0;a<i;a++)f[a]=null;return n?w:w.toP()},Lt.BasePoint=Ut,Ut.prototype.eq=function(){throw new Error("Not implemented")},Ut.prototype.validate=function(){return this.curve.validate(this)},Lt.prototype.decodePoint=function(e,t){e=Ot.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?qt(e[e.length-1]%2==0):7===e[0]&&qt(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},Ut.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Ut.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Ut.prototype.encode=function(e,t){return Ot.encode(this._encode(t),e)},Ut.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Ut.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Ut.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var a=0;a<e;a++)i=i.dbl();r.push(i)}return{step:e,points:r}},Ut.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},Ut.prototype._getBeta=function(){return null},Ut.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var Ft={},Ht={get exports(){return Ft},set exports(e){Ft=e}};"function"==typeof Object.create?Ht.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ht.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var Yt=At,Vt=Ft,Qt=Jt,Wt=Mt.assert;function Gt(e){Qt.call(this,"short",e),this.a=new Yt(e.a,16).toRed(this.red),this.b=new Yt(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Vt(Gt,Qt);var Xt=Gt;function Zt(e,t,r,i){Qt.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Yt(t,16),this.y=new Yt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function $t(e,t,r,i){Qt.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Yt(0)):(this.x=new Yt(t,16),this.y=new Yt(r,16),this.z=new Yt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Gt.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new Yt(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new Yt(e.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(t))?r=n[0]:(r=n[1],Wt(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new Yt(e.a,16),b:new Yt(e.b,16)}})):this._getEndoBasis(r)}}},Gt.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Yt.mont(e),r=new Yt(2).toRed(t).redInvm(),i=r.redNeg(),n=new Yt(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},Gt.prototype._getEndoBasis=function(e){for(var t,r,i,n,a,o,s,d,f,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,u=this.n.clone(),l=new Yt(1),b=new Yt(0),p=new Yt(0),g=new Yt(1),y=0;0!==h.cmpn(0);){var m=u.div(h);d=u.sub(m.mul(h)),f=p.sub(m.mul(l));var v=g.sub(m.mul(b));if(!i&&d.cmp(c)<0)t=s.neg(),r=l,i=d.neg(),n=f;else if(i&&2==++y)break;s=d,u=h,h=d,p=l,l=f,g=b,b=v}a=d.neg(),o=f;var w=i.sqr().add(n.sqr());return a.sqr().add(o.sqr()).cmp(w)>=0&&(a=t,o=r),i.negative&&(i=i.neg(),n=n.neg()),a.negative&&(a=a.neg(),o=o.neg()),[{a:i,b:n},{a:a,b:o}]},Gt.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),d=n.mul(r.b),f=a.mul(i.b);return{k1:e.sub(o).sub(s),k2:d.add(f).neg()}},Gt.prototype.pointFromX=function(e,t){(e=new Yt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(t&&!n||!t&&n)&&(i=i.redNeg()),this.point(e,i)},Gt.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},Gt.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],d=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),d=d.neg(!0)),i[2*a]=s,i[2*a+1]=d,n[2*a]=o.k1,n[2*a+1]=o.k2}for(var f=this._wnafMulAdd(1,i,n,2*a,r),c=0;c<2*a;c++)i[c]=null,n[c]=null;return f},Vt(Zt,Qt.BasePoint),Gt.prototype.point=function(e,t,r){return new Zt(this,e,t,r)},Gt.prototype.pointFromJSON=function(e,t){return Zt.fromJSON(this,e,t)},Zt.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},Zt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Zt.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(n))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(n))}},i},Zt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Zt.prototype.isInfinity=function(){return this.inf},Zt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Zt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},Zt.prototype.getX=function(){return this.x.fromRed()},Zt.prototype.getY=function(){return this.y.fromRed()},Zt.prototype.mul=function(e){return e=new Yt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Zt.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Zt.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Zt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Zt.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},Zt.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Vt($t,Qt.BasePoint),Gt.prototype.jpoint=function(e,t,r){return new $t(this,e,t,r)},$t.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},$t.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$t.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),s=i.redSub(n),d=a.redSub(o);if(0===s.cmpn(0))return 0!==d.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),c=f.redMul(s),h=i.redMul(f),u=d.redSqr().redIAdd(c).redISub(h).redISub(h),l=d.redMul(h.redISub(u)).redISub(a.redMul(c)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(u,l,b)},$t.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=o.redSqr(),f=d.redMul(o),c=r.redMul(d),h=s.redSqr().redIAdd(f).redISub(c).redISub(c),u=s.redMul(c.redISub(h)).redISub(n.redMul(f)),l=this.z.redMul(o);return this.curve.jpoint(h,u,l)},$t.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,a=this.x,o=this.y,s=this.z,d=s.redSqr().redSqr(),f=o.redAdd(o);for(t=0;t<e;t++){var c=a.redSqr(),h=f.redSqr(),u=h.redSqr(),l=c.redAdd(c).redIAdd(c).redIAdd(i.redMul(d)),b=a.redMul(h),p=l.redSqr().redISub(b.redAdd(b)),g=b.redISub(p),y=l.redMul(g);y=y.redIAdd(y).redISub(u);var m=f.redMul(s);t+1<e&&(d=d.redMul(u)),a=p,s=m,f=y}return this.curve.jpoint(a,f.redMul(n),s)},$t.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},$t.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i),d=s.redSqr().redISub(o).redISub(o),f=a.redIAdd(a);f=(f=f.redIAdd(f)).redIAdd(f),e=d,t=s.redMul(o.redISub(d)).redISub(f),r=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),h=this.y.redSqr(),u=h.redSqr(),l=this.x.redAdd(h).redSqr().redISub(c).redISub(u);l=l.redIAdd(l);var b=c.redAdd(c).redIAdd(c),p=b.redSqr(),g=u.redIAdd(u);g=(g=g.redIAdd(g)).redIAdd(g),e=p.redISub(l).redISub(l),t=b.redMul(l.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},$t.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),d=s.redSqr().redISub(o).redISub(o);e=d;var f=a.redIAdd(a);f=(f=f.redIAdd(f)).redIAdd(f),t=s.redMul(o.redISub(d)).redISub(f),r=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),h=this.y.redSqr(),u=this.x.redMul(h),l=this.x.redSub(c).redMul(this.x.redAdd(c));l=l.redAdd(l).redIAdd(l);var b=u.redIAdd(u),p=(b=b.redIAdd(b)).redAdd(b);e=l.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(c);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=l.redMul(b.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},$t.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),a=t.redSqr(),o=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(n)),d=t.redAdd(t),f=(d=d.redIAdd(d)).redMul(o),c=s.redSqr().redISub(f.redAdd(f)),h=f.redISub(c),u=o.redSqr();u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=s.redMul(h).redISub(u),b=r.redAdd(r).redMul(i);return this.curve.jpoint(c,l,b)},$t.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),a=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i),s=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(a)).redSqr(),d=i.redIAdd(i);d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=n.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(d),c=t.redMul(f);c=(c=c.redIAdd(c)).redIAdd(c);var h=this.x.redMul(s).redISub(c);h=(h=h.redIAdd(h)).redIAdd(h);var u=this.y.redMul(f.redMul(d.redISub(f)).redISub(o.redMul(s)));u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=this.z.redAdd(o).redSqr().redISub(r).redISub(s);return this.curve.jpoint(h,u,l)},$t.prototype.mul=function(e,t){return e=new Yt(e,t),this.curve._wnafMul(this,e)},$t.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},$t.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},$t.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},$t.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var er=At,tr=Ft,rr=Jt,ir=Mt;function nr(e){rr.call(this,"mont",e),this.a=new er(e.a,16).toRed(this.red),this.b=new er(e.b,16).toRed(this.red),this.i4=new er(4).toRed(this.red).redInvm(),this.two=new er(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}tr(nr,rr);var ar=nr;function or(e,t,r){rr.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new er(t,16),this.z=new er(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}nr.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},tr(or,rr.BasePoint),nr.prototype.decodePoint=function(e,t){return this.point(ir.toArray(e,t),1)},nr.prototype.point=function(e,t){return new or(this,e,t)},nr.prototype.pointFromJSON=function(e){return or.fromJSON(this,e)},or.prototype.precompute=function(){},or.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},or.fromJSON=function(e,t){return new or(e,t[0],t[1]||e.one)},or.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},or.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},or.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},or.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},or.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),o=n.redMul(i),s=t.z.redMul(a.redAdd(o).redSqr()),d=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,d)},or.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},or.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},or.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},or.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},or.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},or.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var sr=At,dr=Ft,fr=Jt,cr=Mt.assert;function hr(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,fr.call(this,"edwards",e),this.a=new sr(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new sr(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new sr(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),cr(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}dr(hr,fr);var ur=hr;function lr(e,t,r,i,n){fr.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new sr(t,16),this.y=new sr(r,16),this.z=i?new sr(i,16):this.curve.one,this.t=n&&new sr(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}hr.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},hr.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},hr.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},hr.prototype.pointFromX=function(e,t){(e=new sr(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=i.redMul(n.redInvm()),o=a.redSqrt();if(0!==o.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var s=o.fromRed().isOdd();return(t&&!s||!t&&s)&&(o=o.redNeg()),this.point(e,o)},hr.prototype.pointFromY=function(e,t){(e=new sr(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(n.redInvm());if(0===a.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var o=a.redSqrt();if(0!==o.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return o.fromRed().isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},hr.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},dr(lr,fr.BasePoint),hr.prototype.pointFromJSON=function(e){return lr.fromJSON(this,e)},hr.prototype.point=function(e,t,r,i){return new lr(this,e,t,r,i)},lr.fromJSON=function(e,t){return new lr(e,t[0],t[1],t[2])},lr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},lr.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},lr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),o=a.redSub(r),s=i.redSub(t),d=n.redMul(o),f=a.redMul(s),c=n.redMul(s),h=o.redMul(a);return this.curve.point(d,f,h,c)},lr.prototype._projDbl=function(){var e,t,r,i,n,a,o=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var f=(i=this.curve._mulA(s)).redAdd(d);this.zOne?(e=o.redSub(s).redSub(d).redMul(f.redSub(this.curve.two)),t=f.redMul(i.redSub(d)),r=f.redSqr().redSub(f).redSub(f)):(n=this.z.redSqr(),a=f.redSub(n).redISub(n),e=o.redSub(s).redISub(d).redMul(a),t=f.redMul(i.redSub(d)),r=f.redMul(a))}else i=s.redAdd(d),n=this.curve._mulC(this.z).redSqr(),a=i.redSub(n).redSub(n),e=this.curve._mulC(o.redISub(i)).redMul(a),t=this.curve._mulC(i).redMul(s.redISub(d)),r=i.redMul(a);return this.curve.point(e,t,r)},lr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},lr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),o=n.redSub(i),s=n.redAdd(i),d=r.redAdd(t),f=a.redMul(o),c=s.redMul(d),h=a.redMul(d),u=o.redMul(s);return this.curve.point(f,c,u,h)},lr.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(o),d=n.redSub(s),f=n.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),h=i.redMul(d).redMul(c);return this.curve.twisted?(t=i.redMul(f).redMul(o.redSub(this.curve._mulA(a))),r=d.redMul(f)):(t=i.redMul(f).redMul(o.redSub(a)),r=this.curve._mulC(d).redMul(f)),this.curve.point(h,t,r)},lr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},lr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},lr.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},lr.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},lr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},lr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},lr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},lr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},lr.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},lr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},lr.prototype.toP=lr.prototype.normalize,lr.prototype.mixedAdd=lr.prototype.add,function(e){var t=e;t.base=Jt,t.short=Xt,t.mont=ar,t.edwards=ur}(Dt);var br={},pr={},gr={},yr=Rt,mr=Ft;function vr(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function wr(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function _r(e){return 1===e.length?"0"+e:e}function Mr(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}gr.inherits=mr,gr.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var a=e.charCodeAt(n);a<128?r[i++]=a:a<2048?(r[i++]=a>>6|192,r[i++]=63&a|128):vr(e,n)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),r[i++]=a>>18|240,r[i++]=a>>12&63|128,r[i++]=a>>6&63|128,r[i++]=63&a|128):(r[i++]=a>>12|224,r[i++]=a>>6&63|128,r[i++]=63&a|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},gr.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=_r(e[r].toString(16));return t},gr.htonl=wr,gr.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=wr(n)),r+=Mr(n.toString(16))}return r},gr.zero2=_r,gr.zero8=Mr,gr.join32=function(e,t,r,i){var n=r-t;yr(n%4==0);for(var a=new Array(n/4),o=0,s=t;o<a.length;o++,s+=4){var d;d="big"===i?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],a[o]=d>>>0}return a},gr.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var a=e[i];"big"===t?(r[n]=a>>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},gr.rotr32=function(e,t){return e>>>t|e<<32-t},gr.rotl32=function(e,t){return e<<t|e>>>32-t},gr.sum32=function(e,t){return e+t>>>0},gr.sum32_3=function(e,t,r){return e+t+r>>>0},gr.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},gr.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},gr.sum64=function(e,t,r,i){var n=e[t],a=i+e[t+1]>>>0,o=(a<i?1:0)+r+n;e[t]=o>>>0,e[t+1]=a},gr.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},gr.sum64_lo=function(e,t,r,i){return t+i>>>0},gr.sum64_4_hi=function(e,t,r,i,n,a,o,s){var d=0,f=t;return d+=(f=f+i>>>0)<t?1:0,d+=(f=f+a>>>0)<a?1:0,e+r+n+o+(d+=(f=f+s>>>0)<s?1:0)>>>0},gr.sum64_4_lo=function(e,t,r,i,n,a,o,s){return t+i+a+s>>>0},gr.sum64_5_hi=function(e,t,r,i,n,a,o,s,d,f){var c=0,h=t;return c+=(h=h+i>>>0)<t?1:0,c+=(h=h+a>>>0)<a?1:0,c+=(h=h+s>>>0)<s?1:0,e+r+n+o+d+(c+=(h=h+f>>>0)<f?1:0)>>>0},gr.sum64_5_lo=function(e,t,r,i,n,a,o,s,d,f){return t+i+a+s+f>>>0},gr.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},gr.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},gr.shr64_hi=function(e,t,r){return e>>>r},gr.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var Ar={},Sr=gr,Ir=Rt;function Rr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Ar.BlockHash=Rr,Rr.prototype.update=function(e,t){if(e=Sr.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=Sr.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},Rr.prototype.digest=function(e){return this.update(this._pad()),Ir(null===this.pending),this._digest(e)},Rr.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a<this.padLength;a++)i[n++]=0;return i};var xr={},Er={},Pr=gr.rotr32;function kr(e,t,r){return e&t^~e&r}function Br(e,t,r){return e&t^e&r^t&r}function Cr(e,t,r){return e^t^r}Er.ft_1=function(e,t,r,i){return 0===e?kr(t,r,i):1===e||3===e?Cr(t,r,i):2===e?Br(t,r,i):void 0},Er.ch32=kr,Er.maj32=Br,Er.p32=Cr,Er.s0_256=function(e){return Pr(e,2)^Pr(e,13)^Pr(e,22)},Er.s1_256=function(e){return Pr(e,6)^Pr(e,11)^Pr(e,25)},Er.g0_256=function(e){return Pr(e,7)^Pr(e,18)^e>>>3},Er.g1_256=function(e){return Pr(e,17)^Pr(e,19)^e>>>10};var jr=gr,zr=Ar,Dr=Er,Tr=jr.rotl32,Or=jr.sum32,Kr=jr.sum32_5,Nr=Dr.ft_1,qr=zr.BlockHash,Lr=[1518500249,1859775393,2400959708,3395469782];function Jr(){if(!(this instanceof Jr))return new Jr;qr.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}jr.inherits(Jr,qr);var Ur=Jr;Jr.blockSize=512,Jr.outSize=160,Jr.hmacStrength=80,Jr.padLength=64,Jr.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=Tr(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],d=this.h[4];for(i=0;i<r.length;i++){var f=~~(i/20),c=Kr(Tr(n,5),Nr(f,a,o,s),d,r[i],Lr[f]);d=s,s=o,o=Tr(a,30),a=n,n=c}this.h[0]=Or(this.h[0],n),this.h[1]=Or(this.h[1],a),this.h[2]=Or(this.h[2],o),this.h[3]=Or(this.h[3],s),this.h[4]=Or(this.h[4],d)},Jr.prototype._digest=function(e){return"hex"===e?jr.toHex32(this.h,"big"):jr.split32(this.h,"big")};var Fr=gr,Hr=Ar,Yr=Er,Vr=Rt,Qr=Fr.sum32,Wr=Fr.sum32_4,Gr=Fr.sum32_5,Xr=Yr.ch32,Zr=Yr.maj32,$r=Yr.s0_256,ei=Yr.s1_256,ti=Yr.g0_256,ri=Yr.g1_256,ii=Hr.BlockHash,ni=[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];function ai(){if(!(this instanceof ai))return new ai;ii.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=ni,this.W=new Array(64)}Fr.inherits(ai,ii);var oi=ai;ai.blockSize=512,ai.outSize=256,ai.hmacStrength=192,ai.padLength=64,ai.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=Wr(ri(r[i-2]),r[i-7],ti(r[i-15]),r[i-16]);var n=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],d=this.h[4],f=this.h[5],c=this.h[6],h=this.h[7];for(Vr(this.k.length===r.length),i=0;i<r.length;i++){var u=Gr(h,ei(d),Xr(d,f,c),this.k[i],r[i]),l=Qr($r(n),Zr(n,a,o));h=c,c=f,f=d,d=Qr(s,u),s=o,o=a,a=n,n=Qr(u,l)}this.h[0]=Qr(this.h[0],n),this.h[1]=Qr(this.h[1],a),this.h[2]=Qr(this.h[2],o),this.h[3]=Qr(this.h[3],s),this.h[4]=Qr(this.h[4],d),this.h[5]=Qr(this.h[5],f),this.h[6]=Qr(this.h[6],c),this.h[7]=Qr(this.h[7],h)},ai.prototype._digest=function(e){return"hex"===e?Fr.toHex32(this.h,"big"):Fr.split32(this.h,"big")};var si=gr,di=oi;function fi(){if(!(this instanceof fi))return new fi;di.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}si.inherits(fi,di);var ci=fi;fi.blockSize=512,fi.outSize=224,fi.hmacStrength=192,fi.padLength=64,fi.prototype._digest=function(e){return"hex"===e?si.toHex32(this.h.slice(0,7),"big"):si.split32(this.h.slice(0,7),"big")};var hi=gr,ui=Ar,li=Rt,bi=hi.rotr64_hi,pi=hi.rotr64_lo,gi=hi.shr64_hi,yi=hi.shr64_lo,mi=hi.sum64,vi=hi.sum64_hi,wi=hi.sum64_lo,_i=hi.sum64_4_hi,Mi=hi.sum64_4_lo,Ai=hi.sum64_5_hi,Si=hi.sum64_5_lo,Ii=ui.BlockHash,Ri=[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];function xi(){if(!(this instanceof xi))return new xi;Ii.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Ri,this.W=new Array(160)}hi.inherits(xi,Ii);var Ei=xi;function Pi(e,t,r,i,n){var a=e&r^~e&n;return a<0&&(a+=4294967296),a}function ki(e,t,r,i,n,a){var o=t&i^~t&a;return o<0&&(o+=4294967296),o}function Bi(e,t,r,i,n){var a=e&r^e&n^r&n;return a<0&&(a+=4294967296),a}function Ci(e,t,r,i,n,a){var o=t&i^t&a^i&a;return o<0&&(o+=4294967296),o}function ji(e,t){var r=bi(e,t,28)^bi(t,e,2)^bi(t,e,7);return r<0&&(r+=4294967296),r}function zi(e,t){var r=pi(e,t,28)^pi(t,e,2)^pi(t,e,7);return r<0&&(r+=4294967296),r}function Di(e,t){var r=bi(e,t,14)^bi(e,t,18)^bi(t,e,9);return r<0&&(r+=4294967296),r}function Ti(e,t){var r=pi(e,t,14)^pi(e,t,18)^pi(t,e,9);return r<0&&(r+=4294967296),r}function Oi(e,t){var r=bi(e,t,1)^bi(e,t,8)^gi(e,t,7);return r<0&&(r+=4294967296),r}function Ki(e,t){var r=pi(e,t,1)^pi(e,t,8)^yi(e,t,7);return r<0&&(r+=4294967296),r}function Ni(e,t){var r=bi(e,t,19)^bi(t,e,29)^gi(e,t,6);return r<0&&(r+=4294967296),r}function qi(e,t){var r=pi(e,t,19)^pi(t,e,29)^yi(e,t,6);return r<0&&(r+=4294967296),r}xi.blockSize=1024,xi.outSize=512,xi.hmacStrength=192,xi.padLength=128,xi.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=Ni(r[i-4],r[i-3]),a=qi(r[i-4],r[i-3]),o=r[i-14],s=r[i-13],d=Oi(r[i-30],r[i-29]),f=Ki(r[i-30],r[i-29]),c=r[i-32],h=r[i-31];r[i]=_i(n,a,o,s,d,f,c,h),r[i+1]=Mi(n,a,o,s,d,f,c,h)}},xi.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],a=this.h[2],o=this.h[3],s=this.h[4],d=this.h[5],f=this.h[6],c=this.h[7],h=this.h[8],u=this.h[9],l=this.h[10],b=this.h[11],p=this.h[12],g=this.h[13],y=this.h[14],m=this.h[15];li(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=m,M=Di(h,u),A=Ti(h,u),S=Pi(h,u,l,b,p),I=ki(h,u,l,b,p,g),R=this.k[v],x=this.k[v+1],E=r[v],P=r[v+1],k=Ai(w,_,M,A,S,I,R,x,E,P),B=Si(w,_,M,A,S,I,R,x,E,P);w=ji(i,n),_=zi(i,n),M=Bi(i,n,a,o,s),A=Ci(i,n,a,o,s,d);var C=vi(w,_,M,A),j=wi(w,_,M,A);y=p,m=g,p=l,g=b,l=h,b=u,h=vi(f,c,k,B),u=wi(c,c,k,B),f=s,c=d,s=a,d=o,a=i,o=n,i=vi(k,B,C,j),n=wi(k,B,C,j)}mi(this.h,0,i,n),mi(this.h,2,a,o),mi(this.h,4,s,d),mi(this.h,6,f,c),mi(this.h,8,h,u),mi(this.h,10,l,b),mi(this.h,12,p,g),mi(this.h,14,y,m)},xi.prototype._digest=function(e){return"hex"===e?hi.toHex32(this.h,"big"):hi.split32(this.h,"big")};var Li=gr,Ji=Ei;function Ui(){if(!(this instanceof Ui))return new Ui;Ji.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Li.inherits(Ui,Ji);var Fi=Ui;Ui.blockSize=1024,Ui.outSize=384,Ui.hmacStrength=192,Ui.padLength=128,Ui.prototype._digest=function(e){return"hex"===e?Li.toHex32(this.h.slice(0,12),"big"):Li.split32(this.h.slice(0,12),"big")},xr.sha1=Ur,xr.sha224=ci,xr.sha256=oi,xr.sha384=Fi,xr.sha512=Ei;var Hi={},Yi=gr,Vi=Ar,Qi=Yi.rotl32,Wi=Yi.sum32,Gi=Yi.sum32_3,Xi=Yi.sum32_4,Zi=Vi.BlockHash;function $i(){if(!(this instanceof $i))return new $i;Zi.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function en(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function tn(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function rn(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Yi.inherits($i,Zi),Hi.ripemd160=$i,$i.blockSize=512,$i.outSize=160,$i.hmacStrength=192,$i.padLength=64,$i.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],a=this.h[3],o=this.h[4],s=r,d=i,f=n,c=a,h=o,u=0;u<80;u++){var l=Wi(Qi(Xi(r,en(u,i,n,a),e[nn[u]+t],tn(u)),on[u]),o);r=o,o=a,a=Qi(n,10),n=i,i=l,l=Wi(Qi(Xi(s,en(79-u,d,f,c),e[an[u]+t],rn(u)),sn[u]),h),s=h,h=c,c=Qi(f,10),f=d,d=l}l=Gi(this.h[1],n,c),this.h[1]=Gi(this.h[2],a,h),this.h[2]=Gi(this.h[3],o,s),this.h[3]=Gi(this.h[4],r,d),this.h[4]=Gi(this.h[0],i,f),this.h[0]=l},$i.prototype._digest=function(e){return"hex"===e?Yi.toHex32(this.h,"little"):Yi.split32(this.h,"little")};var nn=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],an=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],on=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sn=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],dn=gr,fn=Rt;function cn(e,t,r){if(!(this instanceof cn))return new cn(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(dn.toArray(t,r))}var hn,un,ln=cn;cn.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),fn(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},cn.prototype.update=function(e,t){return this.inner.update(e,t),this},cn.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=pr;t.utils=gr,t.common=Ar,t.sha=xr,t.ripemd=Hi,t.hmac=ln,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(),function(e){var t,r=br,i=pr,n=Dt,a=Mt.assert;function o(e){"short"===e.type?this.curve=new n.short(e):"edwards"===e.type?this.curve=new n.edwards(e):this.curve=new n.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var i=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:i}),i}})}r.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:i.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:i.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=un?hn:(un=1,hn={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(e){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}();var bn=pr,pn=Et,gn=Rt;function yn(e){if(!(this instanceof yn))return new yn(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=pn.toArray(e.entropy,e.entropyEnc||"hex"),r=pn.toArray(e.nonce,e.nonceEnc||"hex"),i=pn.toArray(e.pers,e.persEnc||"hex");gn(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}var mn=yn;yn.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},yn.prototype._hmac=function(){return new bn.hmac(this.hash,this.K)},yn.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},yn.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=pn.toArray(e,t),r=pn.toArray(r,i),gn(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},yn.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=pn.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<e;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var a=n.slice(0,e);return this._update(r),this._reseed++,pn.encode(a,t)};var vn=At,wn=Mt.assert;function _n(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Mn=_n;_n.fromPublic=function(e,t,r){return t instanceof _n?t:new _n(e,{pub:t,pubEnc:r})},_n.fromPrivate=function(e,t,r){return t instanceof _n?t:new _n(e,{priv:t,privEnc:r})},_n.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},_n.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},_n.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},_n.prototype._importPrivate=function(e,t){this.priv=new vn(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},_n.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?wn(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||wn(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},_n.prototype.derive=function(e){return e.validate()||wn(e.validate(),"public point not validated"),e.mul(this.priv).getX()},_n.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},_n.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},_n.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var An=At,Sn=Mt,In=Sn.assert;function Rn(e,t){if(e instanceof Rn)return e;this._importDER(e,t)||(In(e.r&&e.s,"Signature without r or s"),this.r=new An(e.r,16),this.s=new An(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var xn=Rn;function En(){this.place=0}function Pn(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;if(0===e[t.place])return!1;for(var n=0,a=0,o=t.place;a<i;a++,o++)n<<=8,n|=e[o],n>>>=0;return!(n<=127)&&(t.place=o,n)}function kn(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function Bn(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Rn.prototype._importDER=function(e,t){e=Sn.toArray(e,t);var r=new En;if(48!==e[r.place++])return!1;var i=Pn(e,r);if(!1===i)return!1;if(i+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=Pn(e,r);if(!1===n)return!1;if(0!=(128&e[r.place]))return!1;var a=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=Pn(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;if(0!=(128&e[r.place]))return!1;var s=e.slice(r.place,o+r.place);if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new An(a),this.s=new An(s),this.recoveryParam=null,!0},Rn.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=kn(t),r=kn(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];Bn(i,t.length),(i=i.concat(t)).push(2),Bn(i,r.length);var n=i.concat(r),a=[48];return Bn(a,n.length),a=a.concat(n),Sn.encode(a,e)};var Cn=At,jn=mn,zn=br,Dn=kt,Tn=Mt.assert,On=Mn,Kn=xn;function Nn(e){if(!(this instanceof Nn))return new Nn(e);"string"==typeof e&&(Tn(Object.prototype.hasOwnProperty.call(zn,e),"Unknown curve "+e),e=zn[e]),e instanceof zn.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var qn=Nn;Nn.prototype.keyPair=function(e){return new On(this,e)},Nn.prototype.keyFromPrivate=function(e,t){return On.fromPrivate(this,e,t)},Nn.prototype.keyFromPublic=function(e,t){return On.fromPublic(this,e,t)},Nn.prototype.genKeyPair=function(e){e||(e={});for(var t=new jn({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Dn(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new Cn(2));;){var n=new Cn(t.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Nn.prototype._truncateToN=function(e,t,r){var i;if(Cn.isBN(e)||"number"==typeof e)i=(e=new Cn(e,16)).byteLength();else if("object"==typeof e)i=e.length,e=new Cn(e,16);else{var n=e.toString();i=n.length+1>>>1,e=new Cn(n,16)}"number"!=typeof r&&(r=8*i);var a=r-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Nn.prototype.sign=function(e,t,r,i){if("object"==typeof r&&(i=r,r=null),i||(i={}),"string"!=typeof e&&"number"!=typeof e&&!Cn.isBN(e)){Tn("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),Tn(e.length>>>0===e.length);for(var n=0;n<e.length;n++)Tn((255&e[n])===e[n])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,i.msgBitLength),Tn(!e.isNeg(),"Can not sign a negative message");var a=this.n.byteLength(),o=t.getPrivate().toArray("be",a),s=e.toArray("be",a);Tn(new Cn(s).eq(e),"Can not sign message");for(var d=new jn({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),f=this.n.sub(new Cn(1)),c=0;;c++){var h=i.k?i.k(c):new Cn(d.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var u=this.g.mul(h);if(!u.isInfinity()){var l=u.getX(),b=l.umod(this.n);if(0!==b.cmpn(0)){var p=h.invm(this.n).mul(b.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(u.getY().isOdd()?1:0)|(0!==l.cmp(b)?2:0);return i.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new Kn({r:b,s:p,recoveryParam:g})}}}}}},Nn.prototype.verify=function(e,t,r,i,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var a=(t=new Kn(t,"hex")).r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,d=o.invm(this.n),f=d.mul(e).umod(this.n),c=d.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(f,r.getPublic(),c)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(f,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},Nn.prototype.recoverPubKey=function(e,t,r,i){Tn((3&r)===r,"The recovery param is more than two bits"),t=new Kn(t,i);var n=this.n,a=new Cn(e),o=t.r,s=t.s,d=1&r,f=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");o=f?this.curve.pointFromX(o.add(this.curve.n),d):this.curve.pointFromX(o,d);var c=t.r.invm(n),h=n.sub(a).mul(c).umod(n),u=s.mul(c).umod(n);return this.g.mulAdd(h,o,u)},Nn.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new Kn(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(e,t,n)}catch(e){continue}if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Ln=Mt,Jn=Ln.assert,Un=Ln.parseBytes,Fn=Ln.cachedProperty;function Hn(e,t){this.eddsa=e,this._secret=Un(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Un(t.pub)}Hn.fromPublic=function(e,t){return t instanceof Hn?t:new Hn(e,{pub:t})},Hn.fromSecret=function(e,t){return t instanceof Hn?t:new Hn(e,{secret:t})},Hn.prototype.secret=function(){return this._secret},Fn(Hn,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),Fn(Hn,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),Fn(Hn,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),Fn(Hn,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),Fn(Hn,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),Fn(Hn,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Hn.prototype.sign=function(e){return Jn(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Hn.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Hn.prototype.getSecret=function(e){return Jn(this._secret,"KeyPair is public only"),Ln.encode(this.secret(),e)},Hn.prototype.getPublic=function(e){return Ln.encode(this.pubBytes(),e)};var Yn=Hn,Vn=At,Qn=Mt,Wn=Qn.assert,Gn=Qn.cachedProperty,Xn=Qn.parseBytes;function Zn(e,t){this.eddsa=e,"object"!=typeof t&&(t=Xn(t)),Array.isArray(t)&&(Wn(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Wn(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Vn&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Gn(Zn,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Gn(Zn,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Gn(Zn,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Gn(Zn,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Zn.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Zn.prototype.toHex=function(){return Qn.encode(this.toBytes(),"hex").toUpperCase()};var $n=Zn,ea=pr,ta=br,ra=Mt,ia=ra.assert,na=ra.parseBytes,aa=Yn,oa=$n;function sa(e){if(ia("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof sa))return new sa(e);e=ta[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=ea.sha512}var da=sa;sa.prototype.sign=function(e,t){e=na(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),s=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:a})},sa.prototype.verify=function(e,t,r){if(e=na(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(a)},sa.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return ra.intFromLE(e.digest()).umod(this.curve.n)},sa.prototype.keyFromPublic=function(e){return aa.fromPublic(this,e)},sa.prototype.keyFromSecret=function(e){return aa.fromSecret(this,e)},sa.prototype.makeSignature=function(e){return e instanceof oa?e:new oa(this,e)},sa.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},sa.prototype.decodePoint=function(e){var t=(e=ra.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=ra.intFromLE(r);return this.curve.pointFromY(n,i)},sa.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},sa.prototype.decodeInt=function(e){return ra.intFromLE(e)},sa.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=_t,t.utils=Mt,t.rand=kt,t.curve=Dt,t.curves=br,t.ec=qn,t.eddsa=da}(wt);var fa,ca,ha,ua={};
1
+ "undefined"==typeof globalThis&&("undefined"!=typeof window?(window.globalThis=window,window.global=window):"undefined"!=typeof self&&(self.globalThis=self,self.global=self)),Object.defineProperty(exports,"__esModule",{value:!0});const e=Symbol("MODULE_INITIALIZED"),t=new Map;function r(e,r){var i,n;null===(i=t.get(e))||void 0===i||i.forEach((n=e=>e(r),function(){try{return n(...arguments)}catch(e){console.log(e)}}))}let i=null;function n(e){i=e}var a=Object.freeze({__proto__:null,getInitConfig:function(){return i},get initConfig(){return i},setInitConfig:n});function o(t){n(t),r(e,void 0)}var s=Object.freeze({__proto__:null,initialize:o});function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function l(e,t){return Object.entries(t).reduce(((t,r)=>{let[i,n]=r;return f(f({},t),{},{[i]:b.isPrototypeOf(n)?new n(e.slug):"function"==typeof n?n.bind(e):"object"==typeof n&&!Array.isArray(n)&&n?l(e,n):n})}),{})}class b{constructor(e){this.slug=e}static create(e){return class extends b{constructor(t){super(t),Object.assign(this,l(this,e(this)))}}}}var p=Object.freeze({__proto__:null,Agent:b}),g=Object.freeze({__proto__:null,MODULE_INITIALIZED:e,emit:r,off:function(e,r){const i=t.get(e);if(!i)return;const n=i.indexOf(r);-1!==n&&i.splice(n,1)},on:function(e,r){var i;t.has(e)?null===(i=t.get(e))||void 0===i||i.push(r):t.set(e,[r])}});function y(e,t){const r=!e||"object"!=typeof e||Array.isArray(e)?{}:e;return[t.reduce(((e,t)=>{if(t in e){const r=e[t];if(null!==r&&"object"==typeof r&&!Array.isArray(r))return r}const r={};return e[t]=r,r}),r),r]}function m(e,t){let r=e;return t.every((e=>!(!r||"object"!=typeof r||Array.isArray(r)||!(e in r))&&(r=r[e],!0)),e)}const v="tsec",w="general";function _(e){return e?w:i.clientId}function M(e){return function(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}((e?sessionStorage:localStorage).getItem(v))}function A(e,t){const r=e?sessionStorage:localStorage,i=t(M(e));r.setItem(v,JSON.stringify(i))}var S=Object.freeze({__proto__:null,COMMON_STORAGE_KEY:v,GENERAL_ID_KEY:w,getValue:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=_(!!t.isGeneral),i=M(!!t.sessionOnly),[n]=y(i,[this.slug.toString(),r]);return n[e]},hasValue:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=_(!!t.isGeneral),i=M(!!t.sessionOnly);return m(i,[this.slug.toString(),r,e])},removeValue:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=_(!!t.isGeneral);A(!!t.sessionOnly,(t=>{const[i,n]=y(t,[this.slug.toString(),r]);return delete i[e],n}))},setValue:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=_(!!r.isGeneral);A(!!r.sessionOnly,(r=>{const[n,a]=y(r,[this.slug.toString(),i]);return n[e]=t,a}))}});const I="RSA-PSS",R=async(e,t)=>await window.crypto.subtle.generateKey({name:e,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!1,t),x=async()=>await R("RSA-OAEP",["encrypt","decrypt"]),E=async()=>await R(I,["sign"]),P=async(e,t)=>{const r=(new TextEncoder).encode(t);return await window.crypto.subtle.sign({name:I,saltLength:32},e,r)};class k{constructor(e,t,r){this.slug=e,this.dbName=t,this.dbVersion=r}queryObjectStore(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.shimIndexedDB).open(`${this.slug}:${this.dbName}`,this.dbVersion||1);i.onupgradeneeded=()=>{var t;const r=i.result;(null===(t=null==r?void 0:r.objectStoreNames)||void 0===t?void 0:t.contains)&&!r.objectStoreNames.contains(e)&&r.createObjectStore(e,{keyPath:"key"})},i.onsuccess=()=>{const n=i.result,a=n.transaction(e,(null==r?void 0:r.operation)||"readwrite"),o=a.objectStore(e);t(o),a.oncomplete=()=>{n.close()}}}put(e,t,r){return new Promise(((i,n)=>{this.queryObjectStore(e,(e=>{const a=e.put({key:t,value:r});a.onsuccess=()=>{i(a.result)},a.onerror=e=>{n("Failed adding item to objectStore, err: "+e)}}))}))}add(e,t,r){return new Promise(((i,n)=>{this.queryObjectStore(e,(e=>{const a=e.add({key:t,value:r});a.onsuccess=()=>{i(a.result)},a.onerror=e=>{const t=e.target.error;n(t)}}))}))}get(e,t){return new Promise(((r,i)=>{this.queryObjectStore(e,(e=>{const n=e.get(t);n.onsuccess=()=>{var e;n.result?r(null===(e=n.result)||void 0===e?void 0:e.value):r(void 0)},n.onerror=e=>{i("Failed adding item to objectStore, err: "+e)}}))}))}getAll(e,t){return new Promise(((r,i)=>{this.queryObjectStore(e,(e=>{const n=e.getAll(null,t);n.onsuccess=()=>{if(n.result){const e=n.result;(null==e?void 0:e.length)?r(e.map((e=>null==e?void 0:e.value))):r(e)}else r([])},n.onerror=e=>{i("Failed getting items, err: "+e)}}))}))}delete(e,t){return new Promise(((r,i)=>{this.queryObjectStore(e,(e=>{const n=e.delete(t);n.onsuccess=()=>{r()},n.onerror=e=>{i(`Failed deleting key: '${t}' from objectStore, err: `+e)}}))}))}clear(e){return new Promise(((t,r)=>{this.queryObjectStore(e,(e=>{const i=e.clear();i.onsuccess=()=>{t()},i.onerror=e=>{r("Failed clearing objectStore, err: "+e)}}))}))}}const B="platform",C="init",j="completed",D="RSA2048",z=[C,j];class T{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sign",r=arguments.length>2?arguments[2]:void 0;var n,a,o,s;this.agent=e,this.keysType=t,this.options=r,this._extractingKeysPromise=null;const d=!(null===(n=this.options)||void 0===n?void 0:n.productScope);this.keysDatabaseName=d||!(null===(a=this.options)||void 0===a?void 0:a.indexedDBName)?"ts_crypto_binding":this.options.indexedDBName,this.dbVersion=d?1:(null===(o=this.options)||void 0===o?void 0:o.dbVersion)||1,this.keysStoreName=d||!(null===(s=this.options)||void 0===s?void 0:s.keysStoreName)?"identifiers_store":this.options.keysStoreName,this.indexedDBClient=new k(d?B:e.slug,this.keysDatabaseName,this.dbVersion),this.indexedDBClientFallback=new k((d?B:e.slug)+`:${i.clientId}`,this.keysDatabaseName,this.dbVersion)}getKeysRecordKey(){return`${this.keysType}_keys`}getRotatedKeysRecordKey(){return`rotated_${this.keysType}_keys`}getRotatedKeysRecordKeyPending(){return`rotated_pending_${this.keysType}_keys`}arrayBufferToBase64(e){return window.btoa(String.fromCharCode(...new Uint8Array(e)))}async getPKRepresentations(e){const t=await crypto.subtle.exportKey("spki",e);return{arrayBufferKey:t,base64Key:this.arrayBufferToBase64(t)}}async generateKeyPair(){return"sign"==this.keysType?await E():await x()}async calcKeyIdentifier(e){const t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map((e=>e.toString(16).padStart(2,"0"))).join("")}async extractKeysData(){if(this._extractingKeysPromise)return this._extractingKeysPromise;this._extractingKeysPromise=(async()=>{var e,t;const r=(null===(t=null===(e=this.options)||void 0===e?void 0:e.keyRotation)||void 0===t?void 0:t.isEnabled)?await this.getRotatedKeysData():await this.getKeysData(),{base64Key:i}=await this.getPKRepresentations(r.publicKey);return this.publicKeyBase64=i,this.keyIdentifier=r.keyIdentifier,r})();try{return await this._extractingKeysPromise}finally{this._extractingKeysPromise=null}}async generateKeyPairData(e){const t=await this.generateKeyPair(),{arrayBufferKey:r}=await this.getPKRepresentations(t.publicKey),i=e||await this.calcKeyIdentifier(r);return f(f({},t),{},{keyIdentifier:i,createdDate:Date.now()})}shouldKeyBeRotated(e){var t;const r=null===(t=this.options)||void 0===t?void 0:t.keyRotation;if(!(null==r?void 0:r.isEnabled)||!r.expiryDays||void 0===r.startedAt)return!1;const i=24*r.expiryDays*60*60*1e3,n=e.createdDate&&e.createdDate>=r.startedAt?e.createdDate:r.startedAt;return Date.now()-n>i-2592e6}async extractMainKeysData(){return await this.indexedDBClient.get(this.keysStoreName,this.getKeysRecordKey())}async extractFallbackMainKeysData(){return await this.indexedDBClientFallback.get(this.keysStoreName,this.getKeysRecordKey())}async extractRotatedKeysData(){return await this.indexedDBClient.get(this.keysStoreName,this.getRotatedKeysRecordKey())}async extractPendingRotatedKeysData(){return await this.indexedDBClient.get(this.keysStoreName,this.getRotatedKeysRecordKeyPending())}async saveKeyData(e,t){try{return await this.indexedDBClient.add(this.keysStoreName,e,t),t}catch(t){if(t instanceof DOMException&&"ConstraintError"===t.name){const t=await this.indexedDBClient.get(this.keysStoreName,e);if(t)return t}throw t}}async getKeysData(){const e=this.getKeysRecordKey();let t=await this.extractMainKeysData();if(t)return t;if(t=await this.extractFallbackMainKeysData(),t)return this.saveKeyData(e,t);const r=await this.generateKeyPairData();return this.saveKeyData(e,r)}async getOrCreateRotatedKeys(){let e=await this.extractRotatedKeysData();if(!e){const t=this.getRotatedKeysRecordKey(),r=await this.getKeysData(),i=f(f({},r),{},{createdDate:r.createdDate||Date.now()});e=await this.saveKeyData(t,i)}return e}async getRotatedKeysData(){const e=await this.getOrCreateRotatedKeys();if(this.shouldKeyBeRotated(e)){if(!await this.extractPendingRotatedKeysData()){const t=this.getRotatedKeysRecordKeyPending(),r=await this.generateKeyPairData(e.keyIdentifier);await this.saveKeyData(t,r)}}return e}async getPublicData(){return this.publicKeyBase64&&this.keyIdentifier||await this.extractKeysData(),{publicKey:this.publicKeyBase64,keyIdentifier:this.keyIdentifier}}async sign(e){if("sign"==this.keysType){const{privateKey:t}=await this.extractKeysData(),r=await P(t,e);return this.arrayBufferToBase64(r)}throw new Error("keysType must be 'sign' in order to use sign keys")}async clearKeys(){const e=this.getKeysRecordKey();await this.indexedDBClient.delete(this.keysStoreName,e)}getBaseRotationPayload(){return{keyIdentifier:this.keyIdentifier,slot:this.getRotatedKeysRecordKey(),publicKey:this.publicKeyBase64,publicKeyType:D,tenantId:this.options.keyRotation.tenantId}}async getRotationData(){var e,t;if(!(null===(t=null===(e=this.options)||void 0===e?void 0:e.keyRotation)||void 0===t?void 0:t.isEnabled))return;this.publicKeyBase64&&this.keyIdentifier||await this.extractKeysData();const r=await this.extractPendingRotatedKeysData();if(r){const{base64Key:e}=await this.getPKRepresentations(r.publicKey),{privateKey:t}=await this.extractKeysData(),i=f(f({},this.getBaseRotationPayload()),{},{newPublicKey:e,createdDate:r.createdDate,newPublicKeyType:D}),n=JSON.stringify(i);return{data:n,signature:await this.signPayload(n,t)}}const i=await this.extractRotatedKeysData();if(i&&!1===i.confirmed){await this.extractKeysData();const e=JSON.stringify(this.getBaseRotationPayload());return{data:e,signature:await this.signPayload(e,i.privateKey)}}}async signPayload(e,t){const r=await P(t,e);return this.arrayBufferToBase64(r)}async handleRotateResponse(e){if(z.includes(e))if(e===C){const e=await this.extractPendingRotatedKeysData();if(e){await this.indexedDBClient.delete(this.keysStoreName,this.getRotatedKeysRecordKey());const t=f(f({},e),{},{confirmed:!1});await this.indexedDBClient.put(this.keysStoreName,this.getRotatedKeysRecordKey(),t),await this.indexedDBClient.delete(this.keysStoreName,this.getRotatedKeysRecordKeyPending());const{base64Key:r}=await this.getPKRepresentations(e.publicKey);this.publicKeyBase64=r,this.keyIdentifier=e.keyIdentifier}}else if(e===j){const e=await this.extractRotatedKeysData();e&&!1===e.confirmed&&await this.indexedDBClient.put(this.keysStoreName,this.getRotatedKeysRecordKey(),f(f({},e),{},{confirmed:!0}))}}}var O=Object.freeze({__proto__:null,createCryptoBinding:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sign",t=arguments.length>1?arguments[1]:void 0;return new T(this,e,t)},generateRSAKeyPair:x,generateRSASignKeyPair:E,signAssymetric:P,verifyAssymetric:async(e,t,r)=>{const i=(new TextEncoder).encode(t);return await window.crypto.subtle.verify(I,e,r,i)}}),K=Object.freeze({__proto__:null});const N=b.create((e=>{class t extends Error{constructor(t,r){super(`${e.slug}-${t} ${r}`)}}return{TsError:t,TsInternalError:class extends t{constructor(e){super(e,"Internal error")}}}}));var q=b.create((()=>f({exceptions:N},p)));class L{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.agent=e,this.middlewares=t,this.logs=[]}info(e,t){this.pushLog(3,e,t)}warn(e,t){this.pushLog(4,e,t)}error(e,t){this.pushLog(5,e,t)}pushLog(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.logs.push({timestamp:Date.now(),module:this.agent.slug,severity:e,fields:r,message:t});const i=this.middlewares.map((e=>e(this)));Promise.all(i).catch((()=>{}))}}var J=Object.freeze({__proto__:null,consoleMiddleware:function(e){const t=e.logs[e.logs.length-1];console.log(`${t.severity} ${t.message}`,t.fields)},createSdkLogger:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new L(this,e)}});function U(e,t){if(!(null==e?void 0:e.trim()))return"";if(function(e){try{return new URL(e),!0}catch(e){return!1}}(e))return e;const r="http://mock.com",i=new URL(r);i.search=(null==t?void 0:t.toString())||"",i.pathname=e;return i.href.replace(r,"")}const F={"Content-Type":"application/json","X-TS-client-time":(new Date).toUTCString(),"X-TS-ua":navigator.userAgent};function H(e,t,r){var i;const n=(a=t||{},encodeURI(JSON.stringify(a)).split(/%..|./).length-1);var a;return{method:e,headers:f(f(f({},{"X-TS-body-size":String(n)}),F),r||{}),body:null!==(i=t&&JSON.stringify(t||{}))&&void 0!==i?i:void 0}}function Y(e,t,r,i,n){const a=U(e,i),o=H(t,r,n);return fetch(a,o)}async function V(e,t,r,i,n){let a;if(a=await Y(e,t,r,i,n),!a.ok)throw new Error("Request failed");return a}var Q=Object.freeze({__proto__:null,httpDelete:async function(e,t){const r=await V(e,"DELETE",void 0,void 0,t);return f(f({data:await r.json()},r),{},{headers:r.headers})},httpGet:async function(e,t,r){const i=await V(e,"GET",void 0,t,r);return f(f({data:await i.json()},i),{},{headers:i.headers})},httpPost:async function(e,t,r,i){const n=await V(e,"POST",t,r,i);return f(f({data:await n.json()},n),{},{headers:n.headers})},httpPut:async function(e,t,r,i){const n=await V(e,"PUT",t,r,i);return f(f({data:await n.json()},n),{},{headers:n.headers})},init:H}),W=b.create((()=>({events:g,moduleMetadata:a,mainEntry:s,utils:q,storage:S,crypto:O,indexedDB:K,logger:J,http:Q}))),G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];r.push.apply(r,arguments);var i=Function.bind.apply(t,r);return new i}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),r}var Z="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},$=[],ee=[],te="undefined"!=typeof Uint8Array?Uint8Array:Array,re=!1;function ie(){re=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)$[t]=e[t],ee[e.charCodeAt(t)]=t;ee["-".charCodeAt(0)]=62,ee["_".charCodeAt(0)]=63}function ne(e,t,r){for(var i,n,a=[],o=t;o<r;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push($[(n=i)>>18&63]+$[n>>12&63]+$[n>>6&63]+$[63&n]);return a.join("")}function ae(e){var t;re||ie();for(var r=e.length,i=r%3,n="",a=[],o=16383,s=0,d=r-i;s<d;s+=o)a.push(ne(e,s,s+o>d?d:s+o));return 1===i?(t=e[r-1],n+=$[t>>2],n+=$[t<<4&63],n+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],n+=$[t>>10],n+=$[t>>4&63],n+=$[t<<2&63],n+="="),a.push(n),a.join("")}function oe(e,t,r,i,n){var a,o,s=8*n-i-1,d=(1<<s)-1,f=d>>1,c=-7,h=r?n-1:0,u=r?-1:1,l=e[t+h];for(h+=u,a=l&(1<<-c)-1,l>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=u,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=i;c>0;o=256*o+e[t+h],h+=u,c-=8);if(0===a)a=1-f;else{if(a===d)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,i),a-=f}return(l?-1:1)*o*Math.pow(2,a-i)}function se(e,t,r,i,n,a){var o,s,d,f=8*a-n-1,c=(1<<f)-1,h=c>>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,l=i?0:a-1,b=i?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+h>=1?u/d:u*Math.pow(2,1-h))*d>=2&&(o++,d/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(t*d-1)*Math.pow(2,n),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),o=0));n>=8;e[r+l]=255&s,l+=b,s/=256,n-=8);for(o=o<<n|s,f+=n;f>0;e[r+l]=255&o,l+=b,o/=256,f-=8);e[r+l-b]|=128*p}var de={}.toString,fe=Array.isArray||function(e){return"[object Array]"==de.call(e)};le.TYPED_ARRAY_SUPPORT=void 0===Z.TYPED_ARRAY_SUPPORT||Z.TYPED_ARRAY_SUPPORT;var ce=he();function he(){return le.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ue(e,t){if(he()<t)throw new RangeError("Invalid typed array length");return le.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=le.prototype:(null===e&&(e=new le(t)),e.length=t),e}function le(e,t,r){if(!(le.TYPED_ARRAY_SUPPORT||this instanceof le))return new le(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ge(this,e)}return be(this,e,t,r)}function be(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);le.TYPED_ARRAY_SUPPORT?(e=t).__proto__=le.prototype:e=ye(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!le.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|we(t,r);e=ue(e,i);var n=e.write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(ve(t)){var r=0|me(t.length);return 0===(e=ue(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?ue(e,0):ye(e,t);if("Buffer"===t.type&&fe(t.data))return ye(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function pe(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ge(e,t){if(pe(t),e=ue(e,t<0?0:0|me(t)),!le.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function ye(e,t){var r=t.length<0?0:0|me(t.length);e=ue(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function me(e){if(e>=he())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+he().toString(16)+" bytes");return 0|e}function ve(e){return!(null==e||!e._isBuffer)}function we(e,t){if(ve(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Ve(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Qe(e).length;default:if(i)return Ve(e).length;t=(""+t).toLowerCase(),i=!0}}function _e(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Te(this,t,r);case"utf8":case"utf-8":return Ce(this,t,r);case"ascii":return De(this,t,r);case"latin1":case"binary":return ze(this,t,r);case"base64":return Be(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function Me(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function Ae(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=le.from(t,i)),ve(t))return 0===t.length?-1:Se(e,t,r,i,n);if("number"==typeof t)return t&=255,le.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Se(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Se(e,t,r,i,n){var a,o=1,s=e.length,d=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,s/=2,d/=2,r/=2}function f(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var c=-1;for(a=r;a<s;a++)if(f(e,a)===f(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===d)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(r+d>s&&(r=s-d),a=r;a>=0;a--){for(var h=!0,u=0;u<d;u++)if(f(e,a+u)!==f(t,u)){h=!1;break}if(h)return a}return-1}function Ie(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o<i;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function Re(e,t,r,i){return We(Ve(t,e.length-r),e,r,i)}function xe(e,t,r,i){return We(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function Ee(e,t,r,i){return xe(e,t,r,i)}function Pe(e,t,r,i){return We(Qe(t),e,r,i)}function ke(e,t,r,i){return We(function(e,t){for(var r,i,n,a=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(r=e.charCodeAt(o))>>8,n=r%256,a.push(n),a.push(i);return a}(t,e.length-r),e,r,i)}function Be(e,t,r){return 0===t&&r===e.length?ae(e):ae(e.slice(t,r))}function Ce(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var a,o,s,d,f=e[n],c=null,h=f>239?4:f>223?3:f>191?2:1;if(n+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(a=e[n+1]))&&(d=(31&f)<<6|63&a)>127&&(c=d);break;case 3:a=e[n+1],o=e[n+2],128==(192&a)&&128==(192&o)&&(d=(15&f)<<12|(63&a)<<6|63&o)>2047&&(d<55296||d>57343)&&(c=d);break;case 4:a=e[n+1],o=e[n+2],s=e[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(d=(15&f)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&d<1114112&&(c=d)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=h}return function(e){var t=e.length;if(t<=je)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=je));return r}(i)}le.poolSize=8192,le._augment=function(e){return e.__proto__=le.prototype,e},le.from=function(e,t,r){return be(null,e,t,r)},le.TYPED_ARRAY_SUPPORT&&(le.prototype.__proto__=Uint8Array.prototype,le.__proto__=Uint8Array),le.alloc=function(e,t,r){return function(e,t,r,i){return pe(t),t<=0?ue(e,t):void 0!==r?"string"==typeof i?ue(e,t).fill(r,i):ue(e,t).fill(r):ue(e,t)}(null,e,t,r)},le.allocUnsafe=function(e){return ge(null,e)},le.allocUnsafeSlow=function(e){return ge(null,e)},le.isBuffer=Ge,le.compare=function(e,t){if(!ve(e)||!ve(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,a=Math.min(r,i);n<a;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},le.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},le.concat=function(e,t){if(!fe(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return le.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=le.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var a=e[r];if(!ve(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,n),n+=a.length}return i},le.byteLength=we,le.prototype._isBuffer=!0,le.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Me(this,t,t+1);return this},le.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Me(this,t,t+3),Me(this,t+1,t+2);return this},le.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Me(this,t,t+7),Me(this,t+1,t+6),Me(this,t+2,t+5),Me(this,t+3,t+4);return this},le.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Ce(this,0,e):_e.apply(this,arguments)},le.prototype.equals=function(e){if(!ve(e))throw new TypeError("Argument must be a Buffer");return this===e||0===le.compare(this,e)},le.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},le.prototype.compare=function(e,t,r,i,n){if(!ve(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),d=this.slice(i,n),f=e.slice(t,r),c=0;c<s;++c)if(d[c]!==f[c]){a=d[c],o=f[c];break}return a<o?-1:o<a?1:0},le.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},le.prototype.indexOf=function(e,t,r){return Ae(this,e,t,r,!0)},le.prototype.lastIndexOf=function(e,t,r){return Ae(this,e,t,r,!1)},le.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ie(this,e,t,r);case"utf8":case"utf-8":return Re(this,e,t,r);case"ascii":return xe(this,e,t,r);case"latin1":case"binary":return Ee(this,e,t,r);case"base64":return Pe(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var je=4096;function De(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function ze(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function Te(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",a=t;a<r;++a)n+=Ye(e[a]);return n}function Oe(e,t,r){for(var i=e.slice(t,r),n="",a=0;a<i.length;a+=2)n+=String.fromCharCode(i[a]+256*i[a+1]);return n}function Ke(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Ne(e,t,r,i,n,a){if(!ve(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<a)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function qe(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);n<a;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function Le(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);n<a;++n)e[r+n]=t>>>8*(i?n:3-n)&255}function Je(e,t,r,i,n,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ue(e,t,r,i,n){return n||Je(e,0,r,4),se(e,t,r,i,23,4),r+4}function Fe(e,t,r,i,n){return n||Je(e,0,r,8),se(e,t,r,i,52,8),r+8}le.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),le.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=le.prototype;else{var n=t-e;r=new le(n,void 0);for(var a=0;a<n;++a)r[a]=this[a+e]}return r},le.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i},le.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},le.prototype.readUInt8=function(e,t){return t||Ke(e,1,this.length),this[e]},le.prototype.readUInt16LE=function(e,t){return t||Ke(e,2,this.length),this[e]|this[e+1]<<8},le.prototype.readUInt16BE=function(e,t){return t||Ke(e,2,this.length),this[e]<<8|this[e+1]},le.prototype.readUInt32LE=function(e,t){return t||Ke(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},le.prototype.readUInt32BE=function(e,t){return t||Ke(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},le.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},le.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ke(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},le.prototype.readInt8=function(e,t){return t||Ke(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},le.prototype.readInt16LE=function(e,t){t||Ke(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},le.prototype.readInt16BE=function(e,t){t||Ke(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},le.prototype.readInt32LE=function(e,t){return t||Ke(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},le.prototype.readInt32BE=function(e,t){return t||Ke(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},le.prototype.readFloatLE=function(e,t){return t||Ke(e,4,this.length),oe(this,e,!0,23,4)},le.prototype.readFloatBE=function(e,t){return t||Ke(e,4,this.length),oe(this,e,!1,23,4)},le.prototype.readDoubleLE=function(e,t){return t||Ke(e,8,this.length),oe(this,e,!0,52,8)},le.prototype.readDoubleBE=function(e,t){return t||Ke(e,8,this.length),oe(this,e,!1,52,8)},le.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||Ne(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a<r&&(n*=256);)this[t+a]=e/n&255;return t+r},le.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||Ne(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+r},le.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,1,255,0),le.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},le.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qe(this,e,t,!0),t+2},le.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qe(this,e,t,!1),t+2},le.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Le(this,e,t,!0),t+4},le.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Le(this,e,t,!1),t+4},le.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);Ne(this,e,t,r,n-1,-n)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},le.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);Ne(this,e,t,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},le.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,1,127,-128),le.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},le.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qe(this,e,t,!0),t+2},le.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qe(this,e,t,!1),t+2},le.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,2147483647,-2147483648),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Le(this,e,t,!0),t+4},le.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Ne(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Le(this,e,t,!1),t+4},le.prototype.writeFloatLE=function(e,t,r){return Ue(this,e,t,!0,r)},le.prototype.writeFloatBE=function(e,t,r){return Ue(this,e,t,!1,r)},le.prototype.writeDoubleLE=function(e,t,r){return Fe(this,e,t,!0,r)},le.prototype.writeDoubleBE=function(e,t,r){return Fe(this,e,t,!1,r)},le.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,a=i-r;if(this===e&&r<t&&t<i)for(n=a-1;n>=0;--n)e[n+t]=this[n+r];else if(a<1e3||!le.TYPED_ARRAY_SUPPORT)for(n=0;n<a;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},le.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!le.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=ve(e)?e:Ve(new le(e,i).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var He=/[^+\/0-9A-Za-z-_]/g;function Ye(e){return e<16?"0"+e.toString(16):e.toString(16)}function Ve(e,t){var r;t=t||1/0;for(var i=e.length,n=null,a=[],o=0;o<i;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function Qe(e){return function(e){var t,r,i,n,a,o;re||ie();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new te(3*s/4-a),i=a>0?s-4:s;var d=0;for(t=0,r=0;t<i;t+=4,r+=3)n=ee[e.charCodeAt(t)]<<18|ee[e.charCodeAt(t+1)]<<12|ee[e.charCodeAt(t+2)]<<6|ee[e.charCodeAt(t+3)],o[d++]=n>>16&255,o[d++]=n>>8&255,o[d++]=255&n;return 2===a?(n=ee[e.charCodeAt(t)]<<2|ee[e.charCodeAt(t+1)]>>4,o[d++]=255&n):1===a&&(n=ee[e.charCodeAt(t)]<<10|ee[e.charCodeAt(t+1)]<<4|ee[e.charCodeAt(t+2)]>>2,o[d++]=n>>8&255,o[d++]=255&n),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(He,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function We(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function Ge(e){return null!=e&&(!!e._isBuffer||Xe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Xe(e.slice(0,0))}(e))}function Xe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Ze=Object.freeze({__proto__:null,Buffer:le,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),le.alloc(+e)},isBuffer:Ge,kMaxLength:ce});const $e=new W("ido");var et,tt,rt,it,nt;!function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(et||(et={})),function(e){e.InvalidInitOptions="invalid_initialization_options",e.NotInitialized="not_initialized",e.NoActiveJourney="no_active_journey",e.NetworkError="network_error",e.ClientResponseNotValid="client_response_not_valid",e.ServerError="server_error",e.InvalidState="invalid_state",e.InvalidCredentials="invalid_credentials",e.ExpiredOTPPasscode="expired_otp_passcode",e.ExpiredValidationPasscode="expired_validation_passcode",e.MaxResendReached="expired_otp_passcode"}(tt||(tt={})),function(e){e.ClientInput="client_input",e.Cancel="cancel",e.Fail="failure",e.Custom="custom",e.Resend="resend"}(rt||(rt={})),function(e){e.JourneySuccess="journey_success",e.ClientInputRequired="client_input_required",e.ClientInputUpdateRequired="client_input_update_required",e.JourneyRejection="journey_rejection"}(it||(it={})),function(e){e.Rejection="action:rejection",e.Success="action:success",e.Information="action:information",e.DebugBreak="action:debug_break",e.WaitForAnotherDevice="action:wait_for_another_device",e.CryptoBindingRegistration="action:crypto_binding_registration",e.CryptoBindingValidation="action:crypto_binding_validation",e.RegisterDeviceAction="transmit_platform_device_registration",e.ValidateDeviceAction="transmit_platform_device_validation",e.WebAuthnRegistration="action:webauthn_registration",e.DrsTriggerAction="action:drs_trigger_action",e.IdentityVerification="action:id_verification",e.EmailOTPAuthentication="transmit_platform_email_otp_authentication",e.SmsOTPAuthentication="transmit_platform_sms_otp_authentication",e.EmailValidation="transmit_platform_email_validation",e.SmsValidation="transmit_platform_sms_validation",e.TotpRegistration="transmit_platform_totp_registration",e.TransactionSigningTOTP="transmit_platform_transaction_signing_totp",e.InvokeIDP="invoke_idp",e.WebAuthnTransactionSigning="transmit_platform_transaction_signing_webauthn",e.SelectOrganization="transmit_platform_select_organization",e.MobileApproveAuthentication="transmit_platform_mobile_approve_authentication"}(nt||(nt={}));const at=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.Info;this.logLevel=e}setLogLevel(e){e<et.Debug||e>et.Error?this.error("Invalid log level"):this.logLevel=e}debug(e){this.logLevel<=et.Debug&&console.debug(`[DEBUG] ${e}`)}info(e){this.logLevel<=et.Info&&console.info(`[INFO] ${e}`)}warning(e){this.logLevel<=et.Warning&&console.warn(`[WARNING] ${e}`)}error(e){this.logLevel<=et.Error&&console.error(`[ERROR] ${e}`)}},ot={[nt.CryptoBindingRegistration]:"input",[nt.CryptoBindingValidation]:"input",[nt.RegisterDeviceAction]:"data",[nt.ValidateDeviceAction]:"data"},st="api/v2/",dt={path:"auth/sso"},ft={path:"auth/anonymous_invoke"},ct={path:"auth/assert"},ht={path:"auth/poll"},ut={path:"auth/create_debug_token"},lt={path:"auth/key_exchange"},bt={headers:{mandatory:!0,dummy:[{type:"correlation_id",correlation_id:"337BFFE6BEE7D694B8FA41F42B00742CA537DC398F79369A3A60E04D0EB2E8E1"}]},data:{mandatory:!0,dummy:{collection_result:{metadata:{timestamp:(new Date).getTime()},content:{}},policy_request_id:"LoginWithMenu"},large_dummy:{metadata:{timestamp:1679422144431},content:{device_details:{logged_users:1,persistence_mode:"persistent",device_id:"8951bd7b67a959e7b12b5018816f9ce4",os_type:"Mac OS",os_version:"10.15.7",device_model:"Chrome 111.0.0.0"},location:{enabled:!1},capabilities:{fido2_user_verifying_platform_authenticator_available:!0,audio_acquisition_supported:!0,finger_print_supported:!1,image_acquisition_supported:!1,persistent_keys_supported:!0,face_id_key_bio_protection_supported:!1,fido_client_present:!1,fido2_client_present:!0,dyadic_present:!1,installed_plugins:[]},collector_state:{accounts:"disabled",devicedetails:"active",contacts:"disabled",owner:"disabled",software:"disabled",location:"disabled",locationcountry:"disabled",bluetooth:"disabled",externalsdkdetails:"active",hwauthenticators:"active",capabilities:"active",fidoauthenticators:"disabled",largedata:"active",localenrollments:"active",devicefingerprint:"active",apppermissions:"disabled"},local_enrollments:{}},fp2:{user_agent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",webdriver:!0,language:"en-US",color_depth:30,device_memory:8,pixel_ratio:2,hardware_concurrency:12,screen_resolution:[1680,1050],available_screen_resolution:[1680,1025],timezone_offset:240,timezone:"America/New_York",session_storage:!0,local_storage:!0,indexed_db:!0,add_behavior:!1,open_database:!0,cpu_class:"not available",platform:"MacIntel",do_not_track:"not available",plugins:[["PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Chrome PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Chromium PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Microsoft Edge PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["WebKit built-in PDF","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]]],canvas:["canvas winding:yes","canvas fp:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB9AAAADICAYAAACwGnoBAAAAAXNSR0IArs4c6QAAIABJREFUeF7s3XeYXVW9//H3Omdaeu+FGgiE9BDAgmIBQRRQ4eIP0JCQmdC8YgHrZRQLAooSSjIpRMpVCZciiIAiKhoIpEMoUtILKaS3KWf/nu8+e0/2nDkzc+bMmckMfNbz8Ejm7L3W2q8zwT8++/tdjlY+PLz+wAhgKHA0MBjoB/QEDq9j+6uAzcAGYDXwFvA6sMzh1of3eHjtgWHA8ZH/7Qa0q+Mfu3VfHf9sA14Flof/63B7q/fn5fY5cAefo5V/hdqeBCQgAQlIQAISkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQggTYh4FrbLj2844BPAh8FTg4C81xucyewBygAeuRy4uhcrwF/6sx7Tw3lwMKT6LDtNDr7T2Sxf26GvRjwAvBP4G84Z0tmNLxivIwufJ9d5Mpodb/v7zNiPY4EJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkIAE2rRAqwgUPbyTgC8AnwMsQG+TYz7wEPAYUGeaPQr4MPCh4BWBQTl7VFvSln4I52wrdQ4F6Dkz10QSkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkMD7SOCQBegenlV/XwpMCtqzt0nWrcDdwKygR3yjH+IU4LPBqwPWqD43w8J029IcnLMt1hgK0HODrFkkIAEJSEACEpCABCQgAQlIQAISkIAEJCABCUhAAhKQgAQkIIH3l0D9AXppaR6lpZX+I0f/vQkGHt5w4EqgJJNprNf4GnYzgA7EcWxhPz0pyuTWjK7ZxgG6UehfW0mCchK0J6/Be18G7gCmN3ilPYER5jd4JacDnw/CdDvpPXXsPQDxOBQ2vL/IrdOAO3HOtuwPC9C3056uHDyiveHNte0rttCRXmW7c/PCSH1/F+r6LJt72ja5di8BCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkIAEJCCBNidQO1CcNPNo4lU/Ak7AeTvwXAc8twbnHUdl3jhmT9qVzVN6eFZf/W3g4kzvf43tXMW/6EIBf2Ud/+YcRvAgD3E653F4ptOkve6fbOBbvEARcZ7lc3ydefyW//AHPsWZ1N1XfRlwM3Bfg6sngEWA5dZ2lHsjOtPb+wHWzN7C9C8DO3fD3Bdg4Ttw3blwZO8GV09zwb3ALUyZftyR3pbfn83L/IY/ZDNPm7vnGYbyKa6BWGI40y5/JesHmDTzMPIqLwGOwnPjgd9QVlLmzze5bAKxxEA8Z9+Y/ZpcR1nJarK5J+sN6kYJSEACEpCABCQgAQlIQAISkIAEJCABCUhAAhKQgAQkIAEJSKApAjUD9MllZ+K8J/DcNLZ3/W/mXlBOaWmMDX2/h+duIBHry8zJ7zZmQQ+vF3B9UHXemFv5DE9QwvF+oD2L15nAMfyOt/3wvEcOqtBLeI632MEznM1G9tKP+3iCM9MG6JuAHwdV55k/hIXoM4PDzhsRoEcXOAGYAHxmG9w2tykBejjrHeNLrrvyZFa1ugB9PV1ZS1fGszJz4gyutGr7uYyluPD8IqZ+7UAGt6S/ZHLZTJx3P2Ulz/qBufPuJq+yH55rT2XeLGYUn+Z3aljfbwUwl7KSb5DNPVlvUDdKQAISkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAJNETgYoF9+Zzeq4quAFfTfMJrSUkt/D47JZc/iuYnMnGzhYEbDw7sK+CnQOaMbUi7qzN0NVoRnM294z38zD6tyf5qz2EE5XZmTNkC/Hfi+FYJntZidkN7ICvR06/TfBX1+B788F07LqgK9eta8kmv4CBt4thVVoO8jnzP4b67mWc5nYVbSDd3kymhaC/eSaU+SiC1hRvF3KJ4+FHgN532RRGwjzvs35QXdmHPpdoqn3w+Mo6zkWLK5p6EH0ecSkIAEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAISkECzCBwMFIunX+6fle25S5lRPKfWapfNOI5YYj0wFRjmH/+diC3Eeb8hlojjuespK3ma4um39NhUOOL5x88teKRy5cfWsofx9OYuXuUIOvFTTuQJVnMfb/lnmc/k1Fpnmr/Bdn7CYu7jTT7NQAbRgV9wEovYwu94iy9zNKczkASeP6+1Y99DJcfSlR8yhnbEeYxVzOYNJnIsv+YVzmAgP2AMv+Zl/swaulHA62ynH+15MhKg38h4/sMO/sVGPs3R/IfR/IUYYDXo9u7APvDPDv8Y0A74D/AOcDzwFrANOBGqW8yHAfoQ8IPh7UBfwDrap+a5Nu/rwA7ACqUtKG8PWFZrnfN/B+3PhQsLoO+L0KcSThqS/OfNjfDnRfCpkbBtF7z4Fpx0DCx8GzZuh48Ng9NtTTt9/hpgC0f564xlLOuYzT104ABv+d/Vx/xK8G104G7mMMDfc3JUEqOEi1nCIE7jDW7hQd6hJ5O5hE/xOt/lz2yiE9/jPJYxgE/yOpfzDwbzHj/lLJ7jaH++…brB0xZVAGAtqpyy+87fNf4HUyf1sNzSz83GXvYnYKXM6qTDBVhJ29tL7uzrJF+rcOC5Dy8Hq5efB1QGSkNdigBLnWXzB/zn10h7RWRj1hcaCpHOK7cB1fwKc4cvBQCWL6UDjnPuTG//1SRguT7Vqy8CqoAWMXRFBQBWRaE0X3bu9kH/avgtoVv6ndkDVJq9tRY7wErc8bOvknxFBt+/csByS787LgGqxK1PMj2AlaStg6TOvmLQv3JLv9f+FVAlbnnS6QGspO0VOXerbBaF/PoNfwNUiVttIj2AlbjNZ2+W9l2XgVXiNptJD2CZsZpEUUC/AgBLv4dkgAJmFABYZqwmURTQrwDA0u8hGaCAGQUAlhmrSRQF9CsAsPR7SAYoYEYBgGXGahJFAf0K/B9qEBa1B23aowAAAABJRU5ErkJggg==","extensions:ANGLE_instanced_arrays;EXT_blend_minmax;EXT_color_buffer_half_float;EXT_disjoint_timer_query;EXT_float_blend;EXT_frag_depth;EXT_shader_texture_lod;EXT_texture_compression_rgtc;EXT_texture_filter_anisotropic;EXT_sRGB;KHR_parallel_shader_compile;OES_element_index_uint;OES_fbo_render_mipmap;OES_standard_derivatives;OES_texture_float;OES_texture_float_linear;OES_texture_half_float;OES_texture_half_float_linear;OES_vertex_array_object;WEBGL_color_buffer_float;WEBGL_compressed_texture_s3tc;WEBGL_compressed_texture_s3tc_srgb;WEBGL_debug_renderer_info;WEBGL_debug_shaders;WEBGL_depth_texture;WEBGL_draw_buffers;WEBGL_lose_context;WEBGL_multi_draw","webgl aliased line width range:[1, 1]","webgl aliased point size range:[1, 8191]","webgl alpha bits:8","webgl antialiasing:yes","webgl blue bits:8","webgl depth bits:24","webgl green bits:8","webgl max anisotropy:16","webgl max combined texture image units:32","webgl max cube map texture size:16384","webgl max fragment uniform vectors:1024","webgl max render buffer size:16384","webgl max texture image units:16","webgl max texture size:16384","webgl max varying vectors:32","webgl max vertex attribs:16","webgl max vertex texture image units:16","webgl max vertex uniform vectors:1024","webgl max viewport dims:[16384, 16384]","webgl red bits:8","webgl renderer:WebKit WebGL","webgl shading language version:WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)","webgl stencil bits:0","webgl vendor:WebKit","webgl version:WebGL 1.0 (OpenGL ES 2.0 Chromium)","webgl unmasked vendor:Google Inc. (ATI Technologies Inc.)","webgl unmasked renderer:ANGLE (ATI Technologies Inc., AMD Radeon Pro 560X OpenGL Engine, OpenGL 4.1)","webgl vertex shader high float precision:23","webgl vertex shader high float precision rangeMin:127","webgl vertex shader high float precision rangeMax:127","webgl vertex shader medium float precision:23","webgl vertex shader medium float precision rangeMin:127","webgl vertex shader medium float precision rangeMax:127","webgl vertex shader low float precision:23","webgl vertex shader low float precision rangeMin:127","webgl vertex shader low float precision rangeMax:127","webgl fragment shader high float precision:23","webgl fragment shader high float precision rangeMin:127","webgl fragment shader high float precision rangeMax:127","webgl fragment shader medium float precision:23","webgl fragment shader medium float precision rangeMin:127","webgl fragment shader medium float precision rangeMax:127","webgl fragment shader low float precision:23","webgl fragment shader low float precision rangeMin:127","webgl fragment shader low float precision rangeMax:127","webgl vertex shader high int precision:0","webgl vertex shader high int precision rangeMin:31","webgl vertex shader high int precision rangeMax:30","webgl vertex shader medium int precision:0","webgl vertex shader medium int precision rangeMin:31","webgl vertex shader medium int precision rangeMax:30","webgl vertex shader low int precision:0","webgl vertex shader low int precision rangeMin:31","webgl vertex shader low int precision rangeMax:30","webgl fragment shader high int precision:0","webgl fragment shader high int precision rangeMin:31","webgl fragment shader high int precision rangeMax:30","webgl fragment shader medium int precision:0","webgl fragment shader medium int precision rangeMin:31","webgl fragment shader medium int precision rangeMax:30","webgl fragment shader low int precision:0","webgl fragment shader low int precision rangeMin:31","webgl fragment shader low int precision rangeMax:30"],webgl_vendor_and_renderer:"Google Inc. (ATI Technologies Inc.)~ANGLE (ATI Technologies Inc., AMD Radeon Pro 560X OpenGL Engine, OpenGL 4.1)",ad_block:!1,has_lied_languages:!1,has_lied_resolution:!1,has_lied_os:!1,has_lied_browser:!1,touch_support:[0,!1,!1],fonts:["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Comic Sans MS","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","LUCIDA GRANDE","Microsoft Sans Serif","Monaco","Palatino","Tahoma","Times","Times New Roman","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"],fonts_flash:"swf object not loaded",audio:"124.04347657808103",enumerate_devices:["id=;gid=;audioinput;","id=;gid=;videoinput;","id=;gid=;audiooutput;"]}},policy_request_id:"LoginWithMenu",params:{}}},pt=[{"control_flow.0":["assertion_id","type"]}];class gt extends Error{constructor(e,t){at.error(`[ERROR] ${e}`),super(e),this.description=e,this.errorCode=t}static convertFromAssertionError(e){switch(e){case 28:return tt.ClientResponseNotValid;case 29:case 31:case 35:return tt.InvalidCredentials;case 30:return tt.ExpiredOTPPasscode;case 32:return tt.ExpiredValidationPasscode;case 33:return tt.MaxResendReached;default:return tt.ServerError}}}var yt,mt,vt;!function(e){e.JsonRejection="Json Rejection",e.TextRejection="Text Rejection",e.UpdateAction="Update Action",e.NextAction="Next Action",e.JourneyEnd="Journey End"}(yt||(yt={})),function(e){e.Pending="pending",e.Completed="completed",e.Rejected="rejected"}(mt||(mt={})),function(e){e.Form="form",e.LoginForm="login_form",e.Rejection="rejection",e.Information="information",e.DebugBreak="debug_break",e.WaitForTicket="wait_for_ticket",e.DrsTriggerAction="transmit_acp",e.IdentityVerification="kyc",e.WebAuthnRegistration="transmit_platform_web_authn_registration"}(vt||(vt={}));var wt={},_t="6.6.1",Mt={},At={},St={get exports(){return At},set exports(e){At=e}},It=X(Ze);!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function d(e,t,r,i){for(var n=0,a=Math.min(e.length,r),o=t;o<a;o++){var s=e.charCodeAt(o)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,i){if("number"==typeof e)return this._initNumber(e,t,i);if("object"==typeof e)return this._initArray(e,t,i);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,i):(this._parseBase(e,t,n),"le"===i&&this._initArray(this.toArray(),t,i)))},n.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),t,i)},n.prototype._initArray=function(e,t,i){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,o,s=0;if("be"===i)for(n=e.length-1,a=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===i)for(n=0,a=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=s(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=s(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,o=a%i,s=Math.min(a,a-o)+r,f=0,c=r;c<s;c+=i)f=d(e,c,c+i,t),this.imuln(n),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==o){var h=1;for(f=d(e,c,e.length,t),c=0;c<o;c++)h*=t;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},n.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],o=n*a,s=67108863&o,d=o/67108864|0;r.words[0]=s;for(var f=1;f<i;f++){for(var c=d>>>26,h=67108863&d,u=Math.min(f,t.length-1),l=Math.max(0,f-e.length+1);l<=u;l++){var b=f-l|0;c+=(o=(n=0|e.words[b])*(a=0|t.words[l])+h)/67108864|0,h=67108863&o}r.words[f]=0|h,d=0|c}return 0!==d?r.words[f]=0|d:r.length--,r.strip()}n.prototype.toString=function(e,t){var i;if(t=0|t||1,16===(e=e||10)||"hex"===e){i="";for(var n=0,a=0,o=0;o<this.length;o++){var s=this.words[o],d=(16777215&(s<<n|a)).toString(16);a=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),i=0!==a||o!==this.length-1?f[6-d.length]+d+i:d+i}for(0!==a&&(i=a.toString(16)+i);i.length%t!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(e===(0|e)&&e>=2&&e<=36){var u=c[e],l=h[e];i="";var b=this.clone();for(b.negative=0;!b.isZero();){var p=b.modn(l).toString(e);i=(b=b.idivn(l)).isZero()?p+i:f[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%t!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==a),this.toArrayLike(a,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,i){var n=this.byteLength(),a=i||Math.max(1,n);r(n<=a,"byte array longer than desired length"),r(a>0,"Requested array length <= 0"),this.strip();var o,s,d="le"===t,f=new e(a),c=this.clone();if(d){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),f[s]=o;for(;s<a;s++)f[s]=0}else{for(s=0;s<a-n;s++)f[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),f[a-s-1]=o}return f},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},n.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},n.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),i=e%26;this._expand(t),i>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var i=e/26|0,n=e%26;return this._expand(i+1),this.words[i]=t?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},n.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},n.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)a=(t=(0|r.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(e){return this.clone().isub(e)};var l=function(e,t,r){var i,n,a,o=e.words,s=t.words,d=r.words,f=0,c=0|o[0],h=8191&c,u=c>>>13,l=0|o[1],b=8191&l,p=l>>>13,g=0|o[2],y=8191&g,m=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,M=0|o[4],A=8191&M,S=M>>>13,I=0|o[5],R=8191&I,x=I>>>13,E=0|o[6],P=8191&E,k=E>>>13,B=0|o[7],C=8191&B,j=B>>>13,D=0|o[8],z=8191&D,T=D>>>13,O=0|o[9],K=8191&O,N=O>>>13,q=0|s[0],L=8191&q,J=q>>>13,U=0|s[1],F=8191&U,H=U>>>13,Y=0|s[2],V=8191&Y,Q=Y>>>13,W=0|s[3],G=8191&W,X=W>>>13,Z=0|s[4],$=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],ae=8191&ne,oe=ne>>>13,se=0|s[7],de=8191&se,fe=se>>>13,ce=0|s[8],he=8191&ce,ue=ce>>>13,le=0|s[9],be=8191&le,pe=le>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(f+(i=Math.imul(h,L))|0)+((8191&(n=(n=Math.imul(h,J))+Math.imul(u,L)|0))<<13)|0;f=((a=Math.imul(u,J))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(b,L),n=(n=Math.imul(b,J))+Math.imul(p,L)|0,a=Math.imul(p,J);var ye=(f+(i=i+Math.imul(h,F)|0)|0)+((8191&(n=(n=n+Math.imul(h,H)|0)+Math.imul(u,F)|0))<<13)|0;f=((a=a+Math.imul(u,H)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(y,L),n=(n=Math.imul(y,J))+Math.imul(m,L)|0,a=Math.imul(m,J),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(p,F)|0,a=a+Math.imul(p,H)|0;var me=(f+(i=i+Math.imul(h,V)|0)|0)+((8191&(n=(n=n+Math.imul(h,Q)|0)+Math.imul(u,V)|0))<<13)|0;f=((a=a+Math.imul(u,Q)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(w,L),n=(n=Math.imul(w,J))+Math.imul(_,L)|0,a=Math.imul(_,J),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(m,F)|0,a=a+Math.imul(m,H)|0,i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,Q)|0)+Math.imul(p,V)|0,a=a+Math.imul(p,Q)|0;var ve=(f+(i=i+Math.imul(h,G)|0)|0)+((8191&(n=(n=n+Math.imul(h,X)|0)+Math.imul(u,G)|0))<<13)|0;f=((a=a+Math.imul(u,X)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(A,L),n=(n=Math.imul(A,J))+Math.imul(S,L)|0,a=Math.imul(S,J),i=i+Math.imul(w,F)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,F)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,Q)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,X)|0)+Math.imul(p,G)|0,a=a+Math.imul(p,X)|0;var we=(f+(i=i+Math.imul(h,$)|0)|0)+((8191&(n=(n=n+Math.imul(h,ee)|0)+Math.imul(u,$)|0))<<13)|0;f=((a=a+Math.imul(u,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(R,L),n=(n=Math.imul(R,J))+Math.imul(x,L)|0,a=Math.imul(x,J),i=i+Math.imul(A,F)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(S,F)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,Q)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,X)|0,i=i+Math.imul(b,$)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(p,$)|0,a=a+Math.imul(p,ee)|0;var _e=(f+(i=i+Math.imul(h,re)|0)|0)+((8191&(n=(n=n+Math.imul(h,ie)|0)+Math.imul(u,re)|0))<<13)|0;f=((a=a+Math.imul(u,ie)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(P,L),n=(n=Math.imul(P,J))+Math.imul(k,L)|0,a=Math.imul(k,J),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(x,F)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,Q)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(p,re)|0,a=a+Math.imul(p,ie)|0;var Me=(f+(i=i+Math.imul(h,ae)|0)|0)+((8191&(n=(n=n+Math.imul(h,oe)|0)+Math.imul(u,ae)|0))<<13)|0;f=((a=a+Math.imul(u,oe)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(C,L),n=(n=Math.imul(C,J))+Math.imul(j,L)|0,a=Math.imul(j,J),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,H)|0)+Math.imul(k,F)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,Q)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,ee)|0,i=i+Math.imul(y,re)|0,n=(n=n+Math.imul(y,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0,i=i+Math.imul(b,ae)|0,n=(n=n+Math.imul(b,oe)|0)+Math.imul(p,ae)|0,a=a+Math.imul(p,oe)|0;var Ae=(f+(i=i+Math.imul(h,de)|0)|0)+((8191&(n=(n=n+Math.imul(h,fe)|0)+Math.imul(u,de)|0))<<13)|0;f=((a=a+Math.imul(u,fe)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(z,L),n=(n=Math.imul(z,J))+Math.imul(T,L)|0,a=Math.imul(T,J),i=i+Math.imul(C,F)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(j,F)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,Q)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,i=i+Math.imul(w,re)|0,n=(n=n+Math.imul(w,ie)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ie)|0,i=i+Math.imul(y,ae)|0,n=(n=n+Math.imul(y,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0,i=i+Math.imul(b,de)|0,n=(n=n+Math.imul(b,fe)|0)+Math.imul(p,de)|0,a=a+Math.imul(p,fe)|0;var Se=(f+(i=i+Math.imul(h,he)|0)|0)+((8191&(n=(n=n+Math.imul(h,ue)|0)+Math.imul(u,he)|0))<<13)|0;f=((a=a+Math.imul(u,ue)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(K,L),n=(n=Math.imul(K,J))+Math.imul(N,L)|0,a=Math.imul(N,J),i=i+Math.imul(z,F)|0,n=(n=n+Math.imul(z,H)|0)+Math.imul(T,F)|0,a=a+Math.imul(T,H)|0,i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,Q)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,Q)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(x,$)|0,a=a+Math.imul(x,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(S,re)|0,a=a+Math.imul(S,ie)|0,i=i+Math.imul(w,ae)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,i=i+Math.imul(y,de)|0,n=(n=n+Math.imul(y,fe)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,fe)|0,i=i+Math.imul(b,he)|0,n=(n=n+Math.imul(b,ue)|0)+Math.imul(p,he)|0,a=a+Math.imul(p,ue)|0;var Ie=(f+(i=i+Math.imul(h,be)|0)|0)+((8191&(n=(n=n+Math.imul(h,pe)|0)+Math.imul(u,be)|0))<<13)|0;f=((a=a+Math.imul(u,pe)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(K,F),n=(n=Math.imul(K,H))+Math.imul(N,F)|0,a=Math.imul(N,H),i=i+Math.imul(z,V)|0,n=(n=n+Math.imul(z,Q)|0)+Math.imul(T,V)|0,a=a+Math.imul(T,Q)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,X)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,X)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ie)|0,i=i+Math.imul(A,ae)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,i=i+Math.imul(w,de)|0,n=(n=n+Math.imul(w,fe)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,fe)|0,i=i+Math.imul(y,he)|0,n=(n=n+Math.imul(y,ue)|0)+Math.imul(m,he)|0,a=a+Math.imul(m,ue)|0;var Re=(f+(i=i+Math.imul(b,be)|0)|0)+((8191&(n=(n=n+Math.imul(b,pe)|0)+Math.imul(p,be)|0))<<13)|0;f=((a=a+Math.imul(p,pe)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(K,V),n=(n=Math.imul(K,Q))+Math.imul(N,V)|0,a=Math.imul(N,Q),i=i+Math.imul(z,G)|0,n=(n=n+Math.imul(z,X)|0)+Math.imul(T,G)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(C,$)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(j,$)|0,a=a+Math.imul(j,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(k,re)|0,a=a+Math.imul(k,ie)|0,i=i+Math.imul(R,ae)|0,n=(n=n+Math.imul(R,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,i=i+Math.imul(A,de)|0,n=(n=n+Math.imul(A,fe)|0)+Math.imul(S,de)|0,a=a+Math.imul(S,fe)|0,i=i+Math.imul(w,he)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul(_,he)|0,a=a+Math.imul(_,ue)|0;var xe=(f+(i=i+Math.imul(y,be)|0)|0)+((8191&(n=(n=n+Math.imul(y,pe)|0)+Math.imul(m,be)|0))<<13)|0;f=((a=a+Math.imul(m,pe)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(K,G),n=(n=Math.imul(K,X))+Math.imul(N,G)|0,a=Math.imul(N,X),i=i+Math.imul(z,$)|0,n=(n=n+Math.imul(z,ee)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,ee)|0,i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ie)|0,i=i+Math.imul(P,ae)|0,n=(n=n+Math.imul(P,oe)|0)+Math.imul(k,ae)|0,a=a+Math.imul(k,oe)|0,i=i+Math.imul(R,de)|0,n=(n=n+Math.imul(R,fe)|0)+Math.imul(x,de)|0,a=a+Math.imul(x,fe)|0,i=i+Math.imul(A,he)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(S,he)|0,a=a+Math.imul(S,ue)|0;var Ee=(f+(i=i+Math.imul(w,be)|0)|0)+((8191&(n=(n=n+Math.imul(w,pe)|0)+Math.imul(_,be)|0))<<13)|0;f=((a=a+Math.imul(_,pe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(K,$),n=(n=Math.imul(K,ee))+Math.imul(N,$)|0,a=Math.imul(N,ee),i=i+Math.imul(z,re)|0,n=(n=n+Math.imul(z,ie)|0)+Math.imul(T,re)|0,a=a+Math.imul(T,ie)|0,i=i+Math.imul(C,ae)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,oe)|0,i=i+Math.imul(P,de)|0,n=(n=n+Math.imul(P,fe)|0)+Math.imul(k,de)|0,a=a+Math.imul(k,fe)|0,i=i+Math.imul(R,he)|0,n=(n=n+Math.imul(R,ue)|0)+Math.imul(x,he)|0,a=a+Math.imul(x,ue)|0;var Pe=(f+(i=i+Math.imul(A,be)|0)|0)+((8191&(n=(n=n+Math.imul(A,pe)|0)+Math.imul(S,be)|0))<<13)|0;f=((a=a+Math.imul(S,pe)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(K,re),n=(n=Math.imul(K,ie))+Math.imul(N,re)|0,a=Math.imul(N,ie),i=i+Math.imul(z,ae)|0,n=(n=n+Math.imul(z,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,oe)|0,i=i+Math.imul(C,de)|0,n=(n=n+Math.imul(C,fe)|0)+Math.imul(j,de)|0,a=a+Math.imul(j,fe)|0,i=i+Math.imul(P,he)|0,n=(n=n+Math.imul(P,ue)|0)+Math.imul(k,he)|0,a=a+Math.imul(k,ue)|0;var ke=(f+(i=i+Math.imul(R,be)|0)|0)+((8191&(n=(n=n+Math.imul(R,pe)|0)+Math.imul(x,be)|0))<<13)|0;f=((a=a+Math.imul(x,pe)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(K,ae),n=(n=Math.imul(K,oe))+Math.imul(N,ae)|0,a=Math.imul(N,oe),i=i+Math.imul(z,de)|0,n=(n=n+Math.imul(z,fe)|0)+Math.imul(T,de)|0,a=a+Math.imul(T,fe)|0,i=i+Math.imul(C,he)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(j,he)|0,a=a+Math.imul(j,ue)|0;var Be=(f+(i=i+Math.imul(P,be)|0)|0)+((8191&(n=(n=n+Math.imul(P,pe)|0)+Math.imul(k,be)|0))<<13)|0;f=((a=a+Math.imul(k,pe)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863,i=Math.imul(K,de),n=(n=Math.imul(K,fe))+Math.imul(N,de)|0,a=Math.imul(N,fe),i=i+Math.imul(z,he)|0,n=(n=n+Math.imul(z,ue)|0)+Math.imul(T,he)|0,a=a+Math.imul(T,ue)|0;var Ce=(f+(i=i+Math.imul(C,be)|0)|0)+((8191&(n=(n=n+Math.imul(C,pe)|0)+Math.imul(j,be)|0))<<13)|0;f=((a=a+Math.imul(j,pe)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(K,he),n=(n=Math.imul(K,ue))+Math.imul(N,he)|0,a=Math.imul(N,ue);var je=(f+(i=i+Math.imul(z,be)|0)|0)+((8191&(n=(n=n+Math.imul(z,pe)|0)+Math.imul(T,be)|0))<<13)|0;f=((a=a+Math.imul(T,pe)|0)+(n>>>13)|0)+(je>>>26)|0,je&=67108863;var De=(f+(i=Math.imul(K,be))|0)+((8191&(n=(n=Math.imul(K,pe))+Math.imul(N,be)|0))<<13)|0;return f=((a=Math.imul(N,pe))+(n>>>13)|0)+(De>>>26)|0,De&=67108863,d[0]=ge,d[1]=ye,d[2]=me,d[3]=ve,d[4]=we,d[5]=_e,d[6]=Me,d[7]=Ae,d[8]=Se,d[9]=Ie,d[10]=Re,d[11]=xe,d[12]=Ee,d[13]=Pe,d[14]=ke,d[15]=Be,d[16]=Ce,d[17]=je,d[18]=De,0!==f&&(d[19]=f,r.length++),r};function b(e,t,r){return(new p).mulp(e,t,r)}function p(e,t){this.x=e,this.y=t}Math.imul||(l=u),n.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return r=10===this.length&&10===e.length?l(this,e,t):i<63?u(this,e,t):i<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var o=n;n=0;for(var s=67108863&i,d=Math.min(a,t.length-1),f=Math.max(0,a-e.length+1);f<=d;f++){var c=a-f,h=(0|e.words[c])*(0|t.words[f]),u=67108863&h;s=67108863&(u=u+s|0),n+=(o=(o=o+(h/67108864|0)|0)+(u>>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,e,t):b(this,e,t),r},p.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},p.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},p.prototype.permute=function(e,t,r,i,n,a){for(var o=0;o<a;o++)i[o]=t[e[o]],n[o]=r[e[o]]},p.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,d=Math.cos(2*Math.PI/s),f=Math.sin(2*Math.PI/s),c=0;c<n;c+=s)for(var h=d,u=f,l=0;l<o;l++){var b=r[c+l],p=i[c+l],g=r[c+l+o],y=i[c+l+o],m=h*g-u*y;y=h*y+u*g,g=m,r[c+l]=b+g,i[c+l]=p+y,r[c+l+o]=b-g,i[c+l+o]=p-y,l!==s&&(m=d*h-f*u,u=d*u+f*h,h=m)}},p.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},p.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},p.prototype.convert13b=function(e,t,i,n){for(var a=0,o=0;o<t;o++)a+=0|e[o],i[2*o]=8191&a,a>>>=13,i[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<n;++o)i[o]=0;r(0===a),r(0==(-8192&a))},p.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},p.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),o=new Array(i),s=new Array(i),d=new Array(i),f=new Array(i),c=new Array(i),h=new Array(i),u=r.words;u.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,f,i),this.transform(o,a,s,d,i,n),this.transform(f,a,c,h,i,n);for(var l=0;l<i;l++){var b=s[l]*c[l]-d[l]*h[l];d[l]=s[l]*h[l]+d[l]*c[l],s[l]=b}return this.conjugate(s,d,i),this.transform(s,d,u,a,i,n),this.conjugate(u,a,i),this.normalize13b(u,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),b(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,i=0;i<this.length;i++){var n=(0|this.words[i])*e,a=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=a>>>26,this.words[i]=67108863&a}return 0!==t&&(this.words[i]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var a=r.sqr();i<t.length;i++,a=a.sqr())0!==t[i]&&(r=r.mul(a));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,i=e%26,n=(e-i)/26,a=67108863>>>26-i<<26-i;if(0!==i){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,d=(0|this.words[t])-s<<i;this.words[t]=d|o,o=s>>>26-i}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,i){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,d=i;if(n-=o,n=Math.max(0,n),d){for(var f=0;f<o;f++)d.words[f]=this.words[f];d.length=o}if(0===o);else if(this.length>o)for(this.length-=o,f=0;f<this.length;f++)this.words[f]=this.words[f+o];else this.words[0]=0,this.length=1;var c=0;for(f=this.length-1;f>=0&&(0!==c||f>=n);f--){var h=0|this.words[f];this.words[f]=c<<26-a|h>>>a,c=h&s}return d&&0!==c&&(d.words[d.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,i){return r(0===this.negative),this.iushrn(e,t,i)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26,n=1<<t;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==t&&i++,this.length=Math.min(i,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},n.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},n.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,i){var n,a,o=e.length+i;this._expand(o);var s=0;for(n=0;n<e.length;n++){a=(0|this.words[n+i])+s;var d=(0|e.words[n])*t;s=((a-=67108863&d)>>26)-(d/67108864|0),this.words[n+i]=67108863&a}for(;n<this.length-i;n++)s=(a=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&a;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(a=-(0|this.words[n])+s)>>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),a=e,o=0|a.words[a.length-1];0!=(r=26-this._countBits(o))&&(a=a.ushln(r),i.iushln(r),o=0|a.words[a.length-1]);var s,d=i.length-a.length;if("mod"!==t){(s=new n(null)).length=d+1,s.words=new Array(s.length);for(var f=0;f<s.length;f++)s.words[f]=0}var c=i.clone()._ishlnsubmul(a,1,d);0===c.negative&&(i=c,s&&(s.words[d]=1));for(var h=d-1;h>=0;h--){var u=67108864*(0|i.words[a.length+h])+(0|i.words[a.length+h-1]);for(u=Math.min(u/o|0,67108863),i._ishlnsubmul(a,u,h);0!==i.negative;)u--,i.negative=0,i._ishlnsubmul(a,1,h),i.isZero()||(i.negative^=1);s&&(s.words[h]=u)}return s&&s.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(e,t,i){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),i&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),i&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,i=0,n=this.length-1;n>=0;n--)i=(t*i+(0|this.words[n]))%e;return i},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*t;this.words[i]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,i=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new n(1),o=new n(0),s=new n(0),d=new n(1),f=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++f;for(var c=i.clone(),h=t.clone();!t.isZero();){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(h)),a.iushrn(1),o.iushrn(1);for(var b=0,p=1;0==(i.words[0]&p)&&b<26;++b,p<<=1);if(b>0)for(i.iushrn(b);b-- >0;)(s.isOdd()||d.isOdd())&&(s.iadd(c),d.isub(h)),s.iushrn(1),d.iushrn(1);t.cmp(i)>=0?(t.isub(i),a.isub(s),o.isub(d)):(i.isub(t),s.isub(a),d.isub(o))}return{a:s,b:d,gcd:i.iushln(f)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,i=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new n(1),s=new n(0),d=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(d),o.iushrn(1);for(var h=0,u=1;0==(i.words[0]&u)&&h<26;++h,u<<=1);if(h>0)for(i.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(d),s.iushrn(1);t.cmp(i)>=0?(t.isub(i),o.isub(s)):(i.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},n.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,i=(e-t)/26,n=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var a=n,o=i;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,i=e<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)t=1;else{i&&(e=-e),r(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},n.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},n.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new M(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(m,y),m.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},m.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new m;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return g[e]=t,t},M.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var i=this.m.add(new n(1)).iushrn(2);return this.pow(e,i)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new n(1).toRed(this),d=s.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);0!==this.pow(c,f).cmp(d);)c.redIAdd(d);for(var h=this.pow(c,a),u=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=o;0!==l.cmp(s);){for(var p=l,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<b);var y=this.pow(h,new n(1).iushln(b-g-1));u=u.redMul(y),h=y.redSqr(),l=l.redMul(h),b=g}return u},M.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},M.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var a=r[0],o=0,s=0,d=t.bitLength()%26;for(0===d&&(d=26),i=t.length-1;i>=0;i--){for(var f=t.words[i],c=d-1;c>=0;c--){var h=f>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==h||0!==o?(o<<=1,o|=h,(4==++s||0===i&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}d=26}return a},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new A(e)},i(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(i).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(St,G);var Rt=xt;function xt(e,t){if(!e)throw new Error(t||"Assertion failed")}xt.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Et={};!function(e){var t=Et;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",i=0;i<e.length;i++)t+=r(e[i].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),a=n>>8,o=255&n;a?r.push(a,o):r.push(o)}return r},t.zero2=r,t.toHex=i,t.encode=function(e,t){return"hex"===t?i(e):e}}(),function(e){var t=Mt,r=At,i=Rt,n=Et;t.assert=i,t.toArray=n.toArray,t.zero2=n.zero2,t.toHex=n.toHex,t.encode=n.encode,t.getNAF=function(e,t,r){var i,n=new Array(Math.max(e.bitLength(),r)+1);for(i=0;i<n.length;i+=1)n[i]=0;var a=1<<t+1,o=e.clone();for(i=0;i<n.length;i++){var s,d=o.andln(a-1);o.isOdd()?(s=d>(a>>1)-1?(a>>1)-d:d,o.isubn(s)):s=0,n[i]=s,o.iushrn(1)}return n},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,a=0;e.cmpn(-n)>0||t.cmpn(-a)>0;){var o,s,d=e.andln(3)+n&3,f=t.andln(3)+a&3;3===d&&(d=-1),3===f&&(f=-1),o=0==(1&d)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==f?d:-d,r[0].push(o),s=0==(1&f)?0:3!==(i=t.andln(7)+a&7)&&5!==i||2!==d?f:-f,r[1].push(s),2*n===o+1&&(n=1-n),2*a===s+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}();var Pt,kt={},Bt={get exports(){return kt},set exports(e){kt=e}},Ct=X(Object.freeze({__proto__:null,default:{}}));function jt(e){this.rand=e}if(Bt.exports=function(e){return Pt||(Pt=new jt(null)),Pt.generate(e)},kt.Rand=jt,jt.prototype.generate=function(e){return this._rand(e)},jt.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?jt.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?jt.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(jt.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var Dt=Ct;if("function"!=typeof Dt.randomBytes)throw new Error("Not supported");jt.prototype._rand=function(e){return Dt.randomBytes(e)}}catch(e){}var zt={},Tt=At,Ot=Mt,Kt=Ot.getNAF,Nt=Ot.getJSF,qt=Ot.assert;function Lt(e,t){this.type=e,this.p=new Tt(t.p,16),this.red=t.prime?Tt.red(t.prime):Tt.mont(this.p),this.zero=new Tt(0).toRed(this.red),this.one=new Tt(1).toRed(this.red),this.two=new Tt(2).toRed(this.red),this.n=t.n&&new Tt(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Jt=Lt;function Ut(e,t){this.curve=e,this.type=t,this.precomputed=null}Lt.prototype.point=function(){throw new Error("Not implemented")},Lt.prototype.validate=function(){throw new Error("Not implemented")},Lt.prototype._fixedNafMul=function(e,t){qt(e.precomputed);var r=e._getDoubles(),i=Kt(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var a,o,s=[];for(a=0;a<i.length;a+=r.step){o=0;for(var d=a+r.step-1;d>=a;d--)o=(o<<1)+i[d];s.push(o)}for(var f=this.jpoint(null,null,null),c=this.jpoint(null,null,null),h=n;h>0;h--){for(a=0;a<s.length;a++)(o=s[a])===h?c=c.mixedAdd(r.points[a]):o===-h&&(c=c.mixedAdd(r.points[a].neg()));f=f.add(c)}return f.toP()},Lt.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,a=Kt(t,r,this._bitLength),o=this.jpoint(null,null,null),s=a.length-1;s>=0;s--){for(var d=0;s>=0&&0===a[s];s--)d++;if(s>=0&&d++,o=o.dblp(d),s<0)break;var f=a[s];qt(0!==f),o="affine"===e.type?f>0?o.mixedAdd(n[f-1>>1]):o.mixedAdd(n[-f-1>>1].neg()):f>0?o.add(n[f-1>>1]):o.add(n[-f-1>>1].neg())}return"affine"===e.type?o.toP():o},Lt.prototype._wnafMulAdd=function(e,t,r,i,n){var a,o,s,d=this._wnafT1,f=this._wnafT2,c=this._wnafT3,h=0;for(a=0;a<i;a++){var u=(s=t[a])._getNAFPoints(e);d[a]=u.wnd,f[a]=u.points}for(a=i-1;a>=1;a-=2){var l=a-1,b=a;if(1===d[l]&&1===d[b]){var p=[t[l],null,null,t[b]];0===t[l].y.cmp(t[b].y)?(p[1]=t[l].add(t[b]),p[2]=t[l].toJ().mixedAdd(t[b].neg())):0===t[l].y.cmp(t[b].y.redNeg())?(p[1]=t[l].toJ().mixedAdd(t[b]),p[2]=t[l].add(t[b].neg())):(p[1]=t[l].toJ().mixedAdd(t[b]),p[2]=t[l].toJ().mixedAdd(t[b].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Nt(r[l],r[b]);for(h=Math.max(y[0].length,h),c[l]=new Array(h),c[b]=new Array(h),o=0;o<h;o++){var m=0|y[0][o],v=0|y[1][o];c[l][o]=g[3*(m+1)+(v+1)],c[b][o]=0,f[l]=p}}else c[l]=Kt(r[l],d[l],this._bitLength),c[b]=Kt(r[b],d[b],this._bitLength),h=Math.max(c[l].length,h),h=Math.max(c[b].length,h)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(a=h;a>=0;a--){for(var M=0;a>=0;){var A=!0;for(o=0;o<i;o++)_[o]=0|c[o][a],0!==_[o]&&(A=!1);if(!A)break;M++,a--}if(a>=0&&M++,w=w.dblp(M),a<0)break;for(o=0;o<i;o++){var S=_[o];0!==S&&(S>0?s=f[o][S-1>>1]:S<0&&(s=f[o][-S-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(a=0;a<i;a++)f[a]=null;return n?w:w.toP()},Lt.BasePoint=Ut,Ut.prototype.eq=function(){throw new Error("Not implemented")},Ut.prototype.validate=function(){return this.curve.validate(this)},Lt.prototype.decodePoint=function(e,t){e=Ot.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?qt(e[e.length-1]%2==0):7===e[0]&&qt(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},Ut.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Ut.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Ut.prototype.encode=function(e,t){return Ot.encode(this._encode(t),e)},Ut.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Ut.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Ut.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var a=0;a<e;a++)i=i.dbl();r.push(i)}return{step:e,points:r}},Ut.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},Ut.prototype._getBeta=function(){return null},Ut.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var Ft={},Ht={get exports(){return Ft},set exports(e){Ft=e}};"function"==typeof Object.create?Ht.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ht.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var Yt=At,Vt=Ft,Qt=Jt,Wt=Mt.assert;function Gt(e){Qt.call(this,"short",e),this.a=new Yt(e.a,16).toRed(this.red),this.b=new Yt(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Vt(Gt,Qt);var Xt=Gt;function Zt(e,t,r,i){Qt.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Yt(t,16),this.y=new Yt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function $t(e,t,r,i){Qt.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Yt(0)):(this.x=new Yt(t,16),this.y=new Yt(r,16),this.z=new Yt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Gt.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new Yt(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new Yt(e.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(t))?r=n[0]:(r=n[1],Wt(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new Yt(e.a,16),b:new Yt(e.b,16)}})):this._getEndoBasis(r)}}},Gt.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Yt.mont(e),r=new Yt(2).toRed(t).redInvm(),i=r.redNeg(),n=new Yt(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},Gt.prototype._getEndoBasis=function(e){for(var t,r,i,n,a,o,s,d,f,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,u=this.n.clone(),l=new Yt(1),b=new Yt(0),p=new Yt(0),g=new Yt(1),y=0;0!==h.cmpn(0);){var m=u.div(h);d=u.sub(m.mul(h)),f=p.sub(m.mul(l));var v=g.sub(m.mul(b));if(!i&&d.cmp(c)<0)t=s.neg(),r=l,i=d.neg(),n=f;else if(i&&2==++y)break;s=d,u=h,h=d,p=l,l=f,g=b,b=v}a=d.neg(),o=f;var w=i.sqr().add(n.sqr());return a.sqr().add(o.sqr()).cmp(w)>=0&&(a=t,o=r),i.negative&&(i=i.neg(),n=n.neg()),a.negative&&(a=a.neg(),o=o.neg()),[{a:i,b:n},{a:a,b:o}]},Gt.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),d=n.mul(r.b),f=a.mul(i.b);return{k1:e.sub(o).sub(s),k2:d.add(f).neg()}},Gt.prototype.pointFromX=function(e,t){(e=new Yt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(t&&!n||!t&&n)&&(i=i.redNeg()),this.point(e,i)},Gt.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},Gt.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],d=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),d=d.neg(!0)),i[2*a]=s,i[2*a+1]=d,n[2*a]=o.k1,n[2*a+1]=o.k2}for(var f=this._wnafMulAdd(1,i,n,2*a,r),c=0;c<2*a;c++)i[c]=null,n[c]=null;return f},Vt(Zt,Qt.BasePoint),Gt.prototype.point=function(e,t,r){return new Zt(this,e,t,r)},Gt.prototype.pointFromJSON=function(e,t){return Zt.fromJSON(this,e,t)},Zt.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},Zt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Zt.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(n))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(n))}},i},Zt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Zt.prototype.isInfinity=function(){return this.inf},Zt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Zt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},Zt.prototype.getX=function(){return this.x.fromRed()},Zt.prototype.getY=function(){return this.y.fromRed()},Zt.prototype.mul=function(e){return e=new Yt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Zt.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Zt.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Zt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Zt.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},Zt.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Vt($t,Qt.BasePoint),Gt.prototype.jpoint=function(e,t,r){return new $t(this,e,t,r)},$t.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},$t.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$t.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),s=i.redSub(n),d=a.redSub(o);if(0===s.cmpn(0))return 0!==d.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),c=f.redMul(s),h=i.redMul(f),u=d.redSqr().redIAdd(c).redISub(h).redISub(h),l=d.redMul(h.redISub(u)).redISub(a.redMul(c)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(u,l,b)},$t.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=o.redSqr(),f=d.redMul(o),c=r.redMul(d),h=s.redSqr().redIAdd(f).redISub(c).redISub(c),u=s.redMul(c.redISub(h)).redISub(n.redMul(f)),l=this.z.redMul(o);return this.curve.jpoint(h,u,l)},$t.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,a=this.x,o=this.y,s=this.z,d=s.redSqr().redSqr(),f=o.redAdd(o);for(t=0;t<e;t++){var c=a.redSqr(),h=f.redSqr(),u=h.redSqr(),l=c.redAdd(c).redIAdd(c).redIAdd(i.redMul(d)),b=a.redMul(h),p=l.redSqr().redISub(b.redAdd(b)),g=b.redISub(p),y=l.redMul(g);y=y.redIAdd(y).redISub(u);var m=f.redMul(s);t+1<e&&(d=d.redMul(u)),a=p,s=m,f=y}return this.curve.jpoint(a,f.redMul(n),s)},$t.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},$t.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i),d=s.redSqr().redISub(o).redISub(o),f=a.redIAdd(a);f=(f=f.redIAdd(f)).redIAdd(f),e=d,t=s.redMul(o.redISub(d)).redISub(f),r=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),h=this.y.redSqr(),u=h.redSqr(),l=this.x.redAdd(h).redSqr().redISub(c).redISub(u);l=l.redIAdd(l);var b=c.redAdd(c).redIAdd(c),p=b.redSqr(),g=u.redIAdd(u);g=(g=g.redIAdd(g)).redIAdd(g),e=p.redISub(l).redISub(l),t=b.redMul(l.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},$t.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),d=s.redSqr().redISub(o).redISub(o);e=d;var f=a.redIAdd(a);f=(f=f.redIAdd(f)).redIAdd(f),t=s.redMul(o.redISub(d)).redISub(f),r=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),h=this.y.redSqr(),u=this.x.redMul(h),l=this.x.redSub(c).redMul(this.x.redAdd(c));l=l.redAdd(l).redIAdd(l);var b=u.redIAdd(u),p=(b=b.redIAdd(b)).redAdd(b);e=l.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(c);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=l.redMul(b.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},$t.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),a=t.redSqr(),o=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(n)),d=t.redAdd(t),f=(d=d.redIAdd(d)).redMul(o),c=s.redSqr().redISub(f.redAdd(f)),h=f.redISub(c),u=o.redSqr();u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=s.redMul(h).redISub(u),b=r.redAdd(r).redMul(i);return this.curve.jpoint(c,l,b)},$t.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),a=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i),s=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(a)).redSqr(),d=i.redIAdd(i);d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=n.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(d),c=t.redMul(f);c=(c=c.redIAdd(c)).redIAdd(c);var h=this.x.redMul(s).redISub(c);h=(h=h.redIAdd(h)).redIAdd(h);var u=this.y.redMul(f.redMul(d.redISub(f)).redISub(o.redMul(s)));u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=this.z.redAdd(o).redSqr().redISub(r).redISub(s);return this.curve.jpoint(h,u,l)},$t.prototype.mul=function(e,t){return e=new Yt(e,t),this.curve._wnafMul(this,e)},$t.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},$t.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},$t.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},$t.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var er=At,tr=Ft,rr=Jt,ir=Mt;function nr(e){rr.call(this,"mont",e),this.a=new er(e.a,16).toRed(this.red),this.b=new er(e.b,16).toRed(this.red),this.i4=new er(4).toRed(this.red).redInvm(),this.two=new er(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}tr(nr,rr);var ar=nr;function or(e,t,r){rr.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new er(t,16),this.z=new er(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}nr.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},tr(or,rr.BasePoint),nr.prototype.decodePoint=function(e,t){return this.point(ir.toArray(e,t),1)},nr.prototype.point=function(e,t){return new or(this,e,t)},nr.prototype.pointFromJSON=function(e){return or.fromJSON(this,e)},or.prototype.precompute=function(){},or.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},or.fromJSON=function(e,t){return new or(e,t[0],t[1]||e.one)},or.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},or.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},or.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},or.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},or.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),o=n.redMul(i),s=t.z.redMul(a.redAdd(o).redSqr()),d=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,d)},or.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},or.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},or.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},or.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},or.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},or.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var sr=At,dr=Ft,fr=Jt,cr=Mt.assert;function hr(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,fr.call(this,"edwards",e),this.a=new sr(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new sr(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new sr(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),cr(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}dr(hr,fr);var ur=hr;function lr(e,t,r,i,n){fr.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new sr(t,16),this.y=new sr(r,16),this.z=i?new sr(i,16):this.curve.one,this.t=n&&new sr(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}hr.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},hr.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},hr.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},hr.prototype.pointFromX=function(e,t){(e=new sr(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=i.redMul(n.redInvm()),o=a.redSqrt();if(0!==o.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var s=o.fromRed().isOdd();return(t&&!s||!t&&s)&&(o=o.redNeg()),this.point(e,o)},hr.prototype.pointFromY=function(e,t){(e=new sr(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(n.redInvm());if(0===a.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var o=a.redSqrt();if(0!==o.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return o.fromRed().isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},hr.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},dr(lr,fr.BasePoint),hr.prototype.pointFromJSON=function(e){return lr.fromJSON(this,e)},hr.prototype.point=function(e,t,r,i){return new lr(this,e,t,r,i)},lr.fromJSON=function(e,t){return new lr(e,t[0],t[1],t[2])},lr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},lr.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},lr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),o=a.redSub(r),s=i.redSub(t),d=n.redMul(o),f=a.redMul(s),c=n.redMul(s),h=o.redMul(a);return this.curve.point(d,f,h,c)},lr.prototype._projDbl=function(){var e,t,r,i,n,a,o=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var f=(i=this.curve._mulA(s)).redAdd(d);this.zOne?(e=o.redSub(s).redSub(d).redMul(f.redSub(this.curve.two)),t=f.redMul(i.redSub(d)),r=f.redSqr().redSub(f).redSub(f)):(n=this.z.redSqr(),a=f.redSub(n).redISub(n),e=o.redSub(s).redISub(d).redMul(a),t=f.redMul(i.redSub(d)),r=f.redMul(a))}else i=s.redAdd(d),n=this.curve._mulC(this.z).redSqr(),a=i.redSub(n).redSub(n),e=this.curve._mulC(o.redISub(i)).redMul(a),t=this.curve._mulC(i).redMul(s.redISub(d)),r=i.redMul(a);return this.curve.point(e,t,r)},lr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},lr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),o=n.redSub(i),s=n.redAdd(i),d=r.redAdd(t),f=a.redMul(o),c=s.redMul(d),h=a.redMul(d),u=o.redMul(s);return this.curve.point(f,c,u,h)},lr.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(o),d=n.redSub(s),f=n.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),h=i.redMul(d).redMul(c);return this.curve.twisted?(t=i.redMul(f).redMul(o.redSub(this.curve._mulA(a))),r=d.redMul(f)):(t=i.redMul(f).redMul(o.redSub(a)),r=this.curve._mulC(d).redMul(f)),this.curve.point(h,t,r)},lr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},lr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},lr.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},lr.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},lr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},lr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},lr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},lr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},lr.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},lr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},lr.prototype.toP=lr.prototype.normalize,lr.prototype.mixedAdd=lr.prototype.add,function(e){var t=e;t.base=Jt,t.short=Xt,t.mont=ar,t.edwards=ur}(zt);var br={},pr={},gr={},yr=Rt,mr=Ft;function vr(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function wr(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function _r(e){return 1===e.length?"0"+e:e}function Mr(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}gr.inherits=mr,gr.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var a=e.charCodeAt(n);a<128?r[i++]=a:a<2048?(r[i++]=a>>6|192,r[i++]=63&a|128):vr(e,n)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),r[i++]=a>>18|240,r[i++]=a>>12&63|128,r[i++]=a>>6&63|128,r[i++]=63&a|128):(r[i++]=a>>12|224,r[i++]=a>>6&63|128,r[i++]=63&a|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},gr.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=_r(e[r].toString(16));return t},gr.htonl=wr,gr.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=wr(n)),r+=Mr(n.toString(16))}return r},gr.zero2=_r,gr.zero8=Mr,gr.join32=function(e,t,r,i){var n=r-t;yr(n%4==0);for(var a=new Array(n/4),o=0,s=t;o<a.length;o++,s+=4){var d;d="big"===i?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],a[o]=d>>>0}return a},gr.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var a=e[i];"big"===t?(r[n]=a>>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},gr.rotr32=function(e,t){return e>>>t|e<<32-t},gr.rotl32=function(e,t){return e<<t|e>>>32-t},gr.sum32=function(e,t){return e+t>>>0},gr.sum32_3=function(e,t,r){return e+t+r>>>0},gr.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},gr.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},gr.sum64=function(e,t,r,i){var n=e[t],a=i+e[t+1]>>>0,o=(a<i?1:0)+r+n;e[t]=o>>>0,e[t+1]=a},gr.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},gr.sum64_lo=function(e,t,r,i){return t+i>>>0},gr.sum64_4_hi=function(e,t,r,i,n,a,o,s){var d=0,f=t;return d+=(f=f+i>>>0)<t?1:0,d+=(f=f+a>>>0)<a?1:0,e+r+n+o+(d+=(f=f+s>>>0)<s?1:0)>>>0},gr.sum64_4_lo=function(e,t,r,i,n,a,o,s){return t+i+a+s>>>0},gr.sum64_5_hi=function(e,t,r,i,n,a,o,s,d,f){var c=0,h=t;return c+=(h=h+i>>>0)<t?1:0,c+=(h=h+a>>>0)<a?1:0,c+=(h=h+s>>>0)<s?1:0,e+r+n+o+d+(c+=(h=h+f>>>0)<f?1:0)>>>0},gr.sum64_5_lo=function(e,t,r,i,n,a,o,s,d,f){return t+i+a+s+f>>>0},gr.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},gr.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},gr.shr64_hi=function(e,t,r){return e>>>r},gr.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var Ar={},Sr=gr,Ir=Rt;function Rr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Ar.BlockHash=Rr,Rr.prototype.update=function(e,t){if(e=Sr.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=Sr.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},Rr.prototype.digest=function(e){return this.update(this._pad()),Ir(null===this.pending),this._digest(e)},Rr.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a<this.padLength;a++)i[n++]=0;return i};var xr={},Er={},Pr=gr.rotr32;function kr(e,t,r){return e&t^~e&r}function Br(e,t,r){return e&t^e&r^t&r}function Cr(e,t,r){return e^t^r}Er.ft_1=function(e,t,r,i){return 0===e?kr(t,r,i):1===e||3===e?Cr(t,r,i):2===e?Br(t,r,i):void 0},Er.ch32=kr,Er.maj32=Br,Er.p32=Cr,Er.s0_256=function(e){return Pr(e,2)^Pr(e,13)^Pr(e,22)},Er.s1_256=function(e){return Pr(e,6)^Pr(e,11)^Pr(e,25)},Er.g0_256=function(e){return Pr(e,7)^Pr(e,18)^e>>>3},Er.g1_256=function(e){return Pr(e,17)^Pr(e,19)^e>>>10};var jr=gr,Dr=Ar,zr=Er,Tr=jr.rotl32,Or=jr.sum32,Kr=jr.sum32_5,Nr=zr.ft_1,qr=Dr.BlockHash,Lr=[1518500249,1859775393,2400959708,3395469782];function Jr(){if(!(this instanceof Jr))return new Jr;qr.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}jr.inherits(Jr,qr);var Ur=Jr;Jr.blockSize=512,Jr.outSize=160,Jr.hmacStrength=80,Jr.padLength=64,Jr.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=Tr(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],d=this.h[4];for(i=0;i<r.length;i++){var f=~~(i/20),c=Kr(Tr(n,5),Nr(f,a,o,s),d,r[i],Lr[f]);d=s,s=o,o=Tr(a,30),a=n,n=c}this.h[0]=Or(this.h[0],n),this.h[1]=Or(this.h[1],a),this.h[2]=Or(this.h[2],o),this.h[3]=Or(this.h[3],s),this.h[4]=Or(this.h[4],d)},Jr.prototype._digest=function(e){return"hex"===e?jr.toHex32(this.h,"big"):jr.split32(this.h,"big")};var Fr=gr,Hr=Ar,Yr=Er,Vr=Rt,Qr=Fr.sum32,Wr=Fr.sum32_4,Gr=Fr.sum32_5,Xr=Yr.ch32,Zr=Yr.maj32,$r=Yr.s0_256,ei=Yr.s1_256,ti=Yr.g0_256,ri=Yr.g1_256,ii=Hr.BlockHash,ni=[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];function ai(){if(!(this instanceof ai))return new ai;ii.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=ni,this.W=new Array(64)}Fr.inherits(ai,ii);var oi=ai;ai.blockSize=512,ai.outSize=256,ai.hmacStrength=192,ai.padLength=64,ai.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=Wr(ri(r[i-2]),r[i-7],ti(r[i-15]),r[i-16]);var n=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],d=this.h[4],f=this.h[5],c=this.h[6],h=this.h[7];for(Vr(this.k.length===r.length),i=0;i<r.length;i++){var u=Gr(h,ei(d),Xr(d,f,c),this.k[i],r[i]),l=Qr($r(n),Zr(n,a,o));h=c,c=f,f=d,d=Qr(s,u),s=o,o=a,a=n,n=Qr(u,l)}this.h[0]=Qr(this.h[0],n),this.h[1]=Qr(this.h[1],a),this.h[2]=Qr(this.h[2],o),this.h[3]=Qr(this.h[3],s),this.h[4]=Qr(this.h[4],d),this.h[5]=Qr(this.h[5],f),this.h[6]=Qr(this.h[6],c),this.h[7]=Qr(this.h[7],h)},ai.prototype._digest=function(e){return"hex"===e?Fr.toHex32(this.h,"big"):Fr.split32(this.h,"big")};var si=gr,di=oi;function fi(){if(!(this instanceof fi))return new fi;di.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}si.inherits(fi,di);var ci=fi;fi.blockSize=512,fi.outSize=224,fi.hmacStrength=192,fi.padLength=64,fi.prototype._digest=function(e){return"hex"===e?si.toHex32(this.h.slice(0,7),"big"):si.split32(this.h.slice(0,7),"big")};var hi=gr,ui=Ar,li=Rt,bi=hi.rotr64_hi,pi=hi.rotr64_lo,gi=hi.shr64_hi,yi=hi.shr64_lo,mi=hi.sum64,vi=hi.sum64_hi,wi=hi.sum64_lo,_i=hi.sum64_4_hi,Mi=hi.sum64_4_lo,Ai=hi.sum64_5_hi,Si=hi.sum64_5_lo,Ii=ui.BlockHash,Ri=[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];function xi(){if(!(this instanceof xi))return new xi;Ii.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Ri,this.W=new Array(160)}hi.inherits(xi,Ii);var Ei=xi;function Pi(e,t,r,i,n){var a=e&r^~e&n;return a<0&&(a+=4294967296),a}function ki(e,t,r,i,n,a){var o=t&i^~t&a;return o<0&&(o+=4294967296),o}function Bi(e,t,r,i,n){var a=e&r^e&n^r&n;return a<0&&(a+=4294967296),a}function Ci(e,t,r,i,n,a){var o=t&i^t&a^i&a;return o<0&&(o+=4294967296),o}function ji(e,t){var r=bi(e,t,28)^bi(t,e,2)^bi(t,e,7);return r<0&&(r+=4294967296),r}function Di(e,t){var r=pi(e,t,28)^pi(t,e,2)^pi(t,e,7);return r<0&&(r+=4294967296),r}function zi(e,t){var r=bi(e,t,14)^bi(e,t,18)^bi(t,e,9);return r<0&&(r+=4294967296),r}function Ti(e,t){var r=pi(e,t,14)^pi(e,t,18)^pi(t,e,9);return r<0&&(r+=4294967296),r}function Oi(e,t){var r=bi(e,t,1)^bi(e,t,8)^gi(e,t,7);return r<0&&(r+=4294967296),r}function Ki(e,t){var r=pi(e,t,1)^pi(e,t,8)^yi(e,t,7);return r<0&&(r+=4294967296),r}function Ni(e,t){var r=bi(e,t,19)^bi(t,e,29)^gi(e,t,6);return r<0&&(r+=4294967296),r}function qi(e,t){var r=pi(e,t,19)^pi(t,e,29)^yi(e,t,6);return r<0&&(r+=4294967296),r}xi.blockSize=1024,xi.outSize=512,xi.hmacStrength=192,xi.padLength=128,xi.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=Ni(r[i-4],r[i-3]),a=qi(r[i-4],r[i-3]),o=r[i-14],s=r[i-13],d=Oi(r[i-30],r[i-29]),f=Ki(r[i-30],r[i-29]),c=r[i-32],h=r[i-31];r[i]=_i(n,a,o,s,d,f,c,h),r[i+1]=Mi(n,a,o,s,d,f,c,h)}},xi.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],a=this.h[2],o=this.h[3],s=this.h[4],d=this.h[5],f=this.h[6],c=this.h[7],h=this.h[8],u=this.h[9],l=this.h[10],b=this.h[11],p=this.h[12],g=this.h[13],y=this.h[14],m=this.h[15];li(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=m,M=zi(h,u),A=Ti(h,u),S=Pi(h,u,l,b,p),I=ki(h,u,l,b,p,g),R=this.k[v],x=this.k[v+1],E=r[v],P=r[v+1],k=Ai(w,_,M,A,S,I,R,x,E,P),B=Si(w,_,M,A,S,I,R,x,E,P);w=ji(i,n),_=Di(i,n),M=Bi(i,n,a,o,s),A=Ci(i,n,a,o,s,d);var C=vi(w,_,M,A),j=wi(w,_,M,A);y=p,m=g,p=l,g=b,l=h,b=u,h=vi(f,c,k,B),u=wi(c,c,k,B),f=s,c=d,s=a,d=o,a=i,o=n,i=vi(k,B,C,j),n=wi(k,B,C,j)}mi(this.h,0,i,n),mi(this.h,2,a,o),mi(this.h,4,s,d),mi(this.h,6,f,c),mi(this.h,8,h,u),mi(this.h,10,l,b),mi(this.h,12,p,g),mi(this.h,14,y,m)},xi.prototype._digest=function(e){return"hex"===e?hi.toHex32(this.h,"big"):hi.split32(this.h,"big")};var Li=gr,Ji=Ei;function Ui(){if(!(this instanceof Ui))return new Ui;Ji.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Li.inherits(Ui,Ji);var Fi=Ui;Ui.blockSize=1024,Ui.outSize=384,Ui.hmacStrength=192,Ui.padLength=128,Ui.prototype._digest=function(e){return"hex"===e?Li.toHex32(this.h.slice(0,12),"big"):Li.split32(this.h.slice(0,12),"big")},xr.sha1=Ur,xr.sha224=ci,xr.sha256=oi,xr.sha384=Fi,xr.sha512=Ei;var Hi={},Yi=gr,Vi=Ar,Qi=Yi.rotl32,Wi=Yi.sum32,Gi=Yi.sum32_3,Xi=Yi.sum32_4,Zi=Vi.BlockHash;function $i(){if(!(this instanceof $i))return new $i;Zi.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function en(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function tn(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function rn(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Yi.inherits($i,Zi),Hi.ripemd160=$i,$i.blockSize=512,$i.outSize=160,$i.hmacStrength=192,$i.padLength=64,$i.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],a=this.h[3],o=this.h[4],s=r,d=i,f=n,c=a,h=o,u=0;u<80;u++){var l=Wi(Qi(Xi(r,en(u,i,n,a),e[nn[u]+t],tn(u)),on[u]),o);r=o,o=a,a=Qi(n,10),n=i,i=l,l=Wi(Qi(Xi(s,en(79-u,d,f,c),e[an[u]+t],rn(u)),sn[u]),h),s=h,h=c,c=Qi(f,10),f=d,d=l}l=Gi(this.h[1],n,c),this.h[1]=Gi(this.h[2],a,h),this.h[2]=Gi(this.h[3],o,s),this.h[3]=Gi(this.h[4],r,d),this.h[4]=Gi(this.h[0],i,f),this.h[0]=l},$i.prototype._digest=function(e){return"hex"===e?Yi.toHex32(this.h,"little"):Yi.split32(this.h,"little")};var nn=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],an=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],on=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sn=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],dn=gr,fn=Rt;function cn(e,t,r){if(!(this instanceof cn))return new cn(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(dn.toArray(t,r))}var hn,un,ln=cn;cn.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),fn(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},cn.prototype.update=function(e,t){return this.inner.update(e,t),this},cn.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=pr;t.utils=gr,t.common=Ar,t.sha=xr,t.ripemd=Hi,t.hmac=ln,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(),function(e){var t,r=br,i=pr,n=zt,a=Mt.assert;function o(e){"short"===e.type?this.curve=new n.short(e):"edwards"===e.type?this.curve=new n.edwards(e):this.curve=new n.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var i=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:i}),i}})}r.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:i.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:i.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=un?hn:(un=1,hn={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(e){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}();var bn=pr,pn=Et,gn=Rt;function yn(e){if(!(this instanceof yn))return new yn(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=pn.toArray(e.entropy,e.entropyEnc||"hex"),r=pn.toArray(e.nonce,e.nonceEnc||"hex"),i=pn.toArray(e.pers,e.persEnc||"hex");gn(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}var mn=yn;yn.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},yn.prototype._hmac=function(){return new bn.hmac(this.hash,this.K)},yn.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},yn.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=pn.toArray(e,t),r=pn.toArray(r,i),gn(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},yn.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=pn.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<e;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var a=n.slice(0,e);return this._update(r),this._reseed++,pn.encode(a,t)};var vn=At,wn=Mt.assert;function _n(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Mn=_n;_n.fromPublic=function(e,t,r){return t instanceof _n?t:new _n(e,{pub:t,pubEnc:r})},_n.fromPrivate=function(e,t,r){return t instanceof _n?t:new _n(e,{priv:t,privEnc:r})},_n.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},_n.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},_n.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},_n.prototype._importPrivate=function(e,t){this.priv=new vn(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},_n.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?wn(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||wn(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},_n.prototype.derive=function(e){return e.validate()||wn(e.validate(),"public point not validated"),e.mul(this.priv).getX()},_n.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},_n.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},_n.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var An=At,Sn=Mt,In=Sn.assert;function Rn(e,t){if(e instanceof Rn)return e;this._importDER(e,t)||(In(e.r&&e.s,"Signature without r or s"),this.r=new An(e.r,16),this.s=new An(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var xn=Rn;function En(){this.place=0}function Pn(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;if(0===e[t.place])return!1;for(var n=0,a=0,o=t.place;a<i;a++,o++)n<<=8,n|=e[o],n>>>=0;return!(n<=127)&&(t.place=o,n)}function kn(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function Bn(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Rn.prototype._importDER=function(e,t){e=Sn.toArray(e,t);var r=new En;if(48!==e[r.place++])return!1;var i=Pn(e,r);if(!1===i)return!1;if(i+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=Pn(e,r);if(!1===n)return!1;if(0!=(128&e[r.place]))return!1;var a=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=Pn(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;if(0!=(128&e[r.place]))return!1;var s=e.slice(r.place,o+r.place);if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new An(a),this.s=new An(s),this.recoveryParam=null,!0},Rn.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=kn(t),r=kn(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];Bn(i,t.length),(i=i.concat(t)).push(2),Bn(i,r.length);var n=i.concat(r),a=[48];return Bn(a,n.length),a=a.concat(n),Sn.encode(a,e)};var Cn=At,jn=mn,Dn=br,zn=kt,Tn=Mt.assert,On=Mn,Kn=xn;function Nn(e){if(!(this instanceof Nn))return new Nn(e);"string"==typeof e&&(Tn(Object.prototype.hasOwnProperty.call(Dn,e),"Unknown curve "+e),e=Dn[e]),e instanceof Dn.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var qn=Nn;Nn.prototype.keyPair=function(e){return new On(this,e)},Nn.prototype.keyFromPrivate=function(e,t){return On.fromPrivate(this,e,t)},Nn.prototype.keyFromPublic=function(e,t){return On.fromPublic(this,e,t)},Nn.prototype.genKeyPair=function(e){e||(e={});for(var t=new jn({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||zn(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new Cn(2));;){var n=new Cn(t.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Nn.prototype._truncateToN=function(e,t,r){var i;if(Cn.isBN(e)||"number"==typeof e)i=(e=new Cn(e,16)).byteLength();else if("object"==typeof e)i=e.length,e=new Cn(e,16);else{var n=e.toString();i=n.length+1>>>1,e=new Cn(n,16)}"number"!=typeof r&&(r=8*i);var a=r-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Nn.prototype.sign=function(e,t,r,i){if("object"==typeof r&&(i=r,r=null),i||(i={}),"string"!=typeof e&&"number"!=typeof e&&!Cn.isBN(e)){Tn("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),Tn(e.length>>>0===e.length);for(var n=0;n<e.length;n++)Tn((255&e[n])===e[n])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,i.msgBitLength),Tn(!e.isNeg(),"Can not sign a negative message");var a=this.n.byteLength(),o=t.getPrivate().toArray("be",a),s=e.toArray("be",a);Tn(new Cn(s).eq(e),"Can not sign message");for(var d=new jn({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),f=this.n.sub(new Cn(1)),c=0;;c++){var h=i.k?i.k(c):new Cn(d.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var u=this.g.mul(h);if(!u.isInfinity()){var l=u.getX(),b=l.umod(this.n);if(0!==b.cmpn(0)){var p=h.invm(this.n).mul(b.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(u.getY().isOdd()?1:0)|(0!==l.cmp(b)?2:0);return i.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new Kn({r:b,s:p,recoveryParam:g})}}}}}},Nn.prototype.verify=function(e,t,r,i,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var a=(t=new Kn(t,"hex")).r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,d=o.invm(this.n),f=d.mul(e).umod(this.n),c=d.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(f,r.getPublic(),c)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(f,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},Nn.prototype.recoverPubKey=function(e,t,r,i){Tn((3&r)===r,"The recovery param is more than two bits"),t=new Kn(t,i);var n=this.n,a=new Cn(e),o=t.r,s=t.s,d=1&r,f=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");o=f?this.curve.pointFromX(o.add(this.curve.n),d):this.curve.pointFromX(o,d);var c=t.r.invm(n),h=n.sub(a).mul(c).umod(n),u=s.mul(c).umod(n);return this.g.mulAdd(h,o,u)},Nn.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new Kn(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(e,t,n)}catch(e){continue}if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Ln=Mt,Jn=Ln.assert,Un=Ln.parseBytes,Fn=Ln.cachedProperty;function Hn(e,t){this.eddsa=e,this._secret=Un(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Un(t.pub)}Hn.fromPublic=function(e,t){return t instanceof Hn?t:new Hn(e,{pub:t})},Hn.fromSecret=function(e,t){return t instanceof Hn?t:new Hn(e,{secret:t})},Hn.prototype.secret=function(){return this._secret},Fn(Hn,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),Fn(Hn,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),Fn(Hn,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),Fn(Hn,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),Fn(Hn,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),Fn(Hn,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Hn.prototype.sign=function(e){return Jn(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Hn.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Hn.prototype.getSecret=function(e){return Jn(this._secret,"KeyPair is public only"),Ln.encode(this.secret(),e)},Hn.prototype.getPublic=function(e){return Ln.encode(this.pubBytes(),e)};var Yn=Hn,Vn=At,Qn=Mt,Wn=Qn.assert,Gn=Qn.cachedProperty,Xn=Qn.parseBytes;function Zn(e,t){this.eddsa=e,"object"!=typeof t&&(t=Xn(t)),Array.isArray(t)&&(Wn(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Wn(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Vn&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Gn(Zn,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Gn(Zn,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Gn(Zn,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Gn(Zn,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Zn.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Zn.prototype.toHex=function(){return Qn.encode(this.toBytes(),"hex").toUpperCase()};var $n=Zn,ea=pr,ta=br,ra=Mt,ia=ra.assert,na=ra.parseBytes,aa=Yn,oa=$n;function sa(e){if(ia("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof sa))return new sa(e);e=ta[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=ea.sha512}var da=sa;sa.prototype.sign=function(e,t){e=na(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),s=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:a})},sa.prototype.verify=function(e,t,r){if(e=na(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(a)},sa.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return ra.intFromLE(e.digest()).umod(this.curve.n)},sa.prototype.keyFromPublic=function(e){return aa.fromPublic(this,e)},sa.prototype.keyFromSecret=function(e){return aa.fromSecret(this,e)},sa.prototype.makeSignature=function(e){return e instanceof oa?e:new oa(this,e)},sa.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},sa.prototype.decodePoint=function(e){var t=(e=ra.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=ra.intFromLE(r);return this.curve.pointFromY(n,i)},sa.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},sa.prototype.decodeInt=function(e){return ra.intFromLE(e)},sa.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=_t,t.utils=Mt,t.rand=kt,t.curve=zt,t.curves=br,t.ec=qn,t.eddsa=da}(wt);var fa,ca,ha,ua={};
2
2
  /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
3
- fa={get exports(){return ua},set exports(e){ua=e}},function(e){function t(e){return parseInt(e)===e}function r(e){if(!t(e.length))return!1;for(var r=0;r<e.length;r++)if(!t(e[r])||e[r]<0||e[r]>255)return!1;return!0}function i(e,i){if(e.buffer&&"Uint8Array"===e.name)return i&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!r(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&r(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function n(e){return new Uint8Array(e)}function a(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var o,s={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return i(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var i=e[r];i<128?(t.push(String.fromCharCode(i)),r++):i>191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},d=(o="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r];t.push(o[(240&i)>>4]+o[15&i])}return t.join("")}}),f={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],h=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],u=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],l=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],b=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],p=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],m=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],v=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],M=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],S=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function I(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var R=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:i(t,!0)}),this._prepare()};R.prototype._prepare=function(){var e=f[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,i=4*(e+1),n=this.key.length/4,a=I(this.key);for(t=0;t<n;t++)r=t>>2,this._Ke[r][t%4]=a[t],this._Kd[e-r][t%4]=a[t];for(var o,s=0,d=n;d<i;){if(o=a[n-1],a[0]^=h[o>>16&255]<<24^h[o>>8&255]<<16^h[255&o]<<8^h[o>>24&255]^c[s]<<24,s+=1,8!=n)for(t=1;t<n;t++)a[t]^=a[t-1];else{for(t=1;t<n/2;t++)a[t]^=a[t-1];for(o=a[n/2-1],a[n/2]^=h[255&o]^h[o>>8&255]<<8^h[o>>16&255]<<16^h[o>>24&255]<<24,t=n/2+1;t<n;t++)a[t]^=a[t-1]}for(t=0;t<n&&d<i;)u=d>>2,l=d%4,this._Ke[u][l]=a[t],this._Kd[e-u][l]=a[t++],d++}for(var u=1;u<e;u++)for(var l=0;l<4;l++)o=this._Kd[u][l],this._Kd[u][l]=_[o>>24&255]^M[o>>16&255]^A[o>>8&255]^S[255&o]},R.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=I(e),a=0;a<4;a++)i[a]^=this._Ke[0][a];for(var o=1;o<t;o++){for(a=0;a<4;a++)r[a]=l[i[a]>>24&255]^b[i[(a+1)%4]>>16&255]^p[i[(a+2)%4]>>8&255]^g[255&i[(a+3)%4]]^this._Ke[o][a];i=r.slice()}var s,d=n(16);for(a=0;a<4;a++)s=this._Ke[t][a],d[4*a]=255&(h[i[a]>>24&255]^s>>24),d[4*a+1]=255&(h[i[(a+1)%4]>>16&255]^s>>16),d[4*a+2]=255&(h[i[(a+2)%4]>>8&255]^s>>8),d[4*a+3]=255&(h[255&i[(a+3)%4]]^s);return d},R.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=I(e),a=0;a<4;a++)i[a]^=this._Kd[0][a];for(var o=1;o<t;o++){for(a=0;a<4;a++)r[a]=y[i[a]>>24&255]^m[i[(a+3)%4]>>16&255]^v[i[(a+2)%4]>>8&255]^w[255&i[(a+1)%4]]^this._Kd[o][a];i=r.slice()}var s,d=n(16);for(a=0;a<4;a++)s=this._Kd[t][a],d[4*a]=255&(u[i[a]>>24&255]^s>>24),d[4*a+1]=255&(u[i[(a+3)%4]>>16&255]^s>>16),d[4*a+2]=255&(u[i[(a+2)%4]>>8&255]^s>>8),d[4*a+3]=255&(u[255&i[(a+1)%4]]^s);return d};var x=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new R(t)};x.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16)a(e,r,0,o,o+16),a(r=this._aes.encrypt(r),t,o);return t},x.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16)a(e,r,0,o,o+16),a(r=this._aes.decrypt(r),t,o);return t};var E=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=n(16);this._lastCipherblock=i(r,!0),this._aes=new R(t)};E.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16){a(e,r,0,o,o+16);for(var s=0;s<16;s++)r[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(r),a(this._lastCipherblock,t,o)}return t},E.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16){a(e,r,0,o,o+16),r=this._aes.decrypt(r);for(var s=0;s<16;s++)t[o+s]=r[s]^this._lastCipherblock[s];a(e,this._lastCipherblock,0,o,o+16)}return t};var P=function e(t,r,a){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 size)")}else r=n(16);a||(a=1),this.segmentSize=a,this._shiftRegister=i(r,!0),this._aes=new R(t)};P.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[n+o]^=t[o];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},P.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[n+o]^=t[o];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var k=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=n(16);this._lastPrecipher=i(r,!0),this._lastPrecipherIndex=16,this._aes=new R(t)};k.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},k.prototype.decrypt=k.prototype.encrypt;var B=function e(t){if(!(this instanceof e))throw Error("Counter must be instanitated with `new`");0===t||t||(t=1),"number"==typeof t?(this._counter=n(16),this.setValue(t)):this.setBytes(t)};B.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},B.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},B.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var C=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",r instanceof B||(r=new B(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new R(t)};C.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},C.prototype.decrypt=C.prototype.encrypt;var j={AES:R,Counter:B,ModeOfOperation:{ecb:x,cbc:E,cfb:P,ofb:k,ctr:C},utils:{hex:d,utf8:s},padding:{pkcs7:{pad:function(e){var t=16-(e=i(e,!0)).length%16,r=n(e.length+t);a(e,r);for(var o=e.length;o<r.length;o++)r[o]=t;return r},strip:function(e){if((e=i(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,o=0;o<t;o++)if(e[r+o]!==t)throw new Error("PKCS#7 invalid padding byte");var s=n(r);return a(e,s,0,0,r),s}}},_arrayTest:{coerceArray:i,createArray:n,copyArray:a}};fa.exports=j}();class la{getExchangeRequestHeader(){if(!this.kp){const e={entropy:this.generateRandomHexString(192),entropyEnc:"hex"};this.kp=this.ec.genKeyPair(e)}return{type:"key_exchange",scheme:3,y:this.jsArrayToBase64(this.kp.getPublic().encode("array",!1))}}async processExchangeResponseHeader(e){if(e.scheme!=this.scheme)throw"Unsupported crypto scheme "+e.scheme;this.sessionId=e.crypto_session_id;const t=this.kp.derive(this.ec.keyFromPublic(atob(e.y)).getPublic()).toArray("be",32),r=new Uint8Array(t),i=await crypto.subtle.digest("SHA-256",r);this.aesKey=Array.from(new Uint8Array(i))}isReady(){return!(!this.aesKey||!this.sessionId)}decryptResponse(e){let t=null;if(e.headers.forEach((function(e){"encryption"==e.type&&(t=e)})),t){const r=this.base64ToJsArray(t.iv),i=new ua.ModeOfOperation.cbc(this.aesKey,r),n=this.base64ToJsArray(e.data),a=i.decrypt(n);let o=ua.utils.utf8.fromBytes(a);o=this.pkcs7Unpad(o),e.data=JSON.parse(o)}return e}encryptRequest(e){const t=this.generateRandomHexString(32),r=ua.utils.hex.toBytes(t),i={type:"encryption",iv:this.hexToBase64(t),crypto_session_id:this.sessionId},n=e.headers.map((e=>this.encryptStringToBase64(JSON.stringify(e),r))),a=JSON.stringify(e.data),o=this.encryptStringToBase64(a,r);e.headers=[i],e.enc_headers=n,e.data=o}encryptStringToBase64(e,t){const r=new ua.ModeOfOperation.cbc(this.aesKey,t),i=ua.utils.utf8.toBytes(e),n=this.pkcs7Pad(i),a=[...r.encrypt(n)];return this.jsArrayToBase64(a)}toJson(){return{scheme:3,session_id:this.sessionId,key:this.jsArrayToBase64(this.aesKey)}}static fromJson(e){return new la(e)}jsArrayToBase64(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}base64ToJsArray(e){const t=atob(e),r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return r}pkcs7Pad(e){const t=16-e.length%16,r=new Uint8Array(e.length+t);r.set(e,0);for(let i=0;i<t;i++)r[e.length+i]=t;return r}pkcs7Unpad(e){try{const t=e.charCodeAt(e.length-1);if(t<1||t>16)throw new ma(`Invalid padding length: ${t}`);if(e.length<t)throw new ma("Input string shorter than padding length");for(let r=1;r<=t;r++){if(e.charCodeAt(e.length-r)!==t)throw new ma("Invalid padding values")}return e.slice(0,-t)}catch(e){if(e instanceof ma)throw e;throw new ma(`Failed to unpad data: ${e instanceof Error?e.message:String(e)}`)}}constructor(e){if(this.scheme=3,this.ecCurveName="p256",this.ec=new wt.ec(this.ecCurveName),e&&(this.sessionId=e.session_id,this.aesKey=this.base64ToJsArray(e.key),!this.isReady()))throw new Error("Internal: Can't deserialize crypto session")}generateRandomHexString(e){const t=new Uint8Array(e);crypto.getRandomValues(t);let r="";const i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];for(let e=0;e<t.length;e++){r+=i[15&t[e]]}return r}hexToBase64(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let r=0,i=0,n="";for(let a=0;a<e.length;a++)if(r=(r<<4)+parseInt(e[a],16),i+=4,i>=6){n+=t[r>>i-6],i-=6,r&=255>>8-i}if(i){n+=t[r<<6-i]}for(;n.length%4;)n+="=";return n}}class ba{constructor(e,t){this.encrypted=e,this.cryptoSession=t}isReady(){var e;return(null===(e=this.cryptoSession)||void 0===e?void 0:e.isReady())||!1}async exchangeKeyAndEncryptRequest(e,t,r,i,n,a){if(!t.isReady()){const r=["aid","clientId"],n=new URLSearchParams(Array.from(i.searchParams.entries()).filter((e=>{let[t,i]=e;return r.includes(t)})));await t.performKeyExchange(e,n)}return t.promisePossiblyEncryptedTransportRequest(new ya(r,i,n.data,n.headers,a))}async performKeyExchange(e,t){const r={r:"Hello Encrypted World"},i=new URL(e+lt.path+"?"+t.toString()),n=new ya("POST",i,r,[],{"Content-Type":"application/json"}),a=this.promisePossiblyEncryptedTransportRequest(n);let o;const s=await fetch(a.url.toString(),{body:JSON.stringify(null==a?void 0:a.body),method:"POST",headers:a.headers,credentials:"include"});if(!s.ok)throw new Error("Request failed");let d;o=f(f({data:await s.json()},s),{},{headers:s.headers});try{d=o.data}catch(e){throw new Error(`Unsupported resposne format: ${e}`)}await this.postprocessResponse(d),d=this.possiblyDecryptResponse(d);const c=d.data;if(JSON.stringify(c)!==JSON.stringify(r))throw new Error("Key exchange failed");return Promise.resolve()}async postprocessResponse(e){var t;if(e.headers){const r=e.headers.find((e=>"key_exchange"==e.type));if(r)return null===(t=this.cryptoSession)||void 0===t?void 0:t.processExchangeResponseHeader(r)}}promisePossiblyEncryptedTransportRequest(e){const t={headers:e.envelopeHeaders,data:e.body};return this.encryptEnvelopedMessageIfNeeded(t),new pa(e.url.toString(),e.method,t,void 0,e.httpHeaders)}possiblyDecryptResponse(e){return this.cryptoSession&&(e=this.cryptoSession.decryptResponse(e)),e}encryptEnvelopedMessageIfNeeded(e){var t;const r=this.generateKeyExchangeHeaderIfNeeded();(null===(t=this.cryptoSession)||void 0===t?void 0:t.isReady())&&this.cryptoSession.encryptRequest(e),r&&e.headers.push(r)}generateKeyExchangeHeaderIfNeeded(){return this.encrypted&&!this.cryptoSession?(this.cryptoSession=new la,this.cryptoSession.getExchangeRequestHeader()):null}}class pa{constructor(e,t,r,i,n){this.url=e,this.httpMethod=t,this.body=r,this.params=i,this.headers=n}}class ga{addEnvelopeHeader(e){this._envelopeHeaders.push(e)}get method(){return this._requestMethod}get url(){return this._url}get body(){return this._requestBody}get envelopeHeaders(){return this._envelopeHeaders}get httpHeaders(){return this._httpHeaders}constructor(e,t,r,i,n){if(!t||!r)throw new Error("Internal - Invalid arguments for constructing session message");this._requestMethod=e,this._url=t,this._requestBody=r,this._envelopeHeaders=i||[],this._httpHeaders=n}}class ya extends ga{static from(e,t,r,i){return new ya(e,t,r.data,r.headers,i)}}class ma extends Error{constructor(e){super(e),this.name="PaddingError",Object.setPrototypeOf(this,ma.prototype)}}class va{constructor(e){this.urlBaseString=e+"/"+st}convertHttpResponseToRawServiceResponse(e){const{status:t,statusText:r,body:i}=e;return this.rawFrom(t,r,i)}rawFrom(e,t,r){const{error_code:i,error_message:n,headers:a,data:o}=r;return{status:e,statusText:t,error_code:i,error_message:n,headers:a,data:this.buildAggregatedData(o)}}buildAggregatedData(e){switch(null==e?void 0:e.state){case mt.Pending:pt.forEach((t=>{const[[r,i]]=Object.entries(t),n=((e,t,r)=>{if(!e||"object"!=typeof e)return r;const i=Array.isArray(t)?t:t.split(".");let n=e;for(let e=0;e<i.length;e++)if(n=n[i[e]],void 0===n)return r;return n})(e,r);if(n){const t={};i.forEach((e=>{e in n&&(t[e]=n[e])})),e=f(f({},e),t)}}));break;case mt.Rejected:e.type=vt.Rejection}return e}async sendRequest(e,t,r,i){if(!(this.urlBaseString.toString().length>st.length&&e))throw new Error("bad input");const n=new URL(this.urlBaseString);n.pathname+=e,at.debug(`Got Full URL: ${n.toString()}`),Object.keys(t).map((e=>n.searchParams.append(e,t[e]))),at.debug(`Request body: ${r}`);let a=new pa(n.toString(),"POST",r,n.searchParams,{"Content-type":"application/json;charset=UTF-8"});try{i.encrypted&&(a=await i.exchangeKeyAndEncryptRequest(this.urlBaseString,i,a.httpMethod,new URL(a.url),a.body,a.headers));const e=await fetch(a.url.toString(),{body:JSON.stringify(a.body),method:"POST",headers:a.headers,credentials:"include"});let t;const r=await e.json();if(i.encrypted){const e=r;i.postprocessResponse(e),t=i.possiblyDecryptResponse(e)}else t=r;return this.convertHttpResponseToRawServiceResponse(f(f({},e),{},{body:t}))}catch(e){throw new gt("Error occurred while retrieving response from server",tt.NetworkError)}}}!function(e){e.Active="Active",e.Success="Journey Ended with Success",e.Rejected="Journey Ended with Rejection",e.Aborted="Journey aborted by client"}(ca||(ca={})),function(e){e.ClientSdk="Client SDK Journey",e.SSO="SSO Journey"}(ha||(ha={}));class wa extends ba{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;super(i,n),this.journeyType=e,this.sdkData=t,this.additionalParams=r,this.encrypted=i,this.cryptoSession=n,this.state=ca.Active}getQueryParams(){let e={};return this.deviceId&&(e.did=this.deviceId),this.sessionId&&(e.sid=this.sessionId),e}getInternalHeaders(){const e=[];return this.userId&&e.push({type:"uid",uid:this.userId}),e}toJson(){var e;return{journeyType:this.journeyType,challenge:this.challenge,assertionId:this.assertionId,userId:this.userId,sessionId:this.sessionId,deviceId:this.deviceId,actionType:this.actionType,additionalParams:this.additionalParams,sdkData:this.sdkData,encrypted:this.encrypted,cryptoSession:null===(e=this.cryptoSession)||void 0===e?void 0:e.toJson()}}getInvocationData(){const e=bt.data.dummy;return this.additionalParams&&Object.keys(this.additionalParams).length>0&&(e.params=this.additionalParams),this.sdkData&&Object.keys(this.sdkData).length>0&&(e.sdk_data=this.sdkData),e}complete(){if(this.isCompletedState())throw Error(`Cannot complete an already completed journey. Current state: ${this.state.toString()}`);this.challenge=void 0,this.state=ca.Success,this.cryptoSession=void 0}reject(){if(this.isCompletedState())throw Error(`Cannot reject an already completed journey. Current state: ${this.state.toString()}`);this.challenge=void 0,this.state=ca.Rejected,this.cryptoSession=void 0}abort(){if(this.isCompletedState())throw Error(`Cannot abort an already completed journey. Current state: ${this.state.toString()}`);this.challenge=void 0,this.state=ca.Aborted,this.cryptoSession=void 0}active(){if(this.isCompletedState())throw Error(`Cannot run a completed journey. Current state: ${this.state.toString()}`);this.state=ca.Active}isCompletedState(){return this.state===ca.Success||this.state===ca.Rejected||this.state===ca.Aborted}}class _a extends wa{constructor(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0;if(super(ha.ClientSdk,t,r,i,n),this.journeyId=e,!this.journeyId)throw Error("Journey ID must be provided")}getInvocationData(){const e=super.getInvocationData();return e.policy_request_id=this.journeyId,e}getInvocationPath(){return ft.path}toJson(){return f(f({},super.toJson()),{},{journeyId:this.journeyId})}}class Ma extends wa{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;super(ha.SSO,t,{},r,i),this.interactionId=e}getInvocationPath(){return dt.path}getQueryParams(){return f(f({},super.getQueryParams()),{},{ssoInteractionId:this.interactionId})}toJson(){return f(f({},super.toJson()),{},{interactionId:this.interactionId})}}const Aa=["assertion_id","type","escapes","form_id","vendor_name"],Sa=[...Aa,"challenge","assertion_error_code","assertion_error_message","assertions_complete","state","control_flow","rejection_data"],Ia={[rt.Cancel]:rt.Cancel,[rt.Fail]:rt.Fail},Ra=["data"],xa=["json_data"];class Ea{constructor(e){var t,r,i;this.rawResponse=e;const[{escapes:n,form_id:a}]=null!==(r=null===(t=e.data)||void 0===t?void 0:t.control_flow)&&void 0!==r?r:[{}];this.escapes=n,this.data=null!==(i=e.data)&&void 0!==i?i:{},this.formId=a}generateServiceResponse(e,t){var r,i;const n=this.getType(),a=this.getJourneyStepId(e);return f(f({type:n,journeyStepId:a,errorData:this.getErrorData(),data:this.getData(a),clientResponseOptions:this.getClientResponseActions()},t),{},{redirectUrl:null===(i=null===(r=this.data)||void 0===r?void 0:r.data)||void 0===i?void 0:i.url})}getActionType(){return this.data.type}getChallenge(){return this.data.challenge}getAssertionId(){return this.data.assertion_id}getJourneyState(){var e,t,r;let i;if((null===(e=this.rawResponse)||void 0===e?void 0:e.status)>=400)i=yt.TextRejection;else switch(this.data.state){case mt.Completed:i=yt.JourneyEnd;break;case mt.Rejected:i=yt.JsonRejection;break;case mt.Pending:i=(null===(r=null===(t=this.rawResponse)||void 0===t?void 0:t.data)||void 0===r?void 0:r.control_flow)?yt.NextAction:yt.UpdateAction;break;default:i=yt.JsonRejection}return i}getType(){let e=it.JourneyRejection;return this.data.assertions_complete?e=it.JourneySuccess:this.data.state===mt.Pending?e=it.ClientInputRequired:16==this.data.assertion_error_code?e=it.ClientInputUpdateRequired:4001===this.rawResponse.error_code&&(e=it.JourneyRejection),e}getData(e){var t,r;const[i]=null!==(t=this.data.control_flow)&&void 0!==t?t:[{}],n=null!==(r=this.data)&&void 0!==r?r:{},{data:a}=n,o=u(n,Ra),s=null!=a?a:{},{json_data:d}=s,c=u(s,xa);return this.removeFields(i,Aa),this.data=f(f(f(f(f({},o),i),d&&{json_data:d}),Object.keys(c).length&&{data:c}),this.rejectionReason&&{rejectionReason:this.rejectionReason}),this.removeFields(this.data,Sa),this.manipulateDataForJourneyStep(e),this.data}manipulateDataForJourneyStep(e){e===nt.InvokeIDP&&(this.data.authorization_url=this.generateAuthorizationUrlFromResponseData(this.data),delete this.data.authorization_parameters,delete this.data.authorization_endpoint)}generateAuthorizationUrlFromResponseData(e){const{authorization_endpoint:t,authorization_parameters:r}=e,i=Object.keys(r).map((e=>{const t=r[e]instanceof Object?JSON.stringify(r[e]):r[e];return`${e}=${encodeURIComponent(t)}`})).join("&"),n=new URL(t);return n.search=i,n}getErrorData(){if(this.data.assertion_error_code&&0!=this.data.assertion_error_code){const e=gt.convertFromAssertionError(this.data.assertion_error_code);return new gt(this.data.assertion_error_message,e)}}removeFields(e,t){for(const r of t)r in e&&delete e[r]}getJourneyStepId(e){const t=this.getType();if(t===it.JourneyRejection)return this.rejectionReason=this.rawResponse.error_message,nt.Rejection;if(t===it.JourneySuccess)return nt.Success;switch(e){case vt.Form:case vt.LoginForm:return this.formIdToStepId()||this.formId||e;case vt.Information:return nt.Information;case vt.DebugBreak:return nt.DebugBreak;case vt.WaitForTicket:return nt.WaitForAnotherDevice;case vt.Rejection:return nt.Rejection;case vt.DrsTriggerAction:return nt.DrsTriggerAction;case vt.IdentityVerification:return nt.IdentityVerification;case vt.WebAuthnRegistration:return nt.WebAuthnRegistration;default:return e||""}}formIdToStepId(){return this.formId}getClientResponseActions(){var e;const t={[rt.ClientInput]:{type:rt.ClientInput,id:"client_input",label:"Client Input"}};return null===(e=this.escapes)||void 0===e||e.forEach((e=>{let{id:r,display_name:i,schema:n}=e;var a;const o=null!==(a=Ia[r])&&void 0!==a?a:rt.Custom;t[r]=f({type:o,id:r,label:i||r},n&&{schema:n})})),t}}class Pa extends Error{constructor(){super("Missing response data")}}class ka extends Error{constructor(e,t){super("Action of type "+e+" cannot have response from type "+t)}}const Ba=new k("ido","sdkDataDB",1);async function Ca(e){try{return await Ba.get("sdkDataStore",e)}catch(e){console.error("Error retrieving SDK data:",e)}}const ja=new class{constructor(){this.correlationId="",this.getIdentifier=(e,t)=>{var r;const i=null===(r=e.headers.find((e=>t in e)))||void 0===r?void 0:r[t];return at.debug(`Getting identifier ${t} from response, value: ${i}`),i}}async init(e,t){if(!e||!t)throw new gt("Invalid initialization configuration",tt.InvalidInitOptions);const{serverPath:r,logLevel:i,pollingTimeout:n,resource:a,locale:o}=t;if(!r)throw new gt("Invalid initialization options",tt.InvalidInitOptions);at.setLogLevel(null!=i?i:et.Info),this.pollingTimeout=null!=n?n:3,this.clientId=e,a&&(this.resource=a),o&&(this.locale=o),this.serverPath=r,this.api=new va(this.serverPath),at.info("IdoSdk initialized successfully")}async startJourney(e,t){var r,i;const{additionalParams:n,correlationId:a}=null!=t?t:{};this.correlationId=null!=a?a:crypto.randomUUID();const o=await Ca("sdk_data"),s=(null===(r=this.journey)||void 0===r?void 0:r.encrypted)||(null==t?void 0:t.encrypted)||!1,d=(null===(i=this.journey)||void 0===i?void 0:i.isReady())?this.journey.cryptoSession:void 0,f=new _a(e,o,n,s,d);return this.invokeJourney(f)}async startSsoJourney(e,t){var r,i;this.correlationId=e;const n=await Ca("sdk_data"),a=(null===(r=this.journey)||void 0===r?void 0:r.encrypted)||(null==t?void 0:t.encrypted)||!1,o=(null===(i=this.journey)||void 0===i?void 0:i.isReady())?this.journey.cryptoSession:void 0,s=new Ma(e,n,a,o);return this.invokeJourney(s)}async submitClientResponse(e,t){var r,i,n,a,o,s,d;if(!this.journey)throw new gt("Error occurred while trying to submit client response since no journey is active",tt.NoActiveJourney);const f={assertion_id:null===(r=this.journey)||void 0===r?void 0:r.assertionId,action:null===(i=this.journey)||void 0===i?void 0:i.actionType,assert:"action",input:t};if((null==t?void 0:t.fch)||(f.fch=null===(n=this.journey)||void 0===n?void 0:n.challenge),e===rt.ClientInput)switch(null===(a=this.lastServiceResponse)||void 0===a?void 0:a.journeyStepId){case nt.CryptoBindingRegistration:case nt.RegisterDeviceAction:case nt.CryptoBindingValidation:case nt.ValidateDeviceAction:await this.handleCryptoBindingStep(f);break;case nt.WaitForAnotherDevice:return await this.handleWaitForAnotherDeviceAction(f);case nt.DrsTriggerAction:case nt.IdentityVerification:case nt.WebAuthnRegistration:case nt.SmsOTPAuthentication:case nt.EmailOTPAuthentication:case nt.EmailValidation:case nt.SmsValidation:case nt.WebAuthnTransactionSigning:case nt.SelectOrganization:this.handleDataAction(f,t);break;case nt.TotpRegistration:this.handleDataAction(f,{});break;case nt.InvokeIDP:case nt.MobileApproveAuthentication:this.handleDataAction(f,t)}else if(e===rt.Resend)switch(null===(o=this.lastServiceResponse)||void 0===o?void 0:o.journeyStepId){case nt.SmsOTPAuthentication:case nt.EmailOTPAuthentication:case nt.EmailValidation:case nt.SmsValidation:case nt.MobileApproveAuthentication:this.handleResendAssertion(f);break;default:throw new ka(null===(s=this.lastServiceResponse)||void 0===s?void 0:s.journeyStepId,e)}else rt.Cancel,this.handleClientResponseOption(e,t,f);try{let e={headers:await this.getInternalHeaders(),data:f};const t=await(null===(d=this.api)||void 0===d?void 0:d.sendRequest(ct.path,this.getQueryParams(),e,this.journey));if(!t)throw new Pa;return await this.handleServiceResponse(t)}catch(e){throw this.rejectJourney(),e}}handleClientResponseOption(e,t,r){delete r.input,r.assert="escape",r.data={escape_id:e,escape_params:t}}handleResendAssertion(e){delete e.input,delete e.data,e.assert="resend"}async handleCryptoBindingStep(e){const t=$e.crypto.createCryptoBinding("sign"),r=await this.handleCryptoBindingFieldValue(t);this.handleCryptoBindingActionPayload(e,r)}handleCryptoBindingActionPayload(e,t){const r=ot[this.lastServiceResponse.journeyStepId];e[r]=f(f({},e[r]),{},{"ts:idosdk:device":t})}handleDataAction(e,t){delete e.input,e.assert="data",e.data=t}async handleCryptoBindingFieldValue(e){var t,r,i,n,a,o,s,d,f;switch(null===(t=this.lastServiceResponse)||void 0===t?void 0:t.journeyStepId){case nt.CryptoBindingRegistration:case nt.RegisterDeviceAction:const{keyIdentifier:t,publicKey:c}=null!==(r=await e.getPublicData())&&void 0!==r?r:{};return{platform_device_id:t,platform_device_key:c};case nt.CryptoBindingValidation:case nt.ValidateDeviceAction:const{keyIdentifier:h}=null!==(i=await e.getPublicData())&&void 0!==i?i:{};return{platform_device_id:h,signature:await e.sign(null!==(s=null===(o=null===(a=null===(n=this.lastServiceResponse)||void 0===n?void 0:n.data)||void 0===a?void 0:a.app_data)||void 0===o?void 0:o.challenge)&&void 0!==s?s:null===(f=null===(d=this.lastServiceResponse)||void 0===d?void 0:d.data)||void 0===f?void 0:f.device_challenge)}}}async handleWaitForAnotherDeviceAction(e){var t,r,i,n;const a=await this.getInternalHeaders(),o=await(null===(t=this.api)||void 0===t?void 0:t.sendRequest(ht.path,this.getQueryParams(),{headers:a,data:{polling_timeout:this.pollingTimeout,ticket_id:null===(r=this.lastServiceResponse)||void 0===r?void 0:r.data.raw_ticket_id,type:"ticket"}},this.journey));if(!0===(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.change_detected)){const t=await(null===(n=this.api)||void 0===n?void 0:n.sendRequest(ct.path,this.getQueryParams(),{headers:a,data:e},this.journey));if(!t)throw new Pa;return this.handleServiceResponse(t)}return this.lastServiceResponse}async handleServiceResponse(e){var t,r,i,n,a,o;const s=new Ea(e),d=s.getJourneyState();this.handleJourneyState(d),(null===(r=null===(t=e.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.sdk_data)&&(await async function(e,t){try{const r=f(f({},await Ca(e)),t);await Ba.put("sdkDataStore",e,r)}catch(e){console.error("Error saving SDK data:",e)}}("sdk_data",e.data.data.sdk_data),delete e.data.data.sdk_data),this.journey.assertionId=null!==(i=s.getAssertionId())&&void 0!==i?i:this.journey.assertionId,this.journey.actionType=null!==(n=s.getActionType())&&void 0!==n?n:this.journey.actionType,this.journey.challenge=null!==(a=s.getChallenge())&&void 0!==a?a:this.journey.challenge;const{clientResponseOptions:c,data:h}=null!==(o=this.lastServiceResponse)&&void 0!==o?o:{},u=d===yt.UpdateAction?{clientResponseOptions:c,data:h}:{};let l=s.generateServiceResponse(this.journey.actionType,u);switch(this.lastServiceResponse=l,l.journeyStepId){case nt.ValidateDeviceAction:case nt.RegisterDeviceAction:if(d!==yt.NextAction)throw new Error(`Journey rejected on ${l.journeyStepId} device action, with ${l.errorData}`);l=await this.submitClientResponse(rt.ClientInput,l.data);break;default:this.handleJourneySuccess(l)}return l}handleJourneySuccess(e){var t,r;null===(r=null===(t=e.data)||void 0===t?void 0:t.data)||void 0===r||r.url,e.type===it.JourneySuccess&&(e.token=e.data.token,delete e.data.token)}serializeState(){if(!this.lastServiceResponse||!this.journey)throw new gt("Error occurred while trying to serialize state since no journey is active",tt.NoActiveJourney);return btoa(encodeURIComponent(JSON.stringify({journey:this.journey.toJson(),serviceResponse:this.lastServiceResponse})))}restoreFromSerializedState(e){var t;const{journey:r,serviceResponse:i}=JSON.parse(decodeURIComponent(null!==(t=atob(e))&&void 0!==t?t:{}));if(!r||!i)throw new gt("Invalid serialized state",tt.InvalidState);if(this.lastServiceResponse=i,this.journey=function(e){let t,r;switch(e.cryptoSession&&(r=la.fromJson(e.cryptoSession)),e.journeyType){case ha.ClientSdk:t=new _a(e.journeyId,e.sdkData,e.additionalParams,e.encrypted,r);break;case ha.SSO:t=new Ma(e.interactionId,e.sdkData,e.encrypted,r);break;default:throw Error(`error when trying to deserialize Journey Json - unknown journey type ${e.journeyType}`)}return t.challenge=e.challenge,t.assertionId=e.assertionId,t.userId=e.userId,t.sessionId=e.sessionId,t.deviceId=e.deviceId,t.actionType=e.actionType,t}(r),this.journey.encrypted&&!this.journey.isReady())throw new gt("Failed to restore encryption context after redirection",tt.InvalidState);return this.correlationId=r.correlationId,i}async getInternalHeaders(){const e=[];this.journey&&e.push(...this.journey.getInternalHeaders()),this.correlationId&&e.push({type:"correlation_id",correlation_id:this.correlationId});const t=await this.getDeviceHeader();return t&&e.push(t),e}async getDeviceHeader(){var e,t;try{const r=$e.crypto.createCryptoBinding("sign"),{keyIdentifier:i,publicKey:n}=null!==(e=await r.getPublicData())&&void 0!==e?e:{};return i&&n?{type:"device",device:{device_key_id:i,device_public_key:n,device_type:"web",device_os:navigator.platform.toLowerCase(),device_os_version:(null===(t=navigator.userAgent.match(/(?:Version|Edge|Chrome|Firefox|Safari)\/(\d+\.\d+)/))||void 0===t?void 0:t[1])||"unknown",device_manufacturer:navigator.vendor||"unknown",device_model:navigator.platform||"unknown"}}:null}catch(e){return at.error("Failed to create device header"),null}}getQueryParams(){var e,t;const r=f({aid:"default_application",clientId:this.clientId,locale:window.navigator.language||"en-US"},this.journey?this.journey.getQueryParams():{});return(null===(e=this.journey)||void 0===e?void 0:e.deviceId)&&(r.did=this.journey.deviceId),(null===(t=this.journey)||void 0===t?void 0:t.sessionId)&&(r.sid=this.journey.sessionId),this.resource&&(r.resource=this.resource),this.locale&&(r.locale=this.locale),r}async invokeJourney(e){var t,r,i;this.journey=e;const n=await this.getInternalHeaders(),a={data:e.getInvocationData(),headers:n};try{const e=await(null===(r=null===(t=null===window||void 0===window?void 0:window.tsPlatform)||void 0===t?void 0:t.drs)||void 0===r?void 0:r.getSessionToken());e&&a.headers.push(this.buildDrsSessionTokenSdkHeader(e))}catch(e){at.warning(`Could not obtain DRS session token: ${e}`)}try{const t=await(null===(i=this.api)||void 0===i?void 0:i.sendRequest(e.getInvocationPath(),this.getQueryParams(),a,this.journey));if(!t)throw new Pa;return e.userId=this.getIdentifier(t,"uid"),e.sessionId=this.getIdentifier(t,"session_id"),e.deviceId=this.getIdentifier(t,"device_id"),e.active(),this.handleServiceResponse(t)}catch(e){throw this.rejectJourney(),e}}buildDrsSessionTokenSdkHeader(e){return{type:"drs_session_token",drs_session_token:{token:e}}}handleJourneyState(e){switch(e){case yt.TextRejection:case yt.JsonRejection:this.rejectJourney();break;case yt.JourneyEnd:this.completeJourney();break;case yt.NextAction:case yt.UpdateAction:break;default:throw Error(`Unhandled service response state: ${e}`)}}completeJourney(){var e;null===(e=this.journey)||void 0===e||e.complete()}rejectJourney(){var e;null===(e=this.journey)||void 0===e||e.reject()}async generateDebugPin(){var e;if(!this.journey)throw new gt("Error occurred while trying to generate debug pin since no journey is active",tt.NoActiveJourney);const t=await this.getInternalHeaders(),r=await(null===(e=this.api)||void 0===e?void 0:e.sendRequest(ut.path,this.getQueryParams(),{headers:t,data:{}},this.journey));if(!r)throw new Pa;return r.data.debug_pin}};$e.events.on($e.events.MODULE_INITIALIZED,(async()=>{var e;const t=$e.moduleMetadata.getInitConfig();if(!(null===(e=null==t?void 0:t.ido)||void 0===e?void 0:e.serverPath))return;const{clientId:r,ido:i}=t;await ja.init(r,i)}));const za={initialize:o,...Object.freeze({__proto__:null,default:ja})};exports.PACKAGE_VERSION="1.16.2",exports.ido=za,exports.initialize=o;
3
+ fa={get exports(){return ua},set exports(e){ua=e}},function(e){function t(e){return parseInt(e)===e}function r(e){if(!t(e.length))return!1;for(var r=0;r<e.length;r++)if(!t(e[r])||e[r]<0||e[r]>255)return!1;return!0}function i(e,i){if(e.buffer&&"Uint8Array"===e.name)return i&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!r(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&r(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function n(e){return new Uint8Array(e)}function a(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var o,s={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return i(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var i=e[r];i<128?(t.push(String.fromCharCode(i)),r++):i>191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},d=(o="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r];t.push(o[(240&i)>>4]+o[15&i])}return t.join("")}}),f={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],h=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],u=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],l=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],b=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],p=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],m=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],v=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],M=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],S=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function I(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var R=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:i(t,!0)}),this._prepare()};R.prototype._prepare=function(){var e=f[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,i=4*(e+1),n=this.key.length/4,a=I(this.key);for(t=0;t<n;t++)r=t>>2,this._Ke[r][t%4]=a[t],this._Kd[e-r][t%4]=a[t];for(var o,s=0,d=n;d<i;){if(o=a[n-1],a[0]^=h[o>>16&255]<<24^h[o>>8&255]<<16^h[255&o]<<8^h[o>>24&255]^c[s]<<24,s+=1,8!=n)for(t=1;t<n;t++)a[t]^=a[t-1];else{for(t=1;t<n/2;t++)a[t]^=a[t-1];for(o=a[n/2-1],a[n/2]^=h[255&o]^h[o>>8&255]<<8^h[o>>16&255]<<16^h[o>>24&255]<<24,t=n/2+1;t<n;t++)a[t]^=a[t-1]}for(t=0;t<n&&d<i;)u=d>>2,l=d%4,this._Ke[u][l]=a[t],this._Kd[e-u][l]=a[t++],d++}for(var u=1;u<e;u++)for(var l=0;l<4;l++)o=this._Kd[u][l],this._Kd[u][l]=_[o>>24&255]^M[o>>16&255]^A[o>>8&255]^S[255&o]},R.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=I(e),a=0;a<4;a++)i[a]^=this._Ke[0][a];for(var o=1;o<t;o++){for(a=0;a<4;a++)r[a]=l[i[a]>>24&255]^b[i[(a+1)%4]>>16&255]^p[i[(a+2)%4]>>8&255]^g[255&i[(a+3)%4]]^this._Ke[o][a];i=r.slice()}var s,d=n(16);for(a=0;a<4;a++)s=this._Ke[t][a],d[4*a]=255&(h[i[a]>>24&255]^s>>24),d[4*a+1]=255&(h[i[(a+1)%4]>>16&255]^s>>16),d[4*a+2]=255&(h[i[(a+2)%4]>>8&255]^s>>8),d[4*a+3]=255&(h[255&i[(a+3)%4]]^s);return d},R.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=I(e),a=0;a<4;a++)i[a]^=this._Kd[0][a];for(var o=1;o<t;o++){for(a=0;a<4;a++)r[a]=y[i[a]>>24&255]^m[i[(a+3)%4]>>16&255]^v[i[(a+2)%4]>>8&255]^w[255&i[(a+1)%4]]^this._Kd[o][a];i=r.slice()}var s,d=n(16);for(a=0;a<4;a++)s=this._Kd[t][a],d[4*a]=255&(u[i[a]>>24&255]^s>>24),d[4*a+1]=255&(u[i[(a+3)%4]>>16&255]^s>>16),d[4*a+2]=255&(u[i[(a+2)%4]>>8&255]^s>>8),d[4*a+3]=255&(u[255&i[(a+1)%4]]^s);return d};var x=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new R(t)};x.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16)a(e,r,0,o,o+16),a(r=this._aes.encrypt(r),t,o);return t},x.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16)a(e,r,0,o,o+16),a(r=this._aes.decrypt(r),t,o);return t};var E=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=n(16);this._lastCipherblock=i(r,!0),this._aes=new R(t)};E.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16){a(e,r,0,o,o+16);for(var s=0;s<16;s++)r[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(r),a(this._lastCipherblock,t,o)}return t},E.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=n(e.length),r=n(16),o=0;o<e.length;o+=16){a(e,r,0,o,o+16),r=this._aes.decrypt(r);for(var s=0;s<16;s++)t[o+s]=r[s]^this._lastCipherblock[s];a(e,this._lastCipherblock,0,o,o+16)}return t};var P=function e(t,r,a){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 size)")}else r=n(16);a||(a=1),this.segmentSize=a,this._shiftRegister=i(r,!0),this._aes=new R(t)};P.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[n+o]^=t[o];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},P.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[n+o]^=t[o];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var k=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=n(16);this._lastPrecipher=i(r,!0),this._lastPrecipherIndex=16,this._aes=new R(t)};k.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},k.prototype.decrypt=k.prototype.encrypt;var B=function e(t){if(!(this instanceof e))throw Error("Counter must be instanitated with `new`");0===t||t||(t=1),"number"==typeof t?(this._counter=n(16),this.setValue(t)):this.setBytes(t)};B.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},B.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},B.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var C=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",r instanceof B||(r=new B(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new R(t)};C.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},C.prototype.decrypt=C.prototype.encrypt;var j={AES:R,Counter:B,ModeOfOperation:{ecb:x,cbc:E,cfb:P,ofb:k,ctr:C},utils:{hex:d,utf8:s},padding:{pkcs7:{pad:function(e){var t=16-(e=i(e,!0)).length%16,r=n(e.length+t);a(e,r);for(var o=e.length;o<r.length;o++)r[o]=t;return r},strip:function(e){if((e=i(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,o=0;o<t;o++)if(e[r+o]!==t)throw new Error("PKCS#7 invalid padding byte");var s=n(r);return a(e,s,0,0,r),s}}},_arrayTest:{coerceArray:i,createArray:n,copyArray:a}};fa.exports=j}();class la{getExchangeRequestHeader(){if(!this.kp){const e={entropy:this.generateRandomHexString(192),entropyEnc:"hex"};this.kp=this.ec.genKeyPair(e)}return{type:"key_exchange",scheme:3,y:this.jsArrayToBase64(this.kp.getPublic().encode("array",!1))}}async processExchangeResponseHeader(e){if(e.scheme!=this.scheme)throw"Unsupported crypto scheme "+e.scheme;this.sessionId=e.crypto_session_id;const t=this.kp.derive(this.ec.keyFromPublic(atob(e.y)).getPublic()).toArray("be",32),r=new Uint8Array(t),i=await crypto.subtle.digest("SHA-256",r);this.aesKey=Array.from(new Uint8Array(i))}isReady(){return!(!this.aesKey||!this.sessionId)}decryptResponse(e){let t=null;if(e.headers.forEach((function(e){"encryption"==e.type&&(t=e)})),t){const r=this.base64ToJsArray(t.iv),i=new ua.ModeOfOperation.cbc(this.aesKey,r),n=this.base64ToJsArray(e.data),a=i.decrypt(n);let o=ua.utils.utf8.fromBytes(a);o=this.pkcs7Unpad(o),e.data=JSON.parse(o)}return e}encryptRequest(e){const t=this.generateRandomHexString(32),r=ua.utils.hex.toBytes(t),i={type:"encryption",iv:this.hexToBase64(t),crypto_session_id:this.sessionId},n=e.headers.map((e=>this.encryptStringToBase64(JSON.stringify(e),r))),a=JSON.stringify(e.data),o=this.encryptStringToBase64(a,r);e.headers=[i],e.enc_headers=n,e.data=o}encryptStringToBase64(e,t){const r=new ua.ModeOfOperation.cbc(this.aesKey,t),i=ua.utils.utf8.toBytes(e),n=this.pkcs7Pad(i),a=[...r.encrypt(n)];return this.jsArrayToBase64(a)}toJson(){return{scheme:3,session_id:this.sessionId,key:this.jsArrayToBase64(this.aesKey)}}static fromJson(e){return new la(e)}jsArrayToBase64(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}base64ToJsArray(e){const t=atob(e),r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return r}pkcs7Pad(e){const t=16-e.length%16,r=new Uint8Array(e.length+t);r.set(e,0);for(let i=0;i<t;i++)r[e.length+i]=t;return r}pkcs7Unpad(e){try{const t=e.charCodeAt(e.length-1);if(t<1||t>16)throw new ma(`Invalid padding length: ${t}`);if(e.length<t)throw new ma("Input string shorter than padding length");for(let r=1;r<=t;r++){if(e.charCodeAt(e.length-r)!==t)throw new ma("Invalid padding values")}return e.slice(0,-t)}catch(e){if(e instanceof ma)throw e;throw new ma(`Failed to unpad data: ${e instanceof Error?e.message:String(e)}`)}}constructor(e){if(this.scheme=3,this.ecCurveName="p256",this.ec=new wt.ec(this.ecCurveName),e&&(this.sessionId=e.session_id,this.aesKey=this.base64ToJsArray(e.key),!this.isReady()))throw new Error("Internal: Can't deserialize crypto session")}generateRandomHexString(e){const t=new Uint8Array(e);crypto.getRandomValues(t);let r="";const i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];for(let e=0;e<t.length;e++){r+=i[15&t[e]]}return r}hexToBase64(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let r=0,i=0,n="";for(let a=0;a<e.length;a++)if(r=(r<<4)+parseInt(e[a],16),i+=4,i>=6){n+=t[r>>i-6],i-=6,r&=255>>8-i}if(i){n+=t[r<<6-i]}for(;n.length%4;)n+="=";return n}}class ba{constructor(e,t){this.encrypted=e,this.cryptoSession=t}isReady(){var e;return(null===(e=this.cryptoSession)||void 0===e?void 0:e.isReady())||!1}async exchangeKeyAndEncryptRequest(e,t,r,i,n,a){if(!t.isReady()){const r=["aid","clientId"],n=new URLSearchParams(Array.from(i.searchParams.entries()).filter((e=>{let[t,i]=e;return r.includes(t)})));await t.performKeyExchange(e,n)}return t.promisePossiblyEncryptedTransportRequest(new ya(r,i,n.data,n.headers,a))}async performKeyExchange(e,t){const r={r:"Hello Encrypted World"},i=new URL(e+lt.path+"?"+t.toString()),n=new ya("POST",i,r,[],{"Content-Type":"application/json"}),a=this.promisePossiblyEncryptedTransportRequest(n);let o;const s=await fetch(a.url.toString(),{body:JSON.stringify(null==a?void 0:a.body),method:"POST",headers:a.headers,credentials:"include"});if(!s.ok)throw new Error("Request failed");let d;o=f(f({data:await s.json()},s),{},{headers:s.headers});try{d=o.data}catch(e){throw new Error(`Unsupported resposne format: ${e}`)}await this.postprocessResponse(d),d=this.possiblyDecryptResponse(d);const c=d.data;if(JSON.stringify(c)!==JSON.stringify(r))throw new Error("Key exchange failed");return Promise.resolve()}async postprocessResponse(e){var t;if(e.headers){const r=e.headers.find((e=>"key_exchange"==e.type));if(r)return null===(t=this.cryptoSession)||void 0===t?void 0:t.processExchangeResponseHeader(r)}}promisePossiblyEncryptedTransportRequest(e){const t={headers:e.envelopeHeaders,data:e.body};return this.encryptEnvelopedMessageIfNeeded(t),new pa(e.url.toString(),e.method,t,void 0,e.httpHeaders)}possiblyDecryptResponse(e){return this.cryptoSession&&(e=this.cryptoSession.decryptResponse(e)),e}encryptEnvelopedMessageIfNeeded(e){var t;const r=this.generateKeyExchangeHeaderIfNeeded();(null===(t=this.cryptoSession)||void 0===t?void 0:t.isReady())&&this.cryptoSession.encryptRequest(e),r&&e.headers.push(r)}generateKeyExchangeHeaderIfNeeded(){return this.encrypted&&!this.cryptoSession?(this.cryptoSession=new la,this.cryptoSession.getExchangeRequestHeader()):null}}class pa{constructor(e,t,r,i,n){this.url=e,this.httpMethod=t,this.body=r,this.params=i,this.headers=n}}class ga{addEnvelopeHeader(e){this._envelopeHeaders.push(e)}get method(){return this._requestMethod}get url(){return this._url}get body(){return this._requestBody}get envelopeHeaders(){return this._envelopeHeaders}get httpHeaders(){return this._httpHeaders}constructor(e,t,r,i,n){if(!t||!r)throw new Error("Internal - Invalid arguments for constructing session message");this._requestMethod=e,this._url=t,this._requestBody=r,this._envelopeHeaders=i||[],this._httpHeaders=n}}class ya extends ga{static from(e,t,r,i){return new ya(e,t,r.data,r.headers,i)}}class ma extends Error{constructor(e){super(e),this.name="PaddingError",Object.setPrototypeOf(this,ma.prototype)}}class va{constructor(e){this.urlBaseString=e+"/"+st}convertHttpResponseToRawServiceResponse(e){const{status:t,statusText:r,body:i}=e;return this.rawFrom(t,r,i)}rawFrom(e,t,r){const{error_code:i,error_message:n,headers:a,data:o}=r;return{status:e,statusText:t,error_code:i,error_message:n,headers:a,data:this.buildAggregatedData(o)}}buildAggregatedData(e){switch(null==e?void 0:e.state){case mt.Pending:pt.forEach((t=>{const[[r,i]]=Object.entries(t),n=((e,t,r)=>{if(!e||"object"!=typeof e)return r;const i=Array.isArray(t)?t:t.split(".");let n=e;for(let e=0;e<i.length;e++)if(n=n[i[e]],void 0===n)return r;return n})(e,r);if(n){const t={};i.forEach((e=>{e in n&&(t[e]=n[e])})),e=f(f({},e),t)}}));break;case mt.Rejected:e.type=vt.Rejection}return e}async sendRequest(e,t,r,i){if(!(this.urlBaseString.toString().length>st.length&&e))throw new Error("bad input");const n=new URL(this.urlBaseString);n.pathname+=e,at.debug(`Got Full URL: ${n.toString()}`),Object.keys(t).map((e=>n.searchParams.append(e,t[e]))),at.debug(`Request body: ${r}`);let a=new pa(n.toString(),"POST",r,n.searchParams,{"Content-type":"application/json;charset=UTF-8"});try{i.encrypted&&(a=await i.exchangeKeyAndEncryptRequest(this.urlBaseString,i,a.httpMethod,new URL(a.url),a.body,a.headers));const e=await fetch(a.url.toString(),{body:JSON.stringify(a.body),method:"POST",headers:a.headers,credentials:"include"});let t;const r=await e.json();if(i.encrypted){const e=r;i.postprocessResponse(e),t=i.possiblyDecryptResponse(e)}else t=r;return this.convertHttpResponseToRawServiceResponse(f(f({},e),{},{body:t}))}catch(e){throw new gt("Error occurred while retrieving response from server",tt.NetworkError)}}}!function(e){e.Active="Active",e.Success="Journey Ended with Success",e.Rejected="Journey Ended with Rejection",e.Aborted="Journey aborted by client"}(ca||(ca={})),function(e){e.ClientSdk="Client SDK Journey",e.SSO="SSO Journey"}(ha||(ha={}));class wa extends ba{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;super(i,n),this.journeyType=e,this.sdkData=t,this.additionalParams=r,this.encrypted=i,this.cryptoSession=n,this.state=ca.Active}getQueryParams(){let e={};return this.deviceId&&(e.did=this.deviceId),this.sessionId&&(e.sid=this.sessionId),e}getInternalHeaders(){const e=[];return this.userId&&e.push({type:"uid",uid:this.userId}),e}toJson(){var e;return{journeyType:this.journeyType,challenge:this.challenge,assertionId:this.assertionId,userId:this.userId,sessionId:this.sessionId,deviceId:this.deviceId,actionType:this.actionType,additionalParams:this.additionalParams,sdkData:this.sdkData,encrypted:this.encrypted,cryptoSession:null===(e=this.cryptoSession)||void 0===e?void 0:e.toJson()}}getInvocationData(){const e=bt.data.dummy;return this.additionalParams&&Object.keys(this.additionalParams).length>0&&(e.params=this.additionalParams),this.sdkData&&Object.keys(this.sdkData).length>0&&(e.sdk_data=this.sdkData),e}complete(){if(this.isCompletedState())throw Error(`Cannot complete an already completed journey. Current state: ${this.state.toString()}`);this.challenge=void 0,this.state=ca.Success,this.cryptoSession=void 0}reject(){if(this.isCompletedState())throw Error(`Cannot reject an already completed journey. Current state: ${this.state.toString()}`);this.challenge=void 0,this.state=ca.Rejected,this.cryptoSession=void 0}abort(){if(this.isCompletedState())throw Error(`Cannot abort an already completed journey. Current state: ${this.state.toString()}`);this.challenge=void 0,this.state=ca.Aborted,this.cryptoSession=void 0}active(){if(this.isCompletedState())throw Error(`Cannot run a completed journey. Current state: ${this.state.toString()}`);this.state=ca.Active}isCompletedState(){return this.state===ca.Success||this.state===ca.Rejected||this.state===ca.Aborted}}class _a extends wa{constructor(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4?arguments[4]:void 0;if(super(ha.ClientSdk,t,r,i,n),this.journeyId=e,!this.journeyId)throw Error("Journey ID must be provided")}getInvocationData(){const e=super.getInvocationData();return e.policy_request_id=this.journeyId,e}getInvocationPath(){return ft.path}toJson(){return f(f({},super.toJson()),{},{journeyId:this.journeyId})}}class Ma extends wa{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;super(ha.SSO,t,{},r,i),this.interactionId=e}getInvocationPath(){return dt.path}getQueryParams(){return f(f({},super.getQueryParams()),{},{ssoInteractionId:this.interactionId})}toJson(){return f(f({},super.toJson()),{},{interactionId:this.interactionId})}}const Aa=["assertion_id","type","escapes","form_id","vendor_name"],Sa=[...Aa,"challenge","assertion_error_code","assertion_error_message","assertions_complete","state","control_flow","rejection_data"],Ia={[rt.Cancel]:rt.Cancel,[rt.Fail]:rt.Fail},Ra=["data"],xa=["json_data"];class Ea{constructor(e){var t,r,i;this.rawResponse=e;const[{escapes:n,form_id:a}]=null!==(r=null===(t=e.data)||void 0===t?void 0:t.control_flow)&&void 0!==r?r:[{}];this.escapes=n,this.data=null!==(i=e.data)&&void 0!==i?i:{},this.formId=a}generateServiceResponse(e,t){var r,i;const n=this.getType(),a=this.getJourneyStepId(e);return f(f({type:n,journeyStepId:a,errorData:this.getErrorData(),data:this.getData(a),clientResponseOptions:this.getClientResponseActions()},t),{},{redirectUrl:null===(i=null===(r=this.data)||void 0===r?void 0:r.data)||void 0===i?void 0:i.url})}getActionType(){return this.data.type}getChallenge(){return this.data.challenge}getAssertionId(){return this.data.assertion_id}getJourneyState(){var e,t,r;let i;if((null===(e=this.rawResponse)||void 0===e?void 0:e.status)>=400)i=yt.TextRejection;else switch(this.data.state){case mt.Completed:i=yt.JourneyEnd;break;case mt.Rejected:i=yt.JsonRejection;break;case mt.Pending:i=(null===(r=null===(t=this.rawResponse)||void 0===t?void 0:t.data)||void 0===r?void 0:r.control_flow)?yt.NextAction:yt.UpdateAction;break;default:i=yt.JsonRejection}return i}getType(){let e=it.JourneyRejection;return this.data.assertions_complete?e=it.JourneySuccess:this.data.state===mt.Pending?e=it.ClientInputRequired:16==this.data.assertion_error_code?e=it.ClientInputUpdateRequired:4001===this.rawResponse.error_code&&(e=it.JourneyRejection),e}getData(e){var t,r;const[i]=null!==(t=this.data.control_flow)&&void 0!==t?t:[{}],n=null!==(r=this.data)&&void 0!==r?r:{},{data:a}=n,o=u(n,Ra),s=null!=a?a:{},{json_data:d}=s,c=u(s,xa);return this.removeFields(i,Aa),this.data=f(f(f(f(f({},o),i),d&&{json_data:d}),Object.keys(c).length&&{data:c}),this.rejectionReason&&{rejectionReason:this.rejectionReason}),this.removeFields(this.data,Sa),this.manipulateDataForJourneyStep(e),this.data}manipulateDataForJourneyStep(e){e===nt.InvokeIDP&&(this.data.authorization_url=this.generateAuthorizationUrlFromResponseData(this.data),delete this.data.authorization_parameters,delete this.data.authorization_endpoint)}generateAuthorizationUrlFromResponseData(e){const{authorization_endpoint:t,authorization_parameters:r}=e,i=Object.keys(r).map((e=>{const t=r[e]instanceof Object?JSON.stringify(r[e]):r[e];return`${e}=${encodeURIComponent(t)}`})).join("&"),n=new URL(t);return n.search=i,n}getErrorData(){if(this.data.assertion_error_code&&0!=this.data.assertion_error_code){const e=gt.convertFromAssertionError(this.data.assertion_error_code);return new gt(this.data.assertion_error_message,e)}}removeFields(e,t){for(const r of t)r in e&&delete e[r]}getJourneyStepId(e){const t=this.getType();if(t===it.JourneyRejection)return this.rejectionReason=this.rawResponse.error_message,nt.Rejection;if(t===it.JourneySuccess)return nt.Success;switch(e){case vt.Form:case vt.LoginForm:return this.formIdToStepId()||this.formId||e;case vt.Information:return nt.Information;case vt.DebugBreak:return nt.DebugBreak;case vt.WaitForTicket:return nt.WaitForAnotherDevice;case vt.Rejection:return nt.Rejection;case vt.DrsTriggerAction:return nt.DrsTriggerAction;case vt.IdentityVerification:return nt.IdentityVerification;case vt.WebAuthnRegistration:return nt.WebAuthnRegistration;default:return e||""}}formIdToStepId(){return this.formId}getClientResponseActions(){var e;const t={[rt.ClientInput]:{type:rt.ClientInput,id:"client_input",label:"Client Input"}};return null===(e=this.escapes)||void 0===e||e.forEach((e=>{let{id:r,display_name:i,schema:n}=e;var a;const o=null!==(a=Ia[r])&&void 0!==a?a:rt.Custom;t[r]=f({type:o,id:r,label:i||r},n&&{schema:n})})),t}}class Pa extends Error{constructor(){super("Missing response data")}}class ka extends Error{constructor(e,t){super("Action of type "+e+" cannot have response from type "+t)}}const Ba=new k("ido","sdkDataDB",1);async function Ca(e){try{return await Ba.get("sdkDataStore",e)}catch(e){console.error("Error retrieving SDK data:",e)}}const ja=new class{constructor(){this.correlationId="",this.getIdentifier=(e,t)=>{var r;const i=null===(r=e.headers.find((e=>t in e)))||void 0===r?void 0:r[t];return at.debug(`Getting identifier ${t} from response, value: ${i}`),i}}async init(e,t){if(!e||!t)throw new gt("Invalid initialization configuration",tt.InvalidInitOptions);const{serverPath:r,logLevel:i,pollingTimeout:n,resource:a,locale:o}=t;if(!r)throw new gt("Invalid initialization options",tt.InvalidInitOptions);at.setLogLevel(null!=i?i:et.Info),this.pollingTimeout=null!=n?n:3,this.clientId=e,a&&(this.resource=a),o&&(this.locale=o),this.serverPath=r,this.api=new va(this.serverPath),at.info("IdoSdk initialized successfully")}async startJourney(e,t){var r,i;const{additionalParams:n,correlationId:a}=null!=t?t:{};this.correlationId=null!=a?a:crypto.randomUUID();const o=await Ca("sdk_data"),s=(null===(r=this.journey)||void 0===r?void 0:r.encrypted)||(null==t?void 0:t.encrypted)||!1,d=(null===(i=this.journey)||void 0===i?void 0:i.isReady())?this.journey.cryptoSession:void 0,f=new _a(e,o,n,s,d);return this.invokeJourney(f)}async startSsoJourney(e,t){var r,i;this.correlationId=e;const n=await Ca("sdk_data"),a=(null===(r=this.journey)||void 0===r?void 0:r.encrypted)||(null==t?void 0:t.encrypted)||!1,o=(null===(i=this.journey)||void 0===i?void 0:i.isReady())?this.journey.cryptoSession:void 0,s=new Ma(e,n,a,o);return this.invokeJourney(s)}async submitClientResponse(e,t){var r,i,n,a,o,s,d;if(!this.journey)throw new gt("Error occurred while trying to submit client response since no journey is active",tt.NoActiveJourney);const f={assertion_id:null===(r=this.journey)||void 0===r?void 0:r.assertionId,action:null===(i=this.journey)||void 0===i?void 0:i.actionType,assert:"action",input:t};if((null==t?void 0:t.fch)||(f.fch=null===(n=this.journey)||void 0===n?void 0:n.challenge),e===rt.ClientInput)switch(null===(a=this.lastServiceResponse)||void 0===a?void 0:a.journeyStepId){case nt.CryptoBindingRegistration:case nt.RegisterDeviceAction:case nt.CryptoBindingValidation:case nt.ValidateDeviceAction:await this.handleCryptoBindingStep(f);break;case nt.WaitForAnotherDevice:return await this.handleWaitForAnotherDeviceAction(f);case nt.DrsTriggerAction:case nt.IdentityVerification:case nt.WebAuthnRegistration:case nt.SmsOTPAuthentication:case nt.EmailOTPAuthentication:case nt.EmailValidation:case nt.SmsValidation:case nt.WebAuthnTransactionSigning:case nt.SelectOrganization:this.handleDataAction(f,t);break;case nt.TotpRegistration:this.handleDataAction(f,{});break;case nt.InvokeIDP:case nt.MobileApproveAuthentication:this.handleDataAction(f,t)}else if(e===rt.Resend)switch(null===(o=this.lastServiceResponse)||void 0===o?void 0:o.journeyStepId){case nt.SmsOTPAuthentication:case nt.EmailOTPAuthentication:case nt.EmailValidation:case nt.SmsValidation:case nt.MobileApproveAuthentication:this.handleResendAssertion(f);break;default:throw new ka(null===(s=this.lastServiceResponse)||void 0===s?void 0:s.journeyStepId,e)}else rt.Cancel,this.handleClientResponseOption(e,t,f);try{let e={headers:await this.getInternalHeaders(),data:f};const t=await(null===(d=this.api)||void 0===d?void 0:d.sendRequest(ct.path,this.getQueryParams(),e,this.journey));if(!t)throw new Pa;return await this.handleServiceResponse(t)}catch(e){throw this.rejectJourney(),e}}handleClientResponseOption(e,t,r){delete r.input,r.assert="escape",r.data={escape_id:e,escape_params:t}}handleResendAssertion(e){delete e.input,delete e.data,e.assert="resend"}async handleCryptoBindingStep(e){const t=$e.crypto.createCryptoBinding("sign"),r=await this.handleCryptoBindingFieldValue(t);this.handleCryptoBindingActionPayload(e,r)}handleCryptoBindingActionPayload(e,t){const r=ot[this.lastServiceResponse.journeyStepId];e[r]=f(f({},e[r]),{},{"ts:idosdk:device":t})}handleDataAction(e,t){delete e.input,e.assert="data",e.data=t}async handleCryptoBindingFieldValue(e){var t,r,i,n,a,o,s,d,f;switch(null===(t=this.lastServiceResponse)||void 0===t?void 0:t.journeyStepId){case nt.CryptoBindingRegistration:case nt.RegisterDeviceAction:const{keyIdentifier:t,publicKey:c}=null!==(r=await e.getPublicData())&&void 0!==r?r:{};return{platform_device_id:t,platform_device_key:c};case nt.CryptoBindingValidation:case nt.ValidateDeviceAction:const{keyIdentifier:h}=null!==(i=await e.getPublicData())&&void 0!==i?i:{};return{platform_device_id:h,signature:await e.sign(null!==(s=null===(o=null===(a=null===(n=this.lastServiceResponse)||void 0===n?void 0:n.data)||void 0===a?void 0:a.app_data)||void 0===o?void 0:o.challenge)&&void 0!==s?s:null===(f=null===(d=this.lastServiceResponse)||void 0===d?void 0:d.data)||void 0===f?void 0:f.device_challenge)}}}async handleWaitForAnotherDeviceAction(e){var t,r,i,n;const a=await this.getInternalHeaders(),o=await(null===(t=this.api)||void 0===t?void 0:t.sendRequest(ht.path,this.getQueryParams(),{headers:a,data:{polling_timeout:this.pollingTimeout,ticket_id:null===(r=this.lastServiceResponse)||void 0===r?void 0:r.data.raw_ticket_id,type:"ticket"}},this.journey));if(!0===(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.change_detected)){const t=await(null===(n=this.api)||void 0===n?void 0:n.sendRequest(ct.path,this.getQueryParams(),{headers:a,data:e},this.journey));if(!t)throw new Pa;return this.handleServiceResponse(t)}return this.lastServiceResponse}async handleServiceResponse(e){var t,r,i,n,a,o;const s=new Ea(e),d=s.getJourneyState();this.handleJourneyState(d),(null===(r=null===(t=e.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.sdk_data)&&(await async function(e,t){try{const r=f(f({},await Ca(e)),t);await Ba.put("sdkDataStore",e,r)}catch(e){console.error("Error saving SDK data:",e)}}("sdk_data",e.data.data.sdk_data),delete e.data.data.sdk_data),this.journey.assertionId=null!==(i=s.getAssertionId())&&void 0!==i?i:this.journey.assertionId,this.journey.actionType=null!==(n=s.getActionType())&&void 0!==n?n:this.journey.actionType,this.journey.challenge=null!==(a=s.getChallenge())&&void 0!==a?a:this.journey.challenge;const{clientResponseOptions:c,data:h}=null!==(o=this.lastServiceResponse)&&void 0!==o?o:{},u=d===yt.UpdateAction?{clientResponseOptions:c,data:h}:{};let l=s.generateServiceResponse(this.journey.actionType,u);switch(this.lastServiceResponse=l,l.journeyStepId){case nt.ValidateDeviceAction:case nt.RegisterDeviceAction:if(d!==yt.NextAction)throw new Error(`Journey rejected on ${l.journeyStepId} device action, with ${l.errorData}`);l=await this.submitClientResponse(rt.ClientInput,l.data);break;default:this.handleJourneySuccess(l)}return l}handleJourneySuccess(e){var t,r;null===(r=null===(t=e.data)||void 0===t?void 0:t.data)||void 0===r||r.url,e.type===it.JourneySuccess&&(e.token=e.data.token,delete e.data.token)}serializeState(){if(!this.lastServiceResponse||!this.journey)throw new gt("Error occurred while trying to serialize state since no journey is active",tt.NoActiveJourney);return btoa(encodeURIComponent(JSON.stringify({journey:this.journey.toJson(),serviceResponse:this.lastServiceResponse})))}restoreFromSerializedState(e){var t;const{journey:r,serviceResponse:i}=JSON.parse(decodeURIComponent(null!==(t=atob(e))&&void 0!==t?t:{}));if(!r||!i)throw new gt("Invalid serialized state",tt.InvalidState);if(this.lastServiceResponse=i,this.journey=function(e){let t,r;switch(e.cryptoSession&&(r=la.fromJson(e.cryptoSession)),e.journeyType){case ha.ClientSdk:t=new _a(e.journeyId,e.sdkData,e.additionalParams,e.encrypted,r);break;case ha.SSO:t=new Ma(e.interactionId,e.sdkData,e.encrypted,r);break;default:throw Error(`error when trying to deserialize Journey Json - unknown journey type ${e.journeyType}`)}return t.challenge=e.challenge,t.assertionId=e.assertionId,t.userId=e.userId,t.sessionId=e.sessionId,t.deviceId=e.deviceId,t.actionType=e.actionType,t}(r),this.journey.encrypted&&!this.journey.isReady())throw new gt("Failed to restore encryption context after redirection",tt.InvalidState);return this.correlationId=r.correlationId,i}async getInternalHeaders(){const e=[];this.journey&&e.push(...this.journey.getInternalHeaders()),this.correlationId&&e.push({type:"correlation_id",correlation_id:this.correlationId});const t=await this.getDeviceHeader();return t&&e.push(t),e}async getDeviceHeader(){var e,t;try{const r=$e.crypto.createCryptoBinding("sign"),{keyIdentifier:i,publicKey:n}=null!==(e=await r.getPublicData())&&void 0!==e?e:{};return i&&n?{type:"device",device:{device_key_id:i,device_public_key:n,device_type:"web",device_os:navigator.platform.toLowerCase(),device_os_version:(null===(t=navigator.userAgent.match(/(?:Version|Edge|Chrome|Firefox|Safari)\/(\d+\.\d+)/))||void 0===t?void 0:t[1])||"unknown",device_manufacturer:navigator.vendor||"unknown",device_model:navigator.platform||"unknown"}}:null}catch(e){return at.error("Failed to create device header"),null}}getQueryParams(){var e,t;const r=f({aid:"default_application",clientId:this.clientId,locale:window.navigator.language||"en-US"},this.journey?this.journey.getQueryParams():{});return(null===(e=this.journey)||void 0===e?void 0:e.deviceId)&&(r.did=this.journey.deviceId),(null===(t=this.journey)||void 0===t?void 0:t.sessionId)&&(r.sid=this.journey.sessionId),this.resource&&(r.resource=this.resource),this.locale&&(r.locale=this.locale),r}async invokeJourney(e){var t,r,i;this.journey=e;const n=await this.getInternalHeaders(),a={data:e.getInvocationData(),headers:n};try{const e=await(null===(r=null===(t=null===window||void 0===window?void 0:window.tsPlatform)||void 0===t?void 0:t.drs)||void 0===r?void 0:r.getSessionToken());e&&a.headers.push(this.buildDrsSessionTokenSdkHeader(e))}catch(e){at.warning(`Could not obtain DRS session token: ${e}`)}try{const t=await(null===(i=this.api)||void 0===i?void 0:i.sendRequest(e.getInvocationPath(),this.getQueryParams(),a,this.journey));if(!t)throw new Pa;return e.userId=this.getIdentifier(t,"uid"),e.sessionId=this.getIdentifier(t,"session_id"),e.deviceId=this.getIdentifier(t,"device_id"),e.active(),this.handleServiceResponse(t)}catch(e){throw this.rejectJourney(),e}}buildDrsSessionTokenSdkHeader(e){return{type:"drs_session_token",drs_session_token:{token:e}}}handleJourneyState(e){switch(e){case yt.TextRejection:case yt.JsonRejection:this.rejectJourney();break;case yt.JourneyEnd:this.completeJourney();break;case yt.NextAction:case yt.UpdateAction:break;default:throw Error(`Unhandled service response state: ${e}`)}}completeJourney(){var e;null===(e=this.journey)||void 0===e||e.complete()}rejectJourney(){var e;null===(e=this.journey)||void 0===e||e.reject()}async generateDebugPin(){var e;if(!this.journey)throw new gt("Error occurred while trying to generate debug pin since no journey is active",tt.NoActiveJourney);const t=await this.getInternalHeaders(),r=await(null===(e=this.api)||void 0===e?void 0:e.sendRequest(ut.path,this.getQueryParams(),{headers:t,data:{}},this.journey));if(!r)throw new Pa;return r.data.debug_pin}};$e.events.on($e.events.MODULE_INITIALIZED,(async()=>{var e;const t=$e.moduleMetadata.getInitConfig();if(!(null===(e=null==t?void 0:t.ido)||void 0===e?void 0:e.serverPath))return;const{clientId:r,ido:i}=t;await ja.init(r,i)}));const Da={initialize:o,default:ja};exports.PACKAGE_VERSION="1.17.0",exports.default=ja,exports.ido=Da,exports.initialize=o;