@skip-go/widget-web-component 3.5.0 → 3.6.5

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.
@@ -0,0 +1 @@
1
+ export const id=324;export const ids=[324];export const modules={39138:(e,t,r)=>{var n=r(1048).Buffer;t.q1=t.QY=t.x7=void 0;var i=r(10328);t.x7=16;var a=function(e){for(var t=e.length-1;t>=0;t--)if(e[t]++,0!==e[t])return e;return e;},s=function(e,t){for(var r=8*(t+7)/256,s=n.from("00000001","hex"),o=n.from("00","hex"),d=0;d<=r;d++){var c=(0,i.createHash)("sha256");c.update(s),c.update(e),o=n.concat([o,c.digest()]),s=a(s);}return o.slice(1,t+1);};function o(e,r,a){var s=function(e,t,r){var a=(0,i.createCipheriv)("aes-128-ctr",e,t),s=a.update(r),o=a.final();return n.concat([t,s,o]);}(e,(0,i.randomBytes)(t.x7),a),o=(0,i.createHmac)("sha256",r).update(s).digest();return n.concat([s,o]);}function d(e,r,a){var s=a.slice(0,t.x7),o=a.slice(t.x7,a.length-32),d=a.slice(a.length-32,a.length),c=n.concat([s,o]),u=(0,i.createHmac)("sha256",r).update(c).digest();if(!d.equals(u))throw new Error("MAC mismatch");return function(e,t,r){var a=(0,i.createDecipheriv)("aes-128-ctr",e,t),s=a.update(r),o=a.final();return n.concat([s,o]);}(e,s,o);}t.QY=function(e,t){var a=new(0,r(13360).ec)("secp256k1"),d=a.keyFromPrivate((0,i.randomBytes)(32)),c=d.getPublic(!1,"hex"),u=n.from(c,"hex"),l=d.derive(a.keyFromPublic(n.concat([n.from([4]),e])).getPublic()),h=s(l.toArrayLike(n),32),f=o(h.slice(0,16),(0,i.createHash)("sha256").update(h.slice(16)).digest(),t);return n.concat([u,f]);},t.q1=function(e,t){var n=t.slice(0,65),a=t.slice(65),o=new(0,r(13360).ec)("secp256k1"),c=o.keyFromPublic(n).getPublic(),u=o.keyFromPrivate(e).derive(c),l=s(u.toBuffer(),32);return d(l.slice(0,16),(0,i.createHash)("sha256").update(l.slice(16)).digest(),a);};},71324:(e,t,r)=>{r.r(t),r.d(t,{CapsuleProvider:()=>la,LeapCapsuleInfo:()=>ca,OAuthMethod:()=>Kt});var n={};r.r(n),r.d(n,{hasBrowserEnv:()=>ge,hasStandardBrowserEnv:()=>ve,hasStandardBrowserWebWorkerEnv:()=>be,navigator:()=>me,origin:()=>Ee});var i=r(1048);function a(e,t){return function(){return e.apply(t,arguments);};}var s=r(39907);const{toString:o}=Object.prototype,{getPrototypeOf:d}=Object,c=(u=Object.create(null),e=>{const t=o.call(e);return u[t]||(u[t]=t.slice(8,-1).toLowerCase());});var u;const l=e=>(e=e.toLowerCase(),t=>c(t)===e),h=e=>t=>typeof t===e,{isArray:f}=Array,p=h("undefined"),y=l("ArrayBuffer"),g=h("string"),m=h("function"),v=h("number"),b=e=>null!==e&&"object"==typeof e,E=e=>{if("object"!==c(e))return!1;const t=d(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e);},C=l("Date"),S=l("File"),$=l("Blob"),w=l("FileList"),I=l("URLSearchParams"),[T,A,k,B]=["ReadableStream","Request","Response","Headers"].map(l);function R(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),f(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let s;for(n=0;n<a;n++)s=i[n],t.call(null,e[s],s,e);}}function N(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null;}const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,O=e=>!p(e)&&e!==P,U=(_="undefined"!=typeof Uint8Array&&d(Uint8Array),e=>_&&e instanceof _);var _;const L=l("HTMLFormElement"),D=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),x=l("RegExp"),M=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};R(r,((r,i)=>{let a;!1!==(a=t(r,i,e))&&(n[i]=a||r);})),Object.defineProperties(e,n);},K="abcdefghijklmnopqrstuvwxyz",j="0123456789",V={DIGIT:j,ALPHA:K,ALPHA_DIGIT:K+K.toUpperCase()+j},F=l("AsyncFunction"),G=(W="function"==typeof setImmediate,q=m(P.postMessage),W?setImmediate:q?(H=`axios@${Math.random()}`,z=[],P.addEventListener("message",(({source:e,data:t})=>{e===P&&t===H&&z.length&&z.shift()();}),!1),e=>{z.push(e),P.postMessage(H,"*");}):e=>setTimeout(e));var W,q,H,z;const Q="undefined"!=typeof queueMicrotask?queueMicrotask.bind(P):void 0!==s&&s.nextTick||G,Y={isArray:f,isArrayBuffer:y,isBuffer:function(e){return null!==e&&!p(e)&&null!==e.constructor&&!p(e.constructor)&&m(e.constructor.isBuffer)&&e.constructor.isBuffer(e);},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||m(e.append)&&("formdata"===(t=c(e))||"object"===t&&m(e.toString)&&"[object FormData]"===e.toString()));},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&y(e.buffer),t;},isString:g,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:b,isPlainObject:E,isReadableStream:T,isRequest:A,isResponse:k,isHeaders:B,isUndefined:p,isDate:C,isFile:S,isBlob:$,isRegExp:x,isFunction:m,isStream:e=>b(e)&&m(e.pipe),isURLSearchParams:I,isTypedArray:U,isFileList:w,forEach:R,merge:function e(){const{caseless:t}=O(this)&&this||{},r={},n=(n,i)=>{const a=t&&N(r,i)||i;E(r[a])&&E(n)?r[a]=e(r[a],n):E(n)?r[a]=e({},n):f(n)?r[a]=n.slice():r[a]=n;};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&R(arguments[e],n);return r;},extend:(e,t,r,{allOwnKeys:n}={})=>(R(t,((t,n)=>{r&&m(t)?e[n]=a(t,r):e[n]=t;}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r);},toFlatObject:(e,t,r,n)=>{let i,a,s;const o={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)s=i[a],n&&!n(s,e,t)||o[s]||(t[s]=e[s],o[s]=!0);e=!1!==r&&d(e);}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t;},kindOf:c,kindOfTest:l,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r;},toArray:e=>{if(!e)return null;if(f(e))return e;let t=e.length;if(!v(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r;},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1]);}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n;},isHTMLForm:L,hasOwnProperty:D,hasOwnProp:D,reduceDescriptors:M,freezeMethods:e=>{M(e,((t,r)=>{if(m(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];m(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'");}));}));},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0;}));};return f(e)?n(e):n(String(e).split(t)),r;},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r;})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:N,global:P,isContextDefined:O,ALPHABET:V,generateString:(e=16,t=V.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r;},isSpecCompliantForm:function(e){return!!(e&&m(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator]);},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(b(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=f(e)?[]:{};return R(e,((e,t)=>{const a=r(e,n+1);!p(a)&&(i[t]=a);})),t[n]=void 0,i;}}return e;};return r(e,0);},isAsyncFn:F,isThenable:e=>e&&(b(e)||m(e))&&m(e.then)&&m(e.catch),setImmediate:G,asap:Q};function X(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null);}Y.inherits(X,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Y.toJSONObject(this.config),code:this.code,status:this.status};}});const J=X.prototype,Z={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Z[e]={value:e};})),Object.defineProperties(X,Z),Object.defineProperty(J,"isAxiosError",{value:!0}),X.from=(e,t,r,n,i,a)=>{const s=Object.create(J);return Y.toFlatObject(e,s,(function(e){return e!==Error.prototype;}),(e=>"isAxiosError"!==e)),X.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,a&&Object.assign(s,a),s;};const ee=X;var te=r(1048).Buffer;function re(e){return Y.isPlainObject(e)||Y.isArray(e);}function ne(e){return Y.endsWith(e,"[]")?e.slice(0,-2):e;}function ie(e,t,r){return e?e.concat(t).map((function(e,t){return e=ne(e),!r&&t?"["+e+"]":e;})).join(r?".":""):t;}const ae=Y.toFlatObject(Y,{},null,(function(e){return/^is[A-Z]/.test(e);})),se=function(e,t,r){if(!Y.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Y.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Y.isUndefined(t[e]);}))).metaTokens,i=r.visitor||c,a=r.dots,s=r.indexes,o=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Y.isSpecCompliantForm(t);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function d(e){if(null===e)return"";if(Y.isDate(e))return e.toISOString();if(!o&&Y.isBlob(e))throw new ee("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(e)||Y.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):te.from(e):e;}function c(e,r,i){let o=e;if(e&&!i&&"object"==typeof e)if(Y.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Y.isArray(e)&&function(e){return Y.isArray(e)&&!e.some(re);}(e)||(Y.isFileList(e)||Y.endsWith(r,"[]"))&&(o=Y.toArray(e)))return r=ne(r),o.forEach((function(e,n){!Y.isUndefined(e)&&null!==e&&t.append(!0===s?ie([r],n,a):null===s?r:r+"[]",d(e));})),!1;return!!re(e)||(t.append(ie(i,r,a),d(e)),!1);}const u=[],l=Object.assign(ae,{defaultVisitor:c,convertValue:d,isVisitable:re});if(!Y.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Y.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),Y.forEach(r,(function(r,a){!0===(!(Y.isUndefined(r)||null===r)&&i.call(t,r,Y.isString(a)?a.trim():a,n,l))&&e(r,n?n.concat(a):[a]);})),u.pop();}}(e),t;};function oe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e];}));}function de(e,t){this._pairs=[],e&&se(e,this,t);}const ce=de.prototype;ce.append=function(e,t){this._pairs.push([e,t]);},ce.toString=function(e){const t=e?function(t){return e.call(this,t,oe);}:oe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1]);}),"").join("&");};const ue=de;function le(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");}function he(e,t,r){if(!t)return e;const n=r&&r.encode||le,i=r&&r.serialize;let a;if(a=i?i(t,r):Y.isURLSearchParams(t)?t.toString():new ue(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a;}return e;}const fe=class{constructor(){this.handlers=[];}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1;}eject(e){this.handlers[e]&&(this.handlers[e]=null);}clear(){this.handlers&&(this.handlers=[]);}forEach(e){Y.forEach(this.handlers,(function(t){null!==t&&e(t);}));}},pe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ye={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ue,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ge="undefined"!=typeof window&&"undefined"!=typeof document,me="object"==typeof navigator&&navigator||void 0,ve=ge&&(!me||["ReactNative","NativeScript","NS"].indexOf(me.product)<0),be="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ee=ge&&window.location.href||"http://localhost",Ce={...n,...ye},Se=function(e){function t(e,r,n,i){let a=e[i++];if("__proto__"===a)return!0;const s=Number.isFinite(+a),o=i>=e.length;return a=!a&&Y.isArray(n)?n.length:a,o?(Y.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!s):(n[a]&&Y.isObject(n[a])||(n[a]=[]),t(e,r,n[a],i)&&Y.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t;}(n[a])),!s);}if(Y.isFormData(e)&&Y.isFunction(e.entries)){const r={};return Y.forEachEntry(e,((e,n)=>{t(function(e){return Y.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]));}(e),n,r,0);})),r;}return null;},$e={transitional:pe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Y.isObject(e);if(i&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return n?JSON.stringify(Se(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e)||Y.isReadableStream(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return se(e,new Ce.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Ce.isNode&&Y.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments);}},t));}(e,this.formSerializer).toString();if((a=Y.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return se(a?{"files[]":e}:e,t&&new t,this.formSerializer);}}return i||n?(t.setContentType("application/json",!1),function(e){if(Y.isString(e))try{return(0,JSON.parse)(e),Y.trim(e);}catch(e){if("SyntaxError"!==e.name)throw e;}return(0,JSON.stringify)(e);}(e)):e;}],transformResponse:[function(e){const t=this.transitional||$e.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Y.isResponse(e)||Y.isReadableStream(e))return e;if(e&&Y.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e);}catch(e){if(r){if("SyntaxError"===e.name)throw ee.from(e,ee.ERR_BAD_RESPONSE,this,null,this.response);throw e;}}}return e;}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ce.classes.FormData,Blob:Ce.classes.Blob},validateStatus:function(e){return e>=200&&e<300;},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],(e=>{$e.headers[e]={};}));const we=$e,Ie=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Te=Symbol("internals");function Ae(e){return e&&String(e).trim().toLowerCase();}function ke(e){return!1===e||null==e?e:Y.isArray(e)?e.map(ke):String(e);}function Be(e,t,r,n,i){return Y.isFunction(n)?n.call(this,t,r):(i&&(t=r),Y.isString(t)?Y.isString(n)?-1!==t.indexOf(n):Y.isRegExp(n)?n.test(t):void 0:void 0);}class Re{constructor(e){e&&this.set(e);}set(e,t,r){const n=this;function i(e,t,r){const i=Ae(t);if(!i)throw new Error("header name must be a non-empty string");const a=Y.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ke(e));}const a=(e,t)=>Y.forEach(e,((e,r)=>i(e,r,t)));if(Y.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(Y.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&Ie[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n);})),t;})(e),t);else if(Y.isHeaders(e))for(const[t,n]of e.entries())i(n,t,r);else null!=e&&i(t,e,r);return this;}get(e,t){if(e=Ae(e)){const r=Y.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t;}(e);if(Y.isFunction(t))return t.call(this,e,r);if(Y.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function");}}}has(e,t){if(e=Ae(e)){const r=Y.findKey(this,e);return!(!r||void 0===this[r]||t&&!Be(0,this[r],r,t));}return!1;}delete(e,t){const r=this;let n=!1;function i(e){if(e=Ae(e)){const i=Y.findKey(r,e);!i||t&&!Be(0,r[i],i,t)||(delete r[i],n=!0);}}return Y.isArray(e)?e.forEach(i):i(e),n;}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Be(0,this[i],i,e,!0)||(delete this[i],n=!0);}return n;}normalize(e){const t=this,r={};return Y.forEach(this,((n,i)=>{const a=Y.findKey(r,i);if(a)return t[a]=ke(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r));}(i):String(i).trim();s!==i&&delete t[i],t[s]=ke(n),r[s]=!0;})),this;}concat(...e){return this.constructor.concat(this,...e);}toJSON(e){const t=Object.create(null);return Y.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Y.isArray(r)?r.join(", "):r);})),t;}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]();}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n");}get[Symbol.toStringTag](){return"AxiosHeaders";}static from(e){return e instanceof this?e:new this(e);}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r;}static accessor(e){const t=(this[Te]=this[Te]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Ae(e);t[n]||(function(e,t){const r=Y.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i);},configurable:!0});}));}(r,e),t[n]=!0);}return Y.isArray(e)?e.forEach(n):n(e),this;}}Re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Y.reduceDescriptors(Re.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e;}};})),Y.freezeMethods(Re);const Ne=Re;function Pe(e,t){const r=this||we,n=t||r,i=Ne.from(n.headers);let a=n.data;return Y.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0);})),i.normalize(),a;}function Oe(e){return!(!e||!e.__CANCEL__);}function Ue(e,t,r){ee.call(this,null==e?"canceled":e,ee.ERR_CANCELED,t,r),this.name="CanceledError";}Y.inherits(Ue,ee,{__CANCEL__:!0});const _e=Ue;function Le(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ee("Request failed with status code "+r.status,[ee.ERR_BAD_REQUEST,ee.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r);}const De=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,s=0;return t=void 0!==t?t:1e3,function(o){const d=Date.now(),c=n[s];i||(i=d),r[a]=o,n[a]=d;let u=s,l=0;for(;u!==a;)l+=r[u++],u%=e;if(a=(a+1)%e,a===s&&(s=(s+1)%e),d-i<t)return;const h=c&&d-c;return h?Math.round(1e3*l/h):void 0;};}(50,250);return function(e,t){let r,n,i=0,a=1e3/t;const s=(t,a=Date.now())=>{i=a,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t);};return[(...e)=>{const t=Date.now(),o=t-i;o>=a?s(e,t):(r=e,n||(n=setTimeout((()=>{n=null,s(r);}),a-o)));},()=>r&&s(r)];}((r=>{const a=r.loaded,s=r.lengthComputable?r.total:void 0,o=a-n,d=i(o);n=a,e({loaded:a,total:s,progress:s?a/s:void 0,bytes:o,rate:d||void 0,estimated:d&&s&&a<=s?(s-a)/d:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0});}),r);},xe=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]];},Me=e=>(...t)=>Y.asap((()=>e(...t))),Ke=Ce.hasStandardBrowserEnv?function(){const e=Ce.navigator&&/(msie|trident)/i.test(Ce.navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname};}return r=n(window.location.href),function(e){const t=Y.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host;};}():function(){return!0;},je=Ce.hasStandardBrowserEnv?{write(e,t,r,n,i,a){const s=[e+"="+encodeURIComponent(t)];Y.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&s.push("path="+n),Y.isString(i)&&s.push("domain="+i),!0===a&&s.push("secure"),document.cookie=s.join("; ");},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null;},remove(e){this.write(e,"",Date.now()-864e5);}}:{write(){},read:()=>null,remove(){}};function Ve(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e;}(e,t):t;}const Fe=e=>e instanceof Ne?{...e}:e;function Ge(e,t){t=t||{};const r={};function n(e,t,r){return Y.isPlainObject(e)&&Y.isPlainObject(t)?Y.merge.call({caseless:r},e,t):Y.isPlainObject(t)?Y.merge({},t):Y.isArray(t)?t.slice():t;}function i(e,t,r){return Y.isUndefined(t)?Y.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r);}function a(e,t){if(!Y.isUndefined(t))return n(void 0,t);}function s(e,t){return Y.isUndefined(t)?Y.isUndefined(e)?void 0:n(void 0,e):n(void 0,t);}function o(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0;}const d={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(e,t)=>i(Fe(e),Fe(t),!0)};return Y.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=d[n]||i,s=a(e[n],t[n],n);Y.isUndefined(s)&&a!==o||(r[n]=s);})),r;}const We=e=>{const t=Ge({},e);let r,{data:n,withXSRFToken:i,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:d}=t;if(t.headers=o=Ne.from(o),t.url=he(Ve(t.baseURL,t.url),e.params,e.paramsSerializer),d&&o.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),Y.isFormData(n))if(Ce.hasStandardBrowserEnv||Ce.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(r=o.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "));}if(Ce.hasStandardBrowserEnv&&(i&&Y.isFunction(i)&&(i=i(t)),i||!1!==i&&Ke(t.url))){const e=a&&s&&je.read(s);e&&o.set(a,e);}return t;},qe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=We(e);let i=n.data;const a=Ne.from(n.headers).normalize();let s,o,d,c,u,{responseType:l,onUploadProgress:h,onDownloadProgress:f}=n;function p(){c&&c(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s);}let y=new XMLHttpRequest;function g(){if(!y)return;const n=Ne.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());Le((function(e){t(e),p();}),(function(e){r(e),p();}),{data:l&&"text"!==l&&"json"!==l?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:n,config:e,request:y}),y=null;}y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout,"onloadend"in y?y.onloadend=g:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(g);},y.onabort=function(){y&&(r(new ee("Request aborted",ee.ECONNABORTED,e,y)),y=null);},y.onerror=function(){r(new ee("Network Error",ee.ERR_NETWORK,e,y)),y=null;},y.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||pe;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ee(t,i.clarifyTimeoutError?ee.ETIMEDOUT:ee.ECONNABORTED,e,y)),y=null;},void 0===i&&a.setContentType(null),"setRequestHeader"in y&&Y.forEach(a.toJSON(),(function(e,t){y.setRequestHeader(t,e);})),Y.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),l&&"json"!==l&&(y.responseType=n.responseType),f&&([d,u]=De(f,!0),y.addEventListener("progress",d)),h&&y.upload&&([o,c]=De(h),y.upload.addEventListener("progress",o),y.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(s=t=>{y&&(r(!t||t.type?new _e(null,e,y):t),y.abort(),y=null);},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const m=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||"";}(n.url);m&&-1===Ce.protocols.indexOf(m)?r(new ee("Unsupported protocol "+m+":",ee.ERR_BAD_REQUEST,e)):y.send(i||null);}));},He=(e,t)=>{let r,n=new AbortController;const i=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ee?t:new _e(t instanceof Error?t.message:t));}};let a=t&&setTimeout((()=>{i(new ee(`timeout ${t} of ms exceeded`,ee.ETIMEDOUT));}),t);const s=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach((e=>{e&&(e.removeEventListener?e.removeEventListener("abort",i):e.unsubscribe(i));})),e=null);};e.forEach((e=>e&&e.addEventListener&&e.addEventListener("abort",i)));const{signal:o}=n;return o.unsubscribe=s,[o,()=>{a&&clearTimeout(a),a=null;}];},ze=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n;},Qe=(e,t,r,n,i)=>{const a=async function*(e,t,r){for await(const n of e)yield*ze(ArrayBuffer.isView(n)?n:await r(String(n)),t);}(e,t,i);let s,o=0,d=e=>{s||(s=!0,n&&n(e));};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return d(),void e.close();let i=n.byteLength;if(r){let e=o+=i;r(e);}e.enqueue(new Uint8Array(n));}catch(e){throw d(e),e;}},cancel:e=>(d(e),a.return())},{highWaterMark:2});},Ye="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Xe=Ye&&"function"==typeof ReadableStream,Je=Ye&&("function"==typeof TextEncoder?(Ze=new TextEncoder,e=>Ze.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ze;const et=(e,...t)=>{try{return!!e(...t);}catch(e){return!1;}},tt=Xe&&et((()=>{let e=!1;const t=new Request(Ce.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half";}}).headers.has("Content-Type");return e&&!t;})),rt=Xe&&et((()=>Y.isReadableStream(new Response("").body))),nt={stream:rt&&(e=>e.body)};var it;Ye&&(it=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!nt[e]&&(nt[e]=Y.isFunction(it[e])?t=>t[e]():(t,r)=>{throw new ee(`Response type '${e}' is not supported`,ee.ERR_NOT_SUPPORT,r);});})));const at={http:null,xhr:qe,fetch:Ye&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:a,timeout:s,onDownloadProgress:o,onUploadProgress:d,responseType:c,headers:u,withCredentials:l="same-origin",fetchOptions:h}=We(e);c=c?(c+"").toLowerCase():"text";let f,p,[y,g]=i||a||s?He([i,a],s):[];const m=()=>{!f&&setTimeout((()=>{y&&y.unsubscribe();})),f=!0;};let v;try{if(d&&tt&&"get"!==r&&"head"!==r&&0!==(v=await(async(e,t)=>{const r=Y.toFiniteNumber(e.getContentLength());return null==r?(async e=>null==e?0:Y.isBlob(e)?e.size:Y.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:Y.isArrayBufferView(e)||Y.isArrayBuffer(e)?e.byteLength:(Y.isURLSearchParams(e)&&(e+=""),Y.isString(e)?(await Je(e)).byteLength:void 0))(t):r;})(u,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(Y.isFormData(n)&&(e=r.headers.get("content-type"))&&u.setContentType(e),r.body){const[e,t]=xe(v,De(Me(d)));n=Qe(r.body,65536,e,t,Je);}}Y.isString(l)||(l=l?"include":"omit");const i="credentials"in Request.prototype;p=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:n,duplex:"half",credentials:i?l:void 0});let a=await fetch(p);const s=rt&&("stream"===c||"response"===c);if(rt&&(o||s)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=a[t];}));const t=Y.toFiniteNumber(a.headers.get("content-length")),[r,n]=o&&xe(t,De(Me(o),!0))||[];a=new Response(Qe(a.body,65536,r,(()=>{n&&n(),s&&m();}),Je),e);}c=c||"text";let f=await nt[Y.findKey(nt,c)||"text"](a,e);return!s&&m(),g&&g(),await new Promise(((t,r)=>{Le(t,r,{data:f,headers:Ne.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:p});}));}catch(t){if(m(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new ee("Network Error",ee.ERR_NETWORK,e,p),{cause:t.cause||t});throw ee.from(t,t&&t.code,e,p);}})};Y.forEach(at,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t});}catch(e){}Object.defineProperty(e,"adapterName",{value:t});}}));const st=e=>`- ${e}`,ot=e=>Y.isFunction(e)||null===e||!1===e,dt=e=>{e=Y.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let a=0;a<t;a++){let t;if(r=e[a],n=r,!ot(r)&&(n=at[(t=String(r)).toLowerCase()],void 0===n))throw new ee(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+a]=n;}if(!n){const e=Object.entries(i).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let r=t?e.length>1?"since :\n"+e.map(st).join("\n"):" "+st(e[0]):"as no adapter specified";throw new ee("There is no suitable adapter to dispatch the request "+r,"ERR_NOT_SUPPORT");}return n;};function ct(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _e(null,e);}function ut(e){return ct(e),e.headers=Ne.from(e.headers),e.data=Pe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),dt(e.adapter||we.adapter)(e).then((function(t){return ct(e),t.data=Pe.call(e,e.transformResponse,t),t.headers=Ne.from(t.headers),t;}),(function(t){return Oe(t)||(ct(e),t&&t.response&&(t.response.data=Pe.call(e,e.transformResponse,t.response),t.response.headers=Ne.from(t.response.headers))),Promise.reject(t);}));}const lt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{lt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e;};}));const ht={};lt.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.5] Transitional option '"+e+"'"+t+(r?". "+r:"");}return(r,i,a)=>{if(!1===e)throw new ee(n(i," has been removed"+(t?" in "+t:"")),ee.ERR_DEPRECATED);return t&&!ht[i]&&(ht[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a);};};const ft={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ee("options must be an object",ee.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],s=t[a];if(s){const t=e[a],r=void 0===t||s(t,a,e);if(!0!==r)throw new ee("option "+a+" must be "+r,ee.ERR_BAD_OPTION_VALUE);}else if(!0!==r)throw new ee("Unknown option "+a,ee.ERR_BAD_OPTION);}},validators:lt},pt=ft.validators;class yt{constructor(e){this.defaults=e,this.interceptors={request:new fe,response:new fe};}async request(e,t){try{return await this._request(e,t);}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r;}catch(e){}}throw e;}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ge(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&ft.assertOptions(r,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean)},!1),null!=n&&(Y.isFunction(n)?t.paramsSerializer={serialize:n}:ft.assertOptions(n,{encode:pt.function,serialize:pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&Y.merge(i.common,i[t.method]);i&&Y.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e];})),t.headers=Ne.concat(a,i);const s=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,s.unshift(e.fulfilled,e.rejected));}));const d=[];let c;this.interceptors.response.forEach((function(e){d.push(e.fulfilled,e.rejected);}));let u,l=0;if(!o){const e=[ut.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,d),u=e.length,c=Promise.resolve(t);l<u;)c=c.then(e[l++],e[l++]);return c;}u=s.length;let h=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h);}catch(e){t.call(this,e);break;}}try{c=ut.call(this,h);}catch(e){return Promise.reject(e);}for(l=0,u=d.length;l<u;)c=c.then(d[l++],d[l++]);return c;}getUri(e){return he(Ve((e=Ge(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer);}}Y.forEach(["delete","get","head","options"],(function(e){yt.prototype[e]=function(t,r){return this.request(Ge(r||{},{method:e,url:t,data:(r||{}).data}));};})),Y.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Ge(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}));};}yt.prototype[e]=t(),yt.prototype[e+"Form"]=t(!0);}));const gt=yt;class mt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e;}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null;})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e;})).then(e);return n.cancel=function(){r.unsubscribe(t);},n;},e((function(e,n,i){r.reason||(r.reason=new _e(e,n,i),t(r.reason));}));}throwIfRequested(){if(this.reason)throw this.reason;}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e];}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1);}static source(){let e;return{token:new mt((function(t){e=t;})),cancel:e};}}const vt=mt,bt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(bt).forEach((([e,t])=>{bt[t]=e;}));const Et=bt,Ct=function e(t){const r=new gt(t),n=a(gt.prototype.request,r);return Y.extend(n,gt.prototype,r,{allOwnKeys:!0}),Y.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Ge(t,r));},n;}(we);Ct.Axios=gt,Ct.CanceledError=_e,Ct.CancelToken=vt,Ct.isCancel=Oe,Ct.VERSION="1.7.5",Ct.toFormData=se,Ct.AxiosError=ee,Ct.Cancel=Ct.CanceledError,Ct.all=function(e){return Promise.all(e);},Ct.spread=function(e){return function(t){return e.apply(null,t);};},Ct.isAxiosError=function(e){return Y.isObject(e)&&!0===e.isAxiosError;},Ct.mergeConfig=Ge,Ct.AxiosHeaders=Ne,Ct.formToJSON=e=>Se(Y.isHTMLForm(e)?new FormData(e):e),Ct.getAdapter=dt,Ct.HttpStatusCode=Et,Ct.default=Ct;const St=Ct;var $t,wt,It,Tt,At,kt,Bt=r(45810),Rt=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));},Nt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);}return r;};!function(e){e.LIGHT="light",e.DARK="dark";}($t||($t={})),function(e){e.PENDING="PENDING",e.COMPLETE="COMPLETE";}(wt||(wt={})),function(e){e.MOBILE="MOBILE",e.WEB="WEB";}(It||(It={})),function(e){e.DKLS="DKLS",e.CGGMP="CGGMP",e.ED25519="ED25519";}(Tt||(Tt={})),function(e){e.ETH="ETH",e.CELO="CELO",e.MATIC="MATIC";}(At||(At={})),function(e){e.USER="USER",e.RECOVERY="RECOVERY",e.BIOMETRICS="BIOMETRICS";}(kt||(kt={}));const Pt="USER";var Ot,Ut,_t,Lt,Dt;!function(e){e.ETHEREUM="ETHEREUM",e.ARBITRUM="ARBITRUM",e.BASE="BASE",e.OPTIMISM="OPTIMISM",e.POLYGON="POLYGON";}(Ot||(Ot={})),(Dt=Ut||(Ut={})).RAMP="RAMP",Dt.STRIPE="STRIPE",function(e){e.ETHEREUM="ETHEREUM",e.USDC="USDC",e.POLYGON="POLYGON";}(_t||(_t={})),function(e){e.INITIATED="INITIATED",e.FINISHED="FINISHED",e.CANCELLED="CANCELLED";}(Lt||(Lt={}));const xt="x-capsule-sid";var Mt,Kt;"undefined"!=typeof global?global.Buffer=global.Buffer||i.Buffer:"undefined"!=typeof window?(window.Buffer=window.Buffer||i.Buffer,window.global=window.global||window):(self.Buffer=self.Buffer||i.Buffer,self.global=self.global||self),function(e){e.DEV="DEV",e.SANDBOX="SANDBOX",e.BETA="BETA",e.PROD="PROD",e.DEVELOPMENT="BETA",e.PRODUCTION="PROD";}(Mt||(Mt={})),function(e){e.GOOGLE="GOOGLE",e.TWITTER="TWITTER",e.APPLE="APPLE",e.DISCORD="DISCORD",e.FACEBOOK="FACEBOOK",e.FARCASTER="FARCASTER";}(Kt||(Kt={}));const jt={ethereum:Ot.ETHEREUM,ETHEREUM:Ot.ETHEREUM,arbitrum:Ot.ARBITRUM,ARBITRUM:Ot.ARBITRUM,base:Ot.BASE,BASE:Ot.BASE,optimism:Ot.OPTIMISM,OPTIMISM:Ot.OPTIMISM,POLYGON:Ot.POLYGON,polygon:Ot.POLYGON},Vt=(Ot.ETHEREUM,_t.ETHEREUM,Ut.RAMP,Ut.STRIPE,_t.USDC,Ut.RAMP,Ut.STRIPE,Ot.ARBITRUM,_t.ETHEREUM,Ut.RAMP,_t.USDC,Ut.RAMP,Ot.BASE,_t.ETHEREUM,Ut.RAMP,_t.USDC,Ut.RAMP,Ot.OPTIMISM,_t.ETHEREUM,Ut.RAMP,_t.USDC,Ut.RAMP,Ot.POLYGON,_t.POLYGON,Ut.RAMP,Ut.STRIPE,_t.USDC,Ut.RAMP,Ut.STRIPE,{STRIPE:Ut.STRIPE,stripe:Ut.STRIPE,RAMP:Ut.RAMP,ramp:Ut.RAMP}),Ft={eth:_t.ETHEREUM,ETH:_t.ETHEREUM,ethereum:_t.ETHEREUM,ETHEREUM:_t.ETHEREUM,usdc:_t.USDC,USDC:_t.USDC,polygon:_t.POLYGON,POLYGON:_t.POLYGON,matic:_t.POLYGON,MATIC:_t.POLYGON};var Gt;function Wt({env:e},t){const r=function(e){switch(e){case Mt.DEV:return"localhost";case Mt.SANDBOX:return"app.sandbox.usecapsule.com";case Mt.BETA:return"app.beta.usecapsule.com";case Mt.PROD:return"app.usecapsule.com";default:throw new Error(`env: ${e} not supported`);}}(e);return e===Mt.DEV?t?"http://127.0.0.1:3003":`http://${r}:3003`:`https://${r}`;}Ut.RAMP,Ot.ETHEREUM,Ot.ARBITRUM,Ot.BASE,Ot.OPTIMISM,Ot.POLYGON,Ut.STRIPE,Ot.ETHEREUM,Ot.POLYGON,Ut.RAMP,_t.ETHEREUM,_t.USDC,_t.POLYGON,Ut.STRIPE,_t.ETHEREUM,_t.USDC,_t.POLYGON,function(e){e.ACH="ACH",e.DEBIT="Debit",e.CREDIT="Credit",e.APPLE_PAY="Apple Pay";}(Gt||(Gt={}));var qt=r(61828),Ht=(r(97702),r(1048).Buffer);const zt=qt.pki.rsa,Qt="RSA-OAEP",Yt="794241bc819a125a7b78ea313decc0bc";function Xt(e){const t=qt.pki.publicKeyToRSAPublicKeyPem(e.publicKey);return Ht.from(t,"utf-8").toString("hex");}function Jt(e,t){return r=this,n=void 0,a=function*(){const r=qt.random.createInstance();t&&(r.seedFileSync=e=>t,r.seedFile=(e,r)=>{r(null,t);});const n={bits:2048,e:65537,prng:r};if(!e.disableWorkers){n.workLoad=100,n.workers=t?1:-1;const r=yield fetch(`${Wt(e)}/static/js/prime.worker.min.js`),i=new Blob([yield r.text()],{type:"application/javascript"});n.workerScript=URL.createObjectURL(i);}return new Promise(((e,t)=>zt.generateKeyPair(n,((r,n)=>{r&&t(r),e(n);}))));},new((i=void 0)||(i=Promise))((function(e,t){function s(e){try{d(a.next(e));}catch(e){t(e);}}function o(e){try{d(a.throw(e));}catch(e){t(e);}}function d(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r);}))).then(s,o);}d((a=a.apply(r,n||[])).next());}));var r,n,i,a;}function Zt(e,t,r){const n=Ht.from(r,"hex").toString("utf-8");return function(e,t){const r=qt.cipher.createDecipher("AES-CBC",e);return r.start({iv:Yt}),r.update(qt.util.createBuffer(qt.util.hexToBytes(t))),r.finish(),r.output.toString();}(e.decrypt(n,Qt),t);}new Uint8Array([23,66,157,146,179,158,117,120,184,73,123,81]);const er=class{constructor({userManagementHost:e,apiKey:t,opts:r,retrieveSessionCookie:n,persistSessionCookie:i}){this.createUser=e=>Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.post("/users",e)).data;})),this.checkUserExists=(e,t,r)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/exists?email=${encodeURIComponent(e)}&phone=${encodeURIComponent(t)}&countryCode=${encodeURIComponent(r)}`);})),this.verifyEmail=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/verify-email`,t);})),this.verifyPhone=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/verify-identifier`,t);})),this.addSessionPublicKey=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/biometrics/key`,t);})),this.getSessionPublicKeys=e=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/biometrics/keys`);})),this.getSessionPublicKey=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/biometrics/${t}`);})),this.patchSessionPublicKey=(e,t,r,n)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.patch(`/users/${t}/biometrics/${r}`,n,{headers:{"X-Partner-ID":e}});})),this.getWebChallenge=(e,t,r,n,i)=>Rt(this,void 0,void 0,(function*(){const a={};e&&(a.email=e),t&&(a.phone=t),r&&(a.countryCode=r),n&&(a.farcasterUsername=n),i&&(a.publicKey=i);const s=Bt.stringify(a);return(yield this.baseRequest.get("/biometrics/challenge"+(""===s?"":`?${s}`))).data;})),this.touchSession=e=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/touch?regenerate=${!!e}`);})),this.verifyWebChallenge=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post("/biometrics/verify",t,{headers:{"X-Partner-ID":e}});})),this.getSessionChallenge=e=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/biometrics/challenge`);})),this.verifySessionChallenge=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/biometrics/verify`,t);})),this.createWallet=(e,t)=>Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.post(`/users/${e}/wallets`,t)).data;})),this.createPregenWallet=e=>Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.post("/wallets/pregen",e)).data;})),this.getPregenWallets=(e,t)=>Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.get(`/wallets/pregen?pregenIdentifier=${encodeURIComponent(e)}&pregenIdentifierType=${encodeURIComponent(t)}`)).data;})),this.claimPregenWallet=e=>Rt(this,void 0,void 0,(function*(){yield this.baseRequest.post("/wallets/pregen/claim",e);})),this.sendTransaction=(e,t,r)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/wallets/${t}/transactions/send`,r);})),this.signTransaction=(e,t,r)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/wallets/${t}/transactions/sign`,r);})),this.refreshKeys=(e,t)=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/wallets/${t}/refresh`);})),this.updatePregenWallet=(e,t)=>Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.patch(`wallets/pregen/${e}`,t)).data;})),this.getWallets=e=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/wallets`);})),this.login=e=>Rt(this,void 0,void 0,(function*(){const t=e;return yield this.baseRequest.post("/login",t);})),this.verifyLogin=e=>Rt(this,void 0,void 0,(function*(){const t={verificationCode:e};return yield this.baseRequest.post("/login/verify-email",t);})),this.logout=()=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get("/logout");})),this.recoveryVerification=(e,t)=>Rt(this,void 0,void 0,(function*(){const r={email:e,verificationCode:t};return yield this.baseRequest.post("/recovery/verification",r);})),this.recoveryInit=e=>Rt(this,void 0,void 0,(function*(){const t={email:e};return yield this.baseRequest.post("/recovery",t);})),this.preSignMessage=(e,t,r,n)=>Rt(this,void 0,void 0,(function*(){const i={message:r,scheme:n};return(yield this.baseRequest.post(`/users/${e}/wallets/${t}/messages/sign`,i)).data;})),this.deleteSelf=e=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.delete(`/users/${e}`);})),this.getCapsuleShare=(e,t)=>Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.get(`/users/${e}/wallets/${t}/capsule-share`)).data.share;})),this.getBackupKit=e=>Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/download-backup-kit/${e}`,{responseType:"blob"});}));const a={baseURL:e,withCredentials:!0,headers:t?{"X-External-API-Key":t}:void 0};if(n){const e=Array.isArray(St.defaults.transformRequest)?St.defaults.transformRequest:[St.defaults.transformRequest];a.transformRequest=[function(e,t){const r=n();return r&&(t[xt]=r),e;},...e];}if(i){const e=Array.isArray(St.defaults.transformResponse)?St.defaults.transformResponse:[St.defaults.transformResponse];a.transformResponse=[...e,function(e,t,r){return(null==t?void 0:t[xt])&&i(t[xt]),e;}];}this.baseRequest=St.create(a),(null==r?void 0:r.useFetchAdapter)&&(St.defaults.adapter=function(e){return fetch(e.baseURL+e.url.substring(1),{method:e.method,headers:e.headers,body:e.data,credentials:e.withCredentials?"include":void 0}).then((t=>t.text().then((r=>({data:r,status:t.status,statusText:t.statusText,headers:t.headers,config:e,request:fetch}))))).catch((function(e){throw e;}));});}uploadKeyshares(e,t,r){return Rt(this,void 0,void 0,(function*(){const n={keyShares:r};return yield this.baseRequest.post(`/users/${e}/wallets/${t}/key-shares`,n);}));}uploadUserKeyShares(e,t){return Rt(this,void 0,void 0,(function*(){const r={keyShares:t};return yield this.baseRequest.post(`/users/${e}/key-shares`,r);}));}getKeyshare(e,t,r,n){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/wallets/${t}/key-shares?type=${r}${n?`&encryptor=${n}`:""}`);}));}getBiometricKeyshares(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/biometrics/key-shares?publicKey=${t}`);}));}uploadTransmissionKeyshares(e,t){return Rt(this,void 0,void 0,(function*(){const r={shares:t};return yield this.baseRequest.post(`/users/${e}/temporary-shares`,r);}));}getTransmissionKeyshares(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/temporary-shares?sessionLookupId=${t}`);}));}resendVerificationCode(e){var{userId:t}=e,r=Nt(e,["userId"]);return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${t}/resend-verification-code`,r);}));}resendVerificationCodeByPhone(e){var{userId:t}=e,r=Nt(e,["userId"]);return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${t}/resend-verification-code-by-phone`,r);}));}cancelRecoveryAttempt(e){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post("recovery/cancel",{email:e});}));}check2FAStatus(e){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/2fa/users/${e}/check-status`);}));}enable2FA(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/2fa/users/${e}/enable`,{verificationCode:t});}));}setup2FA(e){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/2fa/users/${e}/setup`);}));}initializeRecovery(e){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post("/recovery/init",{email:e});}));}initializeFarcasterLogin(){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post("/auth/farcaster/init");}));}getFarcasterAuthStatus(){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post("/auth/farcaster/status");}));}initializeRecoveryForPhone(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post("/recovery/init",{phone:e,countryCode:t});}));}finalizeRecovery(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/recovery/users/${e}/wallets/${t}/finish`);}));}recoverUserShares(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/recovery/users/${e}/wallets/${t}/key-shares?type=USER&encryptor=RECOVERY`);}));}verifyEmailForRecovery(e,t){return Rt(this,void 0,void 0,(function*(){const r={email:e,verificationCode:t};return yield this.baseRequest.post("/recovery/verify-email",r);}));}verifyPhoneForRecovery(e,t,r){return Rt(this,void 0,void 0,(function*(){const n={phone:e,countryCode:t,verificationCode:r};return yield this.baseRequest.post("/recovery/verify-identifier",n);}));}verify2FA(e,t){return Rt(this,void 0,void 0,(function*(){const r={email:e,verificationCode:t};return yield this.baseRequest.post("/2fa/verify",r);}));}verify2FAForPhone(e,t,r){return Rt(this,void 0,void 0,(function*(){const n={phone:e,countryCode:t,verificationCode:r};return yield this.baseRequest.post("/2fa/verify",n);}));}tempTrasmissionInit(e,t){return Rt(this,void 0,void 0,(function*(){const r={message:e,userId:t};return yield this.baseRequest.post("/temporary-transmissions",r);}));}tempTrasmission(e){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/temporary-transmissions/${e}`);}));}getPartner(e){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/partners/${e}`);}));}acceptScopes(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/scopes/accept`,t);}));}getPendingTransaction(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/pending-transactions/${t}`);}));}acceptPendingTransaction(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/pending-transactions/${t}/accept`);}));}getPolicyPermissions(e,t){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/policies/${t}/permissions`);}));}createOnRampPurchase(e,t,r,n,i,a=!1){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.post(`/users/${e}/wallets/${t}/purchases`,{provider:r,network:n,asset:i,testMode:a});}));}updateOnRampPurchase(e,t,r,n){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.patch(`/users/${e}/wallets/${t}/purchases/${r}`,n);}));}getOnRampPurchase(e,t,r){return Rt(this,void 0,void 0,(function*(){return yield this.baseRequest.get(`/users/${e}/wallets/${t}/purchases/${r}`);}));}distributeCapsuleShare(e){var{userId:t,walletId:r}=e,n=Nt(e,["userId","walletId"]);return Rt(this,void 0,void 0,(function*(){const e=n;return yield this.baseRequest.post(`/users/${t}/wallets/${r}/capsule-share/distribute`,e);}));}keepSessionAlive(e){return Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.post(`/users/${e}/session/keep-alive`)).data;}));}persistRecoveryPublicKeys(e,t){return Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.post(`/users/${e}/recovery-public-keys`,{publicKeys:t})).data;}));}getRecoveryPublicKeys(e){return Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.get(`/users/${e}/recovery-public-keys`)).data;}));}uploadEncryptedWalletPrivateKey(e,t,r,n){return Rt(this,void 0,void 0,(function*(){const i={encryptedWalletPrivateKey:t,encryptionKeyHash:r,biometricPublicKey:n};return(yield this.baseRequest.post(`/users/${e}/encrypted-wallet-private-keys`,i)).data;}));}getEncryptedWalletPrivateKeys(e,t){return Rt(this,void 0,void 0,(function*(){return(yield this.baseRequest.get(`/users/${e}/encrypted-wallet-private-keys/${t}`)).data;}));}};function tr(e){switch(e){case Mt.DEV:return"http://localhost:8080/";case Mt.SANDBOX:return"https://api.sandbox.usecapsule.com/";case Mt.BETA:return"https://api.beta.usecapsule.com/";case Mt.PROD:return"https://api.usecapsule.com/";default:throw new Error(`unsupported env: ${e}`);}}function rr(e,t){const r=t?"ws":"http";switch(e){case Mt.DEV:return`${r}://localhost:3000`;case Mt.SANDBOX:return`${r}s://mpc-network.sandbox.usecapsule.com`;case Mt.BETA:return`${r}s://mpc-network.beta.usecapsule.com`;case Mt.PROD:return`${r}s://mpc-network.prod.usecapsule.com`;default:throw new Error(`unsupported env: ${e}`);}}function nr(e,t,r,n,i){return new er({userManagementHost:tr(e),apiKey:t,opts:{useFetchAdapter:r},retrieveSessionCookie:n,persistSessionCookie:i});}var ir=r(21756);function ar(e,t){const r=ir.A.create({baseURL:e});return t&&(r.defaults.adapter=function(e){return fetch(e.baseURL+e.url,{method:e.method,headers:e.headers,body:e.data,credentials:e.withCredentials?"include":void 0}).then((t=>t.text().then((r=>({data:r,status:t.status,statusText:t.statusText,headers:t.headers,config:e,request:fetch}))))).catch((function(e){throw e;}));}),r;}var sr=r(39138),or=r(3454),dr=r(1048).Buffer;class cr{constructor(e,t,r){this.walletId=e,this.keyshare=t,this.address=r,this.backupDecryptionKey=dr.from(qt.random.getBytesSync(32),"binary").toString("hex");}static buildFrom(e){try{const t=JSON.parse(e);return Object.assign(new cr("","",""),t);}catch(t){const r=new cr("","","");return r.backupDecryptionKey=e.split("|")[0],r;}}getPublicEncryptionKey(){return dr.from(or.privateToPublic(dr.from(this.backupDecryptionKey,"hex")));}getPublicEncryptionKeyHex(){return this.getPublicEncryptionKey().toString("hex");}encryptForSelf(e){try{const t=this.getPublicEncryptionKey();return(0,sr.QY)(t,dr.from(e,"ucs2")).toString("base64");}catch(e){throw Error("Error encrypting backup");}}static encryptWithPublicKey(e,t){try{return(0,sr.QY)(e,dr.from(t,"ucs2")).toString("base64");}catch(e){throw Error("Error encrypting backup");}}decrypt(e){try{const t=dr.from(e,"base64");return(0,sr.q1)(dr.from(this.backupDecryptionKey,"hex"),t).toString("ucs2");}catch(e){throw Error("Error decrypting backup");}}}var ur=r(1048).Buffer;function lr(e,t,r,n,i,a=!1,s){return o=this,d=void 0,u=function*(){let o,d;const{recoveryPublicKeys:c}=yield e.capsuleClient.getRecoveryPublicKeys(t);if(null==c?void 0:c.length)o=c.map((e=>{const{id:t,publicKey:n}=e,a=cr.encryptWithPublicKey(ur.from(n,"hex"),i);return{walletId:r,encryptedShare:a,type:Pt,encryptor:kt.RECOVERY,recoveryPublicKeyId:t};}));else{d=new cr(r,"","");const{recoveryPublicKeys:n}=yield e.capsuleClient.persistRecoveryPublicKeys(t,[d.getPublicEncryptionKeyHex()]),a=d.encryptForSelf(i);o=[{walletId:r,encryptedShare:a,type:Pt,encryptor:kt.RECOVERY,recoveryPublicKeyId:n[0].id}];}return yield e.capsuleClient.uploadUserKeyShares(t,[...n.map((e=>Object.assign({walletId:r},e))),...a?[]:o]),a||(yield e.capsuleClient.distributeCapsuleShare(Object.assign({userId:t,walletId:r,useDKLS:e.useDKLS},s))),d?JSON.stringify(d):"";},new((c=void 0)||(c=Promise))((function(e,t){function r(e){try{i(u.next(e));}catch(e){t(e);}}function n(e){try{i(u.throw(e));}catch(e){t(e);}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof c?i:new c((function(e){e(i);}))).then(r,n);}i((u=u.apply(o,d||[])).next());}));var o,d,c,u;}function hr(e,t,r,n,i=!1,a){return s=this,o=void 0,c=function*(){const s=(yield e.capsuleClient.getSessionPublicKeys(t)).data.keys.map((e=>{if(!e.publicKey)return;const{encryptedMessageHex:t,encryptedKeyHex:r}=function(e,t){const{key:r,encryptedMessageHex:n}=function(e){const t=qt.random.getBytesSync(16),r=qt.cipher.createCipher("AES-CBC",t);return r.start({iv:Yt}),r.update(qt.util.createBuffer(e)),r.finish(),{key:t,encryptedMessageHex:r.output.toHex()};}(t),i=function(e){return Ht.from(e,"hex").toString("utf-8");}(e),a=qt.pki.publicKeyFromPem(i).encrypt(r,Qt);return{encryptedMessageHex:n,encryptedKeyHex:Ht.from(a,"utf-8").toString("hex")};}(e.sigDerivedPublicKey,n);return{encryptedShare:t,encryptedKey:r,type:Pt,encryptor:kt.BIOMETRICS,biometricPublicKey:e.sigDerivedPublicKey};})).filter(Boolean);return yield lr(e,t,r,s,n,i,a);},new((d=void 0)||(d=Promise))((function(e,t){function r(e){try{i(c.next(e));}catch(e){t(e);}}function n(e){try{i(c.throw(e));}catch(e){t(e);}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof d?i:new d((function(e){e(i);}))).then(r,n);}i((c=c.apply(s,o||[])).next());}));var s,o,d,c;}var fr=r(10328);const pr={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:1[3-79]|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:22|44|7[27]|87|9[69])[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-689]|8[1-69]|9[1-578])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","2[0-24-9]\\d{8}|[78]\\d{10,13}|[7-9]\\d{9}|[1-9]\\d{7}|[124-7]\\d{6}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-6]|7(?:0[0-689]|[1-79])|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:5056(?:[0-35-9]\\d|4[468])|7302[0-4]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};var yr={}.constructor;function gr(e){return null!=e&&e.constructor===yr;}function mr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable;}))),r.push.apply(r,n);}return r;}function vr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;}function br(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n;}function Er(e){var t,r,n,i,a,s=(i=Array.prototype.slice.call(e),a=4,function(e){if(Array.isArray(e))return e;}(i)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e;}finally{try{s||null==r.return||r.return();}finally{if(o)throw i;}}return a;}}(i,a)||function(e,t){if(e){if("string"==typeof e)return br(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?br(e,t):void 0;}}(i,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}()),o=s[0],d=s[1],c=s[2],u=s[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,d&&"string"!=typeof d){if(!gr(d))throw new Error("Invalid second argument: ".concat(d));c?(r=d,n=c):n=d;}else u?(r=c,n=u):(r=void 0,n=c),d&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mr(Object(r),!0).forEach((function(t){vr(e,t,r[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t));}));}return e;}({defaultCountry:d},r));return{text:t,options:r,metadata:n};}var Cr="0-90-9٠-٩۰-۹",Sr="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function $r(e){return $r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e;}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e;},$r(e);}function wr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function Ir(e){var t="function"==typeof Map?new Map:void 0;return Ir=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n);}function n(){return Tr(e,arguments,Br(this).constructor);}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),kr(n,e);},Ir(e);}function Tr(e,t,r){return Tr=Ar()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&kr(i,r.prototype),i;},Tr.apply(null,arguments);}function Ar(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0;}catch(e){return!1;}}function kr(e,t){return kr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e;},kr(e,t);}function Br(e){return Br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e);},Br(e);}var Rr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kr(e,t);}(a,e);var t,r,n,i=(r=a,n=Ar(),function(){var e,t=Br(r);if(n){var i=Br(this).constructor;e=Reflect.construct(t,arguments,i);}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===$r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return wr(e);}(this,e);});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}(this,a),t=i.call(this,e),Object.setPrototypeOf(wr(t),a.prototype),t.name=t.constructor.name,t;}return t=a,Object.defineProperty(t,"prototype",{writable:!1}),t;}(Ir(Error));function Nr(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),i=0;i<3;i++){var a=Number(r[i]),s=Number(n[i]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1;}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0;}function Pr(e){return Pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e;}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e;},Pr(e);}function Or(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}function Ur(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}function _r(e,t,r){return t&&Ur(e.prototype,t),r&&Ur(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;}var Lr=" ext. ",Dr=/^\d+$/,xr=function(){function e(t){Or(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!gr(e)||!gr(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(gr(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Gr(e)+": "+e,"."));}(t),this.metadata=t,qr.call(this,t);}return _r(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e;}));}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e];}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical;}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e);}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0;}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0;}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e);}},{key:"country",value:function(e){return this.selectNumberingPlan(e);}},{key:"selectNumberingPlan",value:function(e,t){if(e&&Dr.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Mr(this.getCountryMetadata(e),this);}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Mr(this.getNumberingPlanMetadata(t),this);}else this.numberingPlan=void 0;return this;}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t;}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0];}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var r=this.nonGeographic()[e];if(r)return r;}else{var n=this.countryCallingCodes()[e];if(n&&1===n.length&&"001"===n[0])return this.metadata.countries["001"];}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode();}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix();}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix();}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern();}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths();}},{key:"formats",value:function(){return this.numberingPlan.formats();}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing();}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule();}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits();}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes();}},{key:"type",value:function(e){return this.numberingPlan.type(e);}},{key:"ext",value:function(){return this.numberingPlan.ext();}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes;}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e);}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan;}}]),e;}(),Mr=function(){function e(t,r){Or(this,e),this.globalMetadataObject=r,this.metadata=t,qr.call(this,r.metadata);}return _r(e,[{key:"callingCode",value:function(){return this.metadata[0];}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1];}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12];}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2];}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3];}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4];}},{key:"formats",value:function(){var e=this;return(this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[]).map((function(t){return new Kr(t,e);}));}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5];}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6];}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7];}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix();}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8];}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9];}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10];}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11];}},{key:"hasTypes",value:function(){return!(this.types()&&0===this.types().length||!this.types());}},{key:"type",value:function(e){if(this.hasTypes()&&Fr(this.types(),e))return new Vr(Fr(this.types(),e),this);}},{key:"ext",value:function(){return this.v1||this.v2?Lr:this.metadata[13]||Lr;}}]),e;}(),Kr=function(){function e(t,r){Or(this,e),this._format=t,this.metadata=r;}return _r(e,[{key:"pattern",value:function(){return this._format[0];}},{key:"format",value:function(){return this._format[1];}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[];}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule();}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||jr.test(this.nationalPrefixFormattingRule()));}},{key:"internationalFormat",value:function(){return this._format[5]||this.format();}}]),e;}(),jr=/^\(?\$1\)?$/,Vr=function(){function e(t,r){Or(this,e),this.type=t,this.metadata=r;}return _r(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0];}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths();}}]),e;}();function Fr(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9];}}var Gr=function(e){return Pr(e);};function Wr(e,t){if((t=new xr(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e));}function qr(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===Nr(t,"1.2.0")?this.v2=!0:-1===Nr(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0;}var Hr=function(e){return"([".concat(Cr,"]{1,").concat(e,"})");};function zr(e){var t="[  \\t,]*",r="[:\\..]?[  \\t,-]*",n="#?",i="[  \\t]*";return";ext="+Hr("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+Hr("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+Hr("9")+"#?|[- ]+"+Hr("6")+"#|"+i+"(?:,{2}|;)"+r+Hr("15")+"#?|"+i+"(?:,)+"+r+Hr("9")+n;}var Qr="["+Cr+"]{2}",Yr="[++]{0,1}(?:["+Sr+"]*["+Cr+"]){3,}["+Sr+Cr+"]*",Xr=new RegExp("^[++]{0,1}(?:["+Sr+"]*["+Cr+"]){1,2}$","i"),Jr=Yr+"(?:"+zr()+")?",Zr=new RegExp("^"+Qr+"$|^"+Jr+"$","i"),en=new RegExp("(?:"+zr()+")$","i"),tn={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n;}function nn(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return rn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rn(e,t):void 0;}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}(e.split(""));!(t=n()).done;)r+=(i=t.value,a=r,s=void 0,("+"===i?a?void("function"==typeof s&&s("end")):"+":function(e){return tn[e];}(i))||"");var i,a,s;return r;}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n;}function sn(e,t){return on(e,void 0,t);}function on(e,t,r){var n=r.type(t),i=n&&n.possibleLengths()||r.possibleLengths();if(!i)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!r.type("FIXED_LINE"))return on(e,"MOBILE",r);var a=r.type("MOBILE");a&&(i=function(e,t){for(var r,n=e.slice(),i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return an(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?an(e,t):void 0;}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}(t);!(r=i()).done;){var a=r.value;e.indexOf(a)<0&&n.push(a);}return n.sort((function(e,t){return e-t;}));}(i,a.possibleLengths()));}else if(t&&!n)return"INVALID_LENGTH";var s=e.length,o=i[0];return o===s?"IS_POSSIBLE":o>s?"TOO_SHORT":i[i.length-1]<s?"TOO_LONG":i.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH";}function dn(e,t){return"IS_POSSIBLE"===sn(e,t);}function cn(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e);}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n;}var ln=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function hn(e,t,r){if(t=t||{},e.country||e.countryCallingCode){(r=new xr(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(cn(n,r.nationalNumberPattern())){if(fn(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?fn(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return un(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?un(e,t):void 0;}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}(ln);!(i=a()).done;){var s=i.value;if(fn(n,s,r))return s;}}}}function fn(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&cn(e,t.pattern());}var pn=/(\$\d)/;var yn=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n;}function mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable;}))),r.push.apply(r,n);}return r;}function vn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mn(Object(r),!0).forEach((function(t){bn(e,t,r[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t));}));}return e;}function bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;}var En={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t);}};function Cn(e,t,r,n,i){var a=function(e,t){for(var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return gn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gn(e,t):void 0;}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}(e);!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var a=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(a))continue;}if(cn(t,i.pattern()))return i;}}(n.formats(),e);return a?function(e,t,r){var n=r.useInternationalFormat,i=r.withNationalPrefix,a=(r.carrierCode,r.metadata,e.replace(new RegExp(t.pattern()),n?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(pn,t.nationalPrefixFormattingRule()):t.format()));return n?function(e){return e.replace(new RegExp("[".concat(Sr,"]+"),"g")," ").trim();}(a):a;}(e,a,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!a.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:n}):e;}function Sn(e,t,r,n){return t?n(e,t,r):e;}function $n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable;}))),r.push.apply(r,n);}return r;}function wn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$n(Object(r),!0).forEach((function(t){In(e,t,r[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t));}));}return e;}function In(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;}function Tn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}var An=function(){function e(t,r,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}(this,e),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!r)throw new TypeError("`nationalNumber` not passed");if(!n)throw new TypeError("`metadata` not passed");var i=function(e,t){var r,n,i=new xr(t);return kn(e)?(r=e,i.selectNumberingPlan(r),n=i.countryCallingCode()):n=e,{country:r,countryCallingCode:n};}(t,n),a=i.country,s=i.countryCallingCode;this.country=a,this.countryCallingCode=s,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n;};}var t,r;return t=e,(r=[{key:"setExt",value:function(e){this.ext=e;}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:(e=this.countryCallingCode,t=this.nationalNumber,r=this.getMetadata(),(n=new xr(r).getCountryCodesForCallingCode(e))?n.filter((function(e){return function(e,t,r){var n=new xr(r);return n.selectNumberingPlan(t),n.numberingPlan.possibleLengths().indexOf(e.length)>=0;}(t,e,r);})):[]);var e,t,r,n;}},{key:"isPossible",value:function(){return function(e,t,r){if(void 0===t&&(t={}),r=new xr(r),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode);}else{if(!e.phone)return!1;if(e.country){if(!r.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));r.country(e.country);}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode);}}if(r.possibleLengths())return dn(e.phone||e.nationalNumber,r);if(e.countryCallingCode&&r.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');}(this,{v2:!0},this.getMetadata());}},{key:"isValid",value:function(){return e=this,t={v2:!0},r=this.getMetadata(),t=t||{},(r=new xr(r)).selectNumberingPlan(e.country,e.countryCallingCode),r.hasTypes()?void 0!==hn(e,t,r.metadata):cn(t.v2?e.nationalNumber:e.phone,r.nationalNumberPattern());var e,t,r;}},{key:"isNonGeographic",value:function(){return new xr(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode);}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext;}},{key:"getType",value:function(){return hn(this,{v2:!0},this.getMetadata());}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?vn(vn({},En),r):En,n=new xr(n),e.country&&"001"!==e.country){if(!n.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));n.country(e.country);}else{if(!e.countryCallingCode)return e.phone||"";n.selectNumberingPlan(e.countryCallingCode);}var i,a=n.countryCallingCode(),s=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?Sn(i=Cn(s,e.carrierCode,"NATIONAL",n,r),e.ext,n,r.formatExtension):"";case"INTERNATIONAL":return s?(i=Cn(s,null,"INTERNATIONAL",n,r),Sn(i="+".concat(a," ").concat(i),e.ext,n,r.formatExtension)):"+".concat(a);case"E.164":return"+".concat(a).concat(s);case"RFC3966":return function(e){var t=e.number,r=e.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(r?";ext="+r:"");}({number:"+".concat(a).concat(s),ext:e.ext});case"IDD":if(!r.fromCountry)return;var o=function(e,t,r,n,i){if(Wr(n,i.metadata)===r){var a=Cn(e,t,"NATIONAL",i);return"1"===r?r+" "+a:a;}var s=function(e,t,r){var n=new xr(r);return n.selectNumberingPlan(e,void 0),n.defaultIDDPrefix()?n.defaultIDDPrefix():yn.test(n.IDDPrefix())?n.IDDPrefix():void 0;}(n,0,i.metadata);if(s)return"".concat(s," ").concat(r," ").concat(Cn(e,null,"INTERNATIONAL",i));}(s,e.carrierCode,a,r.fromCountry,n);return Sn(o,e.ext,n,r.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'));}}(this,e,t?wn(wn({},t),{},{v2:!0}):{v2:!0},this.getMetadata());}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e);}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e);}},{key:"getURI",value:function(e){return this.format("RFC3966",e);}}])&&Tn(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e;}(),kn=function(e){return/^[A-Z]{2}$/.test(e);},Bn=new RegExp("(["+Cr+"])");function Rn(e,t){var r=function(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var i,a,s,o=n.length-1,d=o>0&&n[o];if(t.nationalPrefixTransformRule()&&d)i=e.replace(r,t.nationalPrefixTransformRule()),o>1&&(a=n[1]);else{var c=n[0];i=e.slice(c.length),d&&(a=n[1]);}if(d){var u=e.indexOf(n[1]);e.slice(0,u)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix());}else s=n[0];return{nationalNumber:i,nationalPrefix:s,carrierCode:a};}}return{nationalNumber:e};}(e,t),n=r.carrierCode,i=r.nationalNumber;if(i!==e){if(!function(e,t,r){return!(cn(e,r.nationalNumberPattern())&&!cn(t,r.nationalNumberPattern()));}(e,i,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(sn(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0;}}(i,t))return{nationalNumber:e};}return{nationalNumber:i,carrierCode:n};}function Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n;}function Pn(e,t){var r=t.nationalNumber,n=t.defaultCountry,i=t.metadata,a=i.getCountryCodesForCallingCode(e);if(a)return 1===a.length?a[0]:function(e,t){var r=t.countries,n=t.defaultCountry,i=t.metadata;i=new xr(i);for(var a,s=[],o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Nn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Nn(e,t):void 0;}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}(r);!(a=o()).done;){var d=a.value;if(i.country(d),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return d;}else if(hn({phone:e,country:d},void 0,i.metadata)){if(!n)return d;if(d===n)return d;s.push(d);}}if(s.length>0)return s[0];}(r,{countries:a,defaultCountry:n,metadata:i.metadata});}var On="(["+Cr+"]|[\\-\\.\\(\\)]?)",Un=new RegExp("^\\+"+On+"*["+Cr+"]"+On+"*$","g"),_n=new RegExp("^(["+Cr+"]+((\\-)*["+Cr+"])*\\.)*[a-zA-Z]+((\\-)*["+Cr+"])*\\.?$","g"),Ln=";phone-context=";var Dn=new RegExp("[++"+Cr+"]"),xn=new RegExp("[^"+Cr+"#]+$");function Mn(e,t,r){if(t=t||{},r=new xr(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new Rr("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry));}var n=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf(Ln);if(t<0)return null;var r=t+15;if(r>=e.length)return"";var n=e.indexOf(";",r);return n>=0?e.substring(r,n):e.substring(r);}(e);if(!function(e){return null===e||0!==e.length&&(Un.test(e)||_n.test(e));}(i))throw new Rr("NOT_A_NUMBER");if(null===i)r=n(e)||"";else{r="","+"===i.charAt(0)&&(r+=i);var a,s=e.indexOf("tel:");a=s>=0?s+4:0;var o=e.indexOf(Ln);r+=e.substring(a,o);}var d=r.indexOf(";isub=");if(d>0&&(r=r.substring(0,d)),""!==r)return r;}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e)if(e.length>250){if(r)throw new Rr("TOO_LONG");}else{if(!1===t)return e;var n=e.search(Dn);if(!(n<0))return e.slice(n).replace(xn,"");}}(e,r,t);}});if(!n)return{};if(!function(e){return e.length>=2&&Zr.test(e);}(n))return function(e){return Xr.test(e);}(n)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(en);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(en),i=1;i<n.length;){if(n[i])return{number:r,ext:n[i]};i++;}}(n);return i.ext?i:{number:n};}(e,t.v2,t.extract),i=n.number,a=n.ext,s=n.error;if(!i){if(t.v2){if("TOO_SHORT"===s)throw new Rr("TOO_SHORT");throw new Rr("NOT_A_NUMBER");}return{};}var o=function(e,t,r,n){var i,a=function(e,t,r,n){if(!e)return{};var i;if("+"!==e[0]){var a=function(e,t,r,n){if(t){var i=new xr(n);i.selectNumberingPlan(t,r);var a=new RegExp(i.IDDPrefix());if(0===e.search(a)){var s=(e=e.slice(e.match(a)[0].length)).match(Bn);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e;}}}(e,t,r,n);if(!a||a===e){if(t||r){var s=function(e,t,r,n){var i=t?Wr(t,n):r;if(0===e.indexOf(i)){(n=new xr(n)).selectNumberingPlan(t,r);var a=e.slice(i.length),s=Rn(a,n).nationalNumber,o=Rn(e,n).nationalNumber;if(!cn(o,n.nationalNumberPattern())&&cn(s,n.nationalNumberPattern())||"TOO_LONG"===sn(o,n))return{countryCallingCode:i,number:a};}return{number:e};}(e,t,r,n),o=s.countryCallingCode,d=s.number;if(o)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:o,number:d};}return{number:e};}i=!0,e="+"+a;}if("0"===e[1])return{};n=new xr(n);for(var c=2;c-1<=3&&c<=e.length;){var u=e.slice(1,c);if(n.hasCallingCode(u))return n.selectNumberingPlan(u),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:u,number:e.slice(c)};c++;}return{};}(nn(e),t,r,n.metadata),s=a.countryCallingCodeSource,o=a.countryCallingCode,d=a.number;if(o)n.selectNumberingPlan(o);else{if(!d||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(i=t),o=r||Wr(t,n.metadata);}if(!d)return{countryCallingCodeSource:s,countryCallingCode:o};var c=Rn(nn(d),n),u=c.nationalNumber,l=c.carrierCode,h=Pn(o,{nationalNumber:u,defaultCountry:t,metadata:n});return h&&(i=h,"001"===h||n.country(i)),{country:i,countryCallingCode:o,countryCallingCodeSource:s,nationalNumber:u,carrierCode:l};}(i,t.defaultCountry,t.defaultCallingCode,r),d=o.country,c=o.nationalNumber,u=o.countryCallingCode,l=o.countryCallingCodeSource,h=o.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new Rr("INVALID_COUNTRY");return{};}if(!c||c.length<2){if(t.v2)throw new Rr("TOO_SHORT");return{};}if(c.length>17){if(t.v2)throw new Rr("TOO_LONG");return{};}if(t.v2){var f=new An(u,c,r.metadata);return d&&(f.country=d),h&&(f.carrierCode=h),a&&(f.ext=a),f.__countryCallingCodeSource=l,f;}var p=!!(t.extended?r.hasSelectedNumberingPlan():d)&&cn(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!r.possibleLengths()||!dn(c,r)),phone:c,ext:a}:p?function(e,t,r){var n={country:e,phone:t};return r&&(n.ext=r),n;}(d,c,a):{};}function Kn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable;}))),r.push.apply(r,n);}return r;}function jn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(r),!0).forEach((function(t){Vn(e,t,r[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t));}));}return e;}function Vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;}function Fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable;}))),r.push.apply(r,n);}return r;}function Gn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fn(Object(r),!0).forEach((function(t){Wn(e,t,r[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t));}));}return e;}function Wn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;}function qn(){var e=Er(arguments);return function(e,t,r){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e);}(t.defaultCountry,r)&&(t=Gn(Gn({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){return Mn(e,jn(jn({},t),{},{v2:!0}),r);}(e,t,r);}catch(e){if(!(e instanceof Rr))throw e;}}(e.text,e.options,e.metadata);}function Hn(){return function(e,t){var r=Array.prototype.slice.call(t);return r.push(pr),e.apply(this,r);}(qn,arguments);}var zn,Qn,Yn,Xn,Jn,Zn=r(1048).Buffer,ei=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};!function(e){e.CGGMP="CGGMP",e.DKLS="DKLS",e.ED25519="ED25519";}(zn||(zn={})),(Jn=Qn||(Qn={})).EVM="EVM",Jn.SOLANA="SOLANA",function(e){e.INITIATED="INITIATED",e.READY="READY",e.EXPIRED="EXPIRED",e.FINISHED="FINISHED",e.CANCELLED="CANCELLED";}(Yn||(Yn={})),function(e){e.EMAIL="EMAIL",e.PHONE="PHONE";}(Xn||(Xn={})),function(e){e.USER="USER",e.PREGEN="PREGEN";}(Qn||(Qn={}));const ti="@CAPSULE/",ri=`${ti}e-mail`,ni=`${ti}phone`,ii=`${ti}countryCode`,ai=`${ti}farcasterUsername`,si=`${ti}userId`,oi=`${ti}wallets`,di=`${ti}ed25519Wallets`,ci=`${ti}sessionCookie`,ui=`${ti}loginEncryptionKeyPair`,li=2e3,hi=class{convertBigInt(e){const t=new qt.jsbn.BigInteger(null);return t.data=e.data,t.s=e.s,t.t=e.t,t;}convertEncryptionKeyPair(e){return{privateKey:qt.pki.setRsaPrivateKey(this.convertBigInt(e.privateKey.n),this.convertBigInt(e.privateKey.e),this.convertBigInt(e.privateKey.d),this.convertBigInt(e.privateKey.p),this.convertBigInt(e.privateKey.q),this.convertBigInt(e.privateKey.dP),this.convertBigInt(e.privateKey.dQ),this.convertBigInt(e.privateKey.qInv)),publicKey:qt.pki.setRsaPublicKey(this.convertBigInt(e.publicKey.n),this.convertBigInt(e.publicKey.e))};}requireApiKey(){if(!this.ctx.apiKey)throw new Error("in order to create a wallet or user with Capsule, you\n must provide an API key to the capsule instance");}constructor(e,t,r){if(this.localStorageGetItem=e=>this.platformUtils.localStorage.get(e),this.localStorageSetItem=(e,t)=>this.platformUtils.localStorage.set(e,t),this.sessionStorageGetItem=e=>this.platformUtils.sessionStorage.get(e),this.sessionStorageSetItem=(e,t)=>this.platformUtils.sessionStorage.set(e,t),this.sessionStorageRemoveItem=e=>this.platformUtils.sessionStorage.removeItem(e),this.retrieveSessionCookie=()=>this.sessionCookie,this.persistSessionCookie=e=>{this.sessionCookie=e,this.localStorageSetItem(ci,e);},this.clearStorage=()=>ei(this,void 0,void 0,(function*(){this.platformUtils.localStorage.clear(ti),this.platformUtils.sessionStorage.clear(ti),this.platformUtils.secureStorage&&this.platformUtils.secureStorage.clear(ti);})),r||(r={}),this.emailPrimaryColor=r.emailPrimaryColor,this.emailTheme=r.emailTheme,this.homepageUrl=r.homepageUrl,this.supportUrl=r.supportUrl,this.xUrl=r.xUrl,this.githubUrl=r.githubUrl,this.linkedinUrl=r.linkedinUrl,this.portalBackgroundColor=r.portalBackgroundColor,this.portalPrimaryButtonColor=r.portalPrimaryButtonColor,this.portalTextColor=r.portalTextColor,this.portalPrimaryButtonTextColor=r.portalPrimaryButtonTextColor,this.portalTheme=r.portalTheme,this.platformUtils=this.getPlatformUtils(),this.disableProviderModal=this.platformUtils.disableProviderModal,this.supportedWalletTypes=r.supportedWalletTypes||[Qn.EVM],r.useStorageOverrides&&(this.localStorageGetItem=r.localStorageGetItemOverride,this.localStorageSetItem=r.localStorageSetItemOverride,this.sessionStorageGetItem=r.sessionStorageGetItemOverride,this.sessionStorageSetItem=r.sessionStorageSetItemOverride,this.sessionStorageRemoveItem=r.sessionStorageRemoveItemOverride,this.clearStorage=r.clearStorageOverride),this.ctx={env:e,apiKey:t,capsuleClient:nr(e,t,r.disableWorkers,this.retrieveSessionCookie,this.persistSessionCookie),disableWorkers:r.disableWorkers,offloadMPCComputationURL:r.offloadMPCComputationURL,useLocalFiles:r.useLocalFiles,useDKLS:r.useDKLSForCreation||!r.offloadMPCComputationURL,disableWebSockets:!!r.disableWebSockets,wasmOverride:r.wasmOverride},r.offloadMPCComputationURL&&(this.ctx.mpcComputationClient=ar(r.offloadMPCComputationURL,r.disableWorkers)),!this.platformUtils.isSyncStorage||r.useStorageOverrides)return;this.email=this.localStorageGetItem(ri)||void 0,this.userId=this.localStorageGetItem(si)||void 0,this.sessionCookie=this.localStorageGetItem(ci)||this.sessionStorageGetItem(ci)||void 0;const n=this.platformUtils.secureStorage?this.platformUtils.secureStorage.get(oi):this.localStorageGetItem(oi);this.wallets=JSON.parse(n||"{}");const i=this.platformUtils.secureStorage?this.platformUtils.secureStorage.get(di):this.localStorageGetItem(di);this.ed25519Wallets=JSON.parse(i||"{}");const a=this.sessionStorageGetItem(ui);a&&"undefined"!==a&&(this.loginEncryptionKeyPair=this.convertEncryptionKeyPair(JSON.parse(a)));}getVerificationEmailProps(){return{brandColor:this.emailPrimaryColor,theme:this.emailTheme,supportUrl:this.supportUrl,homepageUrl:this.homepageUrl,xUrl:this.xUrl,githubUrl:this.githubUrl,linkedinUrl:this.linkedinUrl};}getBackupKitEmailProps(){return{brandColor:this.emailPrimaryColor,theme:this.emailTheme,homepageUrl:this.homepageUrl,xUrl:this.xUrl,linkedinUrl:this.linkedinUrl,githubUrl:this.githubUrl,supportUrl:this.supportUrl};}init(){return ei(this,void 0,void 0,(function*(){this.email=(yield this.localStorageGetItem(ri))||void 0,this.userId=(yield this.localStorageGetItem(si))||void 0,this.sessionCookie=(yield this.localStorageGetItem(ci))||(yield this.sessionStorageGetItem(ci))||void 0;const e=this.platformUtils.secureStorage?yield this.platformUtils.secureStorage.get(oi):yield this.localStorageGetItem(oi);this.wallets=JSON.parse(e||"{}");const t=this.platformUtils.secureStorage?yield this.platformUtils.secureStorage.get(di):yield this.localStorageGetItem(di);this.ed25519Wallets=JSON.parse(t||"{}");const r=yield this.sessionStorageGetItem(ui);r&&"undefined"!==r&&(this.loginEncryptionKeyPair=this.convertEncryptionKeyPair(JSON.parse(r)));}));}setEmail(e){return ei(this,void 0,void 0,(function*(){this.email=e,yield this.localStorageSetItem(ri,e);}));}setPhoneNumber(e,t){return ei(this,void 0,void 0,(function*(){this.phone=e,this.countryCode=t,yield this.localStorageSetItem(ni,e),yield this.localStorageSetItem(ii,t);}));}setFarcasterUsername(e){return ei(this,void 0,void 0,(function*(){this.farcasterUsername=e,yield this.localStorageSetItem(ai,e);}));}setUserId(e){return ei(this,void 0,void 0,(function*(){this.userId=e,yield this.localStorageSetItem(si,e);}));}setWallets(e){return ei(this,void 0,void 0,(function*(){this.wallets=e,this.platformUtils.secureStorage?yield this.platformUtils.secureStorage.set(oi,JSON.stringify(e)):yield this.localStorageSetItem(oi,JSON.stringify(e));}));}setEd25519Wallets(e){return ei(this,void 0,void 0,(function*(){this.ed25519Wallets=e,this.platformUtils.secureStorage?yield this.platformUtils.secureStorage.set(di,JSON.stringify(e)):yield this.localStorageSetItem(di,JSON.stringify(e));}));}setLoginEncryptionKeyPair(e){return ei(this,void 0,void 0,(function*(){this.loginEncryptionKeyPair=e,yield this.sessionStorageSetItem(ui,JSON.stringify(e));}));}deleteLoginEncryptionKeyPair(){return ei(this,void 0,void 0,(function*(){this.loginEncryptionKeyPair=void 0,yield this.sessionStorageRemoveItem(ui);}));}getUserId(){return this.userId;}getEmail(){return this.email;}getWallets(){return this.wallets;}getED25519Wallets(){return this.ed25519Wallets;}getAddress(e){var t,r;return e?this.wallets[e].address:null===(r=null===(t=Object.values(this.wallets))||void 0===t?void 0:t[0])||void 0===r?void 0:r.address;}getPartnerURL(e){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.getPartner(e)).data.partner.portalUrl;}));}getPortalURL(e){return ei(this,void 0,void 0,(function*(){return e&&(yield this.getPartnerURL(e))||Wt(this.ctx);}));}getCommonLoginQueryParams(e,t){return ei(this,void 0,void 0,(function*(){return`${e?`&newDeviceSessionId=${e}`:""}${t?`&newDeviceEncryptionKey=${t}`:""}`;}));}getCommonQueryParams(e,t){var r,n,i,a,s,o;return ei(this,void 0,void 0,(function*(){const d=(yield this.ctx.capsuleClient.getPartner(e)).data;return`${e?`&partnerId=${e}`:""}${d.font?`&portalFont=${encodeURIComponent(d.font)}`:""}${(null===(r=this.portalTheme)||void 0===r?void 0:r.borderRadius)?`&portalBorderRadius=${encodeURIComponent(this.portalTheme.borderRadius)}`:""}${d.foregroundColor||(null===(n=this.portalTheme)||void 0===n?void 0:n.foregroundColor)?`&portalForegroundColor=${encodeURIComponent(null!==(i=d.foregroundColor)&&void 0!==i?i:this.portalTheme.foregroundColor)}`:""}${d.backgroundColor||this.portalBackgroundColor||(null===(a=this.portalTheme)||void 0===a?void 0:a.backgroundColor)?`&portalBackgroundColor=${encodeURIComponent(null!==(o=null!==(s=d.backgroundColor)&&void 0!==s?s:this.portalBackgroundColor)&&void 0!==o?o:this.portalTheme.backgroundColor)}`:""}${this.portalPrimaryButtonColor?`&portalPrimaryButtonColor=${encodeURIComponent(this.portalPrimaryButtonColor)}`:""}${this.portalTextColor?`&portalTextColor=${encodeURIComponent(this.portalTextColor)}`:""}${this.portalPrimaryButtonTextColor?`&portalPrimaryButtonTextColor=${encodeURIComponent(this.portalPrimaryButtonTextColor)}`:""}${t?`&isForNewDevice=${t}`:""}`;}));}getWebAuthURLForCreate(e,t,r,n){return ei(this,void 0,void 0,(function*(){const i=yield this.getCommonQueryParams(r,n),a={email:`email=${encodeURIComponent(this.email)}`,phone:`phone=${encodeURIComponent(this.phone)}&countryCode=${encodeURIComponent(this.countryCode)}`,farcaster:`farcasterUsername=${encodeURIComponent(this.farcasterUsername)}`}[e];return`${r&&(yield this.getPartnerURL(r))||Wt(this.ctx)}/web/users/${this.userId}/biometrics/${t}?${a}${i}`;}));}getShortUrl(e){return`${Wt(this.ctx)}/short/${e}`;}shortenLoginLink(e){return ei(this,void 0,void 0,(function*(){const t=yield function(e,t){return r=this,n=void 0,s=function*(){let r,n;for(;;)try{r=(0,fr.randomBytes)(32).toString("hex"),n=or.privateToPublic(i.Buffer.from(r,"hex"));break;}catch(e){continue;}const a=i.Buffer.from(n),s=(0,sr.QY)(a,i.Buffer.from(e,"ucs2")).toString("base64"),{data:{id:o}}=yield t.tempTrasmissionInit(s);return encodeURIComponent(o+"|"+r);},new((a=void 0)||(a=Promise))((function(e,t){function i(e){try{d(s.next(e));}catch(e){t(e);}}function o(e){try{d(s.throw(e));}catch(e){t(e);}}function d(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r);}))).then(i,o);}d((s=s.apply(r,n||[])).next());}));var r,n,a,s;}(e,this.ctx.capsuleClient);return this.getShortUrl(t);}));}getWebAuthURLForLogin(e,t,r,n,i,a="email"){return ei(this,void 0,void 0,(function*(){const s=yield this.getCommonQueryParams(r),o=yield this.getCommonLoginQueryParams(n,i),d={email:`email=${encodeURIComponent(this.email)}`,phone:`phone=${encodeURIComponent(this.phone)}&countryCode=${encodeURIComponent(this.countryCode)}`,farcaster:`farcasterUsername=${encodeURIComponent(this.farcasterUsername)}`}[a];return`${r&&(yield this.getPartnerURL(r))||Wt(this.ctx)}/web/biometrics/login?${d}&sessionId=${e}&encryptionKey=${t}${o}${s}`;}));}getWebAuthURLForLoginForPhone(e,t,r,n,i){return ei(this,void 0,void 0,(function*(){const a=yield this.getCommonQueryParams(r),s=yield this.getCommonLoginQueryParams(n,i);return`${r&&(yield this.getPartnerURL(r))||Wt(this.ctx)}/web/biometrics/login?phone=${encodeURIComponent(this.phone)}&countryCode=${encodeURIComponent(this.countryCode)}&sessionId=${e}&encryptionKey=${t}${s}${a}`;}));}getPrivateKey(e){return ei(this,void 0,void 0,(function*(){const t=Object.values(this.wallets),r=e?this.wallets[e]:null==t?void 0:t[0];if(!r)throw new Error("wallet not found");if(r.scheme!==zn.DKLS)throw new Error("invalid wallet scheme");return yield this.platformUtils.getPrivateKey(this.ctx,this.userId,r.id,r.signer,this.retrieveSessionCookie());}));}fetchWallets(){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.getWallets(this.userId)).data.wallets;}));}populateWalletAddresses(){return ei(this,void 0,void 0,(function*(){(yield this.ctx.capsuleClient.getWallets(this.userId)).data.wallets.forEach((e=>{e.scheme===zn.ED25519&&this.ed25519Wallets[e.id]?(this.ed25519Wallets[e.id].address=e.address,this.ed25519Wallets[e.id].publicKey=e.publicKey,this.ed25519Wallets[e.id].scheme=e.scheme,this.ed25519Wallets[e.id].partnerId=e.partnerId,this.ed25519Wallets[e.id].userId=e.userId,delete this.wallets[e.id]):this.wallets[e.id]&&(this.wallets[e.id].address=e.address,this.wallets[e.id].publicKey=e.publicKey,this.wallets[e.id].scheme=e.scheme,this.wallets[e.id].partnerId=e.partnerId,this.wallets[e.id].userId=e.userId,delete this.ed25519Wallets[e.id]);})),yield this.setWallets(this.wallets),yield this.setEd25519Wallets(this.ed25519Wallets);}));}populatePregenWalletAddresses(e,t){return ei(this,void 0,void 0,(function*(){(yield this.ctx.capsuleClient.getPregenWallets(e,t)).wallets.forEach((e=>{e.scheme===zn.ED25519&&this.ed25519Wallets[e.id]?(this.ed25519Wallets[e.id].address=e.address,this.ed25519Wallets[e.id].publicKey=e.publicKey,this.ed25519Wallets[e.id].scheme=e.scheme,this.ed25519Wallets[e.id].partnerId=e.partnerId,this.ed25519Wallets[e.id].userId=e.userId,this.ed25519Wallets[e.id].type=e.type,delete this.wallets[e.id]):this.wallets[e.id]&&(this.wallets[e.id].address=e.address,this.wallets[e.id].publicKey=e.publicKey,this.wallets[e.id].scheme=e.scheme,this.wallets[e.id].partnerId=e.partnerId,this.wallets[e.id].userId=e.userId,this.wallets[e.id].type=e.type,delete this.ed25519Wallets[e.id]);})),yield this.setWallets(this.wallets),yield this.setEd25519Wallets(this.ed25519Wallets);}));}checkIfUserExists(e){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.checkUserExists(e,null,null)).data.exists;}));}checkIfUserExistsByPhone(e,t){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.checkUserExists(null,e,t)).data.exists;}));}createUser(e){return ei(this,void 0,void 0,(function*(){this.requireApiKey(),yield this.setEmail(e);const{userId:t}=yield this.ctx.capsuleClient.createUser(Object.assign({email:this.email},this.getVerificationEmailProps()));yield this.setUserId(t);}));}createUserByPhone(e,t){return ei(this,void 0,void 0,(function*(){this.requireApiKey(),yield this.setPhoneNumber(e,t);const{userId:r}=yield this.ctx.capsuleClient.createUser({phone:this.phone,countryCode:this.countryCode});yield this.setUserId(r);}));}verifyEmail(e){return ei(this,void 0,void 0,(function*(){return yield this.ctx.capsuleClient.verifyEmail(this.userId,{verificationCode:e}),this.getSetUpBiometricsURL(!1);}));}verifyPhone(e){return ei(this,void 0,void 0,(function*(){return yield this.ctx.capsuleClient.verifyPhone(this.userId,{verificationCode:e}),this.getSetUpBiometricsURLForPhone(!1);}));}verify2FA(e,t){return ei(this,void 0,void 0,(function*(){const r=yield this.ctx.capsuleClient.verify2FA(e,t);return{address:r.data.address,initiatedAt:r.data.initiatedAt,status:r.data.status,userId:r.data.userId,walletId:r.data.walletId};}));}verify2FAForPhone(e,t,r){return ei(this,void 0,void 0,(function*(){const n=yield this.ctx.capsuleClient.verify2FAForPhone(e,t,r);return{address:n.data.address,initiatedAt:n.data.initiatedAt,status:n.data.status,userId:n.data.userId,walletId:n.data.walletId};}));}setup2FA(){return ei(this,void 0,void 0,(function*(){return{uri:(yield this.ctx.capsuleClient.setup2FA(this.userId)).data.uri};}));}enable2FA(e){return ei(this,void 0,void 0,(function*(){yield this.ctx.capsuleClient.enable2FA(this.userId,e);}));}check2FAStatus(){return ei(this,void 0,void 0,(function*(){return this.userId?{isSetup:(yield this.ctx.capsuleClient.check2FAStatus(this.userId)).data.isSetup}:{isSetup:!1};}));}resendVerificationCode(){return ei(this,void 0,void 0,(function*(){yield this.ctx.capsuleClient.resendVerificationCode(Object.assign({userId:this.userId},this.getVerificationEmailProps()));}));}resendVerificationCodeByPhone(){return ei(this,void 0,void 0,(function*(){yield this.ctx.capsuleClient.resendVerificationCodeByPhone({userId:this.userId});}));}getSetUpBiometricsURL(e,t="email"){return ei(this,void 0,void 0,(function*(){const r=yield this.ctx.capsuleClient.addSessionPublicKey(this.userId,{status:wt.PENDING,type:It.WEB});return this.getWebAuthURLForCreate(t,r.data.id,r.data.partnerId,e);}));}getSetUpBiometricsURLForPhone(e){return ei(this,void 0,void 0,(function*(){const t=yield this.ctx.capsuleClient.addSessionPublicKey(this.userId,{status:wt.PENDING,type:It.WEB});return this.getWebAuthURLForCreate("phone",t.data.id,t.data.partnerId,e);}));}isSessionActive(){return ei(this,void 0,void 0,(function*(){const e=yield this.ctx.capsuleClient.touchSession();return e.data.biometricVerifiedAt&&(t=this.ctx,r=e.data.biometricVerifiedAt,t.env!==Mt.PROD?Date.now()-r<=36e5:Date.now()-r<=18e5);var t,r;}));}isFullyLoggedIn(){var e,t,r,n;return ei(this,void 0,void 0,(function*(){const i=yield this.isSessionActive(),a=null===(t=null===(e=Object.values(this.getWallets()))||void 0===e?void 0:e[0])||void 0===t?void 0:t.address,s=null===(n=null===(r=Object.values(this.getED25519Wallets()))||void 0===r?void 0:r[0])||void 0===n?void 0:n.address;return i&&!(!a&&!s);}));}initiateUserLogin(e,t,r="email",n){return ei(this,void 0,void 0,(function*(){"email"===r?yield this.setEmail(e):"phone"===r?yield this.setPhoneNumber(e,n):"farcaster"===r&&(yield this.setFarcasterUsername(e));const i=yield this.ctx.capsuleClient.touchSession(!0);if(!this.loginEncryptionKeyPair){const e=yield Jt(this.ctx);yield this.setLoginEncryptionKeyPair(e);}const a=yield this.getWebAuthURLForLogin(i.data.sessionId,Xt(this.loginEncryptionKeyPair),i.data.partnerId,void 0,void 0,r);return t?this.shortenLoginLink(a):a;}));}initiateUserLoginForPhone(e,t,r){return ei(this,void 0,void 0,(function*(){yield this.setPhoneNumber(e,t);const n=yield this.ctx.capsuleClient.touchSession(!0);if(!this.loginEncryptionKeyPair){const e=yield Jt(this.ctx);yield this.setLoginEncryptionKeyPair(e);}const i=yield this.getWebAuthURLForLoginForPhone(n.data.sessionId,Xt(this.loginEncryptionKeyPair),n.data.partnerId);return r?this.shortenLoginLink(i):i;}));}waitForAccountCreation(){return ei(this,void 0,void 0,(function*(){for(;;)try{if(yield new Promise((e=>setTimeout(e,li))),yield this.isSessionActive())return;}catch(e){console.error(e);}}));}waitForPasskeyAndCreateWallet(){return ei(this,void 0,void 0,(function*(){let e,t;if(yield this.waitForAccountCreation(),null!=this.email?(e=this.email,t=Xn.EMAIL):(e=Hn(`${this.countryCode}${this.phone}`).formatInternational(),t=Xn.PHONE),(yield this.ctx.capsuleClient.getPregenWallets(e,t)).wallets[0])return yield this.claimPregenWallets(e,t);{const{recoverySecret:e}=yield this.createWalletPerMissingType();return e;}}));}getFarcasterConnectURL(){return ei(this,void 0,void 0,(function*(){yield this.logout(),yield this.ctx.capsuleClient.touchSession(!0);const{data:{connect_uri:e}}=yield this.ctx.capsuleClient.initializeFarcasterLogin();return e;}));}waitForFarcasterStatus(){return ei(this,void 0,void 0,(function*(){for(;;)try{yield new Promise((e=>setTimeout(e,li)));const e=yield this.ctx.capsuleClient.getFarcasterAuthStatus();if("completed"===e.data.state){const{userId:t,userExists:r,username:n}=e.data;return yield this.setUserId(t),yield this.setFarcasterUsername(n),{userExists:r,username:n};}}catch(e){console.error(e);}}));}getOAuthURL(e){return ei(this,void 0,void 0,(function*(){yield this.logout();const t=yield this.ctx.capsuleClient.touchSession(!0);return`${tr(this.ctx.env)}auth/${e.toLowerCase()}?sessionLookupId=${encodeURIComponent(t.data.sessionLookupId)}`;}));}waitForOAuth(){return ei(this,void 0,void 0,(function*(){for(;;)try{yield new Promise((e=>setTimeout(e,li)));const e=yield this.ctx.capsuleClient.touchSession();if(e.data.userId){const{userId:t,email:r}=e.data;return yield this.setUserId(t),yield this.setEmail(r),{userExists:yield this.checkIfUserExists(r),email:r};}}catch(e){console.error(e);}}));}waitForLoginAndSetup(e){return ei(this,void 0,void 0,(function*(){for(;;)try{if(yield new Promise((e=>setTimeout(e,li))),!(yield this.isSessionActive()))continue;yield this.userSetupAfterLogin();const t=(yield this.fetchWallets()).filter((e=>!!e.address)),r=yield this.getTransmissionKeyShares();if(r.data.temporaryShares.length===t.length){yield this.setupAfterLogin(r.data.temporaryShares,e);const t=0===Object.keys(this.wallets).length&&this.supportedWalletTypes.includes(Qn.EVM),n=0===Object.keys(this.ed25519Wallets).length&&this.supportedWalletTypes.includes(Qn.SOLANA);return{needsWallet:t||n};}}catch(e){console.error(e);}}));}refreshSession(e){return ei(this,void 0,void 0,(function*(){const t=yield this.ctx.capsuleClient.touchSession(!0);if(!this.loginEncryptionKeyPair){const e=yield Jt(this.ctx);yield this.setLoginEncryptionKeyPair(e);}const r=yield this.getWebAuthURLForLogin(t.data.sessionId,Xt(this.loginEncryptionKeyPair));return e&&this.platformUtils.openPopup(r),r;}));}userSetupAfterLogin(){return ei(this,void 0,void 0,(function*(){const e=yield this.ctx.capsuleClient.touchSession();yield this.setUserId(e.data.userId);}));}getTransmissionKeyShares(e){return ei(this,void 0,void 0,(function*(){const t=yield this.ctx.capsuleClient.touchSession(),r=e?`${t.data.sessionLookupId}-new-device`:t.data.sessionLookupId;return this.ctx.capsuleClient.getTransmissionKeyshares(this.userId,r);}));}setupAfterLogin(e,t){return ei(this,void 0,void 0,(function*(){e||(e=(yield this.getTransmissionKeyShares()).data.temporaryShares),yield this.setWallets({}),yield this.setEd25519Wallets({}),e.forEach((e=>{const t=Zt(this.loginEncryptionKeyPair.privateKey,e.encryptedShare,e.encryptedKey);this.wallets[e.walletId]={id:e.walletId,signer:t},this.ed25519Wallets[e.walletId]={id:e.walletId,signer:t};})),yield this.deleteLoginEncryptionKeyPair(),yield this.populateWalletAddresses(),yield this.ctx.capsuleClient.touchSession(!t);}));}distributeNewWalletShare(e,t,r){return ei(this,void 0,void 0,(function*(){let n=t;return n||(n=this.wallets[e].signer),r?yield lr(this.ctx,this.userId,e,[],n,!1,this.getBackupKitEmailProps()):yield hr(this.ctx,this.userId,e,n,!1,this.getBackupKitEmailProps());}));}waitForWalletAddress(e){return ei(this,void 0,void 0,(function*(){let t=0;for(;;)try{if(10===t)break;++t;const r=(yield this.ctx.capsuleClient.getWallets(this.userId)).data.wallets.find((t=>t.id===e));if(r&&r.address)return;yield new Promise((e=>setTimeout(e,1e3)));}catch(e){console.error(e);}throw new Error("timed out waiting for wallet address");}));}waitForPregenWalletAddress(e,t=Xn.EMAIL,r){return ei(this,void 0,void 0,(function*(){let n=0;for(;;)try{if(10===n)break;++n;const i=(yield this.ctx.capsuleClient.getPregenWallets(e,t)).wallets.find((e=>e.id===r));if(i&&i.address)return;yield new Promise((e=>setTimeout(e,1e3)));}catch(e){console.error(e);}throw new Error("timed out waiting for wallet address");}));}createWalletPerMissingType(e=!1){return ei(this,void 0,void 0,(function*(){const t=[];let r;if(0===Object.keys(this.wallets).length&&this.supportedWalletTypes.includes(Qn.EVM)){const[n,i]=yield this.createWallet(e);t.push(n),i&&(r=i);}if(0===Object.keys(this.ed25519Wallets).length&&this.supportedWalletTypes.includes(Qn.SOLANA)){const[n,i]=yield this.createWallet(e,void 0,!0);t.push(n),i&&(r=i);}return{wallets:t,recoverySecret:r};}));}createWallet(e=!1,t,r){return ei(this,void 0,void 0,(function*(){let t,n;if(this.requireApiKey(),r){const e=yield this.platformUtils.ed25519Keygen(this.ctx,this.userId,this.retrieveSessionCookie(),this.getBackupKitEmailProps()),r=e.walletId;t=e.signer,this.ed25519Wallets[r]={id:r,signer:t},n=this.ed25519Wallets[r];}else{const e=yield this.platformUtils.keygen(this.ctx,this.userId,null,this.retrieveSessionCookie(),this.getBackupKitEmailProps()),r=e.walletId;t=e.signer,this.wallets[r]={id:r,signer:t},n=this.wallets[r];}yield this.waitForWalletAddress(n.id),yield this.populateWalletAddresses();let i=null;return e||(i=yield hr(this.ctx,this.userId,n.id,t,!1,this.getBackupKitEmailProps())),[n,i];}));}createWalletPreGen(e,t,r=Xn.EMAIL){return ei(this,void 0,void 0,(function*(){let n;if(this.requireApiKey(),t){const{signer:t,walletId:i}=yield this.platformUtils.ed25519PreKeygen(this.ctx,e,r,this.retrieveSessionCookie());n=i,this.ed25519Wallets[n]={id:n,signer:t};}else{const{signer:t,walletId:i}=yield this.platformUtils.preKeygen(this.ctx,void 0,e,r,null,this.retrieveSessionCookie());n=i,this.wallets[n]={id:n,signer:t};}return yield this.waitForPregenWalletAddress(e,r,n),yield this.populatePregenWalletAddresses(e,r),t?this.ed25519Wallets[n]:this.wallets[n];}));}claimPregenWallets(e,t=Xn.EMAIL){return ei(this,void 0,void 0,(function*(){if(this.requireApiKey(),t===Xn.EMAIL){if(!(yield this.checkIfUserExists(e)))throw new Error("user does not exist");}else{const t=Hn(e),r=t.formatNational(),n=`+${t.countryCallingCode}`;if(!(yield this.checkIfUserExistsByPhone(r,n)))throw new Error("user does not exist");}const r=yield this.ctx.capsuleClient.getPregenWallets(e,t);if(0===r.wallets.length)throw new Error("wallets not found");let n;for(const e of r.wallets){yield this.ctx.capsuleClient.claimPregenWallet({userId:this.userId,walletId:e.id});const t=e.scheme===zn.ED25519?this.ed25519Wallets[e.id].signer:this.wallets[e.id].signer,r=yield hr(this.ctx,this.userId,e.id,t,!1,this.getBackupKitEmailProps());r&&(n=r),e.scheme===zn.ED25519?(this.ed25519Wallets[e.id].userId=this.userId,yield this.setEd25519Wallets(this.ed25519Wallets)):(this.wallets[e.id].userId=this.userId,yield this.setWallets(this.wallets));}return n;}));}updateWalletIdentifierPreGen(e,t,r=Xn.EMAIL){return ei(this,void 0,void 0,(function*(){this.requireApiKey();const n=t||Object.keys(this.wallets)[0];yield this.ctx.capsuleClient.updatePregenWallet(n,{pregenIdentifier:e,pregenIdentifierType:r});}));}hasPregenWallet(e,t=Xn.EMAIL){return ei(this,void 0,void 0,(function*(){return this.requireApiKey(),!!(yield this.ctx.capsuleClient.getPregenWallets(e,t)).wallets[0];}));}getPregenWallets(e,t=Xn.EMAIL){return ei(this,void 0,void 0,(function*(){return this.requireApiKey(),(yield this.ctx.capsuleClient.getPregenWallets(e,t)).wallets;}));}encodeWalletBase64(e){const t=JSON.stringify(e);return Zn.from(t).toString("base64");}getUserShare(){const e=Object.values(this.wallets)[0],t=Object.values(this.ed25519Wallets)[0];return e&&t?`${this.encodeWalletBase64(e)}-${this.encodeWalletBase64(t)}`:e||t?this.encodeWalletBase64(e||t):null;}setUserShare(e){return ei(this,void 0,void 0,(function*(){const t=e.split("-");for(const e of t){const t=Zn.from(e,"base64").toString(),r=JSON.parse(t);r.scheme===zn.ED25519?(this.ed25519Wallets[r.id]=r,yield this.setEd25519Wallets(this.ed25519Wallets)):(this.wallets[r.id]=r,yield this.setWallets(this.wallets));}}));}getTransactionReviewUrl(e){return`${Wt(this.ctx)}/web/users/${this.userId}/transaction-review/${e}?email=${encodeURIComponent(this.email)}`;}signMessage(e,t){return ei(this,void 0,void 0,(function*(){const r=this.wallets[e]||this.ed25519Wallets[e];let n=this.userId;if(r.partnerId&&!r.userId&&(n=r.partnerId),r.scheme===zn.ED25519){const i=yield this.platformUtils.ed25519Sign(this.ctx,n,e,r.signer,t,this.retrieveSessionCookie());return i.pendingTransactionId?Object.assign(Object.assign({},i),{transactionReviewUrl:this.getTransactionReviewUrl(i.pendingTransactionId)}):i;}const i=yield this.platformUtils.signMessage(this.ctx,n,e,this.wallets[e].signer,t,this.retrieveSessionCookie(),r.scheme===zn.DKLS);return i.pendingTransactionId?Object.assign(Object.assign({},i),{transactionReviewUrl:this.getTransactionReviewUrl(i.pendingTransactionId)}):i;}));}signTransaction(e,t,r){return ei(this,void 0,void 0,(function*(){const n=this.wallets[e];let i=this.userId;n.partnerId&&!n.userId&&(i=n.partnerId);const a=yield this.platformUtils.signTransaction(this.ctx,i,e,this.wallets[e].signer,t,r,this.retrieveSessionCookie(),n.scheme===zn.DKLS);return a.pendingTransactionId?Object.assign(Object.assign({},a),{transactionReviewUrl:this.getTransactionReviewUrl(a.pendingTransactionId)}):a;}));}sendTransaction(e,t,r){return ei(this,void 0,void 0,(function*(){const n=this.wallets[e],i=yield this.platformUtils.sendTransaction(this.ctx,this.userId,e,this.wallets[e].signer,t,r,this.retrieveSessionCookie(),n.scheme===zn.DKLS);return i.pendingTransactionId?Object.assign(Object.assign({},i),{transactionReviewUrl:this.getTransactionReviewUrl(i.pendingTransactionId)}):i;}));}isProviderModalDisabled(){return!!this.disableProviderModal;}createOnRampPurchase(e,t,r,n=!1,i=Object.keys(this.wallets)[0]){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.createOnRampPurchase(this.getUserId(),i,(s=e,Vt[s]),(a=t,jt[a]),function(e){return Ft[e];}(r),n)).data;var a,s;}));}updateOnRampPurchase(e,t,r){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.updateOnRampPurchase(this.getUserId(),e,t,r)).data;}));}getOnRampPurchase(e,t){return ei(this,void 0,void 0,(function*(){return(yield this.ctx.capsuleClient.getOnRampPurchase(this.getUserId(),e,t)).data;}));}keepSessionAlive(){return ei(this,void 0,void 0,(function*(){try{return yield this.ctx.capsuleClient.keepSessionAlive(this.userId),!0;}catch(e){return!1;}}));}exportSession(){const e={email:this.email,userId:this.userId,wallets:this.wallets,ed25519Wallets:this.ed25519Wallets,sessionCookie:this.sessionCookie};return Zn.from(JSON.stringify(e)).toString("base64");}importSession(e){return ei(this,void 0,void 0,(function*(){const t=Zn.from(e,"base64").toString("utf8"),r=JSON.parse(t);yield this.setEmail(r.email),yield this.setUserId(r.userId),yield this.setWallets(r.wallets),yield this.setEd25519Wallets(r.ed25519Wallets),this.persistSessionCookie(r.sessionCookie);}));}logout(e){return ei(this,void 0,void 0,(function*(){if(yield this.ctx.capsuleClient.logout(),yield this.clearStorage(),e){const e=Object.assign(Object.assign({},this.wallets),this.ed25519Wallets);Object.entries(e).forEach((([e,t])=>{t.type!==Qn.PREGEN&&(t.scheme===zn.ED25519?delete this.ed25519Wallets[e]:delete this.wallets[e]);})),yield this.setWallets(this.wallets),yield this.setEd25519Wallets(this.ed25519Wallets);}else this.wallets={},this.ed25519Wallets={};this.loginEncryptionKeyPair=void 0,this.email=void 0,this.userId=void 0,this.sessionCookie=void 0;}));}toString(){const e=Object.keys(this.wallets).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:{id:t,address:this.wallets[t].address,signer:this.wallets[t].signer?"[REDACTED]":void 0}})),{}),t={email:this.email,userId:this.userId,wallets:e,loginEncryptionKeyPair:this.loginEncryptionKeyPair?"[REDACTED]":void 0};return`Capsule ${JSON.stringify(t)}`;}};class fi{constructor(){this.get=e=>"undefined"!=typeof window&&localStorage.getItem(e)||null,this.set=(e,t)=>{"undefined"!=typeof window&&localStorage.setItem(e,t);},this.removeItem=e=>{"undefined"!=typeof window&&localStorage.removeItem(e);},this.clear=e=>{if("undefined"!=typeof window)for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);r&&r.startsWith(e)&&(localStorage.removeItem(r),t--);}};}}class pi{constructor(){this.get=e=>"undefined"!=typeof window&&sessionStorage.getItem(e)||null,this.set=(e,t)=>{"undefined"!=typeof window&&sessionStorage.setItem(e,t);},this.removeItem=e=>{"undefined"!=typeof window&&sessionStorage.removeItem(e);},this.clear=e=>{if("undefined"!=typeof window)for(let t=0;t<sessionStorage.length;t++){const r=sessionStorage.key(t);r&&r.startsWith(e)&&(sessionStorage.removeItem(r),t--);}};}}(()=>{const e=()=>{const e=new Error("not implemented");return e.code="ENOSYS",e;};if(!globalThis.fs){let t="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(e,n){t+=r.decode(n);const i=t.lastIndexOf("\n");return-1!=i&&(console.log(t.substring(0,i)),t=t.substring(i+1)),n.length;},write(t,r,n,i,a,s){0===n&&i===r.length&&null===a?s(null,this.writeSync(t,r)):s(e());},chmod(t,r,n){n(e());},chown(t,r,n,i){i(e());},close(t,r){r(e());},fchmod(t,r,n){n(e());},fchown(t,r,n,i){i(e());},fstat(t,r){r(e());},fsync(e,t){t(null);},ftruncate(t,r,n){n(e());},lchown(t,r,n,i){i(e());},link(t,r,n){n(e());},lstat(t,r){r(e());},mkdir(t,r,n){n(e());},open(t,r,n,i){i(e());},read(t,r,n,i,a,s){s(e());},readdir(t,r){r(e());},readlink(t,r){r(e());},rename(t,r,n){n(e());},rmdir(t,r){r(e());},stat(t,r){r(e());},symlink(t,r,n){n(e());},truncate(t,r,n){n(e());},unlink(t,r){r(e());},utimes(t,r,n,i){i(e());}};}if(globalThis.process||(globalThis.process={getuid:()=>-1,getgid:()=>-1,geteuid:()=>-1,getegid:()=>-1,getgroups(){throw e();},pid:-1,ppid:-1,umask(){throw e();},cwd(){throw e();},chdir(){throw e();}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(globalThis.performance||(globalThis.performance=Date),!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const t=new TextEncoder("utf-8"),r=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{0!==e&&console.warn("exit code:",e);},this._exitPromise=new Promise((e=>{this._resolveExitPromise=e;})),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const e=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0);},n=e=>this.mem.getUint32(e+0,!0)+4294967296*this.mem.getInt32(e+4,!0),i=e=>{const t=this.mem.getFloat64(e,!0);if(0===t)return;if(!isNaN(t))return t;const r=this.mem.getUint32(e,!0);return this._values[r];},a=(e,t)=>{const r=2146959360;if("number"==typeof t&&0!==t)return isNaN(t)?(this.mem.setUint32(e+4,r,!0),void this.mem.setUint32(e,0,!0)):void this.mem.setFloat64(e,t,!0);if(void 0===t)return void this.mem.setFloat64(e,0,!0);let n=this._ids.get(t);void 0===n&&(n=this._idPool.pop(),void 0===n&&(n=this._values.length),this._values[n]=t,this._goRefCounts[n]=0,this._ids.set(t,n)),this._goRefCounts[n]++;let i=0;switch(typeof t){case"object":null!==t&&(i=1);break;case"string":i=2;break;case"symbol":i=3;break;case"function":i=4;}this.mem.setUint32(e+4,r|i,!0),this.mem.setUint32(e,n,!0);},s=e=>{const t=n(e+0),r=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,r);},o=e=>{const t=n(e+0),r=n(e+8),a=new Array(r);for(let e=0;e<r;e++)a[e]=i(t+8*e);return a;},d=e=>{const t=n(e+0),i=n(e+8);return r.decode(new DataView(this._inst.exports.mem.buffer,t,i));},c=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t},gojs:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t);},"runtime.wasmWrite":e=>{const t=n(8+(e>>>=0)),r=n(e+16),i=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,r,i));},"runtime.resetMemoryDataView":e=>{this.mem=new DataView(this._inst.exports.mem.buffer);},"runtime.nanotime1":t=>{e(8+(t>>>=0),1e6*(c+performance.now()));},"runtime.walltime":t=>{t>>>=0;const r=(new Date).getTime();e(t+8,r/1e3),this.mem.setInt32(t+16,r%1e3*1e6,!0);},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout((()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume();}),n(e+8))),this.mem.setInt32(e+16,t,!0);},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t);},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(s(e+8));},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,0===this._goRefCounts[t]){const e=this._values[t];this._values[t]=null,this._ids.delete(e),this._idPool.push(t);}},"syscall/js.stringVal":e=>{a(24+(e>>>=0),d(e+8));},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(i(e+8),d(e+16));e=this._inst.exports.getsp()>>>0,a(e+32,t);},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(i(e+8),d(e+16),i(e+32));},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(i(e+8),d(e+16));},"syscall/js.valueIndex":e=>{a(24+(e>>>=0),Reflect.get(i(e+8),n(e+16)));},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(i(e+8),n(e+16),i(e+24));},"syscall/js.valueCall":e=>{e>>>=0;try{const t=i(e+8),r=Reflect.get(t,d(e+16)),n=o(e+32),s=Reflect.apply(r,t,n);e=this._inst.exports.getsp()>>>0,a(e+56,s),this.mem.setUint8(e+64,1);}catch(t){e=this._inst.exports.getsp()>>>0,a(e+56,t),this.mem.setUint8(e+64,0);}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=i(e+8),r=o(e+16),n=Reflect.apply(t,void 0,r);e=this._inst.exports.getsp()>>>0,a(e+40,n),this.mem.setUint8(e+48,1);}catch(t){e=this._inst.exports.getsp()>>>0,a(e+40,t),this.mem.setUint8(e+48,0);}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=i(e+8),r=o(e+16),n=Reflect.construct(t,r);e=this._inst.exports.getsp()>>>0,a(e+40,n),this.mem.setUint8(e+48,1);}catch(t){e=this._inst.exports.getsp()>>>0,a(e+40,t),this.mem.setUint8(e+48,0);}},"syscall/js.valueLength":t=>{e(16+(t>>>=0),parseInt(i(t+8).length));},"syscall/js.valuePrepareString":r=>{r>>>=0;const n=t.encode(String(i(r+8)));a(r+16,n),e(r+24,n.length);},"syscall/js.valueLoadString":e=>{const t=i(8+(e>>>=0));s(e+16).set(t);},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,i(e+8)instanceof i(e+16)?1:0);},"syscall/js.copyBytesToGo":t=>{const r=s(8+(t>>>=0)),n=i(t+32);if(!(n instanceof Uint8Array||n instanceof Uint8ClampedArray))return void this.mem.setUint8(t+48,0);const a=n.subarray(0,r.length);r.set(a),e(t+40,a.length),this.mem.setUint8(t+48,1);},"syscall/js.copyBytesToJS":t=>{const r=i(8+(t>>>=0)),n=s(t+16);if(!(r instanceof Uint8Array||r instanceof Uint8ClampedArray))return void this.mem.setUint8(t+48,0);const a=n.subarray(0,r.length);r.set(a),e(t+40,a.length),this.mem.setUint8(t+48,1);},debug:e=>{console.log(e);}}};}run(e){return r=this,n=void 0,a=function*(){if(!(e instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=e,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let r=4096;const n=e=>{const n=r,i=t.encode(e+"\0");return new Uint8Array(this.mem.buffer,r,i.length).set(i),r+=i.length,r%8!=0&&(r+=8-r%8),n;},i=this.argv.length,a=[];this.argv.forEach((e=>{a.push(n(e));})),a.push(0),Object.keys(this.env).sort().forEach((e=>{a.push(n(`${e}=${this.env[e]}`));})),a.push(0);const s=r;if(a.forEach((e=>{this.mem.setUint32(r,e,!0),this.mem.setUint32(r+4,0,!0),r+=8;})),r>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,s),this.exited&&this._resolveExitPromise(),yield this._exitPromise;},new((i=void 0)||(i=Promise))((function(e,t){function s(e){try{d(a.next(e));}catch(e){t(e);}}function o(e){try{d(a.throw(e));}catch(e){t(e);}}function d(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r);}))).then(s,o);}d((a=a.apply(r,n||[])).next());}));var r,n,i,a;}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise();}_makeFuncWrapper(e){const t=this;return function(){const r={id:e,this:this,args:arguments};return t._pendingEvent=r,t._resume(),r.result;};}};})();var yi=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};const gi=(e,t,r)=>`{"walletId": "${e}", "id":"${t}", "otherId":"CAPSULE", "isReceiver": false, "disableWebSockets": ${r}}`;function mi(e,t,r,n){return yi(this,void 0,void 0,(function*(){const{data:i}=yield e.mpcComputationClient.post("/wallets",{userId:t,walletId:r,protocolId:n});return i;}));}function vi(e,t,r,n,i,a,s){return yi(this,void 0,void 0,(function*(){const{data:o}=yield e.mpcComputationClient.post(`/wallets/${r}/transactions/send`,{userId:t,protocolId:n,transaction:i,signer:a,chainId:s});return o;}));}var bi=r(39907),Ei=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};function Ci(e,t){return Ei(this,void 0,void 0,(function*(){const{functionType:r,params:n}=t;switch(r){case"KEYGEN":{const{userId:t,secretKey:r}=n,i=yield function(e,t,r){return yi(this,void 0,void 0,(function*(){const{walletId:n,protocolId:i}=yield e.capsuleClient.createWallet(t,{useTwoSigners:!0,scheme:e.useDKLS?Tt.DKLS:Tt.CGGMP});if(e.offloadMPCComputationURL&&!e.useDKLS)return{signer:(yield mi(e,t,n,i)).signer,walletId:n};const a=rr(e.env,!e.disableWebSockets),s=e.useDKLS?gi(n,"USER",e.disableWebSockets):((e,t)=>`{"ServerUrl":"${e}", "WalletId": "${t}", "Id":"USER", "Ids":["USER","CAPSULE"], "Threshold":1}`)(a,n),o=e.useDKLS?global.dklsCreateAccount:global.createAccountV2;return{signer:yield new Promise(((e,t)=>o(s,a,i,r,(()=>{}),((r,n)=>{r&&t(r),e(n);})))),walletId:n};}));}(e,t,r);return i;}case"SIGN_TRANSACTION":{const{share:t,walletId:r,userId:i,tx:a,chainId:s}=n;return function(e,t,r,n,i,a){return yi(this,void 0,void 0,(function*(){const{data:{protocolId:s,pendingTransactionId:o}}=yield e.capsuleClient.signTransaction(n,r,{transaction:i,chainId:a});if(o)return console.error("send transaction denied"),{pendingTransactionId:o};if(e.offloadMPCComputationURL&&!e.useDKLS)return vi(e,n,r,s,i,t,a);const d=rr(e.env,!e.disableWebSockets),c=e.useDKLS?global.dklsSendTransaction:global.sendTransaction,u=JSON.parse(t);return!u.disableWebSockets!=!e.disableWebSockets&&(u.disableWebSockets=e.disableWebSockets),t=JSON.stringify(u),new Promise(((e,r)=>c(t,d,i,a,s,((t,n)=>{t&&r(t),e({signature:n});}))));}));}(e,t,r,i,a,s);}case"SEND_TRANSACTION":{const{share:t,walletId:r,userId:i,tx:a,chainId:s}=n;return function(e,t,r,n,i,a){return yi(this,void 0,void 0,(function*(){const{data:{protocolId:s,pendingTransactionId:o}}=yield e.capsuleClient.sendTransaction(n,r,{transaction:i,chainId:a});if(o)return console.error("send transaction denied"),{pendingTransactionId:o};if(e.offloadMPCComputationURL&&!e.useDKLS)return vi(e,n,r,s,i,t,a);const d=rr(e.env,!e.disableWebSockets),c=e.useDKLS?global.dklsSendTransaction:global.sendTransaction,u=JSON.parse(t);return!u.disableWebSockets!=!e.disableWebSockets&&(u.disableWebSockets=e.disableWebSockets),t=JSON.stringify(u),new Promise(((e,r)=>c(t,d,i,a,s,((t,n)=>{t&&r(t),e({signature:n});}))));}));}(e,t,r,i,a,s);}case"SIGN_MESSAGE":{const{share:t,walletId:r,userId:i,message:a}=n;return function(e,t,r,n,i){return yi(this,void 0,void 0,(function*(){const{protocolId:a,pendingTransactionId:s}=yield e.capsuleClient.preSignMessage(n,r,i);if(s)return console.error("sign message denied"),{pendingTransactionId:s};if(e.offloadMPCComputationURL&&!e.useDKLS)return function(e,t,r,n,i,a){return yi(this,void 0,void 0,(function*(){const{data:s}=yield e.mpcComputationClient.post(`/wallets/${r}/messages/sign`,{userId:t,protocolId:n,message:i,signer:a});return s;}));}(e,n,r,a,i,t);const o=rr(e.env,!e.disableWebSockets),d=e.useDKLS?global.dklsSignMessage:global.signMessage,c=JSON.parse(t);return!c.disableWebSockets!=!e.disableWebSockets&&(c.disableWebSockets=e.disableWebSockets),t=JSON.stringify(c),new Promise(((e,r)=>d(t,o,i,a,((t,n)=>{t&&r(t),e({signature:n});}))));}));}(e,t,r,i,a);}case"REFRESH":{const{share:t,walletId:r,userId:i}=n;return function(e,t,r,n){return yi(this,void 0,void 0,(function*(){const{data:{protocolId:i}}=yield e.capsuleClient.refreshKeys(n,r),a=rr(e.env,!e.disableWebSockets),s=e.useDKLS?global.dklsRefresh:global.refresh,o=JSON.parse(t);return!o.disableWebSockets!=!e.disableWebSockets&&(o.disableWebSockets=e.disableWebSockets),t=JSON.stringify(o),new Promise(((e,r)=>s(t,a,i,((t,n)=>{t&&r(t),e(n);}))));}));}(e,t,r,i);}case"PREKEYGEN":{const{email:t,partnerId:r,secretKey:i}=n;let{pregenIdentifier:a,pregenIdentifierType:s}=n;"null"!==t&&"undefined"!==t&&""!==t&&null!=t&&(a=t,s=Xn.EMAIL);const o=yield function(e,t,r,n,i){return yi(this,void 0,void 0,(function*(){const{walletId:t,protocolId:a}=yield e.capsuleClient.createPregenWallet({pregenIdentifier:r,pregenIdentifierType:n}),s=rr(e.env,!e.disableWebSockets),o=gi(t,"USER",e.disableWebSockets);return{signer:yield new Promise(((e,t)=>global.dklsCreateAccount(o,s,a,i,(()=>{}),((r,n)=>{r&&t(r),e(n);})))),walletId:t};}));}(e,0,a,s,i);return o;}case"GET_PRIVATE_KEY":{const{share:t,walletId:r,userId:i}=n;return yield function(e,t,r,n){return yi(this,void 0,void 0,(function*(){const i=yield e.capsuleClient.getCapsuleShare(n,r);return i?new Promise(((e,r)=>global.getPrivateKey(t,i,((t,n)=>{t&&r(t),e(n);})))):"";}));}(e,t,r,i);}case"ED25519_KEYGEN":{const{userId:t}=n;return function(e,t){return yi(this,void 0,void 0,(function*(){const{walletId:r,protocolId:n}=yield e.capsuleClient.createWallet(t,{scheme:Tt.ED25519}),i=rr(e.env,!e.disableWebSockets);return{signer:yield new Promise(((e,t)=>global.ed25519CreateAccount(i,r,n,((r,n)=>{r&&t(r),e(n);})))),walletId:r};}));}(e,t);}case"ED25519_SIGN":{const{share:t,walletId:r,userId:i,base64Bytes:a}=n;return function(e,t,r,n,i){return yi(this,void 0,void 0,(function*(){const{protocolId:a}=yield e.capsuleClient.preSignMessage(r,n,i,Tt.ED25519);return{signature:yield new Promise(((e,r)=>global.ed25519Sign(t,a,i,((t,n)=>{t&&r(t),e(n);}))))};}));}(e,t,i,r,a);}case"ED25519_PREKEYGEN":{const{email:t}=n;let{pregenIdentifier:r,pregenIdentifierType:i}=n;return"null"!==t&&"undefined"!==t&&""!==t&&null!=t&&(r=t,i=Xn.EMAIL),function(e,t,r){return yi(this,void 0,void 0,(function*(){const{walletId:n,protocolId:i}=yield e.capsuleClient.createPregenWallet({pregenIdentifier:t,pregenIdentifierType:r,scheme:Tt.ED25519}),a=rr(e.env,!e.disableWebSockets);return{signer:yield new Promise(((e,t)=>global.ed25519CreateAccount(a,n,i,((r,n)=>{r&&t(r),e(n);})))),walletId:n};}));}(e,r,i);}default:throw new Error(`functionType: ${r} not supported`);}}));}var Si=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};function $i(e,t){return Si(this,void 0,void 0,(function*(){const r=e=>{"CUSTOM"!==e.data.functionType&&t(e.data);};if(e.disableWorkers)return{postMessage:function(t){!function(){Si(this,void 0,void 0,(function*(){yield function(e,t,r){return Ei(this,void 0,void 0,(function*(){const{env:n,apiKey:i,offloadMPCComputationURL:a,disableWorkers:s,sessionCookie:o,useDKLS:d,disableWebSockets:c,wasmOverride:u}=e.data;if(!n)return!0;const l={env:n,apiKey:i,capsuleClient:nr(n,i,r,(()=>o)),offloadMPCComputationURL:a,mpcComputationClient:a?ar(a,!!s):void 0,useDKLS:d,disableWebSockets:!!c,wasmOverride:u};l.offloadMPCComputationURL&&!l.useDKLS||(yield function(e,t){return Ei(this,void 0,void 0,(function*(){const r=new self.Go;let n=t;if(!n){if("true"===bi.env.DISABLE_WASM_FETCH)throw new Error("fetching wasm file is disabled");const t=yield fetch(`${Wt(e)}/static/js/main.wasm`,{mode:"cors"});n=yield t.arrayBuffer();}const i=yield WebAssembly.instantiate(n,r.importObject);r.run(i.instance);}));}(l,u));const h=yield Ci(l,e.data);return t(h),!1;}));}({data:t},(e=>r({data:e})),e.disableWorkers);}));}();},terminate:()=>{}};let n;if(e.useLocalFiles)throw new Error("useLocalFiles only supported locally");{const t=yield fetch(`${Wt(e)}/static/js/mpcWorker-bundle.js`),r=new Blob([yield t.text()],{type:"application/javascript"}),i=URL.createObjectURL(r);n=new Worker(i);}return n.onmessage=r,n;}));}function wi(e,t,r){return n=this,i=void 0,s=function*(){const n=Date.now();for(;Date.now()-n<t;){if(yield e())return!0;yield new Promise((e=>setTimeout(e,r)));}return!1;},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{d(s.next(e));}catch(e){t(e);}}function o(e){try{d(s.throw(e));}catch(e){t(e);}}function d(t){var n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n);}))).then(r,o);}d((s=s.apply(n,i||[])).next());}));var n,i,a,s;}var Ii=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};function Ti(e,t,r){return Ii(this,void 0,void 0,(function*(){return!!(yield e.capsuleClient.getWallets(t)).data.wallets.find((e=>e.id===r)).address;}));}function Ai(e,t,r,n){return Ii(this,void 0,void 0,(function*(){return!!(yield e.capsuleClient.getPregenWallets(t,r)).wallets.find((e=>e.id===n)).address;}));}var ki=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));},Bi=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};class Ri{constructor(){this.localStorage=new fi,this.sessionStorage=new pi,this.secureStorage=null,this.isSyncStorage=!0,this.disableProviderModal=!1;}getPrivateKey(e,t,r,n,i){return function(e,t,r,n,i){return Bi(this,void 0,void 0,(function*(){return yield new Promise((a=>Bi(this,void 0,void 0,(function*(){const s=yield $i(e,(e=>Bi(this,void 0,void 0,(function*(){a(e),s.terminate();}))));s.postMessage({env:e.env,apiKey:e.apiKey,params:{share:n,walletId:r,userId:t},functionType:"GET_PRIVATE_KEY",offloadMPCComputationURL:e.offloadMPCComputationURL,disableWorkers:e.disableWorkers,sessionCookie:i,useDKLS:e.useDKLS,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}));}(e,t,r,n,i);}keygen(e,t,r,n,i={}){return function(e,t,r,n=!1,i,a={}){return new Promise((s=>Ii(this,void 0,void 0,(function*(){const o=yield $i(e,(r=>Ii(this,void 0,void 0,(function*(){if(yield wi((()=>Ii(this,void 0,void 0,(function*(){return Ti(e,t,r.walletId);}))),15e3,1e3),n)return s({signer:r.signer,walletId:r.walletId,recoveryShare:null}),void o.terminate();const i=yield hr(e,t,r.walletId,r.signer,!1,a);s({signer:r.signer,walletId:r.walletId,recoveryShare:i}),o.terminate();}))));o.postMessage({env:e.env,apiKey:e.apiKey,params:{userId:t,secretKey:r},functionType:"KEYGEN",offloadMPCComputationURL:e.offloadMPCComputationURL,disableWorkers:e.disableWorkers,sessionCookie:i,useDKLS:e.useDKLS,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}(e,t,r,!0,n,i);}preKeygen(e,t,r,n,i,a){return function(e,t,r,n,i=!1,a,s){return new Promise((i=>Ii(this,void 0,void 0,(function*(){const o=yield $i(e,(n=>Ii(this,void 0,void 0,(function*(){yield wi((()=>Ii(this,void 0,void 0,(function*(){return Ai(e,t,r,n.walletId);}))),15e3,1e3),i({signer:n.signer,walletId:n.walletId,recoveryShare:null}),o.terminate();})))),d={pregenIdentifier:t,pregenIdentifierType:r,secretKey:n,partnerId:a,email:void 0};r===Xn.EMAIL&&(d.email=t),o.postMessage({env:e.env,apiKey:e.apiKey,params:d,functionType:"PREKEYGEN",offloadMPCComputationURL:e.offloadMPCComputationURL,disableWorkers:e.disableWorkers,sessionCookie:s,useDKLS:e.useDKLS,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}(e,r,n,i,!1,t,a);}signMessage(e,t,r,n,i,a,s){return function(e,t,r,n,i,a,s){return ki(this,void 0,void 0,(function*(){return yield new Promise((o=>ki(this,void 0,void 0,(function*(){const d=yield $i(e,(e=>ki(this,void 0,void 0,(function*(){o(e),d.terminate();}))));d.postMessage({env:e.env,apiKey:e.apiKey,params:{share:n,walletId:r,userId:t,message:i},functionType:"SIGN_MESSAGE",offloadMPCComputationURL:e.offloadMPCComputationURL,disableWorkers:e.disableWorkers,sessionCookie:a,useDKLS:s,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}));}(e,t,r,n,i,a,s);}signTransaction(e,t,r,n,i,a,s,o){return function(e,t,r,n,i,a,s,o){return ki(this,void 0,void 0,(function*(){return yield new Promise((d=>ki(this,void 0,void 0,(function*(){const c=yield $i(e,(e=>ki(this,void 0,void 0,(function*(){d(e),c.terminate();}))));c.postMessage({env:e.env,apiKey:e.apiKey,params:{share:n,walletId:r,userId:t,tx:i,chainId:a},functionType:"SIGN_TRANSACTION",offloadMPCComputationURL:e.offloadMPCComputationURL,disableWorkers:e.disableWorkers,sessionCookie:s,useDKLS:o,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}));}(e,t,r,n,i,a,s,o);}sendTransaction(e,t,r,n,i,a,s,o){return function(e,t,r,n,i,a,s,o){return ki(this,void 0,void 0,(function*(){return yield new Promise((d=>ki(this,void 0,void 0,(function*(){const c=yield $i(e,(e=>ki(this,void 0,void 0,(function*(){d(e),c.terminate();}))));c.postMessage({env:e.env,apiKey:e.apiKey,params:{share:n,walletId:r,userId:t,tx:i,chainId:a},functionType:"SEND_TRANSACTION",offloadMPCComputationURL:e.offloadMPCComputationURL,disableWorkers:e.disableWorkers,sessionCookie:s,useDKLS:o,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}));}(e,t,r,n,i,a,s,o);}signHash(e,t){throw new Error("not implemented");}ed25519Keygen(e,t,r,n){return function(e,t,r){return new Promise((n=>Ii(this,void 0,void 0,(function*(){const i=yield $i(e,(r=>Ii(this,void 0,void 0,(function*(){yield wi((()=>Ii(this,void 0,void 0,(function*(){return Ti(e,t,r.walletId);}))),15e3,1e3),n({signer:r.signer,walletId:r.walletId,recoveryShare:null}),i.terminate();}))));i.postMessage({env:e.env,apiKey:e.apiKey,params:{userId:t},functionType:"ED25519_KEYGEN",disableWorkers:e.disableWorkers,sessionCookie:r,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}(e,t,r);}ed25519PreKeygen(e,t,r,n){return function(e,t,r,n){return new Promise((i=>Ii(this,void 0,void 0,(function*(){const a=yield $i(e,(n=>Ii(this,void 0,void 0,(function*(){yield wi((()=>Ii(this,void 0,void 0,(function*(){return Ai(e,t,r,n.walletId);}))),15e3,1e3),i({signer:n.signer,walletId:n.walletId,recoveryShare:null}),a.terminate();})))),s={pregenIdentifier:t,pregenIdentifierType:r,email:void 0};r===Xn.EMAIL&&(s.email=t),a.postMessage({env:e.env,apiKey:e.apiKey,params:s,functionType:"ED25519_PREKEYGEN",disableWorkers:e.disableWorkers,sessionCookie:n,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}(e,t,r,n);}ed25519Sign(e,t,r,n,i,a){return function(e,t,r,n,i,a){return ki(this,void 0,void 0,(function*(){return yield new Promise((s=>ki(this,void 0,void 0,(function*(){const o=yield $i(e,(e=>ki(this,void 0,void 0,(function*(){s(e),o.terminate();}))));o.postMessage({env:e.env,apiKey:e.apiKey,params:{share:n,walletId:r,userId:t,base64Bytes:i},functionType:"ED25519_SIGN",disableWorkers:e.disableWorkers,sessionCookie:a,disableWebSockets:e.disableWebSockets,wasmOverride:e.wasmOverride});}))));}));}(e,t,r,n,i,a);}openPopup(e){window.open(e,"popup","popup=true,width=400,height=500")||setTimeout((()=>{window.open(e,"_blank");}),0);}}const Ni=class extends hi{getPlatformUtils(){return new Ri;}};var Pi,Oi,Ui,_i,Li,Di=r(51365),xi=r(81898),Mi=r(62966),Ki=r(95535);!function(e){e.LIGHT="light",e.DARK="dark";}(Pi||(Pi={})),function(e){e.PENDING="PENDING",e.COMPLETE="COMPLETE";}(Oi||(Oi={})),function(e){e.MOBILE="MOBILE",e.WEB="WEB";}(Ui||(Ui={})),function(e){e.DKLS="DKLS",e.CGGMP="CGGMP",e.ED25519="ED25519";}(_i||(_i={})),function(e){e.EVM="EVM",e.SOLANA="SOLANA",e.COSMOS="COSMOS";}(Li||(Li={}));const ji=[_i.DKLS,_i.CGGMP];var Vi,Fi,Gi,Wi,qi,Hi;!function(e){e.ETH="ETH",e.CELO="CELO",e.MATIC="MATIC";}(Vi||(Vi={})),function(e){e.USER="USER",e.RECOVERY="RECOVERY",e.BIOMETRICS="BIOMETRICS";}(Fi||(Fi={})),function(e){e.ETHEREUM="ETHEREUM",e.ARBITRUM="ARBITRUM",e.BASE="BASE",e.OPTIMISM="OPTIMISM",e.POLYGON="POLYGON";}(Gi||(Gi={})),function(e){e.RAMP="RAMP",e.STRIPE="STRIPE";}(Wi||(Wi={})),function(e){e.ETHEREUM="ETHEREUM",e.USDC="USDC",e.POLYGON="POLYGON";}(qi||(qi={})),function(e){e.INITIATED="INITIATED",e.FINISHED="FINISHED",e.CANCELLED="CANCELLED";}(Hi||(Hi={})),r(11158);var zi=r(1048).Buffer;function Qi(e){return{r:`0x${e.slice(2,66)}`,s:`0x${e.slice(66,130)}`,v:BigInt(e.slice(130,132))};}function Yi(e){return e.startsWith("0x")&&(e=e.slice(2)),new Uint8Array(zi.from(e,"hex"));}var Xi=r(1048).Buffer,Ji=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};class Zi{constructor(e,t="cosmos",r){this.currentWalletId=e.findWalletId(r,{scheme:ji}),this.capsule=e,this.prefix=t;}get publicKey(){const e=Yi(this.capsule.wallets[this.currentWalletId].publicKey);return Mi.Secp256k1.compressPubkey(e);}get address(){return(0,xi.toBech32)(this.prefix,(0,Di.OB)(this.publicKey));}getAccounts(){return Ji(this,void 0,void 0,(function*(){return[{algo:"secp256k1",address:this.address,pubkey:this.publicKey}];}));}}class ea extends Zi{signDirect(e,t){return Ji(this,void 0,void 0,(function*(){const r=(0,Ki.makeSignBytes)(t);if(e!==this.address)throw new Error(`Address ${e} not found in wallet`);const n=(0,Mi.sha256)(r),i=Qi(`0x${(yield this.capsule.signMessage(this.currentWalletId,Xi.from(n.buffer).toString("base64"))).signature}`),a=new Mi.ExtendedSecp256k1Signature(Yi(i.r),Yi(i.s),Number(i.v)),s=new Uint8Array([...a.r(32),...a.s(32)]);return{signed:t,signature:(0,Di.Fs)(this.publicKey,s)};}));}}class ta extends Zi{signAmino(e,t){return Ji(this,void 0,void 0,(function*(){if(e!==this.address)throw new Error(`Address ${e} not found in wallet`);const r=new Mi.Sha256((0,Di._b)(t)).digest(),n=Qi(`0x${(yield this.capsule.signMessage(this.currentWalletId,Xi.from(r.buffer).toString("base64"))).signature}`),i=new Mi.ExtendedSecp256k1Signature(Yi(n.r),Yi(n.s),Number(n.v)),a=new Uint8Array([...i.r(32),...i.s(32)]);return{signed:t,signature:(0,Di.Fs)(this.publicKey,a)};}));}}var ra=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};const na={"phoenix-1":"terra","loyal-main-02":"loyal","empowerchain-1":"empower","kichain-2":"ki","neutron-1":"neutron","akashnet-2":"akash","pacific-1":"sei","quicksilver-2":"quick","injective-1":"inj","umee-1":"umee",darchub:"darc","secret-4":"secret","chihuahua-1":"chihuahua","osmosis-1":"osmo","passage-2":"pasg","agoric-3":"agoric","passage-1":"pasg","xstaxy-1":"aura","nois-1":"nois","crescent-1":"cre",nyx:"n","fetchhub-4":"fetch","noble-1":"noble","gravity-bridge-3":"gravity","bitsong-2b":"bitsong","dydx-mainnet-1":"dydx","cronosmainnet_25-1":"crc",celestia:"celestia","jackal-1":"jkl","pirin-1":"nolus","meme-1":"meme","dimension_37-1":"xpla","centauri-1":"centauri","mantle-1":"mantle","quasar-1":"quasar","evmos_9001-2":"evmos","planq_7070-2":"plq","sifchain-1":"sif","bitcanna-1":"bcna","eightball-1":"8ball",gitopia:"gitopia","lum-network-1":"lum","ununifi-beta-v1":"ununifi","canto_7700-1":"canto","archway-1":"archway","mars-1":"mars","teritori-1":"tori","migaloo-1":"migaloo","comdex-1":"comdex","omniflixhub-1":"omniflix","core-1":"persistence","shentu-2.2":"shentu","columbus-5":"terra","axelar-dojo-1":"axelar","stride-1":"stride","kaiyo-1":"kujira","cosmoshub-4":"cosmos","kava_2222-10":"kava","sommelier-3":"somm","crypto-org-chain-mainnet-1":"cro","stargaze-1":"stars","juno-1":"juno","theta-testnet-001":"cosmos","uni-5":"juno","osmo-test-5":"osmo","pulsar-2":"secret","constantine-3":"archway","axelar-testnet-lisbon-3":"axelar","carbon-1":"swth","perun-1":"c4e","babajaga-1":"c4e","cheqd-mainnet-1":"cheqd","coreum-mainnet-1":"core","coreum-testnet-1":"testcore","cudos-1":"cudos","mainnet-3":"decentr","desmos-mainnet":"desmos","dydx-testnet-1":"dydx","emoney-3":"emoney","circulus-1":"empower","injective-888":"inj","irishub-1":"iaa","ixo-5":"ixo","pandora-8":"ixo","kyve-1":"kyve","kaon-1":"kyve","likecoin-mainnet-2":"like","ares-1":"mars","mayachain-mainnet-v1":"maya","pion-1":"neutron","nibiru-itn-1":"nibi","grand-1":"noble","nolus-rila":"nolus","nomic-stakenet-3":"nomic","nomic-testnet-4d":"nomic","onomy-mainnet-1":"onomy","test-core-1":"persistence","planq_7000-4":"plq","qsr-questnet-04":"quasar","atlantic-1":"sei","atlantic-2":"sei","elgafar-1":"stars","iov-mainnet-ibc":"star"},ia=e=>ra(void 0,void 0,void 0,(function*(){return new Promise(((t,r)=>{var n,i;const a=null===(i=null===(n=Object.values(e.getWallets()))||void 0===n?void 0:n[0])||void 0===i?void 0:i.address;e.isSessionActive().then((n=>n&&a?t(!0):(window.successFromCapsuleModal=()=>{t(!0);},window.failureFromCapsuleModal=()=>{r();},window.openCapsuleModal?void window.openCapsuleModal(e):(console.log("Social login UI package missing."),void console.log("Consider adding @leapwallet/cosmos-social-login-capsule-provider-ui")))));}));})),aa=(e,t,r,n)=>ra(void 0,void 0,void 0,(function*(){if(!(yield e.isSessionActive()))throw yield ia(e),new Error("Wallet is not connected, please connect again");return yield new Promise(((i,a)=>{window.successFromTransactionSigningModal=a=>ra(void 0,void 0,void 0,(function*(){var s,o;console.log("params passed: ",a);const d=null===(o=Object.values(null!==(s=e.getWallets())&&void 0!==s?s:{}))||void 0===o?void 0:o[0],c=new ea(e,na[t],null==d?void 0:d.id),u=yield c.signDirect(r,n),l={signature:u.signature,signed:u.signed};i(l);})),window.failureFromTransactionSigningModal=e=>{a(e);},window.openTransactionSigningModal?window.openTransactionSigningModal(e,t,r,n):window.successFromTransactionSigningModal({capsule:e,chainId:t,signerAddress:r,signDoc:n});}));})),sa=(e,t)=>ra(void 0,void 0,void 0,(function*(){var r,n;const i=Object.values(null!==(r=null==e?void 0:e.getWallets())&&void 0!==r?r:{});if(i.length<1)throw yield ia(e),Error("Not possible");const a=new ea(e,na[t],null===(n=null==i?void 0:i[0])||void 0===n?void 0:n.id),s=(yield a.getAccounts())[0];if(!s)throw new Error("No account data found");return s;}));var oa=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};class da{constructor(e,t){this.chainId=e,this.capsule=t,this.chainId=e,this.capsule=t;}getAccounts(){return oa(this,void 0,void 0,(function*(){const e=yield sa(this.capsule,this.chainId);return[{address:e.address,algo:"secp256k1",pubkey:e.pubkey}];}));}signDirect(e,t){return oa(this,void 0,void 0,(function*(){if(this.chainId!==t.chainId)throw new Error("Chain ID does not match signer chain ID");const r=yield this.getAccounts();if(console.log("logging accounts",r),r.find((t=>t.address!==e)))throw new Error("Signer address does not match wallet address");return aa(this.capsule,this.chainId,e,t);}));}}const ca={name:"leap-capsule-social-login",prettyName:"Sign In with Email",logo:"https://leap-wallet-assets.s3.amazonaws.com/social-login/mail.svg",mode:"extension",mobileDisabled:!1,rejectMessage:{source:"Request rejected"},downloads:[{device:"desktop",browser:"chrome",link:"https://chrome.google.com/webstore/detail/metamask-flask-developmen/ljfoeinjpaedjfecbmggjgodbgkmjkjk"}],connectEventNamesOnWindow:["leap_keystorechange"]};var ua=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{d(n.next(e));}catch(e){a(e);}}function o(e){try{d(n.throw(e));}catch(e){a(e);}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(s,o);}d((n=n.apply(e,t||[])).next());}));};class la{constructor(e={}){var t;const r=e.env||Mt.BETA;window.capsule=new Ni(r,e.apiKey,null!==(t=e.opts)&&void 0!==t?t:{emailPrimaryColor:"#29a873",homepageUrl:"https://leapwallet.io",portalTheme:{backgroundColor:"#141414",foregroundColor:"#29a873",borderRadius:"sm"}});}getClient(){return window.capsule;}getKey(e){return ua(this,void 0,void 0,(function*(){return sa(window.capsule,e);}));}enable(){return ua(this,void 0,void 0,(function*(){return this.handleConnect();}));}disconnect(){return ua(this,void 0,void 0,(function*(){window.capsuleLogout?window.capsuleLogout():window.capsule.logout();}));}getSimpleAccount(e){return ua(this,void 0,void 0,(function*(){const{address:t,username:r}=yield this.getAccount(e);return{namespace:"cosmos",chainId:e,address:t,username:r};}));}handleConnect(){return ua(this,void 0,void 0,(function*(){yield ia(window.capsule);}));}connect(){return ua(this,void 0,void 0,(function*(){yield ia(window.capsule);}));}getAccount(e){return ua(this,void 0,void 0,(function*(){var t;yield this.handleConnect();const r=yield sa(window.capsule,e);return{username:null===(t=null===window||void 0===window?void 0:window.capsule)||void 0===t?void 0:t.getEmail(),address:r.address,algo:r.algo,pubkey:r.pubkey};}));}getOfflineSigner(e,t){switch(t){case"amino":default:return this.getOfflineSignerAmino(e);case"direct":return this.getOfflineSignerDirect(e);}}getOfflineSignerAmino(e){var t,r;const n=null===(r=Object.values(null===(t=window.capsule)||void 0===t?void 0:t.getWallets()))||void 0===r?void 0:r[0];return new ta(window.capsule,na[e],null==n?void 0:n.id);}getOfflineSignerDirect(e){return new da(e,window.capsule);}signAmino(e,t,r,n){return ua(this,void 0,void 0,(function*(){return((e,t,r,n)=>ra(void 0,void 0,void 0,(function*(){var i,a;if(!(yield e.isSessionActive()))throw yield ia(e),new Error("Wallet is not connected, please connect again");const s=null===(a=Object.values(null!==(i=e.getWallets())&&void 0!==i?i:{}))||void 0===a?void 0:a[0],o=new ta(e,na[t],null==s?void 0:s.id);return yield o.signAmino(r,n);})))(window.capsule,e,t,r);}));}signDirect(e,t,r){return ua(this,void 0,void 0,(function*(){return aa(window.capsule,e,t,r);}));}}},80321:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pubkeyToAddress=t.pubkeyToRawAddress=t.rawSecp256k1PubkeyToRawAddress=t.rawEd25519PubkeyToRawAddress=void 0;const n=r(14514),i=r(7574),a=r(43372),s=r(79918);function o(e){if(32!==e.length)throw new Error(`Invalid Ed25519 pubkey length: ${e.length}`);return(0,n.sha256)(e).slice(0,20);}function d(e){if(33!==e.length)throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${e.length}`);return(0,n.ripemd160)((0,n.sha256)(e));}function c(e){if((0,s.isSecp256k1Pubkey)(e))return d((0,i.fromBase64)(e.value));if((0,s.isEd25519Pubkey)(e))return o((0,i.fromBase64)(e.value));if((0,s.isMultisigThresholdPubkey)(e)){const t=(0,a.encodeAminoPubkey)(e);return(0,n.sha256)(t).slice(0,20);}throw new Error("Unsupported public key type");}t.rawEd25519PubkeyToRawAddress=o,t.rawSecp256k1PubkeyToRawAddress=d,t.pubkeyToRawAddress=c,t.pubkeyToAddress=function(e,t){return(0,i.toBech32)(t,c(e));};},33563:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addCoins=t.parseCoins=t.coins=t.coin=void 0;const n=r(31301);function i(e,t){let r;if("number"==typeof e)try{r=new n.Uint53(e).toString();}catch(e){throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers.");}else{if(!e.match(/^[0-9]+$/))throw new Error("Invalid unsigned integer string format");r=e.replace(/^0*/,"")||"0";}return{amount:r,denom:t};}t.coin=i,t.coins=function(e,t){return[i(e,t)];},t.parseCoins=function(e){return e.replace(/\s/g,"").split(",").filter(Boolean).map((e=>{const t=e.match(/^([0-9]+)([a-zA-Z]+)/);if(!t)throw new Error("Got an invalid coin string");return{amount:t[1].replace(/^0+/,"")||"0",denom:t[2]};}));},t.addCoins=function(e,t){if(e.denom!==t.denom)throw new Error("Trying to add two coins with different denoms");return{amount:n.Decimal.fromAtomics(e.amount,0).plus(n.Decimal.fromAtomics(t.amount,0)).atomics,denom:e.denom};};},43372:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.encodeBech32Pubkey=t.encodeAminoPubkey=t.decodeBech32Pubkey=t.decodeAminoPubkey=t.encodeEd25519Pubkey=t.encodeSecp256k1Pubkey=void 0;const n=r(7574),i=r(31301),a=r(11718),s=r(79918);t.encodeSecp256k1Pubkey=function(e){if(33!==e.length||2!==e[0]&&3!==e[0])throw new Error("Public key must be compressed secp256k1, i.e. 33 bytes starting with 0x02 or 0x03");return{type:s.pubkeyType.secp256k1,value:(0,n.toBase64)(e)};},t.encodeEd25519Pubkey=function(e){if(32!==e.length)throw new Error("Ed25519 public key must be 32 bytes long");return{type:s.pubkeyType.ed25519,value:(0,n.toBase64)(e)};};const o=(0,n.fromHex)("eb5ae98721"),d=(0,n.fromHex)("1624de6420"),c=(0,n.fromHex)("0dfb100520"),u=(0,n.fromHex)("22c1f7e2");function l(e){if((0,a.arrayContentStartsWith)(e,o)){const t=e.slice(o.length);if(33!==t.length)throw new Error("Invalid rest data length. Expected 33 bytes (compressed secp256k1 pubkey).");return{type:s.pubkeyType.secp256k1,value:(0,n.toBase64)(t)};}if((0,a.arrayContentStartsWith)(e,d)){const t=e.slice(d.length);if(32!==t.length)throw new Error("Invalid rest data length. Expected 32 bytes (Ed25519 pubkey).");return{type:s.pubkeyType.ed25519,value:(0,n.toBase64)(t)};}if((0,a.arrayContentStartsWith)(e,c)){const t=e.slice(c.length);if(32!==t.length)throw new Error("Invalid rest data length. Expected 32 bytes (Sr25519 pubkey).");return{type:s.pubkeyType.sr25519,value:(0,n.toBase64)(t)};}if((0,a.arrayContentStartsWith)(e,u))return function(e){const t=Array.from(e),r=t.splice(0,u.length);if(!(0,a.arrayContentStartsWith)(r,u))throw new Error("Invalid multisig prefix.");if(8!=t.shift())throw new Error("Invalid multisig data. Expecting 0x08 prefix before threshold.");const[n,i]=h(t);t.splice(0,i);const o=[];for(;t.length>0;){if(18!=t.shift())throw new Error("Invalid multisig data. Expecting 0x12 prefix before participant pubkey length.");const[e,r]=h(t);if(t.splice(0,r),t.length<e)throw new Error("Invalid multisig data length.");const n=t.splice(0,e),i=l(Uint8Array.from(n));o.push(i);}return{type:s.pubkeyType.multisigThreshold,value:{threshold:n.toString(),pubkeys:o}};}(e);throw new Error("Unsupported public key type. Amino data starts with: "+(0,n.toHex)(e.slice(0,5)));}function h(e){if(e.length<1)throw new Error("Can't decode varint. EOF");if(e[0]>127)throw new Error("Decoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.Varint implementation from the Go standard library and write some tests.");return[e[0],1];}function f(e){const t=i.Uint53.fromString(e.toString()).toNumber();if(t>127)throw new Error("Encoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.PutUvarint implementation from the Go standard library and write some tests.");return[t];}function p(e){if((0,s.isMultisigThresholdPubkey)(e)){const t=Array.from(u);t.push(8),t.push(...f(e.value.threshold));for(const r of e.value.pubkeys.map((e=>p(e))))t.push(18),t.push(...f(r.length)),t.push(...r);return new Uint8Array(t);}if((0,s.isEd25519Pubkey)(e))return new Uint8Array([...d,...(0,n.fromBase64)(e.value)]);if((0,s.isSecp256k1Pubkey)(e))return new Uint8Array([...o,...(0,n.fromBase64)(e.value)]);throw new Error("Unsupported pubkey type");}t.decodeAminoPubkey=l,t.decodeBech32Pubkey=function(e){const{data:t}=(0,n.fromBech32)(e);return l(t);},t.encodeAminoPubkey=p,t.encodeBech32Pubkey=function(e,t){return(0,n.toBech32)(t,p(e));};},51365:(e,t,r)=>{t._b=t.Fs=t.OB=void 0;var n=r(80321);Object.defineProperty(t,"OB",{enumerable:!0,get:function(){return n.rawSecp256k1PubkeyToRawAddress;}});r(33563),r(43372),r(5215),r(88325),r(79918),r(76936),r(33932);var i=r(6635);Object.defineProperty(t,"Fs",{enumerable:!0,get:function(){return i.encodeSecp256k1Signature;}});var a=r(11092);Object.defineProperty(t,"_b",{enumerable:!0,get:function(){return a.serializeSignDoc;}});r(89496),r(3508);},5215:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMultisigThresholdPubkey=t.compareArrays=void 0;const n=r(7574),i=r(31301),a=r(80321);function s(e,t){const r=(0,n.toHex)(e),i=(0,n.toHex)(t);return r===i?0:r<i?-1:1;}t.compareArrays=s,t.createMultisigThresholdPubkey=function(e,t,r=!1){const n=new i.Uint53(t);if(n.toNumber()>e.length)throw new Error(`Threshold k = ${n.toNumber()} exceeds number of keys n = ${e.length}`);const o=r?e:Array.from(e).sort(((e,t)=>s((0,a.pubkeyToRawAddress)(e),(0,a.pubkeyToRawAddress)(t))));return{type:"tendermint/PubKeyMultisigThreshold",value:{threshold:n.toString(),pubkeys:o}};};},88325:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeCosmoshubPath=void 0;const n=r(14514);t.makeCosmoshubPath=function(e){return[n.Slip10RawIndex.hardened(44),n.Slip10RawIndex.hardened(118),n.Slip10RawIndex.hardened(0),n.Slip10RawIndex.normal(0),n.Slip10RawIndex.normal(e)];};},79918:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isMultisigThresholdPubkey=t.isSinglePubkey=t.pubkeyType=t.isSecp256k1Pubkey=t.isEd25519Pubkey=void 0,t.isEd25519Pubkey=function(e){return"tendermint/PubKeyEd25519"===e.type;},t.isSecp256k1Pubkey=function(e){return"tendermint/PubKeySecp256k1"===e.type;},t.pubkeyType={secp256k1:"tendermint/PubKeySecp256k1",ed25519:"tendermint/PubKeyEd25519",sr25519:"tendermint/PubKeySr25519",multisigThreshold:"tendermint/PubKeyMultisigThreshold"},t.isSinglePubkey=function(e){return[t.pubkeyType.ed25519,t.pubkeyType.secp256k1,t.pubkeyType.sr25519].includes(e.type);},t.isMultisigThresholdPubkey=function(e){return"tendermint/PubKeyMultisigThreshold"===e.type;};},76936:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Secp256k1HdWallet=t.extractKdfConfiguration=void 0;const n=r(14514),i=r(7574),a=r(11718),s=r(80321),o=r(88325),d=r(6635),c=r(11092),u=r(3508),l="secp256k1wallet-v1",h={algorithm:"argon2id",params:{outputLength:32,opsLimit:24,memLimitKib:12288}};t.extractKdfConfiguration=function(e){const t=JSON.parse(e);if(!(0,a.isNonNullObject)(t))throw new Error("Root document is not an object.");if(t.type===l)return t.kdf;throw new Error("Unsupported serialization type");};const f={bip39Password:"",hdPaths:[(0,o.makeCosmoshubPath)(0)],prefix:"cosmos"};class p{static async fromMnemonic(e,t={}){const r=new n.EnglishMnemonic(e),i=await n.Bip39.mnemonicToSeed(r,t.bip39Password);return new p(r,{...t,seed:i});}static async generate(e=12,t={}){const r=4*Math.floor(11*e/33),i=n.Random.getBytes(r),a=n.Bip39.encode(i);return p.fromMnemonic(a.toString(),t);}static async deserialize(e,t){const r=JSON.parse(e);if(!(0,a.isNonNullObject)(r))throw new Error("Root document is not an object.");if(r.type===l)return p.deserializeTypeV1(e,t);throw new Error("Unsupported serialization type");}static async deserializeWithEncryptionKey(e,t){const r=JSON.parse(e);if(!(0,a.isNonNullObject)(r))throw new Error("Root document is not an object.");const s=r;if(s.type===l){const e=await(0,u.decrypt)((0,i.fromBase64)(s.data),t,s.encryption),r=JSON.parse((0,i.fromUtf8)(e)),{mnemonic:o,accounts:d}=r;if((0,a.assert)("string"==typeof o),!Array.isArray(d))throw new Error("Property 'accounts' is not an array");if(!d.every((e=>{return t=e,!!(0,a.isNonNullObject)(t)&&"string"==typeof t.hdPath&&"string"==typeof t.prefix;var t;})))throw new Error("Account is not in the correct format.");const c=d[0].prefix;if(!d.every((({prefix:e})=>e===c)))throw new Error("Accounts do not all have the same prefix");const l=d.map((({hdPath:e})=>(0,n.stringToPath)(e)));return p.fromMnemonic(o,{hdPaths:l,prefix:c});}throw new Error("Unsupported serialization type");}static async deserializeTypeV1(e,t){const r=JSON.parse(e);if(!(0,a.isNonNullObject)(r))throw new Error("Root document is not an object.");const n=await(0,u.executeKdf)(t,r.kdf);return p.deserializeWithEncryptionKey(e,n);}constructor(e,t){const r=t.hdPaths??f.hdPaths,n=t.prefix??f.prefix;this.secret=e,this.seed=t.seed,this.accounts=r.map((e=>({hdPath:e,prefix:n})));}get mnemonic(){return this.secret.toString();}async getAccounts(){return(await this.getAccountsWithPrivkeys()).map((({algo:e,pubkey:t,address:r})=>({algo:e,pubkey:t,address:r})));}async signAmino(e,t){const r=(await this.getAccountsWithPrivkeys()).find((({address:t})=>t===e));if(void 0===r)throw new Error(`Address ${e} not found in wallet`);const{privkey:i,pubkey:a}=r,s=(0,n.sha256)((0,c.serializeSignDoc)(t)),o=await n.Secp256k1.createSignature(s,i),u=new Uint8Array([...o.r(32),...o.s(32)]);return{signed:t,signature:(0,d.encodeSecp256k1Signature)(a,u)};}async serialize(e){const t=h,r=await(0,u.executeKdf)(e,t);return this.serializeWithEncryptionKey(r,t);}async serializeWithEncryptionKey(e,t){const r={mnemonic:this.mnemonic,accounts:this.accounts.map((({hdPath:e,prefix:t})=>({hdPath:(0,n.pathToString)(e),prefix:t})))},a=(0,i.toUtf8)(JSON.stringify(r)),s={algorithm:u.supportedAlgorithms.xchacha20poly1305Ietf},o=await(0,u.encrypt)(a,e,s),d={type:l,kdf:t,encryption:s,data:(0,i.toBase64)(o)};return JSON.stringify(d);}async getKeyPair(e){const{privkey:t}=n.Slip10.derivePath(n.Slip10Curve.Secp256k1,this.seed,e),{pubkey:r}=await n.Secp256k1.makeKeypair(t);return{privkey:t,pubkey:n.Secp256k1.compressPubkey(r)};}async getAccountsWithPrivkeys(){return Promise.all(this.accounts.map((async({hdPath:e,prefix:t})=>{const{privkey:r,pubkey:n}=await this.getKeyPair(e);return{algo:"secp256k1",privkey:r,pubkey:n,address:(0,i.toBech32)(t,(0,s.rawSecp256k1PubkeyToRawAddress)(n))};})));}}t.Secp256k1HdWallet=p;},33932:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Secp256k1Wallet=void 0;const n=r(14514),i=r(7574),a=r(80321),s=r(6635),o=r(11092);class d{static async fromKey(e,t="cosmos"){const r=(await n.Secp256k1.makeKeypair(e)).pubkey;return new d(e,n.Secp256k1.compressPubkey(r),t);}constructor(e,t,r){this.privkey=e,this.pubkey=t,this.prefix=r;}get address(){return(0,i.toBech32)(this.prefix,(0,a.rawSecp256k1PubkeyToRawAddress)(this.pubkey));}async getAccounts(){return[{algo:"secp256k1",address:this.address,pubkey:this.pubkey}];}async signAmino(e,t){if(e!==this.address)throw new Error(`Address ${e} not found in wallet`);const r=new n.Sha256((0,o.serializeSignDoc)(t)).digest(),i=await n.Secp256k1.createSignature(r,this.privkey),a=new Uint8Array([...i.r(32),...i.s(32)]);return{signed:t,signature:(0,s.encodeSecp256k1Signature)(this.pubkey,a)};}}t.Secp256k1Wallet=d;},6635:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeSignature=t.encodeSecp256k1Signature=void 0;const n=r(7574),i=r(43372),a=r(79918);t.encodeSecp256k1Signature=function(e,t){if(64!==t.length)throw new Error("Signature must be 64 bytes long. Cosmos SDK uses a 2x32 byte fixed length encoding for the secp256k1 signature integers r and s.");return{pub_key:(0,i.encodeSecp256k1Pubkey)(e),signature:(0,n.toBase64)(t)};},t.decodeSignature=function(e){if(e.pub_key.type===a.pubkeyType.secp256k1)return{pubkey:(0,n.fromBase64)(e.pub_key.value),signature:(0,n.fromBase64)(e.signature)};throw new Error("Unsupported pubkey type");};},11092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.serializeSignDoc=t.escapeCharacters=t.makeSignDoc=t.sortedJsonStringify=void 0;const n=r(7574),i=r(31301);function a(e){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return e.map(a);const t=Object.keys(e).sort(),r={};return t.forEach((t=>{r[t]=a(e[t]);})),r;}function s(e){return JSON.stringify(a(e));}function o(e){return e.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e");}t.sortedJsonStringify=s,t.makeSignDoc=function(e,t,r,n,a,s){return{chain_id:r,account_number:i.Uint53.fromString(a.toString()).toString(),sequence:i.Uint53.fromString(s.toString()).toString(),fee:t,msgs:e,memo:n||""};},t.escapeCharacters=o,t.serializeSignDoc=function(e){const t=o(s(e));return(0,n.toUtf8)(t);};},89496:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeStdTx=t.isStdTx=void 0,t.isStdTx=function(e){const{memo:t,msg:r,fee:n,signatures:i}=e;return"string"==typeof t&&Array.isArray(r)&&"object"==typeof n&&Array.isArray(i);},t.makeStdTx=function(e,t){return{msg:e.msgs,fee:e.fee,memo:e.memo,signatures:Array.isArray(t)?t:[t]};};},3508:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=t.supportedAlgorithms=t.executeKdf=t.cosmjsSalt=void 0;const n=r(14514),i=r(7574);t.cosmjsSalt=(0,i.toAscii)("The CosmJS salt."),t.executeKdf=async function(e,r){if("argon2id"===r.algorithm){const i=r.params;if(!(0,n.isArgon2idOptions)(i))throw new Error("Invalid format of argon2id params");return n.Argon2id.execute(e,t.cosmjsSalt,i);}throw new Error("Unsupported KDF algorithm");},t.supportedAlgorithms={xchacha20poly1305Ietf:"xchacha20poly1305-ietf"},t.encrypt=async function(e,r,i){if(i.algorithm===t.supportedAlgorithms.xchacha20poly1305Ietf){const t=n.Random.getBytes(n.xchacha20NonceLength);return new Uint8Array([...t,...await n.Xchacha20poly1305Ietf.encrypt(e,r,t)]);}throw new Error(`Unsupported encryption algorithm: '${i.algorithm}'`);},t.decrypt=async function(e,r,i){if(i.algorithm===t.supportedAlgorithms.xchacha20poly1305Ietf){const t=e.slice(0,n.xchacha20NonceLength);return n.Xchacha20poly1305Ietf.decrypt(e.slice(n.xchacha20NonceLength),r,t);}throw new Error(`Unsupported encryption algorithm: '${i.algorithm}'`);};},841:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Bip39=t.EnglishMnemonic=t.mnemonicToEntropy=t.entropyToMnemonic=void 0;const n=r(7574),i=r(20361),a=r(76552),s=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];function o(e){return Array.from(e).map((e=>e.toString(2).padStart(8,"0"))).join("");}function d(e){const t=8*e.length/32;return o((0,a.sha256)(e)).slice(0,t);}function c(e){return parseInt(e,2);}const u=[16,20,24,28,32],l=[12,15,18,21,24];function h(e){if(-1===u.indexOf(e.length))throw new Error("invalid input length");return(o(e)+d(e)).match(/(.{11})/g).map((e=>{const t=c(e);return s[t];})).join(" ");}function f(e){return e.normalize("NFKD");}function p(e){const t=f(e).split(" ");if(!l.includes(t.length))throw new Error("Invalid number of words");const r=t.map((e=>{const t=s.indexOf(e);if(-1===t)throw new Error("Found word that is not in the wordlist");return t.toString(2).padStart(11,"0");})).join(""),n=32*Math.floor(r.length/33),i=r.slice(0,n),a=r.slice(n),o=i.match(/(.{1,8})/g).map(c);if(o.length<16||o.length>32||o.length%4!=0)throw new Error("Invalid entropy");const u=Uint8Array.from(o);if(d(u)!==a)throw new Error("Invalid mnemonic checksum");return u;}t.entropyToMnemonic=h,t.mnemonicToEntropy=p;class y{constructor(e){if(!y.mnemonicMatcher.test(e))throw new Error("Invalid mnemonic format");const t=e.split(" "),r=[12,15,18,21,24];if(-1===r.indexOf(t.length))throw new Error(`Invalid word count in mnemonic (allowed: ${r} got: ${t.length})`);for(const e of t)if(-1===y.wordlist.indexOf(e))throw new Error("Mnemonic contains invalid word");p(e),this.data=e;}toString(){return this.data;}}t.EnglishMnemonic=y,y.wordlist=s,y.mnemonicMatcher=/^[a-z]+( [a-z]+)*$/,t.Bip39=class{static encode(e){return new y(h(e));}static decode(e){return p(e.toString());}static async mnemonicToSeed(e,t){const r=(0,n.toUtf8)(f(e.toString())),a="mnemonic"+(t?f(t):""),s=(0,n.toUtf8)(a);return(0,i.pbkdf2Sha512)(r,s,2048,64);}};},79507:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Hmac=void 0,t.Hmac=class{constructor(e,t){const r=(new e).blockSize;this.hash=t=>(new e).update(t).digest();let n=t;if(n.length>r&&(n=this.hash(n)),n.length<r){const e=new Uint8Array(r-n.length);n=new Uint8Array([...n,...e]);}this.oKeyPad=n.map((e=>92^e)),this.iKeyPad=n.map((e=>54^e)),this.messageHasher=new e,this.blockSize=r,this.update(this.iKeyPad);}update(e){return this.messageHasher.update(e),this;}digest(){const e=this.messageHasher.digest();return this.hash(new Uint8Array([...this.oKeyPad,...e]));}};},14514:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.stringToPath=t.Slip10RawIndex=t.slip10CurveFromString=t.Slip10Curve=t.Slip10=t.pathToString=t.sha512=t.Sha512=t.sha256=t.Sha256=t.Secp256k1Signature=t.ExtendedSecp256k1Signature=t.Secp256k1=t.ripemd160=t.Ripemd160=t.Random=t.Xchacha20poly1305Ietf=t.xchacha20NonceLength=t.isArgon2idOptions=t.Ed25519Keypair=t.Ed25519=t.Argon2id=t.keccak256=t.Keccak256=t.Hmac=t.EnglishMnemonic=t.Bip39=void 0;var n=r(841);Object.defineProperty(t,"Bip39",{enumerable:!0,get:function(){return n.Bip39;}}),Object.defineProperty(t,"EnglishMnemonic",{enumerable:!0,get:function(){return n.EnglishMnemonic;}});var i=r(79507);Object.defineProperty(t,"Hmac",{enumerable:!0,get:function(){return i.Hmac;}});var a=r(90598);Object.defineProperty(t,"Keccak256",{enumerable:!0,get:function(){return a.Keccak256;}}),Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return a.keccak256;}});var s=r(43438);Object.defineProperty(t,"Argon2id",{enumerable:!0,get:function(){return s.Argon2id;}}),Object.defineProperty(t,"Ed25519",{enumerable:!0,get:function(){return s.Ed25519;}}),Object.defineProperty(t,"Ed25519Keypair",{enumerable:!0,get:function(){return s.Ed25519Keypair;}}),Object.defineProperty(t,"isArgon2idOptions",{enumerable:!0,get:function(){return s.isArgon2idOptions;}}),Object.defineProperty(t,"xchacha20NonceLength",{enumerable:!0,get:function(){return s.xchacha20NonceLength;}}),Object.defineProperty(t,"Xchacha20poly1305Ietf",{enumerable:!0,get:function(){return s.Xchacha20poly1305Ietf;}});var o=r(22219);Object.defineProperty(t,"Random",{enumerable:!0,get:function(){return o.Random;}});var d=r(43803);Object.defineProperty(t,"Ripemd160",{enumerable:!0,get:function(){return d.Ripemd160;}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return d.ripemd160;}});var c=r(60270);Object.defineProperty(t,"Secp256k1",{enumerable:!0,get:function(){return c.Secp256k1;}});var u=r(72998);Object.defineProperty(t,"ExtendedSecp256k1Signature",{enumerable:!0,get:function(){return u.ExtendedSecp256k1Signature;}}),Object.defineProperty(t,"Secp256k1Signature",{enumerable:!0,get:function(){return u.Secp256k1Signature;}});var l=r(76552);Object.defineProperty(t,"Sha256",{enumerable:!0,get:function(){return l.Sha256;}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return l.sha256;}}),Object.defineProperty(t,"Sha512",{enumerable:!0,get:function(){return l.Sha512;}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return l.sha512;}});var h=r(40771);Object.defineProperty(t,"pathToString",{enumerable:!0,get:function(){return h.pathToString;}}),Object.defineProperty(t,"Slip10",{enumerable:!0,get:function(){return h.Slip10;}}),Object.defineProperty(t,"Slip10Curve",{enumerable:!0,get:function(){return h.Slip10Curve;}}),Object.defineProperty(t,"slip10CurveFromString",{enumerable:!0,get:function(){return h.slip10CurveFromString;}}),Object.defineProperty(t,"Slip10RawIndex",{enumerable:!0,get:function(){return h.Slip10RawIndex;}}),Object.defineProperty(t,"stringToPath",{enumerable:!0,get:function(){return h.stringToPath;}});},90598:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.keccak256=t.Keccak256=void 0;const n=r(70448),i=r(57139);class a{constructor(e){this.blockSize=64,this.impl=n.keccak_256.create(),e&&this.update(e);}update(e){return this.impl.update((0,i.toRealUint8Array)(e)),this;}digest(){return this.impl.digest();}}t.Keccak256=a,t.keccak256=function(e){return new a(e).digest();};},43438:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e};};Object.defineProperty(t,"__esModule",{value:!0}),t.Xchacha20poly1305Ietf=t.xchacha20NonceLength=t.Ed25519=t.Ed25519Keypair=t.Argon2id=t.isArgon2idOptions=void 0;const i=r(11718),a=n(r(86323));t.isArgon2idOptions=function(e){return!!(0,i.isNonNullObject)(e)&&"number"==typeof e.outputLength&&"number"==typeof e.opsLimit&&"number"==typeof e.memLimitKib;},t.Argon2id=class{static async execute(e,t,r){return await a.default.ready,a.default.crypto_pwhash(r.outputLength,e,t,r.opsLimit,1024*r.memLimitKib,a.default.crypto_pwhash_ALG_ARGON2ID13);}};class s{static fromLibsodiumPrivkey(e){if(64!==e.length)throw new Error(`Unexpected key length ${e.length}. Must be 64.`);return new s(e.slice(0,32),e.slice(32,64));}constructor(e,t){this.privkey=e,this.pubkey=t;}toLibsodiumPrivkey(){return new Uint8Array([...this.privkey,...this.pubkey]);}}t.Ed25519Keypair=s,t.Ed25519=class{static async makeKeypair(e){await a.default.ready;const t=a.default.crypto_sign_seed_keypair(e);return s.fromLibsodiumPrivkey(t.privateKey);}static async createSignature(e,t){return await a.default.ready,a.default.crypto_sign_detached(e,t.toLibsodiumPrivkey());}static async verifySignature(e,t,r){return await a.default.ready,a.default.crypto_sign_verify_detached(e,t,r);}},t.xchacha20NonceLength=24,t.Xchacha20poly1305Ietf=class{static async encrypt(e,t,r){return await a.default.ready,a.default.crypto_aead_xchacha20poly1305_ietf_encrypt(e,null,null,r,t);}static async decrypt(e,t,r){return await a.default.ready,a.default.crypto_aead_xchacha20poly1305_ietf_decrypt(null,e,null,r,t);}};},20361:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r];}}),Object.defineProperty(e,n,i);}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r];}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t});}:function(e,t){e.default=t;}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t;};Object.defineProperty(t,"__esModule",{value:!0}),t.pbkdf2Sha512=t.pbkdf2Sha512Noble=t.pbkdf2Sha512NodeCrypto=t.pbkdf2Sha512Subtle=t.getSubtle=t.getNodeCrypto=void 0;const s=r(11718),o=r(57154),d=r(64989);async function c(){try{const e=await Promise.resolve().then((()=>a(r(10328))));if("object"==typeof e&&Object.keys(e).length<=1)return;return e;}catch{return;}}async function u(){let e=globalThis?.crypto?.subtle;return e||(e=globalThis?.crypto?.webcrypto?.subtle),e;}async function l(e,t,r,n,i){return(0,s.assert)(e,"Argument subtle is falsy"),(0,s.assert)("object"==typeof e,"Argument subtle is not of type object"),(0,s.assert)("function"==typeof e.importKey,"subtle.importKey is not a function"),(0,s.assert)("function"==typeof e.deriveBits,"subtle.deriveBits is not a function"),e.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((t=>e.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:{name:"SHA-512"}},t,8*i).then((e=>new Uint8Array(e)))));}async function h(e,t,r,n,i){return(0,s.assert)(e,"Argument nodeCrypto is falsy"),(0,s.assert)("object"==typeof e,"Argument nodeCrypto is not of type object"),(0,s.assert)("function"==typeof e.pbkdf2,"nodeCrypto.pbkdf2 is not a function"),new Promise(((a,s)=>{e.pbkdf2(t,r,n,i,"sha512",((e,t)=>{e?s(e):a(Uint8Array.from(t));}));}));}async function f(e,t,r,n){return(0,o.pbkdf2Async)(d.sha512,e,t,{c:r,dkLen:n});}t.getNodeCrypto=c,t.getSubtle=u,t.pbkdf2Sha512Subtle=l,t.pbkdf2Sha512NodeCrypto=h,t.pbkdf2Sha512Noble=f,t.pbkdf2Sha512=async function(e,t,r,n){const i=await u();if(i)return l(i,e,t,r,n);{const i=await c();return i?h(i,e,t,r,n):f(e,t,r,n);}};},22219:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Random=void 0,t.Random=class{static getBytes(e){try{const t="object"==typeof window?window:self,r=void 0!==t.crypto?t.crypto:t.msCrypto,n=new Uint8Array(e);return r.getRandomValues(n),n;}catch{try{const t=r(10328);return new Uint8Array([...t.randomBytes(e)]);}catch{throw new Error("No secure random number generator found");}}}};},43803:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.Ripemd160=void 0;const n=r(10071),i=r(57139);class a{constructor(e){this.blockSize=64,this.impl=n.ripemd160.create(),e&&this.update(e);}update(e){return this.impl.update((0,i.toRealUint8Array)(e)),this;}digest(){return this.impl.digest();}}t.Ripemd160=a,t.ripemd160=function(e){return new a(e).digest();};},60270:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e};};Object.defineProperty(t,"__esModule",{value:!0}),t.Secp256k1=void 0;const i=r(7574),a=n(r(82823)),s=n(r(13360)),o=r(72998),d=new s.default.ec("secp256k1"),c=new a.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex");t.Secp256k1=class{static async makeKeypair(e){if(32!==e.length)throw new Error("input data is not a valid secp256k1 private key");const t=d.keyFromPrivate(e);if(!0!==t.validate().result)throw new Error("input data is not a valid secp256k1 private key");if(new a.default(e).gte(c))throw new Error("input data is not a valid secp256k1 private key");return{privkey:(0,i.fromHex)(t.getPrivate("hex")),pubkey:Uint8Array.from(t.getPublic("array"))};}static async createSignature(e,t){if(0===e.length)throw new Error("Message hash must not be empty");if(e.length>32)throw new Error("Message hash length must not exceed 32 bytes");const r=d.keyFromPrivate(t),{r:n,s:i,recoveryParam:a}=r.sign(e,{canonical:!0});if("number"!=typeof a)throw new Error("Recovery param missing");return new o.ExtendedSecp256k1Signature(Uint8Array.from(n.toArray()),Uint8Array.from(i.toArray()),a);}static async verifySignature(e,t,r){if(0===t.length)throw new Error("Message hash must not be empty");if(t.length>32)throw new Error("Message hash length must not exceed 32 bytes");const n=d.keyFromPublic(r);try{return n.verify(t,e.toDer());}catch(e){return!1;}}static recoverPubkey(e,t){const r={r:(0,i.toHex)(e.r()),s:(0,i.toHex)(e.s())},n=d.recoverPubKey(t,r,e.recovery),a=d.keyFromPublic(n);return(0,i.fromHex)(a.getPublic(!1,"hex"));}static compressPubkey(e){switch(e.length){case 33:return e;case 65:return Uint8Array.from(d.keyFromPublic(e).getPublic(!0,"array"));default:throw new Error("Invalid pubkey length");}}static uncompressPubkey(e){switch(e.length){case 33:return Uint8Array.from(d.keyFromPublic(e).getPublic(!1,"array"));case 65:return e;default:throw new Error("Invalid pubkey length");}}static trimRecoveryByte(e){switch(e.length){case 64:return e;case 65:return e.slice(0,64);default:throw new Error("Invalid signature length");}}};},72998:(e,t)=>{function r(e){let t=0;for(const r of e){if(0!==r)break;t++;}return e.slice(t);}Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedSecp256k1Signature=t.Secp256k1Signature=void 0;class n{static fromFixedLength(e){if(64!==e.length)throw new Error(`Got invalid data length: ${e.length}. Expected 2x 32 bytes for the pair (r, s)`);return new n(r(e.slice(0,32)),r(e.slice(32,64)));}static fromDer(e){let t=0;if(48!==e[t++])throw new Error("Prefix 0x30 expected");const i=e[t++];if(e.length-t!==i)throw new Error("Data length mismatch detected");if(2!==e[t++])throw new Error("INTEGER tag expected");const a=e[t++];if(a>=128)throw new Error("Decoding length values above 127 not supported");const s=e.slice(t,t+a);if(t+=a,2!==e[t++])throw new Error("INTEGER tag expected");const o=e[t++];if(o>=128)throw new Error("Decoding length values above 127 not supported");const d=e.slice(t,t+o);return t+=o,new n(r(s),r(d));}constructor(e,t){if(e.length>32||0===e.length||0===e[0])throw new Error("Unsigned integer r must be encoded as unpadded big endian.");if(t.length>32||0===t.length||0===t[0])throw new Error("Unsigned integer s must be encoded as unpadded big endian.");this.data={r:e,s:t};}r(e){if(void 0===e)return this.data.r;{const t=e-this.data.r.length;if(t<0)throw new Error("Length too small to hold parameter r");const r=new Uint8Array(t);return new Uint8Array([...r,...this.data.r]);}}s(e){if(void 0===e)return this.data.s;{const t=e-this.data.s.length;if(t<0)throw new Error("Length too small to hold parameter s");const r=new Uint8Array(t);return new Uint8Array([...r,...this.data.s]);}}toFixedLength(){return new Uint8Array([...this.r(32),...this.s(32)]);}toDer(){const e=this.data.r[0]>=128?new Uint8Array([0,...this.data.r]):this.data.r,t=this.data.s[0]>=128?new Uint8Array([0,...this.data.s]):this.data.s,r=e.length,n=t.length,i=new Uint8Array([2,r,...e,2,n,...t]);return new Uint8Array([48,i.length,...i]);}}t.Secp256k1Signature=n;class i extends n{static fromFixedLength(e){if(65!==e.length)throw new Error(`Got invalid data length ${e.length}. Expected 32 + 32 + 1`);return new i(r(e.slice(0,32)),r(e.slice(32,64)),e[64]);}constructor(e,t,r){if(super(e,t),!Number.isInteger(r))throw new Error("The recovery parameter must be an integer.");if(r<0||r>4)throw new Error("The recovery parameter must be one of 0, 1, 2, 3.");this.recovery=r;}toFixedLength(){return new Uint8Array([...this.r(32),...this.s(32),this.recovery]);}}t.ExtendedSecp256k1Signature=i;},76552:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha512=t.Sha512=t.sha256=t.Sha256=void 0;const n=r(79688),i=r(64989),a=r(57139);class s{constructor(e){this.blockSize=64,this.impl=n.sha256.create(),e&&this.update(e);}update(e){return this.impl.update((0,a.toRealUint8Array)(e)),this;}digest(){return this.impl.digest();}}t.Sha256=s,t.sha256=function(e){return new s(e).digest();};class o{constructor(e){this.blockSize=128,this.impl=i.sha512.create(),e&&this.update(e);}update(e){return this.impl.update((0,a.toRealUint8Array)(e)),this;}digest(){return this.impl.digest();}}t.Sha512=o,t.sha512=function(e){return new o(e).digest();};},40771:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e};};Object.defineProperty(t,"__esModule",{value:!0}),t.stringToPath=t.pathToString=t.Slip10=t.Slip10RawIndex=t.slip10CurveFromString=t.Slip10Curve=void 0;const i=r(7574),a=r(31301),s=n(r(82823)),o=n(r(13360)),d=r(79507),c=r(76552);var u;!function(e){e.Secp256k1="Bitcoin seed",e.Ed25519="ed25519 seed";}(u=t.Slip10Curve||(t.Slip10Curve={})),t.slip10CurveFromString=function(e){switch(e){case u.Ed25519:return u.Ed25519;case u.Secp256k1:return u.Secp256k1;default:throw new Error(`Unknown curve string: '${e}'`);}};class l extends a.Uint32{static hardened(e){return new l(e+2**31);}static normal(e){return new l(e);}isHardened(){return this.data>=2**31;}}t.Slip10RawIndex=l;const h=new o.default.ec("secp256k1");class f{static derivePath(e,t,r){let n=this.master(e,t);for(const t of r)n=this.child(e,n.privkey,n.chainCode,t);return n;}static master(e,t){const r=new d.Hmac(c.Sha512,(0,i.toAscii)(e)).update(t).digest(),n=r.slice(0,32),a=r.slice(32,64);return e!==u.Ed25519&&(this.isZero(n)||this.isGteN(e,n))?this.master(e,r):{chainCode:a,privkey:n};}static child(e,t,r,n){let i;if(n.isHardened()){const e=new Uint8Array([0,...t,...n.toBytesBigEndian()]);i=new d.Hmac(c.Sha512,r).update(e).digest();}else{if(e===u.Ed25519)throw new Error("Normal keys are not allowed with ed25519");{const a=new Uint8Array([...f.serializedPoint(e,new s.default(t)),...n.toBytesBigEndian()]);i=new d.Hmac(c.Sha512,r).update(a).digest();}}return this.childImpl(e,t,r,n,i);}static serializedPoint(e,t){if(e===u.Secp256k1)return(0,i.fromHex)(h.g.mul(t).encodeCompressed("hex"));throw new Error("curve not supported");}static childImpl(e,t,r,n,i){const a=i.slice(0,32),o=i.slice(32,64),l=o;if(e===u.Ed25519)return{chainCode:l,privkey:a};const h=this.n(e),f=new s.default(a).add(new s.default(t)).mod(h),p=Uint8Array.from(f.toArray("be",32));if(this.isGteN(e,a)||this.isZero(p)){const i=new d.Hmac(c.Sha512,r).update(new Uint8Array([1,...o,...n.toBytesBigEndian()])).digest();return this.childImpl(e,t,r,n,i);}return{chainCode:l,privkey:p};}static isZero(e){return e.every((e=>0===e));}static isGteN(e,t){return new s.default(t).gte(this.n(e));}static n(e){if(e===u.Secp256k1)return new s.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",16);throw new Error("curve not supported");}}t.Slip10=f,t.pathToString=function(e){return e.reduce(((e,t)=>e+"/"+(t.isHardened()?t.toNumber()-2**31+"'":t.toString())),"m");},t.stringToPath=function(e){if(!e.startsWith("m"))throw new Error("Path string must start with 'm'");let t=e.slice(1);const r=[];for(;t;){const e=t.match(/^\/([0-9]+)('?)/);if(!e)throw new Error("Syntax error while reading path component");const[n,i,s]=e,o=a.Uint53.fromString(i).toNumber();if(o>=2**31)throw new Error("Component value too high. Must not exceed 2**31-1.");s?r.push(l.hardened(o)):r.push(l.normal(o)),t=t.slice(n.length);}return r;};},57139:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRealUint8Array=void 0,t.toRealUint8Array=function(e){return e instanceof Uint8Array?e:Uint8Array.from(e);};},89809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromAscii=t.toAscii=void 0,t.toAscii=function(e){return Uint8Array.from(e.split("").map((e=>{const t=e.charCodeAt(0);if(t<32||t>126)throw new Error("Cannot encode character that is out of printable ASCII range: "+t);return t;})));},t.fromAscii=function(e){return(t=Array.from(e),t.map((e=>{if(e<32||e>126)throw new Error("Cannot decode character that is out of printable ASCII range: "+e);return String.fromCharCode(e);}))).join("");var t;};},97919:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r];}}),Object.defineProperty(e,n,i);}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r];}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t});}:function(e,t){e.default=t;}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t;};Object.defineProperty(t,"__esModule",{value:!0}),t.fromBase64=t.toBase64=void 0;const s=a(r(7991));t.toBase64=function(e){return s.fromByteArray(e);},t.fromBase64=function(e){if(!e.match(/^[a-zA-Z0-9+/]*={0,2}$/))throw new Error("Invalid base64 string format");return s.toByteArray(e);};},28967:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r];}}),Object.defineProperty(e,n,i);}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r];}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t});}:function(e,t){e.default=t;}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t;};Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeBech32=t.fromBech32=t.toBech32=void 0;const s=a(r(68993));function o(e,t,r){return s.encode(e,s.toWords(t),r);}function d(e,t=1/0){const r=s.decode(e,t);return{prefix:r.prefix,data:new Uint8Array(s.fromWords(r.words))};}t.toBech32=o,t.fromBech32=d,t.normalizeBech32=function(e){const{prefix:t,data:r}=d(e);return o(t,r);};},49863:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromHex=t.toHex=void 0,t.toHex=function(e){let t="";for(const r of e)t+=("0"+r.toString(16)).slice(-2);return t;},t.fromHex=function(e){if(e.length%2!=0)throw new Error("hex string length must be a multiple of 2");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2);if(!i.match(/[0-9a-f]{2}/i))throw new Error("hex string contains invalid characters");t[r]=parseInt(i,16);}return t;};},7574:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toUtf8=t.fromUtf8=t.toRfc3339=t.fromRfc3339=t.toHex=t.fromHex=t.toBech32=t.normalizeBech32=t.fromBech32=t.toBase64=t.fromBase64=t.toAscii=t.fromAscii=void 0;var n=r(89809);Object.defineProperty(t,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii;}}),Object.defineProperty(t,"toAscii",{enumerable:!0,get:function(){return n.toAscii;}});var i=r(97919);Object.defineProperty(t,"fromBase64",{enumerable:!0,get:function(){return i.fromBase64;}}),Object.defineProperty(t,"toBase64",{enumerable:!0,get:function(){return i.toBase64;}});var a=r(28967);Object.defineProperty(t,"fromBech32",{enumerable:!0,get:function(){return a.fromBech32;}}),Object.defineProperty(t,"normalizeBech32",{enumerable:!0,get:function(){return a.normalizeBech32;}}),Object.defineProperty(t,"toBech32",{enumerable:!0,get:function(){return a.toBech32;}});var s=r(49863);Object.defineProperty(t,"fromHex",{enumerable:!0,get:function(){return s.fromHex;}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return s.toHex;}});var o=r(15165);Object.defineProperty(t,"fromRfc3339",{enumerable:!0,get:function(){return o.fromRfc3339;}}),Object.defineProperty(t,"toRfc3339",{enumerable:!0,get:function(){return o.toRfc3339;}});var d=r(5975);Object.defineProperty(t,"fromUtf8",{enumerable:!0,get:function(){return d.fromUtf8;}}),Object.defineProperty(t,"toUtf8",{enumerable:!0,get:function(){return d.toUtf8;}});},15165:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRfc3339=t.fromRfc3339=void 0;const r=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/;function n(e,t=2){return e.toString().padStart(t,"0");}t.fromRfc3339=function(e){const t=r.exec(e);if(!t)throw new Error("Date string is not in RFC3339 format");const n=+t[1],i=+t[2],a=+t[3],s=+t[4],o=+t[5],d=+t[6],c=t[7]?Math.floor(1e3*+t[7]):0;let u,l,h;"Z"===t[8]?(u=1,l=0,h=0):(u="-"===t[8].substring(0,1)?-1:1,l=+t[8].substring(1,3),h=+t[8].substring(4,6));const f=u*(60*l+h)*60,p=Date.UTC(n,i-1,a,s,o,d,c)-1e3*f;return new Date(p);},t.toRfc3339=function(e){return`${e.getUTCFullYear()}-${n(e.getUTCMonth()+1)}-${n(e.getUTCDate())}T${n(e.getUTCHours())}:${n(e.getUTCMinutes())}:${n(e.getUTCSeconds())}.${n(e.getUTCMilliseconds(),3)}Z`;};},5975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromUtf8=t.toUtf8=void 0,t.toUtf8=function(e){return(new TextEncoder).encode(e);},t.fromUtf8=function(e,t=!1){return new TextDecoder("utf-8",{fatal:!t}).decode(e);};},76950:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e};};Object.defineProperty(t,"__esModule",{value:!0}),t.Decimal=void 0;const i=n(r(82823));class a{static fromUserInput(e,t){a.verifyFractionalDigits(t);const r=e.match(/[^0-9.]/);if(r)throw new Error(`Invalid character at position ${r.index+1}`);let n,i;if(""===e)n="0",i="";else if(-1===e.search(/\./))n=e,i="";else{const t=e.split(".");switch(t.length){case 0:case 1:throw new Error("Fewer than two elements in split result. This must not happen here.");case 2:if(!t[1])throw new Error("Fractional part missing");n=t[0],i=t[1].replace(/0+$/,"");break;default:throw new Error("More than one separator found");}}if(i.length>t)throw new Error("Got more fractional digits than supported");const s=`${n}${i.padEnd(t,"0")}`;return new a(s,t);}static fromAtomics(e,t){return a.verifyFractionalDigits(t),new a(e,t);}static zero(e){return a.verifyFractionalDigits(e),new a("0",e);}static one(e){return a.verifyFractionalDigits(e),new a("1"+"0".repeat(e),e);}static verifyFractionalDigits(e){if(!Number.isInteger(e))throw new Error("Fractional digits is not an integer");if(e<0)throw new Error("Fractional digits must not be negative");if(e>100)throw new Error("Fractional digits must not exceed 100");}static compare(e,t){if(e.fractionalDigits!==t.fractionalDigits)throw new Error("Fractional digits do not match");return e.data.atomics.cmp(new i.default(t.atomics));}get atomics(){return this.data.atomics.toString();}get fractionalDigits(){return this.data.fractionalDigits;}constructor(e,t){if(!e.match(/^[0-9]+$/))throw new Error("Invalid string format. Only non-negative integers in decimal representation supported.");this.data={atomics:new i.default(e),fractionalDigits:t};}clone(){return new a(this.atomics,this.fractionalDigits);}floor(){const e=new i.default(10).pow(new i.default(this.data.fractionalDigits)),t=this.data.atomics.div(e);return this.data.atomics.mod(e).isZero()?this.clone():a.fromAtomics(t.mul(e).toString(),this.fractionalDigits);}ceil(){const e=new i.default(10).pow(new i.default(this.data.fractionalDigits)),t=this.data.atomics.div(e);return this.data.atomics.mod(e).isZero()?this.clone():a.fromAtomics(t.addn(1).mul(e).toString(),this.fractionalDigits);}toString(){const e=new i.default(10).pow(new i.default(this.data.fractionalDigits)),t=this.data.atomics.div(e),r=this.data.atomics.mod(e);if(r.isZero())return t.toString();{const e=r.toString().padStart(this.data.fractionalDigits,"0").replace(/0+$/,"");return`${t.toString()}.${e}`;}}toFloatApproximation(){const e=Number(this.toString());if(Number.isNaN(e))throw new Error("Conversion to number failed");return e;}plus(e){if(this.fractionalDigits!==e.fractionalDigits)throw new Error("Fractional digits do not match");const t=this.data.atomics.add(new i.default(e.atomics));return new a(t.toString(),this.fractionalDigits);}minus(e){if(this.fractionalDigits!==e.fractionalDigits)throw new Error("Fractional digits do not match");const t=this.data.atomics.sub(new i.default(e.atomics));if(t.ltn(0))throw new Error("Difference must not be negative");return new a(t.toString(),this.fractionalDigits);}multiply(e){const t=this.data.atomics.mul(new i.default(e.toString()));return new a(t.toString(),this.fractionalDigits);}equals(e){return 0===a.compare(this,e);}isLessThan(e){return a.compare(this,e)<0;}isLessThanOrEqual(e){return a.compare(this,e)<=0;}isGreaterThan(e){return a.compare(this,e)>0;}isGreaterThanOrEqual(e){return a.compare(this,e)>=0;}}t.Decimal=a;},31301:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Uint64=t.Uint53=t.Uint32=t.Int53=t.Decimal=void 0;var n=r(76950);Object.defineProperty(t,"Decimal",{enumerable:!0,get:function(){return n.Decimal;}});var i=r(75170);Object.defineProperty(t,"Int53",{enumerable:!0,get:function(){return i.Int53;}}),Object.defineProperty(t,"Uint32",{enumerable:!0,get:function(){return i.Uint32;}}),Object.defineProperty(t,"Uint53",{enumerable:!0,get:function(){return i.Uint53;}}),Object.defineProperty(t,"Uint64",{enumerable:!0,get:function(){return i.Uint64;}});},75170:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e};};Object.defineProperty(t,"__esModule",{value:!0}),t.Uint64=t.Uint53=t.Int53=t.Uint32=void 0;const i=n(r(82823)),a=new i.default("18446744073709551615",10,"be");class s{static fromBigEndianBytes(e){return s.fromBytes(e);}static fromBytes(e,t="be"){if(4!==e.length)throw new Error("Invalid input length. Expected 4 bytes.");for(let t=0;t<e.length;++t)if(!Number.isInteger(e[t])||e[t]>255||e[t]<0)throw new Error("Invalid value in byte. Found: "+e[t]);const r="be"===t?e:Array.from(e).reverse();return new s(r[0]*2**24+65536*r[1]+256*r[2]+r[3]);}static fromString(e){if(!e.match(/^[0-9]+$/))throw new Error("Invalid string format");return new s(Number.parseInt(e,10));}constructor(e){if(Number.isNaN(e))throw new Error("Input is not a number");if(!Number.isInteger(e))throw new Error("Input is not an integer");if(e<0||e>4294967295)throw new Error("Input not in uint32 range: "+e.toString());this.data=e;}toBytesBigEndian(){return new Uint8Array([255&Math.floor(this.data/2**24),255&Math.floor(this.data/65536),255&Math.floor(this.data/256),255&Math.floor(this.data/1)]);}toBytesLittleEndian(){return new Uint8Array([255&Math.floor(this.data/1),255&Math.floor(this.data/256),255&Math.floor(this.data/65536),255&Math.floor(this.data/2**24)]);}toNumber(){return this.data;}toBigInt(){return BigInt(this.toNumber());}toString(){return this.data.toString();}}t.Uint32=s;class o{static fromString(e){if(!e.match(/^-?[0-9]+$/))throw new Error("Invalid string format");return new o(Number.parseInt(e,10));}constructor(e){if(Number.isNaN(e))throw new Error("Input is not a number");if(!Number.isInteger(e))throw new Error("Input is not an integer");if(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER)throw new Error("Input not in int53 range: "+e.toString());this.data=e;}toNumber(){return this.data;}toBigInt(){return BigInt(this.toNumber());}toString(){return this.data.toString();}}t.Int53=o;class d{static fromString(e){const t=o.fromString(e);return new d(t.toNumber());}constructor(e){const t=new o(e);if(t.toNumber()<0)throw new Error("Input is negative");this.data=t;}toNumber(){return this.data.toNumber();}toBigInt(){return BigInt(this.toNumber());}toString(){return this.data.toString();}}t.Uint53=d;class c{static fromBytesBigEndian(e){return c.fromBytes(e);}static fromBytes(e,t="be"){if(8!==e.length)throw new Error("Invalid input length. Expected 8 bytes.");for(let t=0;t<e.length;++t)if(!Number.isInteger(e[t])||e[t]>255||e[t]<0)throw new Error("Invalid value in byte. Found: "+e[t]);const r="be"===t?Array.from(e):Array.from(e).reverse();return new c(new i.default(r));}static fromString(e){if(!e.match(/^[0-9]+$/))throw new Error("Invalid string format");return new c(new i.default(e,10,"be"));}static fromNumber(e){if(Number.isNaN(e))throw new Error("Input is not a number");if(!Number.isInteger(e))throw new Error("Input is not an integer");let t;try{t=new i.default(e);}catch{throw new Error("Input is not a safe integer");}return new c(t);}constructor(e){if(e.isNeg())throw new Error("Input is negative");if(e.gt(a))throw new Error("Input exceeds uint64 range");this.data=e;}toBytesBigEndian(){return Uint8Array.from(this.data.toArray("be",8));}toBytesLittleEndian(){return Uint8Array.from(this.data.toArray("le",8));}toString(){return this.data.toString(10);}toBigInt(){return BigInt(this.toString());}toNumber(){return this.data.toNumber();}}t.Uint64=c;},70734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.arrayContentStartsWith=t.arrayContentEquals=void 0,t.arrayContentEquals=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0;},t.arrayContentStartsWith=function(e,t){if(e.length<t.length)return!1;for(let r=0;r<t.length;++r)if(e[r]!==t[r])return!1;return!0;};},44298:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assertDefinedAndNotNull=t.assertDefined=t.assert=void 0,t.assert=function(e,t){if(!e)throw new Error(t||"condition is not truthy");},t.assertDefined=function(e,t){if(void 0===e)throw new Error(t??"value is undefined");},t.assertDefinedAndNotNull=function(e,t){if(null==e)throw new Error(t??"value is undefined or null");};},11718:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isUint8Array=t.isNonNullObject=t.isDefined=t.sleep=t.assertDefinedAndNotNull=t.assertDefined=t.assert=t.arrayContentStartsWith=t.arrayContentEquals=void 0;var n=r(70734);Object.defineProperty(t,"arrayContentEquals",{enumerable:!0,get:function(){return n.arrayContentEquals;}}),Object.defineProperty(t,"arrayContentStartsWith",{enumerable:!0,get:function(){return n.arrayContentStartsWith;}});var i=r(44298);Object.defineProperty(t,"assert",{enumerable:!0,get:function(){return i.assert;}}),Object.defineProperty(t,"assertDefined",{enumerable:!0,get:function(){return i.assertDefined;}}),Object.defineProperty(t,"assertDefinedAndNotNull",{enumerable:!0,get:function(){return i.assertDefinedAndNotNull;}});var a=r(79589);Object.defineProperty(t,"sleep",{enumerable:!0,get:function(){return a.sleep;}});var s=r(72193);Object.defineProperty(t,"isDefined",{enumerable:!0,get:function(){return s.isDefined;}}),Object.defineProperty(t,"isNonNullObject",{enumerable:!0,get:function(){return s.isNonNullObject;}}),Object.defineProperty(t,"isUint8Array",{enumerable:!0,get:function(){return s.isUint8Array;}});},79589:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sleep=void 0,t.sleep=async function(e){return new Promise((t=>setTimeout(t,e)));};},72193:(e,t,r)=>{var n=r(1048).Buffer;function i(e){return"object"==typeof e&&null!==e;}Object.defineProperty(t,"__esModule",{value:!0}),t.isDefined=t.isUint8Array=t.isNonNullObject=void 0,t.isNonNullObject=i,t.isUint8Array=function(e){return!(!i(e)||"[object Uint8Array]"!==Object.prototype.toString.call(e)||void 0!==n&&void 0!==n.isBuffer&&n.isBuffer(e));},t.isDefined=function(e){return void 0!==e;};},89842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pubkeyToAddress=t.pubkeyToRawAddress=t.rawSecp256k1PubkeyToRawAddress=t.rawEd25519PubkeyToRawAddress=void 0;const n=r(62966),i=r(81898),a=r(42361),s=r(32141);function o(e){if(32!==e.length)throw new Error(`Invalid Ed25519 pubkey length: ${e.length}`);return(0,n.sha256)(e).slice(0,20);}function d(e){if(33!==e.length)throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${e.length}`);return(0,n.ripemd160)((0,n.sha256)(e));}function c(e){if((0,s.isSecp256k1Pubkey)(e))return d((0,i.fromBase64)(e.value));if((0,s.isEd25519Pubkey)(e))return o((0,i.fromBase64)(e.value));if((0,s.isMultisigThresholdPubkey)(e)){const t=(0,a.encodeAminoPubkey)(e);return(0,n.sha256)(t).slice(0,20);}throw new Error("Unsupported public key type");}t.rawEd25519PubkeyToRawAddress=o,t.rawSecp256k1PubkeyToRawAddress=d,t.pubkeyToRawAddress=c,t.pubkeyToAddress=function(e,t){return(0,i.toBech32)(t,c(e));};},75104:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addCoins=t.parseCoins=t.coins=t.coin=void 0;const n=r(90473);function i(e,t){let r;if("number"==typeof e)try{r=new n.Uint53(e).toString();}catch(e){throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers.");}else{if(!e.match(/^[0-9]+$/))throw new Error("Invalid unsigned integer string format");r=e.replace(/^0*/,"")||"0";}return{amount:r,denom:t};}t.coin=i,t.coins=function(e,t){return[i(e,t)];},t.parseCoins=function(e){return e.replace(/\s/g,"").split(",").filter(Boolean).map((e=>{const t=e.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/]{2,127})$/);if(!t)throw new Error("Got an invalid coin string");return{amount:t[1].replace(/^0+/,"")||"0",denom:t[2]};}));},t.addCoins=function(e,t){if(e.denom!==t.denom)throw new Error("Trying to add two coins with different denoms");return{amount:n.Decimal.fromAtomics(e.amount,0).plus(n.Decimal.fromAtomics(t.amount,0)).atomics,denom:e.denom};};},42361:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.encodeBech32Pubkey=t.encodeAminoPubkey=t.decodeBech32Pubkey=t.decodeAminoPubkey=t.encodeEd25519Pubkey=t.encodeSecp256k1Pubkey=void 0;const n=r(81898),i=r(90473),a=r(37370),s=r(32141);t.encodeSecp256k1Pubkey=function(e){if(33!==e.length||2!==e[0]&&3!==e[0])throw new Error("Public key must be compressed secp256k1, i.e. 33 bytes starting with 0x02 or 0x03");return{type:s.pubkeyType.secp256k1,value:(0,n.toBase64)(e)};},t.encodeEd25519Pubkey=function(e){if(32!==e.length)throw new Error("Ed25519 public key must be 32 bytes long");return{type:s.pubkeyType.ed25519,value:(0,n.toBase64)(e)};};const o=(0,n.fromHex)("eb5ae98721"),d=(0,n.fromHex)("1624de6420"),c=(0,n.fromHex)("0dfb100520"),u=(0,n.fromHex)("22c1f7e2");function l(e){if((0,a.arrayContentStartsWith)(e,o)){const t=e.slice(o.length);if(33!==t.length)throw new Error("Invalid rest data length. Expected 33 bytes (compressed secp256k1 pubkey).");return{type:s.pubkeyType.secp256k1,value:(0,n.toBase64)(t)};}if((0,a.arrayContentStartsWith)(e,d)){const t=e.slice(d.length);if(32!==t.length)throw new Error("Invalid rest data length. Expected 32 bytes (Ed25519 pubkey).");return{type:s.pubkeyType.ed25519,value:(0,n.toBase64)(t)};}if((0,a.arrayContentStartsWith)(e,c)){const t=e.slice(c.length);if(32!==t.length)throw new Error("Invalid rest data length. Expected 32 bytes (Sr25519 pubkey).");return{type:s.pubkeyType.sr25519,value:(0,n.toBase64)(t)};}if((0,a.arrayContentStartsWith)(e,u))return function(e){const t=Array.from(e),r=t.splice(0,u.length);if(!(0,a.arrayContentStartsWith)(r,u))throw new Error("Invalid multisig prefix.");if(8!=t.shift())throw new Error("Invalid multisig data. Expecting 0x08 prefix before threshold.");const[n,i]=h(t);t.splice(0,i);const o=[];for(;t.length>0;){if(18!=t.shift())throw new Error("Invalid multisig data. Expecting 0x12 prefix before participant pubkey length.");const[e,r]=h(t);if(t.splice(0,r),t.length<e)throw new Error("Invalid multisig data length.");const n=t.splice(0,e),i=l(Uint8Array.from(n));o.push(i);}return{type:s.pubkeyType.multisigThreshold,value:{threshold:n.toString(),pubkeys:o}};}(e);throw new Error("Unsupported public key type. Amino data starts with: "+(0,n.toHex)(e.slice(0,5)));}function h(e){if(e.length<1)throw new Error("Can't decode varint. EOF");if(e[0]>127)throw new Error("Decoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.Varint implementation from the Go standard library and write some tests.");return[e[0],1];}function f(e){const t=i.Uint53.fromString(e.toString()).toNumber();if(t>127)throw new Error("Encoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.PutUvarint implementation from the Go standard library and write some tests.");return[t];}function p(e){if((0,s.isMultisigThresholdPubkey)(e)){const t=Array.from(u);t.push(8),t.push(...f(e.value.threshold));for(const r of e.value.pubkeys.map((e=>p(e))))t.push(18),t.push(...f(r.length)),t.push(...r);return new Uint8Array(t);}if((0,s.isEd25519Pubkey)(e))return new Uint8Array([...d,...(0,n.fromBase64)(e.value)]);if((0,s.isSecp256k1Pubkey)(e))return new Uint8Array([...o,...(0,n.fromBase64)(e.value)]);throw new Error("Unsupported pubkey type");}t.decodeAminoPubkey=l,t.decodeBech32Pubkey=function(e){const{data:t}=(0,n.fromBech32)(e);return l(t);},t.encodeAminoPubkey=p,t.encodeBech32Pubkey=function(e,t){return(0,n.toBech32)(t,p(e));};},11158:(e,t,r)=>{r(89842),r(75104),r(42361),r(46022),r(90436),r(53786),r(32141),r(62995),r(66223),r(69496),r(53139),r(70623),r(76261);},46022:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMultisigThresholdPubkey=t.compareArrays=void 0;const n=r(81898),i=r(90473),a=r(89842);function s(e,t){const r=(0,n.toHex)(e),i=(0,n.toHex)(t);return r===i?0:r<i?-1:1;}t.compareArrays=s,t.createMultisigThresholdPubkey=function(e,t,r=!1){const n=new i.Uint53(t);if(n.toNumber()>e.length)throw new Error(`Threshold k = ${n.toNumber()} exceeds number of keys n = ${e.length}`);const o=r?e:Array.from(e).sort(((e,t)=>s((0,a.pubkeyToRawAddress)(e),(0,a.pubkeyToRawAddress)(t))));return{type:"tendermint/PubKeyMultisigThreshold",value:{threshold:n.toString(),pubkeys:o}};};},90436:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.omitDefault=void 0,t.omitDefault=function(e){switch(typeof e){case"string":return""===e?void 0:e;case"number":return 0===e?void 0:e;case"bigint":return e===BigInt(0)?void 0:e;case"boolean":return e||void 0;default:throw new Error(`Got unsupported type '${typeof e}'`);}};},53786:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeCosmoshubPath=void 0;const n=r(62966);t.makeCosmoshubPath=function(e){return[n.Slip10RawIndex.hardened(44),n.Slip10RawIndex.hardened(118),n.Slip10RawIndex.hardened(0),n.Slip10RawIndex.normal(0),n.Slip10RawIndex.normal(e)];};},32141:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isMultisigThresholdPubkey=t.isSinglePubkey=t.pubkeyType=t.isSecp256k1Pubkey=t.isEd25519Pubkey=void 0,t.isEd25519Pubkey=function(e){return"tendermint/PubKeyEd25519"===e.type;},t.isSecp256k1Pubkey=function(e){return"tendermint/PubKeySecp256k1"===e.type;},t.pubkeyType={secp256k1:"tendermint/PubKeySecp256k1",ed25519:"tendermint/PubKeyEd25519",sr25519:"tendermint/PubKeySr25519",multisigThreshold:"tendermint/PubKeyMultisigThreshold"},t.isSinglePubkey=function(e){return[t.pubkeyType.ed25519,t.pubkeyType.secp256k1,t.pubkeyType.sr25519].includes(e.type);},t.isMultisigThresholdPubkey=function(e){return"tendermint/PubKeyMultisigThreshold"===e.type;};},62995:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Secp256k1HdWallet=t.extractKdfConfiguration=void 0;const n=r(62966),i=r(81898),a=r(37370),s=r(89842),o=r(53786),d=r(69496),c=r(53139),u=r(76261),l="secp256k1wallet-v1",h={algorithm:"argon2id",params:{outputLength:32,opsLimit:24,memLimitKib:12288}};t.extractKdfConfiguration=function(e){const t=JSON.parse(e);if(!(0,a.isNonNullObject)(t))throw new Error("Root document is not an object.");if(t.type===l)return t.kdf;throw new Error("Unsupported serialization type");};const f={bip39Password:"",hdPaths:[(0,o.makeCosmoshubPath)(0)],prefix:"cosmos"};class p{static async fromMnemonic(e,t={}){const r=new n.EnglishMnemonic(e),i=await n.Bip39.mnemonicToSeed(r,t.bip39Password);return new p(r,{...t,seed:i});}static async generate(e=12,t={}){const r=4*Math.floor(11*e/33),i=n.Random.getBytes(r),a=n.Bip39.encode(i);return p.fromMnemonic(a.toString(),t);}static async deserialize(e,t){const r=JSON.parse(e);if(!(0,a.isNonNullObject)(r))throw new Error("Root document is not an object.");if(r.type===l)return p.deserializeTypeV1(e,t);throw new Error("Unsupported serialization type");}static async deserializeWithEncryptionKey(e,t){const r=JSON.parse(e);if(!(0,a.isNonNullObject)(r))throw new Error("Root document is not an object.");const s=r;if(s.type===l){const e=await(0,u.decrypt)((0,i.fromBase64)(s.data),t,s.encryption),r=JSON.parse((0,i.fromUtf8)(e)),{mnemonic:o,accounts:d}=r;if((0,a.assert)("string"==typeof o),!Array.isArray(d))throw new Error("Property 'accounts' is not an array");if(!d.every((e=>{return t=e,!!(0,a.isNonNullObject)(t)&&"string"==typeof t.hdPath&&"string"==typeof t.prefix;var t;})))throw new Error("Account is not in the correct format.");const c=d[0].prefix;if(!d.every((({prefix:e})=>e===c)))throw new Error("Accounts do not all have the same prefix");const l=d.map((({hdPath:e})=>(0,n.stringToPath)(e)));return p.fromMnemonic(o,{hdPaths:l,prefix:c});}throw new Error("Unsupported serialization type");}static async deserializeTypeV1(e,t){const r=JSON.parse(e);if(!(0,a.isNonNullObject)(r))throw new Error("Root document is not an object.");const n=await(0,u.executeKdf)(t,r.kdf);return p.deserializeWithEncryptionKey(e,n);}constructor(e,t){const r=t.hdPaths??f.hdPaths,n=t.prefix??f.prefix;this.secret=e,this.seed=t.seed,this.accounts=r.map((e=>({hdPath:e,prefix:n})));}get mnemonic(){return this.secret.toString();}async getAccounts(){return(await this.getAccountsWithPrivkeys()).map((({algo:e,pubkey:t,address:r})=>({algo:e,pubkey:t,address:r})));}async signAmino(e,t){const r=(await this.getAccountsWithPrivkeys()).find((({address:t})=>t===e));if(void 0===r)throw new Error(`Address ${e} not found in wallet`);const{privkey:i,pubkey:a}=r,s=(0,n.sha256)((0,c.serializeSignDoc)(t)),o=await n.Secp256k1.createSignature(s,i),u=new Uint8Array([...o.r(32),...o.s(32)]);return{signed:t,signature:(0,d.encodeSecp256k1Signature)(a,u)};}async serialize(e){const t=h,r=await(0,u.executeKdf)(e,t);return this.serializeWithEncryptionKey(r,t);}async serializeWithEncryptionKey(e,t){const r={mnemonic:this.mnemonic,accounts:this.accounts.map((({hdPath:e,prefix:t})=>({hdPath:(0,n.pathToString)(e),prefix:t})))},a=(0,i.toUtf8)(JSON.stringify(r)),s={algorithm:u.supportedAlgorithms.xchacha20poly1305Ietf},o=await(0,u.encrypt)(a,e,s),d={type:l,kdf:t,encryption:s,data:(0,i.toBase64)(o)};return JSON.stringify(d);}async getKeyPair(e){const{privkey:t}=n.Slip10.derivePath(n.Slip10Curve.Secp256k1,this.seed,e),{pubkey:r}=await n.Secp256k1.makeKeypair(t);return{privkey:t,pubkey:n.Secp256k1.compressPubkey(r)};}async getAccountsWithPrivkeys(){return Promise.all(this.accounts.map((async({hdPath:e,prefix:t})=>{const{privkey:r,pubkey:n}=await this.getKeyPair(e);return{algo:"secp256k1",privkey:r,pubkey:n,address:(0,i.toBech32)(t,(0,s.rawSecp256k1PubkeyToRawAddress)(n))};})));}}t.Secp256k1HdWallet=p;},66223:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Secp256k1Wallet=void 0;const n=r(62966),i=r(81898),a=r(89842),s=r(69496),o=r(53139);class d{static async fromKey(e,t="cosmos"){const r=(await n.Secp256k1.makeKeypair(e)).pubkey;return new d(e,n.Secp256k1.compressPubkey(r),t);}constructor(e,t,r){this.privkey=e,this.pubkey=t,this.prefix=r;}get address(){return(0,i.toBech32)(this.prefix,(0,a.rawSecp256k1PubkeyToRawAddress)(this.pubkey));}async getAccounts(){return[{algo:"secp256k1",address:this.address,pubkey:this.pubkey}];}async signAmino(e,t){if(e!==this.address)throw new Error(`Address ${e} not found in wallet`);const r=new n.Sha256((0,o.serializeSignDoc)(t)).digest(),i=await n.Secp256k1.createSignature(r,this.privkey),a=new Uint8Array([...i.r(32),...i.s(32)]);return{signed:t,signature:(0,s.encodeSecp256k1Signature)(this.pubkey,a)};}}t.Secp256k1Wallet=d;},69496:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeSignature=t.encodeSecp256k1Signature=void 0;const n=r(81898),i=r(42361),a=r(32141);t.encodeSecp256k1Signature=function(e,t){if(64!==t.length)throw new Error("Signature must be 64 bytes long. Cosmos SDK uses a 2x32 byte fixed length encoding for the secp256k1 signature integers r and s.");return{pub_key:(0,i.encodeSecp256k1Pubkey)(e),signature:(0,n.toBase64)(t)};},t.decodeSignature=function(e){if(e.pub_key.type===a.pubkeyType.secp256k1)return{pubkey:(0,n.fromBase64)(e.pub_key.value),signature:(0,n.fromBase64)(e.signature)};throw new Error("Unsupported pubkey type");};},53139:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.serializeSignDoc=t.escapeCharacters=t.makeSignDoc=t.sortedJsonStringify=void 0;const n=r(81898),i=r(90473);function a(e){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return e.map(a);const t=Object.keys(e).sort(),r={};return t.forEach((t=>{r[t]=a(e[t]);})),r;}function s(e){return JSON.stringify(a(e));}function o(e){return e.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e");}t.sortedJsonStringify=s,t.makeSignDoc=function(e,t,r,n,a,s,o){return{chain_id:r,account_number:i.Uint53.fromString(a.toString()).toString(),sequence:i.Uint53.fromString(s.toString()).toString(),fee:t,msgs:e,memo:n||"",...o&&{timeout_height:o.toString()}};},t.escapeCharacters=o,t.serializeSignDoc=function(e){const t=o(s(e));return(0,n.toUtf8)(t);};},70623:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeStdTx=t.isStdTx=void 0,t.isStdTx=function(e){const{memo:t,msg:r,fee:n,signatures:i}=e;return"string"==typeof t&&Array.isArray(r)&&"object"==typeof n&&Array.isArray(i);},t.makeStdTx=function(e,t){return{msg:e.msgs,fee:e.fee,memo:e.memo,signatures:Array.isArray(t)?t:[t]};};},76261:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=t.supportedAlgorithms=t.executeKdf=t.cosmjsSalt=void 0;const n=r(62966),i=r(81898);t.cosmjsSalt=(0,i.toAscii)("The CosmJS salt."),t.executeKdf=async function(e,r){if("argon2id"===r.algorithm){const i=r.params;if(!(0,n.isArgon2idOptions)(i))throw new Error("Invalid format of argon2id params");return n.Argon2id.execute(e,t.cosmjsSalt,i);}throw new Error("Unsupported KDF algorithm");},t.supportedAlgorithms={xchacha20poly1305Ietf:"xchacha20poly1305-ietf"},t.encrypt=async function(e,r,i){if(i.algorithm===t.supportedAlgorithms.xchacha20poly1305Ietf){const t=n.Random.getBytes(n.xchacha20NonceLength);return new Uint8Array([...t,...await n.Xchacha20poly1305Ietf.encrypt(e,r,t)]);}throw new Error(`Unsupported encryption algorithm: '${i.algorithm}'`);},t.decrypt=async function(e,r,i){if(i.algorithm===t.supportedAlgorithms.xchacha20poly1305Ietf){const t=e.slice(0,n.xchacha20NonceLength);return n.Xchacha20poly1305Ietf.decrypt(e.slice(n.xchacha20NonceLength),r,t);}throw new Error(`Unsupported encryption algorithm: '${i.algorithm}'`);};},80527:(e,t,r)=>{var n=r(1048).Buffer,i=r(63330);function a(e,t){return void 0===t&&(t="utf8"),n.isBuffer(e)?o(e.toString("base64")):o(n.from(e,t).toString("base64"));}function s(e){return e=e.toString(),i.default(e).replace(/\-/g,"+").replace(/_/g,"/");}function o(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");}var d=a;d.encode=a,d.decode=function(e,t){return void 0===t&&(t="utf8"),n.from(s(e),"base64").toString(t);},d.toBase64=s,d.fromBase64=o,d.toBuffer=function(e){return n.from(s(e),"base64");},t.default=d;},63330:(e,t,r)=>{var n=r(1048).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.length,r=t%4;if(!r)return e;var i=t,a=4-r,s=t+a,o=n.alloc(s);for(o.write(e);a--;)o.write("=",i++);return o.toString();};},97702:(e,t,r)=>{e.exports=r(80527).default,e.exports.default=e.exports;},13739:(e,t,r)=>{var n=r(24643);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t);}));}r(41457),r(70597),r(28550),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i;},n.aes.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t});},n.aes.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i;},n.aes.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t});},n.aes.Algorithm=function(e,t){u||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1);},decrypt:function(e,t){return p(r._w,e,t,!0);}}}),r._init=!1;},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i]);}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var a=t.length();if(16===a||24===a||32===a)for(a>>>=2,i=0;i<a;++i)r.push(t.getInt32());}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var s=this.mode.name,o=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=f(r,e.decrypt&&!o),this._init=!0;}},n.aes._expandKey=function(e,t){return u||h(),f(e,t);},n.aes._updateBlock=p,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var a,s,o,d,c,u=!1,l=4;function h(){u=!0,o=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;for(a=new Array(256),s=new Array(256),d=new Array(4),c=new Array(4),t=0;t<4;++t)d[t]=new Array(256),c[t]=new Array(256);var r,n,i,l,h,f,p,y=0,g=0;for(t=0;t<256;++t){l=(l=g^g<<1^g<<2^g<<3^g<<4)>>8^255&l^99,a[y]=l,s[l]=y,f=(h=e[l])<<24^l<<16^l<<8^l^h,p=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)d[m][y]=f,c[m][l]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]]);}}function f(e,t){for(var r,n=e.slice(0),i=1,s=n.length,d=l*(s+6+1),u=s;u<d;++u)r=n[u-1],u%s==0?(r=a[r>>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^o[i]<<24,i++):s>6&&u%s==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[u]=n[u-s]^r;if(t){for(var h,f=c[0],p=c[1],y=c[2],g=c[3],m=n.slice(0),v=(u=0,(d=n.length)-l);u<d;u+=l,v-=l)if(0===u||u===d-l)m[u]=n[v],m[u+1]=n[v+3],m[u+2]=n[v+2],m[u+3]=n[v+1];else for(var b=0;b<l;++b)h=n[v+b],m[u+(3&-b)]=f[a[h>>>24]]^p[a[h>>>16&255]]^y[a[h>>>8&255]]^g[a[255&h]];n=m;}return n;}function p(e,t,r,n){var i,o,u,l,h,f,p,y,g,m,v,b,E=e.length/4-1;n?(i=c[0],o=c[1],u=c[2],l=c[3],h=s):(i=d[0],o=d[1],u=d[2],l=d[3],h=a),f=t[0]^e[0],p=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var C=3,S=1;S<E;++S)m=i[f>>>24]^o[p>>>16&255]^u[y>>>8&255]^l[255&g]^e[++C],v=i[p>>>24]^o[y>>>16&255]^u[g>>>8&255]^l[255&f]^e[++C],b=i[y>>>24]^o[g>>>16&255]^u[f>>>8&255]^l[255&p]^e[++C],g=i[g>>>24]^o[f>>>16&255]^u[p>>>8&255]^l[255&y]^e[++C],f=m,p=v,y=b;r[0]=h[f>>>24]<<24^h[p>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++C],r[n?3:1]=h[p>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&f]^e[++C],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[f>>>8&255]<<8^h[255&p]^e[++C],r[n?1:3]=h[g>>>24]<<24^h[f>>>16&255]<<16^h[p>>>8&255]<<8^h[255&y]^e[++C];}function y(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof n.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,i.call(t,r);},t;}},47885:(e,t,r)=>{var n=r(24643);r(13739),r(53105);var i=e.exports=n.tls;function a(e,t,r){var a=t.entity===n.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:n.cipher.createDecipher("AES-CBC",a?r.keys.server_write_key:r.keys.client_write_key),iv:a?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:n.cipher.createCipher("AES-CBC",a?r.keys.client_write_key:r.keys.server_write_key),iv:a?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=c,e.write.cipherFunction=s,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=i.hmac_sha1;}function s(e,t){var r,a=!1,s=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(s),t.updateSequenceNumber(),r=e.version.minor===i.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:n.random.getBytesSync(16),t.cipherState.init=!0;var d=t.cipherState.cipher;return d.start({iv:r}),e.version.minor>=i.Versions.TLS_1_1.minor&&d.output.putBytes(r),d.update(e.fragment),d.finish(o)&&(e.fragment=d.output,e.length=e.fragment.length(),a=!0),a;}function o(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n);}return!0;}function d(e,t,r){var n=!0;if(r){for(var i=t.length(),a=t.last(),s=i-1-a;s<i-1;++s)n=n&&t.at(s)==a;n&&t.truncate(a+1);}return n;}function c(e,t){var r,a=!1;r=e.version.minor===i.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:e.fragment.getBytes(16),t.cipherState.init=!0;var s=t.cipherState.cipher;s.start({iv:r}),s.update(e.fragment),a=s.finish(d);var o=t.macLength,c=n.random.getBytesSync(o),u=s.output.length();u>=o?(e.fragment=s.output.getBytes(u-o),c=s.output.getBytes(o)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var l=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=function(e,t,r){var i=n.hmac.create();return i.start("SHA1",e),i.update(t),t=i.digest().getBytes(),i.start(null,null),i.update(r),t===(r=i.digest().getBytes());}(t.macKey,c,l)&&a,a;}i.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=i.BulkCipherAlgorithm.aes,e.cipher_type=i.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=i.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20;},initConnectionState:a},i.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=i.BulkCipherAlgorithm.aes,e.cipher_type=i.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=i.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20;},initConnectionState:a};},45628:(e,t,r)=>{var n=r(24643);r(7835);var i=n.asn1;t.privateKeyValidator={name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},t.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]};},7835:(e,t,r)=>{var n=r(24643);r(28550),r(74467);var i=e.exports=n.asn1=n.asn1||{};function a(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n;}}function s(e,t,r,n){var o;a(e,t,2);var d=e.getByte();t--;var c=192&d,u=31&d;o=e.length();var l,h,f=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;a(e,t,i),n=e.getInt(i<<3);}else n=r;if(n<0)throw new Error("Negative length: "+n);return n;}}(e,t);if(t-=o-e.length(),void 0!==f&&f>t){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=f,p;}f=t;}var y=!(32&~d);if(y)if(l=[],void 0===f)for(;;){if(a(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break;}o=e.length(),l.push(s(e,t,r+1,n)),t-=o-e.length();}else for(;f>0;)o=e.length(),l.push(s(e,f,r+1,n)),t-=o-e.length(),f-=o-e.length();if(void 0===l&&c===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&(h=e.bytes(f)),void 0===l&&n.decodeBitStrings&&c===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&f>1){var g=e.read,m=t,v=0;if(u===i.Type.BITSTRING&&(a(e,t,1),v=e.getByte(),t--),0===v)try{o=e.length();var b=s(e,t,r+1,{strict:!0,decodeBitStrings:!0}),E=o-e.length();t-=E,u==i.Type.BITSTRING&&E++;var C=b.tagClass;E!==f||C!==i.Class.UNIVERSAL&&C!==i.Class.CONTEXT_SPECIFIC||(l=[b]);}catch(e){}void 0===l&&(e.read=g,t=m);}if(void 0===l){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t;}if(u===i.Type.BMPSTRING)for(l="";f>0;f-=2)a(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(f),t-=f;}var S=void 0===h?null:{bitStringContents:h};return i.create(c,u,y,l,S);}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,a,s){if(n.util.isArray(a)){for(var o=[],d=0;d<a.length;++d)void 0!==a[d]&&o.push(a[d]);a=o;}var c={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(a),value:a};return s&&"bitStringContents"in s&&(c.bitStringContents=s.bitStringContents,c.original=i.copy(c)),c;},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var a=0;a<e.length;++a)r.push(i.copy(e[a],t));return r;}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r);},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var a=0;a<e.length;++a)if(!i.equals(e[a],t[a]))return!1;return!0;}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var s=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(s=s&&e.bitStringContents===t.bitStringContents),s;},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t;},i.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.length(),i=s(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var a=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw a.byteCount=r,a.remaining=e.length(),a;}return i;},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,a=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)a.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:a.putByte(0);for(var o=0;o<e.value.length;++o)void 0!==e.value[o]&&a.putBuffer(i.toDer(e.value[o]));}else if(e.type===i.Type.BMPSTRING)for(o=0;o<e.value.length;++o)a.putInt16(e.value.charCodeAt(o));else!(e.type===i.Type.INTEGER&&e.value.length>1)||(0!==e.value.charCodeAt(0)||128&e.value.charCodeAt(1))&&(255!==e.value.charCodeAt(0)||128&~e.value.charCodeAt(1))?a.putBytes(e.value):a.putBytes(e.value.substr(1));if(t.putByte(r),a.length()<=127)t.putByte(127&a.length());else{var d=a.length(),c="";do{c+=String.fromCharCode(255&d),d>>>=8;}while(d>0);for(t.putByte(128|c.length),o=c.length-1;o>=0;--o)t.putByte(c.charCodeAt(o));}return t.putBuffer(a),t;},i.oidToDer=function(e){var t,r,i,a,s=e.split("."),o=n.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var d=2;d<s.length;++d){t=!0,r=[],i=parseInt(s[d],10);do{a=127&i,i>>>=7,t||(a|=128),r.push(a),t=!1;}while(i>0);for(var c=r.length-1;c>=0;--c)o.putByte(r[c]);}return o;},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t;},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var d=e.charAt(10),c=10;"+"!==d&&"-"!==d&&(o=parseInt(e.substr(10,2),10),c+=2);}if(t.setUTCFullYear(r,n,i),t.setUTCHours(a,s,o,0),c&&("+"===(d=e.charAt(c))||"-"===d)){var u=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);u*=6e4,"+"===d?t.setTime(+t-u):t.setTime(+t+u);}return t;},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),d=0,c=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var l=e.length-5,h=e.charAt(l);return"+"!==h&&"-"!==h||(c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===h&&(c*=-1),u=!0),"."===e.charAt(14)&&(d=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(a,s,o,d),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(a,s,o,d)),t;},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z";},i.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z";},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r;},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t);},i.validate=function(e,t,r,a){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)a&&(e.tagClass!==t.tagClass&&a.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&a.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var o=0,d=0;s&&d<t.value.length;++d)s=t.value[d].optional||!1,e.value[o]&&((s=i.validate(e.value[o],t.value[d],r,a))?++o:t.value[d].optional&&(s=!0)),!s&&a&&a.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(s&&r&&(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1);}}else a&&a.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s;};var o=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var a="";r=r||2,(t=t||0)>0&&(a+="\n");for(var s="",d=0;d<t*r;++d)s+=" ";switch(a+=s+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:a+="Universal:";break;case i.Class.APPLICATION:a+="Application:";break;case i.Class.CONTEXT_SPECIFIC:a+="Context-Specific:";break;case i.Class.PRIVATE:a+="Private:";}if(e.tagClass===i.Class.UNIVERSAL)switch(a+=e.type,e.type){case i.Type.NONE:a+=" (None)";break;case i.Type.BOOLEAN:a+=" (Boolean)";break;case i.Type.INTEGER:a+=" (Integer)";break;case i.Type.BITSTRING:a+=" (Bit string)";break;case i.Type.OCTETSTRING:a+=" (Octet string)";break;case i.Type.NULL:a+=" (Null)";break;case i.Type.OID:a+=" (Object Identifier)";break;case i.Type.ODESC:a+=" (Object Descriptor)";break;case i.Type.EXTERNAL:a+=" (External or Instance of)";break;case i.Type.REAL:a+=" (Real)";break;case i.Type.ENUMERATED:a+=" (Enumerated)";break;case i.Type.EMBEDDED:a+=" (Embedded PDV)";break;case i.Type.UTF8:a+=" (UTF8)";break;case i.Type.ROID:a+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:a+=" (Sequence)";break;case i.Type.SET:a+=" (Set)";break;case i.Type.PRINTABLESTRING:a+=" (Printable String)";break;case i.Type.IA5String:a+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:a+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:a+=" (Generalized time)";break;case i.Type.BMPSTRING:a+=" (BMP String)";}else a+=e.type;if(a+="\n",a+=s+"Constructed: "+e.constructed+"\n",e.composed){var c=0,u="";for(d=0;d<e.value.length;++d)void 0!==e.value[d]&&(c+=1,u+=i.prettyPrint(e.value[d],t+1,r),d+1<e.value.length&&(u+=","));a+=s+"Sub values: "+c+u;}else{if(a+=s+"Value: ",e.type===i.Type.OID){var l=i.derToOid(e.value);a+=l,n.pki&&n.pki.oids&&l in n.pki.oids&&(a+=" ("+n.pki.oids[l]+") ");}if(e.type===i.Type.INTEGER)try{a+=i.derToInteger(e.value);}catch(t){a+="0x"+n.util.bytesToHex(e.value);}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?a+="0x"+n.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?a+=" (1 unused bit shown)":h>1&&(a+=" ("+h+" unused bits shown)");}}else if(e.type===i.Type.OCTETSTRING)o.test(e.value)||(a+="("+e.value+") "),a+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{a+=n.util.decodeUtf8(e.value);}catch(t){if("URI malformed"!==t.message)throw t;a+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)";}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?a+=e.value:o.test(e.value)?a+="0x"+n.util.bytesToHex(e.value):0===e.value.length?a+="[null]":a+=e.value;}return a;};},22089:(e,t,r)=>{var n=r(1048).Buffer,i={};e.exports=i;var a={};i.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,a=t.length,s=t.charAt(0),o=[0];for(i=0;i<e.length;++i){for(var d=0,c=e[i];d<o.length;++d)c+=o[d]<<8,o[d]=c%a,c=c/a|0;for(;c>0;)o.push(c%a),c=c/a|0;}for(i=0;0===e[i]&&i<e.length-1;++i)n+=s;for(i=o.length-1;i>=0;--i)n+=t[o[i]];}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),a=[0];for(r=0;r<e.length();++r){for(var s=0,o=e.at(r);s<a.length;++s)o+=a[s]<<8,a[s]=o%n,o=o/n|0;for(;o>0;)a.push(o%n),o=o/n|0;}var d="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)d+=i;for(r=a.length-1;r>=0;--r)d+=t[a[r]];return d;}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n");}return n;},i.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=a[t];if(!r){r=a[t]=[];for(var i=0;i<t.length;++i)r[t.charCodeAt(i)]=i;}e=e.replace(/\s/g,"");var s=t.length,o=t.charAt(0),d=[0];for(i=0;i<e.length;i++){var c=r[e.charCodeAt(i)];if(void 0===c)return;for(var u=0,l=c;u<d.length;++u)l+=d[u]*s,d[u]=255&l,l>>=8;for(;l>0;)d.push(255&l),l>>=8;}for(var h=0;e[h]===o&&h<e.length-1;++h)d.push(0);return void 0!==n?n.from(d.reverse()):new Uint8Array(d.reverse());};},41457:(e,t,r)=>{var n=r(24643);r(28550),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1});},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0});},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t;},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null;};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e);};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t);},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact();},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1);},this.mode.unpad=function(t){return e(this.blockSize,t,!0);});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)));};},70597:(e,t,r)=>{var n=r(24643);r(28550),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function a(e,t){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i<r.length;++i)e.putByte(r[i]);}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var a=[],s=t/4;for(i=0;i<s;++i)a.push(e.getInt32());e=a;}return e;}function s(e){e[e.length-1]=e[e.length-1]+1&4294967295;}function o(e){return[e/4294967296|0,4294967295&e];}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints);},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0;},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0));},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints);},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0);}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._prev=this._iv.slice(0);}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock;},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0);},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0;},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0));},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0;},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0;},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0;}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0;}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0;},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0;},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0;}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0;},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0;},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0;}s(this._inBlock);},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600;},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*i)));}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=o(8*t.length());var a=t.length()%this.blockSize;for(a&&t.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize;}else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a<=0||r){if(r){var o=n%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o);}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize;}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0;}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock);},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize;},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var a=[];this.cipher.encrypt(this._j0,a);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^a[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r;},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i)e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r;},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R);},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3];}return t;},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t);},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,a=new Array(i),s=0;s<i;++s){var o=[0,0,0,0],d=(n-1-s%n)*t;o[s/n|0]=1<<t-1<<d,a[s]=this.generateSubHashTable(this.multiply(o,e),t);}return a;},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(i[2*a],i[a]=[]),a>>=1;for(a=2;a<n;){for(var s=1;s<a;++s){var o=i[a],d=i[s];i[a+s]=[o[0]^d[0],o[1]^d[1],o[2]^d[2],o[3]^d[3]];}a*=2;}for(i[0]=[0,0,0,0],a=n+1;a<r;++a){var c=i[a^n];i[a]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]];}return i;};},92684:(e,t,r)=>{var n=r(24643);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t);}));}r(41457),r(70597),r(28550),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i;},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t});},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i;},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t});},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return f(r._keys,e,t,!1);},decrypt:function(e,t){return f(r._keys,e,t,!0);}}}),r._init=!1;},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],d=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,E=0;E<g;E++){var C=e.getInt32(),S=e.getInt32();C^=(t=252645135&(C>>>4^S))<<4,C^=t=65535&((S^=t)>>>-16^C),C^=(t=858993459&(C>>>2^(S^=t<<-16)))<<2,C^=t=65535&((S^=t)>>>-16^C),C^=(t=1431655765&(C>>>1^(S^=t<<-16)))<<1,C^=t=16711935&((S^=t)>>>8^C),t=(C^=(t=1431655765&(C>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,C=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var $=0;$<v.length;++$){v[$]?(C=C<<2|C>>>26,S=S<<2|S>>>26):(C=C<<1|C>>>27,S=S<<1|S>>>27);var w=r[(C&=-15)>>>28]|n[C>>>24&15]|i[C>>>20&15]|a[C>>>16&15]|s[C>>>12&15]|o[C>>>8&15]|d[C>>>4&15],I=c[(S&=-15)>>>28]|u[S>>>24&15]|l[S>>>20&15]|h[S>>>16&15]|f[S>>>12&15]|p[S>>>8&15]|y[S>>>4&15];t=65535&(I>>>16^w),m[b++]=w^t,m[b++]=I^t<<16;}}return m;}(t),this._init=!0;}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],d=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function f(e,t,r,n){var i,f,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(f=252645135&(y>>>4^g))<<4,y^=(f=65535&(y>>>16^(g^=f)))<<16,y^=f=858993459&((g^=f)>>>2^y),y^=f=16711935&((g^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(g^=f<<8)))<<1)<<1|y>>>31,g=(g^=f)<<1|g>>>31;for(var m=0;m<p;m+=3){for(var v=i[m+1],b=i[m+2],E=i[m];E!=v;E+=b){var C=g^e[E],S=(g>>>4|g<<28)^e[E+1];f=y,y=g,g=f^(s[C>>>24&63]|d[C>>>16&63]|u[C>>>8&63]|h[63&C]|a[S>>>24&63]|o[S>>>16&63]|c[S>>>8&63]|l[63&S]);}f=y,y=g,g=f;}g=g>>>1|g<<31,g^=f=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(f=16711935&(g>>>8^(y^=f<<1)))<<8,g^=(f=858993459&(g>>>2^(y^=f)))<<2,g^=f=65535&((y^=f)>>>16^g),g^=f=252645135&((y^=f<<16)>>>4^g),y^=f<<4,r[0]=y,r[1]=g;}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof n.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,i.call(t,r);},t;}},60773:(e,t,r)=>{var n=r(1048).Buffer,i=r(24643);r(10121),r(75417),r(30260),r(28550);var a=r(45628),s=a.publicKeyValidator,o=a.privateKeyValidator;if(void 0===d)var d=i.jsbn.BigInteger;var c=i.util.ByteBuffer,u=void 0===n?Uint8Array:n;i.pki=i.pki||{},e.exports=i.pki.ed25519=i.ed25519=i.ed25519||{};var l=i.ed25519;function h(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary";}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if(void 0!==n)return n.from(t,r);t=new c(t,r);}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new u(t.length()),a=0;a<i.length;++a)i[a]=t.at(a);return i;}l.constants={},l.constants.PUBLIC_KEY_BYTE_LENGTH=32,l.constants.PRIVATE_KEY_BYTE_LENGTH=64,l.constants.SEED_BYTE_LENGTH=32,l.constants.SIGN_BYTE_LENGTH=64,l.constants.HASH_BYTE_LENGTH=64,l.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=i.random.getBytesSync(l.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==l.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+l.constants.SEED_BYTE_LENGTH+" bytes in length.");}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=h({message:t,encoding:"binary"});for(var r=new u(l.constants.PUBLIC_KEY_BYTE_LENGTH),n=new u(l.constants.PRIVATE_KEY_BYTE_LENGTH),a=0;a<32;++a)n[a]=t[a];return function(e,t){var r,n=[L(),L(),L(),L()],i=C(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,P(n,i),T(e,n),r=0;r<32;++r)t[r+32]=e[r];}(r,n),{publicKey:r,privateKey:n};},l.privateKeyFromAsn1=function(e){var t={},r=[];if(!i.asn1.validate(e,o,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n;}var a=i.asn1.derToOid(t.privateKeyOid),s=i.oids.EdDSA25519;if(a!==s)throw new Error('Invalid OID "'+a+'"; OID must be "'+s+'".');var d=t.privateKey;return{privateKeyBytes:h({message:i.asn1.fromDer(d).value,encoding:"binary"})};},l.publicKeyFromAsn1=function(e){var t={},r=[];if(!i.asn1.validate(e,s,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n;}var a=i.asn1.derToOid(t.publicKeyOid),o=i.oids.EdDSA25519;if(a!==o)throw new Error('Invalid OID "'+a+'"; OID must be "'+o+'".');var d=t.ed25519PublicKey;if(d.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return h({message:d,encoding:"binary"});},l.publicKeyFromPrivateKey=function(e){var t=h({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new u(l.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r;},l.sign=function(e){var t=h(e=e||{}),r=h({message:e.privateKey,encoding:"binary"});if(r.length===l.constants.SEED_BYTE_LENGTH)r=l.generateKeyPair({seed:r}).privateKey;else if(r.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.SEED_BYTE_LENGTH+" or "+l.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new u(l.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var i,a,s=new Float64Array(64),o=[L(),L(),L(),L()],d=C(n,32);d[0]&=248,d[31]&=127,d[31]|=64;for(i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=d[32+i];var c=C(e.subarray(32),r+32);for($(c),P(o,c),T(e,o),i=32;i<64;++i)e[i]=n[i];var u=C(e,r+64);for($(u),i=32;i<64;++i)s[i]=0;for(i=0;i<32;++i)s[i]=c[i];for(i=0;i<32;++i)for(a=0;a<32;a++)s[i+a]+=u[i]*d[a];S(e.subarray(32),s);}(n,t,t.length,r);for(var i=new u(l.constants.SIGN_BYTE_LENGTH),a=0;a<i.length;++a)i[a]=n[a];return i;},l.verify=function(e){var t=h(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=h({message:e.signature,encoding:"binary"});if(r.length!==l.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+l.constants.SIGN_BYTE_LENGTH);var n=h({message:e.publicKey,encoding:"binary"});if(n.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+l.constants.PUBLIC_KEY_BYTE_LENGTH);var i,a=new u(l.constants.SIGN_BYTE_LENGTH+t.length),s=new u(l.constants.SIGN_BYTE_LENGTH+t.length);for(i=0;i<l.constants.SIGN_BYTE_LENGTH;++i)a[i]=r[i];for(i=0;i<t.length;++i)a[i+l.constants.SIGN_BYTE_LENGTH]=t[i];return function(e,t,r,n){var i,a=new u(32),s=[L(),L(),L(),L()],o=[L(),L(),L(),L()];if(r<64)return-1;if(function(e,t){var r=L(),n=L(),i=L(),a=L(),s=L(),o=L(),d=L();return O(e[2],p),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767;}(e[1],t),M(i,e[1]),K(a,i,y),x(i,i,e[2]),D(a,e[2],a),M(s,a),M(o,s),K(d,o,s),K(r,d,i),K(r,r,a),function(e,t){var r,n=L();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)M(n,n),1!==r&&K(n,n,t);for(r=0;r<16;++r)e[r]=n[r];}(r,r),K(r,r,i),K(r,r,a),K(r,r,a),K(e[0],r,a),M(n,e[0]),K(n,n,a),k(n,i)&&K(e[0],e[0],E),M(n,e[0]),K(n,n,a),k(n,i)?-1:(R(e[0])===t[31]>>7&&x(e[0],f,e[0]),K(e[3],e[0],e[1]),0);}(o,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var d=C(e,r);if($(d),N(s,o,d),P(o,t.subarray(32)),w(s,o),T(a,s),r-=64,B(t,0,a,0)){for(i=0;i<r;++i)e[i]=0;return-1;}for(i=0;i<r;++i)e[i]=t[i+64];return r;}(s,a,a.length,n)>=0;};var f=L(),p=L([1]),y=L([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),g=L([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=L([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=L([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),b=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),E=L([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(e,t){var r=i.md.sha512.create(),a=new c(e);r.update(a.getBytes(t),"binary");var s=r.digest().getBytes();if(void 0!==n)return n.from(s,"binary");for(var o=new u(l.constants.HASH_BYTE_LENGTH),d=0;d<64;++d)o[d]=s.charCodeAt(d);return o;}function S(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i<a;++i)t[i]+=r-16*t[n]*b[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0;}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*b[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*b[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n];}function $(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;S(e,t);}function w(e,t){var r=L(),n=L(),i=L(),a=L(),s=L(),o=L(),d=L(),c=L(),u=L();x(r,e[1],e[0]),x(u,t[1],t[0]),K(r,r,u),D(n,e[0],e[1]),D(u,t[0],t[1]),K(n,n,u),K(i,e[3],t[3]),K(i,i,g),K(a,e[2],t[2]),D(a,a,a),x(s,n,r),x(o,a,i),D(d,a,i),D(c,n,r),K(e[0],s,o),K(e[1],c,d),K(e[2],d,o),K(e[3],s,c);}function I(e,t,r){for(var n=0;n<4;++n)_(e[n],t[n],r);}function T(e,t){var r=L(),n=L(),i=L();!function(e,t){var r,n=L();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)M(n,n),2!==r&&4!==r&&K(n,n,t);for(r=0;r<16;++r)e[r]=n[r];}(i,t[2]),K(r,t[0],i),K(n,t[1],i),A(e,n),e[31]^=R(r)<<7;}function A(e,t){var r,n,i,a=L(),s=L();for(r=0;r<16;++r)s[r]=t[r];for(U(s),U(s),U(s),n=0;n<2;++n){for(a[0]=s[0]-65517,r=1;r<15;++r)a[r]=s[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),i=a[15]>>16&1,a[14]&=65535,_(s,a,1-i);}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8;}function k(e,t){var r=new u(32),n=new u(32);return A(r,e),A(n,t),B(r,0,n,0);}function B(e,t,r,n){return function(e,t,r,n){var i,a=0;for(i=0;i<32;++i)a|=e[t+i]^r[n+i];return(1&a-1>>>8)-1;}(e,t,r,n);}function R(e){var t=new u(32);return A(t,e),1&t[0];}function N(e,t,r){var n,i;for(O(e[0],f),O(e[1],p),O(e[2],p),O(e[3],f),i=255;i>=0;--i)I(e,t,n=r[i/8|0]>>(7&i)&1),w(t,e),w(e,e),I(e,t,n);}function P(e,t){var r=[L(),L(),L(),L()];O(r[0],m),O(r[1],v),O(r[2],p),K(r[3],m,v),N(e,r,t);}function O(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r];}function U(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1);}function _(e,t,r){for(var n,i=~(r-1),a=0;a<16;++a)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n;}function L(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r;}function D(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n];}function x(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n];}function M(e,t){K(e,t,t);}function K(e,t,r){var n,i,a=0,s=0,o=0,d=0,c=0,u=0,l=0,h=0,f=0,p=0,y=0,g=0,m=0,v=0,b=0,E=0,C=0,S=0,$=0,w=0,I=0,T=0,A=0,k=0,B=0,R=0,N=0,P=0,O=0,U=0,_=0,L=r[0],D=r[1],x=r[2],M=r[3],K=r[4],j=r[5],V=r[6],F=r[7],G=r[8],W=r[9],q=r[10],H=r[11],z=r[12],Q=r[13],Y=r[14],X=r[15];a+=(n=t[0])*L,s+=n*D,o+=n*x,d+=n*M,c+=n*K,u+=n*j,l+=n*V,h+=n*F,f+=n*G,p+=n*W,y+=n*q,g+=n*H,m+=n*z,v+=n*Q,b+=n*Y,E+=n*X,s+=(n=t[1])*L,o+=n*D,d+=n*x,c+=n*M,u+=n*K,l+=n*j,h+=n*V,f+=n*F,p+=n*G,y+=n*W,g+=n*q,m+=n*H,v+=n*z,b+=n*Q,E+=n*Y,C+=n*X,o+=(n=t[2])*L,d+=n*D,c+=n*x,u+=n*M,l+=n*K,h+=n*j,f+=n*V,p+=n*F,y+=n*G,g+=n*W,m+=n*q,v+=n*H,b+=n*z,E+=n*Q,C+=n*Y,S+=n*X,d+=(n=t[3])*L,c+=n*D,u+=n*x,l+=n*M,h+=n*K,f+=n*j,p+=n*V,y+=n*F,g+=n*G,m+=n*W,v+=n*q,b+=n*H,E+=n*z,C+=n*Q,S+=n*Y,$+=n*X,c+=(n=t[4])*L,u+=n*D,l+=n*x,h+=n*M,f+=n*K,p+=n*j,y+=n*V,g+=n*F,m+=n*G,v+=n*W,b+=n*q,E+=n*H,C+=n*z,S+=n*Q,$+=n*Y,w+=n*X,u+=(n=t[5])*L,l+=n*D,h+=n*x,f+=n*M,p+=n*K,y+=n*j,g+=n*V,m+=n*F,v+=n*G,b+=n*W,E+=n*q,C+=n*H,S+=n*z,$+=n*Q,w+=n*Y,I+=n*X,l+=(n=t[6])*L,h+=n*D,f+=n*x,p+=n*M,y+=n*K,g+=n*j,m+=n*V,v+=n*F,b+=n*G,E+=n*W,C+=n*q,S+=n*H,$+=n*z,w+=n*Q,I+=n*Y,T+=n*X,h+=(n=t[7])*L,f+=n*D,p+=n*x,y+=n*M,g+=n*K,m+=n*j,v+=n*V,b+=n*F,E+=n*G,C+=n*W,S+=n*q,$+=n*H,w+=n*z,I+=n*Q,T+=n*Y,A+=n*X,f+=(n=t[8])*L,p+=n*D,y+=n*x,g+=n*M,m+=n*K,v+=n*j,b+=n*V,E+=n*F,C+=n*G,S+=n*W,$+=n*q,w+=n*H,I+=n*z,T+=n*Q,A+=n*Y,k+=n*X,p+=(n=t[9])*L,y+=n*D,g+=n*x,m+=n*M,v+=n*K,b+=n*j,E+=n*V,C+=n*F,S+=n*G,$+=n*W,w+=n*q,I+=n*H,T+=n*z,A+=n*Q,k+=n*Y,B+=n*X,y+=(n=t[10])*L,g+=n*D,m+=n*x,v+=n*M,b+=n*K,E+=n*j,C+=n*V,S+=n*F,$+=n*G,w+=n*W,I+=n*q,T+=n*H,A+=n*z,k+=n*Q,B+=n*Y,R+=n*X,g+=(n=t[11])*L,m+=n*D,v+=n*x,b+=n*M,E+=n*K,C+=n*j,S+=n*V,$+=n*F,w+=n*G,I+=n*W,T+=n*q,A+=n*H,k+=n*z,B+=n*Q,R+=n*Y,N+=n*X,m+=(n=t[12])*L,v+=n*D,b+=n*x,E+=n*M,C+=n*K,S+=n*j,$+=n*V,w+=n*F,I+=n*G,T+=n*W,A+=n*q,k+=n*H,B+=n*z,R+=n*Q,N+=n*Y,P+=n*X,v+=(n=t[13])*L,b+=n*D,E+=n*x,C+=n*M,S+=n*K,$+=n*j,w+=n*V,I+=n*F,T+=n*G,A+=n*W,k+=n*q,B+=n*H,R+=n*z,N+=n*Q,P+=n*Y,O+=n*X,b+=(n=t[14])*L,E+=n*D,C+=n*x,S+=n*M,$+=n*K,w+=n*j,I+=n*V,T+=n*F,A+=n*G,k+=n*W,B+=n*q,R+=n*H,N+=n*z,P+=n*Q,O+=n*Y,U+=n*X,E+=(n=t[15])*L,s+=38*(S+=n*x),o+=38*($+=n*M),d+=38*(w+=n*K),c+=38*(I+=n*j),u+=38*(T+=n*V),l+=38*(A+=n*F),h+=38*(k+=n*G),f+=38*(B+=n*W),p+=38*(R+=n*q),y+=38*(N+=n*H),g+=38*(P+=n*z),m+=38*(O+=n*Q),v+=38*(U+=n*Y),b+=38*(_+=n*X),a=(n=(a+=38*(C+=n*D))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=(a+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),a+=i-1+37*(i-1),e[0]=a,e[1]=s,e[2]=o,e[3]=d,e[4]=c,e[5]=u,e[6]=l,e[7]=h,e[8]=f,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=v,e[14]=b,e[15]=E;}},24643:e=>{e.exports={options:{usePureJavaScript:!1}};},90081:(e,t,r)=>{var n=r(24643);r(69679),r(28550),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,a={start:function(a,s){if(null!==a)if("string"==typeof a){if(!((a=a.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+a+'"');t=n.md.algorithms[a].create();}else t=a;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var o=s;s=n.util.createBuffer();for(var d=0;d<o.length;++d)s.putByte(o[d]);}var c=s.length();for(c>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=s.length(),d=0;d<c;++d)o=s.at(d),r.putByte(54^o),i.putByte(92^o);if(c<t.blockLength)for(o=t.blockLength-c,d=0;d<o;++d)r.putByte(54),i.putByte(92);e=s,r=r.bytes(),i=i.bytes();}t.start(),t.update(r);},update:function(e){t.update(e);},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest();}};return a.digest=a.getMac,a;};},61828:(e,t,r)=>{e.exports=r(24643),r(13739),r(47885),r(7835),r(41457),r(92684),r(60773),r(90081),r(98323),r(7390),r(93314),r(66531),r(73939),r(75206),r(21054),r(23574),r(74056),r(61264),r(30339),r(47391),r(45114),r(75417),r(56339),r(88622),r(53105),r(28550);},10121:(e,t,r)=>{var n,i=r(24643);function a(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t));}function s(){return new a(null);}function o(e,t,r,n,i,a){for(var s=16383&t,o=t>>14;--a>=0;){var d=16383&this.data[e],c=this.data[e++]>>14,u=o*d+c*s;i=((d=s*d+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+o*c,r.data[n++]=268435455&d;}return i;}e.exports=i.jsbn=i.jsbn||{},i.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=o,n=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(e,t,r,n,i,a){for(var s=32767&t,o=t>>15;--a>=0;){var d=32767&this.data[e],c=this.data[e++]>>15,u=o*d+c*s;i=((d=s*d+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+o*c+(i>>>30),r.data[n++]=1073741823&d;}return i;},n=30):"Netscape"!=navigator.appName?(a.prototype.am=function(e,t,r,n,i,a){for(;--a>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s;}return i;},n=26):(a.prototype.am=o,n=28),a.prototype.DB=n,a.prototype.DM=(1<<n)-1,a.prototype.DV=1<<n,a.prototype.FV=Math.pow(2,52),a.prototype.F1=52-n,a.prototype.F2=2*n-52;var d,c,u=[];for(d="0".charCodeAt(0),c=0;c<=9;++c)u[d++]=c;for(d="a".charCodeAt(0),c=10;c<36;++c)u[d++]=c;for(d="A".charCodeAt(0),c=10;c<36;++c)u[d++]=c;function l(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e);}function h(e,t){var r=u[e.charCodeAt(t)];return null==r?-1:r;}function f(e){var t=s();return t.fromInt(e),t;}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r;}function y(e){this.m=e;}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t;}function m(e,t){return e&t;}function v(e,t){return e|t;}function b(e,t){return e^t;}function E(e,t){return e&~t;}function C(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t;}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t;}function $(){}function w(e){return e;}function I(e){this.r2=s(),this.q3=s(),a.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e;}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e;},y.prototype.revert=function(e){return e;},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e);},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r);},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t);},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(a.ZERO)>0&&this.m.subTo(t,t),t;},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t;},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++;}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e);},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r);},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t);},a.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s;},a.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0;},a.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2;}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var o=8==r?255&e[n]:h(e,n);o<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,(s+=r)>=this.DB&&(s-=this.DB));}8==r&&128&e[0]&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&a.ZERO.subTo(this,this);},a.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t;},a.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s;},a.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s;},a.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,a=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|o,o=(this.data[r]&a)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp();},a.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&a)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp();}},a.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s;}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s;}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp();},a.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&a.ZERO.subTo(t,t);},a.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1);}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp();},a.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var o=s(),d=this.s,c=e.s,u=this.DB-p(n.data[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var l=o.t,h=o.data[l-1];if(0!=h){var f=h*(1<<this.F1)+(l>1?o.data[l-2]>>this.F2:0),y=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,v=r.t,b=v-l,E=null==t?s():t;for(o.dlShiftTo(b,E),r.compareTo(E)>=0&&(r.data[r.t++]=1,r.subTo(E,r)),a.ONE.dlShiftTo(l,E),E.subTo(o,o);o.t<l;)o.data[o.t++]=0;for(;--b>=0;){var C=r.data[--v]==h?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=o.am(0,C,r,b,0,l))<C)for(o.dlShiftTo(b,E),r.subTo(E,r);r.data[v]<--C;)r.subTo(E,r);}null!=t&&(r.drShiftTo(l,t),d!=c&&a.ZERO.subTo(t,t)),r.t=l,r.clamp(),u>0&&r.rShiftTo(u,r),d<0&&a.ZERO.subTo(r,r);}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t;},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s);},a.prototype.exp=function(e,t){if(e>4294967295||e<1)return a.ONE;var r=s(),n=s(),i=t.convert(this),o=p(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var d=r;r=n,n=d;}return t.revert(r);},a.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2;}var r,n=(1<<t)-1,i=!1,a="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(r=this.data[s]>>o)>0&&(i=!0,a=l(r));s>=0;)o<t?(r=(this.data[s]&(1<<o)-1)<<t-o,r|=this.data[--s]>>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&n,o<=0&&(o+=this.DB,--s)),r>0&&(i=!0),i&&(a+=l(r));return i?a:"0";},a.prototype.negate=function(){var e=s();return a.ZERO.subTo(this,e),e;},a.prototype.abs=function(){return this.s<0?this.negate():this;},a.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0;},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM);},a.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t;},a.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r);},a.ZERO=f(0),a.ONE=f(1),$.prototype.convert=w,$.prototype.revert=w,$.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r);},$.prototype.sqrTo=function(e,t){e.squareTo(t);},I.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t;},I.prototype.revert=function(e){return e;},I.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e);},I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r);},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t);};var T=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],A=(1<<26)/T[T.length-1];a.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e));},a.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=f(r),i=s(),a=s(),o="";for(this.divRemTo(n,i,a);i.signum()>0;)o=(r+a.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,a);return a.intValue().toString(e)+o;},a.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,o=0,d=0;d<e.length;++d){var c=h(e,d);c<0?"-"==e.charAt(d)&&0==this.signum()&&(i=!0):(o=t*o+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0));}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&a.ZERO.subTo(this,this);},a.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var n=[],i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256);}},a.prototype.bitwiseTo=function(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t;}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t;}r.s=t(this.s,e.s),r.clamp();},a.prototype.changeBit=function(e,t){var r=a.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r;},a.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s;}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s;}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp();},a.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp();},a.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t];}},a.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp();},a.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r);},a.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r;},a.prototype.millerRabin=function(e){var t=this.subtract(a.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random());}},o=0;o<e;++o){do{n=new a(this.bitLength(),s);}while(n.compareTo(a.ONE)<=0||n.compareTo(t)>=0);var d=n.modPow(i,this);if(0!=d.compareTo(a.ONE)&&0!=d.compareTo(t)){for(var c=1;c++<r&&0!=d.compareTo(t);)if(0==(d=d.modPowInt(2,this)).compareTo(a.ONE))return!1;if(0!=d.compareTo(t))return!1;}}return!0;},a.prototype.clone=function(){var e=s();return this.copyTo(e),e;},a.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1;}else{if(1==this.t)return this.data[0];if(0==this.t)return 0;}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0];},a.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24;},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16;},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1;},a.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),128&r&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t;},a.prototype.equals=function(e){return 0==this.compareTo(e);},a.prototype.min=function(e){return this.compareTo(e)<0?this:e;},a.prototype.max=function(e){return this.compareTo(e)>0?this:e;},a.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t;},a.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t;},a.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,b,t),t;},a.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t;},a.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e;},a.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t;},a.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t;},a.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+C(this.data[e]);return this.s<0?this.t*this.DB:-1;},a.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e;},a.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this.data[t]&1<<e%this.DB);},a.prototype.setBit=function(e){return this.changeBit(e,v);},a.prototype.clearBit=function(e){return this.changeBit(e,E);},a.prototype.flipBit=function(e){return this.changeBit(e,b);},a.prototype.add=function(e){var t=s();return this.addTo(e,t),t;},a.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t;},a.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t;},a.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t;},a.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t;},a.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),[t,r];},a.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),a=f(1);if(i<=0)return a;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new I(t):new g(t);var o=[],d=3,c=r-1,u=(1<<r)-1;if(o[1]=n.convert(this),r>1){var l=s();for(n.sqrTo(o[1],l);d<=u;)o[d]=s(),n.mulTo(l,o[d-2],o[d]),d+=2;}var h,m,v=e.t-1,b=!0,E=s();for(i=p(e.data[v])-1;v>=0;){for(i>=c?h=e.data[v]>>i-c&u:(h=(e.data[v]&(1<<i+1)-1)<<c-i,v>0&&(h|=e.data[v-1]>>this.DB+i-c)),d=r;!(1&h);)h>>=1,--d;if((i-=d)<0&&(i+=this.DB,--v),b)o[h].copyTo(a),b=!1;else{for(;d>1;)n.sqrTo(a,E),n.sqrTo(E,a),d-=2;d>0?n.sqrTo(a,E):(m=a,a=E,E=m),n.mulTo(E,o[h],a);}for(;v>=0&&!(e.data[v]&1<<i);)n.sqrTo(a,E),m=a,a=E,E=m,--i<0&&(i=this.DB-1,--v);}return n.revert(a);},a.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var r=e.clone(),n=this.clone(),i=f(1),s=f(0),o=f(0),d=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&d.isEven()||(o.addTo(this,o),d.subTo(e,d)),o.rShiftTo(1,o)):d.isEven()||d.subTo(e,d),d.rShiftTo(1,d);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(o,i),s.subTo(d,s)):(n.subTo(r,n),t&&o.subTo(i,o),d.subTo(s,d));}return 0!=n.compareTo(a.ONE)?a.ZERO:d.compareTo(e)>=0?d.subtract(e):d.signum()<0?(d.addTo(e,d),d.signum()<0?d.add(e):d):d;},a.prototype.pow=function(e){return this.exp(e,new $);},a.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n;}var i=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r;},a.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=T[T.length-1]){for(t=0;t<T.length;++t)if(r.data[0]==T[t])return!0;return!1;}if(r.isEven())return!1;for(t=1;t<T.length;){for(var n=T[t],i=t+1;i<T.length&&n<A;)n*=T[i++];for(n=r.modInt(n);t<i;)if(n%T[t++]==0)return!1;}return r.millerRabin(e);};},98323:(e,t,r)=>{var n=r(24643);r(28550),r(75417),r(10121),e.exports=n.kem=n.kem||{};var i=n.jsbn.BigInteger;function a(e,t,r,i){e.generate=function(e,a){for(var s=new n.util.ByteBuffer,o=Math.ceil(a/i)+r,d=new n.util.ByteBuffer,c=r;c<o;++c){d.putInt32(c),t.start(),t.update(e+d.getBytes());var u=t.digest();s.putBytes(u.getBytes(i));}return s.truncate(s.length()-a),s.getBytes();};}n.kem.rsa={},n.kem.rsa.create=function(e,t){var r=(t=t||{}).prng||n.random;return{encrypt:function(t,a){var s,o=Math.ceil(t.n.bitLength()/8);do{s=new i(n.util.bytesToHex(r.getBytesSync(o)),16).mod(t.n);}while(s.compareTo(i.ONE)<=0);var d=o-(s=n.util.hexToBytes(s.toString(16))).length;return d>0&&(s=n.util.fillString(String.fromCharCode(0),d)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,a)};},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n);}};},n.kem.kdf1=function(e,t){a(this,e,0,t||e.digestLength);},n.kem.kdf2=function(e,t){a(this,e,1,t||e.digestLength);};},7390:(e,t,r)=>{var n=r(24643);r(28550),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var i={},a=[],s=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var o=0;o<n.log.levels.length;++o){var d=n.log.levels[o];i[d]={index:o,name:d.toUpperCase()};}n.log.logMessage=function(e){for(var t=i[e.level].index,r=0;r<a.length;++r){var s=a[r];s.flags&n.log.NO_LEVEL_CHECK?s.f(e):t<=i[s.level].index&&s.f(s,e);}},n.log.prepareStandard=function(e){"standard"in e||(e.standard=i[e.level].name+" ["+e.category+"] "+e.message);},n.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||0),e.full=n.util.format.apply(this,t);}},n.log.prepareStandardFull=function(e){"standardFull"in e||(n.log.prepareStandard(e),e.standardFull=e.standard);};var c=["error","warning","info","debug","verbose"];for(o=0;o<c.length;++o)!function(e){n.log[e]=function(t,r){var i=Array.prototype.slice.call(arguments).slice(2),a={timestamp:new Date,level:e,category:t,message:r,arguments:i};n.log.logMessage(a);};}(c[o]);if(n.log.makeLogger=function(e){var t={flags:0,f:e};return n.log.setLevel(t,"none"),t;},n.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&n.log.LEVEL_LOCKED))for(var i=0;i<n.log.levels.length;++i)if(t==n.log.levels[i]){e.level=t,r=!0;break;}return r;},n.log.lock=function(e,t){void 0===t||t?e.flags|=n.log.LEVEL_LOCKED:e.flags&=~n.log.LEVEL_LOCKED;},n.log.addLogger=function(e){a.push(e);},"undefined"!=typeof console&&"log"in console){var u;if(console.error&&console.warn&&console.info&&console.debug){var l={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},h=function(e,t){n.log.prepareStandard(t);var r=l[t.level],i=[t.standard];i=i.concat(t.arguments.slice()),r.apply(console,i);};u=n.log.makeLogger(h);}else h=function(e,t){n.log.prepareStandardFull(t),console.log(t.standardFull);},u=n.log.makeLogger(h);n.log.setLevel(u,"debug"),n.log.addLogger(u),s=u;}else console={log:function(){}};if(null!==s&&"undefined"!=typeof window&&window.location){var f=new URL(window.location.href).searchParams;f.has("console.level")&&n.log.setLevel(s,f.get("console.level").slice(-1)[0]),f.has("console.lock")&&"true"==f.get("console.lock").slice(-1)[0]&&n.log.lock(s);}n.log.consoleLogger=s;},93314:(e,t,r)=>{e.exports=r(69679),r(94412),r(60943),r(17585),r(30260);},69679:(e,t,r)=>{var n=r(24643);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{};},94412:(e,t,r)=>{var n=r(24643);r(69679),r(28550);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||function(){a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],d=new Array(64);for(var e=0;e<64;++e)d[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));c=!0;}();var e=null,t=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},i;}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var o=a.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var d=i.fullMessageLength.length-1;d>=0;--d)i.fullMessageLength[d]+=o[1],o[1]=o[0]+(i.fullMessageLength[d]/4294967296>>>0),i.fullMessageLength[d]=i.fullMessageLength[d]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i;},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-o));for(var d,c=0,l=i.fullMessageLength.length-1;l>=0;--l)c=(d=8*i.fullMessageLength[l]+c)/4294967296>>>0,s.putInt32Le(d>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};u(h,r,s);var f=n.util.createBuffer();return f.putInt32Le(h.h0),f.putInt32Le(h.h1),f.putInt32Le(h.h2),f.putInt32Le(h.h3),f;},i;};var a=null,s=null,o=null,d=null,c=!1;function u(e,t,r){for(var n,i,a,c,u,l,h,f=r.length();f>=64;){for(i=e.h0,a=e.h1,c=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),n=i+(u^a&(c^u))+d[h]+t[h],i=u,u=c,c=a,a+=n<<(l=o[h])|n>>>32-l;for(;h<32;++h)n=i+(c^u&(a^c))+d[h]+t[s[h]],i=u,u=c,c=a,a+=n<<(l=o[h])|n>>>32-l;for(;h<48;++h)n=i+(a^c^u)+d[h]+t[s[h]],i=u,u=c,c=a,a+=n<<(l=o[h])|n>>>32-l;for(;h<64;++h)n=i+(c^(a|~u))+d[h]+t[s[h]],i=u,u=c,c=a,a+=n<<(l=o[h])|n>>>32-l;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+c|0,e.h3=e.h3+u|0,f-=64;}}},32046:(e,t,r)=>{var n=r(24643);r(66531),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1;},66531:(e,t,r)=>{var n=r(24643);r(28550),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,a=Math.ceil(r/e.digestLength),s=0;s<a;s++){var o=new n.util.ByteBuffer;o.putInt32(s),e.start(),e.update(t+o.getBytes()),i.putBuffer(e.digest());}return i.truncate(i.length()-r),i.getBytes();}};};},74467:(e,t,r)=>{var n=r(24643);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function a(e,t){i[e]=t,i[t]=e;}function s(e,t){i[e]=t;}a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.3.101.112","EdDSA25519"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("1.3.14.3.2.29","sha1WithRSASignature"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("2.16.840.1.101.3.4.2.4","sha224"),a("2.16.840.1.101.3.4.2.5","sha512-224"),a("2.16.840.1.101.3.4.2.6","sha512-256"),a("1.2.840.113549.2.2","md2"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.4","surname"),a("2.5.4.5","serialNumber"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.9","streetAddress"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.12","title"),a("2.5.4.13","description"),a("2.5.4.15","businessCategory"),a("2.5.4.17","postalCode"),a("2.5.4.42","givenName"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping");},44117:(e,t,r)=>{var n=r(24643);if(r(13739),r(7835),r(92684),r(69679),r(74467),r(73939),r(75206),r(75417),r(56339),r(72374),r(28550),void 0===i)var i=n.jsbn.BigInteger;var a=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var o=s.oids,d={name:"EncryptedPrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},u={name:"pkcs-12PbeParams",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"iterations"}]};function l(e,t){return e.start().update(t).digest().getBytes();}function h(e){var t;if(e){if(!(t=s.oids[a.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r;}}else t="hmacWithSHA1";return f(t);}function f(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r;}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create();}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,d,c,u=n.random.getBytesSync(r.saltSize),l=r.count,h=a.integerToDer(l);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,y,g;switch(r.algorithm){case"aes128":i=16,p=16,y=o["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,y=o["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,y=o["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,y=o.desCBC,g=n.des.createEncryptionCipher;break;default:throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),b=n.pkcs5.pbkdf2(t,u,l,i,v),E=n.random.getBytesSync(p);($=g(b)).start(E),$.update(a.toDer(e)),$.finish(),c=$.output.getBytes();var C=function(e,t,r,i){var o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&o.value.push(a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(s.oids[i]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")])),o;}(u,h,i,m);d=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.pkcs5PBES2).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.pkcs5PBKDF2).getBytes()),C]),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(y).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,E)])])]);}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var $,w=new n.util.ByteBuffer(u);b=s.pbe.generatePkcs12Key(t,w,1,l,i),E=s.pbe.generatePkcs12Key(t,w,2,l,i),($=n.des.createEncryptionCipher(b)).start(E),$.update(a.toDer(e)),$.finish(),c=$.output.getBytes(),d=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,u),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,h.getBytes())])]);}return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[d,a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,c)]);},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},o=[];if(!a.validate(e,d,i,o)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=o,c;}var u=a.derToOid(i.encryptionOid),l=s.pbe.getCipher(u,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return l.update(h),l.finish()&&(r=a.fromDer(l.output)),r;},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t});},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r;}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return a.fromDer(t.body);},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i);}var o,d,c,u;switch(r.algorithm){case"aes128":o="AES-128-CBC",c=16,d=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,d=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,d=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,d=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,d=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;default:var l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw l.algorithm=r.algorithm,l;}var h=u(n.pbe.opensslDeriveBytes(t,d.substr(0,8),c));h.start(d),h.update(a.toDer(s.privateKeyToAsn1(e))),h.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:n.util.bytesToHex(d).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(f);},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,d;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,d=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,d=n.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,d=n.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,d=n.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,d=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,d=function(e){return n.rc2.createDecryptionCipher(e,40);};break;case"RC2-64-CBC":o=8,d=function(e){return n.rc2.createDecryptionCipher(e,64);};break;case"RC2-128-CBC":o=16,d=function(e){return n.rc2.createDecryptionCipher(e,128);};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c;}var u=n.util.hexToBytes(i.dekInfo.parameters),l=d(n.pbe.opensslDeriveBytes(t,u.substr(0,8),o));if(l.start(u),l.update(n.util.createBuffer(i.body)),!l.finish())return r;r=l.output.getBytes();}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(a.fromDer(r),t):a.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r;},s.pbe.generatePkcs12Key=function(e,t,r,i,a,s){var o,d;if(null==s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create();}var c=s.digestLength,u=s.blockLength,l=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!=e){for(d=0;d<e.length;d++)h.putInt16(e.charCodeAt(d));h.putInt16(0);}var f=h.length(),p=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,u);var g=u*Math.ceil(p/u),m=new n.util.ByteBuffer;for(d=0;d<g;d++)m.putByte(t.at(d%p));var v=u*Math.ceil(f/u),b=new n.util.ByteBuffer;for(d=0;d<v;d++)b.putByte(h.at(d%f));var E=m;E.putBuffer(b);for(var C=Math.ceil(a/c),S=1;S<=C;S++){var $=new n.util.ByteBuffer;$.putBytes(y.bytes()),$.putBytes(E.bytes());for(var w=0;w<i;w++)s.start(),s.update($.getBytes()),$=s.digest();var I=new n.util.ByteBuffer;for(d=0;d<u;d++)I.putByte($.at(d%c));var T=Math.ceil(p/u)+Math.ceil(f/u),A=new n.util.ByteBuffer;for(o=0;o<T;o++){var k=new n.util.ByteBuffer(E.getBytes(u)),B=511;for(d=I.length()-1;d>=0;d--)B>>=8,B+=I.at(d)+k.at(d),k.setAt(d,255&B);A.putBuffer(k);}E=A,l.putBuffer($);}return l.truncate(l.length()-a),l;},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n;}},s.pbe.getCipherForPBES2=function(e,t,r){var i,o={},d=[];if(!a.validate(t,c,o,d))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=d,i;if((e=a.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=a.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var u,l,f=o.kdfSalt,p=n.util.createBuffer(o.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":u=16,l=n.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,l=n.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,l=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,l=n.des.createDecryptionCipher;break;case"desCBC":u=8,l=n.des.createDecryptionCipher;}var y=h(o.prfOid),g=n.pkcs5.pbkdf2(r,f,p,u,y),m=o.encIv,v=l(g);return v.start(m),v;},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},o=[];if(!a.validate(t,u,i,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var d,c,l,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,c=8,l=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,c=8,l=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r;};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y;}var g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,f,1,p,d,g);return g.start(),l(m,s.pbe.generatePkcs12Key(r,f,2,p,c,g));},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create();}null===t&&(t="");for(var a=[l(i,e+t)],s=16,o=1;s<r;++o,s+=16)a.push(l(i,a[o-1]+e+t));return a.join("").substr(0,r);};},73939:(e,t,r)=>{var n=r(1048).Buffer,i=r(24643);r(90081),r(69679),r(28550);var a,s=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(a=r(49701)),e.exports=i.pbkdf2=s.pbkdf2=function(e,t,r,s,o,d){if("function"==typeof o&&(d=o,o=null),i.util.isNodejs&&!i.options.usePureJavaScript&&a.pbkdf2&&(null===o||"object"!=typeof o)&&(a.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),e=n.from(e,"binary"),t=n.from(t,"binary"),d?4===a.pbkdf2Sync.length?a.pbkdf2(e,t,r,s,(function(e,t){if(e)return d(e);d(null,t.toString("binary"));})):a.pbkdf2(e,t,r,s,o,(function(e,t){if(e)return d(e);d(null,t.toString("binary"));})):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,t,r,s).toString("binary"):a.pbkdf2Sync(e,t,r,s,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in i.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=i.md[o].create();}var c=o.digestLength;if(s>4294967295*c){var u=new Error("Derived key is too long.");if(d)return d(u);throw u;}var l=Math.ceil(s/c),h=s-(l-1)*c,f=i.hmac.create();f.start(o,e);var p,y,g,m="";if(!d){for(var v=1;v<=l;++v){f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(v)),p=g=f.digest().getBytes();for(var b=2;b<=r;++b)f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,c),g=y;m+=v<l?p:p.substr(0,h);}return m;}function E(){if(v>l)return d(null,m);f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(v)),p=g=f.digest().getBytes(),b=2,C();}function C(){if(b<=r)return f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,c),g=y,++b,i.util.setImmediate(C);m+=v<l?p:p.substr(0,h),++v,E();}v=1,E();};},75206:(e,t,r)=>{var n=r(24643);r(28550);var i=e.exports=n.pem=n.pem||{};function a(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t;},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var a=0,s=-1;for(i=0;i<t.length;++i,++a)if(a>65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),a=i-s-1,s=-1,++i;}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t;}function s(e){return e.replace(/^\s+/,"");}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=a(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=a(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=a(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=a(e.headers[s]);return e.procType&&(i+="\r\n"),(i+=n.util.encode64(e.body,t.maxline||64)+"\r\n")+"-----END "+e.type+"-----\r\n";},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,o=/\r?\n/;t=i.exec(e);){var d=t[1];"NEW CERTIFICATE REQUEST"===d&&(d="CERTIFICATE REQUEST");var c={type:d,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(c),t[2]){for(var u=t[2].split(o),l=0;t&&l<u.length;){for(var h=u[l].replace(/\s+$/,""),f=l+1;f<u.length;++f){var p=u[f];if(!/\s/.test(p[0]))break;h+=p,l=f;}if(t=h.match(a)){for(var y={name:t[1],values:[]},g=t[2].split(","),m=0;m<g.length;++m)y.values.push(s(g[m]));if(c.procType)if(c.contentDomain||"Content-Domain"!==y.name)if(c.dekInfo||"DEK-Info"!==y.name)c.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:g[0],parameters:g[1]||null};}else c.contentDomain=g[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:g[0],type:g[1]};}}++l;}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r;};},21054:(e,t,r)=>{var n=r(24643);r(28550),r(75417),r(60943);var i=e.exports=n.pkcs1=n.pkcs1||{};function a(e,t,r){r||(r=n.md.sha1.create());for(var i="",a=Math.ceil(t/r.digestLength),s=0;s<a;++s){var o=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+o),i+=r.digest().getBytes();}return i.substring(0,t);}i.encode_rsa_oaep=function(e,t,r){var i,s,o,d;"string"==typeof r?(i=r,s=arguments[3]||void 0,o=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(d=r.mgf1.md)),o?o.start():o=n.md.sha1.create(),d||(d=o);var c=Math.ceil(e.n.bitLength()/8),u=c-2*o.digestLength-2;if(t.length>u)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=u,g;i||(i=""),o.update(i,"raw");for(var l=o.digest(),h="",f=u-t.length,p=0;p<f;p++)h+="\0";var y=l.getBytes()+h+""+t;if(s){if(s.length!==o.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,g.digestLength=o.digestLength,g;}}else s=n.random.getBytes(o.digestLength);var m=a(s,c-o.digestLength-1,d),v=n.util.xorBytes(y,m,y.length),b=a(v,o.digestLength,d);return"\0"+n.util.xorBytes(s,b,s.length)+v;},i.decode_rsa_oaep=function(e,t,r){var i,s,o;"string"==typeof r?(i=r,s=arguments[3]||void 0):r&&(i=r.label||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md));var d=Math.ceil(e.n.bitLength()/8);if(t.length!==d)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,m.expectedLength=d,m;if(void 0===s?s=n.md.sha1.create():s.start(),o||(o=s),d<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var c=s.digest().getBytes(),u=t.charAt(0),l=t.substring(1,s.digestLength+1),h=t.substring(1+s.digestLength),f=a(h,s.digestLength,o),p=a(n.util.xorBytes(l,f,l.length),d-s.digestLength-1,o),y=n.util.xorBytes(h,p,h.length),g=y.substring(0,s.digestLength),m="\0"!==u,v=0;v<s.digestLength;++v)m|=c.charAt(v)!==g.charAt(v);for(var b=1,E=s.digestLength,C=s.digestLength;C<y.length;C++){var S=y.charCodeAt(C);m|=S&(b?65534:0),E+=b&=1&S^1;}if(m||1!==y.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return y.substring(E+1);};},23574:(e,t,r)=>{var n=r(24643);r(7835),r(90081),r(74467),r(44793),r(44117),r(75417),r(72374),r(60943),r(28550),r(846);var i=n.asn1,a=n.pki,s=e.exports=n.pkcs12=n.pkcs12||{},o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},d={name:"PFX",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},o,{name:"PFX.macData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},u={name:"Attribute",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,capture:"values"}]},l={name:"CertBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:i.Class.UNIVERSAL,type:i.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function h(e,t,r,n){for(var i=[],a=0;a<e.length;a++)for(var s=0;s<e[a].safeBags.length;s++){var o=e[a].safeBags[s];void 0!==n&&o.type!==n||(null!==t?void 0!==o.attributes[t]&&o.attributes[t].indexOf(r)>=0&&i.push(o):i.push(o));}return i;}function f(e){if(e.composed||e.constructed){for(var t=n.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes();}return e;}function p(e,t){var r={},s=[];if(!i.validate(e,n.pkcs7.asn1.encryptedDataValidator,r,s))throw(o=new Error("Cannot read EncryptedContentInfo.")).errors=s,o;var o,d=i.derToOid(r.contentType);if(d!==a.oids.data)throw(o=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=d,o;d=i.derToOid(r.encAlgorithm);var c=a.pbe.getCipher(d,r.encParameter,t),u=f(r.encryptedContentAsn1),l=n.util.createBuffer(u.value);if(c.update(l),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes();}function y(e,t,r){if(!t&&0===e.length)return[];if((e=i.fromDer(e,t)).tagClass!==i.Class.UNIVERSAL||e.type!==i.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],s=0;s<e.value.length;s++){var o=e.value[s],d={},u=[];if(!i.validate(o,c,d,u))throw(m=new Error("Cannot read SafeBag.")).errors=u,m;var h,f,p={type:i.derToOid(d.bagId),attributes:g(d.bagAttributes)};n.push(p);var y=d.bagValue.value[0];switch(p.type){case a.oids.pkcs8ShroudedKeyBag:if(null===(y=a.decryptPrivateKeyInfo(y,r)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case a.oids.keyBag:try{p.key=a.privateKeyFromAsn1(y);}catch(e){p.key=null,p.asn1=y;}continue;case a.oids.certBag:h=l,f=function(){if(i.derToOid(d.certId)!==a.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=i.derToOid(d.certId),e;}var r=i.fromDer(d.cert,t);try{p.cert=a.certificateFromAsn1(r,!0);}catch(e){p.cert=null,p.asn1=r;}};break;default:var m;throw(m=new Error("Unsupported PKCS#12 SafeBag type.")).oid=p.type,m;}if(void 0!==h&&!i.validate(y,h,d,u))throw(m=new Error("Cannot read PKCS#12 "+h.name)).errors=u,m;f();}return n;}function g(e){var t={};if(void 0!==e)for(var r=0;r<e.length;++r){var n={},s=[];if(!i.validate(e[r],u,n,s)){var o=new Error("Cannot read PKCS#12 BagAttribute.");throw o.errors=s,o;}var d=i.derToOid(n.oid);if(void 0!==a.oids[d]){t[a.oids[d]]=[];for(var c=0;c<n.values.length;++c)t[a.oids[d]].push(n.values[c].value);}}return t;}s.pkcs12FromAsn1=function(e,t,r){"string"==typeof t?(r=t,t=!0):void 0===t&&(t=!0);var c={};if(!i.validate(e,d,c,[]))throw(u=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=u,u;var u,l={version:c.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=n.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=h(l.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=h(l.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=h(l.safeContents,"friendlyName",e.friendlyName,e.bagType)),r;},getBagsByFriendlyName:function(e,t){return h(l.safeContents,"friendlyName",e,t);},getBagsByLocalKeyId:function(e,t){return h(l.safeContents,"localKeyId",e,t);}};if(3!==c.version.charCodeAt(0))throw(u=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=c.version.charCodeAt(0),u;if(i.derToOid(c.contentType)!==a.oids.data)throw(u=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=i.derToOid(c.contentType),u;var g=c.content.value[0];if(g.tagClass!==i.Class.UNIVERSAL||g.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(g=f(g),c.mac){var m=null,v=0,b=i.derToOid(c.macAlgorithm);switch(b){case a.oids.sha1:m=n.md.sha1.create(),v=20;break;case a.oids.sha256:m=n.md.sha256.create(),v=32;break;case a.oids.sha384:m=n.md.sha384.create(),v=48;break;case a.oids.sha512:m=n.md.sha512.create(),v=64;break;case a.oids.md5:m=n.md.md5.create(),v=16;}if(null===m)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+b);var E=new n.util.ByteBuffer(c.macSalt),C="macIterations"in c?parseInt(n.util.bytesToHex(c.macIterations),16):1,S=s.generateKey(r,E,3,C,v,m),$=n.hmac.create();if($.start(m,S),$.update(g.value),$.getMac().getBytes()!==c.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?");}return function(e,t,r,n){if((t=i.fromDer(t,r)).tagClass!==i.Class.UNIVERSAL||t.type!==i.Type.SEQUENCE||!0!==t.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<t.value.length;s++){var d=t.value[s],c={},u=[];if(!i.validate(d,o,c,u))throw(m=new Error("Cannot read ContentInfo.")).errors=u,m;var l={encrypted:!1},h=null,g=c.content.value[0];switch(i.derToOid(c.contentType)){case a.oids.data:if(g.tagClass!==i.Class.UNIVERSAL||g.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=f(g).value;break;case a.oids.encryptedData:h=p(g,n),l.encrypted=!0;break;default:var m;throw(m=new Error("Unsupported PKCS#12 contentType.")).contentType=i.derToOid(c.contentType),m;}l.safeBags=y(h,r,n),e.safeContents.push(l);}}(l,g.value,t,r),l;},s.toPkcs12Asn1=function(e,t,r,o){(o=o||{}).saltSize=o.saltSize||8,o.count=o.count||2048,o.algorithm=o.algorithm||o.encAlgorithm||"aes128","useMac"in o||(o.useMac=!0),"localKeyId"in o||(o.localKeyId=null),"generateLocalKeyId"in o||(o.generateLocalKeyId=!0);var d,c=o.localKeyId;if(null!==c)c=n.util.hexToBytes(c);else if(o.generateLocalKeyId)if(t){var u=n.util.isArray(t)?t[0]:t;"string"==typeof u&&(u=a.certificateFromPem(u)),(A=n.md.sha1.create()).update(i.toDer(a.certificateToAsn1(u)).getBytes()),c=A.digest().getBytes();}else c=n.random.getBytes(20);var l=[];null!==c&&l.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.localKeyId).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,c)])])),"friendlyName"in o&&l.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.friendlyName).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.BMPSTRING,!1,o.friendlyName)])])),l.length>0&&(d=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,l));var h=[],f=[];null!==t&&(f=n.util.isArray(t)?t:[t]);for(var p=[],y=0;y<f.length;++y){"string"==typeof(t=f[y])&&(t=a.certificateFromPem(t));var g=0===y?d:void 0,m=a.certificateToAsn1(t),v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.certBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.x509Certificate).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(m).getBytes())])])]),g]);p.push(v);}if(p.length>0){var b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,p),E=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(b).getBytes())])]);h.push(E);}var C=null;if(null!==e){var S=a.wrapRsaPrivateKey(a.privateKeyToAsn1(e));C=null===r?i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.keyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[S]),d]):i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(S,r,o)]),d]);var $=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[C]),w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer($).getBytes())])]);h.push(w);}var I,T=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,h);if(o.useMac){var A=n.md.sha1.create(),k=new n.util.ByteBuffer(n.random.getBytes(o.saltSize)),B=o.count,R=(e=s.generateKey(r,k,3,B,20),n.hmac.create());R.start(A,e),R.update(i.toDer(T).getBytes());var N=R.getMac();I=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.sha1).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,N.getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,k.getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(B).getBytes())]);}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(3).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(T).getBytes())])]),I]);},s.generateKey=n.pbe.generatePkcs12Key;},74056:(e,t,r)=>{var n=r(24643);r(13739),r(7835),r(92684),r(74467),r(75206),r(44793),r(75417),r(28550),r(846);var i=n.asn1,a=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,a.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s;}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}};}function o(e){for(var t,r=[],a=0;a<e.length;++a)r.push((t=e[a],i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:t.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.encryptedContent.content)])));return r;}function d(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),a=0;a<e.unauthenticatedAttributes.length;++a){var s=e.unauthenticatedAttributes[a];r.values.push(c(s));}t.value.push(r);}return t;}function c(e){var t;if(e.type===n.pki.oids.contentType)t=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.value).getBytes());else if(e.type===n.pki.oids.messageDigest)t=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),a=new Date("2050-01-01T00:00:00Z"),s=e.value;if("string"==typeof s){var o=Date.parse(s);s=isNaN(o)?13===s.length?i.utcTimeToDate(s):i.generalizedTimeToDate(s):new Date(o);}t=s>=r&&s<a?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(s)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(s));}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[t])]);}function u(e,t,r){var a={};if(!i.validate(t,r,a,[])){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s;}if(i.derToOid(a.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(a.encryptedContent){var o="";if(n.util.isArray(a.encryptedContent))for(var d=0;d<a.encryptedContent.length;++d){if(a.encryptedContent[d].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=a.encryptedContent[d].value;}else o=a.encryptedContent;e.encryptedContent={algorithm:i.derToOid(a.encAlgorithm),parameter:n.util.createBuffer(a.encParameter.value),content:n.util.createBuffer(o)};}if(a.content){if(o="",n.util.isArray(a.content))for(d=0;d<a.content.length;++d){if(a.content[d].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=a.content[d].value;}else o=a.content;e.content=n.util.createBuffer(o);}return e.version=a.version.charCodeAt(0),e.rawCapture=a,a;}function l(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:t=n.aes.createDecryptionCipher(e.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:t=n.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm);}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output;}}a.messageFromPem=function(e){var t=n.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r;}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return a.messageFromAsn1(s);},a.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t});},a.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,a.asn1.contentInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw s.errors=r,s;}var o,d=i.derToOid(t.contentType);switch(d){case n.pki.oids.envelopedData:o=a.createEnvelopedData();break;case n.pki.oids.encryptedData:o=a.createEncryptedData();break;case n.pki.oids.signedData:o=a.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+d+" is not (yet) supported.");}return o.fromAsn1(t.content.value[0]),o;},a.createSignedData=function(){var e=null;return e={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(u(e,t,a.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,i=0;i<r.length;++i)e.certificates.push(n.pki.certificateFromAsn1(r[i]));},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(n.pki.certificateToAsn1(e.certificates[r]));var a=[],s=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),a.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,a)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s]);},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var a=t.certificate;"string"==typeof a&&(a=n.pki.certificateFromPem(a)),r=a.issuer.attributes,i=a.serialNumber;}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||n.pki.oids.sha1;switch(o){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o);}var d=t.authenticatedAttributes||[];if(d.length>0){for(var c=!1,u=!1,l=0;l<d.length;++l){var h=d[l];if(c||h.type!==n.pki.oids.contentType){if(u||h.type!==n.pki.oids.messageDigest);else if(u=!0,c)break;}else if(c=!0,u)break;}if(!c||!u)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}e.signers.push({key:s,version:1,issuer:r,serialNumber:i,digestAlgorithm:o,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:d,unauthenticatedAttributes:[]});},sign:function(t){var r;t=t||{},("object"!=typeof e.content||null===e.contentInfo)&&(e.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof n.util.ByteBuffer?r=e.content.bytes():"string"==typeof e.content&&(r=n.util.encodeUtf8(e.content)),t.detached?e.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)])))),0!==e.signers.length&&function(t){var r;if(!(r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var a=i.derToOid(e.contentInfo.value[0].value),s=i.toDer(r);for(var o in s.getByte(),i.getBerValueLength(s),s=s.getBytes(),t)t[o].start().update(s);for(var u=new Date,l=0;l<e.signers.length;++l){var h=e.signers[l];if(0===h.authenticatedAttributes.length){if(a!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");}else{h.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),p=0;p<h.authenticatedAttributes.length;++p){var y=h.authenticatedAttributes[p];y.type===n.pki.oids.messageDigest?y.value=t[h.digestAlgorithm].digest():y.type===n.pki.oids.signingTime&&(y.value||(y.value=u)),f.value.push(c(y)),h.authenticatedAttributesAsn1.value.push(c(y));}s=i.toDer(f).getBytes(),h.md.start().update(s);}h.signature=h.key.sign(h.md,"RSASSA-PKCS1-V1_5");}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(d(e[r]));return t;}(e.signers);}(function(){for(var t={},r=0;r<e.signers.length;++r){var a=e.signers[r];(s=a.digestAlgorithm)in t||(t[s]=n.md[n.pki.oids[s]].create()),0===a.authenticatedAttributes.length?a.md=t[s]:a.md=n.md[n.pki.oids[s]].create();}for(var s in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return t;}());},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(t){"string"==typeof t&&(t=n.pki.certificateFromPem(t)),e.certificates.push(t);},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.");}};},a.createEncryptedData=function(){var e=null;return e={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){u(e,t,a.asn1.encryptedDataValidator);},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),l(e);}};},a.createEnvelopedData=function(){var e=null;return e={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=u(e,t,a.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(s(e[r]));return t;}(r.recipientInfos.value);},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,o(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,(t=e.encryptedContent,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.algorithm).getBytes()),t.parameter?i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.parameter.getBytes()):void 0]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.content.getBytes())])]))])])]);var t;},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],a=i.issuer;if(i.serialNumber===t.serialNumber&&a.length===r.length){for(var s=!0,o=0;o<r.length;++o)if(a[o].type!==r[o].type||a[o].value!==r[o].value){s=!1;break;}if(s)return i;}}return null;},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm);}l(e);},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:t.publicKey}});},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var i,a,s;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,a=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,a=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,a=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,a=8,s=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r);}if(void 0===t)t=n.util.createBuffer(n.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(a));var o=s(t);if(o.start(e.encryptedContent.parameter.copy()),o.update(e.content),!o.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=o.output;}for(var d=0;d<e.recipients.length;++d){var c=e.recipients[d];if(void 0===c.encryptedContent.content){if(c.encryptedContent.algorithm!==n.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);}}}};};},44793:(e,t,r)=>{var n=r(24643);r(7835),r(28550);var i=n.asn1,a=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=a;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=s;var o={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},a.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var d={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[d]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]};},61264:(e,t,r)=>{var n=r(24643);r(7835),r(74467),r(44117),r(75206),r(73939),r(23574),r(45114),r(72374),r(28550),r(846);var i=n.asn1,a=e.exports=n.pki=n.pki||{};a.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body);},a.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r;}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return a.privateKeyFromAsn1(s);},a.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:i.toDer(a.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t});},a.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:i.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t});};},30339:(e,t,r)=>{var n=r(24643);r(28550),r(10121),r(75417),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],a=new r(null);a.fromInt(30);var s=function(e,t){return e|t;};t.generateProbablePrime=function(e,t,i){"function"==typeof t&&(i=t,t={});var a=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof a&&(a={name:a}),a.options=a.options||{};var s=t.prng||n.random,d={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r);}};if("PRIMEINC"===a.name)return function(e,t,i,a){return"workers"in i?function(e,t,i,a){if("undefined"==typeof Worker)return o(e,t,i,a);var s=c(e,t),d=i.workers,u=i.workLoad||100,l=30*u/8,h=i.workerScript||"forge/prime.worker.js";if(-1===d)return n.util.estimateCores((function(e,t){e&&(t=2),d=t-1,f();}));function f(){d=Math.max(1,d);for(var n=[],i=0;i<d;++i)n[i]=new Worker(h);for(i=0;i<d;++i)n[i].addEventListener("message",f);var o=!1;function f(i){if(!o){var d=i.data;if(d.found){for(var h=0;h<n.length;++h)n[h].terminate();return o=!0,a(null,new r(d.prime,16));}s.bitLength()>e&&(s=c(e,t));var f=s.toString(16);i.target.postMessage({hex:f,workLoad:u}),s.dAddOffset(l,0);}}}f();}(e,t,i,a):o(e,t,i,a);}(e,d,a.options,i);throw new Error("Invalid prime generation algorithm: "+a.name);};}function o(e,t,r,n){var i=c(e,t),a=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2;}(i.bitLength());"millerRabinTests"in r&&(a=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),d(i,e,t,0,a,s,n);}function d(e,t,r,a,s,o,u){var l=+new Date;do{if(e.bitLength()>t&&(e=c(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[a++%8],0);}while(o<0||+new Date-l<o);n.util.setImmediate((function(){d(e,t,r,a,s,o,u);}));}function c(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),s,n),n.dAddOffset(31-n.mod(a).byteValue(),0),n;}}();},47391:(e,t,r)=>{var n=r(39907),i=r(24643);r(28550);var a=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(a=r(49701)),(e.exports=i.prng=i.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),s=0;s<32;++s)n[s]=r.create();function o(){if(t.pools[0].messageLength>=32)return d();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),d();}function d(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0;}function c(e){var t=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e);});var a=i.util.createBuffer();if(t)for(;a.length()<e;){var s=Math.max(1,Math.min(e-a.length(),65536)/4),o=new Uint32Array(Math.floor(s));try{t(o);for(var d=0;d<o.length;++d)a.putInt32(o[d]);}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e;}}if(a.length()<e)for(var c,u,l,h=Math.floor(65536*Math.random());a.length()<e;)for(u=16807*(65535&h),u+=(32767&(c=16807*(h>>16)))<<16,h=4294967295&(u=(2147483647&(u+=c>>15))+(u>>31)),d=0;d<3;++d)l=h>>>(d<<3),l^=Math.floor(256*Math.random()),a.putByte(255&l);return a.getBytes(e);}return t.pools=n,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,a=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,c=i.util.createBuffer();t.key=null,function u(l){if(l)return r(l);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return i.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return d(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),d(),e();}));}(u);}));var h=n(t.key,t.seed);t.generated+=h.length,c.putBytes(h),t.key=s(n(t.key,a(t.seed))),t.seed=o(n(t.key,t.seed)),i.util.setImmediate(u);}();},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,a=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var d=i.util.createBuffer();d.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&o();var c=r(t.key,t.seed);t.generated+=c.length,d.putBytes(c),t.key=a(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed));}return d.getBytes(e);},a?(t.seedFile=function(e,t){a.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString());}));},t.seedFileSync=function(e){return a.randomBytes(e).toString();}):(t.seedFile=function(e,t){try{t(null,c(e));}catch(e){t(e);}},t.seedFileSync=c),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1;},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n);},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes));})),self.postMessage({forge:{prng:{needed:e}}});}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}});}));}));},t;};},45114:(e,t,r)=>{var n=r(24643);r(75417),r(28550),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,a=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length();}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||n.random;return{encode:function(e,d){var c,u,l=d-1,h=Math.ceil(l/8),f=e.digest().getBytes();if(h<a+t+2)throw new Error("Message is too long to encrypt.");u=null===s?o.getBytesSync(t):s.bytes();var p=new n.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(u),r.start(),r.update(p.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,h-t-a-2),g.putByte(1),g.putBytes(u);var m=g.getBytes(),v=h-a-1,b=i.generate(y,v),E="";for(c=0;c<v;c++)E+=String.fromCharCode(m.charCodeAt(c)^b.charCodeAt(c));var C=65280>>8*h-l&255;return(E=String.fromCharCode(E.charCodeAt(0)&~C)+E.substr(1))+y+String.fromCharCode(188);},verify:function(e,s,o){var d,c=o-1,u=Math.ceil(c/8);if(s=s.substr(-u),u<a+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var l=u-a-1,h=s.substr(0,l),f=s.substr(l,a),p=65280>>8*u-c&255;if(h.charCodeAt(0)&p)throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(f,l),g="";for(d=0;d<l;d++)g+=String.fromCharCode(h.charCodeAt(d)^y.charCodeAt(d));g=String.fromCharCode(g.charCodeAt(0)&~p)+g.substr(1);var m=u-a-t-2;for(d=0;d<m;d++)if(0!==g.charCodeAt(d))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=g.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),r.start(),r.update(b.getBytes()),f===r.digest().getBytes();}};};},75417:(e,t,r)=>{var n=r(24643);r(13739),r(17585),r(47391),r(28550),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),a=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r);},e.getBytesSync=function(t){return e.generate(t);},e;}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1);},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e;},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),a.putInt32(i[0]),a.putInt32(i[1]),a.putInt32(i[2]),a.putInt32(i[3]),a.getBytes();},r.increment=function(e){return++e[3],e;},r.md=n.md.sha256;var o=s(),d=null,c=n.util.globalScope,u=c.crypto||c.msCrypto;if(u&&u.getRandomValues&&(d=function(e){return u.getRandomValues(e);}),n.options.usePureJavaScript||!n.util.isNodejs&&!d){if("undefined"==typeof window||window.document,o.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var h in navigator)try{"string"==typeof navigator[h]&&(l+=navigator[h]);}catch(e){}o.collect(l),l=null;}t&&(t().mousemove((function(e){o.collectInt(e.clientX,16),o.collectInt(e.clientY,16);})),t().keypress((function(e){o.collectInt(e.charCode,8);})));}if(n.random)for(var h in o)n.random[h]=o[h];else n.random=o;n.random.createInstance=s,e.exports=n.random;}("undefined"!=typeof jQuery?jQuery:null);},56339:(e,t,r)=>{var n=r(24643);r(28550);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],s=function(e,t){return e<<t&65535|(65535&e)>>16-t;},o=function(e,t){return(65535&e)>>t|e<<16-t&65535;};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,a=e,s=e.length(),o=t,d=Math.ceil(o/8),c=255>>(7&o);for(r=s;r<128;r++)a.putByte(i[a.at(r-1)+a.at(r-s)&255]);for(a.setAt(128-d,i[a.at(128-d)&c]),r=127-d;r>=0;r--)a.setAt(r,i[a.at(r+1)^a.at(r+d)]);return a;};var d=function(e,t,r){var i,d,c,u,l=!1,h=null,f=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)y.push(e.getInt16Le());r?(i=function(e){for(c=0;c<4;c++)e[c]+=y[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=s(e[c],a[c]),u++;},d=function(e){for(c=0;c<4;c++)e[c]+=y[63&e[(c+3)%4]];}):(i=function(e){for(c=3;c>=0;c--)e[c]=o(e[c],a[c]),e[c]-=y[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),u--;},d=function(e){for(c=3;c>=0;c--)e[c]-=y[63&e[(c+3)%4]];});var g=function(e){var t=[];for(c=0;c<4;c++){var n=h.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n);}u=r?0:63;for(var i=0;i<e.length;i++)for(var a=0;a<e[i][0];a++)e[i][1](t);for(c=0;c<4;c++)null!==p&&(r?p.putInt16Le(t[c]):t[c]^=p.getInt16Le()),f.putInt16Le(t[c]);},m=null;return m={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),l=!1,h=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f;},update:function(e){for(l||h.putBuffer(e);h.length()>=8;)g([[5,i],[1,d],[6,i],[1,d],[5,i]]);},finish:function(e){var t=!0;if(r)if(e)t=e(8,h,!r);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n);}if(t&&(l=!0,m.update()),!r&&(t=0===h.length()))if(e)t=e(8,f,!r);else{var i=f.length(),a=f.at(i-1);a>i?t=!1:f.truncate(a);}return t;}};};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i;},n.rc2.createEncryptionCipher=function(e,t){return d(e,t,!0);},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i;},n.rc2.createDecryptionCipher=function(e,t){return d(e,t,!1);};},72374:(e,t,r)=>{var n=r(24643);if(r(7835),r(10121),r(74467),r(21054),r(30339),r(75417),r(28550),void 0===i)var i=n.jsbn.BigInteger;var a=n.util.isNodejs?r(49701):null,s=n.asn1,o=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var d=n.pki,c=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},l={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},h={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},y=function(e){var t;if(!(e.algorithm in d.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r;}t=d.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);a.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),a.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(o),s.toDer(i).getBytes();},g=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var a;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{a=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16);}while(a.compareTo(t.n)>=0||!a.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(a.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var d=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return d.multiply(a.modInverse(t.n)).mod(t.n);};function m(e,t,r){var i=n.util.createBuffer(),a=Math.ceil(t.n.bitLength()/8);if(e.length>a-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=a-11,s;}i.putByte(0),i.putByte(r);var o,d=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var c=0;c<d;++c)i.putByte(o);}else for(;d>0;){var u=0,l=n.random.getBytes(d);for(c=0;c<d;++c)0===(o=l.charCodeAt(c))?++u:i.putByte(o);d=u;}return i.putByte(0),i.putBytes(e),i;}function v(e,t,r,i){var a=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),o=s.getByte(),d=s.getByte();if(0!==o||r&&0!==d&&1!==d||!r&&2!=d||r&&0===d&&void 0===i)throw new Error("Encryption block is invalid.");var c=0;if(0===d){c=a-3-i;for(var u=0;u<c;++u)if(0!==s.getByte())throw new Error("Encryption block is invalid.");}else if(1===d)for(c=0;s.length()>1;){if(255!==s.getByte()){--s.read;break;}++c;}else if(2===d)for(c=0;s.length()>1;){if(0===s.getByte()){--s.read;break;}++c;}if(0!==s.getByte()||c!==a-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes();}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return!(r.length>1)||(0!==r.charCodeAt(0)||128&r.charCodeAt(1))&&(255!==r.charCodeAt(0)||128&~r.charCodeAt(1))?r:r.substr(1);}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2;}function C(e){return n.util.isNodejs&&"function"==typeof a[e];}function S(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e];}function $(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e];}function w(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r;}d.rsa.encrypt=function(e,t,r){var a,s=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,a=m(e,t,r)):(a=n.util.createBuffer()).putBytes(e);for(var d=new i(a.toHex(),16),c=g(d,t,s).toString(16),u=n.util.createBuffer(),l=o-Math.ceil(c.length/2);l>0;)u.putByte(0),--l;return u.putBytes(n.util.hexToBytes(c)),u.getBytes();},d.rsa.decrypt=function(e,t,r,a){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o;}var d=new i(n.util.createBuffer(e).toHex(),16);if(d.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=g(d,t,r).toString(16),u=n.util.createBuffer(),l=s-Math.ceil(c.length/2);l>0;)u.putByte(0),--l;return u.putBytes(n.util.hexToBytes(c)),!1!==a?v(u.getBytes(),t,r):u.getBytes();},d.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var a,s=(r=r||{}).prng||n.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r);}},d=r.algorithm||"PRIMEINC";if("PRIMEINC"!==d)throw new Error("Invalid key generation algorithm: "+d);return(a={algorithm:d,state:0,bits:e,rng:o,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a;},d.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,a=0,s=function(e,t){return e|t;},o=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var l=null===e.p?e.pBits:e.qBits,h=l-1;0===e.pqState?(e.num=new i(l,e.rng),e.num.testBit(h)||e.num.bitwiseTo(i.ONE.shiftLeft(h),s,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),a=0,++e.pqState):1===e.pqState?e.num.bitLength()>l?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(c[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null);}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:d.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:d.rsa.setPublicKey(e.n,e.e)};}u+=(n=+new Date)-o,o=n;}return null!==e.keys;},d.rsa.generateKeyPair=function(e,t,r,c){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(c=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(c=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,c=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(c=r,r=void 0):(c=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(c){if(C("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return c(e);c(null,{privateKey:d.privateKeyFromPem(r),publicKey:d.publicKeyFromPem(t)});}));if(S("generateKey")&&S("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey);})).then(void 0,(function(e){c(e);})).then((function(e){if(e){var t=d.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));c(null,{privateKey:t,publicKey:d.setRsaPublicKey(t.n,t.e)});}}));if($("generateKey")&&$("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=d.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));c(null,{privateKey:r,publicKey:d.setRsaPublicKey(r.n,r.e)});},r.onerror=function(e){c(e);};},void(u.onerror=function(e){c(e);});}}else if(C("generateKeyPairSync")){var l=a.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:d.privateKeyFromPem(l.privateKey),publicKey:d.publicKeyFromPem(l.publicKey)};}var h=d.rsa.createKeyPairGenerationState(e,t,r);if(!c)return d.rsa.stepKeyPairGenerationState(h,0),h.keys;!function(e,t,r){"function"==typeof t&&(r=t,t={});var a={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?c(t,e.q):void o(e.qBits,c));}));}function o(e,t){n.prime.generateProbablePrime(e,a,t);}function c(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var a=e.p;e.p=e.q,e.q=a;}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void o(e.qBits,c);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,c);var u=e.e.modInverse(e.phi);e.keys={privateKey:d.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:d.rsa.setPublicKey(e.n,e.e)},r(null,e.keys);}"prng"in t&&(a.prng=t.prng),s();}(h,r,c);},d.setRsaPublicKey=d.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return m(e,t,2).getBytes();}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i);}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e;}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var a=t.encode(e,r,!0);return d.rsa.encrypt(a,r,!0);},verify:function(e,t,i,a){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===a&&(a={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in a||(a._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,r,!0);var i=s.fromDer(t,{parseAllBytes:a._parseAllDigestBytes}),o={},d=[];if(!s.validate(i,p,o,d))throw(c=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=d,c;var c,u=s.derToOid(o.algorithmIdentifier);if(u!==n.oids.md2&&u!==n.oids.md5&&u!==n.oids.sha1&&u!==n.oids.sha224&&u!==n.oids.sha256&&u!==n.oids.sha384&&u!==n.oids.sha512&&u!==n.oids["sha512-224"]&&u!==n.oids["sha512-256"])throw(c=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,c;if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in o))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===o.digest;}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===v(t,r,!0);}});var o=d.rsa.decrypt(t,r,!0,!1);return i.verify(e,o,r.n.bitLength());}};return r;},d.setRsaPrivateKey=d.rsa.setPrivateKey=function(e,t,r,i,a,s,o,c){var u={n:e,e:t,d:r,p:i,q:a,dP:s,dQ:o,qInv:c,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=d.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r);}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e;}};}return t.decode(i,u,!1);},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:y},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e;}},r=1);var n=t.encode(e,u.n.bitLength());return d.rsa.encrypt(n,u,r);}};return u;},d.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(d.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())]);},d.privateKeyFromAsn1=function(e){var t,r,a,o,c,h,f,p,y={},g=[];if(s.validate(e,u,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,l,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m;}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrime1).toHex(),c=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),f=n.util.createBuffer(y.privateKeyExponent2).toHex(),p=n.util.createBuffer(y.privateKeyCoefficient).toHex(),d.setRsaPrivateKey(new i(t,16),new i(r,16),new i(a,16),new i(o,16),new i(c,16),new i(h,16),new i(f,16),new i(p,16));},d.privateKeyToAsn1=d.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.qInv))]);},d.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,f,t,r)){var a,o=s.derToOid(t.publicKeyOid);if(o!==d.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=o,a;e=t.rsaPublicKey;}if(r=[],!s.validate(e,h,t,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var c=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return d.setRsaPublicKey(new i(c,16),new i(u,16));},d.publicKeyToAsn1=d.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(d.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[d.publicKeyToRSAPublicKey(e)])]);},d.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e))]);};},60943:(e,t,r)=>{var n=r(24643);r(69679),r(28550);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i;}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var d=a.length;i.messageLength+=d,d=[d/4294967296>>>0,d>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=d[1],d[1]=d[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,d[0]=d[1]/4294967296>>>0;return t.putBytes(a),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i;},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var d,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-c));for(var u=8*i.fullMessageLength[0],l=0;l<i.fullMessageLength.length-1;++l)u+=(d=8*i.fullMessageLength[l+1])/4294967296>>>0,s.putInt32(u>>>0),u=d>>>0;s.putInt32(u);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(h,r,s);var f=n.util.createBuffer();return f.putInt32(h.h0),f.putInt32(h.h1),f.putInt32(h.h2),f.putInt32(h.h3),f.putInt32(h.h4),f;},i;};var a=null,s=!1;function o(e,t,r){for(var n,i,a,s,o,d,c,u=r.length();u>=64;){for(i=e.h0,a=e.h1,s=e.h2,o=e.h3,d=e.h4,c=0;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(o^a&(s^o))+d+1518500249+n,d=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(o^a&(s^o))+d+1518500249+n,d=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+d+1859775393+n,d=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+d+1859775393+n,d=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a&s|o&(a^s))+d+2400959708+n,d=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+d+3395469782+n,d=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+d|0,u-=64;}}},17585:(e,t,r)=>{var n=r(24643);r(69679),r(28550);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),o=[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],s=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i;}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var o=a.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=o[1],o[1]=o[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),d(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i;},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-c));for(var u=8*i.fullMessageLength[0],l=0;l<i.fullMessageLength.length-1;++l)u+=(o=8*i.fullMessageLength[l+1])/4294967296>>>0,s.putInt32(u>>>0),u=o>>>0;s.putInt32(u);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};d(h,r,s);var f=n.util.createBuffer();return f.putInt32(h.h0),f.putInt32(h.h1),f.putInt32(h.h2),f.putInt32(h.h3),f.putInt32(h.h4),f.putInt32(h.h5),f.putInt32(h.h6),f.putInt32(h.h7),f;},i;};var a=null,s=!1,o=null;function d(e,t,r){for(var n,i,a,s,d,c,u,l,h,f,p,y,g,m=r.length();m>=64;){for(d=0;d<16;++d)t[d]=r.getInt32();for(;d<64;++d)n=((n=t[d-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[d-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[d]=n+t[d-7]+i+t[d-16]|0;for(c=e.h0,u=e.h1,l=e.h2,h=e.h3,f=e.h4,p=e.h5,y=e.h6,g=e.h7,d=0;d<64;++d)a=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),s=c&u|l&(c^u),n=g+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(y^f&(p^y))+o[d]+t[d],g=y,y=p,p=f,f=h+n>>>0,h=l,l=u,u=c,c=n+(i=a+s)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+u|0,e.h2=e.h2+l|0,e.h3=e.h3+h|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64;}}},30260:(e,t,r)=>{var n=r(24643);r(69679),r(28550);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var a=n.sha384=n.sha512.sha384=n.sha512.sha384||{};a.create=function(){return i.create("SHA-384");},n.md.sha384=n.md.algorithms.sha384=a,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256");}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224");}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),d=[[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]],(c={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],o=!0),void 0===e&&(e="SHA-512"),!(e in c))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=c[e],r=null,i=n.util.createBuffer(),a=new Array(80),l=0;l<80;++l)a[l]=new Array(2);var h=64;switch(e){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28;}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,a=0;a<e;++a)f.fullMessageLength.push(0);for(i=n.util.createBuffer(),r=new Array(t.length),a=0;a<t.length;++a)r[a]=t[a].slice(0);return f;}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var s=e.length;f.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var o=f.fullMessageLength.length-1;o>=0;--o)f.fullMessageLength[o]+=s[1],s[1]=s[0]+(f.fullMessageLength[o]/4294967296>>>0),f.fullMessageLength[o]=f.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),u(r,a,i),(i.read>2048||0===i.length())&&i.compact(),f;},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var o,d=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(s.substr(0,f.blockLength-d));for(var c=8*f.fullMessageLength[0],l=0;l<f.fullMessageLength.length-1;++l)c+=(o=8*f.fullMessageLength[l+1])/4294967296>>>0,t.putInt32(c>>>0),c=o>>>0;t.putInt32(c);var h=new Array(r.length);for(l=0;l<r.length;++l)h[l]=r[l].slice(0);u(h,a,t);var p,y=n.util.createBuffer();for(p="SHA-512"===e?h.length:"SHA-384"===e?h.length-2:h.length-4,l=0;l<p;++l)y.putInt32(h[l][0]),l===p-1&&"SHA-512/224"===e||y.putInt32(h[l][1]);return y;},f;};var s=null,o=!1,d=null,c=null;function u(e,t,r){for(var n,i,a,s,o,c,u,l,h,f,p,y,g,m,v,b,E,C,S,$,w,I,T,A,k,B,R,N,P,O,U,_,L,D=r.length();D>=128;){for(R=0;R<16;++R)t[R][0]=r.getInt32()>>>0,t[R][1]=r.getInt32()>>>0;for(;R<80;++R)n=(((N=(O=t[R-2])[0])>>>19|(P=O[1])<<13)^(P>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|P>>>19)^(P<<3|N>>>29)^(N<<26|P>>>6))>>>0,a=(((N=(_=t[R-15])[0])>>>1|(P=_[1])<<31)^(N>>>8|P<<24)^N>>>7)>>>0,s=((N<<31|P>>>1)^(N<<24|P>>>8)^(N<<25|P>>>7))>>>0,U=t[R-7],L=t[R-16],P=i+U[1]+s+L[1],t[R][0]=n+U[0]+a+L[0]+(P/4294967296>>>0)>>>0,t[R][1]=P>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],E=e[3][0],C=e[3][1],S=e[4][0],$=e[4][1],w=e[5][0],I=e[5][1],T=e[6][0],A=e[6][1],k=e[7][0],B=e[7][1],R=0;R<80;++R)u=((S>>>14|$<<18)^(S>>>18|$<<14)^($>>>9|S<<23))>>>0,l=(T^S&(w^T))>>>0,o=((p>>>28|y<<4)^(y>>>2|p<<30)^(y>>>7|p<<25))>>>0,c=((p<<4|y>>>28)^(y<<30|p>>>2)^(y<<25|p>>>7))>>>0,h=(p&g|v&(p^g))>>>0,f=(y&m|b&(y^m))>>>0,P=B+(((S<<18|$>>>14)^(S<<14|$>>>18)^($<<23|S>>>9))>>>0)+((A^$&(I^A))>>>0)+d[R][1]+t[R][1],n=k+u+l+d[R][0]+t[R][0]+(P/4294967296>>>0)>>>0,i=P>>>0,a=o+h+((P=c+f)/4294967296>>>0)>>>0,s=P>>>0,k=T,B=A,T=w,A=I,w=S,I=$,S=E+n+((P=C+i)/4294967296>>>0)>>>0,$=P>>>0,E=v,C=b,v=g,b=m,g=p,m=y,p=n+a+((P=i+s)/4294967296>>>0)>>>0,y=P>>>0;P=e[0][1]+y,e[0][0]=e[0][0]+p+(P/4294967296>>>0)>>>0,e[0][1]=P>>>0,P=e[1][1]+m,e[1][0]=e[1][0]+g+(P/4294967296>>>0)>>>0,e[1][1]=P>>>0,P=e[2][1]+b,e[2][0]=e[2][0]+v+(P/4294967296>>>0)>>>0,e[2][1]=P>>>0,P=e[3][1]+C,e[3][0]=e[3][0]+E+(P/4294967296>>>0)>>>0,e[3][1]=P>>>0,P=e[4][1]+$,e[4][0]=e[4][0]+S+(P/4294967296>>>0)>>>0,e[4][1]=P>>>0,P=e[5][1]+I,e[5][0]=e[5][0]+w+(P/4294967296>>>0)>>>0,e[5][1]=P>>>0,P=e[6][1]+A,e[6][0]=e[6][0]+T+(P/4294967296>>>0)>>>0,e[6][1]=P>>>0,P=e[7][1]+B,e[7][0]=e[7][0]+k+(P/4294967296>>>0)>>>0,e[7][1]=P>>>0,D-=128;}}},88622:(e,t,r)=>{var n=r(24643);r(13739),r(90081),r(94412),r(60943),r(28550);var i=e.exports=n.ssh=n.ssh||{};function a(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var i=n.util.hexToBytes(r);e.putInt32(i.length),e.putBytes(i);}function s(e,t){e.putInt32(t.length),e.putString(t);}function o(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest();}i.privateKeyToPutty=function(e,t,r){var i="ssh-rsa",d=""===(t=t||"")?"none":"aes256-cbc",c="PuTTY-User-Key-File-2: "+i+"\r\n";c+="Encryption: "+d+"\r\n",c+="Comment: "+(r=r||"")+"\r\n";var u=n.util.createBuffer();s(u,i),a(u,e.e),a(u,e.n);var l=n.util.encode64(u.bytes(),64),h=Math.floor(l.length/66)+1;c+="Public-Lines: "+h+"\r\n",c+=l;var f,p=n.util.createBuffer();if(a(p,e.d),a(p,e.p),a(p,e.q),a(p,e.qInv),t){var y=p.length()+16-1;y-=y%16;var g=o(p.bytes());g.truncate(g.length()-y+p.length()),p.putBuffer(g);var m=n.util.createBuffer();m.putBuffer(o("\0\0\0\0",t)),m.putBuffer(o("\0\0\0",t));var v=n.aes.createEncryptionCipher(m.truncate(8),"CBC");v.start(n.util.createBuffer().fillWithByte(0,16)),v.update(p.copy()),v.finish();var b=v.output;b.truncate(16),f=n.util.encode64(b.bytes(),64);}else f=n.util.encode64(p.bytes(),64);c+="\r\nPrivate-Lines: "+(h=Math.floor(f.length/66)+1)+"\r\n",c+=f;var E=o("putty-private-key-file-mac-key",t),C=n.util.createBuffer();s(C,i),s(C,d),s(C,r),C.putInt32(u.length()),C.putBuffer(u),C.putInt32(p.length()),C.putBuffer(p);var S=n.hmac.create();return S.start("sha1",E),S.update(C.bytes()),c+"\r\nPrivate-MAC: "+S.digest().toHex()+"\r\n";},i.publicKeyToOpenSSH=function(e,t){var r="ssh-rsa";t=t||"";var i=n.util.createBuffer();return s(i,r),a(i,e.e),a(i,e.n),r+" "+n.util.encode64(i.bytes())+" "+t;},i.privateKeyToOpenSSH=function(e,t){return t?n.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):n.pki.privateKeyToPem(e);},i.getPublicKeyFingerprint=function(e,t){var r=(t=t||{}).md||n.md.md5.create(),i=n.util.createBuffer();s(i,"ssh-rsa"),a(i,e.e),a(i,e.n),r.start(),r.update(i.getBytes());var o=r.digest();if("hex"===t.encoding){var d=o.toHex();return t.delimiter?d.match(/.{2}/g).join(t.delimiter):d;}if("binary"===t.encoding)return o.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return o;};},53105:(e,t,r)=>{var n=r(24643);r(7835),r(90081),r(94412),r(75206),r(61264),r(75417),r(60943),r(28550);var i=function(e,t,r,i){var a=n.util.createBuffer(),s=e.length>>1,o=s+(1&e.length),d=e.substr(0,o),c=e.substr(s,o),u=n.util.createBuffer(),l=n.hmac.create();r=t+r;var h=Math.ceil(i/16),f=Math.ceil(i/20);l.start("MD5",d);var p=n.util.createBuffer();u.putBytes(r);for(var y=0;y<h;++y)l.start(null,null),l.update(u.getBytes()),u.putBuffer(l.digest()),l.start(null,null),l.update(u.bytes()+r),p.putBuffer(l.digest());l.start("SHA1",c);var g=n.util.createBuffer();for(u.clear(),u.putBytes(r),y=0;y<f;++y)l.start(null,null),l.update(u.getBytes()),u.putBuffer(l.digest()),l.start(null,null),l.update(u.bytes()+r),g.putBuffer(l.digest());return a.putBytes(n.util.xorBytes(p.getBytes(),g.getBytes(),i)),a;},a=function(e,t,r){var i=!1;try{var a=e.deflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(a),t.length=a.length,i=!0;}catch(e){}return i;},s=function(e,t,r){var i=!1;try{var a=e.inflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(a),t.length=a.length,i=!0;}catch(e){}return i;},o=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32();}return n.util.createBuffer(e.getBytes(r));},d=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r);},c={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};c.SupportedVersions=[c.Versions.TLS_1_1,c.Versions.TLS_1_0],c.Version=c.SupportedVersions[0],c.MaxFragment=15360,c.ConnectionEnd={server:0,client:1},c.PRFAlgorithm={tls_prf_sha256:0},c.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},c.CipherType={stream:0,block:1,aead:2},c.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},c.CompressionMethod={none:0,deflate:1},c.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},c.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},c.Alert={},c.Alert.Level={warning:1,fatal:2},c.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},c.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},c.CipherSuites={},c.getCipherSuite=function(e){var t=null;for(var r in c.CipherSuites){var n=c.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break;}}return t;},c.handleUnexpected=function(e,t){!e.open&&e.entity===c.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}});},c.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(c.queue(e,c.createAlert(e,{level:c.Alert.Level.warning,description:c.Alert.Description.no_renegotiation})),c.flush(e)),e.process();},c.parseHelloMessage=function(e,t,r){var i=null,a=e.entity===c.ConnectionEnd.client;if(r<38)e.error(e,{message:a?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});else{var s=t.fragment,d=s.length();if(i={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},a?(i.cipher_suite=s.getBytes(2),i.compression_method=s.getByte()):(i.cipher_suites=o(s,2),i.compression_methods=o(s,1)),(d=r-(d-s.length()))>0){for(var u=o(s,2);u.length()>0;)i.extensions.push({type:[u.getByte(),u.getByte()],data:o(u,2)});if(!a)for(var l=0;l<i.extensions.length;++l){var h=i.extensions[l];if(0===h.type[0]&&0===h.type[1])for(var f=o(h.data,2);f.length()>0&&0===f.getByte();)e.session.extensions.server_name.serverNameList.push(o(f,2).getBytes());}}if(e.session.version&&(i.version.major!==e.session.version.major||i.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});if(a)e.session.cipherSuite=c.getCipherSuite(i.cipher_suite);else for(var p=n.util.createBuffer(i.cipher_suites.bytes());p.length()>0&&(e.session.cipherSuite=c.getCipherSuite(p.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});e.session.compressionMethod=a?i.compression_method:c.CompressionMethod.none;}return i;},c.createSecurityParameters=function(e,t){var r=e.entity===c.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,a=r?n:c.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:c.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:a};},c.handleServerHello=function(e,t,r){var n=c.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=p,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=u,e.session.resuming=!1,c.createSecurityParameters(e,n)),e.session.id=i,e.process();}},c.handleClientHello=function(e,t,r){var i=c.parseHelloMessage(e,t,r);if(!e.fail){var a=i.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(a))?a="":(s.version.major!==i.version.major||s.version.minor>i.version.minor)&&(s=null,a="")),0===a.length&&(a=n.random.getBytes(32)),e.session.id=a,e.session.clientHelloVersion=i.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var o,d=1;d<c.SupportedVersions.length&&!((o=c.SupportedVersions[d]).minor<=i.version.minor);++d);e.version={major:o.major,minor:o.minor},e.session.version=e.version;}null!==s?(e.expect=C,e.session.resuming=!0,e.session.sp.client_random=i.random.bytes()):(e.expect=!1!==e.verifyClient?v:b,e.session.resuming=!1,c.createSecurityParameters(e,i)),e.open=!0,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerHello(e)})),e.session.resuming?(c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.pending=c.createConnectionState(e),e.state.current.write=e.state.pending.write,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)}))):(c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificate(e)})),e.fail||(c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerKeyExchange(e)})),!1!==e.verifyClient&&c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificateRequest(e)})),c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerHelloDone(e)})))),c.flush(e),e.process();}},c.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i,a,s=t.fragment,d={certificate_list:o(s,3)},u=[];try{for(;d.certificate_list.length()>0;)i=o(d.certificate_list,3),a=n.asn1.fromDer(i),i=n.pki.certificateFromAsn1(a,!0),u.push(i);}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}});}var h=e.entity===c.ConnectionEnd.client;!h&&!0!==e.verifyClient||0!==u.length?0===u.length?e.expect=h?l:b:(h?e.session.serverCertificate=u[0]:e.session.clientCertificate=u[0],c.verifyCertificateChain(e,u)&&(e.expect=h?l:b)):e.error(e,{message:h?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}}),e.process();},c.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});e.expect=h,e.process();},c.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});var i=t.fragment,a={enc_pre_master_secret:o(i,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=n.pki.privateKeyFromPem(s);}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});try{var d=e.session.sp;d.pre_master_secret=s.decrypt(a.enc_pre_master_secret);var u=e.session.clientHelloVersion;if(u.major!==d.pre_master_secret.charCodeAt(0)||u.minor!==d.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.");}catch(e){d.pre_master_secret=n.random.getBytes(48);}e.expect=C,null!==e.session.clientCertificate&&(e.expect=E),e.process();},c.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:o(n,1),certificate_authorities:o(n,2)};e.session.certificateRequest=i,e.expect=f,e.process();},c.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i=t.fragment;i.read-=4;var a=i.bytes();i.read+=4;var s={signature:o(i,2).getBytes()},d=n.util.createBuffer();d.putBuffer(e.session.md5.digest()),d.putBuffer(e.session.sha1.digest()),d=d.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(d,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(a),e.session.sha1.update(a);}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure}});}e.expect=C,e.process();},c.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.record_overflow}});if(null===e.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.insufficient_security}},a=e.verify(e,i.alert.description,0,[]);if(!0!==a)return(a||0===a)&&("object"!=typeof a||n.util.isArray(a)?"number"==typeof a&&(i.alert.description=a):(a.message&&(i.message=a.message),a.alert&&(i.alert.description=a.alert))),e.error(e,i);}null!==e.session.certificateRequest&&(t=c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificate(e)}),c.queue(e,t)),t=c.createRecord(e,{type:c.ContentType.handshake,data:c.createClientKeyExchange(e)}),c.queue(e,t),e.expect=m;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificateVerify(e,t)})),c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.pending=c.createConnectionState(e),e.state.current.write=e.state.pending.write,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)})),e.expect=p,c.flush(e),e.process();};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);c.getClientSignature(e,s);},c.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var r=e.entity===c.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=c.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?y:S,e.process();},c.handleFinished=function(e,t,r){var a=t.fragment;a.read-=4;var s=a.bytes();a.read+=4;var o=t.fragment.getBytes();(a=n.util.createBuffer()).putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest());var d=e.entity===c.ConnectionEnd.client,u=d?"server finished":"client finished",l=e.session.sp;if((a=i(l.master_secret,u,a.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&d||!e.session.resuming&&!d)&&(c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)}))),e.expect=d?g:$,e.handshaking=!1,++e.handshakes,e.peerCertificate=d?e.session.serverCertificate:e.session.clientCertificate,c.flush(e),e.isConnected=!0,e.connected(e),e.process();},c.handleAlert=function(e,t){var r,n=t.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case c.Alert.Description.close_notify:r="Connection closed.";break;case c.Alert.Description.unexpected_message:r="Unexpected message.";break;case c.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case c.Alert.Description.decryption_failed:r="Decryption failed.";break;case c.Alert.Description.record_overflow:r="Record overflow.";break;case c.Alert.Description.decompression_failure:r="Decompression failed.";break;case c.Alert.Description.handshake_failure:r="Handshake failure.";break;case c.Alert.Description.bad_certificate:r="Bad certificate.";break;case c.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case c.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case c.Alert.Description.certificate_expired:r="Certificate expired.";break;case c.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case c.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case c.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case c.Alert.Description.access_denied:r="Access denied.";break;case c.Alert.Description.decode_error:r="Decode error.";break;case c.Alert.Description.decrypt_error:r="Decrypt error.";break;case c.Alert.Description.export_restriction:r="Export restriction.";break;case c.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case c.Alert.Description.insufficient_security:r="Insufficient security.";break;case c.Alert.Description.internal_error:r="Internal error.";break;case c.Alert.Description.user_canceled:r="User canceled.";break;case c.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error.";}if(i.description===c.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===c.ConnectionEnd.client?"server":"client",alert:i}),e.process();},c.handleHandshake=function(e,t){var r=t.fragment,i=r.getByte(),a=r.getInt24();if(a>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(a+4);r.read+=4,i in x[e.entity][e.expect]?(e.entity!==c.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),i!==c.HandshakeType.hello_request&&i!==c.HandshakeType.certificate_verify&&i!==c.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),x[e.entity][e.expect][i](e,t,a)):c.handleUnexpected(e,t);},c.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process();},c.handleHeartbeat=function(e,t){var r=t.fragment,i=r.getByte(),a=r.getInt16(),s=r.getBytes(a);if(i===c.HeartbeatMessageType.heartbeat_request){if(e.handshaking||a>s.length)return e.process();c.queue(e,c.createRecord(e,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_response,s)})),c.flush(e);}else if(i===c.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s));}e.process();};var u=1,l=2,h=3,f=4,p=5,y=6,g=7,m=8,v=1,b=2,E=3,C=4,S=5,$=6,w=c.handleUnexpected,I=c.handleChangeCipherSpec,T=c.handleAlert,A=c.handleHandshake,k=c.handleApplicationData,B=c.handleHeartbeat,R=[];R[c.ConnectionEnd.client]=[[w,T,A,w,B],[w,T,A,w,B],[w,T,A,w,B],[w,T,A,w,B],[w,T,A,w,B],[I,T,w,w,B],[w,T,A,w,B],[w,T,A,k,B],[w,T,A,w,B]],R[c.ConnectionEnd.server]=[[w,T,A,w,B],[w,T,A,w,B],[w,T,A,w,B],[w,T,A,w,B],[I,T,w,w,B],[w,T,A,w,B],[w,T,A,k,B],[w,T,A,w,B]];var N=c.handleHelloRequest,P=c.handleServerHello,O=c.handleCertificate,U=c.handleServerKeyExchange,_=c.handleCertificateRequest,L=c.handleServerHelloDone,D=c.handleFinished,x=[];x[c.ConnectionEnd.client]=[[w,w,P,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,O,U,_,L,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,U,_,L,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,_,L,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,L,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,D],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]];var M=c.handleClientHello,K=c.handleClientKeyExchange,j=c.handleCertificateVerify;x[c.ConnectionEnd.server]=[[w,M,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,O,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,K,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,j,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,D],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]],c.generateKeys=function(e,t){var r=i,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var a=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===c.Versions.TLS_1_0.major&&e.version.minor===c.Versions.TLS_1_0.minor;s&&(a+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",n,a),d={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(d.client_write_IV=o.getBytes(t.fixed_iv_length),d.server_write_IV=o.getBytes(t.fixed_iv_length)),d;},c.createConnectionState=function(e){var t=e.entity===c.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0;},compressionState:null,compressFunction:function(e){return!0;},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1];}};return e;},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_record_mac}}),!e.fail;},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}),!e.fail;},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=c.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case c.CompressionMethod.none:break;case c.CompressionMethod.deflate:n.read.compressFunction=s,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.");}}return n;},c.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r;},c.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null;},c.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),c.createRecord(e,{type:c.ContentType.alert,data:r});},c.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var i=e.cipherSuites[r];t.putByte(i.id[0]),t.putByte(i.id[1]);}var a=t.length(),s=n.util.createBuffer();s.putByte(c.CompressionMethod.none);var o=s.length(),u=n.util.createBuffer();if(e.virtualHost){var l=n.util.createBuffer();l.putByte(0),l.putByte(0);var h=n.util.createBuffer();h.putByte(0),d(h,2,n.util.createBuffer(e.virtualHost));var f=n.util.createBuffer();d(f,2,h),d(l,2,f),u.putBuffer(l);}var p=u.length();p>0&&(p+=2);var y=e.session.id,g=y.length+1+2+4+28+2+a+1+o+p,m=n.util.createBuffer();return m.putByte(c.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),d(m,1,n.util.createBuffer(y)),d(m,2,t),d(m,1,s),p>0&&d(m,2,u),m;},c.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(c.HandshakeType.server_hello),i.putInt24(r),i.putByte(e.version.major),i.putByte(e.version.minor),i.putBytes(e.session.sp.server_random),d(i,1,n.util.createBuffer(t)),i.putByte(e.session.cipherSuite.id[0]),i.putByte(e.session.cipherSuite.id[1]),i.putByte(e.session.compressionMethod),i;},c.createCertificate=function(e){var t,r=e.entity===c.ConnectionEnd.client,i=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,i=e.getCertificate(e,t));var a=n.util.createBuffer();if(null!==i)try{n.util.isArray(i)||(i=[i]);for(var s=null,o=0;o<i.length;++o){var u=n.pem.decode(i[o])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=u.type,l;}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var h=n.util.createBuffer(u.body);null===s&&(s=n.asn1.fromDer(h.bytes(),!1));var f=n.util.createBuffer();d(f,3,h),a.putBuffer(f);}i=n.pki.certificateFromAsn1(s),r?e.session.clientCertificate=i:e.session.serverCertificate=i;}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}});}var p=3+a.length(),y=n.util.createBuffer();return y.putByte(c.HandshakeType.certificate),y.putInt24(p),d(y,3,a),y;},c.createClientKeyExchange=function(e){var t=n.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(n.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var i=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,a=n.util.createBuffer();return a.putByte(c.HandshakeType.client_key_exchange),a.putInt24(i),a.putInt16(t.length),a.putBytes(t),a;},c.createServerKeyExchange=function(e){return n.util.createBuffer();},c.getClientSignature=function(e,t){var r=n.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var i=null;if(e.getPrivateKey)try{i=e.getPrivateKey(e,e.session.clientCertificate),i=n.pki.privateKeyFromPem(i);}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});}null===i?e.error(e,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):t=i.sign(t,null),r(e,t);},e.getSignature(e,r,t);},c.createCertificateVerify=function(e,t){var r=t.length+2,i=n.util.createBuffer();return i.putByte(c.HandshakeType.certificate_verify),i.putInt24(r),i.putInt16(t.length),i.putBytes(t),i;},c.createCertificateRequest=function(e){var t=n.util.createBuffer();t.putByte(1);var r=n.util.createBuffer();for(var i in e.caStore.certs){var a=e.caStore.certs[i],s=n.pki.distinguishedNameToAsn1(a.subject),o=n.asn1.toDer(s);r.putInt16(o.length()),r.putBuffer(o);}var u=1+t.length()+2+r.length(),l=n.util.createBuffer();return l.putByte(c.HandshakeType.certificate_request),l.putInt24(u),d(l,1,t),d(l,2,r),l;},c.createServerHelloDone=function(e){var t=n.util.createBuffer();return t.putByte(c.HandshakeType.server_hello_done),t.putInt24(0),t;},c.createChangeCipherSpec=function(){var e=n.util.createBuffer();return e.putByte(1),e;},c.createFinished=function(e){var t=n.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===c.ConnectionEnd.client,a=e.session.sp,s=r?"client finished":"server finished";t=i(a.master_secret,s,t.getBytes(),12);var o=n.util.createBuffer();return o.putByte(c.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o;},c.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var i=n.util.createBuffer();i.putByte(e),i.putInt16(r),i.putBytes(t);var a=i.length(),s=Math.max(16,a-r-3);return i.putBytes(n.random.getBytes(s)),i;},c.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==c.ContentType.handshake&&t.type!==c.ContentType.alert&&t.type!==c.ContentType.change_cipher_spec)){if(t.type===c.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null;}var i;if(t.fragment.length()<=c.MaxFragment)i=[t];else{i=[];for(var a=t.fragment.bytes();a.length>c.MaxFragment;)i.push(c.createRecord(e,{type:t.type,data:n.util.createBuffer(a.slice(0,c.MaxFragment))})),a=a.slice(c.MaxFragment);a.length>0&&i.push(c.createRecord(e,{type:t.type,data:n.util.createBuffer(a)}));}for(var s=0;s<i.length&&!e.fail;++s){var o=i[s];e.state.current.write.update(e,o)&&e.records.push(o);}}},c.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment);}return e.records=[],e.tlsDataReady(e);};var V=function(e){switch(e){case!0:return!0;case n.pki.certificateError.bad_certificate:return c.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return c.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return c.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return c.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return c.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return c.Alert.Description.unknown_ca;default:return c.Alert.Description.bad_certificate;}};for(var F in c.verifyCertificateChain=function(e,t){try{var r={};for(var i in e.verifyOptions)r[i]=e.verifyOptions[i];r.verify=function(t,r,i){V(t);var a=e.verify(e,t,r,i);if(!0!==a){if("object"==typeof a&&!n.util.isArray(a)){var s=new Error("The application rejected the certificate.");throw s.send=!0,s.alert={level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate},a.message&&(s.message=a.message),a.alert&&(s.alert.description=a.alert),s;}a!==t&&(a=function(e){switch(e){case!0:return!0;case c.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case c.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case c.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case c.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case c.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case c.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate;}}(a));}return a;},n.pki.verifyCertificateChain(e.caStore,t,r);}catch(t){var a=t;("object"!=typeof a||n.util.isArray(a))&&(a={send:!0,alert:{level:c.Alert.Level.fatal,description:V(t)}}),"send"in a||(a.send=!0),"alert"in a||(a.alert={level:c.Alert.Level.fatal,description:V(a.error)}),e.error(e,a);}return!e.fail;},c.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var i in(r={}).cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(i):delete e[i];r.getSession=function(e){var t=null,i=null;if(e?i=n.util.bytesToHex(e):r.order.length>0&&(i=r.order[0]),null!==i&&i in r.cache)for(var a in t=r.cache[i],delete r.cache[i],r.order)if(r.order[a]===i){r.order.splice(a,1);break;}return t;},r.setSession=function(e,t){if(r.order.length===r.capacity){var i=r.order.shift();delete r.cache[i];}i=n.util.bytesToHex(e),r.order.push(i),r.cache[i]=t;};}return r;},c.createConnection=function(e){var t;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var i in r=[],c.CipherSuites)r.push(c.CipherSuites[i]);var a=e.server?c.ConnectionEnd.server:c.ConnectionEnd.client,s=e.sessionCache?c.createSessionCache(e.sessionCache):null,o={version:{major:c.Version.major,minor:c.Version.minor},entity:a,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t;},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===c.ConnectionEnd.client?"client":"server"),r.send&&(c.queue(t,c.createAlert(t,r.alert)),c.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1);},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){o.version={major:c.Version.major,minor:c.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,c.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||void 0===e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=c.createConnectionState(o);}};return o.reset(),o.handshake=function(e){if(o.entity!==c.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var t=null;(e=e||"").length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&null!==(t=o.sessionCache.getSession())&&(e=t.id),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=c.createRandom().getBytes(),o.open=!0,c.queue(o,c.createRecord(o,{type:c.ContentType.handshake,data:c.createClientHello(o)})),c.flush(o);}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=function(e){var t=0,r=e.input,i=r.length();if(i<5)t=5-i;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var a=e.record.version.major===e.version.major;a&&e.session&&e.session.version&&(a=e.record.version.minor===e.version.minor),a||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});}return t;}(o)),o.fail||null===o.record||o.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})),e.record.ready=!0)),t;}(o)),!o.fail&&null!==o.record&&o.record.ready&&function(e,t){var r=t.type-c.ContentType.change_cipher_spec,n=R[e.entity][e.expect];r in n?n[r](e,t):c.handleUnexpected(e,t);}(o,o.record)),t;},o.prepare=function(e){return c.queue(o,c.createRecord(o,{type:c.ContentType.application_data,data:n.util.createBuffer(e)})),c.flush(o);},o.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),o.expectedHeartbeatPayload=e,c.queue(o,c.createRecord(o,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_request,e,t)})),c.flush(o);},o.close=function(e){if(!o.fail&&o.sessionCache&&o.session){var t={id:o.session.id,version:o.session.version,sp:o.session.sp};t.sp.keys=null,o.sessionCache.setSession(t.id,t);}o.open&&(o.open=!1,o.input.clear(),(o.isConnected||o.handshaking)&&(o.isConnected=o.handshaking=!1,c.queue(o,c.createAlert(o,{level:c.Alert.Level.warning,description:c.Alert.Description.close_notify})),c.flush(o)),o.closed(o)),o.reset(e);},o;},e.exports=n.tls=n.tls||{},c)"function"!=typeof c[F]&&(n.tls[F]=c[F]);n.tls.prf_tls1=i,n.tls.hmac_sha1=function(e,t,r){var i=n.hmac.create();i.start("SHA1",e);var a=n.util.createBuffer();return a.putInt32(t[0]),a.putInt32(t[1]),a.putByte(r.type),a.putByte(r.version.major),a.putByte(r.version.minor),a.putInt16(r.length),a.putBytes(r.fragment.bytes()),i.update(a.getBytes()),i.digest().getBytes();},n.tls.createSessionCache=c.createSessionCache,n.tls.createConnection=c.createConnection;},28550:(e,t,r)=>{var n=r(39907),i=r(1048).Buffer,a=r(24643),s=r(22089),o=e.exports=a.util=a.util||{};function d(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e);}function c(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(o.isArrayBuffer(e)||o.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t);}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r]);}}else(e instanceof c||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0;}!function(){if(void 0!==n&&n.nextTick&&!n.browser)return o.nextTick=n.nextTick,void("function"==typeof setImmediate?o.setImmediate=setImmediate:o.setImmediate=o.nextTick);if("function"==typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments);},void(o.nextTick=function(e){return setImmediate(e);});if(o.setImmediate=function(e){setTimeout(e,0);},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];function d(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e();}));}}o.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*");},window.addEventListener("message",d,!0);}if("undefined"!=typeof MutationObserver){var r=Date.now(),i=!0,a=document.createElement("div");t=[],new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e();}));})).observe(a,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&a.setAttribute("a",i=!i));};}o.nextTick=o.setImmediate;}(),o.isNodejs=void 0!==n&&n.versions&&n.versions.node,o.globalScope=o.isNodejs?r.g:"undefined"==typeof self?window:self,o.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e);},o.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer;},o.isArrayBufferView=function(e){return e&&o.isArrayBuffer(e.buffer)&&void 0!==e.byteLength;},o.ByteBuffer=c,o.ByteStringBuffer=c,o.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0);},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read;},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0;},o.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e));},o.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this;},o.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this;},o.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(o.encodeUtf8(e));},o.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e));},o.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e));},o.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e));},o.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255));},o.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255));},o.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255));},o.ByteStringBuffer.prototype.putInt=function(e,t){d(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255);}while(t>0);return this.putBytes(r);},o.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t);},o.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes());},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++);},o.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e;},o.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e;},o.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e;},o.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e;},o.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e;},o.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e;},o.ByteStringBuffer.prototype.getInt=function(e){d(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;}while(e>0);return t;},o.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t;},o.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t;},o.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e);},o.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e);},o.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this;},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1);},o.ByteStringBuffer.prototype.copy=function(){var e=o.createBuffer(this.data);return e.read=this.read,e;},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this;},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this;},o.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this;},o.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16);}return e;},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes());},o.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=o.isArrayBuffer(e),n=o.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset);},o.DataBuffer.prototype.length=function(){return this.write-this.read;},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0;},o.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this;},o.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this;},o.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this;},o.DataBuffer.prototype.putBytes=function(e,t){if(o.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this;}if(o.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this;}if(e instanceof o.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&o.isArrayBufferView(e.data))return n=new Uint8Array(e.data.byteLength,e.read,e.length()),this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this;if(e instanceof o.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=o.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t);}throw Error("Invalid parameter: "+e);},o.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this;},o.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16");},o.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this;},o.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this;},o.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this;},o.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this;},o.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this;},o.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this;},o.DataBuffer.prototype.putInt=function(e,t){d(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255);}while(t>0);return this;},o.DataBuffer.prototype.putSignedInt=function(e,t){return d(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t);},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++);},o.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e;},o.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e;},o.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e;},o.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e;},o.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e;},o.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e;},o.DataBuffer.prototype.getInt=function(e){d(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8;}while(e>0);return t;},o.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t;},o.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t;},o.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e);},o.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e);},o.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this;},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1);},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this);},o.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0;}return this;},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this;},o.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this;},o.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16);}return e;},o.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return o.binary.raw.encode(t);if("hex"===e)return o.binary.hex.encode(t);if("base64"===e)return o.binary.base64.encode(t);if("utf8"===e)return o.text.utf8.decode(t);if("utf16"===e)return o.text.utf16.decode(t);throw new Error("Invalid encoding: "+e);},o.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=o.encodeUtf8(e)),new o.ByteBuffer(e);},o.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r;},o.xorBytes=function(e,t,r){for(var n="",i="",a="",s=0,o=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(n+=a,a="",o=0),a+=String.fromCharCode(i),++o;return n+a;},o.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t;},o.bytesToHex=function(e){return o.createBuffer(e).toHex();},o.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e);};var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],h="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(e,t){for(var r,n,i,a="",s="",o=0;o<e.length;)r=e.charCodeAt(o++),n=e.charCodeAt(o++),i=e.charCodeAt(o++),a+=u.charAt(r>>2),a+=u.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=u.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":u.charAt(63&i)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a;},o.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",s=0;s<e.length;)t=l[e.charCodeAt(s++)-43],r=l[e.charCodeAt(s++)-43],n=l[e.charCodeAt(s++)-43],i=l[e.charCodeAt(s++)-43],a+=String.fromCharCode(t<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a;},o.encodeUtf8=function(e){return unescape(encodeURIComponent(e));},o.decodeUtf8=function(e){return decodeURIComponent(escape(e));},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:s.encode,decode:s.decode}},o.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e);},o.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n;},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,a=r=r||0;for(1&e.length&&(i=1,n[a++]=parseInt(e[0],16));i<e.length;i+=2)n[a++]=parseInt(e.substr(i,2),16);return t?a-r:n;},o.binary.base64.encode=function(e,t){for(var r,n,i,a="",s="",o=0;o<e.byteLength;)r=e[o++],n=e[o++],i=e[o++],a+=u.charAt(r>>2),a+=u.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=u.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":u.charAt(63&i)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a;},o.binary.base64.decode=function(e,t,r){var n,i,a,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var d=0,c=r=r||0;d<e.length;)n=l[e.charCodeAt(d++)-43],i=l[e.charCodeAt(d++)-43],a=l[e.charCodeAt(d++)-43],s=l[e.charCodeAt(d++)-43],o[c++]=n<<2|i>>4,64!==a&&(o[c++]=(15&i)<<4|a>>2,64!==s&&(o[c++]=(3&a)<<6|s));return t?c-r:o.subarray(0,c);},o.binary.base58.encode=function(e,t){return o.binary.baseN.encode(e,h,t);},o.binary.base58.decode=function(e,t){return o.binary.baseN.decode(e,h,t);},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(e,t,r){e=o.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n;},o.text.utf8.decode=function(e){return o.decodeUtf8(String.fromCharCode.apply(null,e));},o.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),a=r=r||0,s=r,o=0;o<e.length;++o)i[s++]=e.charCodeAt(o),a+=2;return t?a-r:n;},o.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer));},o.deflate=function(e,t,r){if(t=o.decode64(e.deflate(o.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4);}return t;},o.inflate=function(e,t,r){var n=e.inflate(o.encode64(t)).rval;return null===n?null:o.decode64(n);};var f=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=o.encode64(JSON.stringify(r)),n=e.setItem(t,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i;}},p=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n;}r=null;}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r;},y=function(e,t,r,n){var i=p(e,t);null===i&&(i={}),i[r]=n,f(e,t,i);},g=function(e,t,r){var n=p(e,t);return null!==n&&(n=r in n?n[r]:null),n;},m=function(e,t,r){var n=p(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var a in n){i=!1;break;}i&&(n=null),f(e,t,n);}},v=function(e,t){f(e,t,null);},b=function(e,t,r){var n,i=null;void 0===r&&(r=["web","flash"]);var a=!1,s=null;for(var o in r){n=r[o];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),a="flash"===n;}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),a=!0);}catch(e){s=e;}if(a)break;}if(!a)throw s;return i;};o.setItem=function(e,t,r,n,i){b(y,arguments,i);},o.getItem=function(e,t,r,n){return b(g,arguments,n);},o.removeItem=function(e,t,r,n){b(m,arguments,n);},o.clearItems=function(e,t,r){b(v,arguments,r);},o.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0;},o.format=function(e){for(var t,r,n=/%./g,i=0,a=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&a.push(r),s=n.lastIndex;var o=t[0][1];switch(o){case"s":case"o":i<arguments.length?a.push(arguments[1+i++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+o+"?>");}}return a.push(e.substring(s)),a.join("");},o.formatNumber=function(e,t,r,n){var i=e,a=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===n?".":n,d=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",u=c.length>3?c.length%3:0;return d+(u?c.substr(0,u)+o:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+o)+(a?s+Math.abs(i-c).toFixed(a).slice(2):"");},o.formatSize=function(e){return e>=1073741824?o.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?o.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?o.formatNumber(e/1024,0)+" KiB":o.formatNumber(e,0)+" bytes";},o.bytesFromIP=function(e){return-1!==e.indexOf(".")?o.bytesFromIPv4(e):-1!==e.indexOf(":")?o.bytesFromIPv6(e):null;},o.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=o.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n);}return t.getBytes();},o.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0;}))).length+t),n=o.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var a=o.hexToBytes(e[i]);a.length<2&&n.putByte(0),n.putBytes(a);}else n.fillWithByte(0,r),r=0;return n.getBytes();},o.bytesToIP=function(e){return 4===e.length?o.bytesToIPv4(e):16===e.length?o.bytesToIPv6(e):null;},o.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".");},o.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var a=o.bytesToHex(e[i]+e[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=r[r.length-1],d=t.length;s&&d===s.end+1?(s.end=d,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:d,end:d});}t.push(a);}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""));}return t.join(":");},o.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in o&&!e.update)return t(null,o.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,t(null,o.cores);if("undefined"==typeof Worker)return o.cores=1,t(null,o.cores);if("undefined"==typeof Blob)return o.cores=2,t(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r});}));}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,a){if(0===i){var s=Math.floor(n.reduce((function(e,t){return e+t;}),0)/n.length);return o.cores=Math.max(1,s),URL.revokeObjectURL(r),t(null,o.cores);}!function(e,t){for(var n=[],i=[],a=0;a<e;++a){var s=new Worker(r);s.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var a=0;a<e;++a)n[a].terminate();t(0,i);}})),n.push(s);}for(a=0;a<e;++a)n[a].postMessage(a);}(a,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],a=r[n]=[],s=0;s<e;++s)if(n!==s){var o=t[s];(i.st>o.st&&i.st<o.et||o.st>i.st&&o.st<i.et)&&a.push(s);}return r.reduce((function(e,t){return Math.max(e,t.length);}),0);}(a,r)),e(n,i-1,a);}));}([],5,16);};},846:(e,t,r)=>{var n=r(24643);r(13739),r(7835),r(92684),r(69679),r(32046),r(74467),r(75206),r(45114),r(72374),r(28550);var i=n.asn1,a=e.exports=n.pki=n.pki||{},s=a.oids,o={};o.CN=s.commonName,o.commonName="CN",o.C=s.countryName,o.countryName="C",o.L=s.localityName,o.localityName="L",o.ST=s.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=s.organizationName,o.organizationName="O",o.OU=s.organizationalUnitName,o.organizationalUnitName="OU",o.E=s.emailAddress,o.emailAddress="E";var d=n.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},d,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},u={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},l={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},d,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[l,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function f(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n;}a.RDNAttributesAsArray=function(e,t){for(var r,n,a,d=[],c=0;c<e.value.length;++c){r=e.value[c];for(var u=0;u<r.value.length;++u)a={},n=r.value[u],a.type=i.derToOid(n.value[0].value),a.value=n.value[1].value,a.valueTagClass=n.value[1].type,a.type in s&&(a.name=s[a.type],a.name in o&&(a.shortName=o[a.name])),t&&(t.update(a.type),t.update(a.value)),d.push(a);}return d;},a.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],d=i.derToOid(n.value[0].value),c=n.value[1].value,u=0;u<c.length;++u){var l={};if(l.type=d,l.value=c[u].value,l.valueTagClass=c[u].type,l.type in s&&(l.name=s[l.type],l.name in o&&(l.shortName=o[l.name])),l.type===s.extensionRequest){l.extensions=[];for(var h=0;h<l.value.length;++h)l.extensions.push(a.certificateExtensionFromAsn1(l.value[h]));}t.push(l);}return t;};var p=function(e,t,r){var n={};if(e!==s["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:s.sha1},mgf:{algorithmOid:s.mgf1,hash:{algorithmOid:s.sha1}},saltLength:20});var a={},o=[];if(!i.validate(t,u,a,o)){var d=new Error("Cannot read RSASSA-PSS parameter block.");throw d.errors=o,d;}return void 0!==a.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(a.hashOid)),void 0!==a.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(a.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(a.maskGenHashOid)),void 0!==a.saltLength&&(n.saltLength=a.saltLength.charCodeAt(0)),n;},y=function(e){switch(s[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return n.md.sha1.create();case"md5WithRSAEncryption":return n.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return n.md.sha256.create();case"sha384WithRSAEncryption":return n.md.sha384.create();case"sha512WithRSAEncryption":return n.md.sha512.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t;}},g=function(e){var t,r=e.certificate;switch(r.signatureOid){case s.sha1WithRSAEncryption:case s.sha1WithRSASignature:break;case s["RSASSA-PSS"]:var i,a,o;if(void 0===(i=s[r.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[i])throw(o=new Error("Unsupported MGF hash function.")).oid=r.signatureParameters.mgf.hash.algorithmOid,o.name=i,o;if(void 0===(a=s[r.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[a])throw(o=new Error("Unsupported MGF function.")).oid=r.signatureParameters.mgf.algorithmOid,o.name=a,o;if(a=n.mgf[a].create(n.md[i].create()),void 0===(i=s[r.signatureParameters.hash.algorithmOid])||void 0===n.md[i])throw(o=new Error("Unsupported RSASSA-PSS hash function.")).oid=r.signatureParameters.hash.algorithmOid,o.name=i,o;t=n.pss.create(n.md[i].create(),a,r.signatureParameters.saltLength);}return r.publicKey.verify(e.md.digest().getBytes(),e.signature,t);};function m(e){for(var t,r,a=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),s=e.attributes,o=0;o<s.length;++o){var d=(t=s[o]).value,c=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(c=t.valueTagClass)===i.Type.UTF8&&(d=n.util.encodeUtf8(d)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,c,!1,d)])]),a.value.push(r);}return a;}function v(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).name&&(t.type&&t.type in a.oids?t.name=a.oids[t.type]:t.shortName&&t.shortName in o&&(t.name=a.oids[o[t.shortName]])),void 0===t.type){if(!t.name||!(t.name in a.oids))throw(d=new Error("Attribute type not specified.")).attribute=t,d;t.type=a.oids[t.name];}if(void 0===t.shortName&&t.name&&t.name in o&&(t.shortName=o[t.name]),t.type===s.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(a.certificateExtensionToAsn1(b(t.extensions[n])));}var d;if(void 0===t.value)throw(d=new Error("Attribute value not specified.")).attribute=t,d;}}function b(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in a.oids&&(e.name=a.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in a.oids))throw(C=new Error("Extension ID not specified.")).extension=e,C;e.id=a.oids[e.name];}if(void 0!==e.value)return e;if("keyUsage"===e.name){var r=0,o=0,d=0;e.digitalSignature&&(o|=128,r=7),e.nonRepudiation&&(o|=64,r=6),e.keyEncipherment&&(o|=32,r=5),e.dataEncipherment&&(o|=16,r=4),e.keyAgreement&&(o|=8,r=3),e.keyCertSign&&(o|=4,r=2),e.cRLSign&&(o|=2,r=1),e.encipherOnly&&(o|=1,r=0),e.decipherOnly&&(d|=128,r=7);var c=String.fromCharCode(r);0!==d?c+=String.fromCharCode(o)+String.fromCharCode(d):0!==o&&(c+=String.fromCharCode(o)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c);}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var u=e.value.value;for(var l in e)!0===e[l]&&(l in s?u.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[l]).getBytes())):-1!==l.indexOf(".")&&u.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(l).getBytes())));}else if("nsCertType"===e.name)r=0,o=0,e.client&&(o|=128,r=7),e.server&&(o|=64,r=6),e.email&&(o|=32,r=5),e.objsign&&(o|=16,r=4),e.reserved&&(o|=8,r=3),e.sslCA&&(o|=4,r=2),e.emailCA&&(o|=2,r=1),e.objCA&&(o|=1,r=0),c=String.fromCharCode(r),0!==o&&(c+=String.fromCharCode(o)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c);else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var h=0;h<e.altNames.length;++h){if(c=(v=e.altNames[h]).value,7===v.type&&v.ip){if(null===(c=n.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C;}else 8===v.type&&(c=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(c));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,c));}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment);}else if("subjectKeyIdentifier"===e.name&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,f.getBytes());}else if("authorityKeyIdentifier"===e.name&&t.cert){if(e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),u=e.value.value,e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p));}if(e.authorityCertIssuer){var y=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,y));}if(e.serialNumber){var g=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,g));}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),u=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),E=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h<e.altNames.length;++h){if(c=(v=e.altNames[h]).value,7===v.type&&v.ip){if(null===(c=n.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C;}else 8===v.type&&(c=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(c));E.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,c));}b.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[E])),u.push(b);}var C;if(void 0===e.value)throw(C=new Error("Extension value not specified.")).extension=e,C;return e;}function E(e,t){if(e===s["RSASSA-PSS"]){var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r);}return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"");}function C(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,a=0;a<r.length;++a){var s=r[a],o=s.value,d=i.Type.UTF8;"valueTagClass"in s&&(d=s.valueTagClass),d===i.Type.UTF8&&(o=n.util.encodeUtf8(o));var c=!1;"valueConstructed"in s&&(c=s.valueConstructed);var u=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,d,c,o)])]);t.value.push(u);}return t;}a.certificateFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=s.type,o;}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var d=i.fromDer(s.body,r);return a.certificateFromAsn1(d,t);},a.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(a.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t});},a.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r;}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return a.publicKeyFromAsn1(s);},a.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(a.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t});},a.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(a.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t});},a.getPublicKeyFingerprint=function(e,t){var r,s=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(a.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(a.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".');}s.start(),s.update(r);var o=s.digest();if("hex"===t.encoding){var d=o.toHex();return t.delimiter?d.match(/.{2}/g).join(t.delimiter):d;}if("binary"===t.encoding)return o.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return o;},a.certificationRequestFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==s.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=s.type,o;}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var d=i.fromDer(s.body,r);return a.certificationRequestFromAsn1(d,t);},a.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(a.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t});},a.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return f(e.issuer,t);},e.issuer.addField=function(t){v([t]),e.issuer.attributes.push(t);},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t);},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t);},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){v(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null;},e.setIssuer=function(t,r){v(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null;},e.setExtensions=function(t){for(var r=0;r<t.length;++r)b(t[r],{cert:e});e.extensions=t;},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n;},e.sign=function(t,r){e.md=r||n.md.sha1.create();var o=s[e.md.algorithm+"WithRSAEncryption"];if(!o){var d=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw d.algorithm=e.md.algorithm,d;}e.signatureOid=e.siginfo.algorithmOid=o,e.tbsCertificate=a.getTBSCertificate(e);var c=i.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=t.sign(e.md);},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,s=e.subject,o=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw o.expectedIssuer=s.attributes,o.actualIssuer=n.attributes,o;}var d=t.md;if(null===d){d=y({signatureOid:t.signatureOid,type:"certificate"});var c=t.tbsCertificate||a.getTBSCertificate(t),u=i.toDer(c);d.update(u.getBytes());}return null!==d&&(r=g({certificate:e,md:d,signature:t.signature})),r;},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var a,s;r=!0;for(var o=0;r&&o<n.attributes.length;++o)a=n.attributes[o],s=i.attributes[o],a.type===s.type&&a.value===s.value||(r=!1);}return r;},e.issued=function(t){return t.isIssuer(e);},e.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"});},e.verifySubjectKeyIdentifier=function(){for(var t=s.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var a=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===a;}}return!1;},e;},a.certificateFromAsn1=function(e,t){var r={},s=[];if(!i.validate(e,c,r,s)){var o=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw o.errors=s,o;}if(i.derToOid(r.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var d=a.createCertificate();d.version=r.certVersion?r.certVersion.charCodeAt(0):0;var u=n.util.createBuffer(r.certSerialNumber);d.serialNumber=u.toHex(),d.signatureOid=n.asn1.derToOid(r.certSignatureOid),d.signatureParameters=p(d.signatureOid,r.certSignatureParams,!0),d.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),d.siginfo.parameters=p(d.siginfo.algorithmOid,r.certinfoSignatureParams,!1),d.signature=r.certSignature;var l=[];if(void 0!==r.certValidity1UTCTime&&l.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&l.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&l.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&l.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),l.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(d.validity.notBefore=l[0],d.validity.notAfter=l[1],d.tbsCertificate=r.tbsCertificate,t){d.md=y({signatureOid:d.signatureOid,type:"certificate"});var h=i.toDer(d.tbsCertificate);d.md.update(h.getBytes());}var g=n.md.sha1.create(),m=i.toDer(r.certIssuer);g.update(m.getBytes()),d.issuer.getField=function(e){return f(d.issuer,e);},d.issuer.addField=function(e){v([e]),d.issuer.attributes.push(e);},d.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(d.issuer.uniqueId=r.certIssuerUniqueId),d.issuer.hash=g.digest().toHex();var b=n.md.sha1.create(),E=i.toDer(r.certSubject);return b.update(E.getBytes()),d.subject.getField=function(e){return f(d.subject,e);},d.subject.addField=function(e){v([e]),d.subject.attributes.push(e);},d.subject.attributes=a.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(d.subject.uniqueId=r.certSubjectUniqueId),d.subject.hash=b.digest().toHex(),r.certExtensions?d.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):d.extensions=[],d.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),d;},a.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(a.certificateExtensionFromAsn1(n.value[i]));return t;},a.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in s)if(t.name=s[t.id],"keyUsage"===t.name){var r=0,a=0;(d=i.fromDer(t.value)).value.length>1&&(r=d.value.charCodeAt(1),a=d.value.length>2?d.value.charCodeAt(2):0),t.digitalSignature=!(128&~r),t.nonRepudiation=!(64&~r),t.keyEncipherment=!(32&~r),t.dataEncipherment=!(16&~r),t.keyAgreement=!(8&~r),t.keyCertSign=!(4&~r),t.cRLSign=!(2&~r),t.encipherOnly=!(1&~r),t.decipherOnly=!(128&~a);}else if("basicConstraints"===t.name){(d=i.fromDer(t.value)).value.length>0&&d.value[0].type===i.Type.BOOLEAN?t.cA=0!==d.value[0].value.charCodeAt(0):t.cA=!1;var o=null;d.value.length>0&&d.value[0].type===i.Type.INTEGER?o=d.value[0].value:d.value.length>1&&(o=d.value[1].value),null!==o&&(t.pathLenConstraint=i.derToInteger(o));}else if("extKeyUsage"===t.name)for(var d=i.fromDer(t.value),c=0;c<d.value.length;++c){var u=i.derToOid(d.value[c].value);u in s?t[s[u]]=!0:t[u]=!0;}else if("nsCertType"===t.name)r=0,(d=i.fromDer(t.value)).value.length>1&&(r=d.value.charCodeAt(1)),t.client=!(128&~r),t.server=!(64&~r),t.email=!(32&~r),t.objsign=!(16&~r),t.reserved=!(8&~r),t.sslCA=!(4&~r),t.emailCA=!(2&~r),t.objCA=!(1&~r);else if("subjectAltName"===t.name||"issuerAltName"===t.name){var l;t.altNames=[],d=i.fromDer(t.value);for(var h=0;h<d.value.length;++h){var f={type:(l=d.value[h]).type,value:l.value};switch(t.altNames.push(f),l.type){case 1:case 2:case 6:break;case 7:f.ip=n.util.bytesToIP(l.value);break;case 8:f.oid=i.derToOid(l.value);}}}else"subjectKeyIdentifier"===t.name&&(d=i.fromDer(t.value),t.subjectKeyIdentifier=n.util.bytesToHex(d.value));return t;},a.certificationRequestFromAsn1=function(e,t){var r={},s=[];if(!i.validate(e,h,r,s)){var o=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw o.errors=s,o;}if(i.derToOid(r.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var d=a.createCertificationRequest();if(d.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,d.signatureOid=n.asn1.derToOid(r.csrSignatureOid),d.signatureParameters=p(d.signatureOid,r.csrSignatureParams,!0),d.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),d.siginfo.parameters=p(d.siginfo.algorithmOid,r.csrSignatureParams,!1),d.signature=r.csrSignature,d.certificationRequestInfo=r.certificationRequestInfo,t){d.md=y({signatureOid:d.signatureOid,type:"certification request"});var c=i.toDer(d.certificationRequestInfo);d.md.update(c.getBytes());}var u=n.md.sha1.create();return d.subject.getField=function(e){return f(d.subject,e);},d.subject.addField=function(e){v([e]),d.subject.attributes.push(e);},d.subject.attributes=a.RDNAttributesAsArray(r.certificationRequestInfoSubject,u),d.subject.hash=u.digest().toHex(),d.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),d.getAttribute=function(e){return f(d,e);},d.addAttribute=function(e){v([e]),d.attributes.push(e);},d.attributes=a.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),d;},a.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t);},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t);},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return f(e,t);},e.addAttribute=function(t){v([t]),e.attributes.push(t);},e.md=null,e.setSubject=function(t){v(t),e.subject.attributes=t,e.subject.hash=null;},e.setAttributes=function(t){v(t),e.attributes=t;},e.sign=function(t,r){e.md=r||n.md.sha1.create();var o=s[e.md.algorithm+"WithRSAEncryption"];if(!o){var d=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw d.algorithm=e.md.algorithm,d;}e.signatureOid=e.siginfo.algorithmOid=o,e.certificationRequestInfo=a.getCertificationRequestInfo(e);var c=i.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=t.sign(e.md);},e.verify=function(){var t=!1,r=e.md;if(null===r){r=y({signatureOid:e.signatureOid,type:"certification request"});var n=e.certificationRequestInfo||a.getCertificationRequestInfo(e),s=i.toDer(n);r.update(s.getBytes());}return null!==r&&(t=g({certificate:e,md:r,signature:e.signature})),t;},e;};var S=new Date("1950-01-01T00:00:00Z"),$=new Date("2050-01-01T00:00:00Z");function w(e){return e>=S&&e<$?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e));}a.getTBSCertificate=function(e){var t=w(e.validity.notBefore),r=w(e.validity.notAfter),s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),E(e.siginfo.algorithmOid,e.siginfo.parameters)]),m(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),m(e.subject),a.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&s.value.push(a.certificateExtensionsToAsn1(e.extensions)),s;},a.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),a.publicKeyToAsn1(e.publicKey),C(e)]);},a.distinguishedNameToAsn1=function(e){return m(e);},a.certificateToAsn1=function(e){var t=e.tbsCertificate||a.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),E(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)]);},a.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(a.certificateExtensionToAsn1(e[n]));return t;},a.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t;},a.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||a.getCertificationRequestInfo(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),E(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)]);},a.createCaStore=function(e){var t={certs:{}};function r(e){return s(e),t.certs[e.hash]||null;}function s(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=a.RDNAttributesAsArray(m(e),t),e.hash=t.digest().toHex();}}if(t.getIssuer=function(e){return r(e.issuer);},t.addCertificate=function(e){if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r;}else t.certs[e.subject.hash]=e;},t.hasCertificate=function(e){"string"==typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var s=i.toDer(a.certificateToAsn1(e)).getBytes(),o=0;o<t.length;++o)if(s===i.toDer(a.certificateToAsn1(t[o])).getBytes())return!0;return!1;},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var a=0;a<i.length;++a)e.push(i[a]);else e.push(i);}return e;},t.removeCertificate=function(e){var o;if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))return null;var d=r(e.subject);if(!n.util.isArray(d))return o=t.certs[e.subject.hash],delete t.certs[e.subject.hash],o;for(var c=i.toDer(a.certificateToAsn1(e)).getBytes(),u=0;u<d.length;++u)c===i.toDer(a.certificateToAsn1(d[u])).getBytes()&&(o=d[u],d.splice(u,1));return 0===d.length&&delete t.certs[e.subject.hash],o;},e)for(var o=0;o<e.length;++o){var d=e[o];t.addCertificate(d);}return t;},a.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},a.verifyCertificateChain=function(e,t,r){"function"==typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),s=r.validityCheckDate;void 0===s&&(s=new Date);var o=!0,d=null,c=0;do{var u=t.shift(),l=null,h=!1;if(s&&(s<u.validity.notBefore||s>u.validity.notAfter)&&(d={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:s}),null===d){if(null===(l=t[0]||e.getIssuer(u))&&u.isIssuer(u)&&(h=!0,l=u),l){var f=l;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){l=f.shift();try{p=l.verify(u);}catch(e){}}p||(d={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate});}null!==d||l&&!h||e.hasCertificate(u)||(d={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca});}if(null===d&&l&&!u.isIssuer(l)&&(d={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===d)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===d&&g<u.extensions.length;++g){var m=u.extensions[g];m.critical&&!(m.name in y)&&(d={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate});}if(null===d&&(!o||0===t.length&&(!l||h))){var v=u.getExtension("basicConstraints"),b=u.getExtension("keyUsage");null!==b&&(b.keyCertSign&&null!==v||(d={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:a.certificateError.bad_certificate})),null!==d||null===v||v.cA||(d={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate}),null===d&&null!==b&&"pathLenConstraint"in v&&c-1>v.pathLenConstraint&&(d={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate});}var E=null===d||d.error,C=r.verify?r.verify(E,c,i):E;if(!0!==C)throw!0===E&&(d={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||n.util.isArray(C)?"string"==typeof C&&(d.error=C):(C.message&&(d.message=C.message),C.error&&(d.error=C.error))),d;d=null,o=!1,++c;}while(t.length>0);return!0;};}};