authhero 0.156.0 → 0.157.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authhero.cjs +34 -34
- package/dist/authhero.d.ts +329 -0
- package/dist/authhero.mjs +2325 -2300
- package/package.json +3 -3
package/dist/authhero.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";var z1=Object.defineProperty;var I1=(t,e,n)=>e in t?z1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var te=(t,e,n)=>I1(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@hono/zod-openapi"),ne=t=>typeof t=="string",Br=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},yu=t=>t==null?"":""+t,N1=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},C1=/###/g,wu=t=>t&&t.indexOf("###")>-1?t.replace(C1,"."):t,vu=t=>!t||ne(t),qr=(t,e,n)=>{const r=ne(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(vu(t))return{};const o=wu(r[i]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++i}return vu(t)?{}:{obj:t,k:wu(r[i])}},bu=(t,e,n)=>{const{obj:r,k:i}=qr(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let o=e[e.length-1],a=e.slice(0,e.length-1),c=qr(t,a,Object);for(;c.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),c=qr(t,a,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${o}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${o}`]=n},j1=(t,e,n,r)=>{const{obj:i,k:o}=qr(t,e,Object);i[o]=i[o]||[],i[o].push(n)},_o=(t,e)=>{const{obj:n,k:r}=qr(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},O1=(t,e,n)=>{const r=_o(t,n);return r!==void 0?r:_o(e,n)},wh=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?ne(t[r])||t[r]instanceof String||ne(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):wh(t[r],e[r],n):t[r]=e[r]);return t},Wn=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var P1={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const T1=t=>ne(t)?t.replace(/[&<>"'\/]/g,e=>P1[e]):t;class R1{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const B1=[" ",",","?","!",";"],L1=new R1(20),U1=(t,e,n)=>{e=e||"",n=n||"";const r=B1.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=L1.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(t);if(!o){const a=t.indexOf(n);a>0&&!i.test(t.substring(0,a))&&(o=!0)}return o},Ya=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let i=t;for(let o=0;o<r.length;){if(!i||typeof i!="object")return;let a,c="";for(let d=o;d<r.length;++d)if(d!==o&&(c+=n),c+=r[d],a=i[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&d<r.length-1)continue;o+=d-o+1;break}i=a}return i},yo=t=>t==null?void 0:t.replace("_","-"),M1={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,r;(r=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||r.call(n,console,e)}};class wo{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||M1,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,i){return i&&!this.debug?null:(ne(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new wo(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new wo(this.logger,e)}}var zt=new wo;class ms{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[c,d]=a;for(let l=0;l<d;l++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[c,d]=a;for(let l=0;l<d;l++)c.apply(c,[e,...r])})}}class $u extends ms{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){var l,u;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,n],r&&(Array.isArray(r)?c.push(...r):ne(r)&&o?c.push(...r.split(o)):c.push(r)));const d=_o(this.data,c);return!d&&!n&&!r&&e.indexOf(".")>-1&&(e=c[0],n=c[1],r=c.slice(2).join(".")),d||!a||!ne(r)?d:Ya((u=(l=this.data)==null?void 0:l[e])==null?void 0:u[n],r,o)}addResource(e,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let c=[e,n];r&&(c=c.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(c=e.split("."),i=n,n=c[1]),this.addNamespaces(n),bu(this.data,c,i),o.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(ne(r[o])||Array.isArray(r[o]))&&this.addResource(e,n,o,r[o],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[e,n];e.indexOf(".")>-1&&(c=e.split("."),i=r,r=n,n=c[1]),this.addNamespaces(n);let d=_o(this.data,c)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?wh(d,r,o):d={...d,...r},bu(this.data,c,d),a.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var vh={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(o=>{var a;e=((a=this.processors[o])==null?void 0:a.process(e,n,r,i))??e}),e}};const xu={};class vo extends ms{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),N1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=zt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return(r==null?void 0:r.res)!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&e.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!U1(e,r,i);if(a&&!c){const d=e.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:e,namespaces:ne(o)?[o]:o};const l=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(i)}return{key:e,namespaces:ne(o)?[o]:o}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],n),d=c[c.length-1],l=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((l==null?void 0:l.toLowerCase())==="cimode"){if(u){const L=n.nsSeparator||this.options.nsSeparator;return i?{res:`${d}${L}${a}`,usedKey:a,exactUsedKey:a,usedLng:l,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:`${d}${L}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:l,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:a}const f=this.resolve(e,n);let m=f==null?void 0:f.res;const w=(f==null?void 0:f.usedKey)||a,h=(f==null?void 0:f.exactUsedKey)||a,y=Object.prototype.toString.apply(m),v=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,C=!ne(m)&&typeof m!="boolean"&&typeof m!="number";if(E&&m&&C&&v.indexOf(y)<0&&!(ne(b)&&Array.isArray(m))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,m,{...n,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(f.res=L,f.usedParams=this.getUsedParamsDetails(n),f):L}if(o){const L=Array.isArray(m),Y=L?[]:{},se=L?h:w;for(const ae in m)if(Object.prototype.hasOwnProperty.call(m,ae)){const Se=`${se}${o}${ae}`;Y[ae]=this.translate(Se,{...n,joinArrays:!1,ns:c}),Y[ae]===Se&&(Y[ae]=m[ae])}m=Y}}else if(E&&ne(b)&&Array.isArray(m))m=m.join(b),m&&(m=this.extendTranslation(m,e,n,r));else{let L=!1,Y=!1;const se=n.count!==void 0&&!ne(n.count),ae=vo.hasDefaultValue(n),Se=se?this.pluralResolver.getSuffix(l,n.count,n):"",ze=n.ordinal&&se?this.pluralResolver.getSuffix(l,n.count,{ordinal:!1}):"",Ce=se&&!n.ordinal&&n.count===0,j=Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${Se}`]||n[`defaultValue${ze}`]||n.defaultValue;!this.isValidLookup(m)&&ae&&(L=!0,m=j),this.isValidLookup(m)||(Y=!0,m=a);const z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Y?void 0:m,k=ae&&j!==m&&this.options.updateMissing;if(Y||L||k){if(this.logger.log(k?"updateKey":"missingKey",l,d,a,k?j:m),o){const Q=this.resolve(a,{...n,keySeparator:!1});Q&&Q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let x=[];const P=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&P&&P[0])for(let Q=0;Q<P.length;Q++)x.push(P[Q]);else this.options.saveMissingTo==="all"?x=this.languageUtils.toResolveHierarchy(n.lng||this.language):x.push(n.lng||this.language);const U=(Q,W,oe)=>{var q;const ue=ae&&oe!==m?oe:z;this.options.missingKeyHandler?this.options.missingKeyHandler(Q,d,W,ue,k,n):(q=this.backendConnector)!=null&&q.saveMissing&&this.backendConnector.saveMissing(Q,d,W,ue,k,n),this.emit("missingKey",Q,d,W,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&se?x.forEach(Q=>{const W=this.pluralResolver.getSuffixes(Q,n);Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]&&W.indexOf(`${this.options.pluralSeparator}zero`)<0&&W.push(`${this.options.pluralSeparator}zero`),W.forEach(oe=>{U([Q],a+oe,n[`defaultValue${oe}`]||j)})}):U(x,a,j))}m=this.extendTranslation(m,e,n,f,r),Y&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${d}:${a}`),(Y||L)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}:${a}`:a,L?m:void 0))}return i?(f.res=m,f.usedParams=this.getUsedParamsDetails(n),f):m}extendTranslation(e,n,r,i,o){var l,u;var a=this;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const f=ne(e)&&(((u=r==null?void 0:r.interpolation)==null?void 0:u.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(f){const h=e.match(this.interpolator.nestingRegexp);m=h&&h.length}let w=r.replace&&!ne(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(w={...this.options.interpolation.defaultVariables,...w}),e=this.interpolator.interpolate(e,w,r.lng||this.language||i.usedLng,r),f){const h=e.match(this.interpolator.nestingRegexp),y=h&&h.length;m<y&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var h=arguments.length,y=new Array(h),v=0;v<h;v++)y[v]=arguments[v];return(o==null?void 0:o[0])===y[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${n[0]}`),null):a.translate(...y,n)},r)),r.interpolation&&this.interpolator.reset()}const c=r.postProcess||this.options.postProcess,d=ne(c)?[c]:c;return e!=null&&(d!=null&&d.length)&&r.applyPostProcessor!==!1&&(e=vh.handle(d,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,c;return ne(e)&&(e=[e]),e.forEach(d=>{if(this.isValidLookup(r))return;const l=this.extractFromKey(d,n),u=l.key;i=u;let f=l.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const m=n.count!==void 0&&!ne(n.count),w=m&&!n.ordinal&&n.count===0,h=n.context!==void 0&&(ne(n.context)||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(v=>{var b,E;this.isValidLookup(r)||(c=v,!xu[`${y[0]}-${v}`]&&((b=this.utils)!=null&&b.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(c))&&(xu[`${y[0]}-${v}`]=!0,this.logger.warn(`key "${i}" for languages "${y.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(C=>{var se;if(this.isValidLookup(r))return;a=C;const L=[u];if((se=this.i18nFormat)!=null&&se.addLookupKeys)this.i18nFormat.addLookupKeys(L,u,C,v,n);else{let ae;m&&(ae=this.pluralResolver.getSuffix(C,n.count,n));const Se=`${this.options.pluralSeparator}zero`,ze=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(L.push(u+ae),n.ordinal&&ae.indexOf(ze)===0&&L.push(u+ae.replace(ze,this.options.pluralSeparator)),w&&L.push(u+Se)),h){const Ce=`${u}${this.options.contextSeparator}${n.context}`;L.push(Ce),m&&(L.push(Ce+ae),n.ordinal&&ae.indexOf(ze)===0&&L.push(Ce+ae.replace(ze,this.options.pluralSeparator)),w&&L.push(Ce+Se))}}let Y;for(;Y=L.pop();)this.isValidLookup(r)||(o=Y,r=this.getResource(C,v,Y,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){var o;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!ne(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const o of n)delete i[o]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class ku{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=zt.create("languageUtils")}getScriptPartFromCode(e){if(e=yo(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=yo(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ne(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&(o.indexOf("-")>0&&i.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===i||o.indexOf(i)===0&&i.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ne(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ne(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):ne(e)&&o(this.formatLanguageCode(e)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}const Su={zero:0,one:1,two:2,few:3,many:4,other:5},Au={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class F1{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=zt.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=yo(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(r,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Au;if(!e.match(/-|_/))return Au;const d=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(d,n)}return this.pluralRulesCache[o]=a,a}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((i,o)=>Su[i]-Su[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const Eu=function(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=O1(t,e,n);return!o&&i&&ne(n)&&(o=Ya(t,n,r),o===void 0&&(o=Ya(e,n,r))),o},Ea=t=>t.replace(/\$/g,"$$$$");class D1{constructor(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=zt.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(r=>r),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:o,prefixEscaped:a,suffix:c,suffixEscaped:d,formatSeparator:l,unescapeSuffix:u,unescapePrefix:f,nestingPrefix:m,nestingPrefixEscaped:w,nestingSuffix:h,nestingSuffixEscaped:y,nestingOptionsSeparator:v,maxReplaces:b,alwaysFormat:E}=e.interpolation;this.escape=n!==void 0?n:T1,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?Wn(o):a||"{{",this.suffix=c?Wn(c):d||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=m?Wn(m):w||Wn("$t("),this.nestingSuffix=h?Wn(h):y||Wn(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=b||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,r,i){var w;let o,a,c;const d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=h=>{if(h.indexOf(this.formatSeparator)<0){const E=Eu(n,d,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,r,{...i,...n,interpolationkey:h}):E}const y=h.split(this.formatSeparator),v=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(Eu(n,d,v,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:v})};this.resetRegExp();const u=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((w=i==null?void 0:i.interpolation)==null?void 0:w.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Ea(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Ea(this.escape(h)):Ea(h)}].forEach(h=>{for(c=0;o=h.regex.exec(e);){const y=o[1].trim();if(a=l(y),a===void 0)if(typeof u=="function"){const b=u(e,o,i);a=ne(b)?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,y))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else!ne(a)&&!this.useRawValueToEscape&&(a=yu(a));const v=h.safeValue(a);if(e=e.replace(o[0],v),f?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=o[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;const c=(d,l)=>{const u=this.nestingOptionsSeparator;if(d.indexOf(u)<0)return d;const f=d.split(new RegExp(`${u}[ ]*{`));let m=`{${f[1]}`;d=f[0],m=this.interpolate(m,a);const w=m.match(/'/g),h=m.match(/"/g);(((w==null?void 0:w.length)??0)%2===0&&!h||h.length%2!==0)&&(m=m.replace(/'/g,'"'));try{a=JSON.parse(m),l&&(a={...l,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,y),`${d}${u}${m}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,d};for(;i=this.nestingRegexp.exec(e);){let d=[];a={...r},a=a.replace&&!ne(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let l=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=u.shift(),d=u,l=!0}if(o=n(c.call(this,i[1].trim(),a),a),o&&i[0]===e&&!ne(o))return o;ne(o)||(o=yu(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),l&&(o=d.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const V1=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(a){const[c,...d]=a.split(":"),l=d.join(":").trim().replace(/^'+|'+$/g,""),u=c.trim();n[u]||(n[u]=l),l==="false"&&(n[u]=!1),l==="true"&&(n[u]=!0),isNaN(l)||(n[u]=parseInt(l,10))}})}return{formatName:e,formatOptions:n}},Jn=t=>{const e={};return(n,r,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const a=r+JSON.stringify(o);let c=e[a];return c||(c=t(yo(r),i),e[a]=c),c(n)}};class q1{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=zt.create("formatter"),this.options=e,this.formats={number:Jn((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:Jn((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:Jn((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:Jn((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:Jn((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(e)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Jn(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(c=>c.indexOf(")")>-1)){const c=o.findIndex(d=>d.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,c)].join(this.formatSeparator)}return o.reduce((c,d)=>{var f;const{formatName:l,formatOptions:u}=V1(d);if(this.formats[l]){let m=c;try{const w=((f=i==null?void 0:i.formatParams)==null?void 0:f[i.interpolationkey])||{},h=w.locale||w.lng||i.locale||i.lng||r;m=this.formats[l](c,h,{...u,...i,...w})}catch(w){this.logger.warn(w)}return m}else this.logger.warn(`there was no format function for ${l}`);return c},e)}}const H1=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class K1 extends ms{constructor(e,n,r){var o,a;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=zt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(a=(o=this.backend)==null?void 0:o.init)==null||a.call(o,r,i.backend,i)}queueLoad(e,n,r,i){const o={},a={},c={},d={};return e.forEach(l=>{let u=!0;n.forEach(f=>{const m=`${l}|${f}`;!r.reload&&this.store.hasResourceBundle(l,f)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?a[m]===void 0&&(a[m]=!0):(this.state[m]=1,u=!1,a[m]===void 0&&(a[m]=!0),o[m]===void 0&&(o[m]=!0),d[f]===void 0&&(d[f]=!0)))}),u||(c[l]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(d)}}loaded(e,n,r){const i=e.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),!n&&r&&this.store.addResourceBundle(o,a,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const c={};this.queue.forEach(d=>{j1(d.loaded,[o],a),H1(d,e),n&&d.errors.push(n),d.pendingCount===0&&!d.done&&(Object.keys(d.loaded).forEach(l=>{c[l]||(c[l]={});const u=d.loaded[l];u.length&&u.forEach(f=>{c[l][f]===void 0&&(c[l][f]=!0)})}),d.done=!0,d.errors.length?d.callback(d.errors):d.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(d=>!d.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const c=(l,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(l&&u&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,o*2,a)},o);return}a(l,u)},d=this.backend[r].bind(this.backend);if(d.length===2){try{const l=d(e,n);l&&typeof l.then=="function"?l.then(u=>c(null,u)).catch(c):c(null,l)}catch(l){c(l)}return}return d(e,n,c)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();ne(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ne(n)&&(n=[n]);const o=this.queueLoad(e,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&c&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,c),this.loaded(e,a,c)})}saveMissing(e,n,r,i,o){var d,l,u,f,m;let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((l=(d=this.services)==null?void 0:d.utils)!=null&&l.hasLoadedNamespace&&!((f=(u=this.services)==null?void 0:u.utils)!=null&&f.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((m=this.backend)!=null&&m.create){const w={...a,isUpdate:o},h=this.backend.create.bind(this.backend);if(h.length<6)try{let y;h.length===5?y=h(e,n,r,i,w):y=h(e,n,r,i),y&&typeof y.then=="function"?y.then(v=>c(null,v)).catch(c):c(null,y)}catch(y){c(y)}else h(e,n,r,i,c,w)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const zu=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),ne(t[1])&&(e.defaultValue=t[1]),ne(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Iu=t=>{var e,n;return ne(t.ns)&&(t.ns=[t.ns]),ne(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ne(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Ki=()=>{},G1=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Zr extends ms{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Iu(e),this.services={},this.logger=zt,this.modules={external:[]},G1(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(ne(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=zu();this.options={...i,...this.options,...Iu(n)},this.options.interpolation={...i.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?zt.init(o(this.modules.logger),this.options):zt.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=q1;const f=new ku(this.options);this.store=new $u(this.options.resources,this.options);const m=this.services;m.logger=zt,m.resourceStore=this.store,m.languageUtils=f,m.pluralResolver=new F1(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(m.formatter=o(u),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new D1(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new K1(o(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(w){for(var h=arguments.length,y=new Array(h>1?h-1:0),v=1;v<h;v++)y[v-1]=arguments[v];e.emit(w,...y)}),this.modules.languageDetector&&(m.languageDetector=o(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=o(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new vo(this.services,this.options),this.translator.on("*",function(w){for(var h=arguments.length,y=new Array(h>1?h-1:0),v=1;v<h;v++)y[v-1]=arguments[v];e.emit(w,...y)}),this.modules.external.forEach(w=>{w.init&&w.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ki),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const d=Br(),l=()=>{const u=(f,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),d.resolve(m),r(f,m)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),d}loadResources(e){var o,a;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ki;const i=ne(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],d=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(f=>{f!=="cimode"&&c.indexOf(f)<0&&c.push(f)})};i?d(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>d(u)),(a=(o=this.options.preload)==null?void 0:o.forEach)==null||a.call(o,l=>d(l)),this.services.backendConnector.load(c,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(e,n,r){const i=Br();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=Ki),this.services.backendConnector.reload(e,n,o=>{i.resolve(),r(o)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&vh.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,n){var r=this;this.isLanguageChangingTo=e;const i=Br();this.emit("languageChanging",e);const o=d=>{this.language=d,this.languages=this.services.languageUtils.toResolveHierarchy(d),this.resolvedLanguage=void 0,this.setResolvedLanguage(d)},a=(d,l)=>{l?(o(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(d,function(){return r.t(...arguments)})},c=d=>{var u,f;!e&&!d&&this.services.languageDetector&&(d=[]);const l=ne(d)?d:this.services.languageUtils.getBestMatchFromCodes(d);l&&(this.language||o(l),this.translator.language||this.translator.changeLanguage(l),(f=(u=this.services.languageDetector)==null?void 0:u.cacheUserLanguage)==null||f.call(u,l)),this.loadResources(l,m=>{a(m,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(e),i}getFixedT(e,n,r){var i=this;const o=function(a,c){let d;if(typeof c!="object"){for(var l=arguments.length,u=new Array(l>2?l-2:0),f=2;f<l;f++)u[f-2]=arguments[f];d=i.options.overloadTranslationOptionHandler([a,c].concat(u))}else d={...c};d.lng=d.lng||o.lng,d.lngs=d.lngs||o.lngs,d.ns=d.ns||o.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||r||o.keyPrefix);const m=i.options.keySeparator||".";let w;return d.keyPrefix&&Array.isArray(a)?w=a.map(h=>`${d.keyPrefix}${m}${h}`):w=d.keyPrefix?`${d.keyPrefix}${m}${a}`:a,i.t(w,d)};return ne(e)?o.lng=e:o.lngs=e,o.ns=n,o.keyPrefix=r,o}t(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.translate(...n)}exists(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.exists(...n)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(c,d)=>{const l=this.services.backendConnector.state[`${c}|${d}`];return l===-1||l===0||l===2};if(n.precheck){const c=n.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}loadNamespaces(e,n){const r=Br();return this.options.ns?(ne(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=Br();ne(e)&&(e=[e]);const i=this.options.preload||[],o=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(e){var i,o;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new ku(zu());return n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Zr(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ki;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new Zr(i);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(c=>{o[c]=this[c]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const c=Object.keys(this.store.data).reduce((d,l)=>(d[l]={...this.store.data[l]},Object.keys(d[l]).reduce((u,f)=>(u[f]={...d[l][f]},u),{})),{});o.store=new $u(c,i),o.services.resourceStore=o.store}return o.translator=new vo(o.services,i),o.translator.on("*",function(c){for(var d=arguments.length,l=new Array(d>1?d-1:0),u=1;u<d;u++)l[u-1]=arguments[u];o.emit(c,...l)}),o.init(i,n),o.translator.options=i,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const O=Zr.createInstance();O.createInstance=Zr.createInstance;O.createInstance;O.dir;O.init;O.loadResources;O.reloadResources;O.use;O.changeLanguage;O.getFixedT;const re=O.t;O.exists;O.setDefaultNamespace;O.hasLoadedNamespace;O.loadNamespaces;O.loadLanguages;var bh=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(n.origin);return async function(o,a){var l,u;function c(f,m){o.res.headers.set(f,m)}const d=r(o.req.header("origin")||"",o);if(d&&c("Access-Control-Allow-Origin",d),n.origin!=="*"){const f=o.req.header("Vary");f?c("Vary",f):c("Vary","Origin")}if(n.credentials&&c("Access-Control-Allow-Credentials","true"),(l=n.exposeHeaders)!=null&&l.length&&c("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.maxAge!=null&&c("Access-Control-Max-Age",n.maxAge.toString()),(u=n.allowMethods)!=null&&u.length&&c("Access-Control-Allow-Methods",n.allowMethods.join(","));let f=n.allowHeaders;if(!(f!=null&&f.length)){const m=o.req.header("Access-Control-Request-Headers");m&&(f=m.split(/\s*,\s*/))}return f!=null&&f.length&&(c("Access-Control-Allow-Headers",f.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await a()}};const Xt=s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()}),_s=s.z.object({created_at:s.z.string(),updated_at:s.z.string()}),$h=s.z.object({email:s.z.string().optional(),email_verified:s.z.boolean().optional(),name:s.z.string().optional(),username:s.z.string().optional(),given_name:s.z.string().optional(),phone_number:s.z.string().optional(),phone_verified:s.z.boolean().optional(),family_name:s.z.string().optional()}).catchall(s.z.any()),xh=s.z.object({connection:s.z.string(),user_id:s.z.string(),provider:s.z.string(),isSocial:s.z.boolean(),access_token:s.z.string().optional(),access_token_secret:s.z.string().optional(),refresh_token:s.z.string().optional(),profileData:$h.optional()}),ys=s.z.object({email:s.z.string().optional().transform(t=>t&&t.toLowerCase()),username:s.z.string().optional(),phone_number:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),nickname:s.z.string().optional(),name:s.z.string().optional(),picture:s.z.string().optional(),locale:s.z.string().optional(),linked_to:s.z.string().optional(),profileData:s.z.string().optional(),user_id:s.z.string().optional(),app_metadata:s.z.any().default({}).optional(),user_metadata:s.z.any().default({}).optional()}),bo=ys.extend({email_verified:s.z.boolean().default(!1),verify_email:s.z.boolean().optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string().optional(),provider:s.z.string().default("email"),connection:s.z.string().default("email"),is_social:s.z.boolean().optional()}),Bd=s.z.object({...bo.shape,..._s.shape,user_id:s.z.string(),is_social:s.z.boolean(),email:s.z.string().optional(),login_count:s.z.number().default(0),identities:s.z.array(xh).optional()}),Et=Bd,W1=ys.extend({login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any()),J1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let X1=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=J1[n[t]&63];return e};const kh=s.z.object({audience:s.z.string().optional(),recipient:s.z.string().optional(),createUpnClaim:s.z.boolean().optional(),mapUnknownClaimsAsIs:s.z.boolean().optional(),passthroughClaimsWithNoMapping:s.z.boolean().optional(),mapIdentities:s.z.boolean().optional(),signatureAlgorithm:s.z.string().optional(),digestAlgorithm:s.z.string().optional(),issuer:s.z.string().optional(),destination:s.z.string().optional(),lifetimeInSeconds:s.z.number().optional(),signResponse:s.z.boolean().optional(),nameIdentifierFormat:s.z.string().optional(),nameIdentifierProbes:s.z.array(s.z.string()).optional(),authnContextClassRef:s.z.string().optional(),mappings:s.z.record(s.z.string()).optional()}),$o=s.z.object({id:s.z.string(),name:s.z.string(),callbacks:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:s.z.array(s.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:s.z.object({samlp:kh.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:s.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:s.z.string().default(()=>X1()).optional(),disable_sign_ups:s.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),xn=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...$o.shape}),xr=s.z.object({x:s.z.number(),y:s.z.number()});var Ld=(t=>(t.RICH_TEXT="RICH_TEXT",t.NEXT_BUTTON="NEXT_BUTTON",t.BACK_BUTTON="BACK_BUTTON",t.SUBMIT_BUTTON="SUBMIT_BUTTON",t.DIVIDER="DIVIDER",t.TEXT="TEXT",t.EMAIL="EMAIL",t.PASSWORD="PASSWORD",t.NUMBER="NUMBER",t.PHONE="PHONE",t.DATE="DATE",t.CHECKBOX="CHECKBOX",t.RADIO="RADIO",t.SELECT="SELECT",t.HIDDEN="HIDDEN",t.LEGAL="LEGAL",t))(Ld||{}),Ud=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(Ud||{});const ws=s.z.object({id:s.z.string(),category:s.z.nativeEnum(Ud),type:s.z.nativeEnum(Ld)}),Sh=ws.extend({category:s.z.literal("BLOCK"),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}).passthrough()}),Ah=ws.extend({category:s.z.literal("BLOCK"),type:s.z.union([s.z.literal("NEXT_BUTTON"),s.z.literal("BACK_BUTTON"),s.z.literal("SUBMIT_BUTTON")]),config:s.z.object({text:s.z.string()}).passthrough()}),Eh=ws.extend({category:s.z.literal("FIELD"),type:s.z.literal("LEGAL"),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({text:s.z.string()}).passthrough()}),zh=ws.extend({category:s.z.literal("FIELD"),type:s.z.union([s.z.literal("TEXT"),s.z.literal("EMAIL"),s.z.literal("PASSWORD"),s.z.literal("NUMBER"),s.z.literal("PHONE"),s.z.literal("DATE"),s.z.literal("CHECKBOX"),s.z.literal("RADIO"),s.z.literal("SELECT"),s.z.literal("HIDDEN")]),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({label:s.z.string().optional(),placeholder:s.z.string().optional()}).passthrough()}),Ih=s.z.object({id:s.z.string(),category:s.z.string(),type:s.z.string()}).passthrough(),Nh=s.z.union([Sh,Ah,Eh,zh,Ih]);var Ch=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(Ch||{});const jh=s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:xr,alias:s.z.string().optional(),config:s.z.object({components:s.z.array(Nh),next_node:s.z.string()}).passthrough()}),Oh=s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:xr,alias:s.z.string().optional(),config:s.z.object({flow_id:s.z.string(),next_node:s.z.string()})}),Ph=s.z.object({id:s.z.string(),type:s.z.string(),coordinates:xr}).passthrough(),Th=s.z.union([jh,Oh,Ph]),Rh=s.z.object({next_node:s.z.string(),coordinates:xr}).passthrough(),Bh=s.z.object({resume_flow:s.z.boolean().optional(),coordinates:xr}).passthrough(),Lh=s.z.object({id:s.z.string(),name:s.z.string(),languages:s.z.object({primary:s.z.string()}).passthrough(),nodes:s.z.array(Th),start:Rh,ending:Bh,created_at:s.z.string(),updated_at:s.z.string(),links:s.z.object({sdkSrc:s.z.string().optional(),sdk_src:s.z.string().optional()}).passthrough()}).passthrough(),Z1=Lh.omit({id:!0,created_at:!0,updated_at:!0});var it=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(it||{}),Dt=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(Dt||{}),vs=(t=>(t.S256="S256",t.Plain="plain",t))(vs||{});const Yr=s.z.object({client_id:s.z.string(),act_as:s.z.string().optional(),response_type:s.z.nativeEnum(it).optional(),response_mode:s.z.nativeEnum(Dt).optional(),redirect_uri:s.z.string().optional(),audience:s.z.string().optional(),organization:s.z.string().optional(),state:s.z.string().optional(),nonce:s.z.string().optional(),scope:s.z.string().optional(),prompt:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(vs).optional(),code_challenge:s.z.string().optional(),username:s.z.string().optional(),ui_locales:s.z.string().optional(),vendor_id:s.z.string().optional()}),Qa=s.z.object({colors:s.z.object({primary:s.z.string(),page_background:s.z.object({type:s.z.string().optional(),start:s.z.string().optional(),end:s.z.string().optional(),angle_deg:s.z.number().optional()}).optional()}).optional(),logo_url:s.z.string().optional(),favicon_url:s.z.string().optional(),font:s.z.object({url:s.z.string()}).optional()}),Md=s.z.object({kid:s.z.string().optional(),team_id:s.z.string().optional(),realms:s.z.string().optional(),authentication_method:s.z.string().optional(),client_id:s.z.string().optional(),client_secret:s.z.string().optional(),app_secret:s.z.string().optional(),scope:s.z.string().optional(),authorization_endpoint:s.z.string().optional(),token_endpoint:s.z.string().optional(),userinfo_endpoint:s.z.string().optional(),jwks_uri:s.z.string().optional(),discovery_url:s.z.string().optional(),issuer:s.z.string().optional(),provider:s.z.string().optional(),from:s.z.string().optional(),twilio_sid:s.z.string().optional(),twilio_token:s.z.string().optional()}),xo=s.z.object({id:s.z.string().optional(),name:s.z.string(),strategy:s.z.string(),options:Md.default({}),enabled_clients:s.z.array(s.z.string()).default([]).optional(),response_type:s.z.custom().optional(),response_mode:s.z.custom().optional()}),rn=s.z.object({id:s.z.string(),created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t)}).extend(xo.shape),ko=s.z.object({name:s.z.string(),audience:s.z.string(),sender_email:s.z.string().email(),sender_name:s.z.string(),support_url:s.z.string().url().optional(),logo:s.z.string().url().optional(),primary_color:s.z.string().optional(),secondary_color:s.z.string().optional(),language:s.z.string().optional(),id:s.z.string().optional()}),or=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ko.shape,id:s.z.string()}),Uh=s.z.object({logoUrl:s.z.string(),loginBackgroundImage:s.z.string().nullish(),style:s.z.object({primaryColor:s.z.string(),buttonTextColor:s.z.string(),primaryHoverColor:s.z.string()}),supportEmail:s.z.string().nullable(),supportUrl:s.z.string().nullable(),name:s.z.string(),showGreyishBackground:s.z.boolean().optional(),termsAndConditionsUrl:s.z.string().nullable(),companyName:s.z.string().optional(),checkoutHideSocial:s.z.boolean().optional(),siteUrl:s.z.string().nullable(),manageSubscriptionsUrl:s.z.string().optional()});s.z.object({...xn.shape,tenant:or,connections:s.z.array(rn)});const Mh=s.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),Fh=s.z.object({code_id:s.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:s.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:s.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Mh,code_verifier:s.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:s.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:s.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:s.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:s.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:s.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:s.z.string(),used_at:s.z.string().optional(),user_id:s.z.string().optional()}),Y1=s.z.object({...Fh.shape,created_at:s.z.string()}),Fd=s.z.object({domain:s.z.string(),custom_domain_id:s.z.string().optional(),type:s.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:s.z.enum(["txt"]).optional(),tls_policy:s.z.enum(["recommended"]).optional(),custom_client_ip_header:s.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:s.z.record(s.z.string().max(255)).optional()}),Dh=s.z.object({name:s.z.literal("txt"),record:s.z.string(),domain:s.z.string()}),nn=s.z.object({...Fd.shape,custom_domain_id:s.z.string(),primary:s.z.boolean(),status:s.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:s.z.string().optional(),verification:s.z.object({methods:s.z.array(Dh)}).optional(),tls_policy:s.z.string().optional()}),Q1=nn.extend({tenant_id:s.z.string()}),e_=s.z.object({id:s.z.string(),type:s.z.literal("submit"),label:s.z.string(),className:s.z.string().optional(),disabled:s.z.boolean().optional().default(!1),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0),customizations:s.z.record(s.z.string(),s.z.any()).optional()}),Vh=s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("LEGAL"),config:s.z.object({text:s.z.string(),html:s.z.boolean().optional()}),required:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("NEXT_BUTTON"),config:s.z.object({text:s.z.string().optional()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)})]),So=s.z.object({name:s.z.string().openapi({description:"The name of the form"}),messages:s.z.object({errors:s.z.record(s.z.string(),s.z.any()).optional(),custom:s.z.record(s.z.string(),s.z.any()).optional()}).optional(),languages:s.z.object({primary:s.z.string().optional(),default:s.z.string().optional()}).optional(),translations:s.z.record(s.z.string(),s.z.any()).optional(),nodes:s.z.array(s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({flow_id:s.z.string().max(30),next_node:s.z.string()})}),s.z.object({id:s.z.string(),type:s.z.literal("ROUTER"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150),config:s.z.object({rules:s.z.array(s.z.object({id:s.z.string(),alias:s.z.string().min(1).max(150).optional(),condition:s.z.any(),next_node:s.z.string()})),fallback:s.z.array(s.z.string())})}),s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({components:s.z.array(Vh),next_node:s.z.string()})})])).optional(),start:s.z.object({hidden_fields:s.z.array(s.z.object({key:s.z.string(),value:s.z.string()})).optional(),next_node:s.z.string().optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional()}).optional(),ending:s.z.object({redirection:s.z.object({delay:s.z.number().optional(),target:s.z.string().optional()}).optional(),after_submit:s.z.object({flow_id:s.z.string().optional()}).optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional(),resume_flow:s.z.boolean().optional()}).optional(),style:s.z.object({css:s.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches new JSON structure)"}),tr=s.z.object({..._s.shape,...So.shape,id:s.z.string()}),qh=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Hh=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),bs={enabled:s.z.boolean().default(!1),synchronous:s.z.boolean().default(!1),priority:s.z.number().optional(),hook_id:s.z.string().optional()},t_=s.z.object({...bs,trigger_id:qh,url:s.z.string()}),n_=s.z.object({...bs,trigger_id:Hh,form_id:s.z.string()}),Qi=s.z.union([t_,n_]),r_=s.z.object({...bs,trigger_id:qh,..._s.shape,hook_id:s.z.string(),url:s.z.string()}),i_=s.z.object({...bs,trigger_id:Hh,..._s.shape,hook_id:s.z.string(),form_id:s.z.string()}),nr=s.z.union([r_,i_]),Dd=s.z.object({alg:s.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:s.z.string(),kid:s.z.string(),kty:s.z.enum(["RSA","EC","oct"]),n:s.z.string(),x5t:s.z.string().optional(),x5c:s.z.array(s.z.string()).optional(),use:s.z.enum(["sig","enc"]).optional()}),Kh=s.z.object({keys:s.z.array(Dd)}),ec=s.z.object({issuer:s.z.string(),authorization_endpoint:s.z.string(),token_endpoint:s.z.string(),device_authorization_endpoint:s.z.string(),userinfo_endpoint:s.z.string(),mfa_challenge_endpoint:s.z.string(),jwks_uri:s.z.string(),registration_endpoint:s.z.string(),revocation_endpoint:s.z.string(),scopes_supported:s.z.array(s.z.string()),response_types_supported:s.z.array(s.z.string()),code_challenge_methods_supported:s.z.array(s.z.string()),response_modes_supported:s.z.array(s.z.string()),subject_types_supported:s.z.array(s.z.string()),id_token_signing_alg_values_supported:s.z.array(s.z.string()),token_endpoint_auth_methods_supported:s.z.array(s.z.string()),claims_supported:s.z.array(s.z.string()),request_uri_parameter_supported:s.z.boolean(),request_parameter_supported:s.z.boolean(),token_endpoint_auth_signing_alg_values_supported:s.z.array(s.z.string())}),Gh=s.z.object({csrf_token:s.z.string(),auth0Client:s.z.string().optional(),authParams:Yr,expires_at:s.z.string(),deleted_at:s.z.string().optional(),ip:s.z.string().optional(),useragent:s.z.string().optional(),session_id:s.z.string().optional(),authorization_url:s.z.string().optional(),login_completed:s.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),o_=s.z.object({...Gh.shape,id:s.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:s.z.string(),updated_at:s.z.string()});var he=(t=>(t.FAILED_SILENT_AUTH="fsa",t.FAILED_SIGNUP="fs",t.FAILED_LOGIN="f",t.FAILED_LOGIN_INCORRECT_PASSWORD="fp",t.FAILED_CHANGE_PASSWORD="fcp",t.FAILED_BY_CONNECTOR="fc",t.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",t.FAILED_HOOK="fh",t.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",t.SUCCESS_API_OPERATION="sapi",t.SUCCESS_CHANGE_PASSWORD="scp",t.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",t.SUCCESS_CHANGE_USERNAME="scu",t.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",t.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",t.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",t.SUCCESS_LOGIN="s",t.SUCCESS_LOGOUT="slo",t.SUCCESS_SIGNUP="ss",t.SUCCESS_SILENT_AUTH="ssa",t.SUCCESS_VERIFICATION_EMAIL="sv",t.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",t.CODE_LINK_SENT="cls",t.BLOCKED_ACCOUNT_EMAIL="limit_wc",t.BLOCKED_ACCOUNT_IP="limit_sul",t.BLOCKED_IP_ADDRESS="limit_mu",t))(he||{});const s_=s.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),Wh=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()}),Ao=s.z.object({type:s_,date:s.z.string(),description:s.z.string().optional(),log_id:s.z.string().optional(),_id:s.z.string().optional(),ip:s.z.string(),user_agent:s.z.string(),details:s.z.any().optional(),isMobile:s.z.boolean(),user_id:s.z.string().optional(),user_name:s.z.string().optional(),connection:s.z.string().optional(),connection_id:s.z.string().optional(),client_id:s.z.string().optional(),client_name:s.z.string().optional(),audience:s.z.string().optional(),scope:s.z.array(s.z.string()).optional(),strategy:s.z.string().optional(),strategy_type:s.z.string().optional(),hostname:s.z.string().optional(),auth0_client:Wh.optional()}),Jh=s.z.object({user_id:s.z.string(),password:s.z.string(),algorithm:s.z.enum(["bcrypt","argon2id"]).default("argon2id")}),a_=s.z.object({...Jh.shape,created_at:s.z.string(),updated_at:s.z.string()}),Xh=s.z.object({initial_user_agent:s.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:s.z.string().describe("First IP address associated with this session"),initial_asn:s.z.string().describe("First autonomous system number associated with this session"),last_user_agent:s.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:s.z.string().describe("Last IP address from which this user logged in"),last_asn:s.z.string().describe("Last autonomous system number from which this user logged in")}),Zh=s.z.object({id:s.z.string(),revoked_at:s.z.string().optional(),used_at:s.z.string().optional(),user_id:s.z.string().describe("The user ID associated with the session"),expires_at:s.z.string().optional(),login_session_id:s.z.string(),idle_expires_at:s.z.string().optional(),device:Xh.describe("Metadata related to the device used in the session"),clients:s.z.array(s.z.string()).describe("List of client details for the session")}),$s=s.z.object({created_at:s.z.string(),updated_at:s.z.string(),authenticated_at:s.z.string(),last_interaction_at:s.z.string(),...Zh.shape}),tc=s.z.object({kid:s.z.string().openapi({description:"The key id of the signing key"}),cert:s.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:s.z.string().openapi({description:"The cert fingerprint"}),thumbprint:s.z.string().openapi({description:"The cert thumbprint"}),pkcs7:s.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:s.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:s.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:s.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:s.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:s.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:s.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:s.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var rr=(t=>(t.RefreshToken="refresh_token",t.AuthorizationCode="authorization_code",t.ClientCredential="client_credentials",t.Passwordless="passwordless",t.Password="password",t.OTP="http://auth0.com/oauth/grant-type/passwordless/otp",t))(rr||{});const Vd=s.z.object({access_token:s.z.string(),id_token:s.z.string().optional(),scope:s.z.string().optional(),state:s.z.string().optional(),refresh_token:s.z.string().optional(),token_type:s.z.string(),expires_in:s.z.number()});s.z.object({code:s.z.string(),state:s.z.string().optional()});const Yh=s.z.object({button_border_radius:s.z.number(),button_border_weight:s.z.number(),buttons_style:s.z.enum(["pill"]),input_border_radius:s.z.number(),input_border_weight:s.z.number(),inputs_style:s.z.enum(["pill"]),show_widget_shadow:s.z.boolean(),widget_border_weight:s.z.number(),widget_corner_radius:s.z.number()}),Qh=s.z.object({base_focus_color:s.z.string(),base_hover_color:s.z.string(),body_text:s.z.string(),captcha_widget_theme:s.z.enum(["auto"]),error:s.z.string(),header:s.z.string(),icons:s.z.string(),input_background:s.z.string(),input_border:s.z.string(),input_filled_text:s.z.string(),input_labels_placeholders:s.z.string(),links_focused_components:s.z.string(),primary_button:s.z.string(),primary_button_label:s.z.string(),secondary_button_border:s.z.string(),secondary_button_label:s.z.string(),success:s.z.string(),widget_background:s.z.string(),widget_border:s.z.string()}),wn=s.z.object({bold:s.z.boolean(),size:s.z.number()}),e0=s.z.object({body_text:wn,buttons_text:wn,font_url:s.z.string(),input_labels:wn,links:wn,links_style:s.z.enum(["normal"]),reference_text_size:s.z.number(),subtitle:wn,title:wn}),t0=s.z.object({background_color:s.z.string(),background_image_url:s.z.string(),page_layout:s.z.enum(["center"])}),n0=s.z.object({header_text_alignment:s.z.enum(["center"]),logo_height:s.z.number(),logo_position:s.z.enum(["center"]),logo_url:s.z.string(),social_buttons_layout:s.z.enum(["bottom"])}),r0=s.z.object({borders:Yh,colors:Qh,displayName:s.z.string(),fonts:e0,page_background:t0,widget:n0}),c_=r0.extend({themeId:s.z.string()}),eo=s.z.object({universal_login_experience:s.z.enum(["new","classic"]).default("new"),identifier_first:s.z.boolean().default(!0),password_first:s.z.boolean().default(!1),webauthn_platform_first_factor:s.z.boolean()}),to=s.z.object({name:s.z.string(),enabled:s.z.boolean().optional().default(!0),default_from_address:s.z.string().optional(),credentials:s.z.union([s.z.object({accessKeyId:s.z.string(),secretAccessKey:s.z.string(),region:s.z.string()}),s.z.object({smtp_host:s.z.array(s.z.string()),smtp_port:s.z.number(),smtp_user:s.z.string(),smtp_pass:s.z.string()}),s.z.object({api_key:s.z.string(),domain:s.z.string().optional()}),s.z.object({connectionString:s.z.string()}),s.z.object({tenantId:s.z.string(),clientId:s.z.string(),clientSecret:s.z.string()})]),settings:s.z.object({}).optional()}),qd=s.z.object({id:s.z.string(),session_id:s.z.string(),user_id:s.z.string(),client_id:s.z.string(),expires_at:s.z.string().optional(),idle_expires_at:s.z.string().optional(),last_exchanged_at:s.z.string().optional(),device:Xh,resource_servers:s.z.array(s.z.object({audience:s.z.string(),scopes:s.z.string()})),rotating:s.z.boolean()}),d_=s.z.object({created_at:s.z.string(),...qd.shape}),l_=s.z.object({to:s.z.string(),message:s.z.string()}),u_=s.z.object({name:s.z.string(),options:s.z.object({})});function p_(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const f_=new s.OpenAPIHono().openapi(s.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Qa}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.branding.get(e);return n?t.json(n):t.json({})}).openapi(s.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Qa.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.branding.set(e,n),t.text("OK")});var A=class extends Error{constructor(e=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});te(this,"res");te(this,"status");this.res=n==null?void 0:n.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},Eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function i0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function h_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function g_(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var o0={exports:{}};const m_={},__=Object.freeze(Object.defineProperty({__proto__:null,default:m_},Symbol.toStringTag,{value:"Module"})),y_=h_(__);(function(t){/**
|
|
1
|
+
"use strict";var z1=Object.defineProperty;var I1=(t,e,n)=>e in t?z1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var te=(t,e,n)=>I1(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@hono/zod-openapi"),ne=t=>typeof t=="string",Br=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},yu=t=>t==null?"":""+t,N1=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},C1=/###/g,wu=t=>t&&t.indexOf("###")>-1?t.replace(C1,"."):t,vu=t=>!t||ne(t),qr=(t,e,n)=>{const r=ne(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(vu(t))return{};const o=wu(r[i]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++i}return vu(t)?{}:{obj:t,k:wu(r[i])}},bu=(t,e,n)=>{const{obj:r,k:i}=qr(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let o=e[e.length-1],a=e.slice(0,e.length-1),c=qr(t,a,Object);for(;c.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),c=qr(t,a,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${o}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${o}`]=n},j1=(t,e,n,r)=>{const{obj:i,k:o}=qr(t,e,Object);i[o]=i[o]||[],i[o].push(n)},_o=(t,e)=>{const{obj:n,k:r}=qr(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},O1=(t,e,n)=>{const r=_o(t,n);return r!==void 0?r:_o(e,n)},wh=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?ne(t[r])||t[r]instanceof String||ne(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):wh(t[r],e[r],n):t[r]=e[r]);return t},Wn=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var P1={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const T1=t=>ne(t)?t.replace(/[&<>"'\/]/g,e=>P1[e]):t;class R1{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const B1=[" ",",","?","!",";"],L1=new R1(20),U1=(t,e,n)=>{e=e||"",n=n||"";const r=B1.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=L1.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(t);if(!o){const a=t.indexOf(n);a>0&&!i.test(t.substring(0,a))&&(o=!0)}return o},Za=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let i=t;for(let o=0;o<r.length;){if(!i||typeof i!="object")return;let a,c="";for(let d=o;d<r.length;++d)if(d!==o&&(c+=n),c+=r[d],a=i[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&d<r.length-1)continue;o+=d-o+1;break}i=a}return i},yo=t=>t==null?void 0:t.replace("_","-"),M1={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,r;(r=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||r.call(n,console,e)}};class wo{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||M1,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,i){return i&&!this.debug?null:(ne(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new wo(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new wo(this.logger,e)}}var zt=new wo;class gs{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[c,d]=a;for(let l=0;l<d;l++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[c,d]=a;for(let l=0;l<d;l++)c.apply(c,[e,...r])})}}class $u extends gs{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){var l,u;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,n],r&&(Array.isArray(r)?c.push(...r):ne(r)&&o?c.push(...r.split(o)):c.push(r)));const d=_o(this.data,c);return!d&&!n&&!r&&e.indexOf(".")>-1&&(e=c[0],n=c[1],r=c.slice(2).join(".")),d||!a||!ne(r)?d:Za((u=(l=this.data)==null?void 0:l[e])==null?void 0:u[n],r,o)}addResource(e,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let c=[e,n];r&&(c=c.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(c=e.split("."),i=n,n=c[1]),this.addNamespaces(n),bu(this.data,c,i),o.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(ne(r[o])||Array.isArray(r[o]))&&this.addResource(e,n,o,r[o],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[e,n];e.indexOf(".")>-1&&(c=e.split("."),i=r,r=n,n=c[1]),this.addNamespaces(n);let d=_o(this.data,c)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?wh(d,r,o):d={...d,...r},bu(this.data,c,d),a.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var vh={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(o=>{var a;e=((a=this.processors[o])==null?void 0:a.process(e,n,r,i))??e}),e}};const xu={};class vo extends gs{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),N1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=zt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return(r==null?void 0:r.res)!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&e.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!U1(e,r,i);if(a&&!c){const d=e.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:e,namespaces:ne(o)?[o]:o};const l=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(i)}return{key:e,namespaces:ne(o)?[o]:o}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],n),d=c[c.length-1],l=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((l==null?void 0:l.toLowerCase())==="cimode"){if(u){const L=n.nsSeparator||this.options.nsSeparator;return i?{res:`${d}${L}${a}`,usedKey:a,exactUsedKey:a,usedLng:l,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:`${d}${L}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:l,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:a}const f=this.resolve(e,n);let m=f==null?void 0:f.res;const w=(f==null?void 0:f.usedKey)||a,h=(f==null?void 0:f.exactUsedKey)||a,y=Object.prototype.toString.apply(m),v=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,C=!ne(m)&&typeof m!="boolean"&&typeof m!="number";if(E&&m&&C&&v.indexOf(y)<0&&!(ne(b)&&Array.isArray(m))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,m,{...n,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(f.res=L,f.usedParams=this.getUsedParamsDetails(n),f):L}if(o){const L=Array.isArray(m),Y=L?[]:{},se=L?h:w;for(const ae in m)if(Object.prototype.hasOwnProperty.call(m,ae)){const Se=`${se}${o}${ae}`;Y[ae]=this.translate(Se,{...n,joinArrays:!1,ns:c}),Y[ae]===Se&&(Y[ae]=m[ae])}m=Y}}else if(E&&ne(b)&&Array.isArray(m))m=m.join(b),m&&(m=this.extendTranslation(m,e,n,r));else{let L=!1,Y=!1;const se=n.count!==void 0&&!ne(n.count),ae=vo.hasDefaultValue(n),Se=se?this.pluralResolver.getSuffix(l,n.count,n):"",ze=n.ordinal&&se?this.pluralResolver.getSuffix(l,n.count,{ordinal:!1}):"",Ce=se&&!n.ordinal&&n.count===0,j=Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${Se}`]||n[`defaultValue${ze}`]||n.defaultValue;!this.isValidLookup(m)&&ae&&(L=!0,m=j),this.isValidLookup(m)||(Y=!0,m=a);const z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Y?void 0:m,k=ae&&j!==m&&this.options.updateMissing;if(Y||L||k){if(this.logger.log(k?"updateKey":"missingKey",l,d,a,k?j:m),o){const Q=this.resolve(a,{...n,keySeparator:!1});Q&&Q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let x=[];const P=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&P&&P[0])for(let Q=0;Q<P.length;Q++)x.push(P[Q]);else this.options.saveMissingTo==="all"?x=this.languageUtils.toResolveHierarchy(n.lng||this.language):x.push(n.lng||this.language);const U=(Q,W,oe)=>{var q;const ue=ae&&oe!==m?oe:z;this.options.missingKeyHandler?this.options.missingKeyHandler(Q,d,W,ue,k,n):(q=this.backendConnector)!=null&&q.saveMissing&&this.backendConnector.saveMissing(Q,d,W,ue,k,n),this.emit("missingKey",Q,d,W,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&se?x.forEach(Q=>{const W=this.pluralResolver.getSuffixes(Q,n);Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]&&W.indexOf(`${this.options.pluralSeparator}zero`)<0&&W.push(`${this.options.pluralSeparator}zero`),W.forEach(oe=>{U([Q],a+oe,n[`defaultValue${oe}`]||j)})}):U(x,a,j))}m=this.extendTranslation(m,e,n,f,r),Y&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${d}:${a}`),(Y||L)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}:${a}`:a,L?m:void 0))}return i?(f.res=m,f.usedParams=this.getUsedParamsDetails(n),f):m}extendTranslation(e,n,r,i,o){var l,u;var a=this;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const f=ne(e)&&(((u=r==null?void 0:r.interpolation)==null?void 0:u.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(f){const h=e.match(this.interpolator.nestingRegexp);m=h&&h.length}let w=r.replace&&!ne(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(w={...this.options.interpolation.defaultVariables,...w}),e=this.interpolator.interpolate(e,w,r.lng||this.language||i.usedLng,r),f){const h=e.match(this.interpolator.nestingRegexp),y=h&&h.length;m<y&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var h=arguments.length,y=new Array(h),v=0;v<h;v++)y[v]=arguments[v];return(o==null?void 0:o[0])===y[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${n[0]}`),null):a.translate(...y,n)},r)),r.interpolation&&this.interpolator.reset()}const c=r.postProcess||this.options.postProcess,d=ne(c)?[c]:c;return e!=null&&(d!=null&&d.length)&&r.applyPostProcessor!==!1&&(e=vh.handle(d,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,c;return ne(e)&&(e=[e]),e.forEach(d=>{if(this.isValidLookup(r))return;const l=this.extractFromKey(d,n),u=l.key;i=u;let f=l.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const m=n.count!==void 0&&!ne(n.count),w=m&&!n.ordinal&&n.count===0,h=n.context!==void 0&&(ne(n.context)||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(v=>{var b,E;this.isValidLookup(r)||(c=v,!xu[`${y[0]}-${v}`]&&((b=this.utils)!=null&&b.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(c))&&(xu[`${y[0]}-${v}`]=!0,this.logger.warn(`key "${i}" for languages "${y.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(C=>{var se;if(this.isValidLookup(r))return;a=C;const L=[u];if((se=this.i18nFormat)!=null&&se.addLookupKeys)this.i18nFormat.addLookupKeys(L,u,C,v,n);else{let ae;m&&(ae=this.pluralResolver.getSuffix(C,n.count,n));const Se=`${this.options.pluralSeparator}zero`,ze=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(L.push(u+ae),n.ordinal&&ae.indexOf(ze)===0&&L.push(u+ae.replace(ze,this.options.pluralSeparator)),w&&L.push(u+Se)),h){const Ce=`${u}${this.options.contextSeparator}${n.context}`;L.push(Ce),m&&(L.push(Ce+ae),n.ordinal&&ae.indexOf(ze)===0&&L.push(Ce+ae.replace(ze,this.options.pluralSeparator)),w&&L.push(Ce+Se))}}let Y;for(;Y=L.pop();)this.isValidLookup(r)||(o=Y,r=this.getResource(C,v,Y,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){var o;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!ne(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const o of n)delete i[o]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class ku{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=zt.create("languageUtils")}getScriptPartFromCode(e){if(e=yo(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=yo(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ne(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&(o.indexOf("-")>0&&i.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===i||o.indexOf(i)===0&&i.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ne(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ne(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):ne(e)&&o(this.formatLanguageCode(e)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}const Su={zero:0,one:1,two:2,few:3,many:4,other:5},Au={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class F1{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=zt.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=yo(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(r,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Au;if(!e.match(/-|_/))return Au;const d=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(d,n)}return this.pluralRulesCache[o]=a,a}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((i,o)=>Su[i]-Su[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const Eu=function(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=O1(t,e,n);return!o&&i&&ne(n)&&(o=Za(t,n,r),o===void 0&&(o=Za(e,n,r))),o},Aa=t=>t.replace(/\$/g,"$$$$");class D1{constructor(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=zt.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(r=>r),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:o,prefixEscaped:a,suffix:c,suffixEscaped:d,formatSeparator:l,unescapeSuffix:u,unescapePrefix:f,nestingPrefix:m,nestingPrefixEscaped:w,nestingSuffix:h,nestingSuffixEscaped:y,nestingOptionsSeparator:v,maxReplaces:b,alwaysFormat:E}=e.interpolation;this.escape=n!==void 0?n:T1,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?Wn(o):a||"{{",this.suffix=c?Wn(c):d||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=m?Wn(m):w||Wn("$t("),this.nestingSuffix=h?Wn(h):y||Wn(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=b||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,r,i){var w;let o,a,c;const d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=h=>{if(h.indexOf(this.formatSeparator)<0){const E=Eu(n,d,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,r,{...i,...n,interpolationkey:h}):E}const y=h.split(this.formatSeparator),v=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(Eu(n,d,v,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:v})};this.resetRegExp();const u=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((w=i==null?void 0:i.interpolation)==null?void 0:w.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Aa(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Aa(this.escape(h)):Aa(h)}].forEach(h=>{for(c=0;o=h.regex.exec(e);){const y=o[1].trim();if(a=l(y),a===void 0)if(typeof u=="function"){const b=u(e,o,i);a=ne(b)?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,y))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else!ne(a)&&!this.useRawValueToEscape&&(a=yu(a));const v=h.safeValue(a);if(e=e.replace(o[0],v),f?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=o[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;const c=(d,l)=>{const u=this.nestingOptionsSeparator;if(d.indexOf(u)<0)return d;const f=d.split(new RegExp(`${u}[ ]*{`));let m=`{${f[1]}`;d=f[0],m=this.interpolate(m,a);const w=m.match(/'/g),h=m.match(/"/g);(((w==null?void 0:w.length)??0)%2===0&&!h||h.length%2!==0)&&(m=m.replace(/'/g,'"'));try{a=JSON.parse(m),l&&(a={...l,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,y),`${d}${u}${m}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,d};for(;i=this.nestingRegexp.exec(e);){let d=[];a={...r},a=a.replace&&!ne(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let l=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=u.shift(),d=u,l=!0}if(o=n(c.call(this,i[1].trim(),a),a),o&&i[0]===e&&!ne(o))return o;ne(o)||(o=yu(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),l&&(o=d.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const V1=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(a){const[c,...d]=a.split(":"),l=d.join(":").trim().replace(/^'+|'+$/g,""),u=c.trim();n[u]||(n[u]=l),l==="false"&&(n[u]=!1),l==="true"&&(n[u]=!0),isNaN(l)||(n[u]=parseInt(l,10))}})}return{formatName:e,formatOptions:n}},Jn=t=>{const e={};return(n,r,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const a=r+JSON.stringify(o);let c=e[a];return c||(c=t(yo(r),i),e[a]=c),c(n)}};class q1{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=zt.create("formatter"),this.options=e,this.formats={number:Jn((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:Jn((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:Jn((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:Jn((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:Jn((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(e)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Jn(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(c=>c.indexOf(")")>-1)){const c=o.findIndex(d=>d.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,c)].join(this.formatSeparator)}return o.reduce((c,d)=>{var f;const{formatName:l,formatOptions:u}=V1(d);if(this.formats[l]){let m=c;try{const w=((f=i==null?void 0:i.formatParams)==null?void 0:f[i.interpolationkey])||{},h=w.locale||w.lng||i.locale||i.lng||r;m=this.formats[l](c,h,{...u,...i,...w})}catch(w){this.logger.warn(w)}return m}else this.logger.warn(`there was no format function for ${l}`);return c},e)}}const H1=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class K1 extends gs{constructor(e,n,r){var o,a;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=zt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(a=(o=this.backend)==null?void 0:o.init)==null||a.call(o,r,i.backend,i)}queueLoad(e,n,r,i){const o={},a={},c={},d={};return e.forEach(l=>{let u=!0;n.forEach(f=>{const m=`${l}|${f}`;!r.reload&&this.store.hasResourceBundle(l,f)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?a[m]===void 0&&(a[m]=!0):(this.state[m]=1,u=!1,a[m]===void 0&&(a[m]=!0),o[m]===void 0&&(o[m]=!0),d[f]===void 0&&(d[f]=!0)))}),u||(c[l]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(d)}}loaded(e,n,r){const i=e.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),!n&&r&&this.store.addResourceBundle(o,a,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const c={};this.queue.forEach(d=>{j1(d.loaded,[o],a),H1(d,e),n&&d.errors.push(n),d.pendingCount===0&&!d.done&&(Object.keys(d.loaded).forEach(l=>{c[l]||(c[l]={});const u=d.loaded[l];u.length&&u.forEach(f=>{c[l][f]===void 0&&(c[l][f]=!0)})}),d.done=!0,d.errors.length?d.callback(d.errors):d.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(d=>!d.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const c=(l,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(l&&u&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,o*2,a)},o);return}a(l,u)},d=this.backend[r].bind(this.backend);if(d.length===2){try{const l=d(e,n);l&&typeof l.then=="function"?l.then(u=>c(null,u)).catch(c):c(null,l)}catch(l){c(l)}return}return d(e,n,c)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();ne(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ne(n)&&(n=[n]);const o=this.queueLoad(e,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&c&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,c),this.loaded(e,a,c)})}saveMissing(e,n,r,i,o){var d,l,u,f,m;let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((l=(d=this.services)==null?void 0:d.utils)!=null&&l.hasLoadedNamespace&&!((f=(u=this.services)==null?void 0:u.utils)!=null&&f.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((m=this.backend)!=null&&m.create){const w={...a,isUpdate:o},h=this.backend.create.bind(this.backend);if(h.length<6)try{let y;h.length===5?y=h(e,n,r,i,w):y=h(e,n,r,i),y&&typeof y.then=="function"?y.then(v=>c(null,v)).catch(c):c(null,y)}catch(y){c(y)}else h(e,n,r,i,c,w)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const zu=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),ne(t[1])&&(e.defaultValue=t[1]),ne(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Iu=t=>{var e,n;return ne(t.ns)&&(t.ns=[t.ns]),ne(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ne(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Ki=()=>{},G1=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Zr extends gs{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Iu(e),this.services={},this.logger=zt,this.modules={external:[]},G1(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(ne(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=zu();this.options={...i,...this.options,...Iu(n)},this.options.interpolation={...i.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?zt.init(o(this.modules.logger),this.options):zt.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=q1;const f=new ku(this.options);this.store=new $u(this.options.resources,this.options);const m=this.services;m.logger=zt,m.resourceStore=this.store,m.languageUtils=f,m.pluralResolver=new F1(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(m.formatter=o(u),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new D1(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new K1(o(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(w){for(var h=arguments.length,y=new Array(h>1?h-1:0),v=1;v<h;v++)y[v-1]=arguments[v];e.emit(w,...y)}),this.modules.languageDetector&&(m.languageDetector=o(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=o(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new vo(this.services,this.options),this.translator.on("*",function(w){for(var h=arguments.length,y=new Array(h>1?h-1:0),v=1;v<h;v++)y[v-1]=arguments[v];e.emit(w,...y)}),this.modules.external.forEach(w=>{w.init&&w.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ki),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const d=Br(),l=()=>{const u=(f,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),d.resolve(m),r(f,m)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),d}loadResources(e){var o,a;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ki;const i=ne(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],d=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(f=>{f!=="cimode"&&c.indexOf(f)<0&&c.push(f)})};i?d(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>d(u)),(a=(o=this.options.preload)==null?void 0:o.forEach)==null||a.call(o,l=>d(l)),this.services.backendConnector.load(c,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(e,n,r){const i=Br();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=Ki),this.services.backendConnector.reload(e,n,o=>{i.resolve(),r(o)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&vh.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,n){var r=this;this.isLanguageChangingTo=e;const i=Br();this.emit("languageChanging",e);const o=d=>{this.language=d,this.languages=this.services.languageUtils.toResolveHierarchy(d),this.resolvedLanguage=void 0,this.setResolvedLanguage(d)},a=(d,l)=>{l?(o(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(d,function(){return r.t(...arguments)})},c=d=>{var u,f;!e&&!d&&this.services.languageDetector&&(d=[]);const l=ne(d)?d:this.services.languageUtils.getBestMatchFromCodes(d);l&&(this.language||o(l),this.translator.language||this.translator.changeLanguage(l),(f=(u=this.services.languageDetector)==null?void 0:u.cacheUserLanguage)==null||f.call(u,l)),this.loadResources(l,m=>{a(m,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(e),i}getFixedT(e,n,r){var i=this;const o=function(a,c){let d;if(typeof c!="object"){for(var l=arguments.length,u=new Array(l>2?l-2:0),f=2;f<l;f++)u[f-2]=arguments[f];d=i.options.overloadTranslationOptionHandler([a,c].concat(u))}else d={...c};d.lng=d.lng||o.lng,d.lngs=d.lngs||o.lngs,d.ns=d.ns||o.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||r||o.keyPrefix);const m=i.options.keySeparator||".";let w;return d.keyPrefix&&Array.isArray(a)?w=a.map(h=>`${d.keyPrefix}${m}${h}`):w=d.keyPrefix?`${d.keyPrefix}${m}${a}`:a,i.t(w,d)};return ne(e)?o.lng=e:o.lngs=e,o.ns=n,o.keyPrefix=r,o}t(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.translate(...n)}exists(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.exists(...n)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(c,d)=>{const l=this.services.backendConnector.state[`${c}|${d}`];return l===-1||l===0||l===2};if(n.precheck){const c=n.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}loadNamespaces(e,n){const r=Br();return this.options.ns?(ne(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=Br();ne(e)&&(e=[e]);const i=this.options.preload||[],o=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(e){var i,o;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new ku(zu());return n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Zr(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ki;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new Zr(i);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(c=>{o[c]=this[c]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const c=Object.keys(this.store.data).reduce((d,l)=>(d[l]={...this.store.data[l]},Object.keys(d[l]).reduce((u,f)=>(u[f]={...d[l][f]},u),{})),{});o.store=new $u(c,i),o.services.resourceStore=o.store}return o.translator=new vo(o.services,i),o.translator.on("*",function(c){for(var d=arguments.length,l=new Array(d>1?d-1:0),u=1;u<d;u++)l[u-1]=arguments[u];o.emit(c,...l)}),o.init(i,n),o.translator.options=i,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const O=Zr.createInstance();O.createInstance=Zr.createInstance;O.createInstance;O.dir;O.init;O.loadResources;O.reloadResources;O.use;O.changeLanguage;O.getFixedT;const re=O.t;O.exists;O.setDefaultNamespace;O.hasLoadedNamespace;O.loadNamespaces;O.loadLanguages;var bh=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(n.origin);return async function(o,a){var l,u;function c(f,m){o.res.headers.set(f,m)}const d=r(o.req.header("origin")||"",o);if(d&&c("Access-Control-Allow-Origin",d),n.origin!=="*"){const f=o.req.header("Vary");f?c("Vary",f):c("Vary","Origin")}if(n.credentials&&c("Access-Control-Allow-Credentials","true"),(l=n.exposeHeaders)!=null&&l.length&&c("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.maxAge!=null&&c("Access-Control-Max-Age",n.maxAge.toString()),(u=n.allowMethods)!=null&&u.length&&c("Access-Control-Allow-Methods",n.allowMethods.join(","));let f=n.allowHeaders;if(!(f!=null&&f.length)){const m=o.req.header("Access-Control-Request-Headers");m&&(f=m.split(/\s*,\s*/))}return f!=null&&f.length&&(c("Access-Control-Allow-Headers",f.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await a()}};const Xt=s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()}),ms=s.z.object({created_at:s.z.string(),updated_at:s.z.string()}),$h=s.z.object({email:s.z.string().optional(),email_verified:s.z.boolean().optional(),name:s.z.string().optional(),username:s.z.string().optional(),given_name:s.z.string().optional(),phone_number:s.z.string().optional(),phone_verified:s.z.boolean().optional(),family_name:s.z.string().optional()}).catchall(s.z.any()),xh=s.z.object({connection:s.z.string(),user_id:s.z.string(),provider:s.z.string(),isSocial:s.z.boolean(),access_token:s.z.string().optional(),access_token_secret:s.z.string().optional(),refresh_token:s.z.string().optional(),profileData:$h.optional()}),_s=s.z.object({email:s.z.string().optional().transform(t=>t&&t.toLowerCase()),username:s.z.string().optional(),phone_number:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),nickname:s.z.string().optional(),name:s.z.string().optional(),picture:s.z.string().optional(),locale:s.z.string().optional(),linked_to:s.z.string().optional(),profileData:s.z.string().optional(),user_id:s.z.string().optional(),app_metadata:s.z.any().default({}).optional(),user_metadata:s.z.any().default({}).optional()}),bo=_s.extend({email_verified:s.z.boolean().default(!1),verify_email:s.z.boolean().optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string().optional(),provider:s.z.string().default("email"),connection:s.z.string().default("email"),is_social:s.z.boolean().optional()}),Rd=s.z.object({...bo.shape,...ms.shape,user_id:s.z.string(),is_social:s.z.boolean(),email:s.z.string().optional(),login_count:s.z.number().default(0),identities:s.z.array(xh).optional()}),Et=Rd,W1=_s.extend({login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any()),J1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let X1=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=J1[n[t]&63];return e};const kh=s.z.object({audience:s.z.string().optional(),recipient:s.z.string().optional(),createUpnClaim:s.z.boolean().optional(),mapUnknownClaimsAsIs:s.z.boolean().optional(),passthroughClaimsWithNoMapping:s.z.boolean().optional(),mapIdentities:s.z.boolean().optional(),signatureAlgorithm:s.z.string().optional(),digestAlgorithm:s.z.string().optional(),issuer:s.z.string().optional(),destination:s.z.string().optional(),lifetimeInSeconds:s.z.number().optional(),signResponse:s.z.boolean().optional(),nameIdentifierFormat:s.z.string().optional(),nameIdentifierProbes:s.z.array(s.z.string()).optional(),authnContextClassRef:s.z.string().optional(),mappings:s.z.record(s.z.string()).optional()}),$o=s.z.object({id:s.z.string(),name:s.z.string(),callbacks:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:s.z.array(s.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:s.z.object({samlp:kh.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:s.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:s.z.string().default(()=>X1()).optional(),disable_sign_ups:s.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),xn=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...$o.shape}),xr=s.z.object({x:s.z.number(),y:s.z.number()});var Bd=(t=>(t.RICH_TEXT="RICH_TEXT",t.NEXT_BUTTON="NEXT_BUTTON",t.BACK_BUTTON="BACK_BUTTON",t.SUBMIT_BUTTON="SUBMIT_BUTTON",t.DIVIDER="DIVIDER",t.TEXT="TEXT",t.EMAIL="EMAIL",t.PASSWORD="PASSWORD",t.NUMBER="NUMBER",t.PHONE="PHONE",t.DATE="DATE",t.CHECKBOX="CHECKBOX",t.RADIO="RADIO",t.SELECT="SELECT",t.HIDDEN="HIDDEN",t.LEGAL="LEGAL",t))(Bd||{}),Ld=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(Ld||{});const ys=s.z.object({id:s.z.string(),category:s.z.nativeEnum(Ld),type:s.z.nativeEnum(Bd)}),Sh=ys.extend({category:s.z.literal("BLOCK"),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}).passthrough()}),Ah=ys.extend({category:s.z.literal("BLOCK"),type:s.z.union([s.z.literal("NEXT_BUTTON"),s.z.literal("BACK_BUTTON"),s.z.literal("SUBMIT_BUTTON")]),config:s.z.object({text:s.z.string()}).passthrough()}),Eh=ys.extend({category:s.z.literal("FIELD"),type:s.z.literal("LEGAL"),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({text:s.z.string()}).passthrough()}),zh=ys.extend({category:s.z.literal("FIELD"),type:s.z.union([s.z.literal("TEXT"),s.z.literal("EMAIL"),s.z.literal("PASSWORD"),s.z.literal("NUMBER"),s.z.literal("PHONE"),s.z.literal("DATE"),s.z.literal("CHECKBOX"),s.z.literal("RADIO"),s.z.literal("SELECT"),s.z.literal("HIDDEN")]),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({label:s.z.string().optional(),placeholder:s.z.string().optional()}).passthrough()}),Ih=s.z.object({id:s.z.string(),category:s.z.string(),type:s.z.string()}).passthrough(),Nh=s.z.union([Sh,Ah,Eh,zh,Ih]);var Ch=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(Ch||{});const jh=s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:xr,alias:s.z.string().optional(),config:s.z.object({components:s.z.array(Nh),next_node:s.z.string()}).passthrough()}),Oh=s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:xr,alias:s.z.string().optional(),config:s.z.object({flow_id:s.z.string(),next_node:s.z.string()})}),Ph=s.z.object({id:s.z.string(),type:s.z.string(),coordinates:xr}).passthrough(),Th=s.z.union([jh,Oh,Ph]),Rh=s.z.object({next_node:s.z.string(),coordinates:xr}).passthrough(),Bh=s.z.object({resume_flow:s.z.boolean().optional(),coordinates:xr}).passthrough(),Lh=s.z.object({id:s.z.string(),name:s.z.string(),languages:s.z.object({primary:s.z.string()}).passthrough(),nodes:s.z.array(Th),start:Rh,ending:Bh,created_at:s.z.string(),updated_at:s.z.string(),links:s.z.object({sdkSrc:s.z.string().optional(),sdk_src:s.z.string().optional()}).passthrough()}).passthrough(),Z1=Lh.omit({id:!0,created_at:!0,updated_at:!0});var it=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(it||{}),Dt=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(Dt||{}),ws=(t=>(t.S256="S256",t.Plain="plain",t))(ws||{});const Yr=s.z.object({client_id:s.z.string(),act_as:s.z.string().optional(),response_type:s.z.nativeEnum(it).optional(),response_mode:s.z.nativeEnum(Dt).optional(),redirect_uri:s.z.string().optional(),audience:s.z.string().optional(),organization:s.z.string().optional(),state:s.z.string().optional(),nonce:s.z.string().optional(),scope:s.z.string().optional(),prompt:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(ws).optional(),code_challenge:s.z.string().optional(),username:s.z.string().optional(),ui_locales:s.z.string().optional(),vendor_id:s.z.string().optional()}),Ya=s.z.object({colors:s.z.object({primary:s.z.string(),page_background:s.z.object({type:s.z.string().optional(),start:s.z.string().optional(),end:s.z.string().optional(),angle_deg:s.z.number().optional()}).optional()}).optional(),logo_url:s.z.string().optional(),favicon_url:s.z.string().optional(),font:s.z.object({url:s.z.string()}).optional()}),Ud=s.z.object({kid:s.z.string().optional(),team_id:s.z.string().optional(),realms:s.z.string().optional(),authentication_method:s.z.string().optional(),client_id:s.z.string().optional(),client_secret:s.z.string().optional(),app_secret:s.z.string().optional(),scope:s.z.string().optional(),authorization_endpoint:s.z.string().optional(),token_endpoint:s.z.string().optional(),userinfo_endpoint:s.z.string().optional(),jwks_uri:s.z.string().optional(),discovery_url:s.z.string().optional(),issuer:s.z.string().optional(),provider:s.z.string().optional(),from:s.z.string().optional(),twilio_sid:s.z.string().optional(),twilio_token:s.z.string().optional()}),xo=s.z.object({id:s.z.string().optional(),name:s.z.string(),strategy:s.z.string(),options:Ud.default({}),enabled_clients:s.z.array(s.z.string()).default([]).optional(),response_type:s.z.custom().optional(),response_mode:s.z.custom().optional()}),rn=s.z.object({id:s.z.string(),created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t)}).extend(xo.shape),ko=s.z.object({name:s.z.string(),audience:s.z.string(),sender_email:s.z.string().email(),sender_name:s.z.string(),support_url:s.z.string().url().optional(),logo:s.z.string().url().optional(),primary_color:s.z.string().optional(),secondary_color:s.z.string().optional(),language:s.z.string().optional(),id:s.z.string().optional()}),or=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ko.shape,id:s.z.string()}),Uh=s.z.object({logoUrl:s.z.string(),loginBackgroundImage:s.z.string().nullish(),style:s.z.object({primaryColor:s.z.string(),buttonTextColor:s.z.string(),primaryHoverColor:s.z.string()}),supportEmail:s.z.string().nullable(),supportUrl:s.z.string().nullable(),name:s.z.string(),showGreyishBackground:s.z.boolean().optional(),termsAndConditionsUrl:s.z.string().nullable(),companyName:s.z.string().optional(),checkoutHideSocial:s.z.boolean().optional(),siteUrl:s.z.string().nullable(),manageSubscriptionsUrl:s.z.string().optional()});s.z.object({...xn.shape,tenant:or,connections:s.z.array(rn)});const Mh=s.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),Fh=s.z.object({code_id:s.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:s.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:s.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Mh,code_verifier:s.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:s.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:s.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:s.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:s.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:s.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:s.z.string(),used_at:s.z.string().optional(),user_id:s.z.string().optional()}),Y1=s.z.object({...Fh.shape,created_at:s.z.string()}),Md=s.z.object({domain:s.z.string(),custom_domain_id:s.z.string().optional(),type:s.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:s.z.enum(["txt"]).optional(),tls_policy:s.z.enum(["recommended"]).optional(),custom_client_ip_header:s.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:s.z.record(s.z.string().max(255)).optional()}),Dh=s.z.object({name:s.z.literal("txt"),record:s.z.string(),domain:s.z.string()}),nn=s.z.object({...Md.shape,custom_domain_id:s.z.string(),primary:s.z.boolean(),status:s.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:s.z.string().optional(),verification:s.z.object({methods:s.z.array(Dh)}).optional(),tls_policy:s.z.string().optional()}),Q1=nn.extend({tenant_id:s.z.string()}),e_=s.z.object({id:s.z.string(),type:s.z.literal("submit"),label:s.z.string(),className:s.z.string().optional(),disabled:s.z.boolean().optional().default(!1),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0),customizations:s.z.record(s.z.string(),s.z.any()).optional()}),Vh=s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("LEGAL"),config:s.z.object({text:s.z.string(),html:s.z.boolean().optional()}),required:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("TEXT"),config:s.z.object({placeholder:s.z.string().optional(),multiline:s.z.boolean().optional()}),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("NEXT_BUTTON"),config:s.z.object({text:s.z.string().optional()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)})]),So=s.z.object({name:s.z.string().openapi({description:"The name of the form"}),messages:s.z.object({errors:s.z.record(s.z.string(),s.z.any()).optional(),custom:s.z.record(s.z.string(),s.z.any()).optional()}).optional(),languages:s.z.object({primary:s.z.string().optional(),default:s.z.string().optional()}).optional(),translations:s.z.record(s.z.string(),s.z.any()).optional(),nodes:s.z.array(s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({flow_id:s.z.string().max(30),next_node:s.z.string()})}),s.z.object({id:s.z.string(),type:s.z.literal("ROUTER"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150),config:s.z.object({rules:s.z.array(s.z.object({id:s.z.string(),alias:s.z.string().min(1).max(150).optional(),condition:s.z.any(),next_node:s.z.string()})),fallback:s.z.array(s.z.string())})}),s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({components:s.z.array(Vh),next_node:s.z.string()})})])).optional(),start:s.z.object({hidden_fields:s.z.array(s.z.object({key:s.z.string(),value:s.z.string()})).optional(),next_node:s.z.string().optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional()}).optional(),ending:s.z.object({redirection:s.z.object({delay:s.z.number().optional(),target:s.z.string().optional()}).optional(),after_submit:s.z.object({flow_id:s.z.string().optional()}).optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional(),resume_flow:s.z.boolean().optional()}).optional(),style:s.z.object({css:s.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches new JSON structure)"}),tr=s.z.object({...ms.shape,...So.shape,id:s.z.string()}),qh=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Hh=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),vs={enabled:s.z.boolean().default(!1),synchronous:s.z.boolean().default(!1),priority:s.z.number().optional(),hook_id:s.z.string().optional()},t_=s.z.object({...vs,trigger_id:qh,url:s.z.string()}),n_=s.z.object({...vs,trigger_id:Hh,form_id:s.z.string()}),Qi=s.z.union([t_,n_]),r_=s.z.object({...vs,trigger_id:qh,...ms.shape,hook_id:s.z.string(),url:s.z.string()}),i_=s.z.object({...vs,trigger_id:Hh,...ms.shape,hook_id:s.z.string(),form_id:s.z.string()}),nr=s.z.union([r_,i_]),Fd=s.z.object({alg:s.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:s.z.string(),kid:s.z.string(),kty:s.z.enum(["RSA","EC","oct"]),n:s.z.string(),x5t:s.z.string().optional(),x5c:s.z.array(s.z.string()).optional(),use:s.z.enum(["sig","enc"]).optional()}),Kh=s.z.object({keys:s.z.array(Fd)}),Qa=s.z.object({issuer:s.z.string(),authorization_endpoint:s.z.string(),token_endpoint:s.z.string(),device_authorization_endpoint:s.z.string(),userinfo_endpoint:s.z.string(),mfa_challenge_endpoint:s.z.string(),jwks_uri:s.z.string(),registration_endpoint:s.z.string(),revocation_endpoint:s.z.string(),scopes_supported:s.z.array(s.z.string()),response_types_supported:s.z.array(s.z.string()),code_challenge_methods_supported:s.z.array(s.z.string()),response_modes_supported:s.z.array(s.z.string()),subject_types_supported:s.z.array(s.z.string()),id_token_signing_alg_values_supported:s.z.array(s.z.string()),token_endpoint_auth_methods_supported:s.z.array(s.z.string()),claims_supported:s.z.array(s.z.string()),request_uri_parameter_supported:s.z.boolean(),request_parameter_supported:s.z.boolean(),token_endpoint_auth_signing_alg_values_supported:s.z.array(s.z.string())}),Gh=s.z.object({csrf_token:s.z.string(),auth0Client:s.z.string().optional(),authParams:Yr,expires_at:s.z.string(),deleted_at:s.z.string().optional(),ip:s.z.string().optional(),useragent:s.z.string().optional(),session_id:s.z.string().optional(),authorization_url:s.z.string().optional(),login_completed:s.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),o_=s.z.object({...Gh.shape,id:s.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:s.z.string(),updated_at:s.z.string()});var he=(t=>(t.FAILED_SILENT_AUTH="fsa",t.FAILED_SIGNUP="fs",t.FAILED_LOGIN="f",t.FAILED_LOGIN_INCORRECT_PASSWORD="fp",t.FAILED_CHANGE_PASSWORD="fcp",t.FAILED_BY_CONNECTOR="fc",t.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",t.FAILED_HOOK="fh",t.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",t.SUCCESS_API_OPERATION="sapi",t.SUCCESS_CHANGE_PASSWORD="scp",t.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",t.SUCCESS_CHANGE_USERNAME="scu",t.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",t.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",t.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",t.SUCCESS_LOGIN="s",t.SUCCESS_LOGOUT="slo",t.SUCCESS_SIGNUP="ss",t.SUCCESS_SILENT_AUTH="ssa",t.SUCCESS_VERIFICATION_EMAIL="sv",t.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",t.CODE_LINK_SENT="cls",t.BLOCKED_ACCOUNT_EMAIL="limit_wc",t.BLOCKED_ACCOUNT_IP="limit_sul",t.BLOCKED_IP_ADDRESS="limit_mu",t))(he||{});const s_=s.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),Wh=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()}),Ao=s.z.object({type:s_,date:s.z.string(),description:s.z.string().optional(),log_id:s.z.string().optional(),_id:s.z.string().optional(),ip:s.z.string(),user_agent:s.z.string(),details:s.z.any().optional(),isMobile:s.z.boolean(),user_id:s.z.string().optional(),user_name:s.z.string().optional(),connection:s.z.string().optional(),connection_id:s.z.string().optional(),client_id:s.z.string().optional(),client_name:s.z.string().optional(),audience:s.z.string().optional(),scope:s.z.array(s.z.string()).optional(),strategy:s.z.string().optional(),strategy_type:s.z.string().optional(),hostname:s.z.string().optional(),auth0_client:Wh.optional()}),Jh=s.z.object({user_id:s.z.string(),password:s.z.string(),algorithm:s.z.enum(["bcrypt","argon2id"]).default("argon2id")}),a_=s.z.object({...Jh.shape,created_at:s.z.string(),updated_at:s.z.string()}),Xh=s.z.object({initial_user_agent:s.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:s.z.string().describe("First IP address associated with this session"),initial_asn:s.z.string().describe("First autonomous system number associated with this session"),last_user_agent:s.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:s.z.string().describe("Last IP address from which this user logged in"),last_asn:s.z.string().describe("Last autonomous system number from which this user logged in")}),Zh=s.z.object({id:s.z.string(),revoked_at:s.z.string().optional(),used_at:s.z.string().optional(),user_id:s.z.string().describe("The user ID associated with the session"),expires_at:s.z.string().optional(),login_session_id:s.z.string(),idle_expires_at:s.z.string().optional(),device:Xh.describe("Metadata related to the device used in the session"),clients:s.z.array(s.z.string()).describe("List of client details for the session")}),bs=s.z.object({created_at:s.z.string(),updated_at:s.z.string(),authenticated_at:s.z.string(),last_interaction_at:s.z.string(),...Zh.shape}),ec=s.z.object({kid:s.z.string().openapi({description:"The key id of the signing key"}),cert:s.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:s.z.string().openapi({description:"The cert fingerprint"}),thumbprint:s.z.string().openapi({description:"The cert thumbprint"}),pkcs7:s.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:s.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:s.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:s.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:s.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:s.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:s.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:s.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var rr=(t=>(t.RefreshToken="refresh_token",t.AuthorizationCode="authorization_code",t.ClientCredential="client_credentials",t.Passwordless="passwordless",t.Password="password",t.OTP="http://auth0.com/oauth/grant-type/passwordless/otp",t))(rr||{});const Dd=s.z.object({access_token:s.z.string(),id_token:s.z.string().optional(),scope:s.z.string().optional(),state:s.z.string().optional(),refresh_token:s.z.string().optional(),token_type:s.z.string(),expires_in:s.z.number()});s.z.object({code:s.z.string(),state:s.z.string().optional()});const Yh=s.z.object({button_border_radius:s.z.number(),button_border_weight:s.z.number(),buttons_style:s.z.enum(["pill"]),input_border_radius:s.z.number(),input_border_weight:s.z.number(),inputs_style:s.z.enum(["pill"]),show_widget_shadow:s.z.boolean(),widget_border_weight:s.z.number(),widget_corner_radius:s.z.number()}),Qh=s.z.object({base_focus_color:s.z.string(),base_hover_color:s.z.string(),body_text:s.z.string(),captcha_widget_theme:s.z.enum(["auto"]),error:s.z.string(),header:s.z.string(),icons:s.z.string(),input_background:s.z.string(),input_border:s.z.string(),input_filled_text:s.z.string(),input_labels_placeholders:s.z.string(),links_focused_components:s.z.string(),primary_button:s.z.string(),primary_button_label:s.z.string(),secondary_button_border:s.z.string(),secondary_button_label:s.z.string(),success:s.z.string(),widget_background:s.z.string(),widget_border:s.z.string()}),wn=s.z.object({bold:s.z.boolean(),size:s.z.number()}),e0=s.z.object({body_text:wn,buttons_text:wn,font_url:s.z.string(),input_labels:wn,links:wn,links_style:s.z.enum(["normal"]),reference_text_size:s.z.number(),subtitle:wn,title:wn}),t0=s.z.object({background_color:s.z.string(),background_image_url:s.z.string(),page_layout:s.z.enum(["center"])}),n0=s.z.object({header_text_alignment:s.z.enum(["center"]),logo_height:s.z.number(),logo_position:s.z.enum(["center"]),logo_url:s.z.string(),social_buttons_layout:s.z.enum(["bottom"])}),r0=s.z.object({borders:Yh,colors:Qh,displayName:s.z.string(),fonts:e0,page_background:t0,widget:n0}),c_=r0.extend({themeId:s.z.string()}),eo=s.z.object({universal_login_experience:s.z.enum(["new","classic"]).default("new"),identifier_first:s.z.boolean().default(!0),password_first:s.z.boolean().default(!1),webauthn_platform_first_factor:s.z.boolean()}),to=s.z.object({name:s.z.string(),enabled:s.z.boolean().optional().default(!0),default_from_address:s.z.string().optional(),credentials:s.z.union([s.z.object({accessKeyId:s.z.string(),secretAccessKey:s.z.string(),region:s.z.string()}),s.z.object({smtp_host:s.z.array(s.z.string()),smtp_port:s.z.number(),smtp_user:s.z.string(),smtp_pass:s.z.string()}),s.z.object({api_key:s.z.string(),domain:s.z.string().optional()}),s.z.object({connectionString:s.z.string()}),s.z.object({tenantId:s.z.string(),clientId:s.z.string(),clientSecret:s.z.string()})]),settings:s.z.object({}).optional()}),Vd=s.z.object({id:s.z.string(),session_id:s.z.string(),user_id:s.z.string(),client_id:s.z.string(),expires_at:s.z.string().optional(),idle_expires_at:s.z.string().optional(),last_exchanged_at:s.z.string().optional(),device:Xh,resource_servers:s.z.array(s.z.object({audience:s.z.string(),scopes:s.z.string()})),rotating:s.z.boolean()}),d_=s.z.object({created_at:s.z.string(),...Vd.shape}),l_=s.z.object({to:s.z.string(),message:s.z.string()}),u_=s.z.object({name:s.z.string(),options:s.z.object({})});function p_(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const f_=new s.OpenAPIHono().openapi(s.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ya}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.branding.get(e);return n?t.json(n):t.json({})}).openapi(s.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Ya.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.branding.set(e,n),t.text("OK")});var A=class extends Error{constructor(e=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});te(this,"res");te(this,"status");this.res=n==null?void 0:n.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},Eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function i0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function h_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function g_(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var o0={exports:{}};const m_={},__=Object.freeze(Object.defineProperty({__proto__:null,default:m_},Symbol.toStringTag,{value:"Module"})),y_=h_(__);(function(t){/**
|
|
2
2
|
* @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
3
3
|
* Released under the Apache License, Version 2.0
|
|
4
4
|
* see: https://github.com/dcodeIO/bcrypt.js for details
|
|
5
|
-
*/(function(e,n){typeof g_=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Eo,function(){var e={},n=null;function r(j){if(t&&t.exports)try{return y_.randomBytes(j)}catch{}try{var N;return(self.crypto||self.msCrypto).getRandomValues(N=new Uint32Array(j)),Array.prototype.slice.call(N)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(j)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(j){n=j},e.genSaltSync=function(j,N){if(j=j||y,typeof j!="number")throw Error("Illegal arguments: "+typeof j+", "+typeof N);j<4?j=4:j>31&&(j=31);var z=[];return z.push("$2a$"),j<10&&z.push("0"),z.push(j.toString()),z.push("$"),z.push(f(r(h),h)),z.join("")},e.genSalt=function(j,N,z){if(typeof N=="function"&&(z=N,N=void 0),typeof j=="function"&&(z=j,j=void 0),typeof j>"u")j=y;else if(typeof j!="number")throw Error("illegal arguments: "+typeof j);function k(x){a(function(){try{x(null,e.genSaltSync(j))}catch(P){x(P)}})}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(x,P){k(function(U,Q){if(U){P(U);return}x(Q)})})},e.hashSync=function(j,N){if(typeof N>"u"&&(N=y),typeof N=="number"&&(N=e.genSaltSync(N)),typeof j!="string"||typeof N!="string")throw Error("Illegal arguments: "+typeof j+", "+typeof N);return Ce(j,N)},e.hash=function(j,N,z,k){function x(P){typeof j=="string"&&typeof N=="number"?e.genSalt(N,function(U,Q){Ce(j,Q,P,k)}):typeof j=="string"&&typeof N=="string"?Ce(j,N,P,k):a(P.bind(this,Error("Illegal arguments: "+typeof j+", "+typeof N)))}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);x(z)}else return new Promise(function(P,U){x(function(Q,W){if(Q){U(Q);return}P(W)})})};function o(j,N){for(var z=0,k=0,x=0,P=j.length;x<P;++x)j.charCodeAt(x)===N.charCodeAt(x)?++z:++k;return z<0?!1:k===0}e.compareSync=function(j,N){if(typeof j!="string"||typeof N!="string")throw Error("Illegal arguments: "+typeof j+", "+typeof N);return N.length!==60?!1:o(e.hashSync(j,N.substr(0,N.length-31)),N)},e.compare=function(j,N,z,k){function x(P){if(typeof j!="string"||typeof N!="string"){a(P.bind(this,Error("Illegal arguments: "+typeof j+", "+typeof N)));return}if(N.length!==60){a(P.bind(this,null,!1));return}e.hash(j,N.substr(0,29),function(U,Q){U?P(U):P(null,o(Q,N))},k)}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);x(z)}else return new Promise(function(P,U){x(function(Q,W){if(Q){U(Q);return}P(W)})})},e.getRounds=function(j){if(typeof j!="string")throw Error("Illegal arguments: "+typeof j);return parseInt(j.split("$")[2],10)},e.getSalt=function(j){if(typeof j!="string")throw Error("Illegal arguments: "+typeof j);if(j.length!==60)throw Error("Illegal hash length: "+j.length+" != 60");return j.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c(j){var N=[],z=0;return w.encodeUTF16toUTF8(function(){return z>=j.length?null:j.charCodeAt(z++)},function(k){N.push(k)}),N}var d="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-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,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],u=String.fromCharCode;function f(j,N){var z=0,k=[],x,P;if(N<=0||N>j.length)throw Error("Illegal len: "+N);for(;z<N;){if(x=j[z++]&255,k.push(d[x>>2&63]),x=(x&3)<<4,z>=N){k.push(d[x&63]);break}if(P=j[z++]&255,x|=P>>4&15,k.push(d[x&63]),x=(P&15)<<2,z>=N){k.push(d[x&63]);break}P=j[z++]&255,x|=P>>6&3,k.push(d[x&63]),k.push(d[P&63])}return k.join("")}function m(j,N){var z=0,k=j.length,x=0,P=[],U,Q,W,oe,ue,q;if(N<=0)throw Error("Illegal len: "+N);for(;z<k-1&&x<N&&(q=j.charCodeAt(z++),U=q<l.length?l[q]:-1,q=j.charCodeAt(z++),Q=q<l.length?l[q]:-1,!(U==-1||Q==-1||(ue=U<<2>>>0,ue|=(Q&48)>>4,P.push(u(ue)),++x>=N||z>=k)||(q=j.charCodeAt(z++),W=q<l.length?l[q]:-1,W==-1)||(ue=(Q&15)<<4>>>0,ue|=(W&60)>>2,P.push(u(ue)),++x>=N||z>=k)));)q=j.charCodeAt(z++),oe=q<l.length?l[q]:-1,ue=(W&3)<<6>>>0,ue|=oe,P.push(u(ue)),++x;var je=[];for(z=0;z<x;z++)je.push(P[z].charCodeAt(0));return je}var w=function(){var j={};return j.MAX_CODEPOINT=1114111,j.encodeUTF8=function(N,z){var k=null;for(typeof N=="number"&&(k=N,N=function(){return null});k!==null||(k=N())!==null;)k<128?z(k&127):k<2048?(z(k>>6&31|192),z(k&63|128)):k<65536?(z(k>>12&15|224),z(k>>6&63|128),z(k&63|128)):(z(k>>18&7|240),z(k>>12&63|128),z(k>>6&63|128),z(k&63|128)),k=null},j.decodeUTF8=function(N,z){for(var k,x,P,U,Q=function(W){W=W.slice(0,W.indexOf(null));var oe=Error(W.toString());throw oe.name="TruncatedError",oe.bytes=W,oe};(k=N())!==null;)if(!(k&128))z(k);else if((k&224)===192)(x=N())===null&&Q([k,x]),z((k&31)<<6|x&63);else if((k&240)===224)((x=N())===null||(P=N())===null)&&Q([k,x,P]),z((k&15)<<12|(x&63)<<6|P&63);else if((k&248)===240)((x=N())===null||(P=N())===null||(U=N())===null)&&Q([k,x,P,U]),z((k&7)<<18|(x&63)<<12|(P&63)<<6|U&63);else throw RangeError("Illegal starting byte: "+k)},j.UTF16toUTF8=function(N,z){for(var k,x=null;(k=x!==null?x:N())!==null;){if(k>=55296&&k<=57343&&(x=N())!==null&&x>=56320&&x<=57343){z((k-55296)*1024+x-56320+65536),x=null;continue}z(k)}x!==null&&z(x)},j.UTF8toUTF16=function(N,z){var k=null;for(typeof N=="number"&&(k=N,N=function(){return null});k!==null||(k=N())!==null;)k<=65535?z(k):(k-=65536,z((k>>10)+55296),z(k%1024+56320)),k=null},j.encodeUTF16toUTF8=function(N,z){j.UTF16toUTF8(N,function(k){j.encodeUTF8(k,z)})},j.decodeUTF8toUTF16=function(N,z){j.decodeUTF8(N,function(k){j.UTF8toUTF16(k,z)})},j.calculateCodePoint=function(N){return N<128?1:N<2048?2:N<65536?3:4},j.calculateUTF8=function(N){for(var z,k=0;(z=N())!==null;)k+=j.calculateCodePoint(z);return k},j.calculateUTF16asUTF8=function(N){var z=0,k=0;return j.UTF16toUTF8(N,function(x){++z,k+=j.calculateCodePoint(x)}),[z,k]},j}();Date.now=Date.now||function(){return+new Date};var h=16,y=10,v=16,b=100,E=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],C=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],L=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function Y(j,N,z,k){var x,P=j[N],U=j[N+1];return P^=z[0],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[1],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[2],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[3],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[4],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[5],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[6],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[7],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[8],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[9],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[10],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[11],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[12],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[13],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[14],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[15],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[16],j[N]=U^z[v+1],j[N+1]=P,j}function se(j,N){for(var z=0,k=0;z<4;++z)k=k<<8|j[N]&255,N=(N+1)%j.length;return{key:k,offp:N}}function ae(j,N,z){for(var k=0,x=[0,0],P=N.length,U=z.length,Q,W=0;W<P;W++)Q=se(j,k),k=Q.offp,N[W]=N[W]^Q.key;for(W=0;W<P;W+=2)x=Y(x,0,N,z),N[W]=x[0],N[W+1]=x[1];for(W=0;W<U;W+=2)x=Y(x,0,N,z),z[W]=x[0],z[W+1]=x[1]}function Se(j,N,z,k){for(var x=0,P=[0,0],U=z.length,Q=k.length,W,oe=0;oe<U;oe++)W=se(N,x),x=W.offp,z[oe]=z[oe]^W.key;for(x=0,oe=0;oe<U;oe+=2)W=se(j,x),x=W.offp,P[0]^=W.key,W=se(j,x),x=W.offp,P[1]^=W.key,P=Y(P,0,z,k),z[oe]=P[0],z[oe+1]=P[1];for(oe=0;oe<Q;oe+=2)W=se(j,x),x=W.offp,P[0]^=W.key,W=se(j,x),x=W.offp,P[1]^=W.key,P=Y(P,0,z,k),k[oe]=P[0],k[oe+1]=P[1]}function ze(j,N,z,k,x){var P=L.slice(),U=P.length,Q;if(z<4||z>31)if(Q=Error("Illegal number of rounds (4-31): "+z),k){a(k.bind(this,Q));return}else throw Q;if(N.length!==h)if(Q=Error("Illegal salt length: "+N.length+" != "+h),k){a(k.bind(this,Q));return}else throw Q;z=1<<z>>>0;var W,oe,ue=0,q;Int32Array?(W=new Int32Array(E),oe=new Int32Array(C)):(W=E.slice(),oe=C.slice()),Se(N,j,W,oe);function je(){if(x&&x(ue/z),ue<z)for(var ge=Date.now();ue<z&&(ue=ue+1,ae(j,W,oe),ae(N,W,oe),!(Date.now()-ge>b)););else{for(ue=0;ue<64;ue++)for(q=0;q<U>>1;q++)Y(P,q<<1,W,oe);var Ae=[];for(ue=0;ue<U;ue++)Ae.push((P[ue]>>24&255)>>>0),Ae.push((P[ue]>>16&255)>>>0),Ae.push((P[ue]>>8&255)>>>0),Ae.push((P[ue]&255)>>>0);if(k){k(null,Ae);return}else return Ae}k&&a(je)}if(typeof k<"u")je();else for(var yn;;)if(typeof(yn=je())<"u")return yn||[]}function Ce(j,N,z,k){var x;if(typeof j!="string"||typeof N!="string")if(x=Error("Invalid string / salt: Not a string"),z){a(z.bind(this,x));return}else throw x;var P,U;if(N.charAt(0)!=="$"||N.charAt(1)!=="2")if(x=Error("Invalid salt version: "+N.substring(0,2)),z){a(z.bind(this,x));return}else throw x;if(N.charAt(2)==="$")P="\0",U=3;else{if(P=N.charAt(2),P!=="a"&&P!=="b"&&P!=="y"||N.charAt(3)!=="$")if(x=Error("Invalid salt revision: "+N.substring(2,4)),z){a(z.bind(this,x));return}else throw x;U=4}if(N.charAt(U+2)>"$")if(x=Error("Missing salt rounds"),z){a(z.bind(this,x));return}else throw x;var Q=parseInt(N.substring(U,U+1),10)*10,W=parseInt(N.substring(U+1,U+2),10),oe=Q+W,ue=N.substring(U+3,U+25);j+=P>="a"?"\0":"";var q=c(j),je=m(ue,h);function yn(ge){var Ae=[];return Ae.push("$2"),P>="a"&&Ae.push(P),Ae.push("$"),oe<10&&Ae.push("0"),Ae.push(oe.toString()),Ae.push("$"),Ae.push(f(je,je.length)),Ae.push(f(ge,L.length*4-1)),Ae.join("")}if(typeof z>"u")return yn(ze(q,je,oe));ze(q,je,oe,function(ge,Ae){ge?z(ge,null):z(null,yn(Ae))},k)}return e.encodeBase64=f,e.decodeBase64=m,e})})(o0);var w_=o0.exports;const vi=i0(w_),v_="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let b_=t=>crypto.getRandomValues(new Uint8Array(t)),$_=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(o=e)=>{let a="";for(;;){let c=n(i),d=i;for(;d--;)if(a+=t[c[d]&r]||"",a.length===o)return a}}},x_=(t,e=21)=>$_(t,e,b_),xe=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=v_[n[t]&63];return e};const k_=24;function xs(){return x_("0123456789abcdef",k_)()}function Nu(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function S_(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await zs({userAdapter:t.users,tenant_id:e,email:n.email});return r?(await t.users.create(e,{...n,linked_to:r.user_id}),r):t.users.create(e,n)}}function we(t,e){return{type:e.type,description:e.description||"",ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",date:new Date().toISOString(),details:{request:{method:t.req.method,path:t.req.path,qs:t.req.queries(),body:e.body||t.var.body||""}},isMobile:!1,client_id:t.var.client_id,client_name:"",user_id:e.userId||t.var.user_id||"",hostname:t.req.header("host")||"",user_name:t.var.username||"",connection_id:"",connection:t.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}class Hd{constructor(e,n){te(this,"value");te(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Hd(Math.round(this.milliseconds()*e),"ms")}}class A_{constructor(e){te(this,"hash");this.hash=e}async verify(e,n,r){const i=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",i,n,r)}async sign(e,n){const r=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,n)}async generateKeyPair(e){const n=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),r=await crypto.subtle.exportKey("pkcs8",n.privateKey),i=await crypto.subtle.exportKey("spki",n.publicKey);return{privateKey:r,publicKey:i}}}async function s0(t){return await crypto.subtle.digest("SHA-256",t)}const Cu="0123456789abcdef";function nc(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=Cu[i];const o=e[r]&15;n+=Cu[o]}return n}class a0{constructor(e,n){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],o+=8;o>=5;)o-=5,r+=this.alphabet[i>>o&31];if(o>0&&(r+=this.alphabet[i<<5-o&31]),(n==null?void 0:n.includePadding)??!0){const c=(8-r.length%8)%8;for(let d=0;d<c;d++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),o=[];for(let a=0;a<i;a++){let c=0;const d=[];for(let u=0;u<8;u++){const f=e[a*8+u];if(f==="="){if(a+1!==i)throw new Error(`Invalid character: ${f}`);c+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const m=this.decodeMap.get(f)??null;if(m===null)throw new Error(`Invalid character: ${f}`);d.push(m)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const l=(d[0]<<3)+(d[1]>>2);if(o.push(l),c<6){const u=((d[1]&3)<<6)+(d[2]<<1)+(d[3]>>4);o.push(u)}if(c<4){const u=((d[3]&255)<<4)+(d[4]>>1);o.push(u)}if(c<3){const u=((d[4]&1)<<7)+(d[5]<<2)+(d[6]>>3);o.push(u)}if(c<1){const u=((d[6]&7)<<5)+d[7];o.push(u)}}return Uint8Array.from(o)}}new a0("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new a0("0123456789ABCDEFGHIJKLMNOPQRSTUV");class c0{constructor(e,n){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],o+=8;o>=6;)o+=-6,r+=this.alphabet[i>>o&63];if(o>0&&(r+=this.alphabet[i<<6-o&63]),(n==null?void 0:n.includePadding)??!0){const c=(4-r.length%4)%4;for(let d=0;d<c;d++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),o=[];for(let a=0;a<i;a++){let c=0,d=0;for(let l=0;l<4;l++){const u=e[a*4+l];if(u==="="){if(a+1!==i)throw new Error(`Invalid character: ${u}`);c+=1;continue}if(u===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const f=this.decodeMap.get(u)??null;if(f===null)throw new Error(`Invalid character: ${u}`);d+=f<<6*(3-l)}o.push(d>>16&255),c<2&&o.push(d>>8&255),c<1&&o.push(d&255)}return Uint8Array.from(o)}}const E_=new c0("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),En=new c0("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function ju(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},o={...n};(r==null?void 0:r.audiences)!==void 0&&(o.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(o.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(o.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(o.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(o.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(o.nbf=Math.floor(r.notBefore.getTime()/1e3)),o.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,c=En.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),d=En.encode(a.encode(JSON.stringify(o)),{includePadding:!1}),l=a.encode([c,d].join(".")),u=await I_(t).sign(e,l),f=En.encode(new Uint8Array(u),{includePadding:!1});return[c,d,f].join(".")}function z_(t){const e=t.split(".");return e.length!==3?null:e}function Kd(t){const e=z_(t);if(!e)return null;const n=new TextDecoder,r=En.decode(e[0],{strict:!1}),i=En.decode(e[1],{strict:!1}),o=JSON.parse(n.decode(r));if(typeof o!="object"||o===null||!("alg"in o)||!N_(o.alg)||"typ"in o&&o.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const c={algorithm:o.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;c.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;c.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;c.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const d of a.aud)if(typeof d!="string")return null;c.audiences=a.aud}else{if(typeof a.aud!="string")return null;c.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;c.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;c.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;c.jwtId=a.jti}return{value:t,header:{...o,typ:"JWT",alg:o.alg},payload:{...a},parts:e,...c}}function I_(t){return new A_(C_[t])}function N_(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const C_={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function j_(){const t=new Uint8Array(32);return crypto.getRandomValues(t),En.encode(t,{includePadding:!1})}function O_(t){try{const n=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(t);if(!n||!n[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(n[1].replace(/\s/g,"")),r=>r.charCodeAt(0)).buffer}finally{t=t.replace(/./g,"\0")}}async function P_(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await s0(n);return En.encode(new Uint8Array(r),{includePadding:!1})}const Gi=60*5,ks=30*24*60*60,Qr=24*60*60,T_="auth-token",no=30*60*1e3,R_=7*24*60*60*1e3,B_=5*60,L_=5*60,U_=30*60*1e3,M_=30*60*1e3,F_=24*60*60*1e3;function d0(t,e,n){const r=[];return r.push([encodeURIComponent(t),encodeURIComponent(e)]),(n==null?void 0:n.domain)!==void 0&&r.push(["Domain",n.domain]),(n==null?void 0:n.expires)!==void 0&&r.push(["Expires",n.expires.toUTCString()]),n!=null&&n.httpOnly&&r.push(["HttpOnly"]),(n==null?void 0:n.maxAge)!==void 0&&r.push(["Max-Age",n.maxAge.toString()]),(n==null?void 0:n.path)!==void 0&&r.push(["Path",n.path]),(n==null?void 0:n.sameSite)==="lax"&&r.push(["SameSite","Lax"]),(n==null?void 0:n.sameSite)==="none"&&r.push(["SameSite","None"]),(n==null?void 0:n.sameSite)==="strict"&&r.push(["SameSite","Strict"]),n!=null&&n.secure&&r.push(["Secure"]),r.map(i=>i.join("=")).join("; ")}function D_(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),o=i[0],a=i[1]??"";o&&e.set(decodeURIComponent(o),decodeURIComponent(a))}return e}function Gd(t){return`${t}-${T_}`}function l0(t){if(!t)return;if(t==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(t))return t;const e=t.split(".");return e.length>2?`.${e.slice(-2).join(".")}`:`.${t}`}function zo(t,e){return e?D_(e).get(Gd(t)):void 0}function V_(t,e){return d0(Gd(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?l0(e):void 0})}function rc(t,e,n){return d0(Gd(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:ks,sameSite:"none",domain:n?l0(n):void 0})}var Wd={},Ss={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),o=function(c,d){const l=[];let u=d.exec(c);for(;u;){const f=[];f.startIndex=d.lastIndex-u[0].length;const m=u.length;for(let w=0;w<m;w++)f.push(u[w]);l.push(f),u=d.exec(c)}return l},a=function(c){const d=i.exec(c);return!(d===null||typeof d>"u")};t.isExist=function(c){return typeof c<"u"},t.isEmptyObject=function(c){return Object.keys(c).length===0},t.merge=function(c,d,l){if(d){const u=Object.keys(d),f=u.length;for(let m=0;m<f;m++)l==="strict"?c[u[m]]=[d[u[m]]]:c[u[m]]=d[u[m]]}},t.getValue=function(c){return t.isExist(c)?c:""},t.isName=a,t.getAllMatches=o,t.nameRegexp=r})(Ss);const Jd=Ss,q_={allowBooleanAttributes:!1,unpairedTags:[]};Wd.validate=function(t,e){e=Object.assign({},q_,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=Pu(t,o),o.err)return o}else if(t[o]==="<"){let a=o;if(o++,t[o]==="!"){o=Tu(t,o);continue}else{let c=!1;t[o]==="/"&&(c=!0,o++);let d="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
|
|
5
|
+
*/(function(e,n){typeof g_=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Eo,function(){var e={},n=null;function r(j){if(t&&t.exports)try{return y_.randomBytes(j)}catch{}try{var N;return(self.crypto||self.msCrypto).getRandomValues(N=new Uint32Array(j)),Array.prototype.slice.call(N)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(j)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(j){n=j},e.genSaltSync=function(j,N){if(j=j||y,typeof j!="number")throw Error("Illegal arguments: "+typeof j+", "+typeof N);j<4?j=4:j>31&&(j=31);var z=[];return z.push("$2a$"),j<10&&z.push("0"),z.push(j.toString()),z.push("$"),z.push(f(r(h),h)),z.join("")},e.genSalt=function(j,N,z){if(typeof N=="function"&&(z=N,N=void 0),typeof j=="function"&&(z=j,j=void 0),typeof j>"u")j=y;else if(typeof j!="number")throw Error("illegal arguments: "+typeof j);function k(x){a(function(){try{x(null,e.genSaltSync(j))}catch(P){x(P)}})}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(x,P){k(function(U,Q){if(U){P(U);return}x(Q)})})},e.hashSync=function(j,N){if(typeof N>"u"&&(N=y),typeof N=="number"&&(N=e.genSaltSync(N)),typeof j!="string"||typeof N!="string")throw Error("Illegal arguments: "+typeof j+", "+typeof N);return Ce(j,N)},e.hash=function(j,N,z,k){function x(P){typeof j=="string"&&typeof N=="number"?e.genSalt(N,function(U,Q){Ce(j,Q,P,k)}):typeof j=="string"&&typeof N=="string"?Ce(j,N,P,k):a(P.bind(this,Error("Illegal arguments: "+typeof j+", "+typeof N)))}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);x(z)}else return new Promise(function(P,U){x(function(Q,W){if(Q){U(Q);return}P(W)})})};function o(j,N){for(var z=0,k=0,x=0,P=j.length;x<P;++x)j.charCodeAt(x)===N.charCodeAt(x)?++z:++k;return z<0?!1:k===0}e.compareSync=function(j,N){if(typeof j!="string"||typeof N!="string")throw Error("Illegal arguments: "+typeof j+", "+typeof N);return N.length!==60?!1:o(e.hashSync(j,N.substr(0,N.length-31)),N)},e.compare=function(j,N,z,k){function x(P){if(typeof j!="string"||typeof N!="string"){a(P.bind(this,Error("Illegal arguments: "+typeof j+", "+typeof N)));return}if(N.length!==60){a(P.bind(this,null,!1));return}e.hash(j,N.substr(0,29),function(U,Q){U?P(U):P(null,o(Q,N))},k)}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);x(z)}else return new Promise(function(P,U){x(function(Q,W){if(Q){U(Q);return}P(W)})})},e.getRounds=function(j){if(typeof j!="string")throw Error("Illegal arguments: "+typeof j);return parseInt(j.split("$")[2],10)},e.getSalt=function(j){if(typeof j!="string")throw Error("Illegal arguments: "+typeof j);if(j.length!==60)throw Error("Illegal hash length: "+j.length+" != 60");return j.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c(j){var N=[],z=0;return w.encodeUTF16toUTF8(function(){return z>=j.length?null:j.charCodeAt(z++)},function(k){N.push(k)}),N}var d="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-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,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],u=String.fromCharCode;function f(j,N){var z=0,k=[],x,P;if(N<=0||N>j.length)throw Error("Illegal len: "+N);for(;z<N;){if(x=j[z++]&255,k.push(d[x>>2&63]),x=(x&3)<<4,z>=N){k.push(d[x&63]);break}if(P=j[z++]&255,x|=P>>4&15,k.push(d[x&63]),x=(P&15)<<2,z>=N){k.push(d[x&63]);break}P=j[z++]&255,x|=P>>6&3,k.push(d[x&63]),k.push(d[P&63])}return k.join("")}function m(j,N){var z=0,k=j.length,x=0,P=[],U,Q,W,oe,ue,q;if(N<=0)throw Error("Illegal len: "+N);for(;z<k-1&&x<N&&(q=j.charCodeAt(z++),U=q<l.length?l[q]:-1,q=j.charCodeAt(z++),Q=q<l.length?l[q]:-1,!(U==-1||Q==-1||(ue=U<<2>>>0,ue|=(Q&48)>>4,P.push(u(ue)),++x>=N||z>=k)||(q=j.charCodeAt(z++),W=q<l.length?l[q]:-1,W==-1)||(ue=(Q&15)<<4>>>0,ue|=(W&60)>>2,P.push(u(ue)),++x>=N||z>=k)));)q=j.charCodeAt(z++),oe=q<l.length?l[q]:-1,ue=(W&3)<<6>>>0,ue|=oe,P.push(u(ue)),++x;var je=[];for(z=0;z<x;z++)je.push(P[z].charCodeAt(0));return je}var w=function(){var j={};return j.MAX_CODEPOINT=1114111,j.encodeUTF8=function(N,z){var k=null;for(typeof N=="number"&&(k=N,N=function(){return null});k!==null||(k=N())!==null;)k<128?z(k&127):k<2048?(z(k>>6&31|192),z(k&63|128)):k<65536?(z(k>>12&15|224),z(k>>6&63|128),z(k&63|128)):(z(k>>18&7|240),z(k>>12&63|128),z(k>>6&63|128),z(k&63|128)),k=null},j.decodeUTF8=function(N,z){for(var k,x,P,U,Q=function(W){W=W.slice(0,W.indexOf(null));var oe=Error(W.toString());throw oe.name="TruncatedError",oe.bytes=W,oe};(k=N())!==null;)if(!(k&128))z(k);else if((k&224)===192)(x=N())===null&&Q([k,x]),z((k&31)<<6|x&63);else if((k&240)===224)((x=N())===null||(P=N())===null)&&Q([k,x,P]),z((k&15)<<12|(x&63)<<6|P&63);else if((k&248)===240)((x=N())===null||(P=N())===null||(U=N())===null)&&Q([k,x,P,U]),z((k&7)<<18|(x&63)<<12|(P&63)<<6|U&63);else throw RangeError("Illegal starting byte: "+k)},j.UTF16toUTF8=function(N,z){for(var k,x=null;(k=x!==null?x:N())!==null;){if(k>=55296&&k<=57343&&(x=N())!==null&&x>=56320&&x<=57343){z((k-55296)*1024+x-56320+65536),x=null;continue}z(k)}x!==null&&z(x)},j.UTF8toUTF16=function(N,z){var k=null;for(typeof N=="number"&&(k=N,N=function(){return null});k!==null||(k=N())!==null;)k<=65535?z(k):(k-=65536,z((k>>10)+55296),z(k%1024+56320)),k=null},j.encodeUTF16toUTF8=function(N,z){j.UTF16toUTF8(N,function(k){j.encodeUTF8(k,z)})},j.decodeUTF8toUTF16=function(N,z){j.decodeUTF8(N,function(k){j.UTF8toUTF16(k,z)})},j.calculateCodePoint=function(N){return N<128?1:N<2048?2:N<65536?3:4},j.calculateUTF8=function(N){for(var z,k=0;(z=N())!==null;)k+=j.calculateCodePoint(z);return k},j.calculateUTF16asUTF8=function(N){var z=0,k=0;return j.UTF16toUTF8(N,function(x){++z,k+=j.calculateCodePoint(x)}),[z,k]},j}();Date.now=Date.now||function(){return+new Date};var h=16,y=10,v=16,b=100,E=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],C=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],L=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function Y(j,N,z,k){var x,P=j[N],U=j[N+1];return P^=z[0],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[1],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[2],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[3],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[4],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[5],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[6],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[7],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[8],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[9],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[10],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[11],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[12],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[13],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[14],x=k[P>>>24],x+=k[256|P>>16&255],x^=k[512|P>>8&255],x+=k[768|P&255],U^=x^z[15],x=k[U>>>24],x+=k[256|U>>16&255],x^=k[512|U>>8&255],x+=k[768|U&255],P^=x^z[16],j[N]=U^z[v+1],j[N+1]=P,j}function se(j,N){for(var z=0,k=0;z<4;++z)k=k<<8|j[N]&255,N=(N+1)%j.length;return{key:k,offp:N}}function ae(j,N,z){for(var k=0,x=[0,0],P=N.length,U=z.length,Q,W=0;W<P;W++)Q=se(j,k),k=Q.offp,N[W]=N[W]^Q.key;for(W=0;W<P;W+=2)x=Y(x,0,N,z),N[W]=x[0],N[W+1]=x[1];for(W=0;W<U;W+=2)x=Y(x,0,N,z),z[W]=x[0],z[W+1]=x[1]}function Se(j,N,z,k){for(var x=0,P=[0,0],U=z.length,Q=k.length,W,oe=0;oe<U;oe++)W=se(N,x),x=W.offp,z[oe]=z[oe]^W.key;for(x=0,oe=0;oe<U;oe+=2)W=se(j,x),x=W.offp,P[0]^=W.key,W=se(j,x),x=W.offp,P[1]^=W.key,P=Y(P,0,z,k),z[oe]=P[0],z[oe+1]=P[1];for(oe=0;oe<Q;oe+=2)W=se(j,x),x=W.offp,P[0]^=W.key,W=se(j,x),x=W.offp,P[1]^=W.key,P=Y(P,0,z,k),k[oe]=P[0],k[oe+1]=P[1]}function ze(j,N,z,k,x){var P=L.slice(),U=P.length,Q;if(z<4||z>31)if(Q=Error("Illegal number of rounds (4-31): "+z),k){a(k.bind(this,Q));return}else throw Q;if(N.length!==h)if(Q=Error("Illegal salt length: "+N.length+" != "+h),k){a(k.bind(this,Q));return}else throw Q;z=1<<z>>>0;var W,oe,ue=0,q;Int32Array?(W=new Int32Array(E),oe=new Int32Array(C)):(W=E.slice(),oe=C.slice()),Se(N,j,W,oe);function je(){if(x&&x(ue/z),ue<z)for(var ge=Date.now();ue<z&&(ue=ue+1,ae(j,W,oe),ae(N,W,oe),!(Date.now()-ge>b)););else{for(ue=0;ue<64;ue++)for(q=0;q<U>>1;q++)Y(P,q<<1,W,oe);var Ae=[];for(ue=0;ue<U;ue++)Ae.push((P[ue]>>24&255)>>>0),Ae.push((P[ue]>>16&255)>>>0),Ae.push((P[ue]>>8&255)>>>0),Ae.push((P[ue]&255)>>>0);if(k){k(null,Ae);return}else return Ae}k&&a(je)}if(typeof k<"u")je();else for(var yn;;)if(typeof(yn=je())<"u")return yn||[]}function Ce(j,N,z,k){var x;if(typeof j!="string"||typeof N!="string")if(x=Error("Invalid string / salt: Not a string"),z){a(z.bind(this,x));return}else throw x;var P,U;if(N.charAt(0)!=="$"||N.charAt(1)!=="2")if(x=Error("Invalid salt version: "+N.substring(0,2)),z){a(z.bind(this,x));return}else throw x;if(N.charAt(2)==="$")P="\0",U=3;else{if(P=N.charAt(2),P!=="a"&&P!=="b"&&P!=="y"||N.charAt(3)!=="$")if(x=Error("Invalid salt revision: "+N.substring(2,4)),z){a(z.bind(this,x));return}else throw x;U=4}if(N.charAt(U+2)>"$")if(x=Error("Missing salt rounds"),z){a(z.bind(this,x));return}else throw x;var Q=parseInt(N.substring(U,U+1),10)*10,W=parseInt(N.substring(U+1,U+2),10),oe=Q+W,ue=N.substring(U+3,U+25);j+=P>="a"?"\0":"";var q=c(j),je=m(ue,h);function yn(ge){var Ae=[];return Ae.push("$2"),P>="a"&&Ae.push(P),Ae.push("$"),oe<10&&Ae.push("0"),Ae.push(oe.toString()),Ae.push("$"),Ae.push(f(je,je.length)),Ae.push(f(ge,L.length*4-1)),Ae.join("")}if(typeof z>"u")return yn(ze(q,je,oe));ze(q,je,oe,function(ge,Ae){ge?z(ge,null):z(null,yn(Ae))},k)}return e.encodeBase64=f,e.decodeBase64=m,e})})(o0);var w_=o0.exports;const vi=i0(w_),v_="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let b_=t=>crypto.getRandomValues(new Uint8Array(t)),$_=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(o=e)=>{let a="";for(;;){let c=n(i),d=i;for(;d--;)if(a+=t[c[d]&r]||"",a.length===o)return a}}},x_=(t,e=21)=>$_(t,e,b_),xe=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=v_[n[t]&63];return e};const k_=24;function $s(){return x_("0123456789abcdef",k_)()}function Nu(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function S_(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await Zd({userAdapter:t.users,tenant_id:e,email:n.email});return r?(await t.users.create(e,{...n,linked_to:r.user_id}),r):t.users.create(e,n)}}function we(t,e){return{type:e.type,description:e.description||"",ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",date:new Date().toISOString(),details:{request:{method:t.req.method,path:t.req.path,qs:t.req.queries(),body:e.body||t.var.body||""}},isMobile:!1,client_id:t.var.client_id,client_name:"",user_id:e.userId||t.var.user_id||"",hostname:t.req.header("host")||"",user_name:t.var.username||"",connection_id:"",connection:t.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}class qd{constructor(e,n){te(this,"value");te(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new qd(Math.round(this.milliseconds()*e),"ms")}}class A_{constructor(e){te(this,"hash");this.hash=e}async verify(e,n,r){const i=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",i,n,r)}async sign(e,n){const r=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,n)}async generateKeyPair(e){const n=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),r=await crypto.subtle.exportKey("pkcs8",n.privateKey),i=await crypto.subtle.exportKey("spki",n.publicKey);return{privateKey:r,publicKey:i}}}async function s0(t){return await crypto.subtle.digest("SHA-256",t)}const Cu="0123456789abcdef";function tc(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=Cu[i];const o=e[r]&15;n+=Cu[o]}return n}class a0{constructor(e,n){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],o+=8;o>=5;)o-=5,r+=this.alphabet[i>>o&31];if(o>0&&(r+=this.alphabet[i<<5-o&31]),(n==null?void 0:n.includePadding)??!0){const c=(8-r.length%8)%8;for(let d=0;d<c;d++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),o=[];for(let a=0;a<i;a++){let c=0;const d=[];for(let u=0;u<8;u++){const f=e[a*8+u];if(f==="="){if(a+1!==i)throw new Error(`Invalid character: ${f}`);c+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const m=this.decodeMap.get(f)??null;if(m===null)throw new Error(`Invalid character: ${f}`);d.push(m)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const l=(d[0]<<3)+(d[1]>>2);if(o.push(l),c<6){const u=((d[1]&3)<<6)+(d[2]<<1)+(d[3]>>4);o.push(u)}if(c<4){const u=((d[3]&255)<<4)+(d[4]>>1);o.push(u)}if(c<3){const u=((d[4]&1)<<7)+(d[5]<<2)+(d[6]>>3);o.push(u)}if(c<1){const u=((d[6]&7)<<5)+d[7];o.push(u)}}return Uint8Array.from(o)}}new a0("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new a0("0123456789ABCDEFGHIJKLMNOPQRSTUV");class c0{constructor(e,n){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],o+=8;o>=6;)o+=-6,r+=this.alphabet[i>>o&63];if(o>0&&(r+=this.alphabet[i<<6-o&63]),(n==null?void 0:n.includePadding)??!0){const c=(4-r.length%4)%4;for(let d=0;d<c;d++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),o=[];for(let a=0;a<i;a++){let c=0,d=0;for(let l=0;l<4;l++){const u=e[a*4+l];if(u==="="){if(a+1!==i)throw new Error(`Invalid character: ${u}`);c+=1;continue}if(u===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const f=this.decodeMap.get(u)??null;if(f===null)throw new Error(`Invalid character: ${u}`);d+=f<<6*(3-l)}o.push(d>>16&255),c<2&&o.push(d>>8&255),c<1&&o.push(d&255)}return Uint8Array.from(o)}}const E_=new c0("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),En=new c0("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function ju(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},o={...n};(r==null?void 0:r.audiences)!==void 0&&(o.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(o.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(o.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(o.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(o.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(o.nbf=Math.floor(r.notBefore.getTime()/1e3)),o.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,c=En.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),d=En.encode(a.encode(JSON.stringify(o)),{includePadding:!1}),l=a.encode([c,d].join(".")),u=await I_(t).sign(e,l),f=En.encode(new Uint8Array(u),{includePadding:!1});return[c,d,f].join(".")}function z_(t){const e=t.split(".");return e.length!==3?null:e}function Hd(t){const e=z_(t);if(!e)return null;const n=new TextDecoder,r=En.decode(e[0],{strict:!1}),i=En.decode(e[1],{strict:!1}),o=JSON.parse(n.decode(r));if(typeof o!="object"||o===null||!("alg"in o)||!N_(o.alg)||"typ"in o&&o.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const c={algorithm:o.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;c.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;c.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;c.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const d of a.aud)if(typeof d!="string")return null;c.audiences=a.aud}else{if(typeof a.aud!="string")return null;c.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;c.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;c.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;c.jwtId=a.jti}return{value:t,header:{...o,typ:"JWT",alg:o.alg},payload:{...a},parts:e,...c}}function I_(t){return new A_(C_[t])}function N_(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const C_={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function j_(){const t=new Uint8Array(32);return crypto.getRandomValues(t),En.encode(t,{includePadding:!1})}function O_(t){try{const n=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(t);if(!n||!n[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(n[1].replace(/\s/g,"")),r=>r.charCodeAt(0)).buffer}finally{t=t.replace(/./g,"\0")}}async function P_(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await s0(n);return En.encode(new Uint8Array(r),{includePadding:!1})}const Gi=60*5,xs=30*24*60*60,Qr=24*60*60,T_="auth-token",no=30*60*1e3,R_=7*24*60*60*1e3,B_=5*60,L_=5*60,U_=30*60*1e3,M_=30*60*1e3,F_=24*60*60*1e3;function d0(t,e,n){const r=[];return r.push([encodeURIComponent(t),encodeURIComponent(e)]),(n==null?void 0:n.domain)!==void 0&&r.push(["Domain",n.domain]),(n==null?void 0:n.expires)!==void 0&&r.push(["Expires",n.expires.toUTCString()]),n!=null&&n.httpOnly&&r.push(["HttpOnly"]),(n==null?void 0:n.maxAge)!==void 0&&r.push(["Max-Age",n.maxAge.toString()]),(n==null?void 0:n.path)!==void 0&&r.push(["Path",n.path]),(n==null?void 0:n.sameSite)==="lax"&&r.push(["SameSite","Lax"]),(n==null?void 0:n.sameSite)==="none"&&r.push(["SameSite","None"]),(n==null?void 0:n.sameSite)==="strict"&&r.push(["SameSite","Strict"]),n!=null&&n.secure&&r.push(["Secure"]),r.map(i=>i.join("=")).join("; ")}function D_(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),o=i[0],a=i[1]??"";o&&e.set(decodeURIComponent(o),decodeURIComponent(a))}return e}function Kd(t){return`${t}-${T_}`}function l0(t){if(!t)return;if(t==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(t))return t;const e=t.split(".");return e.length>2?`.${e.slice(-2).join(".")}`:`.${t}`}function zo(t,e){return e?D_(e).get(Kd(t)):void 0}function V_(t,e){return d0(Kd(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?l0(e):void 0})}function nc(t,e,n){return d0(Kd(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:xs,sameSite:"none",domain:n?l0(n):void 0})}var Gd={},ks={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),o=function(c,d){const l=[];let u=d.exec(c);for(;u;){const f=[];f.startIndex=d.lastIndex-u[0].length;const m=u.length;for(let w=0;w<m;w++)f.push(u[w]);l.push(f),u=d.exec(c)}return l},a=function(c){const d=i.exec(c);return!(d===null||typeof d>"u")};t.isExist=function(c){return typeof c<"u"},t.isEmptyObject=function(c){return Object.keys(c).length===0},t.merge=function(c,d,l){if(d){const u=Object.keys(d),f=u.length;for(let m=0;m<f;m++)l==="strict"?c[u[m]]=[d[u[m]]]:c[u[m]]=d[u[m]]}},t.getValue=function(c){return t.isExist(c)?c:""},t.isName=a,t.getAllMatches=o,t.nameRegexp=r})(ks);const Wd=ks,q_={allowBooleanAttributes:!1,unpairedTags:[]};Gd.validate=function(t,e){e=Object.assign({},q_,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=Pu(t,o),o.err)return o}else if(t[o]==="<"){let a=o;if(o++,t[o]==="!"){o=Tu(t,o);continue}else{let c=!1;t[o]==="/"&&(c=!0,o++);let d="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
|
|
6
6
|
`&&t[o]!=="\r";o++)d+=t[o];if(d=d.trim(),d[d.length-1]==="/"&&(d=d.substring(0,d.length-1),o--),!Y_(d)){let f;return d.trim().length===0?f="Invalid space after '<'.":f="Tag '"+d+"' is an invalid name.",be("InvalidTag",f,qe(t,o))}const l=G_(t,o);if(l===!1)return be("InvalidAttr","Attributes for '"+d+"' have open quote.",qe(t,o));let u=l.value;if(o=l.index,u[u.length-1]==="/"){const f=o-u.length;u=u.substring(0,u.length-1);const m=Ru(u,e);if(m===!0)r=!0;else return be(m.err.code,m.err.msg,qe(t,f+m.err.line))}else if(c)if(l.tagClosed){if(u.trim().length>0)return be("InvalidTag","Closing tag '"+d+"' can't have attributes or invalid starting.",qe(t,a));if(n.length===0)return be("InvalidTag","Closing tag '"+d+"' has not been opened.",qe(t,a));{const f=n.pop();if(d!==f.tagName){let m=qe(t,f.tagStartPos);return be("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+m.line+", col "+m.col+") instead of closing tag '"+d+"'.",qe(t,a))}n.length==0&&(i=!0)}}else return be("InvalidTag","Closing tag '"+d+"' doesn't have proper closing.",qe(t,o));else{const f=Ru(u,e);if(f!==!0)return be(f.err.code,f.err.msg,qe(t,o-u.length+f.err.line));if(i===!0)return be("InvalidXml","Multiple possible root nodes found.",qe(t,o));e.unpairedTags.indexOf(d)!==-1||n.push({tagName:d,tagStartPos:a}),r=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Tu(t,o);continue}else if(t[o+1]==="?"){if(o=Pu(t,++o),o.err)return o}else break;else if(t[o]==="&"){const f=X_(t,o);if(f==-1)return be("InvalidChar","char '&' is not expected.",qe(t,o));o=f}else if(i===!0&&!Ou(t[o]))return be("InvalidXml","Extra text at the end",qe(t,o));t[o]==="<"&&o--}}else{if(Ou(t[o]))continue;return be("InvalidChar","char '"+t[o]+"' is not expected.",qe(t,o))}if(r){if(n.length==1)return be("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",qe(t,n[0].tagStartPos));if(n.length>0)return be("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return be("InvalidXml","Start tag expected.",1);return!0};function Ou(t){return t===" "||t===" "||t===`
|
|
7
|
-
`||t==="\r"}function Pu(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return be("InvalidXml","XML declaration allowed only at the start of the document.",qe(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Tu(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const H_='"',K_="'";function G_(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===H_||t[e]===K_)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const W_=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Ru(t,e){const n=
|
|
8
|
-
`);const e=new Ur("!xml");let n=e,r="",i="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){const c=kn(t,">",o,"Closing Tag is not closed.");let d=t.substring(o+2,c).trim();if(this.options.removeNSPrefix){const f=d.indexOf(":");f!==-1&&(d=d.substr(f+1))}this.options.transformTagName&&(d=this.options.transformTagName(d)),n&&(r=this.saveTextToParentTag(r,n,i));const l=i.substring(i.lastIndexOf(".")+1);if(d&&this.options.unpairedTags.indexOf(d)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${d}>`);let u=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(u=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=i.lastIndexOf("."),i=i.substring(0,u),n=this.tagsNodeStack.pop(),r="",o=c}else if(t[o+1]==="?"){let c=
|
|
7
|
+
`||t==="\r"}function Pu(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return be("InvalidXml","XML declaration allowed only at the start of the document.",qe(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Tu(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const H_='"',K_="'";function G_(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===H_||t[e]===K_)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const W_=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Ru(t,e){const n=Wd.getAllMatches(t,W_),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return be("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",Lr(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return be("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",Lr(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return be("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",Lr(n[i]));const o=n[i][2];if(!Z_(o))return be("InvalidAttr","Attribute '"+o+"' is an invalid name.",Lr(n[i]));if(!r.hasOwnProperty(o))r[o]=1;else return be("InvalidAttr","Attribute '"+o+"' is repeated.",Lr(n[i]))}return!0}function J_(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function X_(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,J_(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function be(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Z_(t){return Wd.isName(t)}function Y_(t){return Wd.isName(t)}function qe(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Lr(t){return t.startIndex+t[1].length}var Jd={};const u0={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}},Q_=function(t){return Object.assign({},u0,t)};Jd.buildOptions=Q_;Jd.defaultOptions=u0;class ey{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var ty=ey;const ny=ks;function ry(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,o=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(i&&sy(t,e)){e+=7;let c,d;[c,d,e]=iy(t,e+1),d.indexOf("&")===-1&&(n[ly(c)]={regx:RegExp(`&${c};`,"g"),val:d})}else if(i&&ay(t,e))e+=8;else if(i&&cy(t,e))e+=8;else if(i&&dy(t,e))e+=9;else if(oy)o=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:a+=t[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:e}}function iy(t,e){let n="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)n+=t[e];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function oy(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function sy(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function ay(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function cy(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function dy(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function ly(t){if(ny.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var uy=ry;const py=/^[-+]?0x[a-fA-F0-9]+$/,fy=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const hy={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function gy(t,e={}){if(e=Object.assign({},hy,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(e.hex&&py.test(n))return Number.parseInt(n,16);{const r=fy.exec(n);if(r){const i=r[1],o=r[2];let a=my(r[3]);const c=r[4]||r[6];if(!e.leadingZeros&&o.length>0&&i&&n[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!i&&n[1]!==".")return t;{const d=Number(n),l=""+d;return l.search(/[eE]/)!==-1||c?e.eNotation?d:t:n.indexOf(".")!==-1?l==="0"&&a===""||l===a||i&&l==="-"+a?d:t:o?a===l||i+a===l?d:t:n===l||n===i+l?d:t}}else return t}}function my(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var _y=gy;function yy(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}var p0=yy;const f0=ks,Ur=ty,wy=uy,vy=_y,by=p0;let $y=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=xy,this.parseXml=zy,this.parseTextData=ky,this.resolveNameSpace=Sy,this.buildAttributesMap=Ey,this.isItStopNode=jy,this.replaceEntitiesValue=Ny,this.readStopNodeData=Py,this.saveTextToParentTag=Cy,this.addChild=Iy,this.ignoreAttributesFn=by(this.options.ignoreAttributes)}};function xy(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function ky(t,e,n,r,i,o,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const c=this.options.tagValueProcessor(e,t,n,i,o);return c==null?t:typeof c!=typeof t||c!==t?c:this.options.trimValues?ic(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?ic(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Sy(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const Ay=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Ey(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=f0.getAllMatches(t,Ay),i=r.length,o={};for(let a=0;a<i;a++){const c=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(c,e))continue;let d=r[a][4],l=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),d!==void 0){this.options.trimValues&&(d=d.trim()),d=this.replaceEntitiesValue(d);const u=this.options.attributeValueProcessor(c,d,e);u==null?o[l]=d:typeof u!=typeof d||u!==d?o[l]=u:o[l]=ic(d,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[l]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=o,a}return o}}const zy=function(t){t=t.replace(/\r\n?/g,`
|
|
8
|
+
`);const e=new Ur("!xml");let n=e,r="",i="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){const c=kn(t,">",o,"Closing Tag is not closed.");let d=t.substring(o+2,c).trim();if(this.options.removeNSPrefix){const f=d.indexOf(":");f!==-1&&(d=d.substr(f+1))}this.options.transformTagName&&(d=this.options.transformTagName(d)),n&&(r=this.saveTextToParentTag(r,n,i));const l=i.substring(i.lastIndexOf(".")+1);if(d&&this.options.unpairedTags.indexOf(d)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${d}>`);let u=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(u=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=i.lastIndexOf("."),i=i.substring(0,u),n=this.tagsNodeStack.pop(),r="",o=c}else if(t[o+1]==="?"){let c=rc(t,o,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const d=new Ur(c.tagName);d.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(d[":@"]=this.buildAttributesMap(c.tagExp,i,c.tagName)),this.addChild(n,d,i)}o=c.closeIndex+1}else if(t.substr(o+1,3)==="!--"){const c=kn(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const d=t.substring(o+4,c-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:d}])}o=c}else if(t.substr(o+1,2)==="!D"){const c=wy(t,o);this.docTypeEntities=c.entities,o=c.i}else if(t.substr(o+1,2)==="!["){const c=kn(t,"]]>",o,"CDATA is not closed.")-2,d=t.substring(o+9,c);r=this.saveTextToParentTag(r,n,i);let l=this.parseTextData(d,n.tagname,i,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:d}]):n.add(this.options.textNodeName,l),o=c+2}else{let c=rc(t,o,this.options.removeNSPrefix),d=c.tagName;const l=c.rawTagName;let u=c.tagExp,f=c.attrExpPresent,m=c.closeIndex;this.options.transformTagName&&(d=this.options.transformTagName(d)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const w=n;if(w&&this.options.unpairedTags.indexOf(w.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),d!==e.tagname&&(i+=i?"."+d:d),this.isItStopNode(this.options.stopNodes,i,d)){let h="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)d[d.length-1]==="/"?(d=d.substr(0,d.length-1),i=i.substr(0,i.length-1),u=d):u=u.substr(0,u.length-1),o=c.closeIndex;else if(this.options.unpairedTags.indexOf(d)!==-1)o=c.closeIndex;else{const v=this.readStopNodeData(t,l,m+1);if(!v)throw new Error(`Unexpected end of ${l}`);o=v.i,h=v.tagContent}const y=new Ur(d);d!==u&&f&&(y[":@"]=this.buildAttributesMap(u,i,d)),h&&(h=this.parseTextData(h,d,i,!0,f,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),y.add(this.options.textNodeName,h),this.addChild(n,y,i)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){d[d.length-1]==="/"?(d=d.substr(0,d.length-1),i=i.substr(0,i.length-1),u=d):u=u.substr(0,u.length-1),this.options.transformTagName&&(d=this.options.transformTagName(d));const h=new Ur(d);d!==u&&f&&(h[":@"]=this.buildAttributesMap(u,i,d)),this.addChild(n,h,i),i=i.substr(0,i.lastIndexOf("."))}else{const h=new Ur(d);this.tagsNodeStack.push(n),d!==u&&f&&(h[":@"]=this.buildAttributesMap(u,i,d)),this.addChild(n,h,i),n=h}r="",o=m}}else r+=t[o];return e.child};function Iy(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const Ny=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function Cy(t,e,n,r){return t&&(r===void 0&&(r=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function jy(t,e,n){const r="*."+n;for(const i in t){const o=t[i];if(r===o||e===o)return!0}return!1}function Oy(t,e,n=">"){let r,i="";for(let o=e;o<t.length;o++){let a=t[o];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(t[o+1]===n[1])return{data:i,index:o}}else return{data:i,index:o};else a===" "&&(a=" ");i+=a}}function kn(t,e,n,r){const i=t.indexOf(e,n);if(i===-1)throw new Error(r);return i+e.length-1}function rc(t,e,n,r=">"){const i=Oy(t,e+1,r);if(!i)return;let o=i.data;const a=i.index,c=o.search(/\s/);let d=o,l=!0;c!==-1&&(d=o.substring(0,c),o=o.substring(c+1).trimStart());const u=d;if(n){const f=d.indexOf(":");f!==-1&&(d=d.substr(f+1),l=d!==i.data.substr(f+1))}return{tagName:d,tagExp:o,closeIndex:a,attrExpPresent:l,rawTagName:u}}function Py(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const o=kn(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:o};n=o}else if(t[n+1]==="?")n=kn(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=kn(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=kn(t,"]]>",n,"StopNode is not closed.")-2;else{const o=rc(t,n,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&i++,n=o.closeIndex)}}function ic(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:vy(t,n)}else return f0.isExist(t)?t:""}var Ty=$y,h0={};function Ry(t,e){return g0(t,e)}function g0(t,e,n){let r;const i={};for(let o=0;o<t.length;o++){const a=t[o],c=By(a);let d="";if(n===void 0?d=c:d=n+"."+c,c===e.textNodeName)r===void 0?r=a[c]:r+=""+a[c];else{if(c===void 0)continue;if(a[c]){let l=g0(a[c],e,d);const u=Uy(l,e);a[":@"]?Ly(l,a[":@"],d,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),i[c]!==void 0&&i.hasOwnProperty(c)?(Array.isArray(i[c])||(i[c]=[i[c]]),i[c].push(l)):e.isArray(c,d,u)?i[c]=[l]:i[c]=l}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function By(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Ly(t,e,n,r){if(e){const i=Object.keys(e),o=i.length;for(let a=0;a<o;a++){const c=i[a];r.isArray(c,n+"."+c,!0,!0)?t[c]=[e[c]]:t[c]=e[c]}}}function Uy(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}h0.prettify=Ry;const{buildOptions:My}=Jd,Fy=Ty,{prettify:Dy}=h0,Vy=Gd;let qy=class{constructor(e){this.externalEntities={},this.options=My(e)}parse(e,n){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=Vy.validate(e,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const r=new Fy(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Dy(i,this.options)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}};var Hy=qy;const Ky=`
|
|
9
9
|
`;function Gy(t,e){let n="";return e.format&&e.indentBy.length>0&&(n=Ky),m0(t,e,"",n)}function m0(t,e,n,r){let i="",o=!1;for(let a=0;a<t.length;a++){const c=t[a],d=Wy(c);if(d===void 0)continue;let l="";if(n.length===0?l=d:l=`${n}.${d}`,d===e.textNodeName){let h=c[d];Jy(l,e)||(h=e.tagValueProcessor(d,h),h=_0(h,e)),o&&(i+=r),i+=h,o=!1;continue}else if(d===e.cdataPropName){o&&(i+=r),i+=`<![CDATA[${c[d][0][e.textNodeName]}]]>`,o=!1;continue}else if(d===e.commentPropName){i+=r+`<!--${c[d][0][e.textNodeName]}-->`,o=!0;continue}else if(d[0]==="?"){const h=Bu(c[":@"],e),y=d==="?xml"?"":r;let v=c[d][0][e.textNodeName];v=v.length!==0?" "+v:"",i+=y+`<${d}${v}${h}?>`,o=!0;continue}let u=r;u!==""&&(u+=e.indentBy);const f=Bu(c[":@"],e),m=r+`<${d}${f}`,w=m0(c[d],e,l,u);e.unpairedTags.indexOf(d)!==-1?e.suppressUnpairedNode?i+=m+">":i+=m+"/>":(!w||w.length===0)&&e.suppressEmptyNode?i+=m+"/>":w&&w.endsWith(">")?i+=m+`>${w}${r}</${d}>`:(i+=m+">",w&&r!==""&&(w.includes("/>")||w.includes("</"))?i+=r+e.indentBy+w+r:i+=w,i+=`</${d}>`),o=!0}return i}function Wy(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&r!==":@")return r}}function Bu(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=_0(i,e),i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function Jy(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let n=t.substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function _0(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}var Xy=Gy;const Zy=Xy,Yy=p0,Qy={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function hn(t){this.options=Object.assign({},Qy,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Yy(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=n2),this.processTextOrObjNode=e2,this.options.format?(this.indentate=t2,this.tagEndChar=`>
|
|
10
10
|
`,this.newLine=`
|
|
11
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}hn.prototype.build=function(t){return this.options.preserveOrder?Zy(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};hn.prototype.j2x=function(t,e,n){let r="",i="";const o=n.join(".");for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(typeof t[a]>"u")this.isAttribute(a)&&(i+="");else if(t[a]===null)this.isAttribute(a)?i+="":a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)i+=this.buildTextValNode(t[a],a,"",e);else if(typeof t[a]!="object"){const c=this.isAttribute(a);if(c&&!this.ignoreAttributesFn(c,o))r+=this.buildAttrPairStr(c,""+t[a]);else if(!c)if(a===this.options.textNodeName){let d=this.options.tagValueProcessor(a,""+t[a]);i+=this.replaceEntitiesValue(d)}else i+=this.buildTextValNode(t[a],a,"",e)}else if(Array.isArray(t[a])){const c=t[a].length;let d="",l="";for(let u=0;u<c;u++){const f=t[a][u];if(!(typeof f>"u"))if(f===null)a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const m=this.j2x(f,e+1,n.concat(a));d+=m.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(l+=m.attrStr)}else d+=this.processTextOrObjNode(f,a,e,n);else if(this.options.oneListGroup){let m=this.options.tagValueProcessor(a,f);m=this.replaceEntitiesValue(m),d+=m}else d+=this.buildTextValNode(f,a,"",e)}this.options.oneListGroup&&(d=this.buildObjectNode(d,a,l,e)),i+=d}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const c=Object.keys(t[a]),d=c.length;for(let l=0;l<d;l++)r+=this.buildAttrPairStr(c[l],""+t[a][c[l]])}else i+=this.processTextOrObjNode(t[a],a,e,n);return{attrStr:r,val:i}};hn.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function e2(t,e,n,r){const i=this.j2x(t,n+1,r.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,n):this.buildObjectNode(i.val,e,i.attrStr,n)}hn.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+o+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+o+this.tagEndChar+t+this.indentate(r)+i}};hn.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};hn.prototype.buildTextValNode=function(t,e,n,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}};hn.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function t2(t){return this.options.indentBy.repeat(t)}function n2(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var r2=hn;const i2=
|
|
11
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}hn.prototype.build=function(t){return this.options.preserveOrder?Zy(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};hn.prototype.j2x=function(t,e,n){let r="",i="";const o=n.join(".");for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(typeof t[a]>"u")this.isAttribute(a)&&(i+="");else if(t[a]===null)this.isAttribute(a)?i+="":a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)i+=this.buildTextValNode(t[a],a,"",e);else if(typeof t[a]!="object"){const c=this.isAttribute(a);if(c&&!this.ignoreAttributesFn(c,o))r+=this.buildAttrPairStr(c,""+t[a]);else if(!c)if(a===this.options.textNodeName){let d=this.options.tagValueProcessor(a,""+t[a]);i+=this.replaceEntitiesValue(d)}else i+=this.buildTextValNode(t[a],a,"",e)}else if(Array.isArray(t[a])){const c=t[a].length;let d="",l="";for(let u=0;u<c;u++){const f=t[a][u];if(!(typeof f>"u"))if(f===null)a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const m=this.j2x(f,e+1,n.concat(a));d+=m.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(l+=m.attrStr)}else d+=this.processTextOrObjNode(f,a,e,n);else if(this.options.oneListGroup){let m=this.options.tagValueProcessor(a,f);m=this.replaceEntitiesValue(m),d+=m}else d+=this.buildTextValNode(f,a,"",e)}this.options.oneListGroup&&(d=this.buildObjectNode(d,a,l,e)),i+=d}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const c=Object.keys(t[a]),d=c.length;for(let l=0;l<d;l++)r+=this.buildAttrPairStr(c[l],""+t[a][c[l]])}else i+=this.processTextOrObjNode(t[a],a,e,n);return{attrStr:r,val:i}};hn.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function e2(t,e,n,r){const i=this.j2x(t,n+1,r.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,n):this.buildObjectNode(i.val,e,i.attrStr,n)}hn.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+o+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+o+this.tagEndChar+t+this.indentate(r)+i}};hn.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};hn.prototype.buildTextValNode=function(t,e,n,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}};hn.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function t2(t){return this.options.indentBy.repeat(t)}function n2(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var r2=hn;const i2=Gd,o2=Hy,s2=r2;var a2={XMLParser:o2,XMLValidator:i2,XMLBuilder:s2};function c2(t,e,n){const r=n?`<input type="hidden" name="RelayState" value="${n}" />`:"",i=`
|
|
12
12
|
<!DOCTYPE html>
|
|
13
13
|
<html>
|
|
14
14
|
<body onload="document.forms[0].submit()">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}};
|
|
27
27
|
<\/script>
|
|
28
28
|
</body>
|
|
29
|
-
</html>`;return new Response(i,{headers:{"Content-Type":"text/html"}})}async function d2(t,e,n,r,i){var m,w,h;if(!n.redirect_uri)throw new A(400,{message:"Missing redirect_uri in authParams"});if(!r.email)throw new A(400,{message:"Missing email in user"});const[o]=await t.env.data.keys.list();if(!o)throw new A(500,{message:"No signing key found"});if(!((m=e.addons)!=null&&m.samlp))throw new A(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:a,audience:c}=e.addons.samlp,d=n.state||"";if(!a||!d||!r||!n.state)throw new A(400,{message:"Missing recipient or inResponseTo"});const l=JSON.parse(n.state),u=new URL(n.redirect_uri),f=await l2(t,{issuer:t.env.ISSUER,audience:c||n.client_id,destination:u.toString(),inResponseTo:l.requestId,userId:((h=(w=r.app_metadata)==null?void 0:w.vimeo)==null?void 0:h.user_id)||r.user_id,email:r.email,sessionIndex:i,signature:{privateKeyPem:o.pkcs7,cert:o.cert,kid:o.kid}});return c2(u.toString(),f,l.relayState)}async function l2(t,e){const n=e.notBefore||new Date().toISOString(),r=e.notAfter||new Date(new Date(n).getTime()+10*60*1e3).toISOString(),i=e.issueInstant||n,o=e.sessionNotOnOrAfter||r,a=e.responseId||`_${xe()}`,c=e.assertionId||`_${xe()}`,d=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":o}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":i,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":a,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":i,"@_Version":"2.0"}}];let u=new a2.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(d);if(e.signature){const m=await fetch(t.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:u,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!m.ok)throw new Error(`Failed to sign SAML response: ${m.status}`);u=await m.text()}return e.encode===!1?u:btoa(u)}var u2={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},p2=()=>{var n,r;const t=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[i,o]of Object.entries(u2))if(f2(o))return i}return typeof(t==null?void 0:t.EdgeRuntime)=="string"?"edge-light":(t==null?void 0:t.fastly)!==void 0?"fastly":((r=(n=t==null?void 0:t.process)==null?void 0:n.release)==null?void 0:r.name)==="node"?"node":"other"},f2=t=>navigator.userAgent.startsWith(t);function It(t,e){p2()==="workerd"&&t.executionCtx.waitUntil(e)}function jt(t){var e,n,r,i;return{auth0Client:(e=t.query("auth0Client"))==null?void 0:e.slice(0,255),ip:(n=t.header("x-real-ip"))==null?void 0:n.slice(0,45),useragent:(r=t.header("user-agent"))==null?void 0:r.slice(0,512),countryCode:(i=t.header("cf-ipcountry"))==null?void 0:i.slice(0,2)}}const Lu=["sub","iss","aud","exp","nbf","iat","jti"];async function As(t,e){var v,b;const{authParams:n,user:r,client:i,session_id:o}=e,c=(await t.env.data.keys.list()).filter(E=>!E.revoked_at||new Date(E.revoked_at)>new Date),d=c[c.length-1];if(!(d!=null&&d.pkcs7))throw new A(500,{message:"No signing key available"});const l=O_(d.pkcs7),u=t.var.custom_domain?`https://${t.var.custom_domain}/`:t.env.ISSUER,f={aud:n.audience||"default",scope:n.scope||"",sub:(r==null?void 0:r.user_id)||n.client_id,iss:u,tenant_id:t.var.tenant_id,sid:o},m=r&&((v=n.scope)!=null&&v.split(" ").includes("openid"))?{aud:n.client_id,sub:r.user_id,iss:u,sid:o,nonce:n.nonce,given_name:r.given_name,family_name:r.family_name,nickname:r.nickname,picture:r.picture,locale:r.locale,name:r.name,email:r.email,email_verified:r.email_verified}:void 0;(b=t.env.hooks)!=null&&b.onExecuteCredentialsExchange&&await t.env.hooks.onExecuteCredentialsExchange({ctx:t,client:i,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:n.scope||"",grant_type:""},{accessToken:{setCustomClaim:(E,C)=>{if(Lu.includes(E))throw new Error(`Cannot overwrite reserved claim '${E}'`);f[E]=C}},idToken:{setCustomClaim:(E,C)=>{if(Lu.includes(E))throw new Error(`Cannot overwrite reserved claim '${E}'`);m&&(m[E]=C)}},access:{deny:E=>{throw new A(400,{message:`Access denied: ${E}`})}}});const w={includeIssuedTimestamp:!0,expiresIn:new Hd(1,"d"),headers:{kid:d.kid}},h=await ju("RS256",l,f,w),y=m?await ju("RS256",l,m,w):void 0;return{access_token:h,refresh_token:e.refresh_token,id_token:y,token_type:"Bearer",expires_in:86400}}async function y0(t,e){return{code:(await t.env.data.codes.create(e.client.tenant.id,{code_id:xe(),user_id:e.user.user_id,code_type:"authorization_code",login_id:e.login_id,expires_at:new Date(Date.now()+B_*1e3).toISOString(),code_challenge:e.authParams.code_challenge,code_challenge_method:e.authParams.code_challenge_method,redirect_uri:e.authParams.redirect_uri,state:e.authParams.state,nonce:e.authParams.nonce})).code_id,state:e.authParams.state}}async function h2(t,e){const{client:n,scope:r,audience:i=n.tenant.audience,session_id:o}=e,a=jt(t.req);return await t.env.data.refreshTokens.create(n.tenant.id,{id:xe(),session_id:o,client_id:n.id,idle_expires_at:new Date(Date.now()+ks*1e3).toISOString(),user_id:e.user.user_id,device:{last_ip:a.ip||"",initial_ip:a.ip||"",last_user_agent:a.useragent||"",initial_user_agent:a.useragent||"",initial_asn:"",last_asn:""},resource_servers:[{audience:i,scopes:r}],rotating:!1})}async function w0(t,{user:e,client:n,loginSession:r}){const i=await t.env.data.sessions.create(n.tenant.id,{id:xe(),user_id:e.user_id,login_session_id:r.id,idle_expires_at:new Date(Date.now()+ks*1e3).toISOString(),device:{last_ip:t.req.header("x-real-ip")||"",initial_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||"",initial_user_agent:t.req.header("user-agent")||"",initial_asn:"",last_asn:""},clients:[n.id]});return await t.env.data.loginSessions.update(n.tenant.id,r.id,{session_id:i.id}),i}async function Zt(t,e){var h,y;const{authParams:n,user:r,client:i,ticketAuth:o}=e,a=we(t,{type:he.SUCCESS_LOGIN,description:`Successful login for ${r.user_id}`,userId:r.user_id});if(It(t,t.env.data.logs.create(i.tenant.id,a)),It(t,t.env.data.users.update(i.tenant.id,r.user_id,{last_login:new Date().toISOString(),last_ip:t.req.header("x-real-ip")||"",login_count:r.login_count+1})),o){if(!e.loginSession)throw new A(500,{message:"Login session not found for ticket auth."});const v=j_(),b=xe(12),E=await t.env.data.codes.create(i.tenant.id,{code_id:xe(),code_type:"ticket",login_id:e.loginSession.id,expires_at:new Date(Date.now()+U_).toISOString(),code_verifier:[b,v].join("|"),redirect_uri:n.redirect_uri,state:n.state,nonce:n.nonce});return t.json({login_ticket:E.code_id,co_verifier:v,co_id:b})}let c=e.refreshToken,d=e.sessionId,l=r;if(!d&&((h=e.loginSession)!=null&&h.session_id)){d=e.loginSession.session_id;const v=await t.env.data.sessions.get(i.tenant.id,d);v&&!v.clients.includes(i.id)&&await t.env.data.sessions.update(i.tenant.id,d,{clients:[...v.clients,i.id]}),!c&&((y=n.scope)!=null&&y.split(" ").includes("offline_access"))&&(c=(await h2(t,{user:l,client:i,session_id:d,scope:n.scope,audience:n.audience})).id)}else if(!d){if(!e.loginSession)throw new A(500,{message:"Login session not found for creating a new session."});d=(await w0(t,{user:l,client:i,loginSession:e.loginSession})).id;const b=await b2(t,t.env.data,i.tenant.id,r,e.loginSession,{client:i,authParams:n});if(b instanceof Response)return b;l=b}if(e.authParams.response_mode===Dt.SAML_POST){if(!d)throw new A(500,{message:"Session ID not available for SAML response"});return d2(t,e.client,e.authParams,l,d)}const u=await As(t,{authParams:n,user:l,client:i,session_id:d,refresh_token:c});if(n.response_mode===Dt.WEB_MESSAGE){if(d){const v=rc(i.tenant.id,d,t.var.custom_domain||t.req.header("host")||"");v&&t.header("set-cookie",v)}else console.warn("Session ID not available for WEB_MESSAGE, cookie will not be set.");return u}const f=new Headers;if(d){const v=rc(i.tenant.id,d,t.var.custom_domain||t.req.header("host")||"");v&&f.set("set-cookie",v)}const m=n.response_type||it.CODE;if(m===it.CODE){if(!e.loginSession)throw new A(500,{message:"Login session not found for code response type."});const v=await y0(t,{user:l,client:i,authParams:n,login_id:e.loginSession.id});if(!n.redirect_uri)throw new A(400,{message:"Redirect uri not found for code response type."});const b=new URL(n.redirect_uri);return b.searchParams.set("code",v.code),v.state&&b.searchParams.set("state",v.state),f.set("location",b.toString()),new Response("Redirecting",{status:302,headers:f})}if(!n.redirect_uri)throw new A(400,{message:"Redirect uri not found for this response mode."});const w=new URL(n.redirect_uri);if(m===it.TOKEN||m===it.TOKEN_ID_TOKEN)w.hash=new URLSearchParams({access_token:u.access_token,...u.id_token&&{id_token:u.id_token},token_type:u.token_type,expires_in:u.expires_in.toString(),...n.state&&{state:n.state},...n.scope&&{scope:n.scope}}).toString();else throw new A(500,{message:`Unsupported response type ('${m}') for redirect with tokens.`});return f.set("location",w.toString()),new Response("Redirecting",{status:302,headers:f})}async function g2(t,e,n){const r=await t.env.data.tenants.get(e);if(!r)throw new Error(`Tenant not found: ${e}`);return As(t,{client:{id:t.env.ISSUER,tenant:r,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),name:t.env.ISSUER,disable_sign_ups:!1,connections:[]},authParams:{client_id:t.env.ISSUER,response_type:it.TOKEN,scope:n}})}async function v0(t,e,n){const r=await g2(t,n.tenant_id,"webhook");for await(const i of e.filter(o=>"url"in o))if(!(await fetch(i.url,{method:"POST",headers:{Authorization:`Bearer ${r.access_token}`,"Content-Type":"application/json"},body:JSON.stringify(n)})).ok){const a=we(t,{type:he.FAILED_HOOK,description:`Failed to invoke hook ${i.hook_id}`});await t.env.data.logs.create(n.tenant_id,a)}}function m2(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e);return await v0(t,r,{tenant_id:e,user:n,trigger_id:"post-user-registration"}),n}}function _2(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await v0(t,r,{tenant_id:e,email:n,trigger_id:"pre-user-signup"})}}function Uu(t){return typeof t.form_id=="string"}async function y2(t,e,n){var d;const r=t.env.data,i=t.var.tenant_id||t.req.header("tenant-id");if(!i)throw new A(400,{message:"Missing tenant_id in context"});const o=await r.forms.get(i,e);if(!o)throw new A(404,{message:"Form not found for post-user-login hook"});let a=(d=o.start)==null?void 0:d.next_node;if(!a&&o.nodes&&o.nodes.length>0){const l=o.nodes.find(u=>u.type==="STEP");a=l==null?void 0:l.id}if(!a)throw new A(400,{message:"No start node found in form"});let c=`/u/forms/${o.id}/nodes/${a}?state=${encodeURIComponent(n.id)}`;return new Response(null,{status:302,headers:{location:c}})}function Mu(t){return typeof t.url=="string"}function w2(t,e){return async(n,r)=>{var a,c,d;const i={method:t.req.method,ip:t.req.query("x-real-ip")||"",user_agent:t.req.query("user-agent"),url:((a=t.var.loginSession)==null?void 0:a.authorization_url)||t.req.url};if((c=t.env.hooks)!=null&&c.onExecutePreUserRegistration)try{await t.env.hooks.onExecutePreUserRegistration({ctx:t,user:r,request:i},{user:{setUserMetadata:async(l,u)=>{r[l]=u}}})}catch{const u=we(t,{type:he.FAILED_SIGNUP,description:"Pre user registration hook failed"});await e.logs.create(n,u)}let o=await S_(e)(n,r);if((d=t.env.hooks)!=null&&d.onExecutePostUserRegistration)try{await t.env.hooks.onExecutePostUserRegistration({ctx:t,user:r,request:i},{user:{}})}catch{const u=we(t,{type:he.FAILED_SIGNUP,description:"Post user registration hook failed"});await t.env.data.logs.create(n,u)}return await m2(t)(n,o),o}}async function v2(t,e,n,r){var i;if(e.disable_sign_ups){const o=(i=t.var.loginSession)==null?void 0:i.authorization_url;if(!(o&&new URL(o).searchParams.get("screen_hint")==="signup")&&!await zs({userAdapter:n.users,tenant_id:e.tenant.id,email:r})){const d=we(t,{type:he.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.logs.create(e.tenant.id,d),new A(400,{message:"Signups are disabled for this client"})}}await _2(t)(t.var.tenant_id||"",r)}function Es(t,e){return{...e,users:{...e.users,create:w2(t,e)}}}async function b2(t,e,n,r,i,o){var d;(d=t.env.hooks)!=null&&d.onExecutePostLogin&&(o!=null&&o.client)&&(o!=null&&o.authParams)&&await t.env.hooks.onExecutePostLogin({ctx:t,client:o.client,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:o.authParams.scope||"",grant_type:""},{prompt:{render:l=>{}}});const{hooks:a}=await e.hooks.list(n,{q:"trigger_id:post-user-login",page:0,per_page:100,include_totals:!1});if(i){const l=a.find(u=>u.enabled&&Uu(u));if(l&&Uu(l))return y2(t,l.form_id,i)}const c=a.filter(l=>l.enabled&&Mu(l));for(const l of c)if(Mu(l))try{await fetch(l.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_id:n,user:r,trigger_id:"post-user-login"})})}catch{const f=we(t,{type:he.FAILED_HOOK,description:`Failed to invoke post-user-login webhook: ${l.url}`});await e.logs.create(n,f)}return r}function b0(t){return Es(t,t.env.data)}async function Zd(t,e,n){return(await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`})).users}async function kr({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=r==="sms"?`phone_number:${n}`:`email:${n}`,{users:o}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`${i} provider:${r}`});return o.length>1&&console.error("More than one user found for same email and provider"),o[0]||null}async function zs({userAdapter:t,tenant_id:e,email:n}){var c;const{users:r}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`}),i=r.filter(d=>!(d.provider==="auth2"&&!d.email_verified));if(i.length===0)return;const o=i.filter(d=>!d.linked_to);if(o.length>0)return o.length>1&&console.error("More than one primary user found for same email"),o[0];const a=await t.get(e,(c=i[0])==null?void 0:c.linked_to);if(!a)throw new Error("Primary account not found");return a}async function Io({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=await kr({userAdapter:t,tenant_id:e,username:n,provider:r});return i?i.linked_to?t.get(e,i.linked_to):i:null}async function Is(t,e){const{username:n,provider:r,connection:i,client:o,userId:a,isSocial:c,profileData:d={},ip:l=""}=e;let u=await Io({userAdapter:t.env.data.users,tenant_id:e.client.tenant.id,username:n,provider:r});if(!u){const f={user_id:`${r}|${a||xs()}`,email:i!=="sms"?n:void 0,phone_number:i==="sms"?n:void 0,name:n,provider:r,connection:i,email_verified:!0,last_ip:l,is_social:c,last_login:new Date().toISOString(),profileData:JSON.stringify(d)};u=await b0(t).users.create(o.tenant.id,f),t.set("user_id",u.user_id)}return u}const Vt=s.z.object({page:s.z.string().min(0).optional().default("0").transform(t=>parseInt(t,10)).openapi({description:"The page number where 0 is the first page"}),per_page:s.z.string().min(1).optional().default("10").transform(t=>parseInt(t,10)).openapi({description:"The number of items per page"}),include_totals:s.z.string().optional().default("false").transform(t=>t==="true").openapi({description:"If the total number of items should be included in the response"}),sort:s.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:s.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function Vn(t){if(!t)return;const[e,n]=t.split(":"),r=n==="1"?"asc":"desc";if(!(!e||!r))return{sort_by:e,sort_order:r}}const Fu=Xt.extend({users:s.z.array(Et)}),$2=Xt.extend({sessions:s.z.array($s)}),x2=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Et),Fu])}},description:"List of users"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header");if(o!=null&&o.includes("identities.profileData.email")){const u=o.split("=")[1],m=(await t.env.data.users.list(a,{page:e,per_page:n,include_totals:r,q:`email:${u}`})).users.filter(y=>y.linked_to),[w]=m;if(!w)return t.json([]);const h=await t.env.data.users.get(a,w.linked_to);if(!h)throw new A(500,{message:"Primary account not found"});return t.json([Et.parse(h)])}const c=["-_exists_:linked_to"];o&&c.push(o);const d=await t.env.data.users.list(a,{page:e,per_page:n,include_totals:r,sort:Vn(i),q:c.join(" ")}),l=d.users.filter(u=>!u.linked_to);return r?t.json(Fu.parse({users:l,length:d.length,start:d.start,limit:d.limit})):t.json(s.z.array(Et).parse(l))}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Et}},description:"List of users"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.users.get(n,e);if(!r)throw new A(404);if(r.linked_to)throw new A(404,{message:"User is linked to another user"});return t.json(r)}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.users.remove(n,e))throw new A(404);return t.text("OK")}).openapi(s.createRoute({tags:["users"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...bo.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Et}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");t.set("body",n);const{email:r,phone_number:i,name:o,linked_to:a,email_verified:c,provider:d,connection:l}=n,u=`${n.provider}|${n.user_id||xs()}`;try{const f=await t.env.data.users.create(e,{email:r,user_id:u,name:o||r||i,phone_number:i,provider:d,connection:l,linked_to:a??void 0,email_verified:c||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});t.set("user_id",f.user_id);const m=we(t,{type:he.SUCCESS_API_OPERATION,description:"User created"});It(t,t.env.data.logs.create(e,m));const w={...f,identities:[{connection:f.connection,provider:f.provider,user_id:Nu(f.user_id),isSocial:f.is_social}]};return t.json(Et.parse(w),{status:201})}catch(f){throw f.message==="User already exists"?new A(409,{message:"User already exists"}):f}}).openapi(s.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...bo.shape,verify_email:s.z.boolean(),password:s.z.string()}).partial()}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{var u;const{data:e}=t.env,{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json"),{user_id:i}=t.req.valid("param"),{verify_email:o,password:a,...c}=r,d=await e.users.get(n,i);if(!d)throw new A(404);if(c.email&&c.email!==d.email){const f=await Zd(t.env.data.users,n,c.email);if(f.length&&f.some(m=>m.user_id!==i))throw new A(409,{message:"Another user with the same email address already exists."})}if(d.linked_to)throw new A(404,{message:"User is linked to another user"});if(await t.env.data.users.update(n,i,c),a){const f=(u=d.identities)==null?void 0:u.find(h=>h.connection==="Username-Password-Authentication");if(!f)throw new A(400,{message:"User does not have a password identity"});const m={user_id:f.user_id,password:await vi.hash(a,10),algorithm:"bcrypt"};await e.passwords.get(n,f.user_id)?await e.passwords.update(n,m):await e.passwords.create(n,m)}const l=await t.env.data.users.get(n,i);if(!l)throw new A(500);return t.json(l)}).openapi(s.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.union([s.z.object({link_with:s.z.string()}),s.z.object({user_id:s.z.string(),provider:s.z.string(),connection:s.z.string().optional()})])}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.array(s.z.object({connection:s.z.string(),provider:s.z.string(),user_id:s.z.string(),isSocial:s.z.boolean()}))}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),{user_id:r}=t.req.valid("param"),i="link_with"in n?n.link_with:n.user_id,o=await t.env.data.users.get(e,r);if(!o)throw new A(400,{message:"Linking an inexistent identity is not allowed."});await t.env.data.users.update(e,i,{linked_to:r});const a=await t.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${r}`}),c=[o,...a.users].map(d=>({connection:d.connection,provider:d.provider,user_id:Nu(d.user_id),isSocial:d.is_social}));return t.json(c,{status:201})}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string(),provider:s.z.string(),linked_user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:s.z.array(Et)}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{user_id:n,provider:r,linked_user_id:i}=t.req.valid("param");await t.env.data.users.unlink(e,n,r,i);const o=await t.env.data.users.get(e,n);if(!o)throw new A(404);return t.json([Et.parse(o)])}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array($s),$2])}},description:"List of sessions"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{include_totals:n,page:r,per_page:i}=t.req.valid("query"),{"tenant-id":o}=t.req.valid("header"),a=await t.env.data.sessions.list(o,{page:r,per_page:i,include_totals:n,q:`user_id:${e}`});return n?t.json(a):t.json(a.sessions)});/*! *****************************************************************************
|
|
29
|
+
</html>`;return new Response(i,{headers:{"Content-Type":"text/html"}})}async function d2(t,e,n,r,i){var m,w,h;if(!n.redirect_uri)throw new A(400,{message:"Missing redirect_uri in authParams"});if(!r.email)throw new A(400,{message:"Missing email in user"});const[o]=await t.env.data.keys.list();if(!o)throw new A(500,{message:"No signing key found"});if(!((m=e.addons)!=null&&m.samlp))throw new A(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:a,audience:c}=e.addons.samlp,d=n.state||"";if(!a||!d||!r||!n.state)throw new A(400,{message:"Missing recipient or inResponseTo"});const l=JSON.parse(n.state),u=new URL(n.redirect_uri),f=await l2(t,{issuer:t.env.ISSUER,audience:c||n.client_id,destination:u.toString(),inResponseTo:l.requestId,userId:((h=(w=r.app_metadata)==null?void 0:w.vimeo)==null?void 0:h.user_id)||r.user_id,email:r.email,sessionIndex:i,signature:{privateKeyPem:o.pkcs7,cert:o.cert,kid:o.kid}});return c2(u.toString(),f,l.relayState)}async function l2(t,e){const n=e.notBefore||new Date().toISOString(),r=e.notAfter||new Date(new Date(n).getTime()+10*60*1e3).toISOString(),i=e.issueInstant||n,o=e.sessionNotOnOrAfter||r,a=e.responseId||`_${xe()}`,c=e.assertionId||`_${xe()}`,d=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":o}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":i,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":a,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":i,"@_Version":"2.0"}}];let u=new a2.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(d);if(e.signature){const m=await fetch(t.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:u,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!m.ok)throw new Error(`Failed to sign SAML response: ${m.status}`);u=await m.text()}return e.encode===!1?u:btoa(u)}var u2={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},p2=()=>{var n,r;const t=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[i,o]of Object.entries(u2))if(f2(o))return i}return typeof(t==null?void 0:t.EdgeRuntime)=="string"?"edge-light":(t==null?void 0:t.fastly)!==void 0?"fastly":((r=(n=t==null?void 0:t.process)==null?void 0:n.release)==null?void 0:r.name)==="node"?"node":"other"},f2=t=>navigator.userAgent.startsWith(t);function It(t,e){p2()==="workerd"&&t.executionCtx.waitUntil(e)}function jt(t){var e,n,r,i;return{auth0Client:(e=t.query("auth0Client"))==null?void 0:e.slice(0,255),ip:(n=t.header("x-real-ip"))==null?void 0:n.slice(0,45),useragent:(r=t.header("user-agent"))==null?void 0:r.slice(0,512),countryCode:(i=t.header("cf-ipcountry"))==null?void 0:i.slice(0,2)}}const Lu=["sub","iss","aud","exp","nbf","iat","jti"];async function Ss(t,e){var v,b;const{authParams:n,user:r,client:i,session_id:o}=e,c=(await t.env.data.keys.list()).filter(E=>!E.revoked_at||new Date(E.revoked_at)>new Date),d=c[c.length-1];if(!(d!=null&&d.pkcs7))throw new A(500,{message:"No signing key available"});const l=O_(d.pkcs7),u=t.var.custom_domain?`https://${t.var.custom_domain}/`:t.env.ISSUER,f={aud:n.audience||"default",scope:n.scope||"",sub:(r==null?void 0:r.user_id)||n.client_id,iss:u,tenant_id:t.var.tenant_id,sid:o},m=r&&((v=n.scope)!=null&&v.split(" ").includes("openid"))?{aud:n.client_id,sub:r.user_id,iss:u,sid:o,nonce:n.nonce,given_name:r.given_name,family_name:r.family_name,nickname:r.nickname,picture:r.picture,locale:r.locale,name:r.name,email:r.email,email_verified:r.email_verified}:void 0;(b=t.env.hooks)!=null&&b.onExecuteCredentialsExchange&&await t.env.hooks.onExecuteCredentialsExchange({ctx:t,client:i,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:n.scope||"",grant_type:""},{accessToken:{setCustomClaim:(E,C)=>{if(Lu.includes(E))throw new Error(`Cannot overwrite reserved claim '${E}'`);f[E]=C}},idToken:{setCustomClaim:(E,C)=>{if(Lu.includes(E))throw new Error(`Cannot overwrite reserved claim '${E}'`);m&&(m[E]=C)}},access:{deny:E=>{throw new A(400,{message:`Access denied: ${E}`})}}});const w={includeIssuedTimestamp:!0,expiresIn:new qd(1,"d"),headers:{kid:d.kid}},h=await ju("RS256",l,f,w),y=m?await ju("RS256",l,m,w):void 0;return{access_token:h,refresh_token:e.refresh_token,id_token:y,token_type:"Bearer",expires_in:86400}}async function y0(t,e){return{code:(await t.env.data.codes.create(e.client.tenant.id,{code_id:xe(),user_id:e.user.user_id,code_type:"authorization_code",login_id:e.login_id,expires_at:new Date(Date.now()+B_*1e3).toISOString(),code_challenge:e.authParams.code_challenge,code_challenge_method:e.authParams.code_challenge_method,redirect_uri:e.authParams.redirect_uri,state:e.authParams.state,nonce:e.authParams.nonce})).code_id,state:e.authParams.state}}async function h2(t,e){const{client:n,scope:r,audience:i=n.tenant.audience,session_id:o}=e,a=jt(t.req);return await t.env.data.refreshTokens.create(n.tenant.id,{id:xe(),session_id:o,client_id:n.id,idle_expires_at:new Date(Date.now()+xs*1e3).toISOString(),user_id:e.user.user_id,device:{last_ip:a.ip||"",initial_ip:a.ip||"",last_user_agent:a.useragent||"",initial_user_agent:a.useragent||"",initial_asn:"",last_asn:""},resource_servers:[{audience:i,scopes:r}],rotating:!1})}async function w0(t,{user:e,client:n,loginSession:r}){const i=await t.env.data.sessions.create(n.tenant.id,{id:xe(),user_id:e.user_id,login_session_id:r.id,idle_expires_at:new Date(Date.now()+xs*1e3).toISOString(),device:{last_ip:t.req.header("x-real-ip")||"",initial_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||"",initial_user_agent:t.req.header("user-agent")||"",initial_asn:"",last_asn:""},clients:[n.id]});return await t.env.data.loginSessions.update(n.tenant.id,r.id,{session_id:i.id}),i}async function Zt(t,e){var h,y;const{authParams:n,user:r,client:i,ticketAuth:o}=e,a=we(t,{type:he.SUCCESS_LOGIN,description:`Successful login for ${r.user_id}`,userId:r.user_id});if(It(t,t.env.data.logs.create(i.tenant.id,a)),It(t,t.env.data.users.update(i.tenant.id,r.user_id,{last_login:new Date().toISOString(),last_ip:t.req.header("x-real-ip")||"",login_count:r.login_count+1})),o){if(!e.loginSession)throw new A(500,{message:"Login session not found for ticket auth."});const v=j_(),b=xe(12),E=await t.env.data.codes.create(i.tenant.id,{code_id:xe(),code_type:"ticket",login_id:e.loginSession.id,expires_at:new Date(Date.now()+U_).toISOString(),code_verifier:[b,v].join("|"),redirect_uri:n.redirect_uri,state:n.state,nonce:n.nonce});return t.json({login_ticket:E.code_id,co_verifier:v,co_id:b})}let c=e.refreshToken,d=e.sessionId,l=r;if(!d&&((h=e.loginSession)!=null&&h.session_id)){d=e.loginSession.session_id;const v=await t.env.data.sessions.get(i.tenant.id,d);v&&!v.clients.includes(i.id)&&await t.env.data.sessions.update(i.tenant.id,d,{clients:[...v.clients,i.id]}),!c&&((y=n.scope)!=null&&y.split(" ").includes("offline_access"))&&(c=(await h2(t,{user:l,client:i,session_id:d,scope:n.scope,audience:n.audience})).id)}else if(!d){if(!e.loginSession)throw new A(500,{message:"Login session not found for creating a new session."});d=(await w0(t,{user:l,client:i,loginSession:e.loginSession})).id;const b=await b2(t,t.env.data,i.tenant.id,r,e.loginSession,{client:i,authParams:n});if(b instanceof Response)return b;l=b}if(e.authParams.response_mode===Dt.SAML_POST){if(!d)throw new A(500,{message:"Session ID not available for SAML response"});return d2(t,e.client,e.authParams,l,d)}const u=await Ss(t,{authParams:n,user:l,client:i,session_id:d,refresh_token:c});if(n.response_mode===Dt.WEB_MESSAGE){if(d){const v=nc(i.tenant.id,d,t.var.custom_domain||t.req.header("host")||"");v&&t.header("set-cookie",v)}else console.warn("Session ID not available for WEB_MESSAGE, cookie will not be set.");return u}const f=new Headers;if(d){const v=nc(i.tenant.id,d,t.var.custom_domain||t.req.header("host")||"");v&&f.set("set-cookie",v)}const m=n.response_type||it.CODE;if(m===it.CODE){if(!e.loginSession)throw new A(500,{message:"Login session not found for code response type."});const v=await y0(t,{user:l,client:i,authParams:n,login_id:e.loginSession.id});if(!n.redirect_uri)throw new A(400,{message:"Redirect uri not found for code response type."});const b=new URL(n.redirect_uri);return b.searchParams.set("code",v.code),v.state&&b.searchParams.set("state",v.state),f.set("location",b.toString()),new Response("Redirecting",{status:302,headers:f})}if(!n.redirect_uri)throw new A(400,{message:"Redirect uri not found for this response mode."});const w=new URL(n.redirect_uri);if(m===it.TOKEN||m===it.TOKEN_ID_TOKEN)w.hash=new URLSearchParams({access_token:u.access_token,...u.id_token&&{id_token:u.id_token},token_type:u.token_type,expires_in:u.expires_in.toString(),...n.state&&{state:n.state},...n.scope&&{scope:n.scope}}).toString();else throw new A(500,{message:`Unsupported response type ('${m}') for redirect with tokens.`});return f.set("location",w.toString()),new Response("Redirecting",{status:302,headers:f})}async function g2(t,e,n){const r=await t.env.data.tenants.get(e);if(!r)throw new Error(`Tenant not found: ${e}`);return Ss(t,{client:{id:t.env.ISSUER,tenant:r,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),name:t.env.ISSUER,disable_sign_ups:!1,connections:[]},authParams:{client_id:t.env.ISSUER,response_type:it.TOKEN,scope:n}})}async function v0(t,e,n){const r=await g2(t,n.tenant_id,"webhook");for await(const i of e.filter(o=>"url"in o))if(!(await fetch(i.url,{method:"POST",headers:{Authorization:`Bearer ${r.access_token}`,"Content-Type":"application/json"},body:JSON.stringify(n)})).ok){const a=we(t,{type:he.FAILED_HOOK,description:`Failed to invoke hook ${i.hook_id}`});await t.env.data.logs.create(n.tenant_id,a)}}function m2(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e);return await v0(t,r,{tenant_id:e,user:n,trigger_id:"post-user-registration"}),n}}function _2(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await v0(t,r,{tenant_id:e,email:n,trigger_id:"pre-user-signup"})}}function Uu(t){return typeof t.form_id=="string"}async function y2(t,e,n){var d;const r=t.env.data,i=t.var.tenant_id||t.req.header("tenant-id");if(!i)throw new A(400,{message:"Missing tenant_id in context"});const o=await r.forms.get(i,e);if(!o)throw new A(404,{message:"Form not found for post-user-login hook"});let a=(d=o.start)==null?void 0:d.next_node;if(!a&&o.nodes&&o.nodes.length>0){const l=o.nodes.find(u=>u.type==="STEP");a=l==null?void 0:l.id}if(!a)throw new A(400,{message:"No start node found in form"});let c=`/u/forms/${o.id}/nodes/${a}?state=${encodeURIComponent(n.id)}`;return new Response(null,{status:302,headers:{location:c}})}function Mu(t){return typeof t.url=="string"}function w2(t,e){return async(n,r)=>{var a,c,d;const i={method:t.req.method,ip:t.req.query("x-real-ip")||"",user_agent:t.req.query("user-agent"),url:((a=t.var.loginSession)==null?void 0:a.authorization_url)||t.req.url};if((c=t.env.hooks)!=null&&c.onExecutePreUserRegistration)try{await t.env.hooks.onExecutePreUserRegistration({ctx:t,user:r,request:i},{user:{setUserMetadata:async(l,u)=>{r[l]=u}}})}catch{const u=we(t,{type:he.FAILED_SIGNUP,description:"Pre user registration hook failed"});await e.logs.create(n,u)}let o=await S_(e)(n,r);if((d=t.env.hooks)!=null&&d.onExecutePostUserRegistration)try{await t.env.hooks.onExecutePostUserRegistration({ctx:t,user:r,request:i},{user:{}})}catch{const u=we(t,{type:he.FAILED_SIGNUP,description:"Post user registration hook failed"});await t.env.data.logs.create(n,u)}return await m2(t)(n,o),o}}async function v2(t,e,n,r){var i;if(e.disable_sign_ups){const o=(i=t.var.loginSession)==null?void 0:i.authorization_url;if(!(o&&new URL(o).searchParams.get("screen_hint")==="signup")&&!await Zd({userAdapter:n.users,tenant_id:e.tenant.id,email:r})){const d=we(t,{type:he.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.logs.create(e.tenant.id,d),new A(400,{message:"Signups are disabled for this client"})}}await _2(t)(t.var.tenant_id||"",r)}function As(t,e){return{...e,users:{...e.users,create:w2(t,e)}}}async function b2(t,e,n,r,i,o){var d;(d=t.env.hooks)!=null&&d.onExecutePostLogin&&(o!=null&&o.client)&&(o!=null&&o.authParams)&&await t.env.hooks.onExecutePostLogin({ctx:t,client:o.client,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:o.authParams.scope||"",grant_type:""},{prompt:{render:l=>{}}});const{hooks:a}=await e.hooks.list(n,{q:"trigger_id:post-user-login",page:0,per_page:100,include_totals:!1});if(i){const l=a.find(u=>u.enabled&&Uu(u));if(l&&Uu(l))return y2(t,l.form_id,i)}const c=a.filter(l=>l.enabled&&Mu(l));for(const l of c)if(Mu(l))try{await fetch(l.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_id:n,user:r,trigger_id:"post-user-login"})})}catch{const f=we(t,{type:he.FAILED_HOOK,description:`Failed to invoke post-user-login webhook: ${l.url}`});await e.logs.create(n,f)}return r}function b0(t){return As(t,t.env.data)}async function Xd(t,e,n){return(await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`})).users}async function kr({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=r==="sms"?`phone_number:${n}`:`email:${n}`,{users:o}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`${i} provider:${r}`});return o.length>1&&console.error("More than one user found for same email and provider"),o[0]||null}async function Zd({userAdapter:t,tenant_id:e,email:n}){var c;const{users:r}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`}),i=r.filter(d=>!(d.provider==="auth2"&&!d.email_verified));if(i.length===0)return;const o=i.filter(d=>!d.linked_to);if(o.length>0)return o.length>1&&console.error("More than one primary user found for same email"),o[0];const a=await t.get(e,(c=i[0])==null?void 0:c.linked_to);if(!a)throw new Error("Primary account not found");return a}async function ei({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=await kr({userAdapter:t,tenant_id:e,username:n,provider:r});return i?i.linked_to?t.get(e,i.linked_to):i:null}async function Es(t,e){const{username:n,provider:r,connection:i,client:o,userId:a,isSocial:c,profileData:d={},ip:l=""}=e;let u=await ei({userAdapter:t.env.data.users,tenant_id:e.client.tenant.id,username:n,provider:r});if(!u){const f={user_id:`${r}|${a||$s()}`,email:i!=="sms"?n:void 0,phone_number:i==="sms"?n:void 0,name:n,provider:r,connection:i,email_verified:!0,last_ip:l,is_social:c,last_login:new Date().toISOString(),profileData:JSON.stringify(d)};u=await b0(t).users.create(o.tenant.id,f),t.set("user_id",u.user_id)}return u}const Vt=s.z.object({page:s.z.string().min(0).optional().default("0").transform(t=>parseInt(t,10)).openapi({description:"The page number where 0 is the first page"}),per_page:s.z.string().min(1).optional().default("10").transform(t=>parseInt(t,10)).openapi({description:"The number of items per page"}),include_totals:s.z.string().optional().default("false").transform(t=>t==="true").openapi({description:"If the total number of items should be included in the response"}),sort:s.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:s.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function Vn(t){if(!t)return;const[e,n]=t.split(":"),r=n==="1"?"asc":"desc";if(!(!e||!r))return{sort_by:e,sort_order:r}}const Fu=Xt.extend({users:s.z.array(Et)}),$2=Xt.extend({sessions:s.z.array(bs)}),x2=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Et),Fu])}},description:"List of users"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header");if(o!=null&&o.includes("identities.profileData.email")){const u=o.split("=")[1],m=(await t.env.data.users.list(a,{page:e,per_page:n,include_totals:r,q:`email:${u}`})).users.filter(y=>y.linked_to),[w]=m;if(!w)return t.json([]);const h=await t.env.data.users.get(a,w.linked_to);if(!h)throw new A(500,{message:"Primary account not found"});return t.json([Et.parse(h)])}const c=["-_exists_:linked_to"];o&&c.push(o);const d=await t.env.data.users.list(a,{page:e,per_page:n,include_totals:r,sort:Vn(i),q:c.join(" ")}),l=d.users.filter(u=>!u.linked_to);return r?t.json(Fu.parse({users:l,length:d.length,start:d.start,limit:d.limit})):t.json(s.z.array(Et).parse(l))}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Et}},description:"List of users"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.users.get(n,e);if(!r)throw new A(404);if(r.linked_to)throw new A(404,{message:"User is linked to another user"});return t.json(r)}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.users.remove(n,e))throw new A(404);return t.text("OK")}).openapi(s.createRoute({tags:["users"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...bo.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Et}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");t.set("body",n);const{email:r,phone_number:i,name:o,linked_to:a,email_verified:c,provider:d,connection:l}=n,u=`${n.provider}|${n.user_id||$s()}`;try{const f=await t.env.data.users.create(e,{email:r,user_id:u,name:o||r||i,phone_number:i,provider:d,connection:l,linked_to:a??void 0,email_verified:c||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});t.set("user_id",f.user_id);const m=we(t,{type:he.SUCCESS_API_OPERATION,description:"User created"});It(t,t.env.data.logs.create(e,m));const w={...f,identities:[{connection:f.connection,provider:f.provider,user_id:Nu(f.user_id),isSocial:f.is_social}]};return t.json(Et.parse(w),{status:201})}catch(f){throw f.message==="User already exists"?new A(409,{message:"User already exists"}):f}}).openapi(s.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...bo.shape,verify_email:s.z.boolean(),password:s.z.string()}).partial()}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{var u;const{data:e}=t.env,{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json"),{user_id:i}=t.req.valid("param"),{verify_email:o,password:a,...c}=r,d=await e.users.get(n,i);if(!d)throw new A(404);if(c.email&&c.email!==d.email){const f=await Xd(t.env.data.users,n,c.email);if(f.length&&f.some(m=>m.user_id!==i))throw new A(409,{message:"Another user with the same email address already exists."})}if(d.linked_to)throw new A(404,{message:"User is linked to another user"});if(await t.env.data.users.update(n,i,c),a){const f=(u=d.identities)==null?void 0:u.find(h=>h.connection==="Username-Password-Authentication");if(!f)throw new A(400,{message:"User does not have a password identity"});const m={user_id:f.user_id,password:await vi.hash(a,10),algorithm:"bcrypt"};await e.passwords.get(n,f.user_id)?await e.passwords.update(n,m):await e.passwords.create(n,m)}const l=await t.env.data.users.get(n,i);if(!l)throw new A(500);return t.json(l)}).openapi(s.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.union([s.z.object({link_with:s.z.string()}),s.z.object({user_id:s.z.string(),provider:s.z.string(),connection:s.z.string().optional()})])}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.array(s.z.object({connection:s.z.string(),provider:s.z.string(),user_id:s.z.string(),isSocial:s.z.boolean()}))}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),{user_id:r}=t.req.valid("param"),i="link_with"in n?n.link_with:n.user_id,o=await t.env.data.users.get(e,r);if(!o)throw new A(400,{message:"Linking an inexistent identity is not allowed."});await t.env.data.users.update(e,i,{linked_to:r});const a=await t.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${r}`}),c=[o,...a.users].map(d=>({connection:d.connection,provider:d.provider,user_id:Nu(d.user_id),isSocial:d.is_social}));return t.json(c,{status:201})}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string(),provider:s.z.string(),linked_user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:s.z.array(Et)}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{user_id:n,provider:r,linked_user_id:i}=t.req.valid("param");await t.env.data.users.unlink(e,n,r,i);const o=await t.env.data.users.get(e,n);if(!o)throw new A(404);return t.json([Et.parse(o)])}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(bs),$2])}},description:"List of sessions"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{include_totals:n,page:r,per_page:i}=t.req.valid("query"),{"tenant-id":o}=t.req.valid("header"),a=await t.env.data.sessions.list(o,{page:r,per_page:i,include_totals:n,q:`user_id:${e}`});return n?t.json(a):t.json(a.sessions)});/*! *****************************************************************************
|
|
30
30
|
Copyright (C) Microsoft. All rights reserved.
|
|
31
31
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
32
32
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -39,7 +39,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
39
39
|
|
|
40
40
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
41
41
|
and limitations under the License.
|
|
42
|
-
***************************************************************************** */var Du;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof Eo=="object"?Eo:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(t);typeof n.Reflect<"u"&&(r=i(n.Reflect,r)),e(r,n),typeof n.Reflect>"u"&&(n.Reflect=t);function i(d,l){return function(u,f){Object.defineProperty(d,u,{configurable:!0,writable:!0,value:f}),l&&l(u,f)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return o()||a()}})(function(e,n){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",d={__proto__:[]}instanceof Array,l=!c&&!d,u={create:c?function(){return Aa(Object.create(null))}:d?function(){return Aa({__proto__:null})}:function(){return Aa({})},has:l?function(S,I){return r.call(S,I)}:function(S,I){return I in S},get:l?function(S,I){return r.call(S,I)?S[I]:void 0}:function(S,I){return S[I]}},f=Object.getPrototypeOf(Function),m=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:x1(),w=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:k1(),h=typeof WeakMap=="function"?WeakMap:S1(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,v=v1(),b=b1(v);function E(S,I,T,M){if(q(T)){if(!lu(S))throw new TypeError;if(!uu(I))throw new TypeError;return N(S,I)}else{if(!lu(S))throw new TypeError;if(!ge(I))throw new TypeError;if(!ge(M)&&!q(M)&&!je(M))throw new TypeError;return je(M)&&(M=void 0),T=kt(T),z(S,I,T,M)}}e("decorate",E);function C(S,I){function T(M,ee){if(!ge(M))throw new TypeError;if(!q(ee)&&!y1(ee))throw new TypeError;Q(S,I,M,ee)}return T}e("metadata",C);function L(S,I,T,M){if(!ge(T))throw new TypeError;return q(M)||(M=kt(M)),Q(S,I,T,M)}e("defineMetadata",L);function Y(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),k(S,I,T)}e("hasMetadata",Y);function se(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),x(S,I,T)}e("hasOwnMetadata",se);function ae(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),P(S,I,T)}e("getMetadata",ae);function Se(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),U(S,I,T)}e("getOwnMetadata",Se);function ze(S,I){if(!ge(S))throw new TypeError;return q(I)||(I=kt(I)),W(S,I)}e("getMetadataKeys",ze);function Ce(S,I){if(!ge(S))throw new TypeError;return q(I)||(I=kt(I)),oe(S,I)}e("getOwnMetadataKeys",Ce);function j(S,I,T){if(!ge(I))throw new TypeError;if(q(T)||(T=kt(T)),!ge(I))throw new TypeError;q(T)||(T=kt(T));var M=Rr(I,T,!1);return q(M)?!1:M.OrdinaryDeleteMetadata(S,I,T)}e("deleteMetadata",j);function N(S,I){for(var T=S.length-1;T>=0;--T){var M=S[T],ee=M(I);if(!q(ee)&&!je(ee)){if(!uu(ee))throw new TypeError;I=ee}}return I}function z(S,I,T,M){for(var ee=S.length-1;ee>=0;--ee){var Oe=S[ee],Ie=Oe(I,T,M);if(!q(Ie)&&!je(Ie)){if(!ge(Ie))throw new TypeError;M=Ie}}return M}function k(S,I,T){var M=x(S,I,T);if(M)return!0;var ee=Sa(I);return je(ee)?!1:k(S,ee,T)}function x(S,I,T){var M=Rr(I,T,!1);return q(M)?!1:du(M.OrdinaryHasOwnMetadata(S,I,T))}function P(S,I,T){var M=x(S,I,T);if(M)return U(S,I,T);var ee=Sa(I);if(!je(ee))return P(S,ee,T)}function U(S,I,T){var M=Rr(I,T,!1);if(!q(M))return M.OrdinaryGetOwnMetadata(S,I,T)}function Q(S,I,T,M){var ee=Rr(T,M,!0);ee.OrdinaryDefineOwnMetadata(S,I,T,M)}function W(S,I){var T=oe(S,I),M=Sa(S);if(M===null)return T;var ee=W(M,I);if(ee.length<=0)return T;if(T.length<=0)return ee;for(var Oe=new w,Ie=[],ce=0,V=T;ce<V.length;ce++){var G=V[ce],X=Oe.has(G);X||(Oe.add(G),Ie.push(G))}for(var Z=0,de=ee;Z<de.length;Z++){var G=de[Z],X=Oe.has(G);X||(Oe.add(G),Ie.push(G))}return Ie}function oe(S,I){var T=Rr(S,I,!1);return T?T.OrdinaryOwnMetadataKeys(S,I):[]}function ue(S){if(S===null)return 1;switch(typeof S){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return S===null?1:6;default:return 6}}function q(S){return S===void 0}function je(S){return S===null}function yn(S){return typeof S=="symbol"}function ge(S){return typeof S=="object"?S!==null:typeof S=="function"}function Ae(S,I){switch(ue(S)){case 0:return S;case 1:return S;case 2:return S;case 3:return S;case 4:return S;case 5:return S}var T="string",M=pu(S,o);if(M!==void 0){var ee=M.call(S,T);if(ge(ee))throw new TypeError;return ee}return m1(S)}function m1(S,I){var T,M;{var ee=S.toString;if(Hi(ee)){var M=ee.call(S);if(!ge(M))return M}var T=S.valueOf;if(Hi(T)){var M=T.call(S);if(!ge(M))return M}}throw new TypeError}function du(S){return!!S}function _1(S){return""+S}function kt(S){var I=Ae(S);return yn(I)?I:_1(I)}function lu(S){return Array.isArray?Array.isArray(S):S instanceof Object?S instanceof Array:Object.prototype.toString.call(S)==="[object Array]"}function Hi(S){return typeof S=="function"}function uu(S){return typeof S=="function"}function y1(S){switch(ue(S)){case 3:return!0;case 4:return!0;default:return!1}}function ka(S,I){return S===I||S!==S&&I!==I}function pu(S,I){var T=S[I];if(T!=null){if(!Hi(T))throw new TypeError;return T}}function fu(S){var I=pu(S,a);if(!Hi(I))throw new TypeError;var T=I.call(S);if(!ge(T))throw new TypeError;return T}function hu(S){return S.value}function gu(S){var I=S.next();return I.done?!1:I}function mu(S){var I=S.return;I&&I.call(S)}function Sa(S){var I=Object.getPrototypeOf(S);if(typeof S!="function"||S===f||I!==f)return I;var T=S.prototype,M=T&&Object.getPrototypeOf(T);if(M==null||M===Object.prototype)return I;var ee=M.constructor;return typeof ee!="function"||ee===S?I:ee}function w1(){var S;!q(y)&&typeof n.Reflect<"u"&&!(y in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(S=$1(n.Reflect));var I,T,M,ee=new h,Oe={registerProvider:Ie,getProvider:V,setProvider:X};return Oe;function Ie(Z){if(!Object.isExtensible(Oe))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case S===Z:break;case q(I):I=Z;break;case I===Z:break;case q(T):T=Z;break;case T===Z:break;default:M===void 0&&(M=new w),M.add(Z);break}}function ce(Z,de){if(!q(I)){if(I.isProviderFor(Z,de))return I;if(!q(T)){if(T.isProviderFor(Z,de))return I;if(!q(M))for(var me=fu(M);;){var ve=gu(me);if(!ve)return;var ft=hu(ve);if(ft.isProviderFor(Z,de))return mu(me),ft}}}if(!q(S)&&S.isProviderFor(Z,de))return S}function V(Z,de){var me=ee.get(Z),ve;return q(me)||(ve=me.get(de)),q(ve)&&(ve=ce(Z,de),q(ve)||(q(me)&&(me=new m,ee.set(Z,me)),me.set(de,ve))),ve}function G(Z){if(q(Z))throw new TypeError;return I===Z||T===Z||!q(M)&&M.has(Z)}function X(Z,de,me){if(!G(me))throw new Error("Metadata provider not registered.");var ve=V(Z,de);if(ve!==me){if(!q(ve))return!1;var ft=ee.get(Z);q(ft)&&(ft=new m,ee.set(Z,ft)),ft.set(de,me)}return!0}}function v1(){var S;return!q(y)&&ge(n.Reflect)&&Object.isExtensible(n.Reflect)&&(S=n.Reflect[y]),q(S)&&(S=w1()),!q(y)&&ge(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:S}),S}function b1(S){var I=new h,T={isProviderFor:function(G,X){var Z=I.get(G);return q(Z)?!1:Z.has(X)},OrdinaryDefineOwnMetadata:Ie,OrdinaryHasOwnMetadata:ee,OrdinaryGetOwnMetadata:Oe,OrdinaryOwnMetadataKeys:ce,OrdinaryDeleteMetadata:V};return v.registerProvider(T),T;function M(G,X,Z){var de=I.get(G),me=!1;if(q(de)){if(!Z)return;de=new m,I.set(G,de),me=!0}var ve=de.get(X);if(q(ve)){if(!Z)return;if(ve=new m,de.set(X,ve),!S.setProvider(G,X,T))throw de.delete(X),me&&I.delete(G),new Error("Wrong provider for target.")}return ve}function ee(G,X,Z){var de=M(X,Z,!1);return q(de)?!1:du(de.has(G))}function Oe(G,X,Z){var de=M(X,Z,!1);if(!q(de))return de.get(G)}function Ie(G,X,Z,de){var me=M(Z,de,!0);me.set(G,X)}function ce(G,X){var Z=[],de=M(G,X,!1);if(q(de))return Z;for(var me=de.keys(),ve=fu(me),ft=0;;){var _u=gu(ve);if(!_u)return Z.length=ft,Z;var A1=hu(_u);try{Z[ft]=A1}catch(E1){try{mu(ve)}finally{throw E1}}ft++}}function V(G,X,Z){var de=M(X,Z,!1);if(q(de)||!de.delete(G))return!1;if(de.size===0){var me=I.get(X);q(me)||(me.delete(Z),me.size===0&&I.delete(me))}return!0}}function $1(S){var I=S.defineMetadata,T=S.hasOwnMetadata,M=S.getOwnMetadata,ee=S.getOwnMetadataKeys,Oe=S.deleteMetadata,Ie=new h,ce={isProviderFor:function(V,G){var X=Ie.get(V);return!q(X)&&X.has(G)?!0:ee(V,G).length?(q(X)&&(X=new w,Ie.set(V,X)),X.add(G),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:T,OrdinaryGetOwnMetadata:M,OrdinaryOwnMetadataKeys:ee,OrdinaryDeleteMetadata:Oe};return ce}function Rr(S,I,T){var M=v.getProvider(S,I);if(!q(M))return M;if(T){if(v.setProvider(S,I,b))return b;throw new Error("Illegal state.")}}function x1(){var S={},I=[],T=function(){function ce(V,G,X){this._index=0,this._keys=V,this._values=G,this._selector=X}return ce.prototype["@@iterator"]=function(){return this},ce.prototype[a]=function(){return this},ce.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var G=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:G,done:!1}}return{value:void 0,done:!0}},ce.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),V},ce.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:V,done:!0}},ce}(),M=function(){function ce(){this._keys=[],this._values=[],this._cacheKey=S,this._cacheIndex=-2}return Object.defineProperty(ce.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ce.prototype.has=function(V){return this._find(V,!1)>=0},ce.prototype.get=function(V){var G=this._find(V,!1);return G>=0?this._values[G]:void 0},ce.prototype.set=function(V,G){var X=this._find(V,!0);return this._values[X]=G,this},ce.prototype.delete=function(V){var G=this._find(V,!1);if(G>=0){for(var X=this._keys.length,Z=G+1;Z<X;Z++)this._keys[Z-1]=this._keys[Z],this._values[Z-1]=this._values[Z];return this._keys.length--,this._values.length--,ka(V,this._cacheKey)&&(this._cacheKey=S,this._cacheIndex=-2),!0}return!1},ce.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=S,this._cacheIndex=-2},ce.prototype.keys=function(){return new T(this._keys,this._values,ee)},ce.prototype.values=function(){return new T(this._keys,this._values,Oe)},ce.prototype.entries=function(){return new T(this._keys,this._values,Ie)},ce.prototype["@@iterator"]=function(){return this.entries()},ce.prototype[a]=function(){return this.entries()},ce.prototype._find=function(V,G){if(!ka(this._cacheKey,V)){this._cacheIndex=-1;for(var X=0;X<this._keys.length;X++)if(ka(this._keys[X],V)){this._cacheIndex=X;break}}return this._cacheIndex<0&&G&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},ce}();return M;function ee(ce,V){return ce}function Oe(ce,V){return V}function Ie(ce,V){return[ce,V]}}function k1(){var S=function(){function I(){this._map=new m}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(T){return this._map.has(T)},I.prototype.add=function(T){return this._map.set(T,T),this},I.prototype.delete=function(T){return this._map.delete(T)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[a]=function(){return this.keys()},I}();return S}function S1(){var S=16,I=u.create(),T=M();return function(){function V(){this._key=M()}return V.prototype.has=function(G){var X=ee(G,!1);return X!==void 0?u.has(X,this._key):!1},V.prototype.get=function(G){var X=ee(G,!1);return X!==void 0?u.get(X,this._key):void 0},V.prototype.set=function(G,X){var Z=ee(G,!0);return Z[this._key]=X,this},V.prototype.delete=function(G){var X=ee(G,!1);return X!==void 0?delete X[this._key]:!1},V.prototype.clear=function(){this._key=M()},V}();function M(){var V;do V="@@WeakMap@@"+ce();while(u.has(I,V));return I[V]=!0,V}function ee(V,G){if(!r.call(V,T)){if(!G)return;Object.defineProperty(V,T,{value:u.create()})}return V[T]}function Oe(V,G){for(var X=0;X<G;++X)V[X]=Math.random()*255|0;return V}function Ie(V){if(typeof Uint8Array=="function"){var G=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(G):typeof msCrypto<"u"?msCrypto.getRandomValues(G):Oe(G,V),G}return Oe(new Array(V),V)}function ce(){var V=Ie(S);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var G="",X=0;X<S;++X){var Z=V[X];(X===4||X===6||X===8)&&(G+="-"),Z<16&&(G+="0"),G+=Z.toString(16).toLowerCase()}return G}}function Aa(S){return S.__=void 0,delete S.__,S}})})(Du||(Du={}));/*!
|
|
42
|
+
***************************************************************************** */var Du;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof Eo=="object"?Eo:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(t);typeof n.Reflect<"u"&&(r=i(n.Reflect,r)),e(r,n),typeof n.Reflect>"u"&&(n.Reflect=t);function i(d,l){return function(u,f){Object.defineProperty(d,u,{configurable:!0,writable:!0,value:f}),l&&l(u,f)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return o()||a()}})(function(e,n){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",d={__proto__:[]}instanceof Array,l=!c&&!d,u={create:c?function(){return Sa(Object.create(null))}:d?function(){return Sa({__proto__:null})}:function(){return Sa({})},has:l?function(S,I){return r.call(S,I)}:function(S,I){return I in S},get:l?function(S,I){return r.call(S,I)?S[I]:void 0}:function(S,I){return S[I]}},f=Object.getPrototypeOf(Function),m=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:x1(),w=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:k1(),h=typeof WeakMap=="function"?WeakMap:S1(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,v=v1(),b=b1(v);function E(S,I,T,M){if(q(T)){if(!lu(S))throw new TypeError;if(!uu(I))throw new TypeError;return N(S,I)}else{if(!lu(S))throw new TypeError;if(!ge(I))throw new TypeError;if(!ge(M)&&!q(M)&&!je(M))throw new TypeError;return je(M)&&(M=void 0),T=kt(T),z(S,I,T,M)}}e("decorate",E);function C(S,I){function T(M,ee){if(!ge(M))throw new TypeError;if(!q(ee)&&!y1(ee))throw new TypeError;Q(S,I,M,ee)}return T}e("metadata",C);function L(S,I,T,M){if(!ge(T))throw new TypeError;return q(M)||(M=kt(M)),Q(S,I,T,M)}e("defineMetadata",L);function Y(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),k(S,I,T)}e("hasMetadata",Y);function se(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),x(S,I,T)}e("hasOwnMetadata",se);function ae(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),P(S,I,T)}e("getMetadata",ae);function Se(S,I,T){if(!ge(I))throw new TypeError;return q(T)||(T=kt(T)),U(S,I,T)}e("getOwnMetadata",Se);function ze(S,I){if(!ge(S))throw new TypeError;return q(I)||(I=kt(I)),W(S,I)}e("getMetadataKeys",ze);function Ce(S,I){if(!ge(S))throw new TypeError;return q(I)||(I=kt(I)),oe(S,I)}e("getOwnMetadataKeys",Ce);function j(S,I,T){if(!ge(I))throw new TypeError;if(q(T)||(T=kt(T)),!ge(I))throw new TypeError;q(T)||(T=kt(T));var M=Rr(I,T,!1);return q(M)?!1:M.OrdinaryDeleteMetadata(S,I,T)}e("deleteMetadata",j);function N(S,I){for(var T=S.length-1;T>=0;--T){var M=S[T],ee=M(I);if(!q(ee)&&!je(ee)){if(!uu(ee))throw new TypeError;I=ee}}return I}function z(S,I,T,M){for(var ee=S.length-1;ee>=0;--ee){var Oe=S[ee],Ie=Oe(I,T,M);if(!q(Ie)&&!je(Ie)){if(!ge(Ie))throw new TypeError;M=Ie}}return M}function k(S,I,T){var M=x(S,I,T);if(M)return!0;var ee=ka(I);return je(ee)?!1:k(S,ee,T)}function x(S,I,T){var M=Rr(I,T,!1);return q(M)?!1:du(M.OrdinaryHasOwnMetadata(S,I,T))}function P(S,I,T){var M=x(S,I,T);if(M)return U(S,I,T);var ee=ka(I);if(!je(ee))return P(S,ee,T)}function U(S,I,T){var M=Rr(I,T,!1);if(!q(M))return M.OrdinaryGetOwnMetadata(S,I,T)}function Q(S,I,T,M){var ee=Rr(T,M,!0);ee.OrdinaryDefineOwnMetadata(S,I,T,M)}function W(S,I){var T=oe(S,I),M=ka(S);if(M===null)return T;var ee=W(M,I);if(ee.length<=0)return T;if(T.length<=0)return ee;for(var Oe=new w,Ie=[],ce=0,V=T;ce<V.length;ce++){var G=V[ce],X=Oe.has(G);X||(Oe.add(G),Ie.push(G))}for(var Z=0,de=ee;Z<de.length;Z++){var G=de[Z],X=Oe.has(G);X||(Oe.add(G),Ie.push(G))}return Ie}function oe(S,I){var T=Rr(S,I,!1);return T?T.OrdinaryOwnMetadataKeys(S,I):[]}function ue(S){if(S===null)return 1;switch(typeof S){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return S===null?1:6;default:return 6}}function q(S){return S===void 0}function je(S){return S===null}function yn(S){return typeof S=="symbol"}function ge(S){return typeof S=="object"?S!==null:typeof S=="function"}function Ae(S,I){switch(ue(S)){case 0:return S;case 1:return S;case 2:return S;case 3:return S;case 4:return S;case 5:return S}var T="string",M=pu(S,o);if(M!==void 0){var ee=M.call(S,T);if(ge(ee))throw new TypeError;return ee}return m1(S)}function m1(S,I){var T,M;{var ee=S.toString;if(Hi(ee)){var M=ee.call(S);if(!ge(M))return M}var T=S.valueOf;if(Hi(T)){var M=T.call(S);if(!ge(M))return M}}throw new TypeError}function du(S){return!!S}function _1(S){return""+S}function kt(S){var I=Ae(S);return yn(I)?I:_1(I)}function lu(S){return Array.isArray?Array.isArray(S):S instanceof Object?S instanceof Array:Object.prototype.toString.call(S)==="[object Array]"}function Hi(S){return typeof S=="function"}function uu(S){return typeof S=="function"}function y1(S){switch(ue(S)){case 3:return!0;case 4:return!0;default:return!1}}function xa(S,I){return S===I||S!==S&&I!==I}function pu(S,I){var T=S[I];if(T!=null){if(!Hi(T))throw new TypeError;return T}}function fu(S){var I=pu(S,a);if(!Hi(I))throw new TypeError;var T=I.call(S);if(!ge(T))throw new TypeError;return T}function hu(S){return S.value}function gu(S){var I=S.next();return I.done?!1:I}function mu(S){var I=S.return;I&&I.call(S)}function ka(S){var I=Object.getPrototypeOf(S);if(typeof S!="function"||S===f||I!==f)return I;var T=S.prototype,M=T&&Object.getPrototypeOf(T);if(M==null||M===Object.prototype)return I;var ee=M.constructor;return typeof ee!="function"||ee===S?I:ee}function w1(){var S;!q(y)&&typeof n.Reflect<"u"&&!(y in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(S=$1(n.Reflect));var I,T,M,ee=new h,Oe={registerProvider:Ie,getProvider:V,setProvider:X};return Oe;function Ie(Z){if(!Object.isExtensible(Oe))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case S===Z:break;case q(I):I=Z;break;case I===Z:break;case q(T):T=Z;break;case T===Z:break;default:M===void 0&&(M=new w),M.add(Z);break}}function ce(Z,de){if(!q(I)){if(I.isProviderFor(Z,de))return I;if(!q(T)){if(T.isProviderFor(Z,de))return I;if(!q(M))for(var me=fu(M);;){var ve=gu(me);if(!ve)return;var ft=hu(ve);if(ft.isProviderFor(Z,de))return mu(me),ft}}}if(!q(S)&&S.isProviderFor(Z,de))return S}function V(Z,de){var me=ee.get(Z),ve;return q(me)||(ve=me.get(de)),q(ve)&&(ve=ce(Z,de),q(ve)||(q(me)&&(me=new m,ee.set(Z,me)),me.set(de,ve))),ve}function G(Z){if(q(Z))throw new TypeError;return I===Z||T===Z||!q(M)&&M.has(Z)}function X(Z,de,me){if(!G(me))throw new Error("Metadata provider not registered.");var ve=V(Z,de);if(ve!==me){if(!q(ve))return!1;var ft=ee.get(Z);q(ft)&&(ft=new m,ee.set(Z,ft)),ft.set(de,me)}return!0}}function v1(){var S;return!q(y)&&ge(n.Reflect)&&Object.isExtensible(n.Reflect)&&(S=n.Reflect[y]),q(S)&&(S=w1()),!q(y)&&ge(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:S}),S}function b1(S){var I=new h,T={isProviderFor:function(G,X){var Z=I.get(G);return q(Z)?!1:Z.has(X)},OrdinaryDefineOwnMetadata:Ie,OrdinaryHasOwnMetadata:ee,OrdinaryGetOwnMetadata:Oe,OrdinaryOwnMetadataKeys:ce,OrdinaryDeleteMetadata:V};return v.registerProvider(T),T;function M(G,X,Z){var de=I.get(G),me=!1;if(q(de)){if(!Z)return;de=new m,I.set(G,de),me=!0}var ve=de.get(X);if(q(ve)){if(!Z)return;if(ve=new m,de.set(X,ve),!S.setProvider(G,X,T))throw de.delete(X),me&&I.delete(G),new Error("Wrong provider for target.")}return ve}function ee(G,X,Z){var de=M(X,Z,!1);return q(de)?!1:du(de.has(G))}function Oe(G,X,Z){var de=M(X,Z,!1);if(!q(de))return de.get(G)}function Ie(G,X,Z,de){var me=M(Z,de,!0);me.set(G,X)}function ce(G,X){var Z=[],de=M(G,X,!1);if(q(de))return Z;for(var me=de.keys(),ve=fu(me),ft=0;;){var _u=gu(ve);if(!_u)return Z.length=ft,Z;var A1=hu(_u);try{Z[ft]=A1}catch(E1){try{mu(ve)}finally{throw E1}}ft++}}function V(G,X,Z){var de=M(X,Z,!1);if(q(de)||!de.delete(G))return!1;if(de.size===0){var me=I.get(X);q(me)||(me.delete(Z),me.size===0&&I.delete(me))}return!0}}function $1(S){var I=S.defineMetadata,T=S.hasOwnMetadata,M=S.getOwnMetadata,ee=S.getOwnMetadataKeys,Oe=S.deleteMetadata,Ie=new h,ce={isProviderFor:function(V,G){var X=Ie.get(V);return!q(X)&&X.has(G)?!0:ee(V,G).length?(q(X)&&(X=new w,Ie.set(V,X)),X.add(G),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:T,OrdinaryGetOwnMetadata:M,OrdinaryOwnMetadataKeys:ee,OrdinaryDeleteMetadata:Oe};return ce}function Rr(S,I,T){var M=v.getProvider(S,I);if(!q(M))return M;if(T){if(v.setProvider(S,I,b))return b;throw new Error("Illegal state.")}}function x1(){var S={},I=[],T=function(){function ce(V,G,X){this._index=0,this._keys=V,this._values=G,this._selector=X}return ce.prototype["@@iterator"]=function(){return this},ce.prototype[a]=function(){return this},ce.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var G=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:G,done:!1}}return{value:void 0,done:!0}},ce.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),V},ce.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:V,done:!0}},ce}(),M=function(){function ce(){this._keys=[],this._values=[],this._cacheKey=S,this._cacheIndex=-2}return Object.defineProperty(ce.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ce.prototype.has=function(V){return this._find(V,!1)>=0},ce.prototype.get=function(V){var G=this._find(V,!1);return G>=0?this._values[G]:void 0},ce.prototype.set=function(V,G){var X=this._find(V,!0);return this._values[X]=G,this},ce.prototype.delete=function(V){var G=this._find(V,!1);if(G>=0){for(var X=this._keys.length,Z=G+1;Z<X;Z++)this._keys[Z-1]=this._keys[Z],this._values[Z-1]=this._values[Z];return this._keys.length--,this._values.length--,xa(V,this._cacheKey)&&(this._cacheKey=S,this._cacheIndex=-2),!0}return!1},ce.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=S,this._cacheIndex=-2},ce.prototype.keys=function(){return new T(this._keys,this._values,ee)},ce.prototype.values=function(){return new T(this._keys,this._values,Oe)},ce.prototype.entries=function(){return new T(this._keys,this._values,Ie)},ce.prototype["@@iterator"]=function(){return this.entries()},ce.prototype[a]=function(){return this.entries()},ce.prototype._find=function(V,G){if(!xa(this._cacheKey,V)){this._cacheIndex=-1;for(var X=0;X<this._keys.length;X++)if(xa(this._keys[X],V)){this._cacheIndex=X;break}}return this._cacheIndex<0&&G&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},ce}();return M;function ee(ce,V){return ce}function Oe(ce,V){return V}function Ie(ce,V){return[ce,V]}}function k1(){var S=function(){function I(){this._map=new m}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(T){return this._map.has(T)},I.prototype.add=function(T){return this._map.set(T,T),this},I.prototype.delete=function(T){return this._map.delete(T)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[a]=function(){return this.keys()},I}();return S}function S1(){var S=16,I=u.create(),T=M();return function(){function V(){this._key=M()}return V.prototype.has=function(G){var X=ee(G,!1);return X!==void 0?u.has(X,this._key):!1},V.prototype.get=function(G){var X=ee(G,!1);return X!==void 0?u.get(X,this._key):void 0},V.prototype.set=function(G,X){var Z=ee(G,!0);return Z[this._key]=X,this},V.prototype.delete=function(G){var X=ee(G,!1);return X!==void 0?delete X[this._key]:!1},V.prototype.clear=function(){this._key=M()},V}();function M(){var V;do V="@@WeakMap@@"+ce();while(u.has(I,V));return I[V]=!0,V}function ee(V,G){if(!r.call(V,T)){if(!G)return;Object.defineProperty(V,T,{value:u.create()})}return V[T]}function Oe(V,G){for(var X=0;X<G;++X)V[X]=Math.random()*255|0;return V}function Ie(V){if(typeof Uint8Array=="function"){var G=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(G):typeof msCrypto<"u"?msCrypto.getRandomValues(G):Oe(G,V),G}return Oe(new Array(V),V)}function ce(){var V=Ie(S);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var G="",X=0;X<S;++X){var Z=V[X];(X===4||X===6||X===8)&&(G+="-"),Z<16&&(G+="0"),G+=Z.toString(16).toLowerCase()}return G}}function Sa(S){return S.__=void 0,delete S.__,S}})})(Du||(Du={}));/*!
|
|
43
43
|
* MIT License
|
|
44
44
|
*
|
|
45
45
|
* Copyright (c) 2017-2022 Peculiar Ventures, LLC
|
|
@@ -62,9 +62,9 @@ and limitations under the License.
|
|
|
62
62
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
63
|
* SOFTWARE.
|
|
64
64
|
*
|
|
65
|
-
*/const k2="[object ArrayBuffer]";class D{static isArrayBuffer(e){return Object.prototype.toString.call(e)===k2}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,n){if(e.constructor===n)return e;if(this.isArrayBuffer(e))return new n(e);if(this.isArrayBufferView(e))return new n(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,n){const r=D.toUint8Array(e),i=D.toUint8Array(n);if(r.length!==i.byteLength)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}static concat(...e){let n;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?n=e[0]:e[e.length-1]instanceof Function?n=e.slice(0,e.length-1):n=e;let r=0;for(const a of n)r+=a.byteLength;const i=new Uint8Array(r);let o=0;for(const a of n){const c=this.toUint8Array(a);i.set(c,o),o+=c.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const
|
|
65
|
+
*/const k2="[object ArrayBuffer]";class D{static isArrayBuffer(e){return Object.prototype.toString.call(e)===k2}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,n){if(e.constructor===n)return e;if(this.isArrayBuffer(e))return new n(e);if(this.isArrayBufferView(e))return new n(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,n){const r=D.toUint8Array(e),i=D.toUint8Array(n);if(r.length!==i.byteLength)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}static concat(...e){let n;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?n=e[0]:e[e.length-1]instanceof Function?n=e.slice(0,e.length-1):n=e;let r=0;for(const a of n)r+=a.byteLength;const i=new Uint8Array(r);let o=0;for(const a of n){const c=this.toUint8Array(a);i.set(c,o),o+=c.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const Ea="string",S2=/^[0-9a-f]+$/i,A2=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,E2=/^[a-zA-Z0-9-_]+$/;class Vu{static fromString(e){const n=unescape(encodeURIComponent(e)),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r.buffer}static toString(e){const n=D.toUint8Array(e);let r="";for(let o=0;o<n.length;o++)r+=String.fromCharCode(n[o]);return decodeURIComponent(escape(r))}}class St{static toString(e,n=!1){const r=D.toArrayBuffer(e),i=new DataView(r);let o="";for(let a=0;a<r.byteLength;a+=2){const c=i.getUint16(a,n);o+=String.fromCharCode(c)}return o}static fromString(e,n=!1){const r=new ArrayBuffer(e.length*2),i=new DataView(r);for(let o=0;o<e.length;o++)i.setUint16(o*2,e.charCodeAt(o),n);return r}}class J{static isHex(e){return typeof e===Ea&&S2.test(e)}static isBase64(e){return typeof e===Ea&&A2.test(e)}static isBase64Url(e){return typeof e===Ea&&E2.test(e)}static ToString(e,n="utf8"){const r=D.toUint8Array(e);switch(n.toLowerCase()){case"utf8":return this.ToUtf8String(r);case"binary":return this.ToBinary(r);case"hex":return this.ToHex(r);case"base64":return this.ToBase64(r);case"base64url":return this.ToBase64Url(r);case"utf16le":return St.toString(r,!0);case"utf16":case"utf16be":return St.toString(r);default:throw new Error(`Unknown type of encoding '${n}'`)}}static FromString(e,n="utf8"){if(!e)return new ArrayBuffer(0);switch(n.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return St.fromString(e,!0);case"utf16":case"utf16be":return St.fromString(e);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToBase64(e){const n=D.toUint8Array(e);if(typeof btoa<"u"){const r=this.ToString(n,"binary");return btoa(r)}else return Buffer.from(n).toString("base64")}static FromBase64(e){const n=this.formatString(e);if(!n)return new ArrayBuffer(0);if(!J.isBase64(n))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(n)):new Uint8Array(Buffer.from(n,"base64")).buffer}static FromBase64Url(e){const n=this.formatString(e);if(!n)return new ArrayBuffer(0);if(!J.isBase64Url(n))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(n.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,n=J.DEFAULT_UTF8_ENCODING){switch(n){case"ascii":return this.FromBinary(e);case"utf8":return Vu.fromString(e);case"utf16":case"utf16be":return St.fromString(e);case"utf16le":case"usc2":return St.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToUtf8String(e,n=J.DEFAULT_UTF8_ENCODING){switch(n){case"ascii":return this.ToBinary(e);case"utf8":return Vu.toString(e);case"utf16":case"utf16be":return St.toString(e);case"utf16le":case"usc2":return St.toString(e,!0);default:throw new Error(`Unknown type of encoding '${n}'`)}}static FromBinary(e){const n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);return r.buffer}static ToBinary(e){const n=D.toUint8Array(e);let r="";for(let i=0;i<n.length;i++)r+=String.fromCharCode(n[i]);return r}static ToHex(e){const n=D.toUint8Array(e);let r="";const i=n.length;for(let o=0;o<i;o++){const a=n[o];a<16&&(r+="0"),r+=a.toString(16)}return r}static FromHex(e){let n=this.formatString(e);if(!n)return new ArrayBuffer(0);if(!J.isHex(n))throw new TypeError("Argument 'hexString' is not HEX encoded");n.length%2&&(n=`0${n}`);const r=new Uint8Array(n.length/2);for(let i=0;i<n.length;i=i+2){const o=n.slice(i,i+2);r[i/2]=parseInt(o,16)}return r.buffer}static ToUtf16String(e,n=!1){return St.toString(e,n)}static FromUtf16String(e,n=!1){return St.fromString(e,n)}static Base64Padding(e){const n=4-e.length%4;if(n<4)for(let r=0;r<n;r++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}J.DEFAULT_UTF8_ENCODING="utf8";function z2(...t){const e=t.map(i=>i.byteLength).reduce((i,o)=>i+o),n=new Uint8Array(e);let r=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(const o of i)n[r++]=o}),n.buffer}function $0(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(n[i]!==r[i])return!1;return!0}/*!
|
|
66
66
|
Copyright (c) Peculiar Ventures, LLC
|
|
67
|
-
*/function lr(t,e){let n=0;if(t.length===1)return t[0];for(let r=t.length-1;r>=0;r--)n+=t[t.length-1-r]*Math.pow(2,e*r);return n}function Nn(t,e,n=-1){const r=n;let i=t,o=0,a=Math.pow(2,e);for(let c=1;c<8;c++){if(t<a){let d;if(r<0)d=new ArrayBuffer(c),o=c;else{if(r<c)return new ArrayBuffer(0);d=new ArrayBuffer(r),o=r}const l=new Uint8Array(d);for(let u=c-1;u>=0;u--){const f=Math.pow(2,u*e);l[o-u-1]=Math.floor(i/f),i-=l[o-u-1]*f}return d}a*=Math.pow(2,e)}return new ArrayBuffer(0)}function
|
|
67
|
+
*/function lr(t,e){let n=0;if(t.length===1)return t[0];for(let r=t.length-1;r>=0;r--)n+=t[t.length-1-r]*Math.pow(2,e*r);return n}function Nn(t,e,n=-1){const r=n;let i=t,o=0,a=Math.pow(2,e);for(let c=1;c<8;c++){if(t<a){let d;if(r<0)d=new ArrayBuffer(c),o=c;else{if(r<c)return new ArrayBuffer(0);d=new ArrayBuffer(r),o=r}const l=new Uint8Array(d);for(let u=c-1;u>=0;u--){const f=Math.pow(2,u*e);l[o-u-1]=Math.floor(i/f),i-=l[o-u-1]*f}return d}a*=Math.pow(2,e)}return new ArrayBuffer(0)}function oc(...t){let e=0,n=0;for(const o of t)e+=o.length;const r=new ArrayBuffer(e),i=new Uint8Array(r);for(const o of t)i.set(o,n),n+=o.length;return i}function x0(){const t=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=t[0]===255&&t[1]&128,d=t[0]===0&&(t[1]&128)===0;(c||d)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),n=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)n[c]=0;n[0]=t[0]&128;const r=lr(n,8),i=new ArrayBuffer(this.valueHex.byteLength),o=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)o[c]=t[c];return o[0]&=127,lr(o,8)-r}function I2(t){const e=t<0?t*-1:t;let n=128;for(let r=1;r<8;r++){if(e<=n){if(t<0){const a=n-e,c=Nn(a,8,r),d=new Uint8Array(c);return d[0]|=128,c}let i=Nn(e,8,r),o=new Uint8Array(i);if(o[0]&128){const a=i.slice(0),c=new Uint8Array(a);i=new ArrayBuffer(i.byteLength+1),o=new Uint8Array(i);for(let d=0;d<a.byteLength;d++)o[d+1]=c[d];o[0]=0}return i}n*=Math.pow(2,8)}return new ArrayBuffer(0)}function N2(t,e){if(t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let i=0;i<n.length;i++)if(n[i]!==r[i])return!1;return!0}function et(t,e){const n=t.toString(10);if(e<n.length)return"";const r=e-n.length,i=new Array(r);for(let a=0;a<r;a++)i[a]="0";return i.join("").concat(n)}/*!
|
|
68
68
|
* Copyright (c) 2014, GMO GlobalSign
|
|
69
69
|
* Copyright (c) 2015-2022, Peculiar Ventures
|
|
70
70
|
* All rights reserved.
|
|
@@ -96,11 +96,11 @@ and limitations under the License.
|
|
|
96
96
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
97
97
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
98
98
|
*
|
|
99
|
-
*/function No(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Yd(t){let e=0,n=0;for(let i=0;i<t.length;i++){const o=t[i];e+=o.byteLength}const r=new Uint8Array(e);for(let i=0;i<t.length;i++){const o=t[i];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function Yt(t,e,n,r){return e instanceof Uint8Array?e.byteLength?n<0?(t.error="Wrong parameter: inputOffset less than zero",!1):r<0?(t.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-n-r<0?(t.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(t.error="Wrong parameter: inputBuffer has zero length",!1):(t.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class Ns{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Yd(this.items)}}const Mr=[new Uint8Array([1])],qu="0123456789",Ia="name",Hu="valueHexView",C2="isHexOnly",j2="idBlock",O2="tagClass",P2="tagNumber",T2="isConstructed",R2="fromBER",B2="toBER",L2="local",Je="",$t=new ArrayBuffer(0),Cs=new Uint8Array(0),ei="EndOfContent",k0="OCTET STRING",S0="BIT STRING";function Pt(t){var e;return e=class extends t{constructor(...r){var i;super(...r);const o=r[0]||{};this.isHexOnly=(i=o.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=o.valueHex?D.toUint8Array(o.valueHex):Cs}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(r){this.valueHexView=new Uint8Array(r)}fromBER(r,i,o){const a=r instanceof ArrayBuffer?new Uint8Array(r):r;if(!Yt(this,a,i,o))return-1;const c=i+o;return this.valueHexView=a.subarray(i,c),this.valueHexView.length?(this.blockLength=o,c):(this.warnings.push("Zero buffer length"),i)}toBER(r=!1){return this.isHexOnly?r?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",$t)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:J.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class qn{constructor({blockLength:e=0,error:n=Je,warnings:r=[],valueBeforeDecode:i=Cs}={}){this.blockLength=e,this.error=n,this.warnings=r,this.valueBeforeDecodeView=D.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:J.ToHex(this.valueBeforeDecodeView)}}}qn.NAME="baseBlock";class Ke extends qn{fromBER(e,n,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Ke.NAME="valueBlock";class A0 extends Pt(qn){constructor({idBlock:e={}}={}){var n,r,i,o;super(),e?(this.isHexOnly=(n=e.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=e.valueHex?D.toUint8Array(e.valueHex):Cs,this.tagClass=(r=e.tagClass)!==null&&r!==void 0?r:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let n=0;switch(this.tagClass){case 1:n|=0;break;case 2:n|=64;break;case 3:n|=128;break;case 4:n|=192;break;default:return this.error="Unknown tag class",$t}if(this.isConstructed&&(n|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,n|=o,i[0]=n}return i.buffer}if(!this.isHexOnly){const i=Nn(this.tagNumber,7),o=new Uint8Array(i),a=i.byteLength,c=new Uint8Array(a+1);if(c[0]=n|31,!e){for(let d=0;d<a-1;d++)c[d+1]=o[d]|128;c[a]=o[a-1]}return c.buffer}const r=new Uint8Array(this.valueHexView.byteLength+1);if(r[0]=n|31,!e){const i=this.valueHexView;for(let o=0;o<i.length-1;o++)r[o+1]=i[o]|128;r[this.valueHexView.byteLength]=i[i.length-1]}return r.buffer}fromBER(e,n,r){const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(o[0]&32)===32,this.isHexOnly=!1;const c=o[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let d=1,l=this.valueHexView=new Uint8Array(255),u=255;for(;o[d]&128;){if(l[d-1]=o[d]&127,d++,d>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(d===u){u+=255;const m=new Uint8Array(u);for(let w=0;w<l.length;w++)m[w]=l[w];l=this.valueHexView=new Uint8Array(u)}}this.blockLength=d+1,l[d-1]=o[d]&127;const f=new Uint8Array(d);for(let m=0;m<d;m++)f[m]=l[m];l=this.valueHexView=new Uint8Array(d),l.set(f),this.blockLength<=9?this.tagNumber=lr(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return n+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}A0.NAME="identificationBlock";class E0 extends qn{constructor({lenBlock:e={}}={}){var n,r,i;super(),this.isIndefiniteForm=(n=e.isIndefiniteForm)!==null&&n!==void 0?n:!1,this.longFormUsed=(r=e.longFormUsed)!==null&&r!==void 0?r:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,n,r){const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,n+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,n+this.blockLength;const a=o[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const c=n+1,d=i.subarray(c,c+a);return d[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=lr(d,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,n+this.blockLength}toBER(e=!1){let n,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return n=new ArrayBuffer(1),e===!1&&(r=new Uint8Array(n),r[0]=128),n;if(this.longFormUsed){const i=Nn(this.length,8);if(i.byteLength>127)return this.error="Too big length",$t;if(n=new ArrayBuffer(i.byteLength+1),e)return n;const o=new Uint8Array(i);r=new Uint8Array(n),r[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)r[a+1]=o[a];return n}return n=new ArrayBuffer(1),e===!1&&(r=new Uint8Array(n),r[0]=this.length),n}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}E0.NAME="lengthBlock";const K={};class Ue extends qn{constructor({name:e=Je,optional:n=!1,primitiveSchema:r,...i}={},o){super(i),this.name=e,this.optional=n,r&&(this.primitiveSchema=r),this.idBlock=new A0(i),this.lenBlock=new E0(i),this.valueBlock=o?new o(i):new Ke(i)}fromBER(e,n,r){const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}toBER(e,n){const r=n||new Ns;n||z0(this);const i=this.idBlock.toBER(e);if(r.write(i),this.lenBlock.isIndefiniteForm)r.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,r),r.write(new ArrayBuffer(2));else{const o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;const a=this.lenBlock.toBER(e);r.write(a),r.write(o)}return n?$t:r.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():J.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${J.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const n=this.toBER(),r=e.toBER();return N2(n,r)}}Ue.NAME="BaseBlock";function z0(t){if(t instanceof K.Constructed)for(const e of t.valueBlock.value)z0(e)&&(t.lenBlock.isIndefiniteForm=!0);return!!t.lenBlock.isIndefiniteForm}class Qd extends Ue{constructor({value:e=Je,...n}={},r){super(n,r),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,n,r){const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Qd.NAME="BaseStringBlock";class I0 extends Pt(Ke){constructor({isHexOnly:e=!0,...n}={}){super(n),this.isHexOnly=e}}I0.NAME="PrimitiveValueBlock";var N0;class bi extends Ue{constructor(e={}){super(e,I0),this.idBlock.isConstructed=!1}}N0=bi;K.Primitive=N0;bi.NAME="PRIMITIVE";function U2(t,e){if(t instanceof e)return t;const n=new e;return n.idBlock=t.idBlock,n.lenBlock=t.lenBlock,n.warnings=t.warnings,n.valueBeforeDecodeView=t.valueBeforeDecodeView,n}function Sr(t,e=0,n=t.length){const r=e;let i=new Ue({},Ke);const o=new qn;if(!Yt(o,t,e,n))return i.error=o.error,{offset:-1,result:i};if(!t.subarray(e,e+n).length)return i.error="Zero buffer length",{offset:-1,result:i};let c=i.idBlock.fromBER(t,e,n);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),c===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=c,n-=i.idBlock.blockLength,c=i.lenBlock.fromBER(t,e,n),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),c===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=c,n-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let d=Ue;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};d=K.EndOfContent;break;case 1:d=K.Boolean;break;case 2:d=K.Integer;break;case 3:d=K.BitString;break;case 4:d=K.OctetString;break;case 5:d=K.Null;break;case 6:d=K.ObjectIdentifier;break;case 10:d=K.Enumerated;break;case 12:d=K.Utf8String;break;case 13:d=K.RelativeObjectIdentifier;break;case 14:d=K.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:d=K.Sequence;break;case 17:d=K.Set;break;case 18:d=K.NumericString;break;case 19:d=K.PrintableString;break;case 20:d=K.TeletexString;break;case 21:d=K.VideotexString;break;case 22:d=K.IA5String;break;case 23:d=K.UTCTime;break;case 24:d=K.GeneralizedTime;break;case 25:d=K.GraphicString;break;case 26:d=K.VisibleString;break;case 27:d=K.GeneralString;break;case 28:d=K.UniversalString;break;case 29:d=K.CharacterString;break;case 30:d=K.BmpString;break;case 31:d=K.DATE;break;case 32:d=K.TimeOfDay;break;case 33:d=K.DateTime;break;case 34:d=K.Duration;break;default:{const l=i.idBlock.isConstructed?new K.Constructed:new K.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:d=i.idBlock.isConstructed?K.Constructed:K.Primitive}return i=U2(i,d),c=i.fromBER(t,e,i.lenBlock.isIndefiniteForm?n:i.lenBlock.length),i.valueBeforeDecodeView=t.subarray(r,r+i.blockLength),{offset:c,result:i}}function sr(t){if(!t.byteLength){const e=new Ue({},Ke);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Sr(D.toUint8Array(t).slice(),0,t.byteLength)}function M2(t,e){return t?1:e}class an extends Ke{constructor({value:e=[],isIndefiniteForm:n=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=n}fromBER(e,n,r){const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;if(this.valueBeforeDecodeView=i.subarray(n,n+r),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),n;let o=n;for(;M2(this.isIndefiniteForm,r)>0;){const a=Sr(i,o,r);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(o=a.offset,this.blockLength+=a.result.blockLength,r-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===ei)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ei?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,n){const r=n||new Ns;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,r);return n?$t:r.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const n of this.value)e.value.push(n.toJSON());return e}}an.NAME="ConstructedValueBlock";var C0;class Xe extends Ue{constructor(e={}){super(e,an),this.idBlock.isConstructed=!0}fromBER(e,n,r){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){const e=[];for(const r of this.valueBlock.value)e.push(r.toString("ascii").split(`
|
|
99
|
+
*/function Io(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Yd(t){let e=0,n=0;for(let i=0;i<t.length;i++){const o=t[i];e+=o.byteLength}const r=new Uint8Array(e);for(let i=0;i<t.length;i++){const o=t[i];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function Yt(t,e,n,r){return e instanceof Uint8Array?e.byteLength?n<0?(t.error="Wrong parameter: inputOffset less than zero",!1):r<0?(t.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-n-r<0?(t.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(t.error="Wrong parameter: inputBuffer has zero length",!1):(t.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class zs{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Yd(this.items)}}const Mr=[new Uint8Array([1])],qu="0123456789",za="name",Hu="valueHexView",C2="isHexOnly",j2="idBlock",O2="tagClass",P2="tagNumber",T2="isConstructed",R2="fromBER",B2="toBER",L2="local",Je="",$t=new ArrayBuffer(0),Is=new Uint8Array(0),ti="EndOfContent",k0="OCTET STRING",S0="BIT STRING";function Pt(t){var e;return e=class extends t{constructor(...r){var i;super(...r);const o=r[0]||{};this.isHexOnly=(i=o.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=o.valueHex?D.toUint8Array(o.valueHex):Is}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(r){this.valueHexView=new Uint8Array(r)}fromBER(r,i,o){const a=r instanceof ArrayBuffer?new Uint8Array(r):r;if(!Yt(this,a,i,o))return-1;const c=i+o;return this.valueHexView=a.subarray(i,c),this.valueHexView.length?(this.blockLength=o,c):(this.warnings.push("Zero buffer length"),i)}toBER(r=!1){return this.isHexOnly?r?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",$t)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:J.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class qn{constructor({blockLength:e=0,error:n=Je,warnings:r=[],valueBeforeDecode:i=Is}={}){this.blockLength=e,this.error=n,this.warnings=r,this.valueBeforeDecodeView=D.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:J.ToHex(this.valueBeforeDecodeView)}}}qn.NAME="baseBlock";class Ke extends qn{fromBER(e,n,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Ke.NAME="valueBlock";class A0 extends Pt(qn){constructor({idBlock:e={}}={}){var n,r,i,o;super(),e?(this.isHexOnly=(n=e.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=e.valueHex?D.toUint8Array(e.valueHex):Is,this.tagClass=(r=e.tagClass)!==null&&r!==void 0?r:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let n=0;switch(this.tagClass){case 1:n|=0;break;case 2:n|=64;break;case 3:n|=128;break;case 4:n|=192;break;default:return this.error="Unknown tag class",$t}if(this.isConstructed&&(n|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,n|=o,i[0]=n}return i.buffer}if(!this.isHexOnly){const i=Nn(this.tagNumber,7),o=new Uint8Array(i),a=i.byteLength,c=new Uint8Array(a+1);if(c[0]=n|31,!e){for(let d=0;d<a-1;d++)c[d+1]=o[d]|128;c[a]=o[a-1]}return c.buffer}const r=new Uint8Array(this.valueHexView.byteLength+1);if(r[0]=n|31,!e){const i=this.valueHexView;for(let o=0;o<i.length-1;o++)r[o+1]=i[o]|128;r[this.valueHexView.byteLength]=i[i.length-1]}return r.buffer}fromBER(e,n,r){const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(o[0]&32)===32,this.isHexOnly=!1;const c=o[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let d=1,l=this.valueHexView=new Uint8Array(255),u=255;for(;o[d]&128;){if(l[d-1]=o[d]&127,d++,d>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(d===u){u+=255;const m=new Uint8Array(u);for(let w=0;w<l.length;w++)m[w]=l[w];l=this.valueHexView=new Uint8Array(u)}}this.blockLength=d+1,l[d-1]=o[d]&127;const f=new Uint8Array(d);for(let m=0;m<d;m++)f[m]=l[m];l=this.valueHexView=new Uint8Array(d),l.set(f),this.blockLength<=9?this.tagNumber=lr(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return n+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}A0.NAME="identificationBlock";class E0 extends qn{constructor({lenBlock:e={}}={}){var n,r,i;super(),this.isIndefiniteForm=(n=e.isIndefiniteForm)!==null&&n!==void 0?n:!1,this.longFormUsed=(r=e.longFormUsed)!==null&&r!==void 0?r:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,n,r){const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,n+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,n+this.blockLength;const a=o[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const c=n+1,d=i.subarray(c,c+a);return d[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=lr(d,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,n+this.blockLength}toBER(e=!1){let n,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return n=new ArrayBuffer(1),e===!1&&(r=new Uint8Array(n),r[0]=128),n;if(this.longFormUsed){const i=Nn(this.length,8);if(i.byteLength>127)return this.error="Too big length",$t;if(n=new ArrayBuffer(i.byteLength+1),e)return n;const o=new Uint8Array(i);r=new Uint8Array(n),r[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)r[a+1]=o[a];return n}return n=new ArrayBuffer(1),e===!1&&(r=new Uint8Array(n),r[0]=this.length),n}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}E0.NAME="lengthBlock";const K={};class Ue extends qn{constructor({name:e=Je,optional:n=!1,primitiveSchema:r,...i}={},o){super(i),this.name=e,this.optional=n,r&&(this.primitiveSchema=r),this.idBlock=new A0(i),this.lenBlock=new E0(i),this.valueBlock=o?new o(i):new Ke(i)}fromBER(e,n,r){const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}toBER(e,n){const r=n||new zs;n||z0(this);const i=this.idBlock.toBER(e);if(r.write(i),this.lenBlock.isIndefiniteForm)r.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,r),r.write(new ArrayBuffer(2));else{const o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;const a=this.lenBlock.toBER(e);r.write(a),r.write(o)}return n?$t:r.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():J.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${J.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const n=this.toBER(),r=e.toBER();return N2(n,r)}}Ue.NAME="BaseBlock";function z0(t){if(t instanceof K.Constructed)for(const e of t.valueBlock.value)z0(e)&&(t.lenBlock.isIndefiniteForm=!0);return!!t.lenBlock.isIndefiniteForm}class Qd extends Ue{constructor({value:e=Je,...n}={},r){super(n,r),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,n,r){const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Qd.NAME="BaseStringBlock";class I0 extends Pt(Ke){constructor({isHexOnly:e=!0,...n}={}){super(n),this.isHexOnly=e}}I0.NAME="PrimitiveValueBlock";var N0;class bi extends Ue{constructor(e={}){super(e,I0),this.idBlock.isConstructed=!1}}N0=bi;K.Primitive=N0;bi.NAME="PRIMITIVE";function U2(t,e){if(t instanceof e)return t;const n=new e;return n.idBlock=t.idBlock,n.lenBlock=t.lenBlock,n.warnings=t.warnings,n.valueBeforeDecodeView=t.valueBeforeDecodeView,n}function Sr(t,e=0,n=t.length){const r=e;let i=new Ue({},Ke);const o=new qn;if(!Yt(o,t,e,n))return i.error=o.error,{offset:-1,result:i};if(!t.subarray(e,e+n).length)return i.error="Zero buffer length",{offset:-1,result:i};let c=i.idBlock.fromBER(t,e,n);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),c===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=c,n-=i.idBlock.blockLength,c=i.lenBlock.fromBER(t,e,n),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),c===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=c,n-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let d=Ue;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};d=K.EndOfContent;break;case 1:d=K.Boolean;break;case 2:d=K.Integer;break;case 3:d=K.BitString;break;case 4:d=K.OctetString;break;case 5:d=K.Null;break;case 6:d=K.ObjectIdentifier;break;case 10:d=K.Enumerated;break;case 12:d=K.Utf8String;break;case 13:d=K.RelativeObjectIdentifier;break;case 14:d=K.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:d=K.Sequence;break;case 17:d=K.Set;break;case 18:d=K.NumericString;break;case 19:d=K.PrintableString;break;case 20:d=K.TeletexString;break;case 21:d=K.VideotexString;break;case 22:d=K.IA5String;break;case 23:d=K.UTCTime;break;case 24:d=K.GeneralizedTime;break;case 25:d=K.GraphicString;break;case 26:d=K.VisibleString;break;case 27:d=K.GeneralString;break;case 28:d=K.UniversalString;break;case 29:d=K.CharacterString;break;case 30:d=K.BmpString;break;case 31:d=K.DATE;break;case 32:d=K.TimeOfDay;break;case 33:d=K.DateTime;break;case 34:d=K.Duration;break;default:{const l=i.idBlock.isConstructed?new K.Constructed:new K.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:d=i.idBlock.isConstructed?K.Constructed:K.Primitive}return i=U2(i,d),c=i.fromBER(t,e,i.lenBlock.isIndefiniteForm?n:i.lenBlock.length),i.valueBeforeDecodeView=t.subarray(r,r+i.blockLength),{offset:c,result:i}}function sr(t){if(!t.byteLength){const e=new Ue({},Ke);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Sr(D.toUint8Array(t).slice(),0,t.byteLength)}function M2(t,e){return t?1:e}class an extends Ke{constructor({value:e=[],isIndefiniteForm:n=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=n}fromBER(e,n,r){const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;if(this.valueBeforeDecodeView=i.subarray(n,n+r),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),n;let o=n;for(;M2(this.isIndefiniteForm,r)>0;){const a=Sr(i,o,r);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(o=a.offset,this.blockLength+=a.result.blockLength,r-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===ti)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ti?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,n){const r=n||new zs;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,r);return n?$t:r.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const n of this.value)e.value.push(n.toJSON());return e}}an.NAME="ConstructedValueBlock";var C0;class Xe extends Ue{constructor(e={}){super(e,an),this.idBlock.isConstructed=!0}fromBER(e,n,r){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){const e=[];for(const r of this.valueBlock.value)e.push(r.toString("ascii").split(`
|
|
100
100
|
`).map(i=>` ${i}`).join(`
|
|
101
101
|
`));const n=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${n} :
|
|
102
102
|
${e.join(`
|
|
103
|
-
`)}`:`${n} :`}}C0=Xe;K.Constructed=C0;Xe.NAME="CONSTRUCTED";class j0 extends Ke{fromBER(e,n,r){return n}toBER(e){return $t}}j0.override="EndOfContentValueBlock";var O0;class el extends Ue{constructor(e={}){super(e,j0),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}O0=el;K.EndOfContent=O0;el.NAME=ei;var P0;class Cn extends Ue{constructor(e={}){super(e,Ke),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,n,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,n+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):n+r}toBER(e,n){const r=new ArrayBuffer(2);if(!e){const i=new Uint8Array(r);i[0]=5,i[1]=0}return n&&n.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}P0=Cn;K.Null=P0;Cn.NAME="NULL";class T0 extends Pt(Ke){constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=D.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,n,r){const i=D.toUint8Array(e);return Yt(this,i,n,r)?(this.valueHexView=i.subarray(n,n+r),r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,x0.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}T0.NAME="BooleanValueBlock";var R0;let js=class extends Ue{constructor(e={}){super(e,T0),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};R0=js;K.Boolean=R0;js.NAME="BOOLEAN";class B0 extends Pt(an){constructor({isConstructed:e=!1,...n}={}){super(n),this.isConstructed=e}fromBER(e,n,r){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=an.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let o=0;o<this.value.length;o++){const a=this.value[o].constructor.NAME;if(a===ei){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==k0)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,n,r),this.blockLength=r;return i}toBER(e,n){return this.isConstructed?an.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}B0.NAME="OctetStringValueBlock";var L0;let zn=class U0 extends Ue{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},B0),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,n,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,r===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),n;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(o.byteLength){const a=Sr(o,0,o.byteLength);a.offset!==-1&&a.offset===r&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Xe.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${J.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof U0&&e.push(n.valueBlock.valueHexView);return D.concat(e)}};L0=zn;K.OctetString=L0;zn.NAME=k0;class M0 extends Pt(an){constructor({unusedBits:e=0,isConstructed:n=!1,...r}={}){super(r),this.unusedBits=e,this.isConstructed=n,this.blockLength=this.valueHexView.byteLength}fromBER(e,n,r){if(!r)return n;let i=-1;if(this.isConstructed){if(i=an.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const c of this.value){const d=c.constructor.NAME;if(d===ei){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(d!==S0)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const l=c.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return i}const o=D.toUint8Array(e);if(!Yt(this,o,n,r))return-1;const a=o.subarray(n,n+r);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=a.subarray(1);try{if(c.byteLength){const d=Sr(c,0,c.byteLength);d.offset!==-1&&d.offset===r-1&&(this.value=[d.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,n+r}toBER(e,n){if(this.isConstructed)return an.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return $t;const r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}M0.NAME="BitStringValueBlock";var F0;let In=class extends Ue{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},M0),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,n,r){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Xe.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const i of n)e.push(i.toString(2).padStart(8,"0"));const r=e.join("");return`${this.constructor.NAME} : ${r.substring(0,r.length-this.valueBlock.unusedBits)}`}}};F0=In;K.BitString=F0;In.NAME=S0;var D0;function F2(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let o=r.slice(0);const a=o.length-1,c=i.slice(0),d=c.length-1;let l=0;const u=d<a?a:d;let f=0;for(let m=u;m>=0;m--,f++){switch(!0){case f<c.length:l=o[a-f]+c[d-f]+n[0];break;default:l=o[a-f]+n[0]}switch(n[0]=l/10,!0){case f>=o.length:o=sc(new Uint8Array([l%10]),o);break;default:o[a-f]=l%10}}return n[0]>0&&(o=sc(n,o)),o}function Ku(t){if(t>=Mr.length)for(let e=Mr.length;e<=t;e++){const n=new Uint8Array([0]);let r=Mr[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const o=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=o[0]/10,r[i]=o[0]%10}n[0]>0&&(r=sc(n,r)),Mr.push(r)}return Mr[t]}function D2(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),o=r.slice(0),a=o.length-1,c=i.slice(0),d=c.length-1;let l,u=0;for(let f=d;f>=0;f--,u++)switch(l=o[a-u]-c[d-u]-n,!0){case l<0:n=1,o[a-u]=l+10;break;default:n=0,o[a-u]=l}if(n>0)for(let f=a-d+1;f>=0;f--,u++)if(l=o[a-u]-n,l<0)n=1,o[a-u]=l+10;else{n=0,o[a-u]=l;break}return o.slice()}class tl extends Pt(Ke){constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=x0.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(I2(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const o=this.fromBER(e,n,r);if(o===-1)return o;const a=this.valueHexView;return a[0]===0&&a[1]&128?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),o}toDER(e=!1){const n=this.valueHexView;switch(!0){case(n[0]&128)!==0:{const r=new Uint8Array(this.valueHexView.length+1);r[0]=0,r.set(n,1),this.valueHexView=r}break;case(n[0]===0&&(n[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,n,r){const i=super.fromBER(e,n,r);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let n=new Uint8Array(this.valueHexView.length*8/3),r=0,i;const o=this.valueHexView;let a="",c=!1;for(let d=o.byteLength-1;d>=0;d--){i=o[d];for(let l=0;l<8;l++){if((i&1)===1)switch(r){case e:n=D2(Ku(r),n),a="-";break;default:n=F2(n,Ku(r))}r++,i>>=1}}for(let d=0;d<n.length;d++)n[d]&&(c=!0),c&&(a+=qu.charAt(n[d]));return c===!1&&(a+=qu.charAt(0)),a}}D0=tl;tl.NAME="IntegerValueBlock";Object.defineProperty(D0.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var V0;class Nt extends Ue{constructor(e={}){super(e,tl),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return No(),BigInt(this.valueBlock.toString())}static fromBigInt(e){No();const n=BigInt(e),r=new Ns,i=n.toString(16).replace(/^-/,""),o=new Uint8Array(J.FromHex(i));if(n<0){const c=new Uint8Array(o.length+(o[0]&128?1:0));c[0]|=128;const l=BigInt(`0x${J.ToHex(c)}`)+n,u=D.toUint8Array(J.FromHex(l.toString(16)));u[0]|=128,r.write(u)}else o[0]&128&&r.write(new Uint8Array([0])),r.write(o);return new Nt({valueHex:r.final()})}convertToDER(){const e=new Nt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new Nt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}V0=Nt;K.Integer=V0;Nt.NAME="INTEGER";var q0;class Os extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}q0=Os;K.Enumerated=q0;Os.NAME="ENUMERATED";class ac extends Pt(Ke){constructor({valueDec:e=-1,isFirstSid:n=!1,...r}={}){super(r),this.valueDec=e,this.isFirstSid=n}fromBER(e,n,r){if(!r)return n;const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let c=0;c<r&&(this.valueHexView[c]=o[c]&127,this.blockLength++,!!(o[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=lr(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){No();let n=BigInt(e).toString(2);for(;n.length%7;)n="0"+n;const r=new Uint8Array(n.length/7);for(let i=0;i<r.length;i++)r[i]=parseInt(n.slice(i*7,i*7+7),2)+(i+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Nn(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",$t;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r}toString(){let e="";if(this.isHexOnly)e=J.ToHex(this.valueHexView);else if(this.isFirstSid){let n=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",n-=40):(e="2.",n-=80),e+=n.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}ac.NAME="sidBlock";class H0 extends Ke{constructor({value:e=Je,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new ac;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e){const n=[];for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(i.byteLength===0)return this.error=this.value[r].error,$t;n.push(i)}return Yd(n)}fromString(e){this.value=[];let n=0,r=0,i="",o=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,o){const a=this.value[0];let c=0;switch(a.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const d=parseInt(i,10);if(isNaN(d))return;a.valueDec=d+c,o=!1}else{const a=new ac;if(i>Number.MAX_SAFE_INTEGER){No();const c=BigInt(i);a.valueBigInt=c}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,o=!0),this.value.push(a)}while(r!==-1)}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n?(i=`{${i}}`,this.value[r].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}H0.NAME="ObjectIdentifierValueBlock";var K0;class Ps extends Ue{constructor(e={}){super(e,H0),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}K0=Ps;K.ObjectIdentifier=K0;Ps.NAME="OBJECT IDENTIFIER";class cc extends Pt(qn){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let c=0;c<r&&(this.valueHexView[c]=o[c]&127,this.blockLength++,!!(o[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=lr(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Nn(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",$t;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r.buffer}toString(){let e="";return this.isHexOnly?e=J.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}cc.NAME="relativeSidBlock";class G0 extends Ke{constructor({value:e=Je,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new cc;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,$t;r.push(o)}return Yd(r)}fromString(e){this.value=[];let n=0,r=0,i="";do{r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1;const o=new cc;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(r!==-1);return!0}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n&&(i=`{${i}}`),e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}G0.NAME="RelativeObjectIdentifierValueBlock";var W0;class nl extends Ue{constructor(e={}){super(e,G0),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}W0=nl;K.RelativeObjectIdentifier=W0;nl.NAME="RelativeObjectIdentifier";var J0;class Mt extends Xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}J0=Mt;K.Sequence=J0;Mt.NAME="SEQUENCE";var X0;let Ft=class extends Xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};X0=Ft;K.Set=X0;Ft.NAME="SET";class Z0 extends Pt(Ke){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Je}toJSON(){return{...super.toJSON(),value:this.value}}}Z0.NAME="StringValueBlock";class Y0 extends Z0{}Y0.NAME="SimpleStringValueBlock";class nt extends Qd{constructor({...e}={}){super(e,Y0)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,D.toUint8Array(e))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);this.valueBlock.value=e}}nt.NAME="SIMPLE STRING";class Q0 extends nt{fromBuffer(e){this.valueBlock.valueHexView=D.toUint8Array(e);try{this.valueBlock.value=J.ToUtf8String(e)}catch(n){this.warnings.push(`Error during "decodeURIComponent": ${n}, using raw string`),this.valueBlock.value=J.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(J.FromUtf8String(e)),this.valueBlock.value=e}}Q0.NAME="Utf8StringValueBlock";var eg;class Qt extends Q0{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}eg=Qt;K.Utf8String=eg;Qt.NAME="UTF8String";class tg extends nt{fromBuffer(e){this.valueBlock.value=J.ToUtf16String(e),this.valueBlock.valueHexView=D.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(J.FromUtf16String(e))}}tg.NAME="BmpStringValueBlock";var ng;class Ts extends tg{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}ng=Ts;K.BmpString=ng;Ts.NAME="BMPString";class rg extends nt{fromBuffer(e){const n=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),r=new Uint8Array(n);for(let i=0;i<r.length;i+=4)r[i]=r[i+3],r[i+1]=r[i+2],r[i+2]=0,r[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(n))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n*4);for(let i=0;i<n;i++){const o=Nn(e.charCodeAt(i),8),a=new Uint8Array(o);if(a.length>4)continue;const c=4-a.length;for(let d=a.length-1;d>=0;d--)r[i*4+d+c]=a[d]}this.valueBlock.value=e}}rg.NAME="UniversalStringValueBlock";var ig;class Rs extends rg{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}ig=Rs;K.UniversalString=ig;Rs.NAME="UniversalString";var og;class Bs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}og=Bs;K.NumericString=og;Bs.NAME="NumericString";var sg;class Ls extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}sg=Ls;K.PrintableString=sg;Ls.NAME="PrintableString";var ag;class Us extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}ag=Us;K.TeletexString=ag;Us.NAME="TeletexString";var cg;class Ms extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}cg=Ms;K.VideotexString=cg;Ms.NAME="VideotexString";var dg;class Fs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}dg=Fs;K.IA5String=dg;Fs.NAME="IA5String";var lg;class Ds extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}lg=Ds;K.GraphicString=lg;Ds.NAME="GraphicString";var ug;class $i extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}ug=$i;K.VisibleString=ug;$i.NAME="VisibleString";var pg;class Vs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}pg=Vs;K.GeneralString=pg;Vs.NAME="GeneralString";var fg;class qs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}fg=qs;K.CharacterString=fg;qs.NAME="CharacterString";var hg;class xi extends $i{constructor({value:e,valueDate:n,...r}={}){if(super(r),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}n&&(this.fromDate(n),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,D.toUint8Array(e)))}toBuffer(){const e=this.toString(),n=new ArrayBuffer(e.length),r=new Uint8Array(n);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return n}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const r=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(r===null){this.error="Wrong input string for conversion";return}const i=parseInt(r[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(r[2],10),this.day=parseInt(r[3],10),this.hour=parseInt(r[4],10),this.minute=parseInt(r[5],10),this.second=parseInt(r[6],10)}toString(e="iso"){if(e==="iso"){const n=new Array(7);return n[0]=et(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=et(this.month,2),n[2]=et(this.day,2),n[3]=et(this.hour,2),n[4]=et(this.minute,2),n[5]=et(this.second,2),n[6]="Z",n.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}hg=xi;K.UTCTime=hg;xi.NAME="UTCTime";var gg;class Hs extends xi{constructor(e={}){var n;super(e),(n=this.millisecond)!==null&&n!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let n=!1,r="",i="",o=0,a,c=0,d=0;if(e[e.length-1]==="Z")r=e.substring(0,e.length-1),n=!0;else{const f=new Number(e[e.length-1]);if(isNaN(f.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(r.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(r.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let f=1,m=r.indexOf("+"),w="";if(m===-1&&(m=r.indexOf("-"),f=-1),m!==-1){if(w=r.substring(m+1),r=r.substring(0,m),w.length!==2&&w.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(w.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=f*h,w.length===4){if(h=parseInt(w.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");d=f*h}}}let l=r.indexOf(".");if(l===-1&&(l=r.indexOf(",")),l!==-1){const f=new Number(`0${r.substring(l)}`);if(isNaN(f.valueOf()))throw new Error("Wrong input string for conversion");o=f.valueOf(),i=r.substring(0,l)}else i=r;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let f=60*o;this.minute=Math.floor(f),f=60*(f-this.minute),this.second=Math.floor(f),f=1e3*(f-this.second),this.millisecond=Math.floor(f)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let f=60*o;this.second=Math.floor(f),f=1e3*(f-this.second),this.millisecond=Math.floor(f)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){const f=1e3*o;this.millisecond=Math.floor(f)}break;default:throw new Error("Wrong input string for conversion")}const u=a.exec(i);if(u===null)throw new Error("Wrong input string for conversion");for(let f=1;f<u.length;f++)switch(f){case 1:this.year=parseInt(u[f],10);break;case 2:this.month=parseInt(u[f],10);break;case 3:this.day=parseInt(u[f],10);break;case 4:this.hour=parseInt(u[f],10)+c;break;case 5:this.minute=parseInt(u[f],10)+d;break;case 6:this.second=parseInt(u[f],10);break;default:throw new Error("Wrong input string for conversion")}if(n===!1){const f=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=f.getUTCFullYear(),this.month=f.getUTCMonth(),this.day=f.getUTCDay(),this.hour=f.getUTCHours(),this.minute=f.getUTCMinutes(),this.second=f.getUTCSeconds(),this.millisecond=f.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const n=[];return n.push(et(this.year,4)),n.push(et(this.month,2)),n.push(et(this.day,2)),n.push(et(this.hour,2)),n.push(et(this.minute,2)),n.push(et(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(et(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}gg=Hs;K.GeneralizedTime=gg;Hs.NAME="GeneralizedTime";var mg;class rl extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}mg=rl;K.DATE=mg;rl.NAME="DATE";var _g;class il extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}_g=il;K.TimeOfDay=_g;il.NAME="TimeOfDay";var yg;class ol extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}yg=ol;K.DateTime=yg;ol.NAME="DateTime";var wg;class sl extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}wg=sl;K.Duration=wg;sl.NAME="Duration";var vg;class al extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}vg=al;K.TIME=vg;al.NAME="TIME";class jn{constructor({name:e=Je,optional:n=!1}={}){this.name=e,this.optional=n}}class cl extends jn{constructor({value:e=[],...n}={}){super(n),this.value=e}}class Co extends jn{constructor({value:e=new jn,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class V2{constructor({data:e=Cs}={}){this.dataView=D.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=D.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=D.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function Sn(t,e,n){if(n instanceof cl){for(let o=0;o<n.value.length;o++)if(Sn(t,e,n.value[o]).verified)return{verified:!0,result:t};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Ia)&&(o.name=n.name),o}}if(n instanceof jn)return n.hasOwnProperty(Ia)&&(t[n.name]=e),{verified:!0,result:t};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(j2 in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(R2 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(B2 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=n.idBlock.toBER(!1);if(r.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(n.idBlock.fromBER(r,0,r.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(n.idBlock.hasOwnProperty(O2)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(P2)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(T2)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(C2 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(n.idBlock.isHexOnly){if(!(Hu in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=n.idBlock.valueHexView,a=e.idBlock.valueHexView;if(o.length!==a.length)return{verified:!1,result:t};for(let c=0;c<o.length;c++)if(o[c]!==a[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(t[n.name]=e)),n instanceof K.Constructed){let o=0,a={verified:!1,result:{error:"Unknown error"}},c=n.valueBlock.value.length;if(c>0&&n.valueBlock.value[0]instanceof Co&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&n.valueBlock.value.length!==0){let d=!0;for(let l=0;l<n.valueBlock.value.length;l++)d=d&&(n.valueBlock.value[l].optional||!1);return d?{verified:!0,result:t}:(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let d=0;d<c;d++)if(d-o>=e.valueBlock.value.length){if(n.valueBlock.value[d].optional===!1){const l={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(delete t[n.name],l.name=n.name)),l}}else if(n.valueBlock.value[0]instanceof Co){if(a=Sn(t,e.valueBlock.value[d],n.valueBlock.value[0].value),a.verified===!1)if(n.valueBlock.value[0].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&delete t[n.name]),a;if(Ia in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let l={};L2 in n.valueBlock.value[0]&&n.valueBlock.value[0].local?l=e:l=t,typeof l[n.valueBlock.value[0].name]>"u"&&(l[n.valueBlock.value[0].name]=[]),l[n.valueBlock.value[0].name].push(e.valueBlock.value[d])}}else if(a=Sn(t,e.valueBlock.value[d-o],n.valueBlock.value[d]),a.verified===!1)if(n.valueBlock.value[d].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&delete t[n.name]),a;if(a.verified===!1){const d={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(delete t[n.name],d.name=n.name)),d}return{verified:!0,result:t}}if(n.primitiveSchema&&Hu in e.valueBlock){const o=Sr(e.valueBlock.valueHexView);if(o.offset===-1){const a={verified:!1,result:o.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(delete t[n.name],a.name=n.name)),a}return Sn(t,o.result,n.primitiveSchema)}return{verified:!0,result:t}}function q2(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Sr(D.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:Sn(n.result,n.result,e)}const bg=Object.freeze(Object.defineProperty({__proto__:null,Any:jn,BaseBlock:Ue,BaseStringBlock:Qd,BitString:In,BmpString:Ts,Boolean:js,CharacterString:qs,Choice:cl,Constructed:Xe,DATE:rl,DateTime:ol,Duration:sl,EndOfContent:el,Enumerated:Os,GeneralString:Vs,GeneralizedTime:Hs,GraphicString:Ds,HexBlock:Pt,IA5String:Fs,Integer:Nt,Null:Cn,NumericString:Bs,ObjectIdentifier:Ps,OctetString:zn,Primitive:bi,PrintableString:Ls,RawData:V2,RelativeObjectIdentifier:nl,Repeated:Co,Sequence:Mt,Set:Ft,TIME:al,TeletexString:Us,TimeOfDay:il,UTCTime:xi,UniversalString:Rs,Utf8String:Qt,ValueBlock:Ke,VideotexString:Ms,ViewWriter:Ns,VisibleString:$i,compareSchema:Sn,fromBER:sr,verifySchema:q2},Symbol.toStringTag,{value:"Module"}));var R;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(R||(R={}));var $;(function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"})($||($={}));class Ks{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(D.isBufferSource(e))this.unusedBits=n,this.value=D.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof In))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new In({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new In({name:e})}toNumber(){let e="";const n=new Uint8Array(this.value);for(const r of n)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let n=e.toString(2);const r=n.length+7>>3;this.unusedBits=(r<<3)-n.length;const i=new Uint8Array(r);n=n.padStart(r<<3,"0").split("").reverse().join("");let o=0;for(;o<r;)i[o]=parseInt(n.slice(o<<3,(o<<3)+8),2),o++;this.value=i.buffer}}class le{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):D.isBufferSource(e)?this.buffer=D.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof zn))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new zn({valueHex:this.buffer})}toSchema(e){return new zn({name:e})}}const H2={fromASN:t=>t instanceof Cn?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new Cn;const e=sr(t);if(e.result.error)throw new Error(e.result.error);return e.result}},K2={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new Nt({value:+t})},G2={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new Os({value:t})},_e={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Nt({valueHex:t})},W2={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new In({valueHex:t})},J2={fromASN:t=>t.valueBlock.toString(),toASN:t=>new Ps({value:t})},X2={fromASN:t=>t.valueBlock.value,toASN:t=>new js({value:t})},jo={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new zn({valueHex:t})},Z2={fromASN:t=>new le(t.getValue()),toASN:t=>t.toASN()};function lt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const $g=lt(Qt),Y2=lt(Ts),Q2=lt(Rs),ew=lt(Bs),tw=lt(Ls),nw=lt(Us),rw=lt(Ms),iw=lt(Fs),ow=lt(Ds),sw=lt($i),aw=lt(Vs),cw=lt(qs),dw={fromASN:t=>t.toDate(),toASN:t=>new xi({valueDate:t})},lw={fromASN:t=>t.toDate(),toASN:t=>new Hs({valueDate:t})},uw={fromASN:()=>null,toASN:()=>new Cn};function dl(t){switch(t){case $.Any:return H2;case $.BitString:return W2;case $.BmpString:return Y2;case $.Boolean:return X2;case $.CharacterString:return cw;case $.Enumerated:return G2;case $.GeneralString:return aw;case $.GeneralizedTime:return lw;case $.GraphicString:return ow;case $.IA5String:return iw;case $.Integer:return K2;case $.Null:return uw;case $.NumericString:return ew;case $.ObjectIdentifier:return J2;case $.OctetString:return jo;case $.PrintableString:return tw;case $.TeletexString:return nw;case $.UTCTime:return dw;case $.UniversalString:return Q2;case $.Utf8String:return $g;case $.VideotexString:return rw;case $.VisibleString:return sw;default:return null}}function Ut(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Ut(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function xg(t){var e;if(t){const n=Object.getPrototypeOf(t);return((e=n==null?void 0:n.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:xg(n)}return!1}function pw(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(n[i]!==r[i])return!1;return!0}class fw{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,n=!1){const r=this.items.get(e);if(!r)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(n&&!r.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return r}cache(e){const n=this.get(e);n.schema||(n.schema=this.create(e,!0))}createDefault(e){const n={type:R.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(n,r),n.items=Object.assign({},n.items,r.items)),n}create(e,n){const r=this.items.get(e)||this.createDefault(e),i=[];for(const o in r.items){const a=r.items[o],c=n?o:"";let d;if(typeof a.type=="number"){const u=$[a.type],f=bg[u];if(!f)throw new Error(`Cannot get ASN1 class by name '${u}'`);d=new f({name:c})}else Ut(a.type)?d=new a.type().toSchema(c):a.optional?this.get(a.type).type===R.Choice?d=new jn({name:c}):(d=this.create(a.type,!1),d.name=c):d=new jn({name:c});const l=!!a.optional||a.defaultValue!==void 0;if(a.repeated){d.name="";const u=a.repeated==="set"?Ft:Mt;d=new u({name:"",value:[new Co({name:c,value:d})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||Ut(a.type)){const u=a.repeated?Xe:bi;i.push(new u({name:c,optional:l,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const u=!!a.repeated;let f=u?d:this.get(a.type,!0).schema;f="valueBlock"in f?f.valueBlock.value:f.value,i.push(new Xe({name:u?"":c,optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:f}))}else i.push(new Xe({optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:[d]}));else d.optional=l,i.push(d)}switch(r.type){case R.Sequence:return new Mt({value:i,name:""});case R.Set:return new Ft({value:i,name:""});case R.Choice:return new cl({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,n){return this.items.set(e,n),this}findParentSchema(e){const n=Object.getPrototypeOf(e);return n?this.items.get(n)||this.findParentSchema(n):null}}const ot=new fw,B=t=>e=>{let n;ot.has(e)?n=ot.get(e):(n=ot.createDefault(e),ot.set(e,n)),Object.assign(n,t)},g=t=>(e,n)=>{let r;ot.has(e.constructor)?r=ot.get(e.constructor):(r=ot.createDefault(e.constructor),ot.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const o=dl(t.type);if(!o)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=o}r.items[n]=i};class Gu extends Error{constructor(){super(...arguments),this.schemas=[]}}class hw{static parse(e,n){const r=sr(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){var r;try{if(Ut(n))return new n().fromASN(e);const i=ot.get(n);ot.cache(n);let o=i.schema;if(e.constructor===Xe&&i.type!==R.Choice){o=new Xe({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(const d in i.items)delete e[d]}const a=Sn({},e,o);if(!a.verified)throw new Gu(`Data does not match to ${n.name} ASN1 schema. ${a.result.error}`);const c=new n;if(xg(n)){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const d=i.itemType;if(typeof d=="number"){const l=dl(d);if(!l)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);return n.from(e.valueBlock.value,u=>l.fromASN(u))}else return n.from(e.valueBlock.value,l=>this.fromASN(l,d))}for(const d in i.items){const l=a.result[d];if(!l)continue;const u=i.items[d],f=u.type;if(typeof f=="number"||Ut(f)){const m=(r=u.converter)!==null&&r!==void 0?r:Ut(f)?new f:null;if(!m)throw new Error("Converter is empty");if(u.repeated)if(u.implicit){const w=u.repeated==="sequence"?Mt:Ft,h=new w;h.valueBlock=l.valueBlock;const y=sr(h.toBER(!1));if(y.offset===-1)throw new Error(`Cannot parse the child item. ${y.result.error}`);if(!("value"in y.result.valueBlock&&Array.isArray(y.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const v=y.result.valueBlock.value;c[d]=Array.from(v,b=>m.fromASN(b))}else c[d]=Array.from(l,w=>m.fromASN(w));else{let w=l;if(u.implicit){let h;if(Ut(f))h=new f().toSchema("");else{const y=$[f],v=bg[y];if(!v)throw new Error(`Cannot get '${y}' class from asn1js module`);h=new v}h.valueBlock=w.valueBlock,w=sr(h.toBER(!1)).result}c[d]=m.fromASN(w)}}else if(u.repeated){if(!Array.isArray(l))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");c[d]=Array.from(l,m=>this.fromASN(m,f))}else c[d]=this.fromASN(l,f)}return c}catch(i){throw i instanceof Gu&&i.schemas.push(n.name),i}}}class ll{static serialize(e){return e instanceof Ue?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Ut(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=ot.get(n);ot.cache(n);let i=[];if(r.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof r.itemType=="number"){const a=dl(r.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(c=>a.toASN(c))}else i=e.map(a=>this.toAsnItem({type:r.itemType},"[]",n,a))}else for(const a in r.items){const c=r.items[a],d=e[a];if(d===void 0||c.defaultValue===d||typeof c.defaultValue=="object"&&typeof d=="object"&&pw(this.serialize(c.defaultValue),this.serialize(d)))continue;const l=ll.toAsnItem(c,a,n,d);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||Ut(c.type))){const u={};u.valueHex=l instanceof Cn?l.valueBeforeDecodeView:l.valueBlock.toBER(),i.push(new bi({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...u}))}else i.push(new Xe({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:l.valueBlock.value}));else i.push(new Xe({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[l]}));else c.repeated?i=i.concat(l):i.push(l)}let o;switch(r.type){case R.Sequence:o=new Mt({value:i});break;case R.Set:o=new Ft({value:i});break;case R.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,n,r,i){let o;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${n}' doesn't have converter for type ${$[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,l=>a.toASN(l)),d=e.repeated==="sequence"?Mt:Ft;o=new d({value:c})}else o=a.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const a=Array.from(i,d=>this.toASN(d)),c=e.repeated==="sequence"?Mt:Ft;o=new c({value:a})}else o=this.toASN(i);return o}}class fe extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const n of e)this.push(n)}}}class F{static serialize(e){return ll.serialize(e)}static parse(e,n){return hw.parse(e,n)}static toString(e){const n=D.isBufferSource(e)?D.toArrayBuffer(e):F.serialize(e),r=sr(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function p(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(o=(i<3?a(o):i>3?a(e,n,o):a(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}var kg={exports:{}};(function(t){(function(e){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",d={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${n}\\.${n}\\.${n}\\.${n}(${a})?$`,"i")};function l(h,y){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let v=0,b=-1,E=(h.match(d.zoneIndex)||[])[0],C,L;for(E&&(E=E.substring(1),h=h.replace(/%.+$/,""));(b=h.indexOf(":",b+1))>=0;)v++;if(h.substr(0,2)==="::"&&v--,h.substr(-2,2)==="::"&&v--,v>y)return null;for(L=y-v,C=":";L--;)C+="0:";return h=h.replace("::",C),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),y=function(){const Y=h.split(":"),se=[];for(let ae=0;ae<Y.length;ae++)se.push(parseInt(Y[ae],16));return se}(),{parts:y,zoneId:E}}function u(h,y,v,b){if(h.length!==y.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let E=0,C;for(;b>0;){if(C=v-b,C<0&&(C=0),h[E]>>C!==y[E]>>C)return!1;b-=v,E+=1}return!0}function f(h){if(o.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(i.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}function m(h,y){for(;h.length<y;)h=`0${h}`;return h}const w={};w.IPv4=function(){function h(y){if(y.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let v,b;for(v=0;v<y.length;v++)if(b=y[v],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=y}return h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(y,v){let b;if(v===void 0&&(b=y,y=b[0],v=b[1]),y.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,y.octets,8,v)},h.prototype.prefixLengthFromSubnetMask=function(){let y=0,v=!1;const b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let E,C,L;for(E=3;E>=0;E-=1)if(C=this.octets[E],C in b){if(L=b[C],v&&L!==0)return null;L!==8&&(v=!0),y+=L}else return null;return 32-y},h.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h}(),w.IPv4.broadcastAddressFromCIDR=function(h){try{const y=this.parseCIDR(h),v=y[0].toByteArray(),b=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[];let C=0;for(;C<4;)E.push(parseInt(v[C],10)|parseInt(b[C],10)^255),C++;return new this(E)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(h){return this.parser(h)!==null},w.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},w.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(h){return!!(w.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(h){let y,v,b,E,C;try{for(y=this.parseCIDR(h),b=y[0].toByteArray(),C=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[],v=0;v<4;)E.push(parseInt(b[v],10)&parseInt(C[v],10)),v++;return new this(E)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(h){const y=this.parser(h);if(y===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(y)},w.IPv4.parseCIDR=function(h){let y;if(y=h.match(/^(.+)\/(\d+)$/)){const v=parseInt(y[2]);if(v>=0&&v<=32){const b=[this.parse(y[1]),v];return Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(h){let y,v,b;if(y=h.match(r.fourOctet))return function(){const E=y.slice(1,6),C=[];for(let L=0;L<E.length;L++)v=E[L],C.push(f(v));return C}();if(y=h.match(r.longValue)){if(b=f(y[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return function(){const E=[];let C;for(C=0;C<=24;C+=8)E.push(b>>C&255);return E}().reverse()}else return(y=h.match(r.twoOctet))?function(){const E=y.slice(1,4),C=[];if(b=f(E[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return C.push(f(E[0])),C.push(b>>16&255),C.push(b>>8&255),C.push(b&255),C}():(y=h.match(r.threeOctet))?function(){const E=y.slice(1,5),C=[];if(b=f(E[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return C.push(f(E[0])),C.push(f(E[1])),C.push(b>>8&255),C.push(b&255),C}():null},w.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");const y=[0,0,0,0];let v=0;const b=Math.floor(h/8);for(;v<b;)y[v]=255,v++;return b<4&&(y[b]=Math.pow(2,h%8)-1<<8-h%8),new this(y)},w.IPv6=function(){function h(y,v){let b,E;if(y.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(y[b]<<8|y[b+1]);else if(y.length===8)this.parts=y;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(E=this.parts[b],!(0<=E&&E<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");v&&(this.zoneId=v)}return h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(y,v){let b;if(v===void 0&&(b=y,y=b[0],v=b[1]),y.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,y.parts,16,v)},h.prototype.prefixLengthFromSubnetMask=function(){let y=0,v=!1;const b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let E,C;for(let L=7;L>=0;L-=1)if(E=this.parts[L],E in b){if(C=b[E],v&&C!==0)return null;C!==16&&(v=!0),y+=C}else return null;return 128-y},h.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let y;const v=[],b=this.parts;for(let E=0;E<b.length;E++)y=b[E],v.push(y>>8),v.push(y&255);return v},h.prototype.toFixedLengthString=function(){const y=(function(){const b=[];for(let E=0;E<this.parts.length;E++)b.push(m(this.parts[E].toString(16),4));return b}).call(this).join(":");let v="";return this.zoneId&&(v=`%${this.zoneId}`),y+v},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const y=this.parts.slice(-2),v=y[0],b=y[1];return new w.IPv4([v>>8,v&255,b>>8,b&255])},h.prototype.toNormalizedString=function(){const y=(function(){const b=[];for(let E=0;E<this.parts.length;E++)b.push(this.parts[E].toString(16));return b}).call(this).join(":");let v="";return this.zoneId&&(v=`%${this.zoneId}`),y+v},h.prototype.toRFC5952String=function(){const y=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString();let b=0,E=-1,C;for(;C=y.exec(v);)C[0].length>E&&(b=C.index,E=C[0].length);return E<0?v:`${v.substring(0,b)}::${v.substring(b+E)}`},h.prototype.toString=function(){return this.toRFC5952String()},h}(),w.IPv6.broadcastAddressFromCIDR=function(h){try{const y=this.parseCIDR(h),v=y[0].toByteArray(),b=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[];let C=0;for(;C<16;)E.push(parseInt(v[C],10)|parseInt(b[C],10)^255),C++;return new this(E)}catch(y){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${y})`)}},w.IPv6.isIPv6=function(h){return this.parser(h)!==null},w.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{const y=this.parser(h);return new this(y.parts,y.zoneId),!0}catch{return!1}},w.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(h){let y,v,b,E,C;try{for(y=this.parseCIDR(h),b=y[0].toByteArray(),C=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[],v=0;v<16;)E.push(parseInt(b[v],10)&parseInt(C[v],10)),v++;return new this(E)}catch(L){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${L})`)}},w.IPv6.parse=function(h){const y=this.parser(h);if(y.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(y.parts,y.zoneId)},w.IPv6.parseCIDR=function(h){let y,v,b;if((v=h.match(/^(.+)\/(\d+)$/))&&(y=parseInt(v[2]),y>=0&&y<=128))return b=[this.parse(v[1]),y],Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(h){let y,v,b,E,C,L;if(b=h.match(d.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(d.native.test(h))return l(h,8);if((b=h.match(d.transitional))&&(L=b[6]||"",y=b[1],b[1].endsWith("::")||(y=y.slice(0,-1)),y=l(y+L,6),y.parts)){for(C=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],v=0;v<C.length;v++)if(E=C[v],!(0<=E&&E<=255))return null;return y.parts.push(C[0]<<8|C[1]),y.parts.push(C[2]<<8|C[3]),{parts:y.parts,zoneId:y.zoneId}}return null},w.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");const y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let v=0;const b=Math.floor(h/8);for(;v<b;)y[v]=255,v++;return b<16&&(y[b]=Math.pow(2,h%8)-1<<8-h%8),new this(y)},w.fromByteArray=function(h){const y=h.length;if(y===4)return new w.IPv4(h);if(y===16)return new w.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},w.isValid=function(h){return w.IPv6.isValid(h)||w.IPv4.isValid(h)},w.isValidCIDR=function(h){return w.IPv6.isValidCIDR(h)||w.IPv4.isValidCIDR(h)},w.parse=function(h){if(w.IPv6.isValid(h))return w.IPv6.parse(h);if(w.IPv4.isValid(h))return w.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},w.parseCIDR=function(h){try{return w.IPv6.parseCIDR(h)}catch{try{return w.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},w.process=function(h){const y=this.parse(h);return y.kind()==="ipv6"&&y.isIPv4MappedAddress()?y.toIPv4Address():y},w.subnetMatch=function(h,y,v){let b,E,C,L;v==null&&(v="unicast");for(E in y)if(Object.prototype.hasOwnProperty.call(y,E)){for(C=y[E],C[0]&&!(C[0]instanceof Array)&&(C=[C]),b=0;b<C.length;b++)if(L=C[b],h.kind()===L[0].kind()&&h.match.apply(h,L))return E}return v},t.exports?t.exports=w:e.ipaddr=w})(Eo)})(kg);var Wu=kg.exports;class Ju{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const n=parseInt(e.slice(8),16).toString(2).split("").reduce((i,o)=>i+ +o,0);let r=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return r=r.slice(0,-1),`${r}/${n}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const n=new Uint8Array(e);return Wu.fromByteArray(Array.from(n)).toString()}return this.decodeIP(J.ToHex(e))}static fromString(e){const n=Wu.parse(e);return new Uint8Array(n.toByteArray()).buffer}}var dc,lc,uc;let Me=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};p([g({type:$.TeletexString})],Me.prototype,"teletexString",void 0);p([g({type:$.PrintableString})],Me.prototype,"printableString",void 0);p([g({type:$.UniversalString})],Me.prototype,"universalString",void 0);p([g({type:$.Utf8String})],Me.prototype,"utf8String",void 0);p([g({type:$.BmpString})],Me.prototype,"bmpString",void 0);Me=p([B({type:R.Choice})],Me);let ur=class extends Me{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?J.ToHex(this.anyValue):super.toString())}};p([g({type:$.IA5String})],ur.prototype,"ia5String",void 0);p([g({type:$.Any})],ur.prototype,"anyValue",void 0);ur=p([B({type:R.Choice})],ur);class Gs{constructor(e={}){this.type="",this.value=new ur,Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Gs.prototype,"type",void 0);p([g({type:ur})],Gs.prototype,"value",void 0);let pr=dc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,dc.prototype)}};pr=dc=p([B({type:R.Set,itemType:Gs})],pr);let pc=lc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,lc.prototype)}};pc=lc=p([B({type:R.Sequence,itemType:pr})],pc);let $e=uc=class extends pc{constructor(e){super(e),Object.setPrototypeOf(this,uc.prototype)}};$e=uc=p([B({type:R.Sequence})],$e);const gw={fromASN:t=>Ju.toString(jo.fromASN(t)),toASN:t=>jo.toASN(Ju.fromString(t))};class ti{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ti.prototype,"typeId",void 0);p([g({type:$.Any,context:0})],ti.prototype,"value",void 0);class ul{constructor(e={}){this.partyName=new Me,Object.assign(this,e)}}p([g({type:Me,optional:!0,context:0,implicit:!0})],ul.prototype,"nameAssigner",void 0);p([g({type:Me,context:1,implicit:!0})],ul.prototype,"partyName",void 0);let ie=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ti,context:0,implicit:!0})],ie.prototype,"otherName",void 0);p([g({type:$.IA5String,context:1,implicit:!0})],ie.prototype,"rfc822Name",void 0);p([g({type:$.IA5String,context:2,implicit:!0})],ie.prototype,"dNSName",void 0);p([g({type:$.Any,context:3,implicit:!0})],ie.prototype,"x400Address",void 0);p([g({type:$e,context:4,implicit:!1})],ie.prototype,"directoryName",void 0);p([g({type:ul,context:5})],ie.prototype,"ediPartyName",void 0);p([g({type:$.IA5String,context:6,implicit:!0})],ie.prototype,"uniformResourceIdentifier",void 0);p([g({type:$.OctetString,context:7,implicit:!0,converter:gw})],ie.prototype,"iPAddress",void 0);p([g({type:$.ObjectIdentifier,context:8,implicit:!0})],ie.prototype,"registeredID",void 0);ie=p([B({type:R.Choice})],ie);const pl="1.3.6.1.5.5.7",mw=`${pl}.1`,Ar=`${pl}.3`,Ws=`${pl}.48`,Xu=`${Ws}.1`,Zu=`${Ws}.2`,Yu=`${Ws}.3`,Qu=`${Ws}.5`,gn="2.5.29";var fc;const hc=`${mw}.1`;class ki{constructor(e={}){this.accessMethod="",this.accessLocation=new ie,Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ki.prototype,"accessMethod",void 0);p([g({type:ie})],ki.prototype,"accessLocation",void 0);let ir=fc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,fc.prototype)}};ir=fc=p([B({type:R.Sequence,itemType:ki})],ir);const gc=`${gn}.35`;class fl extends le{}class An{constructor(e={}){e&&Object.assign(this,e)}}p([g({type:fl,context:0,optional:!0,implicit:!0})],An.prototype,"keyIdentifier",void 0);p([g({type:ie,context:1,optional:!0,implicit:!0,repeated:"sequence"})],An.prototype,"authorityCertIssuer",void 0);p([g({type:$.Integer,context:2,optional:!0,implicit:!0,converter:_e})],An.prototype,"authorityCertSerialNumber",void 0);const Sg=`${gn}.19`;class Oo{constructor(e={}){this.cA=!1,Object.assign(this,e)}}p([g({type:$.Boolean,defaultValue:!1})],Oo.prototype,"cA",void 0);p([g({type:$.Integer,optional:!0})],Oo.prototype,"pathLenConstraint",void 0);var mc;let He=mc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,mc.prototype)}};He=mc=p([B({type:R.Sequence,itemType:ie})],He);var _c;let ep=_c=class extends He{constructor(e){super(e),Object.setPrototypeOf(this,_c.prototype)}};ep=_c=p([B({type:R.Sequence})],ep);var yc;const Ag=`${gn}.32`;let qt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};p([g({type:$.IA5String})],qt.prototype,"ia5String",void 0);p([g({type:$.VisibleString})],qt.prototype,"visibleString",void 0);p([g({type:$.BmpString})],qt.prototype,"bmpString",void 0);p([g({type:$.Utf8String})],qt.prototype,"utf8String",void 0);qt=p([B({type:R.Choice})],qt);class hl{constructor(e={}){this.organization=new qt,this.noticeNumbers=[],Object.assign(this,e)}}p([g({type:qt})],hl.prototype,"organization",void 0);p([g({type:$.Integer,repeated:"sequence"})],hl.prototype,"noticeNumbers",void 0);class gl{constructor(e={}){Object.assign(this,e)}}p([g({type:hl,optional:!0})],gl.prototype,"noticeRef",void 0);p([g({type:qt,optional:!0})],gl.prototype,"explicitText",void 0);let Po=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.IA5String})],Po.prototype,"cPSuri",void 0);p([g({type:gl})],Po.prototype,"userNotice",void 0);Po=p([B({type:R.Choice})],Po);class ml{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ml.prototype,"policyQualifierId",void 0);p([g({type:$.Any})],ml.prototype,"qualifier",void 0);class Js{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Js.prototype,"policyIdentifier",void 0);p([g({type:ml,repeated:"sequence",optional:!0})],Js.prototype,"policyQualifiers",void 0);let To=yc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,yc.prototype)}};To=yc=p([B({type:R.Sequence,itemType:Js})],To);let Ro=class{constructor(e=0){this.value=e}};p([g({type:$.Integer})],Ro.prototype,"value",void 0);Ro=p([B({type:R.Choice})],Ro);let tp=class extends Ro{};tp=p([B({type:R.Choice})],tp);var wc;const vc=`${gn}.31`;var ht;(function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"})(ht||(ht={}));class Eg extends Ks{toJSON(){const e=[],n=this.toNumber();return n&ht.aACompromise&&e.push("aACompromise"),n&ht.affiliationChanged&&e.push("affiliationChanged"),n&ht.cACompromise&&e.push("cACompromise"),n&ht.certificateHold&&e.push("certificateHold"),n&ht.cessationOfOperation&&e.push("cessationOfOperation"),n&ht.keyCompromise&&e.push("keyCompromise"),n&ht.privilegeWithdrawn&&e.push("privilegeWithdrawn"),n&ht.superseded&&e.push("superseded"),n&ht.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let On=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ie,context:0,repeated:"sequence",implicit:!0})],On.prototype,"fullName",void 0);p([g({type:pr,context:1,implicit:!0})],On.prototype,"nameRelativeToCRLIssuer",void 0);On=p([B({type:R.Choice})],On);class Er{constructor(e={}){Object.assign(this,e)}}p([g({type:On,context:0,optional:!0})],Er.prototype,"distributionPoint",void 0);p([g({type:Eg,context:1,optional:!0,implicit:!0})],Er.prototype,"reasons",void 0);p([g({type:ie,context:2,optional:!0,repeated:"sequence",implicit:!0})],Er.prototype,"cRLIssuer",void 0);let ar=wc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,wc.prototype)}};ar=wc=p([B({type:R.Sequence,itemType:Er})],ar);var bc;let np=bc=class extends ar{constructor(e){super(e),Object.setPrototypeOf(this,bc.prototype)}};np=bc=p([B({type:R.Sequence,itemType:Er})],np);class Ve{constructor(e={}){this.onlyContainsUserCerts=Ve.ONLY,this.onlyContainsCACerts=Ve.ONLY,this.indirectCRL=Ve.ONLY,this.onlyContainsAttributeCerts=Ve.ONLY,Object.assign(this,e)}}Ve.ONLY=!1;p([g({type:On,context:0,optional:!0})],Ve.prototype,"distributionPoint",void 0);p([g({type:$.Boolean,context:1,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"onlyContainsUserCerts",void 0);p([g({type:$.Boolean,context:2,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"onlyContainsCACerts",void 0);p([g({type:Eg,context:3,optional:!0,implicit:!0})],Ve.prototype,"onlySomeReasons",void 0);p([g({type:$.Boolean,context:4,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"indirectCRL",void 0);p([g({type:$.Boolean,context:5,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"onlyContainsAttributeCerts",void 0);var Hr;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(Hr||(Hr={}));let $c=class{constructor(e=Hr.unspecified){this.reason=Hr.unspecified,this.reason=e}toJSON(){return Hr[this.reason]}toString(){return this.toJSON()}};p([g({type:$.Enumerated})],$c.prototype,"reason",void 0);$c=p([B({type:R.Choice})],$c);var xc;const zg=`${gn}.37`;let Bo=xc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,xc.prototype)}};Bo=xc=p([B({type:R.Sequence,itemType:$.ObjectIdentifier})],Bo);const _w=`${Ar}.1`,yw=`${Ar}.2`,ww=`${Ar}.3`,vw=`${Ar}.4`,bw=`${Ar}.8`,$w=`${Ar}.9`;let kc=class{constructor(e=new ArrayBuffer(0)){this.value=e}};p([g({type:$.Integer,converter:_e})],kc.prototype,"value",void 0);kc=p([B({type:R.Choice})],kc);let Sc=class{constructor(e){this.value=new Date,e&&(this.value=e)}};p([g({type:$.GeneralizedTime})],Sc.prototype,"value",void 0);Sc=p([B({type:R.Choice})],Sc);var Ac;let rp=Ac=class extends He{constructor(e){super(e),Object.setPrototypeOf(this,Ac.prototype)}};rp=Ac=p([B({type:R.Sequence})],rp);const Ig=`${gn}.15`;var gt;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(gt||(gt={}));class Na extends Ks{toJSON(){const e=this.toNumber(),n=[];return e>.cRLSign&&n.push("crlSign"),e>.dataEncipherment&&n.push("dataEncipherment"),e>.decipherOnly&&n.push("decipherOnly"),e>.digitalSignature&&n.push("digitalSignature"),e>.encipherOnly&&n.push("encipherOnly"),e>.keyAgreement&&n.push("keyAgreement"),e>.keyCertSign&&n.push("keyCertSign"),e>.keyEncipherment&&n.push("keyEncipherment"),e>.nonRepudiation&&n.push("nonRepudiation"),n}toString(){return`[${this.toJSON().join(", ")}]`}}var Ec;class Xs{constructor(e={}){this.base=new ie,this.minimum=0,Object.assign(this,e)}}p([g({type:ie})],Xs.prototype,"base",void 0);p([g({type:$.Integer,context:0,defaultValue:0,implicit:!0})],Xs.prototype,"minimum",void 0);p([g({type:$.Integer,context:1,optional:!0,implicit:!0})],Xs.prototype,"maximum",void 0);let Lo=Ec=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Ec.prototype)}};Lo=Ec=p([B({type:R.Sequence,itemType:Xs})],Lo);class Ng{constructor(e={}){Object.assign(this,e)}}p([g({type:Lo,context:0,optional:!0,implicit:!0})],Ng.prototype,"permittedSubtrees",void 0);p([g({type:Lo,context:1,optional:!0,implicit:!0})],Ng.prototype,"excludedSubtrees",void 0);class Cg{constructor(e={}){Object.assign(this,e)}}p([g({type:$.Integer,context:0,implicit:!0,optional:!0,converter:_e})],Cg.prototype,"requireExplicitPolicy",void 0);p([g({type:$.Integer,context:1,implicit:!0,optional:!0,converter:_e})],Cg.prototype,"inhibitPolicyMapping",void 0);var zc;class _l{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],_l.prototype,"issuerDomainPolicy",void 0);p([g({type:$.ObjectIdentifier})],_l.prototype,"subjectDomainPolicy",void 0);let ip=zc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,zc.prototype)}};ip=zc=p([B({type:R.Sequence,itemType:_l})],ip);var Ic;const jg=`${gn}.17`;let Nc=Ic=class extends He{constructor(e){super(e),Object.setPrototypeOf(this,Ic.prototype)}};Nc=Ic=p([B({type:R.Sequence})],Nc);let Ht=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],Ht.prototype,"type",void 0);p([g({type:$.Any,repeated:"set"})],Ht.prototype,"values",void 0);var Cc;let op=Cc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Cc.prototype)}};op=Cc=p([B({type:R.Sequence,itemType:Ht})],op);const Og=`${gn}.14`;class cn extends fl{}class Pg{constructor(e={}){Object.assign(this,e)}}p([g({type:$.GeneralizedTime,context:0,implicit:!0,optional:!0})],Pg.prototype,"notBefore",void 0);p([g({type:$.GeneralizedTime,context:1,implicit:!0,optional:!0})],Pg.prototype,"notAfter",void 0);var Kr;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(Kr||(Kr={}));class Tg extends Ks{toJSON(){const e=[],n=this.toNumber();return n&Kr.pKIXCertificate&&e.push("pKIXCertificate"),n&Kr.newExtensions&&e.push("newExtensions"),n&Kr.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Rg{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Tg,Object.assign(this,e)}}p([g({type:$.GeneralString})],Rg.prototype,"entrustVers",void 0);p([g({type:Tg})],Rg.prototype,"entrustInfoFlags",void 0);var jc;let sp=jc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,jc.prototype)}};sp=jc=p([B({type:R.Sequence,itemType:ki})],sp);class H{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof H&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&$0(e.parameters,this.parameters)||e.parameters===this.parameters)}}p([g({type:$.ObjectIdentifier})],H.prototype,"algorithm",void 0);p([g({type:$.Any,optional:!0})],H.prototype,"parameters",void 0);class mt{constructor(e={}){this.algorithm=new H,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:H})],mt.prototype,"algorithm",void 0);p([g({type:$.BitString})],mt.prototype,"subjectPublicKey",void 0);let Re=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const n=new Date(e);n.getUTCFullYear()>2049?this.generalTime=n:this.utcTime=n}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};p([g({type:$.UTCTime})],Re.prototype,"utcTime",void 0);p([g({type:$.GeneralizedTime})],Re.prototype,"generalTime",void 0);Re=p([B({type:R.Choice})],Re);class Si{constructor(e){this.notBefore=new Re(new Date),this.notAfter=new Re(new Date),e&&(this.notBefore=new Re(e.notBefore),this.notAfter=new Re(e.notAfter))}}p([g({type:Re})],Si.prototype,"notBefore",void 0);p([g({type:Re})],Si.prototype,"notAfter",void 0);var Oc;let ct=class Bg{constructor(e={}){this.extnID="",this.critical=Bg.CRITICAL,this.extnValue=new le,Object.assign(this,e)}};ct.CRITICAL=!1;p([g({type:$.ObjectIdentifier})],ct.prototype,"extnID",void 0);p([g({type:$.Boolean,defaultValue:ct.CRITICAL})],ct.prototype,"critical",void 0);p([g({type:le})],ct.prototype,"extnValue",void 0);let ln=Oc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Oc.prototype)}};ln=Oc=p([B({type:R.Sequence,itemType:ct})],ln);var Pn;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(Pn||(Pn={}));class rt{constructor(e={}){this.version=Pn.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new H,this.issuer=new $e,this.validity=new Si,this.subject=new $e,this.subjectPublicKeyInfo=new mt,Object.assign(this,e)}}p([g({type:$.Integer,context:0,defaultValue:Pn.v1})],rt.prototype,"version",void 0);p([g({type:$.Integer,converter:_e})],rt.prototype,"serialNumber",void 0);p([g({type:H})],rt.prototype,"signature",void 0);p([g({type:$e})],rt.prototype,"issuer",void 0);p([g({type:Si})],rt.prototype,"validity",void 0);p([g({type:$e})],rt.prototype,"subject",void 0);p([g({type:mt})],rt.prototype,"subjectPublicKeyInfo",void 0);p([g({type:$.BitString,context:1,implicit:!0,optional:!0})],rt.prototype,"issuerUniqueID",void 0);p([g({type:$.BitString,context:2,implicit:!0,optional:!0})],rt.prototype,"subjectUniqueID",void 0);p([g({type:ln,context:3,optional:!0})],rt.prototype,"extensions",void 0);class Tn{constructor(e={}){this.tbsCertificate=new rt,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:rt})],Tn.prototype,"tbsCertificate",void 0);p([g({type:H})],Tn.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],Tn.prototype,"signatureValue",void 0);class Zs{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Re,Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],Zs.prototype,"userCertificate",void 0);p([g({type:Re})],Zs.prototype,"revocationDate",void 0);p([g({type:ct,optional:!0,repeated:"sequence"})],Zs.prototype,"crlEntryExtensions",void 0);class en{constructor(e={}){this.signature=new H,this.issuer=new $e,this.thisUpdate=new Re,Object.assign(this,e)}}p([g({type:$.Integer,optional:!0})],en.prototype,"version",void 0);p([g({type:H})],en.prototype,"signature",void 0);p([g({type:$e})],en.prototype,"issuer",void 0);p([g({type:Re})],en.prototype,"thisUpdate",void 0);p([g({type:Re,optional:!0})],en.prototype,"nextUpdate",void 0);p([g({type:Zs,repeated:"sequence",optional:!0})],en.prototype,"revokedCertificates",void 0);p([g({type:ct,optional:!0,context:0,repeated:"sequence"})],en.prototype,"crlExtensions",void 0);class yl{constructor(e={}){this.tbsCertList=new en,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:en})],yl.prototype,"tbsCertList",void 0);p([g({type:H})],yl.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],yl.prototype,"signature",void 0);class zr{constructor(e={}){this.issuer=new $e,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$e})],zr.prototype,"issuer",void 0);p([g({type:$.Integer,converter:_e})],zr.prototype,"serialNumber",void 0);let fr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:cn,context:0,implicit:!0})],fr.prototype,"subjectKeyIdentifier",void 0);p([g({type:zr})],fr.prototype,"issuerAndSerialNumber",void 0);fr=p([B({type:R.Choice})],fr);var Kt;(function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"})(Kt||(Kt={}));let ni=class extends H{};ni=p([B({type:R.Sequence})],ni);let Uo=class extends H{};Uo=p([B({type:R.Sequence})],Uo);let Ot=class extends H{};Ot=p([B({type:R.Sequence})],Ot);let Mo=class extends H{};Mo=p([B({type:R.Sequence})],Mo);let ap=class extends H{};ap=p([B({type:R.Sequence})],ap);let Pc=class extends H{};Pc=p([B({type:R.Sequence})],Pc);let Ir=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],Ir.prototype,"attrType",void 0);p([g({type:$.Any,repeated:"set"})],Ir.prototype,"attrValues",void 0);var Tc;class Tt{constructor(e={}){this.version=Kt.v0,this.sid=new fr,this.digestAlgorithm=new ni,this.signatureAlgorithm=new Uo,this.signature=new le,Object.assign(this,e)}}p([g({type:$.Integer})],Tt.prototype,"version",void 0);p([g({type:fr})],Tt.prototype,"sid",void 0);p([g({type:ni})],Tt.prototype,"digestAlgorithm",void 0);p([g({type:Ir,repeated:"set",context:0,implicit:!0,optional:!0})],Tt.prototype,"signedAttrs",void 0);p([g({type:Uo})],Tt.prototype,"signatureAlgorithm",void 0);p([g({type:le})],Tt.prototype,"signature",void 0);p([g({type:Ir,repeated:"set",context:1,implicit:!0,optional:!0})],Tt.prototype,"unsignedAttrs",void 0);let Fo=Tc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Tc.prototype)}};Fo=Tc=p([B({type:R.Set,itemType:Tt})],Fo);let cp=class extends Re{};cp=p([B({type:R.Choice})],cp);let dp=class extends Tt{};dp=p([B({type:R.Sequence})],dp);class wl{constructor(e={}){this.acIssuer=new ie,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}p([g({type:ie})],wl.prototype,"acIssuer",void 0);p([g({type:$.Integer})],wl.prototype,"acSerial",void 0);p([g({type:Ht,repeated:"sequence"})],wl.prototype,"attrs",void 0);var Rc;let Do=Rc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Rc.prototype)}};Do=Rc=p([B({type:R.Sequence,itemType:$.ObjectIdentifier})],Do);class Ys{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}p([g({type:$.Integer,optional:!0})],Ys.prototype,"pathLenConstraint",void 0);p([g({type:Do,implicit:!0,context:0,optional:!0})],Ys.prototype,"permittedAttrs",void 0);p([g({type:Do,implicit:!0,context:1,optional:!0})],Ys.prototype,"excludedAttrs",void 0);p([g({type:$.Boolean,defaultValue:!0})],Ys.prototype,"permitUnSpecified",void 0);class Hn{constructor(e={}){this.issuer=new He,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:He})],Hn.prototype,"issuer",void 0);p([g({type:$.Integer,converter:_e})],Hn.prototype,"serial",void 0);p([g({type:$.BitString,optional:!0})],Hn.prototype,"issuerUID",void 0);var Bc;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(Bc||(Bc={}));class Kn{constructor(e={}){this.digestedObjectType=Bc.publicKey,this.digestAlgorithm=new H,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Enumerated})],Kn.prototype,"digestedObjectType",void 0);p([g({type:$.ObjectIdentifier,optional:!0})],Kn.prototype,"otherObjectTypeID",void 0);p([g({type:H})],Kn.prototype,"digestAlgorithm",void 0);p([g({type:$.BitString})],Kn.prototype,"objectDigest",void 0);class Qs{constructor(e={}){Object.assign(this,e)}}p([g({type:He,optional:!0})],Qs.prototype,"issuerName",void 0);p([g({type:Hn,context:0,implicit:!0,optional:!0})],Qs.prototype,"baseCertificateID",void 0);p([g({type:Kn,context:1,implicit:!0,optional:!0})],Qs.prototype,"objectDigestInfo",void 0);let hr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ie,repeated:"sequence"})],hr.prototype,"v1Form",void 0);p([g({type:Qs,context:0,implicit:!0})],hr.prototype,"v2Form",void 0);hr=p([B({type:R.Choice})],hr);class ea{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}p([g({type:$.GeneralizedTime})],ea.prototype,"notBeforeTime",void 0);p([g({type:$.GeneralizedTime})],ea.prototype,"notAfterTime",void 0);class Ai{constructor(e={}){Object.assign(this,e)}}p([g({type:Hn,implicit:!0,context:0,optional:!0})],Ai.prototype,"baseCertificateID",void 0);p([g({type:He,implicit:!0,context:1,optional:!0})],Ai.prototype,"entityName",void 0);p([g({type:Kn,implicit:!0,context:2,optional:!0})],Ai.prototype,"objectDigestInfo",void 0);var Lc;(function(t){t[t.v2=1]="v2"})(Lc||(Lc={}));class xt{constructor(e={}){this.version=Lc.v2,this.holder=new Ai,this.issuer=new hr,this.signature=new H,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new ea,this.attributes=[],Object.assign(this,e)}}p([g({type:$.Integer})],xt.prototype,"version",void 0);p([g({type:Ai})],xt.prototype,"holder",void 0);p([g({type:hr})],xt.prototype,"issuer",void 0);p([g({type:H})],xt.prototype,"signature",void 0);p([g({type:$.Integer,converter:_e})],xt.prototype,"serialNumber",void 0);p([g({type:ea})],xt.prototype,"attrCertValidityPeriod",void 0);p([g({type:Ht,repeated:"sequence"})],xt.prototype,"attributes",void 0);p([g({type:$.BitString,optional:!0})],xt.prototype,"issuerUniqueID",void 0);p([g({type:ln,optional:!0})],xt.prototype,"extensions",void 0);class ta{constructor(e={}){this.acinfo=new xt,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:xt})],ta.prototype,"acinfo",void 0);p([g({type:H})],ta.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],ta.prototype,"signatureValue",void 0);var Vo;(function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"})(Vo||(Vo={}));class Uc extends Ks{}class vl{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier,implicit:!0,context:0})],vl.prototype,"type",void 0);p([g({type:$.Any,implicit:!0,context:1})],vl.prototype,"value",void 0);class bl{constructor(e={}){this.policyId="",this.classList=new Uc(Vo.unclassified),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],bl.prototype,"policyId",void 0);p([g({type:Uc,defaultValue:new Uc(Vo.unclassified)})],bl.prototype,"classList",void 0);p([g({type:vl,repeated:"set"})],bl.prototype,"securityCategories",void 0);class na{constructor(e={}){Object.assign(this,e)}}p([g({type:le})],na.prototype,"cotets",void 0);p([g({type:$.ObjectIdentifier})],na.prototype,"oid",void 0);p([g({type:$.Utf8String})],na.prototype,"string",void 0);class Lg{constructor(e={}){this.values=[],Object.assign(this,e)}}p([g({type:He,implicit:!0,context:0,optional:!0})],Lg.prototype,"policyAuthority",void 0);p([g({type:na,repeated:"sequence"})],Lg.prototype,"values",void 0);var Mc;class ra{constructor(e={}){this.targetCertificate=new Hn,Object.assign(this,e)}}p([g({type:Hn})],ra.prototype,"targetCertificate",void 0);p([g({type:ie,optional:!0})],ra.prototype,"targetName",void 0);p([g({type:Kn,optional:!0})],ra.prototype,"certDigestInfo",void 0);let gr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ie,context:0,implicit:!0})],gr.prototype,"targetName",void 0);p([g({type:ie,context:1,implicit:!0})],gr.prototype,"targetGroup",void 0);p([g({type:ra,context:2,implicit:!0})],gr.prototype,"targetCert",void 0);gr=p([B({type:R.Choice})],gr);let Fc=Mc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Mc.prototype)}};Fc=Mc=p([B({type:R.Sequence,itemType:gr})],Fc);var Dc;let lp=Dc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Dc.prototype)}};lp=Dc=p([B({type:R.Sequence,itemType:Fc})],lp);class Ug{constructor(e={}){Object.assign(this,e)}}p([g({type:He,implicit:!0,context:0,optional:!0})],Ug.prototype,"roleAuthority",void 0);p([g({type:ie,implicit:!0,context:1})],Ug.prototype,"roleName",void 0);class $l{constructor(e={}){this.service=new ie,this.ident=new ie,Object.assign(this,e)}}p([g({type:ie})],$l.prototype,"service",void 0);p([g({type:ie})],$l.prototype,"ident",void 0);p([g({type:le,optional:!0})],$l.prototype,"authInfo",void 0);var Vc;class xl{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],xl.prototype,"otherCertFormat",void 0);p([g({type:$.Any})],xl.prototype,"otherCert",void 0);let mr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:Tn})],mr.prototype,"certificate",void 0);p([g({type:ta,context:2,implicit:!0})],mr.prototype,"v2AttrCert",void 0);p([g({type:xl,context:3,implicit:!0})],mr.prototype,"other",void 0);mr=p([B({type:R.Choice})],mr);let qo=Vc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Vc.prototype)}};qo=Vc=p([B({type:R.Set,itemType:mr})],qo);class Nr{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Nr.prototype,"contentType",void 0);p([g({type:$.Any,context:0})],Nr.prototype,"content",void 0);let ri=class{constructor(e={}){Object.assign(this,e)}};p([g({type:le})],ri.prototype,"single",void 0);p([g({type:$.Any})],ri.prototype,"any",void 0);ri=p([B({type:R.Choice})],ri);class ia{constructor(e={}){this.eContentType="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ia.prototype,"eContentType",void 0);p([g({type:ri,context:0,optional:!0})],ia.prototype,"eContent",void 0);let ii=class{constructor(e={}){Object.assign(this,e)}};p([g({type:le,context:0,implicit:!0,optional:!0})],ii.prototype,"value",void 0);p([g({type:le,converter:Z2,context:0,implicit:!0,optional:!0,repeated:"sequence"})],ii.prototype,"constructedValue",void 0);ii=p([B({type:R.Choice})],ii);class Ei{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Mo,Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Ei.prototype,"contentType",void 0);p([g({type:Mo})],Ei.prototype,"contentEncryptionAlgorithm",void 0);p([g({type:ii,optional:!0})],Ei.prototype,"encryptedContent",void 0);class oa{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],oa.prototype,"keyAttrId",void 0);p([g({type:$.Any,optional:!0})],oa.prototype,"keyAttr",void 0);var qc;class sa{constructor(e={}){this.subjectKeyIdentifier=new cn,Object.assign(this,e)}}p([g({type:cn})],sa.prototype,"subjectKeyIdentifier",void 0);p([g({type:$.GeneralizedTime,optional:!0})],sa.prototype,"date",void 0);p([g({type:oa,optional:!0})],sa.prototype,"other",void 0);let _r=class{constructor(e={}){Object.assign(this,e)}};p([g({type:sa,context:0,implicit:!0,optional:!0})],_r.prototype,"rKeyId",void 0);p([g({type:zr,optional:!0})],_r.prototype,"issuerAndSerialNumber",void 0);_r=p([B({type:R.Choice})],_r);class kl{constructor(e={}){this.rid=new _r,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:_r})],kl.prototype,"rid",void 0);p([g({type:le})],kl.prototype,"encryptedKey",void 0);let Ho=qc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,qc.prototype)}};Ho=qc=p([B({type:R.Sequence,itemType:kl})],Ho);class Sl{constructor(e={}){this.algorithm=new H,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:H})],Sl.prototype,"algorithm",void 0);p([g({type:$.BitString})],Sl.prototype,"publicKey",void 0);let Rn=class{constructor(e={}){Object.assign(this,e)}};p([g({type:cn,context:0,implicit:!0,optional:!0})],Rn.prototype,"subjectKeyIdentifier",void 0);p([g({type:Sl,context:1,implicit:!0,optional:!0})],Rn.prototype,"originatorKey",void 0);p([g({type:zr,optional:!0})],Rn.prototype,"issuerAndSerialNumber",void 0);Rn=p([B({type:R.Choice})],Rn);class Cr{constructor(e={}){this.version=Kt.v3,this.originator=new Rn,this.keyEncryptionAlgorithm=new Ot,this.recipientEncryptedKeys=new Ho,Object.assign(this,e)}}p([g({type:$.Integer})],Cr.prototype,"version",void 0);p([g({type:Rn,context:0})],Cr.prototype,"originator",void 0);p([g({type:le,context:1,optional:!0})],Cr.prototype,"ukm",void 0);p([g({type:Ot})],Cr.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:Ho})],Cr.prototype,"recipientEncryptedKeys",void 0);let yr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:cn,context:0,implicit:!0})],yr.prototype,"subjectKeyIdentifier",void 0);p([g({type:zr})],yr.prototype,"issuerAndSerialNumber",void 0);yr=p([B({type:R.Choice})],yr);class zi{constructor(e={}){this.version=Kt.v0,this.rid=new yr,this.keyEncryptionAlgorithm=new Ot,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],zi.prototype,"version",void 0);p([g({type:yr})],zi.prototype,"rid",void 0);p([g({type:Ot})],zi.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:le})],zi.prototype,"encryptedKey",void 0);class Ii{constructor(e={}){this.keyIdentifier=new le,Object.assign(this,e)}}p([g({type:le})],Ii.prototype,"keyIdentifier",void 0);p([g({type:$.GeneralizedTime,optional:!0})],Ii.prototype,"date",void 0);p([g({type:oa,optional:!0})],Ii.prototype,"other",void 0);class Ni{constructor(e={}){this.version=Kt.v4,this.kekid=new Ii,this.keyEncryptionAlgorithm=new Ot,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],Ni.prototype,"version",void 0);p([g({type:Ii})],Ni.prototype,"kekid",void 0);p([g({type:Ot})],Ni.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:le})],Ni.prototype,"encryptedKey",void 0);class Ci{constructor(e={}){this.version=Kt.v0,this.keyEncryptionAlgorithm=new Ot,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],Ci.prototype,"version",void 0);p([g({type:Pc,context:0,optional:!0})],Ci.prototype,"keyDerivationAlgorithm",void 0);p([g({type:Ot})],Ci.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:le})],Ci.prototype,"encryptedKey",void 0);class Al{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Al.prototype,"oriType",void 0);p([g({type:$.Any})],Al.prototype,"oriValue",void 0);let un=class{constructor(e={}){Object.assign(this,e)}};p([g({type:zi,optional:!0})],un.prototype,"ktri",void 0);p([g({type:Cr,context:1,implicit:!0,optional:!0})],un.prototype,"kari",void 0);p([g({type:Ni,context:2,implicit:!0,optional:!0})],un.prototype,"kekri",void 0);p([g({type:Ci,context:3,implicit:!0,optional:!0})],un.prototype,"pwri",void 0);p([g({type:Al,context:4,implicit:!0,optional:!0})],un.prototype,"ori",void 0);un=p([B({type:R.Choice})],un);var Hc;let Ko=Hc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Hc.prototype)}};Ko=Hc=p([B({type:R.Set,itemType:un})],Ko);var Kc;class aa{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],aa.prototype,"otherRevInfoFormat",void 0);p([g({type:$.Any})],aa.prototype,"otherRevInfo",void 0);let Go=class{constructor(e={}){this.other=new aa,Object.assign(this,e)}};p([g({type:aa,context:1,implicit:!0})],Go.prototype,"other",void 0);Go=p([B({type:R.Choice})],Go);let Wo=Kc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Kc.prototype)}};Wo=Kc=p([B({type:R.Set,itemType:Go})],Wo);class El{constructor(e={}){Object.assign(this,e)}}p([g({type:qo,context:0,implicit:!0,optional:!0})],El.prototype,"certs",void 0);p([g({type:Wo,context:1,implicit:!0,optional:!0})],El.prototype,"crls",void 0);var Gc;let Wc=Gc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Gc.prototype)}};Wc=Gc=p([B({type:R.Set,itemType:Ir})],Wc);class ji{constructor(e={}){this.version=Kt.v0,this.recipientInfos=new Ko,this.encryptedContentInfo=new Ei,Object.assign(this,e)}}p([g({type:$.Integer})],ji.prototype,"version",void 0);p([g({type:El,context:0,implicit:!0,optional:!0})],ji.prototype,"originatorInfo",void 0);p([g({type:Ko})],ji.prototype,"recipientInfos",void 0);p([g({type:Ei})],ji.prototype,"encryptedContentInfo",void 0);p([g({type:Wc,context:1,implicit:!0,optional:!0})],ji.prototype,"unprotectedAttrs",void 0);const xw="1.2.840.113549.1.7.2";var Jc;let Jo=Jc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Jc.prototype)}};Jo=Jc=p([B({type:R.Set,itemType:ni})],Jo);class jr{constructor(e={}){this.version=Kt.v0,this.digestAlgorithms=new Jo,this.encapContentInfo=new ia,this.signerInfos=new Fo,Object.assign(this,e)}}p([g({type:$.Integer})],jr.prototype,"version",void 0);p([g({type:Jo})],jr.prototype,"digestAlgorithms",void 0);p([g({type:ia})],jr.prototype,"encapContentInfo",void 0);p([g({type:qo,context:0,implicit:!0,optional:!0})],jr.prototype,"certificates",void 0);p([g({type:Wo,context:1,implicit:!0,optional:!0})],jr.prototype,"crls",void 0);p([g({type:Fo})],jr.prototype,"signerInfos",void 0);const oi="1.2.840.10045.2.1",zl="1.2.840.10045.4.1",Mg="1.2.840.10045.4.3.1",Il="1.2.840.10045.4.3.2",Nl="1.2.840.10045.4.3.3",Cl="1.2.840.10045.4.3.4",up="1.2.840.10045.3.1.7",pp="1.3.132.0.34",fp="1.3.132.0.35";function Oi(t){return new H({algorithm:t})}const kw=Oi(zl);Oi(Mg);const Sw=Oi(Il),Aw=Oi(Nl),Ew=Oi(Cl);let si=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],si.prototype,"fieldType",void 0);p([g({type:$.Any})],si.prototype,"parameters",void 0);si=p([B({type:R.Sequence})],si);class zw extends le{}let wr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.OctetString})],wr.prototype,"a",void 0);p([g({type:$.OctetString})],wr.prototype,"b",void 0);p([g({type:$.BitString,optional:!0})],wr.prototype,"seed",void 0);wr=p([B({type:R.Sequence})],wr);var Xc;(function(t){t[t.ecpVer1=1]="ecpVer1"})(Xc||(Xc={}));let Gt=class{constructor(e={}){this.version=Xc.ecpVer1,Object.assign(this,e)}};p([g({type:$.Integer})],Gt.prototype,"version",void 0);p([g({type:si})],Gt.prototype,"fieldID",void 0);p([g({type:wr})],Gt.prototype,"curve",void 0);p([g({type:zw})],Gt.prototype,"base",void 0);p([g({type:$.Integer,converter:_e})],Gt.prototype,"order",void 0);p([g({type:$.Integer,optional:!0})],Gt.prototype,"cofactor",void 0);Gt=p([B({type:R.Sequence})],Gt);let pn=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],pn.prototype,"namedCurve",void 0);p([g({type:$.Null})],pn.prototype,"implicitCurve",void 0);p([g({type:Gt})],pn.prototype,"specifiedCurve",void 0);pn=p([B({type:R.Choice})],pn);class ca{constructor(e={}){this.version=1,this.privateKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],ca.prototype,"version",void 0);p([g({type:le})],ca.prototype,"privateKey",void 0);p([g({type:pn,context:0,optional:!0})],ca.prototype,"parameters",void 0);p([g({type:$.BitString,context:1,optional:!0})],ca.prototype,"publicKey",void 0);class Xo{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],Xo.prototype,"r",void 0);p([g({type:$.Integer,converter:_e})],Xo.prototype,"s",void 0);const Ye="1.2.840.113549.1.1",Bn=`${Ye}.1`,Iw=`${Ye}.7`,Nw=`${Ye}.9`,Gr=`${Ye}.10`,Cw=`${Ye}.2`,jw=`${Ye}.4`,Zo=`${Ye}.5`,Ow=`${Ye}.14`,Zc=`${Ye}.11`,Yo=`${Ye}.12`,Qo=`${Ye}.13`,Fg=`${Ye}.15`,Dg=`${Ye}.16`,es="1.3.14.3.2.26",Vg="2.16.840.1.101.3.4.2.4",ts="2.16.840.1.101.3.4.2.1",ns="2.16.840.1.101.3.4.2.2",rs="2.16.840.1.101.3.4.2.3",Pw="2.16.840.1.101.3.4.2.5",Tw="2.16.840.1.101.3.4.2.6",Rw="1.2.840.113549.2.2",Bw="1.2.840.113549.2.5",da=`${Ye}.8`;function Ne(t){return new H({algorithm:t,parameters:null})}Ne(Rw);Ne(Bw);const Ln=Ne(es);Ne(Vg);Ne(ts);Ne(ns);Ne(rs);Ne(Pw);Ne(Tw);const qg=new H({algorithm:da,parameters:F.serialize(Ln)}),Hg=new H({algorithm:Nw,parameters:F.serialize(jo.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});Ne(Bn);Ne(Cw);Ne(jw);Ne(Zo);Ne(Fg);Ne(Dg);Ne(Yo);Ne(Qo);Ne(Fg);Ne(Dg);class la{constructor(e={}){this.hashAlgorithm=new H(Ln),this.maskGenAlgorithm=new H({algorithm:da,parameters:F.serialize(Ln)}),this.pSourceAlgorithm=new H(Hg),Object.assign(this,e)}}p([g({type:H,context:0,defaultValue:Ln})],la.prototype,"hashAlgorithm",void 0);p([g({type:H,context:1,defaultValue:qg})],la.prototype,"maskGenAlgorithm",void 0);p([g({type:H,context:2,defaultValue:Hg})],la.prototype,"pSourceAlgorithm",void 0);new H({algorithm:Iw,parameters:F.serialize(new la)});class Un{constructor(e={}){this.hashAlgorithm=new H(Ln),this.maskGenAlgorithm=new H({algorithm:da,parameters:F.serialize(Ln)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}p([g({type:H,context:0,defaultValue:Ln})],Un.prototype,"hashAlgorithm",void 0);p([g({type:H,context:1,defaultValue:qg})],Un.prototype,"maskGenAlgorithm",void 0);p([g({type:$.Integer,context:2,defaultValue:20})],Un.prototype,"saltLength",void 0);p([g({type:$.Integer,context:3,defaultValue:1})],Un.prototype,"trailerField",void 0);new H({algorithm:Gr,parameters:F.serialize(new Un)});class ua{constructor(e={}){this.digestAlgorithm=new H,this.digest=new le,Object.assign(this,e)}}p([g({type:H})],ua.prototype,"digestAlgorithm",void 0);p([g({type:le})],ua.prototype,"digest",void 0);var Yc;class pa{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],pa.prototype,"prime",void 0);p([g({type:$.Integer,converter:_e})],pa.prototype,"exponent",void 0);p([g({type:$.Integer,converter:_e})],pa.prototype,"coefficient",void 0);let Qc=Yc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Yc.prototype)}};Qc=Yc=p([B({type:R.Sequence,itemType:pa})],Qc);class Rt{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer})],Rt.prototype,"version",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"modulus",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"publicExponent",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"privateExponent",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"prime1",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"prime2",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"exponent1",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"exponent2",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"coefficient",void 0);p([g({type:Qc,optional:!0})],Rt.prototype,"otherPrimeInfos",void 0);class jl{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],jl.prototype,"modulus",void 0);p([g({type:$.Integer,converter:_e})],jl.prototype,"publicExponent",void 0);var ed;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(ed||(ed={}));const We=ed;/*! *****************************************************************************
|
|
103
|
+
`)}`:`${n} :`}}C0=Xe;K.Constructed=C0;Xe.NAME="CONSTRUCTED";class j0 extends Ke{fromBER(e,n,r){return n}toBER(e){return $t}}j0.override="EndOfContentValueBlock";var O0;class el extends Ue{constructor(e={}){super(e,j0),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}O0=el;K.EndOfContent=O0;el.NAME=ti;var P0;class Cn extends Ue{constructor(e={}){super(e,Ke),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,n,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,n+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):n+r}toBER(e,n){const r=new ArrayBuffer(2);if(!e){const i=new Uint8Array(r);i[0]=5,i[1]=0}return n&&n.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}P0=Cn;K.Null=P0;Cn.NAME="NULL";class T0 extends Pt(Ke){constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=D.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,n,r){const i=D.toUint8Array(e);return Yt(this,i,n,r)?(this.valueHexView=i.subarray(n,n+r),r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,x0.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}T0.NAME="BooleanValueBlock";var R0;let Ns=class extends Ue{constructor(e={}){super(e,T0),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};R0=Ns;K.Boolean=R0;Ns.NAME="BOOLEAN";class B0 extends Pt(an){constructor({isConstructed:e=!1,...n}={}){super(n),this.isConstructed=e}fromBER(e,n,r){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=an.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let o=0;o<this.value.length;o++){const a=this.value[o].constructor.NAME;if(a===ti){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==k0)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,n,r),this.blockLength=r;return i}toBER(e,n){return this.isConstructed?an.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}B0.NAME="OctetStringValueBlock";var L0;let zn=class U0 extends Ue{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},B0),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,n,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,r===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),n;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(o.byteLength){const a=Sr(o,0,o.byteLength);a.offset!==-1&&a.offset===r&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Xe.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${J.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof U0&&e.push(n.valueBlock.valueHexView);return D.concat(e)}};L0=zn;K.OctetString=L0;zn.NAME=k0;class M0 extends Pt(an){constructor({unusedBits:e=0,isConstructed:n=!1,...r}={}){super(r),this.unusedBits=e,this.isConstructed=n,this.blockLength=this.valueHexView.byteLength}fromBER(e,n,r){if(!r)return n;let i=-1;if(this.isConstructed){if(i=an.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const c of this.value){const d=c.constructor.NAME;if(d===ti){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(d!==S0)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const l=c.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return i}const o=D.toUint8Array(e);if(!Yt(this,o,n,r))return-1;const a=o.subarray(n,n+r);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=a.subarray(1);try{if(c.byteLength){const d=Sr(c,0,c.byteLength);d.offset!==-1&&d.offset===r-1&&(this.value=[d.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,n+r}toBER(e,n){if(this.isConstructed)return an.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return $t;const r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}M0.NAME="BitStringValueBlock";var F0;let In=class extends Ue{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},M0),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,n,r){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Xe.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const i of n)e.push(i.toString(2).padStart(8,"0"));const r=e.join("");return`${this.constructor.NAME} : ${r.substring(0,r.length-this.valueBlock.unusedBits)}`}}};F0=In;K.BitString=F0;In.NAME=S0;var D0;function F2(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let o=r.slice(0);const a=o.length-1,c=i.slice(0),d=c.length-1;let l=0;const u=d<a?a:d;let f=0;for(let m=u;m>=0;m--,f++){switch(!0){case f<c.length:l=o[a-f]+c[d-f]+n[0];break;default:l=o[a-f]+n[0]}switch(n[0]=l/10,!0){case f>=o.length:o=oc(new Uint8Array([l%10]),o);break;default:o[a-f]=l%10}}return n[0]>0&&(o=oc(n,o)),o}function Ku(t){if(t>=Mr.length)for(let e=Mr.length;e<=t;e++){const n=new Uint8Array([0]);let r=Mr[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const o=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=o[0]/10,r[i]=o[0]%10}n[0]>0&&(r=oc(n,r)),Mr.push(r)}return Mr[t]}function D2(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),o=r.slice(0),a=o.length-1,c=i.slice(0),d=c.length-1;let l,u=0;for(let f=d;f>=0;f--,u++)switch(l=o[a-u]-c[d-u]-n,!0){case l<0:n=1,o[a-u]=l+10;break;default:n=0,o[a-u]=l}if(n>0)for(let f=a-d+1;f>=0;f--,u++)if(l=o[a-u]-n,l<0)n=1,o[a-u]=l+10;else{n=0,o[a-u]=l;break}return o.slice()}class tl extends Pt(Ke){constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=x0.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(I2(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const o=this.fromBER(e,n,r);if(o===-1)return o;const a=this.valueHexView;return a[0]===0&&a[1]&128?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),o}toDER(e=!1){const n=this.valueHexView;switch(!0){case(n[0]&128)!==0:{const r=new Uint8Array(this.valueHexView.length+1);r[0]=0,r.set(n,1),this.valueHexView=r}break;case(n[0]===0&&(n[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,n,r){const i=super.fromBER(e,n,r);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let n=new Uint8Array(this.valueHexView.length*8/3),r=0,i;const o=this.valueHexView;let a="",c=!1;for(let d=o.byteLength-1;d>=0;d--){i=o[d];for(let l=0;l<8;l++){if((i&1)===1)switch(r){case e:n=D2(Ku(r),n),a="-";break;default:n=F2(n,Ku(r))}r++,i>>=1}}for(let d=0;d<n.length;d++)n[d]&&(c=!0),c&&(a+=qu.charAt(n[d]));return c===!1&&(a+=qu.charAt(0)),a}}D0=tl;tl.NAME="IntegerValueBlock";Object.defineProperty(D0.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var V0;class Nt extends Ue{constructor(e={}){super(e,tl),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Io(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Io();const n=BigInt(e),r=new zs,i=n.toString(16).replace(/^-/,""),o=new Uint8Array(J.FromHex(i));if(n<0){const c=new Uint8Array(o.length+(o[0]&128?1:0));c[0]|=128;const l=BigInt(`0x${J.ToHex(c)}`)+n,u=D.toUint8Array(J.FromHex(l.toString(16)));u[0]|=128,r.write(u)}else o[0]&128&&r.write(new Uint8Array([0])),r.write(o);return new Nt({valueHex:r.final()})}convertToDER(){const e=new Nt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new Nt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}V0=Nt;K.Integer=V0;Nt.NAME="INTEGER";var q0;class Cs extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}q0=Cs;K.Enumerated=q0;Cs.NAME="ENUMERATED";class sc extends Pt(Ke){constructor({valueDec:e=-1,isFirstSid:n=!1,...r}={}){super(r),this.valueDec=e,this.isFirstSid=n}fromBER(e,n,r){if(!r)return n;const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let c=0;c<r&&(this.valueHexView[c]=o[c]&127,this.blockLength++,!!(o[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=lr(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){Io();let n=BigInt(e).toString(2);for(;n.length%7;)n="0"+n;const r=new Uint8Array(n.length/7);for(let i=0;i<r.length;i++)r[i]=parseInt(n.slice(i*7,i*7+7),2)+(i+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Nn(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",$t;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r}toString(){let e="";if(this.isHexOnly)e=J.ToHex(this.valueHexView);else if(this.isFirstSid){let n=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",n-=40):(e="2.",n-=80),e+=n.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}sc.NAME="sidBlock";class H0 extends Ke{constructor({value:e=Je,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new sc;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e){const n=[];for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(i.byteLength===0)return this.error=this.value[r].error,$t;n.push(i)}return Yd(n)}fromString(e){this.value=[];let n=0,r=0,i="",o=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,o){const a=this.value[0];let c=0;switch(a.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const d=parseInt(i,10);if(isNaN(d))return;a.valueDec=d+c,o=!1}else{const a=new sc;if(i>Number.MAX_SAFE_INTEGER){Io();const c=BigInt(i);a.valueBigInt=c}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,o=!0),this.value.push(a)}while(r!==-1)}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n?(i=`{${i}}`,this.value[r].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}H0.NAME="ObjectIdentifierValueBlock";var K0;class js extends Ue{constructor(e={}){super(e,H0),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}K0=js;K.ObjectIdentifier=K0;js.NAME="OBJECT IDENTIFIER";class ac extends Pt(qn){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=D.toUint8Array(e);if(!Yt(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let c=0;c<r&&(this.valueHexView[c]=o[c]&127,this.blockLength++,!!(o[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=lr(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Nn(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",$t;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r.buffer}toString(){let e="";return this.isHexOnly?e=J.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}ac.NAME="relativeSidBlock";class G0 extends Ke{constructor({value:e=Je,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new ac;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,$t;r.push(o)}return Yd(r)}fromString(e){this.value=[];let n=0,r=0,i="";do{r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1;const o=new ac;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(r!==-1);return!0}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n&&(i=`{${i}}`),e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}G0.NAME="RelativeObjectIdentifierValueBlock";var W0;class nl extends Ue{constructor(e={}){super(e,G0),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}W0=nl;K.RelativeObjectIdentifier=W0;nl.NAME="RelativeObjectIdentifier";var J0;class Mt extends Xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}J0=Mt;K.Sequence=J0;Mt.NAME="SEQUENCE";var X0;let Ft=class extends Xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};X0=Ft;K.Set=X0;Ft.NAME="SET";class Z0 extends Pt(Ke){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Je}toJSON(){return{...super.toJSON(),value:this.value}}}Z0.NAME="StringValueBlock";class Y0 extends Z0{}Y0.NAME="SimpleStringValueBlock";class nt extends Qd{constructor({...e}={}){super(e,Y0)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,D.toUint8Array(e))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);this.valueBlock.value=e}}nt.NAME="SIMPLE STRING";class Q0 extends nt{fromBuffer(e){this.valueBlock.valueHexView=D.toUint8Array(e);try{this.valueBlock.value=J.ToUtf8String(e)}catch(n){this.warnings.push(`Error during "decodeURIComponent": ${n}, using raw string`),this.valueBlock.value=J.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(J.FromUtf8String(e)),this.valueBlock.value=e}}Q0.NAME="Utf8StringValueBlock";var eg;class Qt extends Q0{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}eg=Qt;K.Utf8String=eg;Qt.NAME="UTF8String";class tg extends nt{fromBuffer(e){this.valueBlock.value=J.ToUtf16String(e),this.valueBlock.valueHexView=D.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(J.FromUtf16String(e))}}tg.NAME="BmpStringValueBlock";var ng;class Os extends tg{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}ng=Os;K.BmpString=ng;Os.NAME="BMPString";class rg extends nt{fromBuffer(e){const n=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),r=new Uint8Array(n);for(let i=0;i<r.length;i+=4)r[i]=r[i+3],r[i+1]=r[i+2],r[i+2]=0,r[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(n))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n*4);for(let i=0;i<n;i++){const o=Nn(e.charCodeAt(i),8),a=new Uint8Array(o);if(a.length>4)continue;const c=4-a.length;for(let d=a.length-1;d>=0;d--)r[i*4+d+c]=a[d]}this.valueBlock.value=e}}rg.NAME="UniversalStringValueBlock";var ig;class Ps extends rg{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}ig=Ps;K.UniversalString=ig;Ps.NAME="UniversalString";var og;class Ts extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}og=Ts;K.NumericString=og;Ts.NAME="NumericString";var sg;class Rs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}sg=Rs;K.PrintableString=sg;Rs.NAME="PrintableString";var ag;class Bs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}ag=Bs;K.TeletexString=ag;Bs.NAME="TeletexString";var cg;class Ls extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}cg=Ls;K.VideotexString=cg;Ls.NAME="VideotexString";var dg;class Us extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}dg=Us;K.IA5String=dg;Us.NAME="IA5String";var lg;class Ms extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}lg=Ms;K.GraphicString=lg;Ms.NAME="GraphicString";var ug;class $i extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}ug=$i;K.VisibleString=ug;$i.NAME="VisibleString";var pg;class Fs extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}pg=Fs;K.GeneralString=pg;Fs.NAME="GeneralString";var fg;class Ds extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}fg=Ds;K.CharacterString=fg;Ds.NAME="CharacterString";var hg;class xi extends $i{constructor({value:e,valueDate:n,...r}={}){if(super(r),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}n&&(this.fromDate(n),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,D.toUint8Array(e)))}toBuffer(){const e=this.toString(),n=new ArrayBuffer(e.length),r=new Uint8Array(n);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return n}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const r=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(r===null){this.error="Wrong input string for conversion";return}const i=parseInt(r[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(r[2],10),this.day=parseInt(r[3],10),this.hour=parseInt(r[4],10),this.minute=parseInt(r[5],10),this.second=parseInt(r[6],10)}toString(e="iso"){if(e==="iso"){const n=new Array(7);return n[0]=et(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=et(this.month,2),n[2]=et(this.day,2),n[3]=et(this.hour,2),n[4]=et(this.minute,2),n[5]=et(this.second,2),n[6]="Z",n.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}hg=xi;K.UTCTime=hg;xi.NAME="UTCTime";var gg;class Vs extends xi{constructor(e={}){var n;super(e),(n=this.millisecond)!==null&&n!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let n=!1,r="",i="",o=0,a,c=0,d=0;if(e[e.length-1]==="Z")r=e.substring(0,e.length-1),n=!0;else{const f=new Number(e[e.length-1]);if(isNaN(f.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(r.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(r.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let f=1,m=r.indexOf("+"),w="";if(m===-1&&(m=r.indexOf("-"),f=-1),m!==-1){if(w=r.substring(m+1),r=r.substring(0,m),w.length!==2&&w.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(w.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=f*h,w.length===4){if(h=parseInt(w.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");d=f*h}}}let l=r.indexOf(".");if(l===-1&&(l=r.indexOf(",")),l!==-1){const f=new Number(`0${r.substring(l)}`);if(isNaN(f.valueOf()))throw new Error("Wrong input string for conversion");o=f.valueOf(),i=r.substring(0,l)}else i=r;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let f=60*o;this.minute=Math.floor(f),f=60*(f-this.minute),this.second=Math.floor(f),f=1e3*(f-this.second),this.millisecond=Math.floor(f)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let f=60*o;this.second=Math.floor(f),f=1e3*(f-this.second),this.millisecond=Math.floor(f)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){const f=1e3*o;this.millisecond=Math.floor(f)}break;default:throw new Error("Wrong input string for conversion")}const u=a.exec(i);if(u===null)throw new Error("Wrong input string for conversion");for(let f=1;f<u.length;f++)switch(f){case 1:this.year=parseInt(u[f],10);break;case 2:this.month=parseInt(u[f],10);break;case 3:this.day=parseInt(u[f],10);break;case 4:this.hour=parseInt(u[f],10)+c;break;case 5:this.minute=parseInt(u[f],10)+d;break;case 6:this.second=parseInt(u[f],10);break;default:throw new Error("Wrong input string for conversion")}if(n===!1){const f=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=f.getUTCFullYear(),this.month=f.getUTCMonth(),this.day=f.getUTCDay(),this.hour=f.getUTCHours(),this.minute=f.getUTCMinutes(),this.second=f.getUTCSeconds(),this.millisecond=f.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const n=[];return n.push(et(this.year,4)),n.push(et(this.month,2)),n.push(et(this.day,2)),n.push(et(this.hour,2)),n.push(et(this.minute,2)),n.push(et(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(et(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}gg=Vs;K.GeneralizedTime=gg;Vs.NAME="GeneralizedTime";var mg;class rl extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}mg=rl;K.DATE=mg;rl.NAME="DATE";var _g;class il extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}_g=il;K.TimeOfDay=_g;il.NAME="TimeOfDay";var yg;class ol extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}yg=ol;K.DateTime=yg;ol.NAME="DateTime";var wg;class sl extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}wg=sl;K.Duration=wg;sl.NAME="Duration";var vg;class al extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}vg=al;K.TIME=vg;al.NAME="TIME";class jn{constructor({name:e=Je,optional:n=!1}={}){this.name=e,this.optional=n}}class cl extends jn{constructor({value:e=[],...n}={}){super(n),this.value=e}}class No extends jn{constructor({value:e=new jn,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class V2{constructor({data:e=Is}={}){this.dataView=D.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=D.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=D.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function Sn(t,e,n){if(n instanceof cl){for(let o=0;o<n.value.length;o++)if(Sn(t,e,n.value[o]).verified)return{verified:!0,result:t};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(za)&&(o.name=n.name),o}}if(n instanceof jn)return n.hasOwnProperty(za)&&(t[n.name]=e),{verified:!0,result:t};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(j2 in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(R2 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(B2 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=n.idBlock.toBER(!1);if(r.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(n.idBlock.fromBER(r,0,r.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(n.idBlock.hasOwnProperty(O2)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(P2)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(T2)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(C2 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(n.idBlock.isHexOnly){if(!(Hu in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=n.idBlock.valueHexView,a=e.idBlock.valueHexView;if(o.length!==a.length)return{verified:!1,result:t};for(let c=0;c<o.length;c++)if(o[c]!==a[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(t[n.name]=e)),n instanceof K.Constructed){let o=0,a={verified:!1,result:{error:"Unknown error"}},c=n.valueBlock.value.length;if(c>0&&n.valueBlock.value[0]instanceof No&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&n.valueBlock.value.length!==0){let d=!0;for(let l=0;l<n.valueBlock.value.length;l++)d=d&&(n.valueBlock.value[l].optional||!1);return d?{verified:!0,result:t}:(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let d=0;d<c;d++)if(d-o>=e.valueBlock.value.length){if(n.valueBlock.value[d].optional===!1){const l={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(delete t[n.name],l.name=n.name)),l}}else if(n.valueBlock.value[0]instanceof No){if(a=Sn(t,e.valueBlock.value[d],n.valueBlock.value[0].value),a.verified===!1)if(n.valueBlock.value[0].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&delete t[n.name]),a;if(za in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let l={};L2 in n.valueBlock.value[0]&&n.valueBlock.value[0].local?l=e:l=t,typeof l[n.valueBlock.value[0].name]>"u"&&(l[n.valueBlock.value[0].name]=[]),l[n.valueBlock.value[0].name].push(e.valueBlock.value[d])}}else if(a=Sn(t,e.valueBlock.value[d-o],n.valueBlock.value[d]),a.verified===!1)if(n.valueBlock.value[d].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&delete t[n.name]),a;if(a.verified===!1){const d={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(delete t[n.name],d.name=n.name)),d}return{verified:!0,result:t}}if(n.primitiveSchema&&Hu in e.valueBlock){const o=Sr(e.valueBlock.valueHexView);if(o.offset===-1){const a={verified:!1,result:o.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Je),n.name&&(delete t[n.name],a.name=n.name)),a}return Sn(t,o.result,n.primitiveSchema)}return{verified:!0,result:t}}function q2(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Sr(D.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:Sn(n.result,n.result,e)}const bg=Object.freeze(Object.defineProperty({__proto__:null,Any:jn,BaseBlock:Ue,BaseStringBlock:Qd,BitString:In,BmpString:Os,Boolean:Ns,CharacterString:Ds,Choice:cl,Constructed:Xe,DATE:rl,DateTime:ol,Duration:sl,EndOfContent:el,Enumerated:Cs,GeneralString:Fs,GeneralizedTime:Vs,GraphicString:Ms,HexBlock:Pt,IA5String:Us,Integer:Nt,Null:Cn,NumericString:Ts,ObjectIdentifier:js,OctetString:zn,Primitive:bi,PrintableString:Rs,RawData:V2,RelativeObjectIdentifier:nl,Repeated:No,Sequence:Mt,Set:Ft,TIME:al,TeletexString:Bs,TimeOfDay:il,UTCTime:xi,UniversalString:Ps,Utf8String:Qt,ValueBlock:Ke,VideotexString:Ls,ViewWriter:zs,VisibleString:$i,compareSchema:Sn,fromBER:sr,verifySchema:q2},Symbol.toStringTag,{value:"Module"}));var R;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(R||(R={}));var $;(function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"})($||($={}));class qs{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(D.isBufferSource(e))this.unusedBits=n,this.value=D.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof In))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new In({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new In({name:e})}toNumber(){let e="";const n=new Uint8Array(this.value);for(const r of n)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let n=e.toString(2);const r=n.length+7>>3;this.unusedBits=(r<<3)-n.length;const i=new Uint8Array(r);n=n.padStart(r<<3,"0").split("").reverse().join("");let o=0;for(;o<r;)i[o]=parseInt(n.slice(o<<3,(o<<3)+8),2),o++;this.value=i.buffer}}class le{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):D.isBufferSource(e)?this.buffer=D.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof zn))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new zn({valueHex:this.buffer})}toSchema(e){return new zn({name:e})}}const H2={fromASN:t=>t instanceof Cn?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new Cn;const e=sr(t);if(e.result.error)throw new Error(e.result.error);return e.result}},K2={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new Nt({value:+t})},G2={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new Cs({value:t})},_e={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Nt({valueHex:t})},W2={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new In({valueHex:t})},J2={fromASN:t=>t.valueBlock.toString(),toASN:t=>new js({value:t})},X2={fromASN:t=>t.valueBlock.value,toASN:t=>new Ns({value:t})},Co={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new zn({valueHex:t})},Z2={fromASN:t=>new le(t.getValue()),toASN:t=>t.toASN()};function lt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const $g=lt(Qt),Y2=lt(Os),Q2=lt(Ps),ew=lt(Ts),tw=lt(Rs),nw=lt(Bs),rw=lt(Ls),iw=lt(Us),ow=lt(Ms),sw=lt($i),aw=lt(Fs),cw=lt(Ds),dw={fromASN:t=>t.toDate(),toASN:t=>new xi({valueDate:t})},lw={fromASN:t=>t.toDate(),toASN:t=>new Vs({valueDate:t})},uw={fromASN:()=>null,toASN:()=>new Cn};function dl(t){switch(t){case $.Any:return H2;case $.BitString:return W2;case $.BmpString:return Y2;case $.Boolean:return X2;case $.CharacterString:return cw;case $.Enumerated:return G2;case $.GeneralString:return aw;case $.GeneralizedTime:return lw;case $.GraphicString:return ow;case $.IA5String:return iw;case $.Integer:return K2;case $.Null:return uw;case $.NumericString:return ew;case $.ObjectIdentifier:return J2;case $.OctetString:return Co;case $.PrintableString:return tw;case $.TeletexString:return nw;case $.UTCTime:return dw;case $.UniversalString:return Q2;case $.Utf8String:return $g;case $.VideotexString:return rw;case $.VisibleString:return sw;default:return null}}function Ut(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Ut(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function xg(t){var e;if(t){const n=Object.getPrototypeOf(t);return((e=n==null?void 0:n.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:xg(n)}return!1}function pw(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(n[i]!==r[i])return!1;return!0}class fw{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,n=!1){const r=this.items.get(e);if(!r)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(n&&!r.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return r}cache(e){const n=this.get(e);n.schema||(n.schema=this.create(e,!0))}createDefault(e){const n={type:R.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(n,r),n.items=Object.assign({},n.items,r.items)),n}create(e,n){const r=this.items.get(e)||this.createDefault(e),i=[];for(const o in r.items){const a=r.items[o],c=n?o:"";let d;if(typeof a.type=="number"){const u=$[a.type],f=bg[u];if(!f)throw new Error(`Cannot get ASN1 class by name '${u}'`);d=new f({name:c})}else Ut(a.type)?d=new a.type().toSchema(c):a.optional?this.get(a.type).type===R.Choice?d=new jn({name:c}):(d=this.create(a.type,!1),d.name=c):d=new jn({name:c});const l=!!a.optional||a.defaultValue!==void 0;if(a.repeated){d.name="";const u=a.repeated==="set"?Ft:Mt;d=new u({name:"",value:[new No({name:c,value:d})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||Ut(a.type)){const u=a.repeated?Xe:bi;i.push(new u({name:c,optional:l,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const u=!!a.repeated;let f=u?d:this.get(a.type,!0).schema;f="valueBlock"in f?f.valueBlock.value:f.value,i.push(new Xe({name:u?"":c,optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:f}))}else i.push(new Xe({optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:[d]}));else d.optional=l,i.push(d)}switch(r.type){case R.Sequence:return new Mt({value:i,name:""});case R.Set:return new Ft({value:i,name:""});case R.Choice:return new cl({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,n){return this.items.set(e,n),this}findParentSchema(e){const n=Object.getPrototypeOf(e);return n?this.items.get(n)||this.findParentSchema(n):null}}const ot=new fw,B=t=>e=>{let n;ot.has(e)?n=ot.get(e):(n=ot.createDefault(e),ot.set(e,n)),Object.assign(n,t)},g=t=>(e,n)=>{let r;ot.has(e.constructor)?r=ot.get(e.constructor):(r=ot.createDefault(e.constructor),ot.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const o=dl(t.type);if(!o)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=o}r.items[n]=i};class Gu extends Error{constructor(){super(...arguments),this.schemas=[]}}class hw{static parse(e,n){const r=sr(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){var r;try{if(Ut(n))return new n().fromASN(e);const i=ot.get(n);ot.cache(n);let o=i.schema;if(e.constructor===Xe&&i.type!==R.Choice){o=new Xe({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(const d in i.items)delete e[d]}const a=Sn({},e,o);if(!a.verified)throw new Gu(`Data does not match to ${n.name} ASN1 schema. ${a.result.error}`);const c=new n;if(xg(n)){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const d=i.itemType;if(typeof d=="number"){const l=dl(d);if(!l)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);return n.from(e.valueBlock.value,u=>l.fromASN(u))}else return n.from(e.valueBlock.value,l=>this.fromASN(l,d))}for(const d in i.items){const l=a.result[d];if(!l)continue;const u=i.items[d],f=u.type;if(typeof f=="number"||Ut(f)){const m=(r=u.converter)!==null&&r!==void 0?r:Ut(f)?new f:null;if(!m)throw new Error("Converter is empty");if(u.repeated)if(u.implicit){const w=u.repeated==="sequence"?Mt:Ft,h=new w;h.valueBlock=l.valueBlock;const y=sr(h.toBER(!1));if(y.offset===-1)throw new Error(`Cannot parse the child item. ${y.result.error}`);if(!("value"in y.result.valueBlock&&Array.isArray(y.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const v=y.result.valueBlock.value;c[d]=Array.from(v,b=>m.fromASN(b))}else c[d]=Array.from(l,w=>m.fromASN(w));else{let w=l;if(u.implicit){let h;if(Ut(f))h=new f().toSchema("");else{const y=$[f],v=bg[y];if(!v)throw new Error(`Cannot get '${y}' class from asn1js module`);h=new v}h.valueBlock=w.valueBlock,w=sr(h.toBER(!1)).result}c[d]=m.fromASN(w)}}else if(u.repeated){if(!Array.isArray(l))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");c[d]=Array.from(l,m=>this.fromASN(m,f))}else c[d]=this.fromASN(l,f)}return c}catch(i){throw i instanceof Gu&&i.schemas.push(n.name),i}}}class ll{static serialize(e){return e instanceof Ue?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Ut(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=ot.get(n);ot.cache(n);let i=[];if(r.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof r.itemType=="number"){const a=dl(r.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(c=>a.toASN(c))}else i=e.map(a=>this.toAsnItem({type:r.itemType},"[]",n,a))}else for(const a in r.items){const c=r.items[a],d=e[a];if(d===void 0||c.defaultValue===d||typeof c.defaultValue=="object"&&typeof d=="object"&&pw(this.serialize(c.defaultValue),this.serialize(d)))continue;const l=ll.toAsnItem(c,a,n,d);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||Ut(c.type))){const u={};u.valueHex=l instanceof Cn?l.valueBeforeDecodeView:l.valueBlock.toBER(),i.push(new bi({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...u}))}else i.push(new Xe({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:l.valueBlock.value}));else i.push(new Xe({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[l]}));else c.repeated?i=i.concat(l):i.push(l)}let o;switch(r.type){case R.Sequence:o=new Mt({value:i});break;case R.Set:o=new Ft({value:i});break;case R.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,n,r,i){let o;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${n}' doesn't have converter for type ${$[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,l=>a.toASN(l)),d=e.repeated==="sequence"?Mt:Ft;o=new d({value:c})}else o=a.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const a=Array.from(i,d=>this.toASN(d)),c=e.repeated==="sequence"?Mt:Ft;o=new c({value:a})}else o=this.toASN(i);return o}}class fe extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const n of e)this.push(n)}}}class F{static serialize(e){return ll.serialize(e)}static parse(e,n){return hw.parse(e,n)}static toString(e){const n=D.isBufferSource(e)?D.toArrayBuffer(e):F.serialize(e),r=sr(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function p(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(o=(i<3?a(o):i>3?a(e,n,o):a(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}var kg={exports:{}};(function(t){(function(e){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",d={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${n}\\.${n}\\.${n}\\.${n}(${a})?$`,"i")};function l(h,y){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let v=0,b=-1,E=(h.match(d.zoneIndex)||[])[0],C,L;for(E&&(E=E.substring(1),h=h.replace(/%.+$/,""));(b=h.indexOf(":",b+1))>=0;)v++;if(h.substr(0,2)==="::"&&v--,h.substr(-2,2)==="::"&&v--,v>y)return null;for(L=y-v,C=":";L--;)C+="0:";return h=h.replace("::",C),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),y=function(){const Y=h.split(":"),se=[];for(let ae=0;ae<Y.length;ae++)se.push(parseInt(Y[ae],16));return se}(),{parts:y,zoneId:E}}function u(h,y,v,b){if(h.length!==y.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let E=0,C;for(;b>0;){if(C=v-b,C<0&&(C=0),h[E]>>C!==y[E]>>C)return!1;b-=v,E+=1}return!0}function f(h){if(o.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(i.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}function m(h,y){for(;h.length<y;)h=`0${h}`;return h}const w={};w.IPv4=function(){function h(y){if(y.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let v,b;for(v=0;v<y.length;v++)if(b=y[v],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=y}return h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(y,v){let b;if(v===void 0&&(b=y,y=b[0],v=b[1]),y.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,y.octets,8,v)},h.prototype.prefixLengthFromSubnetMask=function(){let y=0,v=!1;const b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let E,C,L;for(E=3;E>=0;E-=1)if(C=this.octets[E],C in b){if(L=b[C],v&&L!==0)return null;L!==8&&(v=!0),y+=L}else return null;return 32-y},h.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h}(),w.IPv4.broadcastAddressFromCIDR=function(h){try{const y=this.parseCIDR(h),v=y[0].toByteArray(),b=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[];let C=0;for(;C<4;)E.push(parseInt(v[C],10)|parseInt(b[C],10)^255),C++;return new this(E)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(h){return this.parser(h)!==null},w.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},w.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(h){return!!(w.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(h){let y,v,b,E,C;try{for(y=this.parseCIDR(h),b=y[0].toByteArray(),C=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[],v=0;v<4;)E.push(parseInt(b[v],10)&parseInt(C[v],10)),v++;return new this(E)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(h){const y=this.parser(h);if(y===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(y)},w.IPv4.parseCIDR=function(h){let y;if(y=h.match(/^(.+)\/(\d+)$/)){const v=parseInt(y[2]);if(v>=0&&v<=32){const b=[this.parse(y[1]),v];return Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(h){let y,v,b;if(y=h.match(r.fourOctet))return function(){const E=y.slice(1,6),C=[];for(let L=0;L<E.length;L++)v=E[L],C.push(f(v));return C}();if(y=h.match(r.longValue)){if(b=f(y[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return function(){const E=[];let C;for(C=0;C<=24;C+=8)E.push(b>>C&255);return E}().reverse()}else return(y=h.match(r.twoOctet))?function(){const E=y.slice(1,4),C=[];if(b=f(E[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return C.push(f(E[0])),C.push(b>>16&255),C.push(b>>8&255),C.push(b&255),C}():(y=h.match(r.threeOctet))?function(){const E=y.slice(1,5),C=[];if(b=f(E[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return C.push(f(E[0])),C.push(f(E[1])),C.push(b>>8&255),C.push(b&255),C}():null},w.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");const y=[0,0,0,0];let v=0;const b=Math.floor(h/8);for(;v<b;)y[v]=255,v++;return b<4&&(y[b]=Math.pow(2,h%8)-1<<8-h%8),new this(y)},w.IPv6=function(){function h(y,v){let b,E;if(y.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(y[b]<<8|y[b+1]);else if(y.length===8)this.parts=y;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(E=this.parts[b],!(0<=E&&E<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");v&&(this.zoneId=v)}return h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(y,v){let b;if(v===void 0&&(b=y,y=b[0],v=b[1]),y.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,y.parts,16,v)},h.prototype.prefixLengthFromSubnetMask=function(){let y=0,v=!1;const b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let E,C;for(let L=7;L>=0;L-=1)if(E=this.parts[L],E in b){if(C=b[E],v&&C!==0)return null;C!==16&&(v=!0),y+=C}else return null;return 128-y},h.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let y;const v=[],b=this.parts;for(let E=0;E<b.length;E++)y=b[E],v.push(y>>8),v.push(y&255);return v},h.prototype.toFixedLengthString=function(){const y=(function(){const b=[];for(let E=0;E<this.parts.length;E++)b.push(m(this.parts[E].toString(16),4));return b}).call(this).join(":");let v="";return this.zoneId&&(v=`%${this.zoneId}`),y+v},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const y=this.parts.slice(-2),v=y[0],b=y[1];return new w.IPv4([v>>8,v&255,b>>8,b&255])},h.prototype.toNormalizedString=function(){const y=(function(){const b=[];for(let E=0;E<this.parts.length;E++)b.push(this.parts[E].toString(16));return b}).call(this).join(":");let v="";return this.zoneId&&(v=`%${this.zoneId}`),y+v},h.prototype.toRFC5952String=function(){const y=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString();let b=0,E=-1,C;for(;C=y.exec(v);)C[0].length>E&&(b=C.index,E=C[0].length);return E<0?v:`${v.substring(0,b)}::${v.substring(b+E)}`},h.prototype.toString=function(){return this.toRFC5952String()},h}(),w.IPv6.broadcastAddressFromCIDR=function(h){try{const y=this.parseCIDR(h),v=y[0].toByteArray(),b=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[];let C=0;for(;C<16;)E.push(parseInt(v[C],10)|parseInt(b[C],10)^255),C++;return new this(E)}catch(y){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${y})`)}},w.IPv6.isIPv6=function(h){return this.parser(h)!==null},w.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{const y=this.parser(h);return new this(y.parts,y.zoneId),!0}catch{return!1}},w.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(h){let y,v,b,E,C;try{for(y=this.parseCIDR(h),b=y[0].toByteArray(),C=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),E=[],v=0;v<16;)E.push(parseInt(b[v],10)&parseInt(C[v],10)),v++;return new this(E)}catch(L){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${L})`)}},w.IPv6.parse=function(h){const y=this.parser(h);if(y.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(y.parts,y.zoneId)},w.IPv6.parseCIDR=function(h){let y,v,b;if((v=h.match(/^(.+)\/(\d+)$/))&&(y=parseInt(v[2]),y>=0&&y<=128))return b=[this.parse(v[1]),y],Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(h){let y,v,b,E,C,L;if(b=h.match(d.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(d.native.test(h))return l(h,8);if((b=h.match(d.transitional))&&(L=b[6]||"",y=b[1],b[1].endsWith("::")||(y=y.slice(0,-1)),y=l(y+L,6),y.parts)){for(C=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],v=0;v<C.length;v++)if(E=C[v],!(0<=E&&E<=255))return null;return y.parts.push(C[0]<<8|C[1]),y.parts.push(C[2]<<8|C[3]),{parts:y.parts,zoneId:y.zoneId}}return null},w.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");const y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let v=0;const b=Math.floor(h/8);for(;v<b;)y[v]=255,v++;return b<16&&(y[b]=Math.pow(2,h%8)-1<<8-h%8),new this(y)},w.fromByteArray=function(h){const y=h.length;if(y===4)return new w.IPv4(h);if(y===16)return new w.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},w.isValid=function(h){return w.IPv6.isValid(h)||w.IPv4.isValid(h)},w.isValidCIDR=function(h){return w.IPv6.isValidCIDR(h)||w.IPv4.isValidCIDR(h)},w.parse=function(h){if(w.IPv6.isValid(h))return w.IPv6.parse(h);if(w.IPv4.isValid(h))return w.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},w.parseCIDR=function(h){try{return w.IPv6.parseCIDR(h)}catch{try{return w.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},w.process=function(h){const y=this.parse(h);return y.kind()==="ipv6"&&y.isIPv4MappedAddress()?y.toIPv4Address():y},w.subnetMatch=function(h,y,v){let b,E,C,L;v==null&&(v="unicast");for(E in y)if(Object.prototype.hasOwnProperty.call(y,E)){for(C=y[E],C[0]&&!(C[0]instanceof Array)&&(C=[C]),b=0;b<C.length;b++)if(L=C[b],h.kind()===L[0].kind()&&h.match.apply(h,L))return E}return v},t.exports?t.exports=w:e.ipaddr=w})(Eo)})(kg);var Wu=kg.exports;class Ju{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const n=parseInt(e.slice(8),16).toString(2).split("").reduce((i,o)=>i+ +o,0);let r=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return r=r.slice(0,-1),`${r}/${n}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const n=new Uint8Array(e);return Wu.fromByteArray(Array.from(n)).toString()}return this.decodeIP(J.ToHex(e))}static fromString(e){const n=Wu.parse(e);return new Uint8Array(n.toByteArray()).buffer}}var cc,dc,lc;let Me=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};p([g({type:$.TeletexString})],Me.prototype,"teletexString",void 0);p([g({type:$.PrintableString})],Me.prototype,"printableString",void 0);p([g({type:$.UniversalString})],Me.prototype,"universalString",void 0);p([g({type:$.Utf8String})],Me.prototype,"utf8String",void 0);p([g({type:$.BmpString})],Me.prototype,"bmpString",void 0);Me=p([B({type:R.Choice})],Me);let ur=class extends Me{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?J.ToHex(this.anyValue):super.toString())}};p([g({type:$.IA5String})],ur.prototype,"ia5String",void 0);p([g({type:$.Any})],ur.prototype,"anyValue",void 0);ur=p([B({type:R.Choice})],ur);class Hs{constructor(e={}){this.type="",this.value=new ur,Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Hs.prototype,"type",void 0);p([g({type:ur})],Hs.prototype,"value",void 0);let pr=cc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,cc.prototype)}};pr=cc=p([B({type:R.Set,itemType:Hs})],pr);let uc=dc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,dc.prototype)}};uc=dc=p([B({type:R.Sequence,itemType:pr})],uc);let $e=lc=class extends uc{constructor(e){super(e),Object.setPrototypeOf(this,lc.prototype)}};$e=lc=p([B({type:R.Sequence})],$e);const gw={fromASN:t=>Ju.toString(Co.fromASN(t)),toASN:t=>Co.toASN(Ju.fromString(t))};class ni{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ni.prototype,"typeId",void 0);p([g({type:$.Any,context:0})],ni.prototype,"value",void 0);class ul{constructor(e={}){this.partyName=new Me,Object.assign(this,e)}}p([g({type:Me,optional:!0,context:0,implicit:!0})],ul.prototype,"nameAssigner",void 0);p([g({type:Me,context:1,implicit:!0})],ul.prototype,"partyName",void 0);let ie=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ni,context:0,implicit:!0})],ie.prototype,"otherName",void 0);p([g({type:$.IA5String,context:1,implicit:!0})],ie.prototype,"rfc822Name",void 0);p([g({type:$.IA5String,context:2,implicit:!0})],ie.prototype,"dNSName",void 0);p([g({type:$.Any,context:3,implicit:!0})],ie.prototype,"x400Address",void 0);p([g({type:$e,context:4,implicit:!1})],ie.prototype,"directoryName",void 0);p([g({type:ul,context:5})],ie.prototype,"ediPartyName",void 0);p([g({type:$.IA5String,context:6,implicit:!0})],ie.prototype,"uniformResourceIdentifier",void 0);p([g({type:$.OctetString,context:7,implicit:!0,converter:gw})],ie.prototype,"iPAddress",void 0);p([g({type:$.ObjectIdentifier,context:8,implicit:!0})],ie.prototype,"registeredID",void 0);ie=p([B({type:R.Choice})],ie);const pl="1.3.6.1.5.5.7",mw=`${pl}.1`,Ar=`${pl}.3`,Ks=`${pl}.48`,Xu=`${Ks}.1`,Zu=`${Ks}.2`,Yu=`${Ks}.3`,Qu=`${Ks}.5`,gn="2.5.29";var pc;const fc=`${mw}.1`;class ki{constructor(e={}){this.accessMethod="",this.accessLocation=new ie,Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ki.prototype,"accessMethod",void 0);p([g({type:ie})],ki.prototype,"accessLocation",void 0);let ir=pc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,pc.prototype)}};ir=pc=p([B({type:R.Sequence,itemType:ki})],ir);const hc=`${gn}.35`;class fl extends le{}class An{constructor(e={}){e&&Object.assign(this,e)}}p([g({type:fl,context:0,optional:!0,implicit:!0})],An.prototype,"keyIdentifier",void 0);p([g({type:ie,context:1,optional:!0,implicit:!0,repeated:"sequence"})],An.prototype,"authorityCertIssuer",void 0);p([g({type:$.Integer,context:2,optional:!0,implicit:!0,converter:_e})],An.prototype,"authorityCertSerialNumber",void 0);const Sg=`${gn}.19`;class jo{constructor(e={}){this.cA=!1,Object.assign(this,e)}}p([g({type:$.Boolean,defaultValue:!1})],jo.prototype,"cA",void 0);p([g({type:$.Integer,optional:!0})],jo.prototype,"pathLenConstraint",void 0);var gc;let He=gc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,gc.prototype)}};He=gc=p([B({type:R.Sequence,itemType:ie})],He);var mc;let ep=mc=class extends He{constructor(e){super(e),Object.setPrototypeOf(this,mc.prototype)}};ep=mc=p([B({type:R.Sequence})],ep);var _c;const Ag=`${gn}.32`;let qt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};p([g({type:$.IA5String})],qt.prototype,"ia5String",void 0);p([g({type:$.VisibleString})],qt.prototype,"visibleString",void 0);p([g({type:$.BmpString})],qt.prototype,"bmpString",void 0);p([g({type:$.Utf8String})],qt.prototype,"utf8String",void 0);qt=p([B({type:R.Choice})],qt);class hl{constructor(e={}){this.organization=new qt,this.noticeNumbers=[],Object.assign(this,e)}}p([g({type:qt})],hl.prototype,"organization",void 0);p([g({type:$.Integer,repeated:"sequence"})],hl.prototype,"noticeNumbers",void 0);class gl{constructor(e={}){Object.assign(this,e)}}p([g({type:hl,optional:!0})],gl.prototype,"noticeRef",void 0);p([g({type:qt,optional:!0})],gl.prototype,"explicitText",void 0);let Oo=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.IA5String})],Oo.prototype,"cPSuri",void 0);p([g({type:gl})],Oo.prototype,"userNotice",void 0);Oo=p([B({type:R.Choice})],Oo);class ml{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ml.prototype,"policyQualifierId",void 0);p([g({type:$.Any})],ml.prototype,"qualifier",void 0);class Gs{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Gs.prototype,"policyIdentifier",void 0);p([g({type:ml,repeated:"sequence",optional:!0})],Gs.prototype,"policyQualifiers",void 0);let Po=_c=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,_c.prototype)}};Po=_c=p([B({type:R.Sequence,itemType:Gs})],Po);let To=class{constructor(e=0){this.value=e}};p([g({type:$.Integer})],To.prototype,"value",void 0);To=p([B({type:R.Choice})],To);let tp=class extends To{};tp=p([B({type:R.Choice})],tp);var yc;const wc=`${gn}.31`;var ht;(function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"})(ht||(ht={}));class Eg extends qs{toJSON(){const e=[],n=this.toNumber();return n&ht.aACompromise&&e.push("aACompromise"),n&ht.affiliationChanged&&e.push("affiliationChanged"),n&ht.cACompromise&&e.push("cACompromise"),n&ht.certificateHold&&e.push("certificateHold"),n&ht.cessationOfOperation&&e.push("cessationOfOperation"),n&ht.keyCompromise&&e.push("keyCompromise"),n&ht.privilegeWithdrawn&&e.push("privilegeWithdrawn"),n&ht.superseded&&e.push("superseded"),n&ht.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let On=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ie,context:0,repeated:"sequence",implicit:!0})],On.prototype,"fullName",void 0);p([g({type:pr,context:1,implicit:!0})],On.prototype,"nameRelativeToCRLIssuer",void 0);On=p([B({type:R.Choice})],On);class Er{constructor(e={}){Object.assign(this,e)}}p([g({type:On,context:0,optional:!0})],Er.prototype,"distributionPoint",void 0);p([g({type:Eg,context:1,optional:!0,implicit:!0})],Er.prototype,"reasons",void 0);p([g({type:ie,context:2,optional:!0,repeated:"sequence",implicit:!0})],Er.prototype,"cRLIssuer",void 0);let ar=yc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,yc.prototype)}};ar=yc=p([B({type:R.Sequence,itemType:Er})],ar);var vc;let np=vc=class extends ar{constructor(e){super(e),Object.setPrototypeOf(this,vc.prototype)}};np=vc=p([B({type:R.Sequence,itemType:Er})],np);class Ve{constructor(e={}){this.onlyContainsUserCerts=Ve.ONLY,this.onlyContainsCACerts=Ve.ONLY,this.indirectCRL=Ve.ONLY,this.onlyContainsAttributeCerts=Ve.ONLY,Object.assign(this,e)}}Ve.ONLY=!1;p([g({type:On,context:0,optional:!0})],Ve.prototype,"distributionPoint",void 0);p([g({type:$.Boolean,context:1,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"onlyContainsUserCerts",void 0);p([g({type:$.Boolean,context:2,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"onlyContainsCACerts",void 0);p([g({type:Eg,context:3,optional:!0,implicit:!0})],Ve.prototype,"onlySomeReasons",void 0);p([g({type:$.Boolean,context:4,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"indirectCRL",void 0);p([g({type:$.Boolean,context:5,defaultValue:Ve.ONLY,implicit:!0})],Ve.prototype,"onlyContainsAttributeCerts",void 0);var Hr;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(Hr||(Hr={}));let bc=class{constructor(e=Hr.unspecified){this.reason=Hr.unspecified,this.reason=e}toJSON(){return Hr[this.reason]}toString(){return this.toJSON()}};p([g({type:$.Enumerated})],bc.prototype,"reason",void 0);bc=p([B({type:R.Choice})],bc);var $c;const zg=`${gn}.37`;let Ro=$c=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,$c.prototype)}};Ro=$c=p([B({type:R.Sequence,itemType:$.ObjectIdentifier})],Ro);const _w=`${Ar}.1`,yw=`${Ar}.2`,ww=`${Ar}.3`,vw=`${Ar}.4`,bw=`${Ar}.8`,$w=`${Ar}.9`;let xc=class{constructor(e=new ArrayBuffer(0)){this.value=e}};p([g({type:$.Integer,converter:_e})],xc.prototype,"value",void 0);xc=p([B({type:R.Choice})],xc);let kc=class{constructor(e){this.value=new Date,e&&(this.value=e)}};p([g({type:$.GeneralizedTime})],kc.prototype,"value",void 0);kc=p([B({type:R.Choice})],kc);var Sc;let rp=Sc=class extends He{constructor(e){super(e),Object.setPrototypeOf(this,Sc.prototype)}};rp=Sc=p([B({type:R.Sequence})],rp);const Ig=`${gn}.15`;var gt;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(gt||(gt={}));class Ia extends qs{toJSON(){const e=this.toNumber(),n=[];return e>.cRLSign&&n.push("crlSign"),e>.dataEncipherment&&n.push("dataEncipherment"),e>.decipherOnly&&n.push("decipherOnly"),e>.digitalSignature&&n.push("digitalSignature"),e>.encipherOnly&&n.push("encipherOnly"),e>.keyAgreement&&n.push("keyAgreement"),e>.keyCertSign&&n.push("keyCertSign"),e>.keyEncipherment&&n.push("keyEncipherment"),e>.nonRepudiation&&n.push("nonRepudiation"),n}toString(){return`[${this.toJSON().join(", ")}]`}}var Ac;class Ws{constructor(e={}){this.base=new ie,this.minimum=0,Object.assign(this,e)}}p([g({type:ie})],Ws.prototype,"base",void 0);p([g({type:$.Integer,context:0,defaultValue:0,implicit:!0})],Ws.prototype,"minimum",void 0);p([g({type:$.Integer,context:1,optional:!0,implicit:!0})],Ws.prototype,"maximum",void 0);let Bo=Ac=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Ac.prototype)}};Bo=Ac=p([B({type:R.Sequence,itemType:Ws})],Bo);class Ng{constructor(e={}){Object.assign(this,e)}}p([g({type:Bo,context:0,optional:!0,implicit:!0})],Ng.prototype,"permittedSubtrees",void 0);p([g({type:Bo,context:1,optional:!0,implicit:!0})],Ng.prototype,"excludedSubtrees",void 0);class Cg{constructor(e={}){Object.assign(this,e)}}p([g({type:$.Integer,context:0,implicit:!0,optional:!0,converter:_e})],Cg.prototype,"requireExplicitPolicy",void 0);p([g({type:$.Integer,context:1,implicit:!0,optional:!0,converter:_e})],Cg.prototype,"inhibitPolicyMapping",void 0);var Ec;class _l{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],_l.prototype,"issuerDomainPolicy",void 0);p([g({type:$.ObjectIdentifier})],_l.prototype,"subjectDomainPolicy",void 0);let ip=Ec=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Ec.prototype)}};ip=Ec=p([B({type:R.Sequence,itemType:_l})],ip);var zc;const jg=`${gn}.17`;let Ic=zc=class extends He{constructor(e){super(e),Object.setPrototypeOf(this,zc.prototype)}};Ic=zc=p([B({type:R.Sequence})],Ic);let Ht=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],Ht.prototype,"type",void 0);p([g({type:$.Any,repeated:"set"})],Ht.prototype,"values",void 0);var Nc;let op=Nc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Nc.prototype)}};op=Nc=p([B({type:R.Sequence,itemType:Ht})],op);const Og=`${gn}.14`;class cn extends fl{}class Pg{constructor(e={}){Object.assign(this,e)}}p([g({type:$.GeneralizedTime,context:0,implicit:!0,optional:!0})],Pg.prototype,"notBefore",void 0);p([g({type:$.GeneralizedTime,context:1,implicit:!0,optional:!0})],Pg.prototype,"notAfter",void 0);var Kr;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(Kr||(Kr={}));class Tg extends qs{toJSON(){const e=[],n=this.toNumber();return n&Kr.pKIXCertificate&&e.push("pKIXCertificate"),n&Kr.newExtensions&&e.push("newExtensions"),n&Kr.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Rg{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Tg,Object.assign(this,e)}}p([g({type:$.GeneralString})],Rg.prototype,"entrustVers",void 0);p([g({type:Tg})],Rg.prototype,"entrustInfoFlags",void 0);var Cc;let sp=Cc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Cc.prototype)}};sp=Cc=p([B({type:R.Sequence,itemType:ki})],sp);class H{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof H&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&$0(e.parameters,this.parameters)||e.parameters===this.parameters)}}p([g({type:$.ObjectIdentifier})],H.prototype,"algorithm",void 0);p([g({type:$.Any,optional:!0})],H.prototype,"parameters",void 0);class mt{constructor(e={}){this.algorithm=new H,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:H})],mt.prototype,"algorithm",void 0);p([g({type:$.BitString})],mt.prototype,"subjectPublicKey",void 0);let Re=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const n=new Date(e);n.getUTCFullYear()>2049?this.generalTime=n:this.utcTime=n}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};p([g({type:$.UTCTime})],Re.prototype,"utcTime",void 0);p([g({type:$.GeneralizedTime})],Re.prototype,"generalTime",void 0);Re=p([B({type:R.Choice})],Re);class Si{constructor(e){this.notBefore=new Re(new Date),this.notAfter=new Re(new Date),e&&(this.notBefore=new Re(e.notBefore),this.notAfter=new Re(e.notAfter))}}p([g({type:Re})],Si.prototype,"notBefore",void 0);p([g({type:Re})],Si.prototype,"notAfter",void 0);var jc;let ct=class Bg{constructor(e={}){this.extnID="",this.critical=Bg.CRITICAL,this.extnValue=new le,Object.assign(this,e)}};ct.CRITICAL=!1;p([g({type:$.ObjectIdentifier})],ct.prototype,"extnID",void 0);p([g({type:$.Boolean,defaultValue:ct.CRITICAL})],ct.prototype,"critical",void 0);p([g({type:le})],ct.prototype,"extnValue",void 0);let ln=jc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,jc.prototype)}};ln=jc=p([B({type:R.Sequence,itemType:ct})],ln);var Pn;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(Pn||(Pn={}));class rt{constructor(e={}){this.version=Pn.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new H,this.issuer=new $e,this.validity=new Si,this.subject=new $e,this.subjectPublicKeyInfo=new mt,Object.assign(this,e)}}p([g({type:$.Integer,context:0,defaultValue:Pn.v1})],rt.prototype,"version",void 0);p([g({type:$.Integer,converter:_e})],rt.prototype,"serialNumber",void 0);p([g({type:H})],rt.prototype,"signature",void 0);p([g({type:$e})],rt.prototype,"issuer",void 0);p([g({type:Si})],rt.prototype,"validity",void 0);p([g({type:$e})],rt.prototype,"subject",void 0);p([g({type:mt})],rt.prototype,"subjectPublicKeyInfo",void 0);p([g({type:$.BitString,context:1,implicit:!0,optional:!0})],rt.prototype,"issuerUniqueID",void 0);p([g({type:$.BitString,context:2,implicit:!0,optional:!0})],rt.prototype,"subjectUniqueID",void 0);p([g({type:ln,context:3,optional:!0})],rt.prototype,"extensions",void 0);class Tn{constructor(e={}){this.tbsCertificate=new rt,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:rt})],Tn.prototype,"tbsCertificate",void 0);p([g({type:H})],Tn.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],Tn.prototype,"signatureValue",void 0);class Js{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Re,Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],Js.prototype,"userCertificate",void 0);p([g({type:Re})],Js.prototype,"revocationDate",void 0);p([g({type:ct,optional:!0,repeated:"sequence"})],Js.prototype,"crlEntryExtensions",void 0);class en{constructor(e={}){this.signature=new H,this.issuer=new $e,this.thisUpdate=new Re,Object.assign(this,e)}}p([g({type:$.Integer,optional:!0})],en.prototype,"version",void 0);p([g({type:H})],en.prototype,"signature",void 0);p([g({type:$e})],en.prototype,"issuer",void 0);p([g({type:Re})],en.prototype,"thisUpdate",void 0);p([g({type:Re,optional:!0})],en.prototype,"nextUpdate",void 0);p([g({type:Js,repeated:"sequence",optional:!0})],en.prototype,"revokedCertificates",void 0);p([g({type:ct,optional:!0,context:0,repeated:"sequence"})],en.prototype,"crlExtensions",void 0);class yl{constructor(e={}){this.tbsCertList=new en,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:en})],yl.prototype,"tbsCertList",void 0);p([g({type:H})],yl.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],yl.prototype,"signature",void 0);class zr{constructor(e={}){this.issuer=new $e,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$e})],zr.prototype,"issuer",void 0);p([g({type:$.Integer,converter:_e})],zr.prototype,"serialNumber",void 0);let fr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:cn,context:0,implicit:!0})],fr.prototype,"subjectKeyIdentifier",void 0);p([g({type:zr})],fr.prototype,"issuerAndSerialNumber",void 0);fr=p([B({type:R.Choice})],fr);var Kt;(function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"})(Kt||(Kt={}));let ri=class extends H{};ri=p([B({type:R.Sequence})],ri);let Lo=class extends H{};Lo=p([B({type:R.Sequence})],Lo);let Ot=class extends H{};Ot=p([B({type:R.Sequence})],Ot);let Uo=class extends H{};Uo=p([B({type:R.Sequence})],Uo);let ap=class extends H{};ap=p([B({type:R.Sequence})],ap);let Oc=class extends H{};Oc=p([B({type:R.Sequence})],Oc);let Ir=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],Ir.prototype,"attrType",void 0);p([g({type:$.Any,repeated:"set"})],Ir.prototype,"attrValues",void 0);var Pc;class Tt{constructor(e={}){this.version=Kt.v0,this.sid=new fr,this.digestAlgorithm=new ri,this.signatureAlgorithm=new Lo,this.signature=new le,Object.assign(this,e)}}p([g({type:$.Integer})],Tt.prototype,"version",void 0);p([g({type:fr})],Tt.prototype,"sid",void 0);p([g({type:ri})],Tt.prototype,"digestAlgorithm",void 0);p([g({type:Ir,repeated:"set",context:0,implicit:!0,optional:!0})],Tt.prototype,"signedAttrs",void 0);p([g({type:Lo})],Tt.prototype,"signatureAlgorithm",void 0);p([g({type:le})],Tt.prototype,"signature",void 0);p([g({type:Ir,repeated:"set",context:1,implicit:!0,optional:!0})],Tt.prototype,"unsignedAttrs",void 0);let Mo=Pc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Pc.prototype)}};Mo=Pc=p([B({type:R.Set,itemType:Tt})],Mo);let cp=class extends Re{};cp=p([B({type:R.Choice})],cp);let dp=class extends Tt{};dp=p([B({type:R.Sequence})],dp);class wl{constructor(e={}){this.acIssuer=new ie,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}p([g({type:ie})],wl.prototype,"acIssuer",void 0);p([g({type:$.Integer})],wl.prototype,"acSerial",void 0);p([g({type:Ht,repeated:"sequence"})],wl.prototype,"attrs",void 0);var Tc;let Fo=Tc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Tc.prototype)}};Fo=Tc=p([B({type:R.Sequence,itemType:$.ObjectIdentifier})],Fo);class Xs{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}p([g({type:$.Integer,optional:!0})],Xs.prototype,"pathLenConstraint",void 0);p([g({type:Fo,implicit:!0,context:0,optional:!0})],Xs.prototype,"permittedAttrs",void 0);p([g({type:Fo,implicit:!0,context:1,optional:!0})],Xs.prototype,"excludedAttrs",void 0);p([g({type:$.Boolean,defaultValue:!0})],Xs.prototype,"permitUnSpecified",void 0);class Hn{constructor(e={}){this.issuer=new He,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:He})],Hn.prototype,"issuer",void 0);p([g({type:$.Integer,converter:_e})],Hn.prototype,"serial",void 0);p([g({type:$.BitString,optional:!0})],Hn.prototype,"issuerUID",void 0);var Rc;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(Rc||(Rc={}));class Kn{constructor(e={}){this.digestedObjectType=Rc.publicKey,this.digestAlgorithm=new H,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Enumerated})],Kn.prototype,"digestedObjectType",void 0);p([g({type:$.ObjectIdentifier,optional:!0})],Kn.prototype,"otherObjectTypeID",void 0);p([g({type:H})],Kn.prototype,"digestAlgorithm",void 0);p([g({type:$.BitString})],Kn.prototype,"objectDigest",void 0);class Zs{constructor(e={}){Object.assign(this,e)}}p([g({type:He,optional:!0})],Zs.prototype,"issuerName",void 0);p([g({type:Hn,context:0,implicit:!0,optional:!0})],Zs.prototype,"baseCertificateID",void 0);p([g({type:Kn,context:1,implicit:!0,optional:!0})],Zs.prototype,"objectDigestInfo",void 0);let hr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ie,repeated:"sequence"})],hr.prototype,"v1Form",void 0);p([g({type:Zs,context:0,implicit:!0})],hr.prototype,"v2Form",void 0);hr=p([B({type:R.Choice})],hr);class Ys{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}p([g({type:$.GeneralizedTime})],Ys.prototype,"notBeforeTime",void 0);p([g({type:$.GeneralizedTime})],Ys.prototype,"notAfterTime",void 0);class Ai{constructor(e={}){Object.assign(this,e)}}p([g({type:Hn,implicit:!0,context:0,optional:!0})],Ai.prototype,"baseCertificateID",void 0);p([g({type:He,implicit:!0,context:1,optional:!0})],Ai.prototype,"entityName",void 0);p([g({type:Kn,implicit:!0,context:2,optional:!0})],Ai.prototype,"objectDigestInfo",void 0);var Bc;(function(t){t[t.v2=1]="v2"})(Bc||(Bc={}));class xt{constructor(e={}){this.version=Bc.v2,this.holder=new Ai,this.issuer=new hr,this.signature=new H,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Ys,this.attributes=[],Object.assign(this,e)}}p([g({type:$.Integer})],xt.prototype,"version",void 0);p([g({type:Ai})],xt.prototype,"holder",void 0);p([g({type:hr})],xt.prototype,"issuer",void 0);p([g({type:H})],xt.prototype,"signature",void 0);p([g({type:$.Integer,converter:_e})],xt.prototype,"serialNumber",void 0);p([g({type:Ys})],xt.prototype,"attrCertValidityPeriod",void 0);p([g({type:Ht,repeated:"sequence"})],xt.prototype,"attributes",void 0);p([g({type:$.BitString,optional:!0})],xt.prototype,"issuerUniqueID",void 0);p([g({type:ln,optional:!0})],xt.prototype,"extensions",void 0);class Qs{constructor(e={}){this.acinfo=new xt,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:xt})],Qs.prototype,"acinfo",void 0);p([g({type:H})],Qs.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],Qs.prototype,"signatureValue",void 0);var Do;(function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"})(Do||(Do={}));class Lc extends qs{}class vl{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier,implicit:!0,context:0})],vl.prototype,"type",void 0);p([g({type:$.Any,implicit:!0,context:1})],vl.prototype,"value",void 0);class bl{constructor(e={}){this.policyId="",this.classList=new Lc(Do.unclassified),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],bl.prototype,"policyId",void 0);p([g({type:Lc,defaultValue:new Lc(Do.unclassified)})],bl.prototype,"classList",void 0);p([g({type:vl,repeated:"set"})],bl.prototype,"securityCategories",void 0);class ea{constructor(e={}){Object.assign(this,e)}}p([g({type:le})],ea.prototype,"cotets",void 0);p([g({type:$.ObjectIdentifier})],ea.prototype,"oid",void 0);p([g({type:$.Utf8String})],ea.prototype,"string",void 0);class Lg{constructor(e={}){this.values=[],Object.assign(this,e)}}p([g({type:He,implicit:!0,context:0,optional:!0})],Lg.prototype,"policyAuthority",void 0);p([g({type:ea,repeated:"sequence"})],Lg.prototype,"values",void 0);var Uc;class ta{constructor(e={}){this.targetCertificate=new Hn,Object.assign(this,e)}}p([g({type:Hn})],ta.prototype,"targetCertificate",void 0);p([g({type:ie,optional:!0})],ta.prototype,"targetName",void 0);p([g({type:Kn,optional:!0})],ta.prototype,"certDigestInfo",void 0);let gr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ie,context:0,implicit:!0})],gr.prototype,"targetName",void 0);p([g({type:ie,context:1,implicit:!0})],gr.prototype,"targetGroup",void 0);p([g({type:ta,context:2,implicit:!0})],gr.prototype,"targetCert",void 0);gr=p([B({type:R.Choice})],gr);let Mc=Uc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Uc.prototype)}};Mc=Uc=p([B({type:R.Sequence,itemType:gr})],Mc);var Fc;let lp=Fc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Fc.prototype)}};lp=Fc=p([B({type:R.Sequence,itemType:Mc})],lp);class Ug{constructor(e={}){Object.assign(this,e)}}p([g({type:He,implicit:!0,context:0,optional:!0})],Ug.prototype,"roleAuthority",void 0);p([g({type:ie,implicit:!0,context:1})],Ug.prototype,"roleName",void 0);class $l{constructor(e={}){this.service=new ie,this.ident=new ie,Object.assign(this,e)}}p([g({type:ie})],$l.prototype,"service",void 0);p([g({type:ie})],$l.prototype,"ident",void 0);p([g({type:le,optional:!0})],$l.prototype,"authInfo",void 0);var Dc;class xl{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],xl.prototype,"otherCertFormat",void 0);p([g({type:$.Any})],xl.prototype,"otherCert",void 0);let mr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:Tn})],mr.prototype,"certificate",void 0);p([g({type:Qs,context:2,implicit:!0})],mr.prototype,"v2AttrCert",void 0);p([g({type:xl,context:3,implicit:!0})],mr.prototype,"other",void 0);mr=p([B({type:R.Choice})],mr);let Vo=Dc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Dc.prototype)}};Vo=Dc=p([B({type:R.Set,itemType:mr})],Vo);class Nr{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Nr.prototype,"contentType",void 0);p([g({type:$.Any,context:0})],Nr.prototype,"content",void 0);let ii=class{constructor(e={}){Object.assign(this,e)}};p([g({type:le})],ii.prototype,"single",void 0);p([g({type:$.Any})],ii.prototype,"any",void 0);ii=p([B({type:R.Choice})],ii);class na{constructor(e={}){this.eContentType="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],na.prototype,"eContentType",void 0);p([g({type:ii,context:0,optional:!0})],na.prototype,"eContent",void 0);let oi=class{constructor(e={}){Object.assign(this,e)}};p([g({type:le,context:0,implicit:!0,optional:!0})],oi.prototype,"value",void 0);p([g({type:le,converter:Z2,context:0,implicit:!0,optional:!0,repeated:"sequence"})],oi.prototype,"constructedValue",void 0);oi=p([B({type:R.Choice})],oi);class Ei{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Uo,Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Ei.prototype,"contentType",void 0);p([g({type:Uo})],Ei.prototype,"contentEncryptionAlgorithm",void 0);p([g({type:oi,optional:!0})],Ei.prototype,"encryptedContent",void 0);class ra{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ra.prototype,"keyAttrId",void 0);p([g({type:$.Any,optional:!0})],ra.prototype,"keyAttr",void 0);var Vc;class ia{constructor(e={}){this.subjectKeyIdentifier=new cn,Object.assign(this,e)}}p([g({type:cn})],ia.prototype,"subjectKeyIdentifier",void 0);p([g({type:$.GeneralizedTime,optional:!0})],ia.prototype,"date",void 0);p([g({type:ra,optional:!0})],ia.prototype,"other",void 0);let _r=class{constructor(e={}){Object.assign(this,e)}};p([g({type:ia,context:0,implicit:!0,optional:!0})],_r.prototype,"rKeyId",void 0);p([g({type:zr,optional:!0})],_r.prototype,"issuerAndSerialNumber",void 0);_r=p([B({type:R.Choice})],_r);class kl{constructor(e={}){this.rid=new _r,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:_r})],kl.prototype,"rid",void 0);p([g({type:le})],kl.prototype,"encryptedKey",void 0);let qo=Vc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Vc.prototype)}};qo=Vc=p([B({type:R.Sequence,itemType:kl})],qo);class Sl{constructor(e={}){this.algorithm=new H,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:H})],Sl.prototype,"algorithm",void 0);p([g({type:$.BitString})],Sl.prototype,"publicKey",void 0);let Rn=class{constructor(e={}){Object.assign(this,e)}};p([g({type:cn,context:0,implicit:!0,optional:!0})],Rn.prototype,"subjectKeyIdentifier",void 0);p([g({type:Sl,context:1,implicit:!0,optional:!0})],Rn.prototype,"originatorKey",void 0);p([g({type:zr,optional:!0})],Rn.prototype,"issuerAndSerialNumber",void 0);Rn=p([B({type:R.Choice})],Rn);class Cr{constructor(e={}){this.version=Kt.v3,this.originator=new Rn,this.keyEncryptionAlgorithm=new Ot,this.recipientEncryptedKeys=new qo,Object.assign(this,e)}}p([g({type:$.Integer})],Cr.prototype,"version",void 0);p([g({type:Rn,context:0})],Cr.prototype,"originator",void 0);p([g({type:le,context:1,optional:!0})],Cr.prototype,"ukm",void 0);p([g({type:Ot})],Cr.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:qo})],Cr.prototype,"recipientEncryptedKeys",void 0);let yr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:cn,context:0,implicit:!0})],yr.prototype,"subjectKeyIdentifier",void 0);p([g({type:zr})],yr.prototype,"issuerAndSerialNumber",void 0);yr=p([B({type:R.Choice})],yr);class zi{constructor(e={}){this.version=Kt.v0,this.rid=new yr,this.keyEncryptionAlgorithm=new Ot,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],zi.prototype,"version",void 0);p([g({type:yr})],zi.prototype,"rid",void 0);p([g({type:Ot})],zi.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:le})],zi.prototype,"encryptedKey",void 0);class Ii{constructor(e={}){this.keyIdentifier=new le,Object.assign(this,e)}}p([g({type:le})],Ii.prototype,"keyIdentifier",void 0);p([g({type:$.GeneralizedTime,optional:!0})],Ii.prototype,"date",void 0);p([g({type:ra,optional:!0})],Ii.prototype,"other",void 0);class Ni{constructor(e={}){this.version=Kt.v4,this.kekid=new Ii,this.keyEncryptionAlgorithm=new Ot,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],Ni.prototype,"version",void 0);p([g({type:Ii})],Ni.prototype,"kekid",void 0);p([g({type:Ot})],Ni.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:le})],Ni.prototype,"encryptedKey",void 0);class Ci{constructor(e={}){this.version=Kt.v0,this.keyEncryptionAlgorithm=new Ot,this.encryptedKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],Ci.prototype,"version",void 0);p([g({type:Oc,context:0,optional:!0})],Ci.prototype,"keyDerivationAlgorithm",void 0);p([g({type:Ot})],Ci.prototype,"keyEncryptionAlgorithm",void 0);p([g({type:le})],Ci.prototype,"encryptedKey",void 0);class Al{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Al.prototype,"oriType",void 0);p([g({type:$.Any})],Al.prototype,"oriValue",void 0);let un=class{constructor(e={}){Object.assign(this,e)}};p([g({type:zi,optional:!0})],un.prototype,"ktri",void 0);p([g({type:Cr,context:1,implicit:!0,optional:!0})],un.prototype,"kari",void 0);p([g({type:Ni,context:2,implicit:!0,optional:!0})],un.prototype,"kekri",void 0);p([g({type:Ci,context:3,implicit:!0,optional:!0})],un.prototype,"pwri",void 0);p([g({type:Al,context:4,implicit:!0,optional:!0})],un.prototype,"ori",void 0);un=p([B({type:R.Choice})],un);var qc;let Ho=qc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,qc.prototype)}};Ho=qc=p([B({type:R.Set,itemType:un})],Ho);var Hc;class oa{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],oa.prototype,"otherRevInfoFormat",void 0);p([g({type:$.Any})],oa.prototype,"otherRevInfo",void 0);let Ko=class{constructor(e={}){this.other=new oa,Object.assign(this,e)}};p([g({type:oa,context:1,implicit:!0})],Ko.prototype,"other",void 0);Ko=p([B({type:R.Choice})],Ko);let Go=Hc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Hc.prototype)}};Go=Hc=p([B({type:R.Set,itemType:Ko})],Go);class El{constructor(e={}){Object.assign(this,e)}}p([g({type:Vo,context:0,implicit:!0,optional:!0})],El.prototype,"certs",void 0);p([g({type:Go,context:1,implicit:!0,optional:!0})],El.prototype,"crls",void 0);var Kc;let Gc=Kc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Kc.prototype)}};Gc=Kc=p([B({type:R.Set,itemType:Ir})],Gc);class ji{constructor(e={}){this.version=Kt.v0,this.recipientInfos=new Ho,this.encryptedContentInfo=new Ei,Object.assign(this,e)}}p([g({type:$.Integer})],ji.prototype,"version",void 0);p([g({type:El,context:0,implicit:!0,optional:!0})],ji.prototype,"originatorInfo",void 0);p([g({type:Ho})],ji.prototype,"recipientInfos",void 0);p([g({type:Ei})],ji.prototype,"encryptedContentInfo",void 0);p([g({type:Gc,context:1,implicit:!0,optional:!0})],ji.prototype,"unprotectedAttrs",void 0);const xw="1.2.840.113549.1.7.2";var Wc;let Wo=Wc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Wc.prototype)}};Wo=Wc=p([B({type:R.Set,itemType:ri})],Wo);class jr{constructor(e={}){this.version=Kt.v0,this.digestAlgorithms=new Wo,this.encapContentInfo=new na,this.signerInfos=new Mo,Object.assign(this,e)}}p([g({type:$.Integer})],jr.prototype,"version",void 0);p([g({type:Wo})],jr.prototype,"digestAlgorithms",void 0);p([g({type:na})],jr.prototype,"encapContentInfo",void 0);p([g({type:Vo,context:0,implicit:!0,optional:!0})],jr.prototype,"certificates",void 0);p([g({type:Go,context:1,implicit:!0,optional:!0})],jr.prototype,"crls",void 0);p([g({type:Mo})],jr.prototype,"signerInfos",void 0);const si="1.2.840.10045.2.1",zl="1.2.840.10045.4.1",Mg="1.2.840.10045.4.3.1",Il="1.2.840.10045.4.3.2",Nl="1.2.840.10045.4.3.3",Cl="1.2.840.10045.4.3.4",up="1.2.840.10045.3.1.7",pp="1.3.132.0.34",fp="1.3.132.0.35";function Oi(t){return new H({algorithm:t})}const kw=Oi(zl);Oi(Mg);const Sw=Oi(Il),Aw=Oi(Nl),Ew=Oi(Cl);let ai=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],ai.prototype,"fieldType",void 0);p([g({type:$.Any})],ai.prototype,"parameters",void 0);ai=p([B({type:R.Sequence})],ai);class zw extends le{}let wr=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.OctetString})],wr.prototype,"a",void 0);p([g({type:$.OctetString})],wr.prototype,"b",void 0);p([g({type:$.BitString,optional:!0})],wr.prototype,"seed",void 0);wr=p([B({type:R.Sequence})],wr);var Jc;(function(t){t[t.ecpVer1=1]="ecpVer1"})(Jc||(Jc={}));let Gt=class{constructor(e={}){this.version=Jc.ecpVer1,Object.assign(this,e)}};p([g({type:$.Integer})],Gt.prototype,"version",void 0);p([g({type:ai})],Gt.prototype,"fieldID",void 0);p([g({type:wr})],Gt.prototype,"curve",void 0);p([g({type:zw})],Gt.prototype,"base",void 0);p([g({type:$.Integer,converter:_e})],Gt.prototype,"order",void 0);p([g({type:$.Integer,optional:!0})],Gt.prototype,"cofactor",void 0);Gt=p([B({type:R.Sequence})],Gt);let pn=class{constructor(e={}){Object.assign(this,e)}};p([g({type:$.ObjectIdentifier})],pn.prototype,"namedCurve",void 0);p([g({type:$.Null})],pn.prototype,"implicitCurve",void 0);p([g({type:Gt})],pn.prototype,"specifiedCurve",void 0);pn=p([B({type:R.Choice})],pn);class sa{constructor(e={}){this.version=1,this.privateKey=new le,Object.assign(this,e)}}p([g({type:$.Integer})],sa.prototype,"version",void 0);p([g({type:le})],sa.prototype,"privateKey",void 0);p([g({type:pn,context:0,optional:!0})],sa.prototype,"parameters",void 0);p([g({type:$.BitString,context:1,optional:!0})],sa.prototype,"publicKey",void 0);class Jo{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],Jo.prototype,"r",void 0);p([g({type:$.Integer,converter:_e})],Jo.prototype,"s",void 0);const Ye="1.2.840.113549.1.1",Bn=`${Ye}.1`,Iw=`${Ye}.7`,Nw=`${Ye}.9`,Gr=`${Ye}.10`,Cw=`${Ye}.2`,jw=`${Ye}.4`,Xo=`${Ye}.5`,Ow=`${Ye}.14`,Xc=`${Ye}.11`,Zo=`${Ye}.12`,Yo=`${Ye}.13`,Fg=`${Ye}.15`,Dg=`${Ye}.16`,Qo="1.3.14.3.2.26",Vg="2.16.840.1.101.3.4.2.4",es="2.16.840.1.101.3.4.2.1",ts="2.16.840.1.101.3.4.2.2",ns="2.16.840.1.101.3.4.2.3",Pw="2.16.840.1.101.3.4.2.5",Tw="2.16.840.1.101.3.4.2.6",Rw="1.2.840.113549.2.2",Bw="1.2.840.113549.2.5",aa=`${Ye}.8`;function Ne(t){return new H({algorithm:t,parameters:null})}Ne(Rw);Ne(Bw);const Ln=Ne(Qo);Ne(Vg);Ne(es);Ne(ts);Ne(ns);Ne(Pw);Ne(Tw);const qg=new H({algorithm:aa,parameters:F.serialize(Ln)}),Hg=new H({algorithm:Nw,parameters:F.serialize(Co.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});Ne(Bn);Ne(Cw);Ne(jw);Ne(Xo);Ne(Fg);Ne(Dg);Ne(Zo);Ne(Yo);Ne(Fg);Ne(Dg);class ca{constructor(e={}){this.hashAlgorithm=new H(Ln),this.maskGenAlgorithm=new H({algorithm:aa,parameters:F.serialize(Ln)}),this.pSourceAlgorithm=new H(Hg),Object.assign(this,e)}}p([g({type:H,context:0,defaultValue:Ln})],ca.prototype,"hashAlgorithm",void 0);p([g({type:H,context:1,defaultValue:qg})],ca.prototype,"maskGenAlgorithm",void 0);p([g({type:H,context:2,defaultValue:Hg})],ca.prototype,"pSourceAlgorithm",void 0);new H({algorithm:Iw,parameters:F.serialize(new ca)});class Un{constructor(e={}){this.hashAlgorithm=new H(Ln),this.maskGenAlgorithm=new H({algorithm:aa,parameters:F.serialize(Ln)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}p([g({type:H,context:0,defaultValue:Ln})],Un.prototype,"hashAlgorithm",void 0);p([g({type:H,context:1,defaultValue:qg})],Un.prototype,"maskGenAlgorithm",void 0);p([g({type:$.Integer,context:2,defaultValue:20})],Un.prototype,"saltLength",void 0);p([g({type:$.Integer,context:3,defaultValue:1})],Un.prototype,"trailerField",void 0);new H({algorithm:Gr,parameters:F.serialize(new Un)});class da{constructor(e={}){this.digestAlgorithm=new H,this.digest=new le,Object.assign(this,e)}}p([g({type:H})],da.prototype,"digestAlgorithm",void 0);p([g({type:le})],da.prototype,"digest",void 0);var Zc;class la{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],la.prototype,"prime",void 0);p([g({type:$.Integer,converter:_e})],la.prototype,"exponent",void 0);p([g({type:$.Integer,converter:_e})],la.prototype,"coefficient",void 0);let Yc=Zc=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,Zc.prototype)}};Yc=Zc=p([B({type:R.Sequence,itemType:la})],Yc);class Rt{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer})],Rt.prototype,"version",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"modulus",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"publicExponent",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"privateExponent",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"prime1",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"prime2",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"exponent1",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"exponent2",void 0);p([g({type:$.Integer,converter:_e})],Rt.prototype,"coefficient",void 0);p([g({type:Yc,optional:!0})],Rt.prototype,"otherPrimeInfos",void 0);class jl{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.Integer,converter:_e})],jl.prototype,"modulus",void 0);p([g({type:$.Integer,converter:_e})],jl.prototype,"publicExponent",void 0);var Qc;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Qc||(Qc={}));const We=Qc;/*! *****************************************************************************
|
|
104
104
|
Copyright (c) Microsoft Corporation.
|
|
105
105
|
|
|
106
106
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -113,9 +113,9 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
113
113
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
114
114
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
115
115
|
PERFORMANCE OF THIS SOFTWARE.
|
|
116
|
-
***************************************************************************** */var
|
|
116
|
+
***************************************************************************** */var ed=function(t,e){return ed=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i])},ed(t,e)};function Ol(t,e){ed(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Lw(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function c(u){try{l(r.next(u))}catch(f){a(f)}}function d(u){try{l(r.throw(u))}catch(f){a(f)}}function l(u){u.done?o(u.value):i(u.value).then(c,d)}l((r=r.apply(t,[])).next())})}function Uw(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(l){return function(u){return d([l,u])}}function d(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){n.label=l[1];break}if(l[0]===6&&n.label<o[1]){n.label=o[1],o=l;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(l);break}o[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(u){l=[6,u],i=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Wi(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function rs(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function bn(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(rs(arguments[e]));return t}var Mw="injectionTokens";function Fw(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],n=Reflect.getOwnMetadata(Mw,t)||{};return Object.keys(n).forEach(function(r){e[+r]=n[r]}),e}function Kg(t){return!!t.useClass}function td(t){return!!t.useFactory}var Gg=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var n=this,r={},i=!1,o,a=function(){return i||(o=e(n.wrap()),i=!0),o};return new Proxy(r,this.createHandler(a))},t.prototype.createHandler=function(e){var n={},r=function(i){n[i]=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];o[0]=e();var c=Reflect[i];return c.apply(void 0,bn(o))}};return this.reflectMethods.forEach(r),n},t}();function Xn(t){return typeof t=="string"||typeof t=="symbol"}function Dw(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function hp(t){return typeof t=="object"&&"token"in t&&"transform"in t}function Vw(t){return typeof t=="function"||t instanceof Gg}function ro(t){return!!t.useToken}function io(t){return t.useValue!=null}function qw(t){return Kg(t)||io(t)||ro(t)||td(t)}var Pl=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var n=this._registryMap.get(e);return n[n.length-1]||null},t.prototype.set=function(e,n){this.ensure(e),this._registryMap.get(e).push(n)},t.prototype.setAll=function(e,n){this._registryMap.set(e,n)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t}(),Hw=function(t){Ol(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Pl),gp=function(){function t(){this.scopedResolutions=new Map}return t}();function Kw(t,e){if(t===null)return"at position #"+e;var n=t.split(",")[e].trim();return'"'+n+'" at position #'+e}function Gw(t,e,n){return n===void 0&&(n=" "),bn([t],e.message.split(`
|
|
117
117
|
`).map(function(r){return n+r})).join(`
|
|
118
|
-
`)}function Ww(t,e,n){var r=is(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],o=i===void 0?null:i,a=Kw(o,e);return Gw("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',n)}function Jw(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Xw=function(t){Ol(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Pl),Zw=function(t){Ol(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Pl),Yw=function(){function t(){this.preResolution=new Xw,this.postResolution=new Zw}return t}(),Wg=new Map,Qw=function(){function t(e){this.parent=e,this._registry=new Hw,this.interceptors=new Yw,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:We.Transient}),this.ensureNotDisposed();var i;if(qw(n)?i=n:i={useClass:n},ro(i))for(var o=[e],a=i;a!=null;){var c=a.useToken;if(o.includes(c))throw new Error("Token registration cycle detected! "+bn(o,[c]).join(" -> "));o.push(c);var d=this._registry.get(c);d&&ro(d.provider)?a=d.provider:a=null}if((r.lifecycle===We.Singleton||r.lifecycle==We.ContainerScoped||r.lifecycle==We.ResolutionScoped)&&(io(i)||nd(i)))throw new Error('Cannot use lifecycle "'+We[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:r}),this},t.prototype.registerType=function(e,n){return this.ensureNotDisposed(),Xn(n)?this.register(e,{useToken:n}):this.register(e,{useClass:n})},t.prototype.registerInstance=function(e,n){return this.ensureNotDisposed(),this.register(e,{useValue:n})},t.prototype.registerSingleton=function(e,n){if(this.ensureNotDisposed(),Xn(e)){if(Xn(n))return this.register(e,{useToken:n},{lifecycle:We.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:We.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!Xn(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:We.Singleton})},t.prototype.resolve=function(e,n){n===void 0&&(n=new gp),this.ensureNotDisposed();var r=this.getRegistration(e);if(!r&&Xn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),r){var i=this.resolveRegistration(r,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Vw(e)){var i=this.construct(e,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,n){var r,i;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var a=Wi(this.interceptors.preResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var d=c.value;d.options.frequency!="Once"&&o.push(d),d.callback(e,n)}}catch(l){r={error:l}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,o;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var c=Wi(this.interceptors.postResolution.getAll(e)),d=c.next();!d.done;d=c.next()){var l=d.value;l.options.frequency!="Once"&&a.push(l),l.callback(e,n,r)}}catch(u){i={error:u}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===We.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===We.Singleton,i=e.options.lifecycle===We.ContainerScoped,o=r||i,a;return io(e.provider)?a=e.provider.useValue:ro(e.provider)?a=o?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):Kg(e.provider)?a=o?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):nd(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,n),e.options.lifecycle===We.ResolutionScoped&&n.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,n){var r=this;n===void 0&&(n=new gp),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&Xn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var o=i.map(function(c){return r.resolveRegistration(c,n)});return this.executePostResolutionInterceptor(e,o,"All"),o}var a=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,a,"All"),a},t.prototype.isRegistered=function(e,n){return n===void 0&&(n=!1),this.ensureNotDisposed(),this._registry.has(e)||n&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,n;this.ensureNotDisposed();try{for(var r=Wi(this._registry.entries()),i=r.next();!i.done;i=r.next()){var o=is(i.value,2),a=o[0],c=o[1];this._registry.setAll(a,c.filter(function(d){return!io(d.provider)}).map(function(d){return d.instance=void 0,d}))}}catch(d){e={error:d}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,n;this.ensureNotDisposed();var r=new t(this);try{for(var i=Wi(this._registry.entries()),o=i.next();!o.done;o=i.next()){var a=is(o.value,2),c=a[0],d=a[1];d.some(function(l){var u=l.options;return u.lifecycle===We.ContainerScoped})&&r._registry.setAll(c,d.map(function(l){return l.options.lifecycle===We.ContainerScoped?{provider:l.provider,options:l.options}:l}))}}catch(l){e={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t.prototype.beforeResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:n,options:r})},t.prototype.afterResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:n,options:r})},t.prototype.dispose=function(){return Lw(this,void 0,void 0,function(){var e;return Uw(this,function(n){switch(n.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(r){var i=r.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return n.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,n){var r=this;if(e instanceof Gg)return e.createProxy(function(o){return r.resolve(o,n)});var i=function(){var o=Wg.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=o.map(r.resolveParams(n,e));return new(e.bind.apply(e,bn([void 0],a)))}();return Jw(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,o){var a,c,d;try{return Dw(i)?hp(i)?i.multiple?(a=r.resolve(i.transform)).transform.apply(a,bn([r.resolveAll(i.token)],i.transformArgs)):(c=r.resolve(i.transform)).transform.apply(c,bn([r.resolve(i.token,e)],i.transformArgs)):i.multiple?r.resolveAll(i.token):r.resolve(i.token,e):hp(i)?(d=r.resolve(i.transform,e)).transform.apply(d,bn([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(l){throw new Error(Ww(n,o,l))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),Fe=new Qw;function fa(){return function(t){Wg.set(t,Fw(t))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var rd;class ha{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}p([g({type:$.ObjectIdentifier})],ha.prototype,"attrId",void 0);p([g({type:$.Any,repeated:"set"})],ha.prototype,"attrValues",void 0);let mp=rd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};mp=rd=p([B({type:R.Sequence,itemType:ha})],mp);var id;let _p=id=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,id.prototype)}};_p=id=p([B({type:R.Sequence,itemType:Nr})],_p);class Jg{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Jg.prototype,"certId",void 0);p([g({type:$.Any,context:0})],Jg.prototype,"certValue",void 0);class Xg{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Xg.prototype,"crlId",void 0);p([g({type:$.Any,context:0})],Xg.prototype,"crltValue",void 0);class Zg extends le{}let ga=class{constructor(e={}){this.encryptionAlgorithm=new H,this.encryptedData=new Zg,Object.assign(this,e)}};p([g({type:H})],ga.prototype,"encryptionAlgorithm",void 0);p([g({type:Zg})],ga.prototype,"encryptedData",void 0);var od,sd;(function(t){t[t.v1=0]="v1"})(sd||(sd={}));class Yg extends le{}let ad=od=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,od.prototype)}};ad=od=p([B({type:R.Sequence,itemType:Ht})],ad);class Pi{constructor(e={}){this.version=sd.v1,this.privateKeyAlgorithm=new H,this.privateKey=new Yg,Object.assign(this,e)}}p([g({type:$.Integer})],Pi.prototype,"version",void 0);p([g({type:H})],Pi.prototype,"privateKeyAlgorithm",void 0);p([g({type:Yg})],Pi.prototype,"privateKey",void 0);p([g({type:ad,implicit:!0,context:0,optional:!0})],Pi.prototype,"attributes",void 0);let yp=class extends Pi{};yp=p([B({type:R.Sequence})],yp);let wp=class extends ga{};wp=p([B({type:R.Sequence})],wp);class Qg{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Qg.prototype,"secretTypeId",void 0);p([g({type:$.Any,context:0})],Qg.prototype,"secretValue",void 0);class Ti{constructor(e={}){this.mac=new ua,this.macSalt=new le,this.iterations=1,Object.assign(this,e)}}p([g({type:ua})],Ti.prototype,"mac",void 0);p([g({type:le})],Ti.prototype,"macSalt",void 0);p([g({type:$.Integer,defaultValue:1})],Ti.prototype,"iterations",void 0);class ma{constructor(e={}){this.version=3,this.authSafe=new Nr,this.macData=new Ti,Object.assign(this,e)}}p([g({type:$.Integer})],ma.prototype,"version",void 0);p([g({type:Nr})],ma.prototype,"authSafe",void 0);p([g({type:Ti,optional:!0})],ma.prototype,"macData",void 0);var cd;class _a{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],_a.prototype,"bagId",void 0);p([g({type:$.Any,context:0})],_a.prototype,"bagValue",void 0);p([g({type:ha,repeated:"set",optional:!0})],_a.prototype,"bagAttributes",void 0);let vp=cd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,cd.prototype)}};vp=cd=p([B({type:R.Sequence,itemType:_a})],vp);var dd,ld,ud;const em="1.2.840.113549.1.9",tm=`${em}.7`,Tl=`${em}.14`;let os=class extends Me{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};p([g({type:$.IA5String})],os.prototype,"ia5String",void 0);os=p([B({type:R.Choice})],os);let bp=class extends Nr{};bp=p([B({type:R.Sequence})],bp);let $p=class extends ma{};$p=p([B({type:R.Sequence})],$p);let xp=class extends ga{};xp=p([B({type:R.Sequence})],xp);let pd=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.IA5String})],pd.prototype,"value",void 0);pd=p([B({type:R.Choice})],pd);let kp=class extends os{};kp=p([B({type:R.Choice})],kp);let Sp=class extends Me{};Sp=p([B({type:R.Choice})],Sp);let fd=class{constructor(e=new Date){this.value=e}};p([g({type:$.GeneralizedTime})],fd.prototype,"value",void 0);fd=p([B({type:R.Choice})],fd);let Ap=class extends Me{};Ap=p([B({type:R.Choice})],Ap);let hd=class{constructor(e="M"){this.value=e}toString(){return this.value}};p([g({type:$.PrintableString})],hd.prototype,"value",void 0);hd=p([B({type:R.Choice})],hd);let ss=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.PrintableString})],ss.prototype,"value",void 0);ss=p([B({type:R.Choice})],ss);let Ep=class extends ss{};Ep=p([B({type:R.Choice})],Ep);let zp=class extends Me{};zp=p([B({type:R.Choice})],zp);let gd=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.ObjectIdentifier})],gd.prototype,"value",void 0);gd=p([B({type:R.Choice})],gd);let Ip=class extends Re{};Ip=p([B({type:R.Choice})],Ip);let md=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};p([g({type:$.Integer})],md.prototype,"value",void 0);md=p([B({type:R.Choice})],md);let Np=class extends Tt{};Np=p([B({type:R.Sequence})],Np);let as=class extends Me{};as=p([B({type:R.Choice})],as);let Cp=dd=class extends ln{constructor(e){super(e),Object.setPrototypeOf(this,dd.prototype)}};Cp=dd=p([B({type:R.Sequence})],Cp);let jp=ld=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};jp=ld=p([B({type:R.Set,itemType:Ir})],jp);let _d=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.BmpString})],_d.prototype,"value",void 0);_d=p([B({type:R.Choice})],_d);let yd=class extends H{};yd=p([B({type:R.Sequence})],yd);let Op=ud=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};Op=ud=p([B({type:R.Sequence,itemType:yd})],Op);var wd;let cs=wd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,wd.prototype)}};cs=wd=p([B({type:R.Sequence,itemType:Ht})],cs);class Or{constructor(e={}){this.version=0,this.subject=new $e,this.subjectPKInfo=new mt,this.attributes=new cs,Object.assign(this,e)}}p([g({type:$.Integer})],Or.prototype,"version",void 0);p([g({type:$e})],Or.prototype,"subject",void 0);p([g({type:mt})],Or.prototype,"subjectPKInfo",void 0);p([g({type:cs,implicit:!0,context:0})],Or.prototype,"attributes",void 0);class ai{constructor(e={}){this.certificationRequestInfo=new Or,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:Or})],ai.prototype,"certificationRequestInfo",void 0);p([g({type:H})],ai.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],ai.prototype,"signature",void 0);/*!
|
|
118
|
+
`)}function Ww(t,e,n){var r=rs(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],o=i===void 0?null:i,a=Kw(o,e);return Gw("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',n)}function Jw(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Xw=function(t){Ol(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Pl),Zw=function(t){Ol(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Pl),Yw=function(){function t(){this.preResolution=new Xw,this.postResolution=new Zw}return t}(),Wg=new Map,Qw=function(){function t(e){this.parent=e,this._registry=new Hw,this.interceptors=new Yw,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:We.Transient}),this.ensureNotDisposed();var i;if(qw(n)?i=n:i={useClass:n},ro(i))for(var o=[e],a=i;a!=null;){var c=a.useToken;if(o.includes(c))throw new Error("Token registration cycle detected! "+bn(o,[c]).join(" -> "));o.push(c);var d=this._registry.get(c);d&&ro(d.provider)?a=d.provider:a=null}if((r.lifecycle===We.Singleton||r.lifecycle==We.ContainerScoped||r.lifecycle==We.ResolutionScoped)&&(io(i)||td(i)))throw new Error('Cannot use lifecycle "'+We[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:r}),this},t.prototype.registerType=function(e,n){return this.ensureNotDisposed(),Xn(n)?this.register(e,{useToken:n}):this.register(e,{useClass:n})},t.prototype.registerInstance=function(e,n){return this.ensureNotDisposed(),this.register(e,{useValue:n})},t.prototype.registerSingleton=function(e,n){if(this.ensureNotDisposed(),Xn(e)){if(Xn(n))return this.register(e,{useToken:n},{lifecycle:We.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:We.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!Xn(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:We.Singleton})},t.prototype.resolve=function(e,n){n===void 0&&(n=new gp),this.ensureNotDisposed();var r=this.getRegistration(e);if(!r&&Xn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),r){var i=this.resolveRegistration(r,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Vw(e)){var i=this.construct(e,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,n){var r,i;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var a=Wi(this.interceptors.preResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var d=c.value;d.options.frequency!="Once"&&o.push(d),d.callback(e,n)}}catch(l){r={error:l}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,o;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var c=Wi(this.interceptors.postResolution.getAll(e)),d=c.next();!d.done;d=c.next()){var l=d.value;l.options.frequency!="Once"&&a.push(l),l.callback(e,n,r)}}catch(u){i={error:u}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===We.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===We.Singleton,i=e.options.lifecycle===We.ContainerScoped,o=r||i,a;return io(e.provider)?a=e.provider.useValue:ro(e.provider)?a=o?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):Kg(e.provider)?a=o?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):td(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,n),e.options.lifecycle===We.ResolutionScoped&&n.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,n){var r=this;n===void 0&&(n=new gp),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&Xn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var o=i.map(function(c){return r.resolveRegistration(c,n)});return this.executePostResolutionInterceptor(e,o,"All"),o}var a=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,a,"All"),a},t.prototype.isRegistered=function(e,n){return n===void 0&&(n=!1),this.ensureNotDisposed(),this._registry.has(e)||n&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,n;this.ensureNotDisposed();try{for(var r=Wi(this._registry.entries()),i=r.next();!i.done;i=r.next()){var o=rs(i.value,2),a=o[0],c=o[1];this._registry.setAll(a,c.filter(function(d){return!io(d.provider)}).map(function(d){return d.instance=void 0,d}))}}catch(d){e={error:d}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,n;this.ensureNotDisposed();var r=new t(this);try{for(var i=Wi(this._registry.entries()),o=i.next();!o.done;o=i.next()){var a=rs(o.value,2),c=a[0],d=a[1];d.some(function(l){var u=l.options;return u.lifecycle===We.ContainerScoped})&&r._registry.setAll(c,d.map(function(l){return l.options.lifecycle===We.ContainerScoped?{provider:l.provider,options:l.options}:l}))}}catch(l){e={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t.prototype.beforeResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:n,options:r})},t.prototype.afterResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:n,options:r})},t.prototype.dispose=function(){return Lw(this,void 0,void 0,function(){var e;return Uw(this,function(n){switch(n.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(r){var i=r.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return n.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,n){var r=this;if(e instanceof Gg)return e.createProxy(function(o){return r.resolve(o,n)});var i=function(){var o=Wg.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=o.map(r.resolveParams(n,e));return new(e.bind.apply(e,bn([void 0],a)))}();return Jw(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,o){var a,c,d;try{return Dw(i)?hp(i)?i.multiple?(a=r.resolve(i.transform)).transform.apply(a,bn([r.resolveAll(i.token)],i.transformArgs)):(c=r.resolve(i.transform)).transform.apply(c,bn([r.resolve(i.token,e)],i.transformArgs)):i.multiple?r.resolveAll(i.token):r.resolve(i.token,e):hp(i)?(d=r.resolve(i.transform,e)).transform.apply(d,bn([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(l){throw new Error(Ww(n,o,l))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),Fe=new Qw;function ua(){return function(t){Wg.set(t,Fw(t))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var nd;class pa{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}p([g({type:$.ObjectIdentifier})],pa.prototype,"attrId",void 0);p([g({type:$.Any,repeated:"set"})],pa.prototype,"attrValues",void 0);let mp=nd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,nd.prototype)}};mp=nd=p([B({type:R.Sequence,itemType:pa})],mp);var rd;let _p=rd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};_p=rd=p([B({type:R.Sequence,itemType:Nr})],_p);class Jg{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Jg.prototype,"certId",void 0);p([g({type:$.Any,context:0})],Jg.prototype,"certValue",void 0);class Xg{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Xg.prototype,"crlId",void 0);p([g({type:$.Any,context:0})],Xg.prototype,"crltValue",void 0);class Zg extends le{}let fa=class{constructor(e={}){this.encryptionAlgorithm=new H,this.encryptedData=new Zg,Object.assign(this,e)}};p([g({type:H})],fa.prototype,"encryptionAlgorithm",void 0);p([g({type:Zg})],fa.prototype,"encryptedData",void 0);var id,od;(function(t){t[t.v1=0]="v1"})(od||(od={}));class Yg extends le{}let sd=id=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,id.prototype)}};sd=id=p([B({type:R.Sequence,itemType:Ht})],sd);class Pi{constructor(e={}){this.version=od.v1,this.privateKeyAlgorithm=new H,this.privateKey=new Yg,Object.assign(this,e)}}p([g({type:$.Integer})],Pi.prototype,"version",void 0);p([g({type:H})],Pi.prototype,"privateKeyAlgorithm",void 0);p([g({type:Yg})],Pi.prototype,"privateKey",void 0);p([g({type:sd,implicit:!0,context:0,optional:!0})],Pi.prototype,"attributes",void 0);let yp=class extends Pi{};yp=p([B({type:R.Sequence})],yp);let wp=class extends fa{};wp=p([B({type:R.Sequence})],wp);class Qg{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],Qg.prototype,"secretTypeId",void 0);p([g({type:$.Any,context:0})],Qg.prototype,"secretValue",void 0);class Ti{constructor(e={}){this.mac=new da,this.macSalt=new le,this.iterations=1,Object.assign(this,e)}}p([g({type:da})],Ti.prototype,"mac",void 0);p([g({type:le})],Ti.prototype,"macSalt",void 0);p([g({type:$.Integer,defaultValue:1})],Ti.prototype,"iterations",void 0);class ha{constructor(e={}){this.version=3,this.authSafe=new Nr,this.macData=new Ti,Object.assign(this,e)}}p([g({type:$.Integer})],ha.prototype,"version",void 0);p([g({type:Nr})],ha.prototype,"authSafe",void 0);p([g({type:Ti,optional:!0})],ha.prototype,"macData",void 0);var ad;class ga{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:$.ObjectIdentifier})],ga.prototype,"bagId",void 0);p([g({type:$.Any,context:0})],ga.prototype,"bagValue",void 0);p([g({type:pa,repeated:"set",optional:!0})],ga.prototype,"bagAttributes",void 0);let vp=ad=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,ad.prototype)}};vp=ad=p([B({type:R.Sequence,itemType:ga})],vp);var cd,dd,ld;const em="1.2.840.113549.1.9",tm=`${em}.7`,Tl=`${em}.14`;let is=class extends Me{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};p([g({type:$.IA5String})],is.prototype,"ia5String",void 0);is=p([B({type:R.Choice})],is);let bp=class extends Nr{};bp=p([B({type:R.Sequence})],bp);let $p=class extends ha{};$p=p([B({type:R.Sequence})],$p);let xp=class extends fa{};xp=p([B({type:R.Sequence})],xp);let ud=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.IA5String})],ud.prototype,"value",void 0);ud=p([B({type:R.Choice})],ud);let kp=class extends is{};kp=p([B({type:R.Choice})],kp);let Sp=class extends Me{};Sp=p([B({type:R.Choice})],Sp);let pd=class{constructor(e=new Date){this.value=e}};p([g({type:$.GeneralizedTime})],pd.prototype,"value",void 0);pd=p([B({type:R.Choice})],pd);let Ap=class extends Me{};Ap=p([B({type:R.Choice})],Ap);let fd=class{constructor(e="M"){this.value=e}toString(){return this.value}};p([g({type:$.PrintableString})],fd.prototype,"value",void 0);fd=p([B({type:R.Choice})],fd);let os=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.PrintableString})],os.prototype,"value",void 0);os=p([B({type:R.Choice})],os);let Ep=class extends os{};Ep=p([B({type:R.Choice})],Ep);let zp=class extends Me{};zp=p([B({type:R.Choice})],zp);let hd=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.ObjectIdentifier})],hd.prototype,"value",void 0);hd=p([B({type:R.Choice})],hd);let Ip=class extends Re{};Ip=p([B({type:R.Choice})],Ip);let gd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};p([g({type:$.Integer})],gd.prototype,"value",void 0);gd=p([B({type:R.Choice})],gd);let Np=class extends Tt{};Np=p([B({type:R.Sequence})],Np);let ss=class extends Me{};ss=p([B({type:R.Choice})],ss);let Cp=cd=class extends ln{constructor(e){super(e),Object.setPrototypeOf(this,cd.prototype)}};Cp=cd=p([B({type:R.Sequence})],Cp);let jp=dd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,dd.prototype)}};jp=dd=p([B({type:R.Set,itemType:Ir})],jp);let md=class{constructor(e=""){this.value=e}toString(){return this.value}};p([g({type:$.BmpString})],md.prototype,"value",void 0);md=p([B({type:R.Choice})],md);let _d=class extends H{};_d=p([B({type:R.Sequence})],_d);let Op=ld=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};Op=ld=p([B({type:R.Sequence,itemType:_d})],Op);var yd;let as=yd=class extends fe{constructor(e){super(e),Object.setPrototypeOf(this,yd.prototype)}};as=yd=p([B({type:R.Sequence,itemType:Ht})],as);class Or{constructor(e={}){this.version=0,this.subject=new $e,this.subjectPKInfo=new mt,this.attributes=new as,Object.assign(this,e)}}p([g({type:$.Integer})],Or.prototype,"version",void 0);p([g({type:$e})],Or.prototype,"subject",void 0);p([g({type:mt})],Or.prototype,"subjectPKInfo",void 0);p([g({type:as,implicit:!0,context:0})],Or.prototype,"attributes",void 0);class ci{constructor(e={}){this.certificationRequestInfo=new Or,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}p([g({type:Or})],ci.prototype,"certificationRequestInfo",void 0);p([g({type:H})],ci.prototype,"signatureAlgorithm",void 0);p([g({type:$.BitString})],ci.prototype,"signature",void 0);/*!
|
|
119
119
|
* MIT License
|
|
120
120
|
*
|
|
121
121
|
* Copyright (c) Peculiar Ventures. All rights reserved.
|
|
@@ -138,20 +138,20 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
138
138
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
139
139
|
* SOFTWARE.
|
|
140
140
|
*
|
|
141
|
-
*/const Ri="crypto.algorithm";class ev{getAlgorithms(){return Fe.resolveAll(Ri)}toAsnAlgorithm(e){({...e});for(const n of this.getAlgorithms()){const r=n.toAsnAlgorithm(e);if(r)return r}if(/^[0-9.]+$/.test(e.name)){const n=new H({algorithm:e.name});if("parameters"in e){const r=e;n.parameters=r.parameters}return n}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const r of this.getAlgorithms()){const i=r.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}}const Mn="crypto.algorithmProvider";Fe.registerSingleton(Mn,ev);var oo;const Qe="1.3.36.3.3.2.8.1.1",Pp=`${Qe}.1`,Tp=`${Qe}.2`,Rp=`${Qe}.3`,Bp=`${Qe}.4`,Lp=`${Qe}.5`,Up=`${Qe}.6`,Mp=`${Qe}.7`,Fp=`${Qe}.8`,Dp=`${Qe}.9`,Vp=`${Qe}.10`,qp=`${Qe}.11`,Hp=`${Qe}.12`,Kp=`${Qe}.13`,Gp=`${Qe}.14`,Wp="brainpoolP160r1",Jp="brainpoolP160t1",Xp="brainpoolP192r1",Zp="brainpoolP192t1",Yp="brainpoolP224r1",Qp="brainpoolP224t1",ef="brainpoolP256r1",tf="brainpoolP256t1",nf="brainpoolP320r1",rf="brainpoolP320t1",of="brainpoolP384r1",sf="brainpoolP384t1",af="brainpoolP512r1",cf="brainpoolP512t1",ye="ECDSA";let
|
|
142
|
-
`)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,n=0){const r=[];let i=this.pad(n++),o="";const a=e[pe.VALUE];a&&(o=` ${a}`),r.push(`${i}${e[pe.NAME]}:${o}`),i=this.pad(n);for(const c in e){if(typeof c=="symbol")continue;const d=e[c],l=c?`${c}: `:"";if(typeof d=="string"||typeof d=="number"||typeof d=="boolean")r.push(`${i}${l}${d}`);else if(d instanceof Date)r.push(`${i}${l}${d.toUTCString()}`);else if(Array.isArray(d))for(const u of d)u[pe.NAME]=c,r.push(...this.serializeObj(u,n));else if(d instanceof pe)d[pe.NAME]=c,r.push(...this.serializeObj(d,n));else if(D.isBufferSource(d))c?(r.push(`${i}${l}`),r.push(...this.serializeBufferSource(d,n+1))):r.push(...this.serializeBufferSource(d,n));else if("toTextObject"in d){const u=d.toTextObject();u[pe.NAME]=c,r.push(...this.serializeObj(u,n))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return r}static serializeBufferSource(e,n=0){const r=this.pad(n),i=D.toUint8Array(e),o=[];for(let a=0;a<i.length;){const c=[];for(let d=0;d<16&&a<i.length;d++){d===8&&c.push("");const l=i[a++].toString(16).padStart(2,"0");c.push(l)}o.push(`${r}${c.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Fn.oidSerializer=mn;Fn.algorithmSerializer=tv;class _n{constructor(...e){if(e.length===1){const n=e[0];this.rawData=F.serialize(n),this.onInit(n)}else{const n=F.parse(e[0],e[1]);this.rawData=D.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof _n?$0(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return F.toString(this.rawData);case"text":return Fn.serialize(this.toTextObject());case"hex":return J.ToHex(this.rawData);case"base64":return J.ToBase64(this.rawData);case"base64url":return J.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new pe(this.getTextName(),{},e)}}_n.NAME="ASN";class ut extends _n{constructor(...e){let n;D.isBufferSource(e[0])?n=D.toArrayBuffer(e[0]):n=F.serialize(new ct({extnID:e[0],critical:e[1],extnValue:new le(D.toArrayBuffer(e[2]))})),super(n,ct)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[pe.NAME]===ut.NAME&&(e[pe.NAME]=mn.toString(this.type)),e}}var im;class on{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[im]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(on.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(on.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,n){return this.items.forEach(e,n)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=on.DEFAULT){const n=this.items.get(e.toLowerCase());if(!n)throw new Error(`Cannot get Crypto by name '${e}'`);return n}set(e,n){if(typeof e=="string"){if(!n)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),n)}else this.items.set(on.DEFAULT,e);return this}}im=Symbol.toStringTag;on.DEFAULT="default";const Te=new on,nv=/^[0-2](?:\.[1-9][0-9]*)+$/;function rv(t){return new RegExp(nv).test(t)}class om{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return rv(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const Ze=new om;Ze.register("CN","2.5.4.3");Ze.register("L","2.5.4.7");Ze.register("ST","2.5.4.8");Ze.register("O","2.5.4.10");Ze.register("OU","2.5.4.11");Ze.register("C","2.5.4.6");Ze.register("DC","0.9.2342.19200300.100.1.25");Ze.register("E","1.2.840.113549.1.9.1");Ze.register("G","2.5.4.42");Ze.register("I","2.5.4.43");Ze.register("SN","2.5.4.4");Ze.register("T","2.5.4.12");function iv(t,e){return`\\${J.ToHex(J.FromUtf8String(e)).toUpperCase()}`}function ov(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,iv)}class st{static isASCII(e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,n={}){this.extraNames=new om,this.asn=new $e;for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const i=n[r];this.extraNames.register(r,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof $e?this.asn=e:D.isBufferSource(e)?this.asn=F.parse(e,$e):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||Ze.findId(e),r=[];for(const i of this.asn)for(const o of i)o.type===n&&r.push(o.value.toString());return r}getName(e){return this.extraNames.get(e)||Ze.get(e)}toString(){return this.asn.map(e=>e.map(n=>{const r=this.getName(n.type)||n.type,i=n.value.anyValue?`#${J.ToHex(n.value.anyValue)}`:ov(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const o of r){const a=this.getName(o.type)||o.type;(e=i[a])!==null&&e!==void 0||(i[a]=[]),i[a].push(o.value.anyValue?`#${J.ToHex(o.value.anyValue)}`:o.value.toString())}n.push(i)}return n}fromString(e){const n=new $e,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,o=",";for(;i=r.exec(`${e},`);){let[,a,c]=i;const d=c[c.length-1];(d===","||d==="+")&&(c=c.slice(0,c.length-1),i[3]=d);const l=i[3];a=this.getTypeOid(a);const u=this.createAttribute(a,c);o==="+"?n[n.length-1].push(u):n.push(new pr([u])),o=l}return n}fromJSON(e){const n=new $e;for(const r of e){const i=new pr;for(const o in r){const a=this.getTypeOid(o),c=r[o];for(const d of c){const l=this.createAttribute(a,d);i.push(l)}}n.push(i)}return n}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,n){const r=new
|
|
143
|
-
`).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return F.serialize(this.asn)}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||Te.get()):r=e[0]||Te.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const sm="Cannot initialize GeneralName from ASN.1 data.",df=`${sm} Unsupported string format in use.`,sv=`${sm} Value doesn't match to GUID regular expression.`,lf=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,uf="1.3.6.1.4.1.311.25.1",pf="1.3.6.1.4.1.311.20.2.3",
|
|
141
|
+
*/const Ri="crypto.algorithm";class ev{getAlgorithms(){return Fe.resolveAll(Ri)}toAsnAlgorithm(e){({...e});for(const n of this.getAlgorithms()){const r=n.toAsnAlgorithm(e);if(r)return r}if(/^[0-9.]+$/.test(e.name)){const n=new H({algorithm:e.name});if("parameters"in e){const r=e;n.parameters=r.parameters}return n}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const r of this.getAlgorithms()){const i=r.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}}const Mn="crypto.algorithmProvider";Fe.registerSingleton(Mn,ev);var oo;const Qe="1.3.36.3.3.2.8.1.1",Pp=`${Qe}.1`,Tp=`${Qe}.2`,Rp=`${Qe}.3`,Bp=`${Qe}.4`,Lp=`${Qe}.5`,Up=`${Qe}.6`,Mp=`${Qe}.7`,Fp=`${Qe}.8`,Dp=`${Qe}.9`,Vp=`${Qe}.10`,qp=`${Qe}.11`,Hp=`${Qe}.12`,Kp=`${Qe}.13`,Gp=`${Qe}.14`,Wp="brainpoolP160r1",Jp="brainpoolP160t1",Xp="brainpoolP192r1",Zp="brainpoolP192t1",Yp="brainpoolP224r1",Qp="brainpoolP224t1",ef="brainpoolP256r1",tf="brainpoolP256t1",nf="brainpoolP320r1",rf="brainpoolP320t1",of="brainpoolP384r1",sf="brainpoolP384t1",af="brainpoolP512r1",cf="brainpoolP512t1",ye="ECDSA";let di=oo=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case ye.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return kw;case"sha-256":return Sw;case"sha-384":return Aw;case"sha-512":return Ew}else if("namedCurve"in e){let n="";switch(e.namedCurve){case"P-256":n=up;break;case"K-256":n=oo.SECP256K1;break;case"P-384":n=pp;break;case"P-521":n=fp;break;case Wp:n=Pp;break;case Jp:n=Tp;break;case Xp:n=Rp;break;case Zp:n=Bp;break;case Yp:n=Lp;break;case Qp:n=Up;break;case ef:n=Mp;break;case tf:n=Fp;break;case nf:n=Dp;break;case rf:n=Vp;break;case of:n=qp;break;case sf:n=Hp;break;case af:n=Kp;break;case cf:n=Gp;break}if(n)return new H({algorithm:si,parameters:F.serialize(new pn({namedCurve:n}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case zl:return{name:ye,hash:{name:"SHA-1"}};case Il:return{name:ye,hash:{name:"SHA-256"}};case Nl:return{name:ye,hash:{name:"SHA-384"}};case Cl:return{name:ye,hash:{name:"SHA-512"}};case si:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(F.parse(e.parameters,pn).namedCurve){case up:return{name:ye,namedCurve:"P-256"};case oo.SECP256K1:return{name:ye,namedCurve:"K-256"};case pp:return{name:ye,namedCurve:"P-384"};case fp:return{name:ye,namedCurve:"P-521"};case Pp:return{name:ye,namedCurve:Wp};case Tp:return{name:ye,namedCurve:Jp};case Rp:return{name:ye,namedCurve:Xp};case Bp:return{name:ye,namedCurve:Zp};case Lp:return{name:ye,namedCurve:Yp};case Up:return{name:ye,namedCurve:Qp};case Mp:return{name:ye,namedCurve:ef};case Fp:return{name:ye,namedCurve:tf};case Dp:return{name:ye,namedCurve:nf};case Vp:return{name:ye,namedCurve:rf};case qp:return{name:ye,namedCurve:of};case Hp:return{name:ye,namedCurve:sf};case Kp:return{name:ye,namedCurve:af};case Gp:return{name:ye,namedCurve:cf}}}}return null}};di.SECP256K1="1.3.132.0.10";di=oo=p([ua()],di);Fe.registerSingleton(Ri,di);const nm=Symbol("name"),rm=Symbol("value");class pe{constructor(e,n={},r=""){this[nm]=e,this[rm]=r;for(const i in n)this[i]=n[i]}}pe.NAME=nm;pe.VALUE=rm;class tv{static toTextObject(e){const n=new pe("Algorithm Identifier",{},mn.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case si:{const r=new di().toWebAlgorithm(e);r&&"namedCurve"in r?n["Named Curve"]=r.namedCurve:n.Parameters=e.parameters;break}default:n.Parameters=e.parameters}return n}}class mn{static toString(e){const n=this.items[e];return n||e}}mn.items={[Qo]:"sha1",[Vg]:"sha224",[es]:"sha256",[ts]:"sha384",[ns]:"sha512",[Bn]:"rsaEncryption",[Xo]:"sha1WithRSAEncryption",[Ow]:"sha224WithRSAEncryption",[Xc]:"sha256WithRSAEncryption",[Zo]:"sha384WithRSAEncryption",[Yo]:"sha512WithRSAEncryption",[si]:"ecPublicKey",[zl]:"ecdsaWithSHA1",[Mg]:"ecdsaWithSHA224",[Il]:"ecdsaWithSHA256",[Nl]:"ecdsaWithSHA384",[Cl]:"ecdsaWithSHA512",[_w]:"TLS WWW server authentication",[yw]:"TLS WWW client authentication",[ww]:"Code Signing",[vw]:"E-mail Protection",[bw]:"Time Stamping",[$w]:"OCSP Signing",[xw]:"Signed Data"};class Fn{static serialize(e){return this.serializeObj(e).join(`
|
|
142
|
+
`)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,n=0){const r=[];let i=this.pad(n++),o="";const a=e[pe.VALUE];a&&(o=` ${a}`),r.push(`${i}${e[pe.NAME]}:${o}`),i=this.pad(n);for(const c in e){if(typeof c=="symbol")continue;const d=e[c],l=c?`${c}: `:"";if(typeof d=="string"||typeof d=="number"||typeof d=="boolean")r.push(`${i}${l}${d}`);else if(d instanceof Date)r.push(`${i}${l}${d.toUTCString()}`);else if(Array.isArray(d))for(const u of d)u[pe.NAME]=c,r.push(...this.serializeObj(u,n));else if(d instanceof pe)d[pe.NAME]=c,r.push(...this.serializeObj(d,n));else if(D.isBufferSource(d))c?(r.push(`${i}${l}`),r.push(...this.serializeBufferSource(d,n+1))):r.push(...this.serializeBufferSource(d,n));else if("toTextObject"in d){const u=d.toTextObject();u[pe.NAME]=c,r.push(...this.serializeObj(u,n))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return r}static serializeBufferSource(e,n=0){const r=this.pad(n),i=D.toUint8Array(e),o=[];for(let a=0;a<i.length;){const c=[];for(let d=0;d<16&&a<i.length;d++){d===8&&c.push("");const l=i[a++].toString(16).padStart(2,"0");c.push(l)}o.push(`${r}${c.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Fn.oidSerializer=mn;Fn.algorithmSerializer=tv;class _n{constructor(...e){if(e.length===1){const n=e[0];this.rawData=F.serialize(n),this.onInit(n)}else{const n=F.parse(e[0],e[1]);this.rawData=D.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof _n?$0(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return F.toString(this.rawData);case"text":return Fn.serialize(this.toTextObject());case"hex":return J.ToHex(this.rawData);case"base64":return J.ToBase64(this.rawData);case"base64url":return J.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new pe(this.getTextName(),{},e)}}_n.NAME="ASN";class ut extends _n{constructor(...e){let n;D.isBufferSource(e[0])?n=D.toArrayBuffer(e[0]):n=F.serialize(new ct({extnID:e[0],critical:e[1],extnValue:new le(D.toArrayBuffer(e[2]))})),super(n,ct)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[pe.NAME]===ut.NAME&&(e[pe.NAME]=mn.toString(this.type)),e}}var im;class on{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[im]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(on.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(on.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,n){return this.items.forEach(e,n)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=on.DEFAULT){const n=this.items.get(e.toLowerCase());if(!n)throw new Error(`Cannot get Crypto by name '${e}'`);return n}set(e,n){if(typeof e=="string"){if(!n)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),n)}else this.items.set(on.DEFAULT,e);return this}}im=Symbol.toStringTag;on.DEFAULT="default";const Te=new on,nv=/^[0-2](?:\.[1-9][0-9]*)+$/;function rv(t){return new RegExp(nv).test(t)}class om{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return rv(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const Ze=new om;Ze.register("CN","2.5.4.3");Ze.register("L","2.5.4.7");Ze.register("ST","2.5.4.8");Ze.register("O","2.5.4.10");Ze.register("OU","2.5.4.11");Ze.register("C","2.5.4.6");Ze.register("DC","0.9.2342.19200300.100.1.25");Ze.register("E","1.2.840.113549.1.9.1");Ze.register("G","2.5.4.42");Ze.register("I","2.5.4.43");Ze.register("SN","2.5.4.4");Ze.register("T","2.5.4.12");function iv(t,e){return`\\${J.ToHex(J.FromUtf8String(e)).toUpperCase()}`}function ov(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,iv)}class st{static isASCII(e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,n={}){this.extraNames=new om,this.asn=new $e;for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const i=n[r];this.extraNames.register(r,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof $e?this.asn=e:D.isBufferSource(e)?this.asn=F.parse(e,$e):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||Ze.findId(e),r=[];for(const i of this.asn)for(const o of i)o.type===n&&r.push(o.value.toString());return r}getName(e){return this.extraNames.get(e)||Ze.get(e)}toString(){return this.asn.map(e=>e.map(n=>{const r=this.getName(n.type)||n.type,i=n.value.anyValue?`#${J.ToHex(n.value.anyValue)}`:ov(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const o of r){const a=this.getName(o.type)||o.type;(e=i[a])!==null&&e!==void 0||(i[a]=[]),i[a].push(o.value.anyValue?`#${J.ToHex(o.value.anyValue)}`:o.value.toString())}n.push(i)}return n}fromString(e){const n=new $e,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,o=",";for(;i=r.exec(`${e},`);){let[,a,c]=i;const d=c[c.length-1];(d===","||d==="+")&&(c=c.slice(0,c.length-1),i[3]=d);const l=i[3];a=this.getTypeOid(a);const u=this.createAttribute(a,c);o==="+"?n[n.length-1].push(u):n.push(new pr([u])),o=l}return n}fromJSON(e){const n=new $e;for(const r of e){const i=new pr;for(const o in r){const a=this.getTypeOid(o),c=r[o];for(const d of c){const l=this.createAttribute(a,d);i.push(l)}}n.push(i)}return n}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,n){const r=new Hs({type:e});if(typeof n=="object")for(const i in n)switch(i){case"ia5String":r.value.ia5String=n[i];break;case"utf8String":r.value.utf8String=n[i];break;case"universalString":r.value.universalString=n[i];break;case"bmpString":r.value.bmpString=n[i];break;case"printableString":r.value.printableString=n[i];break}else if(n[0]==="#")r.value.anyValue=J.FromHex(n.slice(1));else{const i=this.processStringValue(n);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=i:st.isPrintableString(i)?r.value.printableString=i:r.value.utf8String=i}return r}processStringValue(e){const n=/"(.*?[^\\])?"/.exec(e);return n&&(e=n[1]),e.replace(/\\0a/ig,`
|
|
143
|
+
`).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return F.serialize(this.asn)}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||Te.get()):r=e[0]||Te.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const sm="Cannot initialize GeneralName from ASN.1 data.",df=`${sm} Unsupported string format in use.`,sv=`${sm} Value doesn't match to GUID regular expression.`,lf=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,uf="1.3.6.1.4.1.311.25.1",pf="1.3.6.1.4.1.311.20.2.3",Na="dns",Ca="dn",ja="email",Oa="ip",Pa="url",Ta="guid",Ra="upn",Ji="id";class sn extends _n{constructor(...e){let n;if(e.length===2)switch(e[0]){case Ca:{const r=new st(e[1]).toArrayBuffer(),i=F.parse(r,$e);n=new ie({directoryName:i});break}case Na:n=new ie({dNSName:e[1]});break;case ja:n=new ie({rfc822Name:e[1]});break;case Ta:{const r=new RegExp(lf,"i").exec(e[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=r.slice(1).map((o,a)=>a<3?J.ToHex(new Uint8Array(J.FromHex(o)).reverse()):o).join("");n=new ie({otherName:new ni({typeId:uf,value:F.serialize(new le(J.FromHex(i)))})});break}case Oa:n=new ie({iPAddress:e[1]});break;case Ji:n=new ie({registeredID:e[1]});break;case Ra:{n=new ie({otherName:new ni({typeId:pf,value:F.serialize($g.toASN(e[1]))})});break}case Pa:n=new ie({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else D.isBufferSource(e[0])?n=F.parse(e[0],ie):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=Na,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=ja,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Oa,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Pa,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Ji,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Ca,this.value=new st(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===uf){this.type=Ta;const n=F.parse(e.otherName.value,le),r=new RegExp(lf,"i").exec(J.ToHex(n));if(!r)throw new Error(sv);this.value=r.slice(1).map((i,o)=>o<3?J.ToHex(new Uint8Array(J.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===pf)this.type=Ra,this.value=F.parse(e.otherName.value,Me).toString();else throw new Error(df);else throw new Error(df)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Ca:case Na:case Ta:case Oa:case Ji:case Ra:case Pa:e=this.type.toUpperCase();break;case ja:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Ji&&(n=mn.toString(n)),new pe(e,void 0,n)}}class li extends _n{constructor(e){let n;if(e instanceof He)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof ie)r.push(i);else{const o=F.parse(new sn(i.type,i.value).rawData,ie);r.push(o)}n=new He(r)}else if(D.isBufferSource(e))n=F.parse(e,He);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(n)}onInit(e){const n=[];for(const r of e){let i=null;try{i=new sn(r)}catch{continue}n.push(i)}this.items=n}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const n of this.items){const r=n.toTextObject();let i=e[r[pe.NAME]];Array.isArray(i)||(i=[],e[r[pe.NAME]]=i),i.push(r)}return e}}li.NAME="GeneralNames";const Wr="-{5}",ui="\\n",av=`[^${ui}]+`,cv=`${Wr}BEGIN (${av}(?=${Wr}))${Wr}`,dv=`${Wr}END \\1${Wr}`,vr="\\n",lv=`[^:${ui}]+`,uv=`(?:[^${ui}]+${vr}(?: +[^${ui}]+${vr})*)`,pv="[a-zA-Z0-9=+/]+",fv=`(?:${pv}${vr})+`,ff=`${cv}${vr}(?:((?:${lv}: ${uv})+))?${vr}?(${fv})${dv}`;class tt{static isPem(e){return typeof e=="string"&&new RegExp(ff,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(ff,"g"),r=[];let i=null;for(;i=n.exec(e);){const o=i[3].replace(new RegExp(`[${ui}]+`,"g"),""),a={type:i[1],headers:[],rawData:J.FromBase64(o)},c=i[2];if(c){const d=c.split(new RegExp(vr,"g"));let l=null;for(const u of d){const[f,m]=u.split(/:(.*)/);if(m===void 0){if(!l)throw new Error("Cannot parse PEM string. Incorrect header value");l.value+=f.trim()}else l&&a.headers.push(l),l={key:f,value:m.trim()}}l&&a.headers.push(l)}r.push(a)}return r}static decode(e){return this.decodeWithHeaders(e).map(r=>r.rawData)}static decodeFirst(e){const n=this.decode(e);if(!n.length)throw new RangeError("PEM string doesn't contain any objects");return n[0]}static encode(e,n){if(Array.isArray(e)){const r=new Array;return n?e.forEach(i=>{if(!D.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");r.push(this.encodeStruct({type:n,rawData:D.toArrayBuffer(i)}))}):e.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");r.push(this.encodeStruct(i))}),r.join(`
|
|
144
144
|
`)}else{if(!n)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:n,rawData:D.toArrayBuffer(e)})}}static encodeStruct(e){var n;const r=e.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${r}-----`),!((n=e.headers)===null||n===void 0)&&n.length){for(const l of e.headers)i.push(`${l.key}: ${l.value}`);i.push("")}const o=J.ToBase64(e.rawData);let a,c=0;const d=Array();for(;c<o.length&&(o.length-c<64?a=o.substring(c):(a=o.substring(c,c+64),c+=64),a.length!==0);)if(d.push(a),a.length<64)break;return i.push(...d),i.push(`-----END ${r}-----`),i.join(`
|
|
145
|
-
`)}}tt.CertificateTag="CERTIFICATE";tt.CrlTag="CRL";tt.CertificateRequestTag="CERTIFICATE REQUEST";tt.PublicKeyTag="PUBLIC KEY";tt.PrivateKeyTag="PRIVATE KEY";class Wt extends _n{static isAsnEncoded(e){return D.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(tt.isPem(e))return tt.decode(e)[0];if(J.isHex(e))return J.FromHex(e);if(J.isBase64(e))return J.FromBase64(e);if(J.isBase64Url(e))return J.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const n=J.ToBinary(e);return tt.isPem(n)?tt.decode(n)[0]:J.isHex(n)?J.FromHex(n):J.isBase64(n)?J.FromBase64(n):J.isBase64Url(n)?J.FromBase64Url(n):D.toArrayBuffer(e)}}constructor(...e){Wt.isAsnEncoded(e[0])?super(Wt.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return tt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class _t extends Wt{static async create(e,n=Te.get()){if(e instanceof _t)return e;if(on.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new _t(r)}else{if(e.publicKey)return e.publicKey;if(D.isBufferSource(e))return new _t(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Wt.isAsnEncoded(e)?super(e,mt):super(e),this.tag=tt.PublicKeyTag}async export(...e){let n,r=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,r=e[1]||r,n=e[2]||Te.get()):n=e[0]||Te.get();let o=this.rawData;const a=F.parse(this.rawData,mt);return a.algorithm.algorithm===Gr&&(o=hv(a,o)),n.subtle.importKey("spki",o,i,!0,r)}onInit(e){const n=Fe.resolve(Mn),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Bn:{const i=F.parse(e.subjectPublicKey,jl),o=D.toUint8Array(i.modulus);r.publicExponent=D.toUint8Array(i.publicExponent),r.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||Te.get()):r=e[0]||Te.get(),await r.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let n,r="SHA-1";e.length===1?typeof e[0]=="string"?(r=e[0],n=Te.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=Te.get();const i=F.parse(this.rawData,mt);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=F.parse(this.rawData,mt);switch(e.Algorithm=Fn.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case oi:e["EC Point"]=n.subjectPublicKey;break;case Bn:default:e["Raw Data"]=n.subjectPublicKey}return e}}function hv(t,e){return t.algorithm=new H({algorithm:Bn,parameters:null}),e=F.serialize(t),e}class ui extends ut{static async create(e,n=!1,r=Te.get()){if("name"in e&&"serialNumber"in e)return new ui(e,n);const o=await(await _t.create(e,r)).getKeyIdentifier(r);return new ui(J.ToHex(o),n)}constructor(...e){if(D.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new An({keyIdentifier:new fl(J.FromHex(e[0]))});super(gc,e[1],F.serialize(n))}else{const n=e[0],r=n.name instanceof di?F.parse(n.name.rawData,He):n.name,i=new An({authorityCertIssuer:r,authorityCertSerialNumber:J.FromHex(n.serialNumber)});super(gc,e[1],F.serialize(i))}}onInit(e){super.onInit(e);const n=F.parse(e.extnValue,An);n.keyIdentifier&&(this.keyId=J.ToHex(n.keyIdentifier)),(n.authorityCertIssuer||n.authorityCertSerialNumber)&&(this.certId={name:n.authorityCertIssuer||[],serialNumber:n.authorityCertSerialNumber?J.ToHex(n.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),n=F.parse(this.value,An);return n.authorityCertIssuer&&(e["Authority Issuer"]=new di(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}ui.NAME="Authority Key Identifier";class Rl extends ut{constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,Oo);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new Oo({cA:e[0],pathLenConstraint:e[1]});super(Sg,e[2],F.serialize(n)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}Rl.NAME="Basic Constraints";var hf;(function(t){t.serverAuth="1.3.6.1.5.5.7.3.1",t.clientAuth="1.3.6.1.5.5.7.3.2",t.codeSigning="1.3.6.1.5.5.7.3.3",t.emailProtection="1.3.6.1.5.5.7.3.4",t.timeStamping="1.3.6.1.5.5.7.3.8",t.ocspSigning="1.3.6.1.5.5.7.3.9"})(hf||(hf={}));class Bl extends ut{constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,Bo);this.usages=n.map(r=>r)}else{const n=new Bo(e[0]);super(zg,e[1],F.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>mn.toString(n)).join(", "),e}}Bl.NAME="Extended Key Usages";var ds;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(ds||(ds={}));class Ll extends ut{constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,Na);this.usages=n.toNumber()}else{const n=new Na(e[0]);super(Ig,e[1],F.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=F.parse(this.value,Na);return e[""]=n.toJSON().join(", "),e}}Ll.NAME="Key Usages";class Bi extends ut{static async create(e,n=!1,r=Te.get()){const o=await(await _t.create(e,r)).getKeyIdentifier(r);return new Bi(J.ToHex(o),n)}constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,cn);this.keyId=J.ToHex(n)}else{const n=typeof e[0]=="string"?J.FromHex(e[0]):e[0],r=new cn(n);super(Og,e[1],F.serialize(r)),this.keyId=J.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=F.parse(this.value,cn);return e[""]=n,e}}Bi.NAME="Subject Key Identifier";class am extends ut{constructor(...e){D.isBufferSource(e[0])?super(e[0]):super(jg,e[1],new di(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=F.parse(e.extnValue,Nc);this.names=new di(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}am.NAME="Subject Alternative Name";class pt{static register(e,n){this.items.set(e,n)}static create(e){const n=new ut(e),r=this.items.get(n.type);return r?new r(e):n}}pt.items=new Map;class cm extends ut{constructor(...e){var n;if(D.isBufferSource(e[0])){super(e[0]);const r=F.parse(this.value,To);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,o=new To(r.map(a=>new Js({policyIdentifier:a})));super(Ag,i,F.serialize(o)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new pe("",{},mn.toString(n))),e}}cm.NAME="Certificate Policies";pt.register(Ag,cm);class dm extends ut{constructor(...e){var n;if(D.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(a=>new Er({distributionPoint:new On({fullName:[new ie({uniformResourceIdentifier:a})]})})),o=new ar(i);super(vc,e[1],F.serialize(o))}else{const r=new ar(e[0]);super(vc,e[1],F.serialize(r))}(n=this.distributionPoints)!==null&&n!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const n=F.parse(e.extnValue,ar);this.distributionPoints=n}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(n=>{var r;const i={};return n.distributionPoint&&(i[""]=(r=n.distributionPoint.fullName)===null||r===void 0?void 0:r.map(o=>new sn(o).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(o=>o.toString()).join(", ")),i}),e}}dm.NAME="CRL Distribution Points";class lm extends ut{constructor(...e){var n,r,i,o;if(D.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof ir){const a=new ir(e[0]);super(hc,e[1],F.serialize(a))}else{const a=e[0],c=new ir;Zi(c,a,Xu,"ocsp"),Zi(c,a,Zu,"caIssuers"),Zi(c,a,Yu,"timeStamping"),Zi(c,a,Qu,"caRepository"),super(hc,e[1],F.serialize(c))}(n=this.ocsp)!==null&&n!==void 0||(this.ocsp=[]),(r=this.caIssuers)!==null&&r!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],F.parse(e.extnValue,ir).forEach(r=>{switch(r.accessMethod){case Xu:this.ocsp.push(new sn(r.accessLocation));break;case Zu:this.caIssuers.push(new sn(r.accessLocation));break;case Yu:this.timeStamping.push(new sn(r.accessLocation));break;case Qu:this.caRepository.push(new sn(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Xi(e,"OCSP",this.ocsp),this.caIssuers.length&&Xi(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Xi(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Xi(e,"CA Repository",this.caRepository),e}}lm.NAME="Authority Info Access";function Xi(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new pe("");n.forEach((i,o)=>{const a=i.toTextObject(),c=`${a[pe.NAME]} ${o+1}`;let d=r[c];Array.isArray(d)||(d=[],r[c]=d),d.push(a)}),t[e]=r}}function Zi(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(a=>{typeof a=="string"&&(a=new sn("url",a)),t.push(new ki({accessMethod:n,accessLocation:F.parse(a.rawData,ie)}))})}class Pr extends _n{constructor(...e){let n;if(D.isBufferSource(e[0]))n=D.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(o=>D.toArrayBuffer(o)):[];n=F.serialize(new Ht({type:r,values:i}))}super(n,Ht)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(n=>new pe("",{"":n})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[pe.NAME]===Pr.NAME&&(e[pe.NAME]=mn.toString(this.type)),e}}Pr.NAME="Attribute";class um extends Pr{constructor(...e){var n;if(D.isBufferSource(e[0]))super(e[0]);else{const r=new as({printableString:e[0]});super(tm,[F.serialize(r)])}(n=this.password)!==null&&n!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const n=F.parse(this.values[0],as);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[pe.VALUE]=this.password,e}}um.NAME="Challenge Password";class Ul extends Pr{constructor(...e){var n;if(D.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new ln;for(const o of r)i.push(F.parse(o.rawData,ct));super(Tl,[F.serialize(i)])}(n=this.items)!==null&&n!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const n=F.parse(this.values[0],ln);this.items=n.map(r=>pt.create(F.serialize(r)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.items.map(r=>r.toTextObject());for(const r of n)e[r[pe.NAME]]=r;return e}}Ul.NAME="Extensions";class ya{static register(e,n){this.items.set(e,n)}static create(e){const n=new Pr(e),r=this.items.get(n.type);return r?new r(e):n}}ya.items=new Map;const Li="crypto.signatureFormatter";class gv{toAsnSignature(e,n){return D.toArrayBuffer(n)}toWebSignature(e,n){return D.toArrayBuffer(n)}}var so;let vd=so=class{static createPssParams(e,n){const r=so.getHashAlgorithm(e);return r?new Un({hashAlgorithm:r,maskGenAlgorithm:new H({algorithm:da,parameters:F.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=Fe.resolve(Mn);return typeof e=="string"?n.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?n.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let n;if(typeof e.hash=="string")n=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")n=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(n.toLowerCase()){case"sha-1":return new H({algorithm:Zo,parameters:null});case"sha-256":return new H({algorithm:Zc,parameters:null});case"sha-384":return new H({algorithm:Yo,parameters:null});case"sha-512":return new H({algorithm:Qo,parameters:null})}}else return new H({algorithm:Bn,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const n=so.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new H({algorithm:Gr,parameters:F.serialize(n)})}else return new H({algorithm:Gr,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Bn:return{name:"RSASSA-PKCS1-v1_5"};case Zo:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case Zc:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Yo:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Qo:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Gr:if(e.parameters){const n=F.parse(e.parameters,Un);return{name:"RSA-PSS",hash:Fe.resolve(Mn).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};vd=so=p([fa()],vd);Fe.registerSingleton(Ri,vd);let bd=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new H({algorithm:es});case"sha-256":return new H({algorithm:ts});case"sha-384":return new H({algorithm:ns});case"sha-512":return new H({algorithm:rs})}return null}toWebAlgorithm(e){switch(e.algorithm){case es:return{name:"SHA-1"};case ts:return{name:"SHA-256"};case ns:return{name:"SHA-384"};case rs:return{name:"SHA-512"}}return null}};bd=p([fa()],bd);Fe.registerSingleton(Ri,bd);class at{addPadding(e,n){const r=D.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=D.toUint8Array(e);for(let i=0;i<r.length;i++)if(r[i]){r=r.slice(i);break}if(n&&r[0]>127){const i=new Uint8Array(r.length+1);return i.set(r,1),i.buffer}return r.buffer}toAsnSignature(e,n){if(e.name==="ECDSA"){const r=e.namedCurve,i=at.namedCurveSize.get(r)||at.defaultNamedCurveSize,o=new Xo,a=D.toUint8Array(n);return o.r=this.removePadding(a.slice(0,i),!0),o.s=this.removePadding(a.slice(i,i+i),!0),F.serialize(o)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=F.parse(n,Xo),i=e.namedCurve,o=at.namedCurveSize.get(i)||at.defaultNamedCurveSize,a=this.addPadding(o,this.removePadding(r.r)),c=this.addPadding(o,this.removePadding(r.s));return z2(a,c)}return null}}at.namedCurveSize=new Map;at.defaultNamedCurveSize=32;const La="1.3.101.110",gf="1.3.101.111",Ua="1.3.101.112",mf="1.3.101.113";let $d=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Ua;break;case"x25519":n=La;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Ua;break;case"ed448":n=mf;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=La;break;case"x448":n=gf;break}}return n?new H({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Ua:return{name:"Ed25519"};case mf:return{name:"EdDSA",namedCurve:"Ed448"};case La:return{name:"X25519"};case gf:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};$d=p([fa()],$d);Fe.registerSingleton(Ri,$d);class mv extends Wt{constructor(e){Wt.isAsnEncoded(e)?super(e,ai):super(e),this.tag=tt.CertificateRequestTag}onInit(e){this.tbs=F.serialize(e.certificationRequestInfo),this.publicKey=new _t(e.certificationRequestInfo.subjectPKInfo);const n=Fe.resolve(Mn);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>ya.create(F.serialize(i)));const r=this.getAttribute(Tl);this.extensions=[],r instanceof Ul&&(this.extensions=r.items),this.subjectName=new st(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const n of this.attributes)if(n.type===e)return n;return null}getAttributes(e){return this.attributes.filter(n=>n.type===e)}getExtension(e){for(const n of this.extensions)if(n.type===e)return n;return null}getExtensions(e){return this.extensions.filter(n=>n.type===e)}async verify(e=Te.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=Fe.resolveAll(Li).reverse();let o=null;for(const c of i)if(o=c.toWebSignature(n,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=F.parse(this.rawData,ai),r=n.certificationRequestInfo,i=new pe("",{Version:`${Pn[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new pe("");for(const a of this.attributes){const c=a.toTextObject();o[c[pe.NAME]]=c}i.Attributes=o}return e.Data=i,e.Signature=new pe("",{Algorithm:Fn.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}mv.NAME="PKCS#10 Certificate Request";class Ml extends Wt{constructor(e){Wt.isAsnEncoded(e)?super(e,Tn):super(e),this.tag=tt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=F.serialize(n),this.serialNumber=J.ToHex(n.serialNumber),this.subjectName=new st(n.subject),this.subject=new st(n.subject).toString(),this.issuerName=new st(n.issuer),this.issuer=this.issuerName.toString();const r=Fe.resolve(Mn);this.signatureAlgorithm=r.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const i=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const o=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!o)throw new Error("Cannot get 'notAfter' value");this.notAfter=o,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(a=>pt.create(F.serialize(a)))),this.publicKey=new _t(n.subjectPublicKeyInfo)}getExtension(e){for(const n of this.extensions)if(typeof e=="string"){if(n.type===e)return n}else if(n instanceof e)return n;return null}getExtensions(e){return this.extensions.filter(n=>typeof e=="string"?n.type===e:n instanceof e)}async verify(e={},n=Te.get()){let r,i;const o=e.publicKey;try{if(!o)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in o)r={...o.publicKey.algorithm,...this.signatureAlgorithm},i=await o.publicKey.export(r,["verify"],n);else if(o instanceof _t)r={...o.algorithm,...this.signatureAlgorithm},i=await o.export(r,["verify"],n);else if(D.isBufferSource(o)){const l=new _t(o);r={...l.algorithm,...this.signatureAlgorithm},i=await l.export(r,["verify"],n)}else r={...o.algorithm,...this.signatureAlgorithm},i=o}catch{return!1}const a=Fe.resolveAll(Li).reverse();let c=null;for(const l of a)if(c=l.toWebSignature(r,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const d=await n.subtle.verify(this.signatureAlgorithm,i,c,this.tbs);if(e.signatureOnly)return d;{const u=(e.date||new Date).getTime();return d&&this.notBefore.getTime()<u&&u<this.notAfter.getTime()}}async getThumbprint(...e){let n,r="SHA-1";return e[0]&&(e[0].subtle?n=e[0]:(r=e[0]||r,n=e[1])),n??(n=Te.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=Te.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=F.parse(this.rawData,Tn),r=n.tbsCertificate,i=new pe("",{Version:`${Pn[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":Fn.serializeAlgorithm(r.signature),Issuer:this.issuer,Validity:new pe("",{"Not Before":r.validity.notBefore.getTime(),"Not After":r.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(r.issuerUniqueID&&(i["Issuer Unique ID"]=r.issuerUniqueID),r.subjectUniqueID&&(i["Subject Unique ID"]=r.subjectUniqueID),this.extensions.length){const o=new pe("");for(const a of this.extensions){const c=a.toTextObject();o[c[pe.NAME]]=c}i.Extensions=o}return e.Data=i,e.Signature=new pe("",{Algorithm:Fn.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}Ml.NAME="Certificate";class _v{static async createSelfSigned(e,n=Te.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},n)}static async create(e,n=Te.get()){var r;let i;e.publicKey instanceof _t?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:D.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);const o=e.serialNumber?D.toUint8Array(J.FromHex(e.serialNumber)):n.getRandomValues(new Uint8Array(16));o[0]>127&&(o[0]&=127),o.length>1&&o[0]===0&&(o[1]|=128);const a=e.notBefore||new Date,c=e.notAfter||new Date(a.getTime()+31536e6),d=new Tn({tbsCertificate:new rt({version:Pn.v3,serialNumber:o,validity:new Si({notBefore:a,notAfter:c}),extensions:new ln(((r=e.extensions)===null||r===void 0?void 0:r.map(v=>F.parse(v.rawData,ct)))||[]),subjectPublicKeyInfo:F.parse(i,mt)})});if(e.subject){const v=e.subject instanceof st?e.subject:new st(e.subject);d.tbsCertificate.subject=F.parse(v.toArrayBuffer(),$e)}if(e.issuer){const v=e.issuer instanceof st?e.issuer:new st(e.issuer);d.tbsCertificate.issuer=F.parse(v.toArrayBuffer(),$e)}const l={hash:"SHA-256"},u="signingKey"in e?{...l,...e.signingAlgorithm,...e.signingKey.algorithm}:{...l,...e.signingAlgorithm},f=Fe.resolve(Mn);d.tbsCertificate.signature=d.signatureAlgorithm=f.toAsnAlgorithm(u);const m=F.serialize(d.tbsCertificate),w="signingKey"in e?await n.subtle.sign(u,e.signingKey,m):e.signature,h=Fe.resolveAll(Li).reverse();let y=null;for(const v of h)if(y=v.toAsnSignature(u,w),y)break;if(!y)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return d.signatureValue=y,new Ml(F.serialize(d))}}var _f;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(_f||(_f={}));pt.register(Sg,Rl);pt.register(zg,Bl);pt.register(Ig,Ll);pt.register(Og,Bi);pt.register(gc,ui);pt.register(jg,am);pt.register(vc,dm);pt.register(hc,lm);ya.register(tm,um);ya.register(Tl,Ul);Fe.registerSingleton(Li,gv);Fe.registerSingleton(Li,at);at.namedCurveSize.set("P-256",32);at.namedCurveSize.set("K-256",32);at.namedCurveSize.set("P-384",48);at.namedCurveSize.set("P-521",66);async function xd(t){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},n=await crypto.subtle.generateKey(e,!0,["sign","verify"]),r=xe(),i=nc(new TextEncoder().encode(r)),o=await _v.createSelfSigned({serialNumber:i,name:t.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:n,extensions:[new Rl(!0,2,!0),new Bl(["1.3.6.1.5.5.7.3.1"],!0),new Ll(ds.keyCertSign|ds.cRLSign,!0),await Bi.create(n.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",n.privateKey),c=o.toString("pem"),d=await wv(o),l=nc(await o.getThumbprint()),u=yv("PRIVATE",a);return{kid:o.serialNumber,cert:c,thumbprint:l,fingerprint:d,pkcs7:u}}function yv(t,e){const n=E_.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
|
|
145
|
+
`)}}tt.CertificateTag="CERTIFICATE";tt.CrlTag="CRL";tt.CertificateRequestTag="CERTIFICATE REQUEST";tt.PublicKeyTag="PUBLIC KEY";tt.PrivateKeyTag="PRIVATE KEY";class Wt extends _n{static isAsnEncoded(e){return D.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(tt.isPem(e))return tt.decode(e)[0];if(J.isHex(e))return J.FromHex(e);if(J.isBase64(e))return J.FromBase64(e);if(J.isBase64Url(e))return J.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const n=J.ToBinary(e);return tt.isPem(n)?tt.decode(n)[0]:J.isHex(n)?J.FromHex(n):J.isBase64(n)?J.FromBase64(n):J.isBase64Url(n)?J.FromBase64Url(n):D.toArrayBuffer(e)}}constructor(...e){Wt.isAsnEncoded(e[0])?super(Wt.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return tt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class _t extends Wt{static async create(e,n=Te.get()){if(e instanceof _t)return e;if(on.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new _t(r)}else{if(e.publicKey)return e.publicKey;if(D.isBufferSource(e))return new _t(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Wt.isAsnEncoded(e)?super(e,mt):super(e),this.tag=tt.PublicKeyTag}async export(...e){let n,r=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,r=e[1]||r,n=e[2]||Te.get()):n=e[0]||Te.get();let o=this.rawData;const a=F.parse(this.rawData,mt);return a.algorithm.algorithm===Gr&&(o=hv(a,o)),n.subtle.importKey("spki",o,i,!0,r)}onInit(e){const n=Fe.resolve(Mn),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Bn:{const i=F.parse(e.subjectPublicKey,jl),o=D.toUint8Array(i.modulus);r.publicExponent=D.toUint8Array(i.publicExponent),r.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||Te.get()):r=e[0]||Te.get(),await r.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let n,r="SHA-1";e.length===1?typeof e[0]=="string"?(r=e[0],n=Te.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=Te.get();const i=F.parse(this.rawData,mt);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=F.parse(this.rawData,mt);switch(e.Algorithm=Fn.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case si:e["EC Point"]=n.subjectPublicKey;break;case Bn:default:e["Raw Data"]=n.subjectPublicKey}return e}}function hv(t,e){return t.algorithm=new H({algorithm:Bn,parameters:null}),e=F.serialize(t),e}class pi extends ut{static async create(e,n=!1,r=Te.get()){if("name"in e&&"serialNumber"in e)return new pi(e,n);const o=await(await _t.create(e,r)).getKeyIdentifier(r);return new pi(J.ToHex(o),n)}constructor(...e){if(D.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new An({keyIdentifier:new fl(J.FromHex(e[0]))});super(hc,e[1],F.serialize(n))}else{const n=e[0],r=n.name instanceof li?F.parse(n.name.rawData,He):n.name,i=new An({authorityCertIssuer:r,authorityCertSerialNumber:J.FromHex(n.serialNumber)});super(hc,e[1],F.serialize(i))}}onInit(e){super.onInit(e);const n=F.parse(e.extnValue,An);n.keyIdentifier&&(this.keyId=J.ToHex(n.keyIdentifier)),(n.authorityCertIssuer||n.authorityCertSerialNumber)&&(this.certId={name:n.authorityCertIssuer||[],serialNumber:n.authorityCertSerialNumber?J.ToHex(n.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),n=F.parse(this.value,An);return n.authorityCertIssuer&&(e["Authority Issuer"]=new li(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}pi.NAME="Authority Key Identifier";class Rl extends ut{constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,jo);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new jo({cA:e[0],pathLenConstraint:e[1]});super(Sg,e[2],F.serialize(n)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}Rl.NAME="Basic Constraints";var hf;(function(t){t.serverAuth="1.3.6.1.5.5.7.3.1",t.clientAuth="1.3.6.1.5.5.7.3.2",t.codeSigning="1.3.6.1.5.5.7.3.3",t.emailProtection="1.3.6.1.5.5.7.3.4",t.timeStamping="1.3.6.1.5.5.7.3.8",t.ocspSigning="1.3.6.1.5.5.7.3.9"})(hf||(hf={}));class Bl extends ut{constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,Ro);this.usages=n.map(r=>r)}else{const n=new Ro(e[0]);super(zg,e[1],F.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>mn.toString(n)).join(", "),e}}Bl.NAME="Extended Key Usages";var cs;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(cs||(cs={}));class Ll extends ut{constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,Ia);this.usages=n.toNumber()}else{const n=new Ia(e[0]);super(Ig,e[1],F.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=F.parse(this.value,Ia);return e[""]=n.toJSON().join(", "),e}}Ll.NAME="Key Usages";class Bi extends ut{static async create(e,n=!1,r=Te.get()){const o=await(await _t.create(e,r)).getKeyIdentifier(r);return new Bi(J.ToHex(o),n)}constructor(...e){if(D.isBufferSource(e[0])){super(e[0]);const n=F.parse(this.value,cn);this.keyId=J.ToHex(n)}else{const n=typeof e[0]=="string"?J.FromHex(e[0]):e[0],r=new cn(n);super(Og,e[1],F.serialize(r)),this.keyId=J.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=F.parse(this.value,cn);return e[""]=n,e}}Bi.NAME="Subject Key Identifier";class am extends ut{constructor(...e){D.isBufferSource(e[0])?super(e[0]):super(jg,e[1],new li(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=F.parse(e.extnValue,Ic);this.names=new li(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}am.NAME="Subject Alternative Name";class pt{static register(e,n){this.items.set(e,n)}static create(e){const n=new ut(e),r=this.items.get(n.type);return r?new r(e):n}}pt.items=new Map;class cm extends ut{constructor(...e){var n;if(D.isBufferSource(e[0])){super(e[0]);const r=F.parse(this.value,Po);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,o=new Po(r.map(a=>new Gs({policyIdentifier:a})));super(Ag,i,F.serialize(o)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new pe("",{},mn.toString(n))),e}}cm.NAME="Certificate Policies";pt.register(Ag,cm);class dm extends ut{constructor(...e){var n;if(D.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(a=>new Er({distributionPoint:new On({fullName:[new ie({uniformResourceIdentifier:a})]})})),o=new ar(i);super(wc,e[1],F.serialize(o))}else{const r=new ar(e[0]);super(wc,e[1],F.serialize(r))}(n=this.distributionPoints)!==null&&n!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const n=F.parse(e.extnValue,ar);this.distributionPoints=n}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(n=>{var r;const i={};return n.distributionPoint&&(i[""]=(r=n.distributionPoint.fullName)===null||r===void 0?void 0:r.map(o=>new sn(o).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(o=>o.toString()).join(", ")),i}),e}}dm.NAME="CRL Distribution Points";class lm extends ut{constructor(...e){var n,r,i,o;if(D.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof ir){const a=new ir(e[0]);super(fc,e[1],F.serialize(a))}else{const a=e[0],c=new ir;Zi(c,a,Xu,"ocsp"),Zi(c,a,Zu,"caIssuers"),Zi(c,a,Yu,"timeStamping"),Zi(c,a,Qu,"caRepository"),super(fc,e[1],F.serialize(c))}(n=this.ocsp)!==null&&n!==void 0||(this.ocsp=[]),(r=this.caIssuers)!==null&&r!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],F.parse(e.extnValue,ir).forEach(r=>{switch(r.accessMethod){case Xu:this.ocsp.push(new sn(r.accessLocation));break;case Zu:this.caIssuers.push(new sn(r.accessLocation));break;case Yu:this.timeStamping.push(new sn(r.accessLocation));break;case Qu:this.caRepository.push(new sn(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Xi(e,"OCSP",this.ocsp),this.caIssuers.length&&Xi(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Xi(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Xi(e,"CA Repository",this.caRepository),e}}lm.NAME="Authority Info Access";function Xi(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new pe("");n.forEach((i,o)=>{const a=i.toTextObject(),c=`${a[pe.NAME]} ${o+1}`;let d=r[c];Array.isArray(d)||(d=[],r[c]=d),d.push(a)}),t[e]=r}}function Zi(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(a=>{typeof a=="string"&&(a=new sn("url",a)),t.push(new ki({accessMethod:n,accessLocation:F.parse(a.rawData,ie)}))})}class Pr extends _n{constructor(...e){let n;if(D.isBufferSource(e[0]))n=D.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(o=>D.toArrayBuffer(o)):[];n=F.serialize(new Ht({type:r,values:i}))}super(n,Ht)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(n=>new pe("",{"":n})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[pe.NAME]===Pr.NAME&&(e[pe.NAME]=mn.toString(this.type)),e}}Pr.NAME="Attribute";class um extends Pr{constructor(...e){var n;if(D.isBufferSource(e[0]))super(e[0]);else{const r=new ss({printableString:e[0]});super(tm,[F.serialize(r)])}(n=this.password)!==null&&n!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const n=F.parse(this.values[0],ss);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[pe.VALUE]=this.password,e}}um.NAME="Challenge Password";class Ul extends Pr{constructor(...e){var n;if(D.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new ln;for(const o of r)i.push(F.parse(o.rawData,ct));super(Tl,[F.serialize(i)])}(n=this.items)!==null&&n!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const n=F.parse(this.values[0],ln);this.items=n.map(r=>pt.create(F.serialize(r)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.items.map(r=>r.toTextObject());for(const r of n)e[r[pe.NAME]]=r;return e}}Ul.NAME="Extensions";class ma{static register(e,n){this.items.set(e,n)}static create(e){const n=new Pr(e),r=this.items.get(n.type);return r?new r(e):n}}ma.items=new Map;const Li="crypto.signatureFormatter";class gv{toAsnSignature(e,n){return D.toArrayBuffer(n)}toWebSignature(e,n){return D.toArrayBuffer(n)}}var so;let wd=so=class{static createPssParams(e,n){const r=so.getHashAlgorithm(e);return r?new Un({hashAlgorithm:r,maskGenAlgorithm:new H({algorithm:aa,parameters:F.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=Fe.resolve(Mn);return typeof e=="string"?n.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?n.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let n;if(typeof e.hash=="string")n=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")n=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(n.toLowerCase()){case"sha-1":return new H({algorithm:Xo,parameters:null});case"sha-256":return new H({algorithm:Xc,parameters:null});case"sha-384":return new H({algorithm:Zo,parameters:null});case"sha-512":return new H({algorithm:Yo,parameters:null})}}else return new H({algorithm:Bn,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const n=so.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new H({algorithm:Gr,parameters:F.serialize(n)})}else return new H({algorithm:Gr,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Bn:return{name:"RSASSA-PKCS1-v1_5"};case Xo:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case Xc:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Zo:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Yo:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Gr:if(e.parameters){const n=F.parse(e.parameters,Un);return{name:"RSA-PSS",hash:Fe.resolve(Mn).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};wd=so=p([ua()],wd);Fe.registerSingleton(Ri,wd);let vd=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new H({algorithm:Qo});case"sha-256":return new H({algorithm:es});case"sha-384":return new H({algorithm:ts});case"sha-512":return new H({algorithm:ns})}return null}toWebAlgorithm(e){switch(e.algorithm){case Qo:return{name:"SHA-1"};case es:return{name:"SHA-256"};case ts:return{name:"SHA-384"};case ns:return{name:"SHA-512"}}return null}};vd=p([ua()],vd);Fe.registerSingleton(Ri,vd);class at{addPadding(e,n){const r=D.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=D.toUint8Array(e);for(let i=0;i<r.length;i++)if(r[i]){r=r.slice(i);break}if(n&&r[0]>127){const i=new Uint8Array(r.length+1);return i.set(r,1),i.buffer}return r.buffer}toAsnSignature(e,n){if(e.name==="ECDSA"){const r=e.namedCurve,i=at.namedCurveSize.get(r)||at.defaultNamedCurveSize,o=new Jo,a=D.toUint8Array(n);return o.r=this.removePadding(a.slice(0,i),!0),o.s=this.removePadding(a.slice(i,i+i),!0),F.serialize(o)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=F.parse(n,Jo),i=e.namedCurve,o=at.namedCurveSize.get(i)||at.defaultNamedCurveSize,a=this.addPadding(o,this.removePadding(r.r)),c=this.addPadding(o,this.removePadding(r.s));return z2(a,c)}return null}}at.namedCurveSize=new Map;at.defaultNamedCurveSize=32;const Ba="1.3.101.110",gf="1.3.101.111",La="1.3.101.112",mf="1.3.101.113";let bd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=La;break;case"x25519":n=Ba;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=La;break;case"ed448":n=mf;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Ba;break;case"x448":n=gf;break}}return n?new H({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case La:return{name:"Ed25519"};case mf:return{name:"EdDSA",namedCurve:"Ed448"};case Ba:return{name:"X25519"};case gf:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};bd=p([ua()],bd);Fe.registerSingleton(Ri,bd);class mv extends Wt{constructor(e){Wt.isAsnEncoded(e)?super(e,ci):super(e),this.tag=tt.CertificateRequestTag}onInit(e){this.tbs=F.serialize(e.certificationRequestInfo),this.publicKey=new _t(e.certificationRequestInfo.subjectPKInfo);const n=Fe.resolve(Mn);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>ma.create(F.serialize(i)));const r=this.getAttribute(Tl);this.extensions=[],r instanceof Ul&&(this.extensions=r.items),this.subjectName=new st(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const n of this.attributes)if(n.type===e)return n;return null}getAttributes(e){return this.attributes.filter(n=>n.type===e)}getExtension(e){for(const n of this.extensions)if(n.type===e)return n;return null}getExtensions(e){return this.extensions.filter(n=>n.type===e)}async verify(e=Te.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=Fe.resolveAll(Li).reverse();let o=null;for(const c of i)if(o=c.toWebSignature(n,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=F.parse(this.rawData,ci),r=n.certificationRequestInfo,i=new pe("",{Version:`${Pn[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new pe("");for(const a of this.attributes){const c=a.toTextObject();o[c[pe.NAME]]=c}i.Attributes=o}return e.Data=i,e.Signature=new pe("",{Algorithm:Fn.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}mv.NAME="PKCS#10 Certificate Request";class Ml extends Wt{constructor(e){Wt.isAsnEncoded(e)?super(e,Tn):super(e),this.tag=tt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=F.serialize(n),this.serialNumber=J.ToHex(n.serialNumber),this.subjectName=new st(n.subject),this.subject=new st(n.subject).toString(),this.issuerName=new st(n.issuer),this.issuer=this.issuerName.toString();const r=Fe.resolve(Mn);this.signatureAlgorithm=r.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const i=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const o=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!o)throw new Error("Cannot get 'notAfter' value");this.notAfter=o,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(a=>pt.create(F.serialize(a)))),this.publicKey=new _t(n.subjectPublicKeyInfo)}getExtension(e){for(const n of this.extensions)if(typeof e=="string"){if(n.type===e)return n}else if(n instanceof e)return n;return null}getExtensions(e){return this.extensions.filter(n=>typeof e=="string"?n.type===e:n instanceof e)}async verify(e={},n=Te.get()){let r,i;const o=e.publicKey;try{if(!o)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in o)r={...o.publicKey.algorithm,...this.signatureAlgorithm},i=await o.publicKey.export(r,["verify"],n);else if(o instanceof _t)r={...o.algorithm,...this.signatureAlgorithm},i=await o.export(r,["verify"],n);else if(D.isBufferSource(o)){const l=new _t(o);r={...l.algorithm,...this.signatureAlgorithm},i=await l.export(r,["verify"],n)}else r={...o.algorithm,...this.signatureAlgorithm},i=o}catch{return!1}const a=Fe.resolveAll(Li).reverse();let c=null;for(const l of a)if(c=l.toWebSignature(r,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const d=await n.subtle.verify(this.signatureAlgorithm,i,c,this.tbs);if(e.signatureOnly)return d;{const u=(e.date||new Date).getTime();return d&&this.notBefore.getTime()<u&&u<this.notAfter.getTime()}}async getThumbprint(...e){let n,r="SHA-1";return e[0]&&(e[0].subtle?n=e[0]:(r=e[0]||r,n=e[1])),n??(n=Te.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=Te.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=F.parse(this.rawData,Tn),r=n.tbsCertificate,i=new pe("",{Version:`${Pn[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":Fn.serializeAlgorithm(r.signature),Issuer:this.issuer,Validity:new pe("",{"Not Before":r.validity.notBefore.getTime(),"Not After":r.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(r.issuerUniqueID&&(i["Issuer Unique ID"]=r.issuerUniqueID),r.subjectUniqueID&&(i["Subject Unique ID"]=r.subjectUniqueID),this.extensions.length){const o=new pe("");for(const a of this.extensions){const c=a.toTextObject();o[c[pe.NAME]]=c}i.Extensions=o}return e.Data=i,e.Signature=new pe("",{Algorithm:Fn.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}Ml.NAME="Certificate";class _v{static async createSelfSigned(e,n=Te.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},n)}static async create(e,n=Te.get()){var r;let i;e.publicKey instanceof _t?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:D.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);const o=e.serialNumber?D.toUint8Array(J.FromHex(e.serialNumber)):n.getRandomValues(new Uint8Array(16));o[0]>127&&(o[0]&=127),o.length>1&&o[0]===0&&(o[1]|=128);const a=e.notBefore||new Date,c=e.notAfter||new Date(a.getTime()+31536e6),d=new Tn({tbsCertificate:new rt({version:Pn.v3,serialNumber:o,validity:new Si({notBefore:a,notAfter:c}),extensions:new ln(((r=e.extensions)===null||r===void 0?void 0:r.map(v=>F.parse(v.rawData,ct)))||[]),subjectPublicKeyInfo:F.parse(i,mt)})});if(e.subject){const v=e.subject instanceof st?e.subject:new st(e.subject);d.tbsCertificate.subject=F.parse(v.toArrayBuffer(),$e)}if(e.issuer){const v=e.issuer instanceof st?e.issuer:new st(e.issuer);d.tbsCertificate.issuer=F.parse(v.toArrayBuffer(),$e)}const l={hash:"SHA-256"},u="signingKey"in e?{...l,...e.signingAlgorithm,...e.signingKey.algorithm}:{...l,...e.signingAlgorithm},f=Fe.resolve(Mn);d.tbsCertificate.signature=d.signatureAlgorithm=f.toAsnAlgorithm(u);const m=F.serialize(d.tbsCertificate),w="signingKey"in e?await n.subtle.sign(u,e.signingKey,m):e.signature,h=Fe.resolveAll(Li).reverse();let y=null;for(const v of h)if(y=v.toAsnSignature(u,w),y)break;if(!y)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return d.signatureValue=y,new Ml(F.serialize(d))}}var _f;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(_f||(_f={}));pt.register(Sg,Rl);pt.register(zg,Bl);pt.register(Ig,Ll);pt.register(Og,Bi);pt.register(hc,pi);pt.register(jg,am);pt.register(wc,dm);pt.register(fc,lm);ma.register(tm,um);ma.register(Tl,Ul);Fe.registerSingleton(Li,gv);Fe.registerSingleton(Li,at);at.namedCurveSize.set("P-256",32);at.namedCurveSize.set("K-256",32);at.namedCurveSize.set("P-384",48);at.namedCurveSize.set("P-521",66);async function $d(t){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},n=await crypto.subtle.generateKey(e,!0,["sign","verify"]),r=xe(),i=tc(new TextEncoder().encode(r)),o=await _v.createSelfSigned({serialNumber:i,name:t.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:n,extensions:[new Rl(!0,2,!0),new Bl(["1.3.6.1.5.5.7.3.1"],!0),new Ll(cs.keyCertSign|cs.cRLSign,!0),await Bi.create(n.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",n.privateKey),c=o.toString("pem"),d=await wv(o),l=tc(await o.getThumbprint()),u=yv("PRIVATE",a);return{kid:o.serialNumber,cert:c,thumbprint:l,fingerprint:d,pkcs7:u}}function yv(t,e){const n=E_.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
|
|
146
146
|
`,i=0;for(;i<n.length;)i+64<=n.length?r+=n.substr(i,64)+`\r
|
|
147
147
|
`:r+=n.substr(i)+`\r
|
|
148
148
|
`,i+=64;return r+=`-----END ${t} KEY-----\r
|
|
149
|
-
`,r}async function wv(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),o=new TextEncoder().encode(r);return nc(await s0(o))}const vv=1e3*60*60*24,bv=new s.OpenAPIHono().openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(tc)}},description:"List of keys"}}}),async t=>{const n=(await t.env.data.keys.list()).filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:tc}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),r=(await t.env.data.keys.list()).find(i=>i.kid===e);if(!r)throw new A(404,{message:"Key not found"});return t.json(r)}).openapi(s.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const e=await t.env.data.keys.list();for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+vv).toISOString()});const n=await xd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{kid:e}=t.req.valid("param");if(!await t.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new A(404,{message:"Key not found"});const r=await xd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(r),t.text("OK")}),$v=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:s.z.object({email:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.array(Bd)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await Zd(t.env.data.users,e,n)).filter(o=>!o.linked_to);return t.json(i)}),xv=Xt.extend({clients:s.z.array(xn)}),kv=new s.OpenAPIHono().openapi(s.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([xv,s.z.array(xn)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),d=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a})).applications;return i?t.json({clients:d,start:0,limit:10,length:d.length}):t.json(d)}).openapi(s.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:xn}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=(await t.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(o=>o.id===n);if(!i)throw new A(404);return t.json(i)}).openapi(s.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.applications.remove(e,n))throw new A(404,{message:"Application not found"});return t.text("OK")}).openapi(s.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object($o.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:xn}},description:"The update application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=t.req.valid("json");await t.env.data.applications.update(e,n,i);const o=await t.env.data.applications.get(e,n);if(!o)throw new A(404,{message:"Application not found"});return t.json(o)}).openapi(s.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object($o.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.object(xn.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||xe(),client_secret:n.client_secret||xe()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()});ys.extend({email:s.z.string(),login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any());const Sv=Xt.extend({tenants:s.z.array(or)}),Av=new s.OpenAPIHono().openapi(s.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Vt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.union([s.z.array(or),Sv])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),a=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:Vn(i),q:o});return r?t.json(a):t.json(a.tenants)}).openapi(s.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:or}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new A(404);return t.json(n)}).openapi(s.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param");return await t.env.data.tenants.remove(e),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ko.shape).partial()}}},params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),n=t.req.valid("json");return await t.env.data.tenants.update(e,n),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ko.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:or}},description:"An tenant"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.tenants.create(e);return t.json(n,{status:201})}),Ev=Xt.extend({logs:s.z.array(Ao)}),zv=new s.OpenAPIHono().openapi(s.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Ao),Ev])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),c=await t.env.data.logs.list(a,{page:e,per_page:n,include_totals:r,sort:Vn(i),q:o});return r?t.json(c):t.json(c.logs)}).openapi(s.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ao}},description:"A log entry"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.logs.get(e,n);if(!r)throw new A(404);return t.json(r)}),Iv=Xt.extend({hooks:s.z.array(nr)}),Nv=new s.OpenAPIHono().openapi(s.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(nr),Iv])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),c=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a});return i?t.json(c):t.json(c.hooks)}).openapi(s.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Qi}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:nr}},description:"The created hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.hooks.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()}),body:{content:{"application/json":{schema:s.z.union([Qi.options[0].omit({hook_id:!0}).partial(),Qi.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:nr}},description:"The updated hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=t.req.valid("json");await t.env.data.hooks.update(e,n,r);const i=await t.env.data.hooks.get(e,n);if(!i)throw new A(404,{message:"Hook not found"});return t.json(i)}).openapi(s.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:nr}},description:"A hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=await t.env.data.hooks.get(e,n);if(!r)throw new A(404,{message:"Hook not found"});return t.json(r)}).openapi(s.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param");if(!await t.env.data.hooks.remove(e,n))throw new A(404,{message:"Hook not found"});return t.text("OK")}),Cv=Xt.extend({connections:s.z.array(rn)}),jv=new s.OpenAPIHono().openapi(s.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(rn),Cv])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),c=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a});return i?t.json(c):t.json(c.connections)}).openapi(s.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:rn}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.connections.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.connections.remove(e,n))throw new A(404,{message:"Connection not found"});return t.text("OK")}).openapi(s.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(xo.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:rn}},description:"The updated connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.connections.update(e,n,r))throw new A(404,{message:"Connection not found"});const o=await t.env.data.connections.get(e,n);if(!o)throw new A(404,{message:"Connection not found"});return t.json(o)}).openapi(s.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(xo.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:rn}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.connections.create(e,n);return t.json(r,{status:201})}),Ov=new s.OpenAPIHono().openapi(s.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:eo}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.promptSettings.get(e);return n?t.json(n):t.json(eo.parse({}))}).openapi(s.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(eo.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.promptSettings.get(e);return Object.assign(r,n),await t.env.data.promptSettings.set(e,r),t.json(r)});let yf=!1;function pm(t){t.use(async(e,n)=>(yf||(t.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),yf=!0),await n()))}s.z.object({alg:s.z.literal("RS256"),kty:s.z.literal("RSA"),use:s.z.literal("sig"),n:s.z.string(),e:s.z.string(),kid:s.z.string(),x5t:s.z.string(),x5c:s.z.array(s.z.string())});async function Pv(t){try{const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new A(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function Tv(t,e){const r=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),i=new Uint8Array(Array.from(e.signature).map(d=>d.charCodeAt(0))),a=(await Pv(t.env)).find(d=>d.kid===e.header.kid);if(!a)return console.log("No matching kid found"),!1;const c=await crypto.subtle.importKey("jwk",a,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",c,i,r)}function Rv(t){const[e,n,r]=t.split(".");if(!e||!n||!r)return null;const i=JSON.parse(atob(e)),o=JSON.parse(atob(n)),a=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return{header:i,payload:o,signature:a,raw:{header:e,payload:n,signature:r}}}function fm(t){return async(e,n)=>{var i,o,a;const r=t.openAPIRegistry.definitions.find(c=>"route"in c&&c.route.path===e.req.path&&c.route.method.toUpperCase()===e.req.method);if(r&&"route"in r){const c=(o=(i=r.route.security)==null?void 0:i[0])==null?void 0:o.Bearer;if(!(c!=null&&c.length))return await n();const d=e.req.header("authorization")||"",[l,u]=d.split(" ");if((l==null?void 0:l.toLowerCase())!=="bearer"||!u)throw new A(401,{message:"Missing bearer token"});const f=Rv(u);if(!f||!await Tv(e,f))throw new A(403,{message:"Invalid JWT signature"});e.set("user_id",f.payload.sub),e.set("user",f.payload);const m=f.payload.permissions||[],w=((a=f.payload.scope)==null?void 0:a.split(" "))||[];if(c.length&&!(c.some(h=>m.includes(h))||c.some(h=>w.includes(h))))throw new A(403,{message:"Unauthorized"})}return await n()}}const Bv=new s.OpenAPIHono().openapi(s.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:to}},description:"Email provider"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.emailProviders.get(e);if(!n)throw new A(404,{message:"Email provider not found"});return t.json(n)}).openapi(s.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(to.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.create(e,n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(to.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.update(e,n),t.text("OK")}),Lv=new s.OpenAPIHono().openapi(s.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:$s}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.sessions.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.remove(e,n))throw new A(404,{message:"Session not found"});return t.text("OK")}).openapi(s.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.update(e,n,{revoked_at:new Date().toDateString()}))throw new A(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),Uv=new s.OpenAPIHono().openapi(s.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:qd}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.refreshTokens.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.refreshTokens.remove(e,n))throw new A(404,{message:"Session not found"});return t.text("OK")}),Mv=new s.OpenAPIHono().openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(nn)}},description:"List of custom domains"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.customDomains.list(e);return t.json(n)}).openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:nn}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.customDomains.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.customDomains.remove(e,n))throw new A(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(s.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(nn.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:nn}},description:"The updated custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.customDomains.update(e,n,r))throw new A(404);const o=await t.env.data.customDomains.get(e,n);if(!o)throw new A(404);return t.json(o)}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(Fd.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:nn}},description:"The created custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.customDomains.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:nn}},description:"The custom domain"}}}),async()=>{throw new A(501,{message:"Not implemented"})});function Fl(t,e){const n={};for(const[r,i]of Object.entries(e)){const o={};for(const[a,c]of Object.entries(i))typeof c=="function"?o[a]=async(...d)=>{const l=performance.now();try{const u=await c(...d),m=performance.now()-l,w=t.res.headers.get("Server-Timing")||"",h=w?`${w}, ${r}-${a};dur=${m.toFixed(2)}`:`${r}-${a};dur=${m.toFixed(2)}`;return t.res.headers.set("Server-Timing",h),u}catch(u){const m=performance.now()-l,w=t.res.headers.get("Server-Timing")||"",h=w?`${w}, ${r}-${a}-error;dur=${m.toFixed(2)}`:`${r}-${a}-error;dur=${m.toFixed(2)}`;throw t.res.headers.set("Server-Timing",h),u}}:o[a]=c;n[r]=o}return n}async function Dl(t,e){const n=t.req.header("x-forwarded-host");if(n){const i=await t.env.data.customDomains.getByDomain(n);if(i)return t.set("tenant_id",i.tenant_id),t.set("custom_domain",n),await e()}const r=t.req.header("host");if(r){const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const o=i[0];await t.env.data.tenants.get(o)&&t.set("tenant_id",o)}}return await e()}const $n=class $n{constructor(){te(this,"cacheStore",new Map)}static getInstance(){return $n.instance||($n.instance=new $n),$n.instance}set(e,n,r){if(r<=0)return;const i=Date.now()+r;this.cacheStore.set(e,{value:n,expiresAt:i})}get(e){const n=this.cacheStore.get(e);if(n){if(Date.now()>n.expiresAt){this.cacheStore.delete(e);return}return n.value}}delete(e){this.cacheStore.delete(e)}getKeysByPrefix(e){return Array.from(this.cacheStore.keys()).filter(n=>n.startsWith(e))}clear(){this.cacheStore.clear()}};te($n,"instance");let kd=$n;function Fv(t,e,n){try{return`${t}:${e}:${JSON.stringify(n)}`}catch{return`${t}:${e}:${Date.now()}-${Math.random()}`}}function Vl(t,e){const n=e.cache||kd.getInstance(),r=e.defaultTtl,i=e.customTtls||{},o=new Set(e.excludeMethods||[]),a=e.maxItems||0,c=e.cacheEntities||[],d=c.length===0,l=new Set(c),u={};for(const[f,m]of Object.entries(t)){const w=d||l.has(f),h={};for(const[y,v]of Object.entries(m))if(typeof v=="function"){if(!w){h[y]=v;continue}const b=`${f}:${y}`;if(o.has(b)){h[y]=v;continue}const E=i[b]||r,C=["create","update","remove","delete","set","used"].includes(y);h[y]=async(...L)=>{if(C){const Se=await Promise.resolve(n.getKeysByPrefix(`${f}:`));for(const ze of Se)await Promise.resolve(n.delete(ze));return await v.apply(m,L)}const Y=Fv(f,y,L),se=await Promise.resolve(n.get(Y));if(se!==void 0)return se;const ae=await v.apply(m,L);if(await n.set(Y,ae,E),a>0){const Se=await Promise.resolve(n.getKeysByPrefix(""));if(Se.length>a){const ze=Se.slice(0,Se.length-a);for(const Ce of ze)await Promise.resolve(n.delete(Ce))}}return ae}}else h[y]=v;u[f]=h}return u}const Dv=Xt.extend({forms:s.z.array(tr)}),Vv=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(tr),Dv])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),c=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a});return i?t.json(c):t.json(c.forms)}).openapi(s.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:tr}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.forms.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.forms.remove(e,n))throw new A(404,{message:"Form not found"});return t.text("OK")}).openapi(s.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(So.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:tr}},description:"The updated form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.forms.update(e,n,r))throw new A(404,{message:"Form not found"});const o=await t.env.data.forms.get(e,n);if(!o)throw new A(404,{message:"Form not found"});return t.json(o)}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(So.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:tr}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.forms.create(e,n);return t.json(r,{status:201})});function qv(t){const e=new s.OpenAPIHono;e.use(bh({origin:r=>{var i;return r&&(i=t.allowedOrigins)!=null&&i.includes(r)?r:""},allowHeaders:["Tenant-Id","Content-Type","Content-Range","Auth0-Client","Authorization","Range","Upgrade-Insecure-Requests"],allowMethods:["POST","PUT","GET","DELETE","PATCH","OPTIONS"],exposeHeaders:["Content-Length","Content-Range"],maxAge:600,credentials:!0})),pm(e),e.use(async(r,i)=>{const o=Es(r,t.dataAdapter),a=Vl(o,{defaultTtl:0,cacheEntities:["tenants","connections","clients"]});return r.env.data=Fl(r,a),i()}),e.use(Dl).use(fm(e));const n=e.route("/branding",f_).route("/custom-domains",Mv).route("/email/providers",Bv).route("/users",x2).route("/keys",bv).route("/users-by-email",$v).route("/clients",kv).route("/tenants",Av).route("/logs",zv).route("/hooks",Nv).route("/connections",jv).route("/prompts",Ov).route("/sessions",Lv).route("/refresh_tokens",Uv).route("/forms",Vv);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management API"},servers:[{url:"/api/v2",description:"API V2"}],security:[{oauth2:["openid","email","profile"]}]}),n}function Hv(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}var wf;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(wf||(wf={}));var vf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(vf||(vf={}));function Kv(t){return gm(t,Gv,pi.Include)}function hm(t){return gm(t,Wv,pi.None)}function gm(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let c=0;c<3&&i+c<t.byteLength;c++)o=o<<8|t[i+c],a+=8;for(let c=0;c<4;c++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===pi.Include&&(r+="=")}return r}const Gv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var pi;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(pi||(pi={}));var bf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(bf||(bf={}));class Jv{uint8(e,n){if(e.byteLength<n+1)throw new TypeError("Insufficient bytes");return e[n]}uint16(e,n){if(e.byteLength<n+2)throw new TypeError("Insufficient bytes");return e[n]<<8|e[n+1]}uint32(e,n){if(e.byteLength<n+4)throw new TypeError("Insufficient bytes");let r=0;for(let i=0;i<4;i++)r|=e[n+i]<<24-i*8;return r}uint64(e,n){if(e.byteLength<n+8)throw new TypeError("Insufficient bytes");let r=0n;for(let i=0;i<8;i++)r|=BigInt(e[n+i])<<BigInt(56-i*8);return r}putUint8(e,n,r){if(e.length<r+1)throw new TypeError("Not enough space");if(n<0||n>255)throw new TypeError("Invalid uint8 value");e[r]=n}putUint16(e,n,r){if(e.length<r+2)throw new TypeError("Not enough space");if(n<0||n>65535)throw new TypeError("Invalid uint16 value");e[r]=n>>8,e[r+1]=n&255}putUint32(e,n,r){if(e.length<r+4)throw new TypeError("Not enough space");if(n<0||n>4294967295)throw new TypeError("Invalid uint32 value");for(let i=0;i<4;i++)e[r+i]=n>>(3-i)*8&255}putUint64(e,n,r){if(e.length<r+8)throw new TypeError("Not enough space");if(n<0||n>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let i=0;i<8;i++)e[r+i]=Number(n>>BigInt((7-i)*8)&0xffn)}}const $f=new Jv;function At(t,e){return(t<<32-e|t>>>e)>>>0}function Xv(t){const e=new Zv;return e.update(t),e.digest()}class Zv{constructor(){te(this,"blockSize",64);te(this,"size",32);te(this,"blocks",new Uint8Array(64));te(this,"currentBlockSize",0);te(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));te(this,"l",0n);te(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let n=0;if(this.currentBlockSize>0){const r=e.slice(0,64-this.currentBlockSize);this.blocks.set(r,this.currentBlockSize),this.process(),n+=r.byteLength,this.currentBlockSize=0}for(;n+64<=e.byteLength;){const r=e.slice(n,n+64);this.blocks.set(r),this.process(),n+=64}if(e.byteLength-n>0){const r=e.slice(n);this.blocks.set(r),this.currentBlockSize=r.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),$f.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)$f.putUint32(e,this.H[n],n*4);return e}process(){for(let l=0;l<16;l++)this.w[l]=(this.blocks[l*4]<<24|this.blocks[l*4+1]<<16|this.blocks[l*4+2]<<8|this.blocks[l*4+3])>>>0;for(let l=16;l<64;l++){const u=(At(this.w[l-2],17)^At(this.w[l-2],19)^this.w[l-2]>>>10)>>>0,f=(At(this.w[l-15],7)^At(this.w[l-15],18)^this.w[l-15]>>>3)>>>0;this.w[l]=u+this.w[l-7]+f+this.w[l-16]|0}let e=this.H[0],n=this.H[1],r=this.H[2],i=this.H[3],o=this.H[4],a=this.H[5],c=this.H[6],d=this.H[7];for(let l=0;l<64;l++){const u=(At(o,6)^At(o,11)^At(o,25))>>>0,f=(o&a^~o&c)>>>0,m=d+u+f+Yv[l]+this.w[l]|0,w=(At(e,2)^At(e,13)^At(e,22))>>>0,h=(e&n^e&r^n&r)>>>0,y=w+h|0;d=c,c=a,a=o,o=i+m|0,i=r,r=n,n=e,e=m+y|0}this.H[0]=e+this.H[0]|0,this.H[1]=n+this.H[1]|0,this.H[2]=r+this.H[2]|0,this.H[3]=i+this.H[3]|0,this.H[4]=o+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=c+this.H[6]|0,this.H[7]=d+this.H[7]|0}}const Yv=new Uint32Array([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]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class Qv{constructor(e){te(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function eb(t){const e=Xv(new TextEncoder().encode(t));return hm(e)}function tb(){const t=new Uint8Array(32);return crypto.getRandomValues(t),hm(t)}function Jr(t,e){const n=new TextEncoder().encode(e.toString()),r=new Request(t,{method:"POST",body:n});return r.headers.set("Content-Type","application/x-www-form-urlencoded"),r.headers.set("Accept","application/json"),r.headers.set("User-Agent","arctic"),r.headers.set("Content-Length",n.byteLength.toString()),r}function Ma(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return Kv(n)}async function ls(t){let e;try{e=await fetch(t)}catch(n){throw new _m(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new ao(e.status)}if(typeof n!="object"||n===null)throw new cr(e.status,n);let r;try{r=mm(n)}catch{throw new cr(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new ao(e.status)}if(typeof n!="object"||n===null)throw new cr(e.status,n);return new Qv(n)}throw e.body!==null&&await e.body.cancel(),new ao(e.status)}async function nb(t){let e;try{e=await fetch(t)}catch(n){throw new _m(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new cr(e.status,null)}if(typeof n!="object"||n===null)throw new cr(e.status,n);let r;try{r=mm(n)}catch{throw new cr(e.status,n)}throw r}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new ao(e.status)}function mm(t){let e;if("error"in t&&typeof t.error=="string")e=t.error;else throw new Error("Invalid error response");let n=null,r=null,i=null;if("error_description"in t){if(typeof t.error_description!="string")throw new Error("Invalid data");n=t.error_description}if("error_uri"in t){if(typeof t.error_uri!="string")throw new Error("Invalid data");r=t.error_uri}if("state"in t){if(typeof t.state!="string")throw new Error("Invalid data");i=t.state}return new rb(e,n,r,i)}class _m extends Error{constructor(e){super("Failed to send request",{cause:e})}}class rb extends Error{constructor(n,r,i,o){super(`OAuth request error: ${n}`);te(this,"code");te(this,"description");te(this,"uri");te(this,"state");this.code=n,this.description=r,this.uri=i,this.state=o}}class ao extends Error{constructor(n){super("Unexpected error response");te(this,"status");this.status=n}}class cr extends Error{constructor(n,r){super("Unexpected error response body");te(this,"status");te(this,"data");this.status=n,this.data=r}}class ql{constructor(e,n,r){te(this,"clientId");te(this,"clientPassword");te(this,"redirectURI");this.clientId=e,this.clientPassword=n,this.redirectURI=r}createAuthorizationURL(e,n,r){const i=new URL(e);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&i.searchParams.set("redirect_uri",this.redirectURI),i.searchParams.set("state",n),r.length>0&&i.searchParams.set("scope",r.join(" ")),i}createAuthorizationURLWithPKCE(e,n,r,i,o){const a=new URL(e);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&a.searchParams.set("redirect_uri",this.redirectURI),a.searchParams.set("state",n),r===fi.S256){const c=eb(i);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",c)}else r===fi.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",i));return o.length>0&&a.searchParams.set("scope",o.join(" ")),a}async validateAuthorizationCode(e,n,r){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("code",n),this.redirectURI!==null&&i.set("redirect_uri",this.redirectURI),r!==null&&i.set("code_verifier",r),this.clientPassword===null&&i.set("client_id",this.clientId);const o=Jr(e,i);if(this.clientPassword!==null){const c=Ma(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${c}`)}return await ls(o)}async refreshAccessToken(e,n,r){const i=new URLSearchParams;i.set("grant_type","refresh_token"),i.set("refresh_token",n),this.clientPassword===null&&i.set("client_id",this.clientId),r.length>0&&i.set("scope",r.join(" "));const o=Jr(e,i);if(this.clientPassword!==null){const c=Ma(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${c}`)}return await ls(o)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=Jr(e,r);if(this.clientPassword!==null){const o=Ma(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${o}`)}await nb(i)}}var fi;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(fi||(fi={}));var xf;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(xf||(xf={}));var kf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(kf||(kf={}));function Xr(t){return ib(t,ob,us.None)}function ib(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let c=0;c<3&&i+c<t.byteLength;c++)o=o<<8|t[i+c],a+=8;for(let c=0;c<4;c++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===us.Include&&(r+="=")}return r}const ob="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var us;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(us||(us={}));var Sf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Sf||(Sf={}));function sb(t,e,n){const r=Xr(new TextEncoder().encode(t)),i=Xr(new TextEncoder().encode(e)),o=Xr(n);return r+"."+i+"."+o}function ab(t,e){const n=Xr(new TextEncoder().encode(t)),r=Xr(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const cb="https://appleid.apple.com/auth/authorize",db="https://appleid.apple.com/auth/token";class ym{constructor(e,n,r,i,o){te(this,"clientId");te(this,"teamId");te(this,"keyId");te(this,"pkcs8PrivateKey");te(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=o}createAuthorizationURL(e,n){const r=new URL(cb);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId);const r=await this.createClientSecret();n.set("client_secret",r);const i=Jr(db,n);return await ls(i)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),n=Math.floor(Date.now()/1e3),r=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),i=JSON.stringify({iss:this.teamId,exp:n+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:n}),o=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,ab(r,i)));return sb(r,i,o)}}const lb="https://www.facebook.com/v16.0/dialog/oauth",ub="https://graph.facebook.com/v16.0/oauth/access_token";class wm{constructor(e,n,r){te(this,"clientId");te(this,"clientSecret");te(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(lb);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId),n.set("client_secret",this.clientSecret);const r=Jr(ub,n);return await ls(r)}}const pb="https://accounts.google.com/o/oauth2/v2/auth",Af="https://oauth2.googleapis.com/token",fb="https://oauth2.googleapis.com/revoke";let vm=class{constructor(e,n,r){te(this,"client");this.client=new ql(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(pb,e,fi.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(Af,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(Af,e,[])}async revokeToken(e){await this.client.revokeToken(fb,e)}};const wa=s.z.object({iss:s.z.string().url(),sub:s.z.string(),aud:s.z.string(),exp:s.z.number(),email:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),name:s.z.string().optional(),iat:s.z.number(),auth_time:s.z.number().optional(),nonce:s.z.string().optional(),acr:s.z.string().optional(),amr:s.z.array(s.z.string()).optional(),azp:s.z.string().optional(),at_hash:s.z.string().optional(),c_hash:s.z.string().optional()}).passthrough();wa.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function hb(t){return t.ISSUER}function dt(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function Pe(t){return t.OAUTH_API_URL||t.ISSUER}function bm(t){const{options:e}=t;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const n=Buffer.from(e.app_secret,"utf-8"),r=n.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),i=Uint8Array.from(Buffer.from(r,"base64"));return n.fill(0),{options:e,keyArray:i}}async function gb(t,e){var d,l;const{options:n,keyArray:r}=bm(e),i=new ym(n.client_id,n.team_id,n.kid,r,`${Pe(t.env)}callback`),o=xe(),a=await i.createAuthorizationURL(o,((d=n.scope)==null?void 0:d.split(" "))||["name","email"]);return(((l=n.scope)==null?void 0:l.split(" "))||["name","email"]).some(u=>["email","name"].includes(u))&&a.searchParams.set("response_mode","form_post"),{redirectUrl:a.href,code:o}}async function mb(t,e,n){const{options:r,keyArray:i}=bm(e),a=await new ym(r.client_id,r.team_id,r.kid,i,`${Pe(t.env)}callback`).validateAuthorizationCode(n),c=Kd(a.idToken());if(!c)throw new Error("Invalid ID token");const d=wa.parse(c.payload);return{sub:d.sub,email:d.email,given_name:d.given_name,family_name:d.family_name,name:d.name,picture:d.picture,locale:d.locale}}const _b=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:gb,validateAuthorizationCodeAndGetUser:mb},Symbol.toStringTag,{value:"Module"}));async function yb(t,e){var a;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new wm(n.client_id,n.client_secret,`${Pe(t.env)}callback`),i=xe();return{redirectUrl:r.createAuthorizationURL(i,((a=n.scope)==null?void 0:a.split(" "))||["email"]).href,code:i}}async function wb(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new wm(r.client_id,r.client_secret,`${Pe(t.env)}callback`).validateAuthorizationCode(n),a=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${o.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const c=await a.json();return t.set("log",`Userinfo: ${JSON.stringify(c)}`),{sub:c.id,email:c.email,name:c.name}}const vb=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:yb,validateAuthorizationCodeAndGetUser:wb},Symbol.toStringTag,{value:"Module"}));async function bb(t,e){var c;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=new vm(n.client_id,n.client_secret,`${Pe(t.env)}callback`),i=xe(),o=tb();return{redirectUrl:r.createAuthorizationURL(i,o,((c=n.scope)==null?void 0:c.split(" "))??["email","profile"]).href,code:i,codeVerifier:o}}async function $b(t,e,n,r){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret||!r)throw new Error("Missing required authentication parameters");const a=await new vm(i.client_id,i.client_secret,`${Pe(t.env)}callback`).validateAuthorizationCode(n,r),c=Kd(a.idToken());if(!c)throw new Error("Invalid ID token");const d=wa.parse(c.payload);return{sub:d.sub,email:d.email,given_name:d.given_name,family_name:d.family_name,name:d.name,picture:d.picture,locale:d.locale}}const xb=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:bb,validateAuthorizationCodeAndGetUser:$b},Symbol.toStringTag,{value:"Module"}));async function kb(t,e){var a;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new ql(n.client_id,n.client_secret,`${Pe(t.env)}callback`),i=xe(),o=r.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",i,((a=n.scope)==null?void 0:a.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return o.searchParams.set("response_type","code"),o.searchParams.set("response_mode","query"),{redirectUrl:o.href,code:i}}async function Sb(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new ql(r.client_id,r.client_secret,`${Pe(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),a=Kd(o.idToken());if(!a)throw new Error("Invalid ID token");const c=wa.parse(a.payload);if(typeof c.msn!="string")throw new Error("msn not available in id token");const d=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${o.accessToken()}`,"Merchant-Serial-Number":c.msn}});if(!d.ok)throw new A(400,{message:"Failed to get user from vipps"});return await d.json()}const Ab=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:kb,validateAuthorizationCodeAndGetUser:Sb},Symbol.toStringTag,{value:"Module"}));function $m(t,e){const n=t.env.STRATEGIES||{},i={apple:_b,facebook:vb,"google-oauth2":xb,vipps:Ab,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function Ui(t,e){const n=await t.data.clients.get(e);if(!n)throw new A(403,{message:"Client not found"});const r=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,i=await t.data.connections.list(n.tenant.id),o=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},a=i.connections.map(c=>{var u;const d=(u=o.connections)==null?void 0:u.find(f=>f.name===c.name);if(!(d!=null&&d.options))return c;const l=rn.parse({...d||{},...c});return l.options=Md.passthrough().parse({...d.options||{},...c.options}),l}).filter(c=>c);return{...n,web_origins:[...(r==null?void 0:r.web_origins)||[],...n.web_origins||[],`${dt(t)}login`],allowed_logout_urls:[...(r==null?void 0:r.allowed_logout_urls)||[],...n.allowed_logout_urls||[],t.ISSUER],callbacks:[...(r==null?void 0:r.callbacks)||[],...n.callbacks||[],`${dt(t)}info`],connections:a,tenant:{...(r==null?void 0:r.tenant)||{},...n.tenant}}}async function Eb(t,e,n,r){if(!r.state)throw new A(400,{message:"State not found"});const i=e.connections.find(d=>d.name===n);if(!i){t.set("client_id",e.id);const d=we(t,{type:he.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,d),new A(403,{message:"Connection Not Found"})}let o=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!o){const{ip:d,useragent:l,auth0Client:u}=jt(t.req);o=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:r,csrf_token:xe(),ip:d,useragent:l,auth0Client:u})}const c=await $m(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:o.id,code_id:c.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:c.codeVerifier,expires_at:new Date(Date.now()+L_*1e3).toISOString()}),t.redirect(c.redirectUrl)}async function Ef(t,{code:e,state:n}){var h;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new A(403,{message:"State not found"});const o=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!o)throw new A(403,{message:"Session not found"});if(o.authorization_url){const y=new URL(o.authorization_url).hostname,v=t.var.custom_domain||t.req.header("host")||"";if(y!==v&&y){const b=new URL(`https://${y}/callback`);return b.searchParams.set("state",n),b.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:b.toString()}})}}const a=await Ui(r,o.authParams.client_id);t.set("client_id",a.id),t.set("tenant_id",a.tenant.id);const c=a.connections.find(y=>y.id===i.connection_id);if(!c){const y=we(t,{type:he.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(a.tenant.id,y),new A(403,{message:"Connection not found"})}if(t.set("connection",c.name),!o.authParams.redirect_uri){const y=we(t,{type:he.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(a.tenant.id,y),new A(403,{message:"Redirect URI not defined"})}const l=await $m(t,c.strategy).validateAuthorizationCodeAndGetUser(t,c,e,i.code_verifier),{sub:u,...f}=l;t.set("user_id",u);const m=((h=l.email)==null?void 0:h.toLocaleLowerCase())||`${c.name}.${u}@${new URL(t.env.ISSUER).hostname}`;t.set("username",m);const w=await Is(t,{client:a,username:m,provider:c.strategy,connection:c.name,userId:u,profileData:f,isSocial:!0,ip:t.req.header("x-real-ip")});return Zt(t,{client:a,authParams:o.authParams,loginSession:o,user:w})}async function zf(t,e,n,r,i,o){const a=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!a)throw new A(400,{message:"State not found"});const c=await t.env.data.loginSessions.get(t.var.tenant_id,a.login_id);if(!c)throw new A(400,{message:"Login not found"});const{redirect_uri:d}=c.authParams;if(!d)throw new A(400,{message:"Redirect uri not found"});const l=we(t,{type:he.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});It(t,t.env.data.logs.create(t.var.tenant_id,l));const u=new URL(d);return Hv(u,{error:n,error_description:r,error_reason:o,error_code:i,state:c.authParams.state}),t.redirect(`${dt(t.env)}login/identifier?state=${c.id}&error=${n}`)}const zb=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("query");if(r)return zf(t,e,r,i,o,a);if(!n)throw new A(400,{message:"Code is required"});const c=await Ef(t,{code:n,state:e});if(!(c instanceof Response))throw new A(500,{message:"Internal server error"});return c}).openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("form");if(r)return zf(t,e,r,i,o,a);if(!n)throw new A(400,{message:"Code is required"});const c=await Ef(t,{code:n,state:e});if(!(c instanceof Response))throw new A(500,{message:"Internal server error"});return c});function xm(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return Ib(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function Ib(t,e,n){if(t.protocol!==e.protocol)return!1;if(n&&e.pathname.includes("*")){const r=e.pathname.replace(/\*/g,".*").replace(/\//g,"\\/");if(!new RegExp(`^${r}$`).test(t.pathname))return!1}else if(t.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const r=e.hostname.split(".").slice(1).join(".");return t.hostname.endsWith(r)}return t.hostname===e.hostname}const Nb=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),returnTo:s.z.string().optional()}),header:s.z.object({cookie:s.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async t=>{const{client_id:e,returnTo:n}=t.req.valid("query"),r=await t.env.data.clients.get(e);if(!r)return t.text("OK");const i=await t.env.data.clients.get("DEFAULT_CLIENT");t.set("client_id",e),t.set("tenant_id",r.tenant.id);const o=n||t.req.header("referer");if(!o)return t.text("OK");if(!xm(o,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new A(400,{message:"Invalid redirect uri"});const a=t.req.header("cookie");if(a){const d=zo(r.tenant.id,a);if(d){const l=await t.env.data.sessions.get(r.tenant.id,d);if(l){const u=await t.env.data.users.get(r.tenant.id,l.user_id);u&&(t.set("user_id",u.user_id),t.set("connection",u.connection));const f=await t.env.data.refreshTokens.list(r.tenant.id,{q:`session_id=${d}`,page:0,per_page:100,include_totals:!1});await Promise.all(f.refresh_tokens.map(m=>t.env.data.refreshTokens.remove(r.tenant.id,m.id))),await t.env.data.sessions.update(r.tenant.id,d,{revoked_at:new Date().toISOString()})}}}const c=we(t,{type:he.SUCCESS_LOGOUT,description:"User successfully logged out"});return await t.env.data.logs.create(r.tenant.id,c),new Response("Redirecting",{status:302,headers:{"set-cookie":V_(r.tenant.id,t.req.header("host")),location:o}})}),If=s.z.object({sub:s.z.string(),email:s.z.string().optional(),family_name:s.z.string().optional(),given_name:s.z.string().optional(),email_verified:s.z.boolean()}),Cb=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:If}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new A(404,{message:"User not found"});const e=await t.env.data.users.get(t.var.user.tenant_id,t.var.user.sub);if(!e)throw new A(404,{message:"User not found"});return t.json(If.parse({...e,sub:e.user_id}))}),jb=new s.OpenAPIHono().openapi(s.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:Kh}},description:"List of tenants"}}}),async t=>{const e=await t.env.data.keys.list(),n=await Promise.all(e.map(async r=>{const o=await new Ml(r.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",o);return Dd.parse({...a,kid:r.kid})}));return t.json({keys:n},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Gi}, stale-while-revalidate=${Gi*2}, stale-if-error=86400`}})}).openapi(s.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:ec}},description:"List of tenants"}}}),async t=>{const e=ec.parse({issuer:hb(t.env),authorization_endpoint:`${Pe(t.env)}authorize`,token_endpoint:`${Pe(t.env)}oauth/token`,device_authorization_endpoint:`${Pe(t.env)}oauth/device/code`,userinfo_endpoint:`${Pe(t.env)}userinfo`,mfa_challenge_endpoint:`${Pe(t.env)}mfa/challenge`,jwks_uri:`${Pe(t.env)}.well-known/jwks.json`,registration_endpoint:`${Pe(t.env)}oidc/register`,revocation_endpoint:`${Pe(t.env)}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return t.json(e,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Gi}, stale-while-revalidate=${Gi*2}, stale-if-error=86400`}})});function co(t,e){if(!t||!e||t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t.charCodeAt(r)^e.charCodeAt(r);return n===0}const km=s.z.object({grant_type:s.z.literal("client_credentials"),scope:s.z.string().optional(),client_secret:s.z.string(),client_id:s.z.string(),audience:s.z.string().optional()});async function Ob(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new A(403,{message:"Invalid client credentials"});if(n.client_secret&&!co(n.client_secret,e.client_secret))throw new A(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience},i=await As(t,{authParams:r,client:n});return t.json(i)}const Pb=s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string().optional(),client_secret:s.z.string().optional(),code_verifier:s.z.string().optional()}).refine(t=>"client_secret"in t&&!("code_verifier"in t)||!("client_secret"in t)&&"code_verifier"in t,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function Tb(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new A(403,{message:"Client not found"});const r=await t.env.data.codes.get(n.tenant.id,e.code,"authorization_code");if(!r||!r.user_id)throw new A(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new A(403,{message:"Code expired"});if(r.used_at)throw new A(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new A(403,{message:"Invalid login"});if("client_secret"in e){const a=await t.env.data.clients.get("DEFAULT_CLIENT");if(!co(n.client_secret,e.client_secret)&&!co(a==null?void 0:a.client_secret,e.client_secret))throw new A(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const a=await P_(e.code_verifier,r.code_challenge_method);if(!co(a,r.code_challenge))throw new A(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new A(403,{message:"Invalid redirect uri"});const o=await t.env.data.users.get(n.tenant.id,r.user_id);if(!o)throw new A(403,{message:"User not found"});return await t.env.data.codes.used(n.tenant.id,e.code),Zt(t,{user:o,client:n,loginSession:i,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:Dt.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}})}const Rb=s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),redirect_uri:s.z.string().optional(),refresh_token:s.z.string()});async function Bb(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new A(403,{message:"Client not found"});const r=await t.env.data.refreshTokens.get(n.tenant.id,e.refresh_token);if(r){if(r.expires_at&&new Date(r.expires_at)<new Date||r.idle_expires_at&&new Date(r.idle_expires_at)<new Date)throw new A(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new A(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Invalid refresh token"})});const i=await t.env.data.users.get(n.tenant.id,r.user_id);if(!i)throw new A(403,{message:"User not found"});const o=r.resource_servers[0];if(r.idle_expires_at){const a=new Date(Date.now()+2592e6);await t.env.data.refreshTokens.update(n.tenant.id,r.id,{idle_expires_at:a.toISOString(),last_exchanged_at:new Date().toISOString(),device:{...r.device,last_ip:t.req.header["x-real-ip"]||"",last_user_agent:t.req.header["user-agent"]||""}})}return Zt(t,{user:i,client:n,refreshToken:r.id,sessionId:r.session_id,authParams:{client_id:n.id,audience:o==null?void 0:o.audience,scope:o==null?void 0:o.scopes,response_mode:Dt.WEB_MESSAGE}})}const Lb={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(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|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]|2[23]"],"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","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?: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))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\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)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|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-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\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-9]\\d{9}|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])|9(?:0[25]|42))[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(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[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]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\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{2})(\\d{4})","$1 $2 $3",["2"],"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"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"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,12],[["(\\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[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|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(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"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])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($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,10,11,12],[["(\\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",["(?:19|[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[0-35])|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-3]))|(?: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|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|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|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"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))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\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","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{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]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\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,12],[["(\\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}",[6,7,8,9,10,11]],["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]],["3[2-8]\\d{9,10}",[11,12]],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",["[36]0|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",["3"],"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-467]|5[0-3]|8[0-7]))\\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|7090)\\d{5}|(?: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))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\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",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"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|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"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]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,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","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\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","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],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|8\\d\\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[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"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[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|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]","(?:[2489]\\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,12],[["(\\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]|7[67]|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d|90)\\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-9]"]]]],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|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],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(?:[1245]|3[12])"]],["(\\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,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-468]))\\d{4}|(?:2742|305[3-9]|472[247-9]|505[2-57-9]|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-47-9]|1[02-9]|2[0135-79]|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[0-247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|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}"],0,0,0,["305209\\d{4}"]]],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-9]\\d)\\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,12],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|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\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","7093\\d{5}|(?: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])|7093[5-7])\\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|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"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}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],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,["348[57]\\d{7}",[11]],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}"]]]}};function Ub(t,e){var n=Array.prototype.slice.call(e);return n.push(Lb),t.apply(this,n)}function Nf(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var o=Number(n[i]),a=Number(r[i]);if(o>a)return 1;if(a>o)return-1;if(!isNaN(o)&&isNaN(a))return 1;if(isNaN(o)&&!isNaN(a))return-1}return t[1]&&e[1]?t[1]>e[1]?1:t[1]<e[1]?-1:0:!t[1]&&e[1]?1:t[1]&&!e[1]?-1:0}var Mb={}.constructor;function dr(t){return t!=null&&t.constructor===Mb}function Sd(t){"@babel/helpers - typeof";return Sd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sd(t)}function va(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fb(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ba(t,e,n){return e&&Fb(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Db="1.2.0",Vb="1.7.35",Cf=" ext. ",qb=/^\d+$/,Ge=function(){function t(e){va(this,t),Sm(e),this.metadata=e,Am.call(this,e)}return ba(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(n){return n!=="001"})}},{key:"getCountryMetadata",value:function(n){return this.metadata.countries[n]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(n){return this.getCountryMetadata(n)!==void 0}},{key:"hasCallingCode",value:function(n){if(this.getCountryCodesForCallingCode(n))return!0;if(this.nonGeographic()){if(this.nonGeographic()[n])return!0}else{var r=this.countryCallingCodes()[n];if(r&&r.length===1&&r[0]==="001")return!0}}},{key:"isNonGeographicCallingCode",value:function(n){return this.nonGeographic()?!!this.nonGeographic()[n]:!this.getCountryCodesForCallingCode(n)}},{key:"country",value:function(n){return this.selectNumberingPlan(n)}},{key:"selectNumberingPlan",value:function(n,r){if(n&&qb.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new jf(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new jf(this.getNumberingPlanMetadata(r),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var r=this.countryCallingCodes()[n];if(r)return r.length===1&&r[0].length===3?void 0:r}},{key:"getCountryCodeForCallingCode",value:function(n){var r=this.getCountryCodesForCallingCode(n);if(r)return r[0]}},{key:"getNumberingPlanMetadata",value:function(n){var r=this.getCountryCodeForCallingCode(n);if(r)return this.getCountryMetadata(r);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")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(n){return this.numberingPlan.type(n)}},{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(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}]),t}(),jf=function(){function t(e,n){va(this,t),this.globalMetadataObject=n,this.metadata=e,Am.call(this,n.metadata)}return ba(t,[{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(n){return n[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var n=this,r=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return r.map(function(i){return new Hb(i,n)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(n){return n[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()&&this.types().length===0?!1:!!this.types()}},{key:"type",value:function(n){if(this.hasTypes()&&Of(this.types(),n))return new Gb(Of(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?Cf:this.metadata[13]||Cf}}]),t}(),Hb=function(){function t(e,n){va(this,t),this._format=e,this.metadata=n}return ba(t,[{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()&&!Kb.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),Kb=/^\(?\$1\)?$/,Gb=function(){function t(e,n){va(this,t),this.type=e,this.metadata=n}return ba(t,[{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()}}]),t}();function Of(t,e){switch(e){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function Sm(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!dr(t)||!dr(t.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(dr(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+Wb(t)+": "+t,"."))}var Wb=function(e){return Sd(e)};function Hl(t,e){if(e=new Ge(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function Jb(t,e){return e.countries.hasOwnProperty(t)}function Am(t){var e=t.version;typeof e=="number"?(this.v1=e===1,this.v2=e===2,this.v3=e===3,this.v4=e===4):e?Nf(e,Db)===-1?this.v2=!0:Nf(e,Vb)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function Kl(t,e){return Xb(t,void 0,e)}function Xb(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=t.length,a=i[0];return a===o?"IS_POSSIBLE":a>o?"TOO_SHORT":i[i.length-1]<o?"TOO_LONG":i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function Zb(t,e,n){if(e===void 0&&(e={}),n=new Ge(n),e.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!n.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));n.country(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}}if(n.possibleLengths())return Em(t.phone||t.nationalNumber,n);if(t.countryCallingCode&&n.isNonGeographicCallingCode(t.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function Em(t,e){switch(Kl(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Jt(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function Yb(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=Qb(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
150
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qb(t,e){if(t){if(typeof t=="string")return Pf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pf(t,e)}}function Pf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var e3=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Gl(t,e,n){if(e=e||{},!(!t.country&&!t.countryCallingCode)){n=new Ge(n),n.selectNumberingPlan(t.country,t.countryCallingCode);var r=e.v2?t.nationalNumber:t.phone;if(Jt(r,n.nationalNumberPattern())){if(
|
|
151
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O3(t,e){if(t){if(typeof t=="string")return Tf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tf(t,e)}}function Tf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Rf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rf(Object(n),!0).forEach(function(r){P3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function P3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Lf={formatExtension:function(e,n,r){return"".concat(e).concat(r.ext()).concat(n)}};function T3(t,e,n,r){if(n?n=Bf(Bf({},Lf),n):n=Lf,r=new Ge(r),t.country&&t.country!=="001"){if(!r.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));r.country(t.country)}else if(t.countryCallingCode)r.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var i=r.countryCallingCode(),o=n.v2?t.nationalNumber:t.phone,a;switch(e){case"NATIONAL":return o?(a=
|
|
149
|
+
`,r}async function wv(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),o=new TextEncoder().encode(r);return tc(await s0(o))}const vv=1e3*60*60*24,bv=new s.OpenAPIHono().openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(ec)}},description:"List of keys"}}}),async t=>{const n=(await t.env.data.keys.list()).filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ec}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),r=(await t.env.data.keys.list()).find(i=>i.kid===e);if(!r)throw new A(404,{message:"Key not found"});return t.json(r)}).openapi(s.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const e=await t.env.data.keys.list();for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+vv).toISOString()});const n=await $d({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{kid:e}=t.req.valid("param");if(!await t.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new A(404,{message:"Key not found"});const r=await $d({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(r),t.text("OK")}),$v=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:s.z.object({email:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.array(Rd)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await Xd(t.env.data.users,e,n)).filter(o=>!o.linked_to);return t.json(i)}),xv=Xt.extend({clients:s.z.array(xn)}),kv=new s.OpenAPIHono().openapi(s.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([xv,s.z.array(xn)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),d=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a})).applications;return i?t.json({clients:d,start:0,limit:10,length:d.length}):t.json(d)}).openapi(s.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:xn}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=(await t.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(o=>o.id===n);if(!i)throw new A(404);return t.json(i)}).openapi(s.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.applications.remove(e,n))throw new A(404,{message:"Application not found"});return t.text("OK")}).openapi(s.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object($o.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:xn}},description:"The update application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=t.req.valid("json");await t.env.data.applications.update(e,n,i);const o=await t.env.data.applications.get(e,n);if(!o)throw new A(404,{message:"Application not found"});return t.json(o)}).openapi(s.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object($o.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.object(xn.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||xe(),client_secret:n.client_secret||xe()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()});_s.extend({email:s.z.string(),login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any());const Sv=Xt.extend({tenants:s.z.array(or)}),Av=new s.OpenAPIHono().openapi(s.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Vt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.union([s.z.array(or),Sv])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),a=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:Vn(i),q:o});return r?t.json(a):t.json(a.tenants)}).openapi(s.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:or}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new A(404);return t.json(n)}).openapi(s.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param");return await t.env.data.tenants.remove(e),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ko.shape).partial()}}},params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),n=t.req.valid("json");return await t.env.data.tenants.update(e,n),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ko.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:or}},description:"An tenant"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.tenants.create(e);return t.json(n,{status:201})}),Ev=Xt.extend({logs:s.z.array(Ao)}),zv=new s.OpenAPIHono().openapi(s.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Ao),Ev])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),c=await t.env.data.logs.list(a,{page:e,per_page:n,include_totals:r,sort:Vn(i),q:o});return r?t.json(c):t.json(c.logs)}).openapi(s.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ao}},description:"A log entry"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.logs.get(e,n);if(!r)throw new A(404);return t.json(r)}),Iv=Xt.extend({hooks:s.z.array(nr)}),Nv=new s.OpenAPIHono().openapi(s.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(nr),Iv])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),c=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a});return i?t.json(c):t.json(c.hooks)}).openapi(s.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Qi}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:nr}},description:"The created hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.hooks.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()}),body:{content:{"application/json":{schema:s.z.union([Qi.options[0].omit({hook_id:!0}).partial(),Qi.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:nr}},description:"The updated hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=t.req.valid("json");await t.env.data.hooks.update(e,n,r);const i=await t.env.data.hooks.get(e,n);if(!i)throw new A(404,{message:"Hook not found"});return t.json(i)}).openapi(s.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:nr}},description:"A hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=await t.env.data.hooks.get(e,n);if(!r)throw new A(404,{message:"Hook not found"});return t.json(r)}).openapi(s.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param");if(!await t.env.data.hooks.remove(e,n))throw new A(404,{message:"Hook not found"});return t.text("OK")}),Cv=Xt.extend({connections:s.z.array(rn)}),jv=new s.OpenAPIHono().openapi(s.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(rn),Cv])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),c=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a});return i?t.json(c):t.json(c.connections)}).openapi(s.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:rn}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.connections.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.connections.remove(e,n))throw new A(404,{message:"Connection not found"});return t.text("OK")}).openapi(s.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(xo.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:rn}},description:"The updated connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.connections.update(e,n,r))throw new A(404,{message:"Connection not found"});const o=await t.env.data.connections.get(e,n);if(!o)throw new A(404,{message:"Connection not found"});return t.json(o)}).openapi(s.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(xo.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:rn}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.connections.create(e,n);return t.json(r,{status:201})}),Ov=new s.OpenAPIHono().openapi(s.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:eo}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.promptSettings.get(e);return n?t.json(n):t.json(eo.parse({}))}).openapi(s.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(eo.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.promptSettings.get(e);return Object.assign(r,n),await t.env.data.promptSettings.set(e,r),t.json(r)});let yf=!1;function pm(t){t.use(async(e,n)=>(yf||(t.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),yf=!0),await n()))}s.z.object({alg:s.z.literal("RS256"),kty:s.z.literal("RSA"),use:s.z.literal("sig"),n:s.z.string(),e:s.z.string(),kid:s.z.string(),x5t:s.z.string(),x5c:s.z.array(s.z.string())});async function Pv(t){try{const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new A(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function Tv(t,e){const r=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),i=new Uint8Array(Array.from(e.signature).map(d=>d.charCodeAt(0))),a=(await Pv(t.env)).find(d=>d.kid===e.header.kid);if(!a)return console.log("No matching kid found"),!1;const c=await crypto.subtle.importKey("jwk",a,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",c,i,r)}function Rv(t){const[e,n,r]=t.split(".");if(!e||!n||!r)return null;const i=JSON.parse(atob(e)),o=JSON.parse(atob(n)),a=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return{header:i,payload:o,signature:a,raw:{header:e,payload:n,signature:r}}}function fm(t){return async(e,n)=>{var i,o,a;const r=t.openAPIRegistry.definitions.find(c=>"route"in c&&c.route.path===e.req.path&&c.route.method.toUpperCase()===e.req.method);if(r&&"route"in r){const c=(o=(i=r.route.security)==null?void 0:i[0])==null?void 0:o.Bearer;if(!(c!=null&&c.length))return await n();const d=e.req.header("authorization")||"",[l,u]=d.split(" ");if((l==null?void 0:l.toLowerCase())!=="bearer"||!u)throw new A(401,{message:"Missing bearer token"});const f=Rv(u);if(!f||!await Tv(e,f))throw new A(403,{message:"Invalid JWT signature"});e.set("user_id",f.payload.sub),e.set("user",f.payload);const m=f.payload.permissions||[],w=((a=f.payload.scope)==null?void 0:a.split(" "))||[];if(c.length&&!(c.some(h=>m.includes(h))||c.some(h=>w.includes(h))))throw new A(403,{message:"Unauthorized"})}return await n()}}const Bv=new s.OpenAPIHono().openapi(s.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:to}},description:"Email provider"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.emailProviders.get(e);if(!n)throw new A(404,{message:"Email provider not found"});return t.json(n)}).openapi(s.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(to.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.create(e,n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(to.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.update(e,n),t.text("OK")}),Lv=new s.OpenAPIHono().openapi(s.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bs}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.sessions.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.remove(e,n))throw new A(404,{message:"Session not found"});return t.text("OK")}).openapi(s.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.update(e,n,{revoked_at:new Date().toDateString()}))throw new A(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),Uv=new s.OpenAPIHono().openapi(s.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Vd}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.refreshTokens.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.refreshTokens.remove(e,n))throw new A(404,{message:"Session not found"});return t.text("OK")}),Mv=new s.OpenAPIHono().openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(nn)}},description:"List of custom domains"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.customDomains.list(e);return t.json(n)}).openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:nn}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.customDomains.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.customDomains.remove(e,n))throw new A(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(s.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(nn.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:nn}},description:"The updated custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.customDomains.update(e,n,r))throw new A(404);const o=await t.env.data.customDomains.get(e,n);if(!o)throw new A(404);return t.json(o)}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(Md.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:nn}},description:"The created custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.customDomains.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:nn}},description:"The custom domain"}}}),async()=>{throw new A(501,{message:"Not implemented"})});function Fl(t,e){const n={};for(const[r,i]of Object.entries(e)){const o={};for(const[a,c]of Object.entries(i))typeof c=="function"?o[a]=async(...d)=>{const l=performance.now();try{const u=await c(...d),m=performance.now()-l,w=t.res.headers.get("Server-Timing")||"",h=w?`${w}, ${r}-${a};dur=${m.toFixed(2)}`:`${r}-${a};dur=${m.toFixed(2)}`;return t.res.headers.set("Server-Timing",h),u}catch(u){const m=performance.now()-l,w=t.res.headers.get("Server-Timing")||"",h=w?`${w}, ${r}-${a}-error;dur=${m.toFixed(2)}`:`${r}-${a}-error;dur=${m.toFixed(2)}`;throw t.res.headers.set("Server-Timing",h),u}}:o[a]=c;n[r]=o}return n}async function Dl(t,e){const n=t.req.header("x-forwarded-host");if(n){const i=await t.env.data.customDomains.getByDomain(n);if(i)return t.set("tenant_id",i.tenant_id),t.set("custom_domain",n),await e()}const r=t.req.header("host");if(r){const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const o=i[0];await t.env.data.tenants.get(o)&&t.set("tenant_id",o)}}return await e()}const $n=class $n{constructor(){te(this,"cacheStore",new Map)}static getInstance(){return $n.instance||($n.instance=new $n),$n.instance}set(e,n,r){if(r<=0)return;const i=Date.now()+r;this.cacheStore.set(e,{value:n,expiresAt:i})}get(e){const n=this.cacheStore.get(e);if(n){if(Date.now()>n.expiresAt){this.cacheStore.delete(e);return}return n.value}}delete(e){this.cacheStore.delete(e)}getKeysByPrefix(e){return Array.from(this.cacheStore.keys()).filter(n=>n.startsWith(e))}clear(){this.cacheStore.clear()}};te($n,"instance");let xd=$n;function Fv(t,e,n){try{return`${t}:${e}:${JSON.stringify(n)}`}catch{return`${t}:${e}:${Date.now()}-${Math.random()}`}}function Vl(t,e){const n=e.cache||xd.getInstance(),r=e.defaultTtl,i=e.customTtls||{},o=new Set(e.excludeMethods||[]),a=e.maxItems||0,c=e.cacheEntities||[],d=c.length===0,l=new Set(c),u={};for(const[f,m]of Object.entries(t)){const w=d||l.has(f),h={};for(const[y,v]of Object.entries(m))if(typeof v=="function"){if(!w){h[y]=v;continue}const b=`${f}:${y}`;if(o.has(b)){h[y]=v;continue}const E=i[b]||r,C=["create","update","remove","delete","set","used"].includes(y);h[y]=async(...L)=>{if(C){const Se=await Promise.resolve(n.getKeysByPrefix(`${f}:`));for(const ze of Se)await Promise.resolve(n.delete(ze));return await v.apply(m,L)}const Y=Fv(f,y,L),se=await Promise.resolve(n.get(Y));if(se!==void 0)return se;const ae=await v.apply(m,L);if(await n.set(Y,ae,E),a>0){const Se=await Promise.resolve(n.getKeysByPrefix(""));if(Se.length>a){const ze=Se.slice(0,Se.length-a);for(const Ce of ze)await Promise.resolve(n.delete(Ce))}}return ae}}else h[y]=v;u[f]=h}return u}const Dv=Xt.extend({forms:s.z.array(tr)}),Vv=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Vt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(tr),Dv])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),c=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:Vn(o),q:a});return i?t.json(c):t.json(c.forms)}).openapi(s.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:tr}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.forms.get(e,n);if(!r)throw new A(404);return t.json(r)}).openapi(s.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.forms.remove(e,n))throw new A(404,{message:"Form not found"});return t.text("OK")}).openapi(s.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(So.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:tr}},description:"The updated form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.forms.update(e,n,r))throw new A(404,{message:"Form not found"});const o=await t.env.data.forms.get(e,n);if(!o)throw new A(404,{message:"Form not found"});return t.json(o)}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(So.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:tr}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.forms.create(e,n);return t.json(r,{status:201})});function qv(t){const e=new s.OpenAPIHono;e.use(bh({origin:r=>{var i;return r&&(i=t.allowedOrigins)!=null&&i.includes(r)?r:""},allowHeaders:["Tenant-Id","Content-Type","Content-Range","Auth0-Client","Authorization","Range","Upgrade-Insecure-Requests"],allowMethods:["POST","PUT","GET","DELETE","PATCH","OPTIONS"],exposeHeaders:["Content-Length","Content-Range"],maxAge:600,credentials:!0})),pm(e),e.use(async(r,i)=>{const o=As(r,t.dataAdapter),a=Vl(o,{defaultTtl:0,cacheEntities:["tenants","connections","clients"]});return r.env.data=Fl(r,a),i()}),e.use(Dl).use(fm(e));const n=e.route("/branding",f_).route("/custom-domains",Mv).route("/email/providers",Bv).route("/users",x2).route("/keys",bv).route("/users-by-email",$v).route("/clients",kv).route("/tenants",Av).route("/logs",zv).route("/hooks",Nv).route("/connections",jv).route("/prompts",Ov).route("/sessions",Lv).route("/refresh_tokens",Uv).route("/forms",Vv);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management API"},servers:[{url:"/api/v2",description:"API V2"}],security:[{oauth2:["openid","email","profile"]}]}),n}function Hv(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}var wf;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(wf||(wf={}));var vf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(vf||(vf={}));function Kv(t){return gm(t,Gv,fi.Include)}function hm(t){return gm(t,Wv,fi.None)}function gm(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let c=0;c<3&&i+c<t.byteLength;c++)o=o<<8|t[i+c],a+=8;for(let c=0;c<4;c++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===fi.Include&&(r+="=")}return r}const Gv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var fi;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(fi||(fi={}));var bf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(bf||(bf={}));class Jv{uint8(e,n){if(e.byteLength<n+1)throw new TypeError("Insufficient bytes");return e[n]}uint16(e,n){if(e.byteLength<n+2)throw new TypeError("Insufficient bytes");return e[n]<<8|e[n+1]}uint32(e,n){if(e.byteLength<n+4)throw new TypeError("Insufficient bytes");let r=0;for(let i=0;i<4;i++)r|=e[n+i]<<24-i*8;return r}uint64(e,n){if(e.byteLength<n+8)throw new TypeError("Insufficient bytes");let r=0n;for(let i=0;i<8;i++)r|=BigInt(e[n+i])<<BigInt(56-i*8);return r}putUint8(e,n,r){if(e.length<r+1)throw new TypeError("Not enough space");if(n<0||n>255)throw new TypeError("Invalid uint8 value");e[r]=n}putUint16(e,n,r){if(e.length<r+2)throw new TypeError("Not enough space");if(n<0||n>65535)throw new TypeError("Invalid uint16 value");e[r]=n>>8,e[r+1]=n&255}putUint32(e,n,r){if(e.length<r+4)throw new TypeError("Not enough space");if(n<0||n>4294967295)throw new TypeError("Invalid uint32 value");for(let i=0;i<4;i++)e[r+i]=n>>(3-i)*8&255}putUint64(e,n,r){if(e.length<r+8)throw new TypeError("Not enough space");if(n<0||n>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let i=0;i<8;i++)e[r+i]=Number(n>>BigInt((7-i)*8)&0xffn)}}const $f=new Jv;function At(t,e){return(t<<32-e|t>>>e)>>>0}function Xv(t){const e=new Zv;return e.update(t),e.digest()}class Zv{constructor(){te(this,"blockSize",64);te(this,"size",32);te(this,"blocks",new Uint8Array(64));te(this,"currentBlockSize",0);te(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));te(this,"l",0n);te(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let n=0;if(this.currentBlockSize>0){const r=e.slice(0,64-this.currentBlockSize);this.blocks.set(r,this.currentBlockSize),this.process(),n+=r.byteLength,this.currentBlockSize=0}for(;n+64<=e.byteLength;){const r=e.slice(n,n+64);this.blocks.set(r),this.process(),n+=64}if(e.byteLength-n>0){const r=e.slice(n);this.blocks.set(r),this.currentBlockSize=r.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),$f.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)$f.putUint32(e,this.H[n],n*4);return e}process(){for(let l=0;l<16;l++)this.w[l]=(this.blocks[l*4]<<24|this.blocks[l*4+1]<<16|this.blocks[l*4+2]<<8|this.blocks[l*4+3])>>>0;for(let l=16;l<64;l++){const u=(At(this.w[l-2],17)^At(this.w[l-2],19)^this.w[l-2]>>>10)>>>0,f=(At(this.w[l-15],7)^At(this.w[l-15],18)^this.w[l-15]>>>3)>>>0;this.w[l]=u+this.w[l-7]+f+this.w[l-16]|0}let e=this.H[0],n=this.H[1],r=this.H[2],i=this.H[3],o=this.H[4],a=this.H[5],c=this.H[6],d=this.H[7];for(let l=0;l<64;l++){const u=(At(o,6)^At(o,11)^At(o,25))>>>0,f=(o&a^~o&c)>>>0,m=d+u+f+Yv[l]+this.w[l]|0,w=(At(e,2)^At(e,13)^At(e,22))>>>0,h=(e&n^e&r^n&r)>>>0,y=w+h|0;d=c,c=a,a=o,o=i+m|0,i=r,r=n,n=e,e=m+y|0}this.H[0]=e+this.H[0]|0,this.H[1]=n+this.H[1]|0,this.H[2]=r+this.H[2]|0,this.H[3]=i+this.H[3]|0,this.H[4]=o+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=c+this.H[6]|0,this.H[7]=d+this.H[7]|0}}const Yv=new Uint32Array([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]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class Qv{constructor(e){te(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function eb(t){const e=Xv(new TextEncoder().encode(t));return hm(e)}function tb(){const t=new Uint8Array(32);return crypto.getRandomValues(t),hm(t)}function Jr(t,e){const n=new TextEncoder().encode(e.toString()),r=new Request(t,{method:"POST",body:n});return r.headers.set("Content-Type","application/x-www-form-urlencoded"),r.headers.set("Accept","application/json"),r.headers.set("User-Agent","arctic"),r.headers.set("Content-Length",n.byteLength.toString()),r}function Ua(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return Kv(n)}async function ds(t){let e;try{e=await fetch(t)}catch(n){throw new _m(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new ao(e.status)}if(typeof n!="object"||n===null)throw new cr(e.status,n);let r;try{r=mm(n)}catch{throw new cr(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new ao(e.status)}if(typeof n!="object"||n===null)throw new cr(e.status,n);return new Qv(n)}throw e.body!==null&&await e.body.cancel(),new ao(e.status)}async function nb(t){let e;try{e=await fetch(t)}catch(n){throw new _m(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new cr(e.status,null)}if(typeof n!="object"||n===null)throw new cr(e.status,n);let r;try{r=mm(n)}catch{throw new cr(e.status,n)}throw r}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new ao(e.status)}function mm(t){let e;if("error"in t&&typeof t.error=="string")e=t.error;else throw new Error("Invalid error response");let n=null,r=null,i=null;if("error_description"in t){if(typeof t.error_description!="string")throw new Error("Invalid data");n=t.error_description}if("error_uri"in t){if(typeof t.error_uri!="string")throw new Error("Invalid data");r=t.error_uri}if("state"in t){if(typeof t.state!="string")throw new Error("Invalid data");i=t.state}return new rb(e,n,r,i)}class _m extends Error{constructor(e){super("Failed to send request",{cause:e})}}class rb extends Error{constructor(n,r,i,o){super(`OAuth request error: ${n}`);te(this,"code");te(this,"description");te(this,"uri");te(this,"state");this.code=n,this.description=r,this.uri=i,this.state=o}}class ao extends Error{constructor(n){super("Unexpected error response");te(this,"status");this.status=n}}class cr extends Error{constructor(n,r){super("Unexpected error response body");te(this,"status");te(this,"data");this.status=n,this.data=r}}class ql{constructor(e,n,r){te(this,"clientId");te(this,"clientPassword");te(this,"redirectURI");this.clientId=e,this.clientPassword=n,this.redirectURI=r}createAuthorizationURL(e,n,r){const i=new URL(e);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&i.searchParams.set("redirect_uri",this.redirectURI),i.searchParams.set("state",n),r.length>0&&i.searchParams.set("scope",r.join(" ")),i}createAuthorizationURLWithPKCE(e,n,r,i,o){const a=new URL(e);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&a.searchParams.set("redirect_uri",this.redirectURI),a.searchParams.set("state",n),r===hi.S256){const c=eb(i);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",c)}else r===hi.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",i));return o.length>0&&a.searchParams.set("scope",o.join(" ")),a}async validateAuthorizationCode(e,n,r){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("code",n),this.redirectURI!==null&&i.set("redirect_uri",this.redirectURI),r!==null&&i.set("code_verifier",r),this.clientPassword===null&&i.set("client_id",this.clientId);const o=Jr(e,i);if(this.clientPassword!==null){const c=Ua(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${c}`)}return await ds(o)}async refreshAccessToken(e,n,r){const i=new URLSearchParams;i.set("grant_type","refresh_token"),i.set("refresh_token",n),this.clientPassword===null&&i.set("client_id",this.clientId),r.length>0&&i.set("scope",r.join(" "));const o=Jr(e,i);if(this.clientPassword!==null){const c=Ua(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${c}`)}return await ds(o)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=Jr(e,r);if(this.clientPassword!==null){const o=Ua(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${o}`)}await nb(i)}}var hi;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(hi||(hi={}));var xf;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(xf||(xf={}));var kf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(kf||(kf={}));function Xr(t){return ib(t,ob,ls.None)}function ib(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let c=0;c<3&&i+c<t.byteLength;c++)o=o<<8|t[i+c],a+=8;for(let c=0;c<4;c++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===ls.Include&&(r+="=")}return r}const ob="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var ls;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(ls||(ls={}));var Sf;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Sf||(Sf={}));function sb(t,e,n){const r=Xr(new TextEncoder().encode(t)),i=Xr(new TextEncoder().encode(e)),o=Xr(n);return r+"."+i+"."+o}function ab(t,e){const n=Xr(new TextEncoder().encode(t)),r=Xr(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const cb="https://appleid.apple.com/auth/authorize",db="https://appleid.apple.com/auth/token";class ym{constructor(e,n,r,i,o){te(this,"clientId");te(this,"teamId");te(this,"keyId");te(this,"pkcs8PrivateKey");te(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=o}createAuthorizationURL(e,n){const r=new URL(cb);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId);const r=await this.createClientSecret();n.set("client_secret",r);const i=Jr(db,n);return await ds(i)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),n=Math.floor(Date.now()/1e3),r=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),i=JSON.stringify({iss:this.teamId,exp:n+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:n}),o=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,ab(r,i)));return sb(r,i,o)}}const lb="https://www.facebook.com/v16.0/dialog/oauth",ub="https://graph.facebook.com/v16.0/oauth/access_token";class wm{constructor(e,n,r){te(this,"clientId");te(this,"clientSecret");te(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(lb);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId),n.set("client_secret",this.clientSecret);const r=Jr(ub,n);return await ds(r)}}const pb="https://accounts.google.com/o/oauth2/v2/auth",Af="https://oauth2.googleapis.com/token",fb="https://oauth2.googleapis.com/revoke";let vm=class{constructor(e,n,r){te(this,"client");this.client=new ql(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(pb,e,hi.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(Af,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(Af,e,[])}async revokeToken(e){await this.client.revokeToken(fb,e)}};const _a=s.z.object({iss:s.z.string().url(),sub:s.z.string(),aud:s.z.string(),exp:s.z.number(),email:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),name:s.z.string().optional(),iat:s.z.number(),auth_time:s.z.number().optional(),nonce:s.z.string().optional(),acr:s.z.string().optional(),amr:s.z.array(s.z.string()).optional(),azp:s.z.string().optional(),at_hash:s.z.string().optional(),c_hash:s.z.string().optional()}).passthrough();_a.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function hb(t){return t.ISSUER}function dt(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function Pe(t){return t.OAUTH_API_URL||t.ISSUER}function bm(t){const{options:e}=t;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const n=Buffer.from(e.app_secret,"utf-8"),r=n.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),i=Uint8Array.from(Buffer.from(r,"base64"));return n.fill(0),{options:e,keyArray:i}}async function gb(t,e){var d,l;const{options:n,keyArray:r}=bm(e),i=new ym(n.client_id,n.team_id,n.kid,r,`${Pe(t.env)}callback`),o=xe(),a=await i.createAuthorizationURL(o,((d=n.scope)==null?void 0:d.split(" "))||["name","email"]);return(((l=n.scope)==null?void 0:l.split(" "))||["name","email"]).some(u=>["email","name"].includes(u))&&a.searchParams.set("response_mode","form_post"),{redirectUrl:a.href,code:o}}async function mb(t,e,n){const{options:r,keyArray:i}=bm(e),a=await new ym(r.client_id,r.team_id,r.kid,i,`${Pe(t.env)}callback`).validateAuthorizationCode(n),c=Hd(a.idToken());if(!c)throw new Error("Invalid ID token");const d=_a.parse(c.payload);return{sub:d.sub,email:d.email,given_name:d.given_name,family_name:d.family_name,name:d.name,picture:d.picture,locale:d.locale}}const _b=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:gb,validateAuthorizationCodeAndGetUser:mb},Symbol.toStringTag,{value:"Module"}));async function yb(t,e){var a;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new wm(n.client_id,n.client_secret,`${Pe(t.env)}callback`),i=xe();return{redirectUrl:r.createAuthorizationURL(i,((a=n.scope)==null?void 0:a.split(" "))||["email"]).href,code:i}}async function wb(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new wm(r.client_id,r.client_secret,`${Pe(t.env)}callback`).validateAuthorizationCode(n),a=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${o.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const c=await a.json();return t.set("log",`Userinfo: ${JSON.stringify(c)}`),{sub:c.id,email:c.email,name:c.name}}const vb=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:yb,validateAuthorizationCodeAndGetUser:wb},Symbol.toStringTag,{value:"Module"}));async function bb(t,e){var c;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=new vm(n.client_id,n.client_secret,`${Pe(t.env)}callback`),i=xe(),o=tb();return{redirectUrl:r.createAuthorizationURL(i,o,((c=n.scope)==null?void 0:c.split(" "))??["email","profile"]).href,code:i,codeVerifier:o}}async function $b(t,e,n,r){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret||!r)throw new Error("Missing required authentication parameters");const a=await new vm(i.client_id,i.client_secret,`${Pe(t.env)}callback`).validateAuthorizationCode(n,r),c=Hd(a.idToken());if(!c)throw new Error("Invalid ID token");const d=_a.parse(c.payload);return{sub:d.sub,email:d.email,given_name:d.given_name,family_name:d.family_name,name:d.name,picture:d.picture,locale:d.locale}}const xb=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:bb,validateAuthorizationCodeAndGetUser:$b},Symbol.toStringTag,{value:"Module"}));async function kb(t,e){var a;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new ql(n.client_id,n.client_secret,`${Pe(t.env)}callback`),i=xe(),o=r.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",i,((a=n.scope)==null?void 0:a.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return o.searchParams.set("response_type","code"),o.searchParams.set("response_mode","query"),{redirectUrl:o.href,code:i}}async function Sb(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new ql(r.client_id,r.client_secret,`${Pe(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),a=Hd(o.idToken());if(!a)throw new Error("Invalid ID token");const c=_a.parse(a.payload);if(typeof c.msn!="string")throw new Error("msn not available in id token");const d=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${o.accessToken()}`,"Merchant-Serial-Number":c.msn}});if(!d.ok)throw new A(400,{message:"Failed to get user from vipps"});return await d.json()}const Ab=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:kb,validateAuthorizationCodeAndGetUser:Sb},Symbol.toStringTag,{value:"Module"}));function $m(t,e){const n=t.env.STRATEGIES||{},i={apple:_b,facebook:vb,"google-oauth2":xb,vipps:Ab,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function Ui(t,e){const n=await t.data.clients.get(e);if(!n)throw new A(403,{message:"Client not found"});const r=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,i=await t.data.connections.list(n.tenant.id),o=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},a=i.connections.map(c=>{var u;const d=(u=o.connections)==null?void 0:u.find(f=>f.name===c.name);if(!(d!=null&&d.options))return c;const l=rn.parse({...d||{},...c});return l.options=Ud.passthrough().parse({...d.options||{},...c.options}),l}).filter(c=>c);return{...n,web_origins:[...(r==null?void 0:r.web_origins)||[],...n.web_origins||[],`${dt(t)}login`],allowed_logout_urls:[...(r==null?void 0:r.allowed_logout_urls)||[],...n.allowed_logout_urls||[],t.ISSUER],callbacks:[...(r==null?void 0:r.callbacks)||[],...n.callbacks||[],`${dt(t)}info`],connections:a,tenant:{...(r==null?void 0:r.tenant)||{},...n.tenant}}}async function Eb(t,e,n,r){if(!r.state)throw new A(400,{message:"State not found"});const i=e.connections.find(d=>d.name===n);if(!i){t.set("client_id",e.id);const d=we(t,{type:he.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,d),new A(403,{message:"Connection Not Found"})}let o=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!o){const{ip:d,useragent:l,auth0Client:u}=jt(t.req);o=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:r,csrf_token:xe(),ip:d,useragent:l,auth0Client:u})}const c=await $m(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:o.id,code_id:c.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:c.codeVerifier,expires_at:new Date(Date.now()+L_*1e3).toISOString()}),t.redirect(c.redirectUrl)}async function Ef(t,{code:e,state:n}){var h;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new A(403,{message:"State not found"});const o=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!o)throw new A(403,{message:"Session not found"});if(o.authorization_url){const y=new URL(o.authorization_url).hostname,v=t.var.custom_domain||t.req.header("host")||"";if(y!==v&&y){const b=new URL(`https://${y}/callback`);return b.searchParams.set("state",n),b.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:b.toString()}})}}const a=await Ui(r,o.authParams.client_id);t.set("client_id",a.id),t.set("tenant_id",a.tenant.id);const c=a.connections.find(y=>y.id===i.connection_id);if(!c){const y=we(t,{type:he.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(a.tenant.id,y),new A(403,{message:"Connection not found"})}if(t.set("connection",c.name),!o.authParams.redirect_uri){const y=we(t,{type:he.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(a.tenant.id,y),new A(403,{message:"Redirect URI not defined"})}const l=await $m(t,c.strategy).validateAuthorizationCodeAndGetUser(t,c,e,i.code_verifier),{sub:u,...f}=l;t.set("user_id",u);const m=((h=l.email)==null?void 0:h.toLocaleLowerCase())||`${c.name}.${u}@${new URL(t.env.ISSUER).hostname}`;t.set("username",m);const w=await Es(t,{client:a,username:m,provider:c.strategy,connection:c.name,userId:u,profileData:f,isSocial:!0,ip:t.req.header("x-real-ip")});return Zt(t,{client:a,authParams:o.authParams,loginSession:o,user:w})}async function zf(t,e,n,r,i,o){const a=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!a)throw new A(400,{message:"State not found"});const c=await t.env.data.loginSessions.get(t.var.tenant_id,a.login_id);if(!c)throw new A(400,{message:"Login not found"});const{redirect_uri:d}=c.authParams;if(!d)throw new A(400,{message:"Redirect uri not found"});const l=we(t,{type:he.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});It(t,t.env.data.logs.create(t.var.tenant_id,l));const u=new URL(d);return Hv(u,{error:n,error_description:r,error_reason:o,error_code:i,state:c.authParams.state}),t.redirect(`${dt(t.env)}login/identifier?state=${c.id}&error=${n}`)}const zb=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("query");if(r)return zf(t,e,r,i,o,a);if(!n)throw new A(400,{message:"Code is required"});const c=await Ef(t,{code:n,state:e});if(!(c instanceof Response))throw new A(500,{message:"Internal server error"});return c}).openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("form");if(r)return zf(t,e,r,i,o,a);if(!n)throw new A(400,{message:"Code is required"});const c=await Ef(t,{code:n,state:e});if(!(c instanceof Response))throw new A(500,{message:"Internal server error"});return c});function xm(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return Ib(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function Ib(t,e,n){if(t.protocol!==e.protocol)return!1;if(n&&e.pathname.includes("*")){const r=e.pathname.replace(/\*/g,".*").replace(/\//g,"\\/");if(!new RegExp(`^${r}$`).test(t.pathname))return!1}else if(t.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const r=e.hostname.split(".").slice(1).join(".");return t.hostname.endsWith(r)}return t.hostname===e.hostname}const Nb=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),returnTo:s.z.string().optional()}),header:s.z.object({cookie:s.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async t=>{const{client_id:e,returnTo:n}=t.req.valid("query"),r=await t.env.data.clients.get(e);if(!r)return t.text("OK");const i=await t.env.data.clients.get("DEFAULT_CLIENT");t.set("client_id",e),t.set("tenant_id",r.tenant.id);const o=n||t.req.header("referer");if(!o)return t.text("OK");if(!xm(o,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new A(400,{message:"Invalid redirect uri"});const a=t.req.header("cookie");if(a){const d=zo(r.tenant.id,a);if(d){const l=await t.env.data.sessions.get(r.tenant.id,d);if(l){const u=await t.env.data.users.get(r.tenant.id,l.user_id);u&&(t.set("user_id",u.user_id),t.set("connection",u.connection));const f=await t.env.data.refreshTokens.list(r.tenant.id,{q:`session_id=${d}`,page:0,per_page:100,include_totals:!1});await Promise.all(f.refresh_tokens.map(m=>t.env.data.refreshTokens.remove(r.tenant.id,m.id))),await t.env.data.sessions.update(r.tenant.id,d,{revoked_at:new Date().toISOString()})}}}const c=we(t,{type:he.SUCCESS_LOGOUT,description:"User successfully logged out"});return await t.env.data.logs.create(r.tenant.id,c),new Response("Redirecting",{status:302,headers:{"set-cookie":V_(r.tenant.id,t.req.header("host")),location:o}})}),If=s.z.object({sub:s.z.string(),email:s.z.string().optional(),family_name:s.z.string().optional(),given_name:s.z.string().optional(),email_verified:s.z.boolean()}),Cb=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:If}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new A(404,{message:"User not found"});const e=await t.env.data.users.get(t.var.user.tenant_id,t.var.user.sub);if(!e)throw new A(404,{message:"User not found"});return t.json(If.parse({...e,sub:e.user_id}))}),jb=new s.OpenAPIHono().openapi(s.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:Kh}},description:"List of tenants"}}}),async t=>{const e=await t.env.data.keys.list(),n=await Promise.all(e.map(async r=>{const o=await new Ml(r.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",o);return Fd.parse({...a,kid:r.kid})}));return t.json({keys:n},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Gi}, stale-while-revalidate=${Gi*2}, stale-if-error=86400`}})}).openapi(s.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:Qa}},description:"List of tenants"}}}),async t=>{const e=Qa.parse({issuer:hb(t.env),authorization_endpoint:`${Pe(t.env)}authorize`,token_endpoint:`${Pe(t.env)}oauth/token`,device_authorization_endpoint:`${Pe(t.env)}oauth/device/code`,userinfo_endpoint:`${Pe(t.env)}userinfo`,mfa_challenge_endpoint:`${Pe(t.env)}mfa/challenge`,jwks_uri:`${Pe(t.env)}.well-known/jwks.json`,registration_endpoint:`${Pe(t.env)}oidc/register`,revocation_endpoint:`${Pe(t.env)}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return t.json(e,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Gi}, stale-while-revalidate=${Gi*2}, stale-if-error=86400`}})});function co(t,e){if(!t||!e||t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t.charCodeAt(r)^e.charCodeAt(r);return n===0}const km=s.z.object({grant_type:s.z.literal("client_credentials"),scope:s.z.string().optional(),client_secret:s.z.string(),client_id:s.z.string(),audience:s.z.string().optional()});async function Ob(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new A(403,{message:"Invalid client credentials"});if(n.client_secret&&!co(n.client_secret,e.client_secret))throw new A(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience},i=await Ss(t,{authParams:r,client:n});return t.json(i)}const Pb=s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string().optional(),client_secret:s.z.string().optional(),code_verifier:s.z.string().optional()}).refine(t=>"client_secret"in t&&!("code_verifier"in t)||!("client_secret"in t)&&"code_verifier"in t,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function Tb(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new A(403,{message:"Client not found"});const r=await t.env.data.codes.get(n.tenant.id,e.code,"authorization_code");if(!r||!r.user_id)throw new A(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new A(403,{message:"Code expired"});if(r.used_at)throw new A(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new A(403,{message:"Invalid login"});if("client_secret"in e){const a=await t.env.data.clients.get("DEFAULT_CLIENT");if(!co(n.client_secret,e.client_secret)&&!co(a==null?void 0:a.client_secret,e.client_secret))throw new A(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const a=await P_(e.code_verifier,r.code_challenge_method);if(!co(a,r.code_challenge))throw new A(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new A(403,{message:"Invalid redirect uri"});const o=await t.env.data.users.get(n.tenant.id,r.user_id);if(!o)throw new A(403,{message:"User not found"});return await t.env.data.codes.used(n.tenant.id,e.code),Zt(t,{user:o,client:n,loginSession:i,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:Dt.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}})}const Rb=s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),redirect_uri:s.z.string().optional(),refresh_token:s.z.string()});async function Bb(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new A(403,{message:"Client not found"});const r=await t.env.data.refreshTokens.get(n.tenant.id,e.refresh_token);if(r){if(r.expires_at&&new Date(r.expires_at)<new Date||r.idle_expires_at&&new Date(r.idle_expires_at)<new Date)throw new A(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new A(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Invalid refresh token"})});const i=await t.env.data.users.get(n.tenant.id,r.user_id);if(!i)throw new A(403,{message:"User not found"});const o=r.resource_servers[0];if(r.idle_expires_at){const a=new Date(Date.now()+2592e6);await t.env.data.refreshTokens.update(n.tenant.id,r.id,{idle_expires_at:a.toISOString(),last_exchanged_at:new Date().toISOString(),device:{...r.device,last_ip:t.req.header["x-real-ip"]||"",last_user_agent:t.req.header["user-agent"]||""}})}return Zt(t,{user:i,client:n,refreshToken:r.id,sessionId:r.session_id,authParams:{client_id:n.id,audience:o==null?void 0:o.audience,scope:o==null?void 0:o.scopes,response_mode:Dt.WEB_MESSAGE}})}const Lb={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(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|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]|2[23]"],"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","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?: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))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\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)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|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-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\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-9]\\d{9}|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])|9(?:0[25]|42))[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(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[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]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\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{2})(\\d{4})","$1 $2 $3",["2"],"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"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"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,12],[["(\\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[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|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(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"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])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($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,10,11,12],[["(\\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",["(?:19|[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[0-35])|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-3]))|(?: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|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|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|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"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))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\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","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{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]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\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,12],[["(\\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}",[6,7,8,9,10,11]],["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]],["3[2-8]\\d{9,10}",[11,12]],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",["[36]0|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",["3"],"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-467]|5[0-3]|8[0-7]))\\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|7090)\\d{5}|(?: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))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\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",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"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|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"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]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,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","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\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","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],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|8\\d\\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[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"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[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|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]","(?:[2489]\\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,12],[["(\\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]|7[67]|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d|90)\\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-9]"]]]],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|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],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(?:[1245]|3[12])"]],["(\\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,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-468]))\\d{4}|(?:2742|305[3-9]|472[247-9]|505[2-57-9]|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-47-9]|1[02-9]|2[0135-79]|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[0-247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|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}"],0,0,0,["305209\\d{4}"]]],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-9]\\d)\\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,12],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|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\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","7093\\d{5}|(?: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])|7093[5-7])\\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|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"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}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],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,["348[57]\\d{7}",[11]],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}"]]]}};function Ub(t,e){var n=Array.prototype.slice.call(e);return n.push(Lb),t.apply(this,n)}function Nf(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var o=Number(n[i]),a=Number(r[i]);if(o>a)return 1;if(a>o)return-1;if(!isNaN(o)&&isNaN(a))return 1;if(isNaN(o)&&!isNaN(a))return-1}return t[1]&&e[1]?t[1]>e[1]?1:t[1]<e[1]?-1:0:!t[1]&&e[1]?1:t[1]&&!e[1]?-1:0}var Mb={}.constructor;function dr(t){return t!=null&&t.constructor===Mb}function kd(t){"@babel/helpers - typeof";return kd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kd(t)}function ya(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fb(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function wa(t,e,n){return e&&Fb(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Db="1.2.0",Vb="1.7.35",Cf=" ext. ",qb=/^\d+$/,Ge=function(){function t(e){ya(this,t),Sm(e),this.metadata=e,Am.call(this,e)}return wa(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(n){return n!=="001"})}},{key:"getCountryMetadata",value:function(n){return this.metadata.countries[n]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(n){return this.getCountryMetadata(n)!==void 0}},{key:"hasCallingCode",value:function(n){if(this.getCountryCodesForCallingCode(n))return!0;if(this.nonGeographic()){if(this.nonGeographic()[n])return!0}else{var r=this.countryCallingCodes()[n];if(r&&r.length===1&&r[0]==="001")return!0}}},{key:"isNonGeographicCallingCode",value:function(n){return this.nonGeographic()?!!this.nonGeographic()[n]:!this.getCountryCodesForCallingCode(n)}},{key:"country",value:function(n){return this.selectNumberingPlan(n)}},{key:"selectNumberingPlan",value:function(n,r){if(n&&qb.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new jf(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new jf(this.getNumberingPlanMetadata(r),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var r=this.countryCallingCodes()[n];if(r)return r.length===1&&r[0].length===3?void 0:r}},{key:"getCountryCodeForCallingCode",value:function(n){var r=this.getCountryCodesForCallingCode(n);if(r)return r[0]}},{key:"getNumberingPlanMetadata",value:function(n){var r=this.getCountryCodeForCallingCode(n);if(r)return this.getCountryMetadata(r);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")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(n){return this.numberingPlan.type(n)}},{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(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}]),t}(),jf=function(){function t(e,n){ya(this,t),this.globalMetadataObject=n,this.metadata=e,Am.call(this,n.metadata)}return wa(t,[{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(n){return n[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var n=this,r=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return r.map(function(i){return new Hb(i,n)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(n){return n[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()&&this.types().length===0?!1:!!this.types()}},{key:"type",value:function(n){if(this.hasTypes()&&Of(this.types(),n))return new Gb(Of(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?Cf:this.metadata[13]||Cf}}]),t}(),Hb=function(){function t(e,n){ya(this,t),this._format=e,this.metadata=n}return wa(t,[{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()&&!Kb.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),Kb=/^\(?\$1\)?$/,Gb=function(){function t(e,n){ya(this,t),this.type=e,this.metadata=n}return wa(t,[{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()}}]),t}();function Of(t,e){switch(e){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function Sm(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!dr(t)||!dr(t.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(dr(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+Wb(t)+": "+t,"."))}var Wb=function(e){return kd(e)};function Hl(t,e){if(e=new Ge(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function Jb(t,e){return e.countries.hasOwnProperty(t)}function Am(t){var e=t.version;typeof e=="number"?(this.v1=e===1,this.v2=e===2,this.v3=e===3,this.v4=e===4):e?Nf(e,Db)===-1?this.v2=!0:Nf(e,Vb)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function Kl(t,e){return Xb(t,void 0,e)}function Xb(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=t.length,a=i[0];return a===o?"IS_POSSIBLE":a>o?"TOO_SHORT":i[i.length-1]<o?"TOO_LONG":i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function Zb(t,e,n){if(e===void 0&&(e={}),n=new Ge(n),e.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!n.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));n.country(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}}if(n.possibleLengths())return Em(t.phone||t.nationalNumber,n);if(t.countryCallingCode&&n.isNonGeographicCallingCode(t.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function Em(t,e){switch(Kl(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Jt(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function Yb(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=Qb(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
150
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qb(t,e){if(t){if(typeof t=="string")return Pf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pf(t,e)}}function Pf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var e3=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Gl(t,e,n){if(e=e||{},!(!t.country&&!t.countryCallingCode)){n=new Ge(n),n.selectNumberingPlan(t.country,t.countryCallingCode);var r=e.v2?t.nationalNumber:t.phone;if(Jt(r,n.nationalNumberPattern())){if(Ma(r,"FIXED_LINE",n))return n.type("MOBILE")&&n.type("MOBILE").pattern()===""||!n.type("MOBILE")||Ma(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var i=Yb(e3),o;!(o=i()).done;){var a=o.value;if(Ma(r,a,n))return a}}}}function Ma(t,e,n){return e=n.type(e),!e||!e.pattern()||e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0?!1:Jt(t,e.pattern())}function t3(t,e,n){if(e=e||{},n=new Ge(n),n.selectNumberingPlan(t.country,t.countryCallingCode),n.hasTypes())return Gl(t,e,n.metadata)!==void 0;var r=e.v2?t.nationalNumber:t.phone;return Jt(r,n.nationalNumberPattern())}function n3(t,e,n){var r=new Ge(n),i=r.getCountryCodesForCallingCode(t);return i?i.filter(function(o){return r3(e,o,n)}):[]}function r3(t,e,n){var r=new Ge(n);return r.selectNumberingPlan(e),r.numberingPlan.possibleLengths().indexOf(t.length)>=0}var Wl=2,i3=17,o3=3,vt="0-90-9٠-٩۰-۹",s3="-‐-―−ー-",a3="//",c3="..",d3=" ",l3="()()[]\\[\\]",u3="~⁓∼~",us="".concat(s3).concat(a3).concat(c3).concat(d3).concat(l3).concat(u3),Jl="++",p3=new RegExp("(["+vt+"])");function f3(t,e,n,r){if(e){var i=new Ge(r);i.selectNumberingPlan(e,n);var o=new RegExp(i.IDDPrefix());if(t.search(o)===0){t=t.slice(t.match(o)[0].length);var a=t.match(p3);if(!(a&&a[1]!=null&&a[1].length>0&&a[1]==="0"))return t}}}function h3(t,e){if(t&&e.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+e.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(t);if(r){var i,o,a=r.length-1,c=a>0&&r[a];if(e.nationalPrefixTransformRule()&&c)i=t.replace(n,e.nationalPrefixTransformRule()),a>1&&(o=r[1]);else{var d=r[0];i=t.slice(d.length),c&&(o=r[1])}var l;if(c){var u=t.indexOf(r[1]),f=t.slice(0,u);f===e.numberingPlan.nationalPrefix()&&(l=e.numberingPlan.nationalPrefix())}else l=r[0];return{nationalNumber:i,nationalPrefix:l,carrierCode:o}}}return{nationalNumber:t}}function Sd(t,e){var n=h3(t,e),r=n.carrierCode,i=n.nationalNumber;if(i!==t){if(!g3(t,i,e))return{nationalNumber:t};if(e.possibleLengths()&&!m3(i,e))return{nationalNumber:t}}return{nationalNumber:i,carrierCode:r}}function g3(t,e,n){return!(Jt(t,n.nationalNumberPattern())&&!Jt(e,n.nationalNumberPattern()))}function m3(t,e){switch(Kl(t,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function _3(t,e,n,r){var i=e?Hl(e,r):n;if(t.indexOf(i)===0){r=new Ge(r),r.selectNumberingPlan(e,n);var o=t.slice(i.length),a=Sd(o,r),c=a.nationalNumber,d=Sd(t,r),l=d.nationalNumber;if(!Jt(l,r.nationalNumberPattern())&&Jt(c,r.nationalNumberPattern())||Kl(l,r)==="TOO_LONG")return{countryCallingCode:i,number:o}}return{number:t}}function zm(t,e,n,r){if(!t)return{};var i;if(t[0]!=="+"){var o=f3(t,e,n,r);if(o&&o!==t)i=!0,t="+"+o;else{if(e||n){var a=_3(t,e,n,r),c=a.countryCallingCode,d=a.number;if(c)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:c,number:d}}return{number:t}}}if(t[1]==="0")return{};r=new Ge(r);for(var l=2;l-1<=o3&&l<=t.length;){var u=t.slice(1,l);if(r.hasCallingCode(u))return r.selectNumberingPlan(u),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:u,number:t.slice(l)};l++}return{}}function y3(t){return t.replace(new RegExp("[".concat(us,"]+"),"g")," ").trim()}var w3=/(\$\d)/;function v3(t,e,n){var r=n.useInternationalFormat,i=n.withNationalPrefix,o=t.replace(new RegExp(e.pattern()),r?e.internationalFormat():i&&e.nationalPrefixFormattingRule()?e.format().replace(w3,e.nationalPrefixFormattingRule()):e.format());return r?y3(o):o}var b3=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function $3(t,e,n){var r=new Ge(n);if(r.selectNumberingPlan(t,e),r.defaultIDDPrefix())return r.defaultIDDPrefix();if(b3.test(r.IDDPrefix()))return r.IDDPrefix()}var x3=";ext=",Zn=function(e){return"([".concat(vt,"]{1,").concat(e,"})")};function Im(t){var e="20",n="15",r="9",i="6",o="[ \\t,]*",a="[:\\..]?[ \\t,-]*",c="#?",d="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",l="(?:[xx##~~]|int|int)",u="[- ]+",f="[ \\t]*",m="(?:,{2}|;)",w=x3+Zn(e),h=o+d+a+Zn(e)+c,y=o+l+a+Zn(r)+c,v=u+Zn(i)+"#",b=f+m+a+Zn(n)+c,E=f+"(?:,)+"+a+Zn(r)+c;return w+"|"+h+"|"+y+"|"+v+"|"+b+"|"+E}var k3="["+vt+"]{"+Wl+"}",S3="["+Jl+"]{0,1}(?:["+us+"]*["+vt+"]){3,}["+us+vt+"]*",A3=new RegExp("^["+Jl+"]{0,1}(?:["+us+"]*["+vt+"]){1,2}$","i"),E3=S3+"(?:"+Im()+")?",z3=new RegExp("^"+k3+"$|^"+E3+"$","i");function I3(t){return t.length>=Wl&&z3.test(t)}function N3(t){return A3.test(t)}function C3(t){var e=t.number,n=t.ext;if(!e)return"";if(e[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(e).concat(n?";ext="+n:"")}function j3(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=O3(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
151
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O3(t,e){if(t){if(typeof t=="string")return Tf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tf(t,e)}}function Tf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Rf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rf(Object(n),!0).forEach(function(r){P3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function P3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Lf={formatExtension:function(e,n,r){return"".concat(e).concat(r.ext()).concat(n)}};function T3(t,e,n,r){if(n?n=Bf(Bf({},Lf),n):n=Lf,r=new Ge(r),t.country&&t.country!=="001"){if(!r.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));r.country(t.country)}else if(t.countryCallingCode)r.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var i=r.countryCallingCode(),o=n.v2?t.nationalNumber:t.phone,a;switch(e){case"NATIONAL":return o?(a=ps(o,t.carrierCode,"NATIONAL",r,n),Fa(a,t.ext,r,n.formatExtension)):"";case"INTERNATIONAL":return o?(a=ps(o,null,"INTERNATIONAL",r,n),a="+".concat(i," ").concat(a),Fa(a,t.ext,r,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(o);case"RFC3966":return C3({number:"+".concat(i).concat(o),ext:t.ext});case"IDD":if(!n.fromCountry)return;var c=B3(o,t.carrierCode,i,n.fromCountry,r);return Fa(c,t.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(e,'"'))}}function ps(t,e,n,r,i){var o=R3(r.formats(),t);return o?v3(t,o,{useInternationalFormat:n==="INTERNATIONAL",withNationalPrefix:!(o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&i&&i.nationalPrefix===!1),carrierCode:e,metadata:r}):t}function R3(t,e){for(var n=j3(t),r;!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var o=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(e.search(o)!==0)continue}if(Jt(e,i.pattern()))return i}}function Fa(t,e,n,r){return e?r(t,e,n):t}function B3(t,e,n,r,i){var o=Hl(r,i.metadata);if(o===n){var a=ps(t,e,"NATIONAL",i);return n==="1"?n+" "+a:a}var c=$3(r,void 0,i.metadata);if(c)return"".concat(c," ").concat(n," ").concat(ps(t,null,"INTERNATIONAL",i))}function Uf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Mf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Uf(Object(n),!0).forEach(function(r){L3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Uf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function L3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M3(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function F3(t,e,n){return e&&M3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var D3=function(){function t(e,n,r){if(U3(this,t),!e)throw new TypeError("First argument is required");if(typeof e!="string")throw new TypeError("First argument must be a string");if(typeof e=="string"){if(e[0]==="+"&&!n)throw new TypeError("`metadata` argument not passed");if(dr(n)&&dr(n.countries)){r=n;var i=e;if(!H3.test(i))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var o=zm(i,void 0,void 0,r),a=o.countryCallingCode,c=o.number;if(n=c,e=a,!n)throw new Error("Invalid `number` argument passed: too short")}}if(!n)throw new TypeError("`nationalNumber` argument is required");if(typeof n!="string")throw new TypeError("`nationalNumber` argument must be a string");Sm(r);var d=q3(e,r),l=d.country,u=d.countryCallingCode;this.country=l,this.countryCallingCode=u,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return F3(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:n3(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return Zb(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return t3(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new Ge(this.getMetadata());return n.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(n){return this.number===n.number&&this.ext===n.ext}},{key:"getType",value:function(){return Gl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,r){return T3(this,n,r?Mf(Mf({},r),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(n){return this.format("NATIONAL",n)}},{key:"formatInternational",value:function(n){return this.format("INTERNATIONAL",n)}},{key:"getURI",value:function(n){return this.format("RFC3966",n)}}]),t}(),V3=function(e){return/^[A-Z]{2}$/.test(e)};function q3(t,e){var n,r,i=new Ge(e);return V3(t)?(n=t,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=t,{country:n,countryCallingCode:r}}var H3=/^\+\d+$/;function Ad(t){"@babel/helpers - typeof";return Ad=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ad(t)}function K3(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}function G3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W3(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gi(t,e)}function J3(t){var e=Cm();return function(){var r=mi(t),i;if(e){var o=mi(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return X3(this,i)}}function X3(t,e){if(e&&(Ad(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nm(t)}function Nm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ed(t){var e=typeof Map=="function"?new Map:void 0;return Ed=function(r){if(r===null||!Z3(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return lo(r,arguments,mi(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),gi(i,r)},Ed(t)}function lo(t,e,n){return Cm()?lo=Reflect.construct:lo=function(i,o,a){var c=[null];c.push.apply(c,o);var d=Function.bind.apply(i,c),l=new d;return a&&gi(l,a.prototype),l},lo.apply(null,arguments)}function Cm(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Z3(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function gi(t,e){return gi=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},gi(t,e)}function mi(t){return mi=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},mi(t)}var Bt=function(t){W3(n,t);var e=J3(n);function n(r){var i;return G3(this,n),i=e.call(this,r),Object.setPrototypeOf(Nm(i),n.prototype),i.name=i.constructor.name,i}return K3(n)}(Ed(Error)),Ff=new RegExp("(?:"+Im()+")$","i");function Y3(t){var e=t.search(Ff);if(e<0)return{};for(var n=t.slice(0,e),r=t.match(Ff),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}var Q3={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 e4(t){return Q3[t]}function t4(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=n4(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
152
152
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n4(t,e){if(t){if(typeof t=="string")return Df(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Df(t,e)}}function Df(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Vf(t){for(var e="",n=t4(t.split("")),r;!(r=n()).done;){var i=r.value;e+=r4(i,e)||""}return e}function r4(t,e,n){return t==="+"?e?void 0:"+":e4(t)}function i4(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=o4(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
153
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o4(t,e){if(t){if(typeof t=="string")return qf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qf(t,e)}}function qf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s4(t,e){var n=e.countries,r=e.metadata;r=new Ge(r);for(var i=i4(n),o;!(o=i()).done;){var a=o.value;if(r.country(a),r.leadingDigits()){if(t&&t.search(r.leadingDigits())===0)return a}else if(Gl({phone:t,country:a},void 0,r.metadata))return a}}function a4(t,e){var n=e.nationalNumber,r=e.defaultCountry,i=e.metadata,o=i.getCountryCodesForCallingCode(t);if(o)return o.length===1?o[0]:s4(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var jm="+",c4="[\\-\\.\\(\\)]?",Hf="(["+vt+"]|"+c4+")",d4="^\\"+jm+Hf+"*["+vt+"]"+Hf+"*$",l4=new RegExp(d4,"g"),
|
|
154
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P4(t,e){if(t){if(typeof t=="string")return Xf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xf(t,e)}}function Xf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function T4(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,c;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(d){o=!0,c=d}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw c}}return r}}function R4(t){if(Array.isArray(t))return t}function B4(t){var e=Array.prototype.slice.call(t),n=j4(e,4),r=n[0],i=n[1],o=n[2],a=n[3],c,d,l;if(typeof r=="string")c=r;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")a?(d=o,l=a):(d=void 0,l=o),i&&(d=N4({defaultCountry:i},d));else if(dr(i))o?(d=i,l=o):l=i;else throw new Error("Invalid second argument: ".concat(i));return{text:c,options:d,metadata:l}}function Zf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Yf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zf(Object(n),!0).forEach(function(r){L4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function L4(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U4(t,e,n){e&&e.defaultCountry&&!Jb(e.defaultCountry,n)&&(e=Yf(Yf({},e),{},{defaultCountry:void 0}));try{return I4(t,e,n)}catch(r){if(!(r instanceof Bt))throw r}}function M4(){var t=B4(arguments),e=t.text,n=t.options,r=t.metadata;return U4(e,n,r)}function F4(){return Ub(M4,arguments)}function mi(t,e="US"){const n=t.trim();if(n.includes("@")){const r=n.toLowerCase(),i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);return{connectionType:"email",normalized:i?r:null,isValid:i}}else if(/^\+?\d[\d\s\-().]*$/.test(n)){const r=F4(n,{defaultCountry:e});return r&&r.isValid()?{connectionType:"sms",normalized:r.number,isValid:!0}:{connectionType:"sms",normalized:null,isValid:!1}}else return{connectionType:"username",normalized:n,isValid:!0}}const D4=s.z.object({client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),otp:s.z.string(),authParams:Yr.optional()});async function $a(t,{client_id:e,username:n,otp:r,authParams:i}){const o=jt(t.req),{connectionType:a,normalized:c}=mi(n,o.countryCode);if(!c)throw new A(400,{message:"Invalid username format"});const d=await t.env.data.clients.get(e);if(!d)throw new A(403,{message:"Client not found"});const{env:l}=t,u=await l.data.codes.get(d.tenant.id,r,"otp");if(!u)throw new A(400,{message:"Code not found or expired"});if(u.expires_at<new Date().toISOString())throw new A(400,{message:"Code expired"});if(u.used_at)throw new A(400,{message:"Code already used"});const f=await l.data.loginSessions.get(d.tenant.id,u.login_id);if(!f||f.authParams.username!==n)throw new A(400,{message:"Code not found or expired"});if(f.ip&&o.ip&&f.ip!==o.ip)return t.redirect(`${dt(t.env)}invalid-session?state=${f.id}`);const m=await Is(t,{client:d,username:c,provider:a,connection:a,isSocial:!1,ip:t.req.header("x-real-ip")});return await l.data.codes.used(d.tenant.id,r),Zt(t,{user:m,client:d,loginSession:f,authParams:i||{client_id:e,response_type:it.TOKEN_ID_TOKEN,response_mode:Dt.WEB_MESSAGE}})}const Qf=s.z.object({client_id:s.z.string().optional(),client_secret:s.z.string().optional()}),V4=s.z.union([km.extend(Qf.shape),s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string(),code_verifier:s.z.string().min(43).max(128)}),s.z.object({grant_type:s.z.literal("authorization_code"),code:s.z.string(),redirect_uri:s.z.string().optional(),...Qf.shape}),s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),refresh_token:s.z.string(),redirect_uri:s.z.string().optional()}),s.z.object({grant_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:s.z.string(),username:s.z.string(),otp:s.z.string(),realm:s.z.enum(["email","sms"])})]);function q4(t){if(!t)return{};const[e,n]=t.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&n){const[r,i]=atob(n).split(":");return{client_id:r,client_secret:i}}return{}}const H4=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:V4}}}},responses:{200:{content:{"application/json":{schema:Vd}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=q4(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new A(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case rr.AuthorizationCode:i=await Tb(t,Pb.parse(r));break;case rr.ClientCredential:i=await Ob(t,km.parse(r));break;case rr.RefreshToken:i=await Bb(t,Rb.parse(r));break;case rr.OTP:i=await $a(t,D4.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}if(i instanceof Response){const o=i.status,a=i.headers.get("Location");if(o===302&&a)return t.redirect(a,302);try{const c=await i.json();return t.json(c,o)}catch(c){return console.error("Failed to process raw Response from grant flow:",c),t.json({error:"server_error",error_description:"Invalid response format from authentication flow."},500)}}else return t.json(i)});var Xl={exports:{}};const Zl=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],Om=(t,e=Zl,n="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";e[0].minDiversity=0,e[0].minLength=0;const i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];n&&i.push({regex:`[${n}]`,message:"symbol"});let o={};o.contains=i.filter(c=>new RegExp(`${c.regex}`).test(r)).map(c=>c.message),o.length=r.length;let a=e.filter(c=>o.contains.length>=c.minDiversity).filter(c=>o.length>=c.minLength).sort((c,d)=>d.id-c.id).map(c=>({id:c.id,value:c.value}));return Object.assign(o,a[0]),o};Xl.exports={passwordStrength:Om,defaultOptions:Zl};var K4=Xl.exports.passwordStrength=Om;Xl.exports.defaultOptions=Zl;function Yl(t){return K4(t).id<2?!1:t.length>=8&&/[a-z]/.test(t)&&/[A-Z]/.test(t)&&/[0-9]/.test(t)&&/[^A-Za-z0-9]/.test(t)}async function Mi(t,e){var i;const n=await t.env.data.emailProviders.get(t.var.tenant_id)||(t.env.DEFAULT_TENANT_ID?await t.env.data.emailProviders.get(t.env.DEFAULT_TENANT_ID):null);if(!n)throw new A(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new A(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function Pm(t,e){var a,c;if(!t.var.client_id)throw new A(500,{message:"Client not found"});const n=await Ui(t.env,t.var.client_id),r=n.connections.find(d=>d.strategy==="sms");if(!r)throw new A(500,{message:"SMS provider not found"});const i=((a=r.options)==null?void 0:a.provider)||"twilio",o=(c=t.env.smsProviders)==null?void 0:c[i];if(!o)throw new A(500,{message:"SMS provider not found"});await o({options:r.options,to:e.to,from:e.from,text:e.text,template:"auth-code",data:{code:e.code,tenantName:n.tenant.name,tenantId:n.tenant.id}})}async function Tm(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new A(500,{message:"Tenant not found"});const o=`${dt(t.env)}reset-password?state=${r}&code=${n}`,a={vendorName:i.name,lng:i.language||"en"};await Mi(t,{to:e,subject:re("reset_password_title",a),html:`Click here to reset your password: ${dt(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:o,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:re("password_reset_title",a),resetPasswordEmailClickToReset:re("reset_password_email_click_to_reset",a),resetPasswordEmailReset:re("reset_password_email_reset",a),supportInfo:re("support_info",a),contactUs:re("contact_us",a),copyright:re("copyright",a),tenantName:i.name,tenantId:i.id}})}async function Rm(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new A(500,{message:"Tenant not found"});const{connectionType:i}=mi(e),o=new URL(dt(t.env)),a={vendorName:r.name,vendorId:r.id,loginDomain:o.hostname,code:n,lng:r.language||"en"};i==="email"?await Mi(t,{to:e,subject:re("code_email_subject",a),html:`Click here to validate your email: ${dt(t.env)}validate-email`,template:"auth-code",data:{code:n,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",buttonColor:r.primary_color||"",welcomeToYourAccount:re("welcome_to_your_account",a),linkEmailClickToLogin:re("link_email_click_to_login",a),linkEmailLogin:re("link_email_login",a),linkEmailOrEnterCode:re("link_email_or_enter_code",a),codeValid30Mins:re("code_valid_30_minutes",a),supportInfo:re("support_info",a),contactUs:re("contact_us",a),copyright:re("copyright",a)}}):i==="sms"&&await Pm(t,{to:e,text:re("sms_code_text",a),code:n,from:r.name});const c=we(t,{type:he.CODE_LINK_SENT,description:e});It(t,t.env.data.logs.create(r.id,c))}async function Ql(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new A(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new A(400,{message:"redirect_uri is required"});const{connectionType:o}=mi(e),a=new URL(Pe(t.env));a.pathname="passwordless/verify_redirect",a.searchParams.set("verification_code",n),a.searchParams.set("connection",o),a.searchParams.set("client_id",r.client_id),a.searchParams.set("redirect_uri",r.redirect_uri),a.searchParams.set("email",e),r.response_type&&a.searchParams.set("response_type",r.response_type),r.scope&&a.searchParams.set("scope",r.scope),r.state&&a.searchParams.set("state",r.state),r.nonce&&a.searchParams.set("nonce",r.nonce),r.code_challenge&&a.searchParams.set("code_challenge",r.code_challenge),r.code_challenge_method&&a.searchParams.set("code_challenge_method",r.code_challenge_method),r.audience&&a.searchParams.set("audience",r.audience);const c={vendorName:i.name,code:n,lng:i.language||"en"};if(o==="email")await Mi(t,{to:e,subject:re("code_email_subject",c),html:`Click here to validate your email: ${dt(t.env)}validate-email`,template:"auth-link",data:{code:n,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:a.toString(),buttonColor:i.primary_color||"",welcomeToYourAccount:re("welcome_to_your_account",c),linkEmailClickToLogin:re("link_email_click_to_login",c),linkEmailLogin:re("link_email_login",c),linkEmailOrEnterCode:re("link_email_or_enter_code",c),codeValid30Mins:re("code_valid_30_minutes",c),supportInfo:re("support_info",c),contactUs:re("contact_us",c),copyright:re("copyright",c)}});else if(o==="sms")await Pm(t,{to:e,text:`${re("link_sms_login",c)}: ${a.toString()}`,code:n,from:i.name});else throw new A(400,{message:"Only email and SMS connections are supported for magic links"});const d=we(t,{type:he.CODE_LINK_SENT,description:e});It(t,t.env.data.logs.create(i.id,d))}async function eu(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new A(500,{message:"Tenant not found"});if(!e.email)throw new A(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await Mi(t,{to:e.email,subject:re("welcome_to_your_account",r),html:`Click here to validate your email: ${dt(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${dt(t.env)}validate-email`,supportUrl:n.support_url||"https://support.sesamy.com",buttonColor:n.primary_color||"#7d68f4",welcomeToYourAccount:re("welcome_to_your_account",r),verifyEmailVerify:re("verify_email_verify",r),supportInfo:re("support_info",r),contactUs:re("contact_us",r),copyright:re("copyright",r)}})}async function G4(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new A(500,{message:"Tenant not found"});const o={vendorName:i.name,lng:i.language||"en"},a=`${dt(t.env)}signup?state=${r}&code=${n}`;await Mi(t,{to:e,subject:re("register_password_account",o),html:`Click here to register: ${a}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:a,setPassword:re("set_password",o),registerPasswordAccount:re("register_password_account",o),clickToSignUpDescription:re("click_to_sign_up_description",o),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:re("welcome_to_your_account",o),verifyEmailVerify:re("verify_email_verify",o),supportInfo:re("support_info",o),contactUs:re("contact_us",o),copyright:re("copyright",o)}})}const W4=new s.OpenAPIHono().openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string()})}}}},responses:{200:{content:{"application/json":{schema:s.z.object({_id:s.z.string(),email:s.z.string().optional(),email_verified:s.z.boolean(),app_metadata:s.z.object({}),user_metadata:s.z.object({})})}},description:"Created user"}}}),async t=>{const{email:e,password:n,client_id:r}=t.req.valid("json"),i=await t.env.data.clients.get(r);if(!i)throw new A(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!Yl(n))throw new A(400,{message:"Password does not meet the requirements"});if(await Io({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new A(400,{message:"Invalid sign up"});const a=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${xs()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});t.set("user_id",a.user_id),t.set("username",a.email),t.set("connection",a.connection);const c=await vi.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:a.user_id,password:c,algorithm:"bcrypt"}),await eu(t,a);const d=we(t,{type:he.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,d),t.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async t=>{const{email:e,client_id:n}=t.req.valid("json"),r=await t.env.data.clients.get(n);if(!r)throw new A(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await kr({userAdapter:t.env.data.users,tenant_id:r.tenant.id,username:e,provider:"auth2"}))return t.html("If an account with that email exists, we've sent instructions to reset your password.");const o={client_id:n,username:e},a=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:o,csrf_token:xe(),...jt(t.req)});return await Tm(t,e,a.id,a.authParams.state),t.html("If an account with that email exists, we've sent instructions to reset your password.")});function Dn(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const J4=new s.OpenAPIHono().openapi(s.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({connection:s.z.literal("email"),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),send:s.z.enum(["link","code"]),authParams:Yr.omit({client_id:!0})}),s.z.object({client_id:s.z.string(),connection:s.z.literal("sms"),phone_number:s.z.string(),send:s.z.enum(["link","code"]),authParams:Yr.omit({client_id:!0})})])}}}},responses:{200:{description:"Status"}}}),async t=>{const e=t.req.valid("json"),{env:n}=t,{client_id:r,send:i,authParams:o,connection:a}=e,c=await t.env.data.clients.get(r);if(!c)throw new A(400,{message:"Client not found"});t.set("client_id",c.id),t.set("tenant_id",c.tenant.id);const d=a==="email"?e.email:e.phone_number,{ip:l,useragent:u,auth0Client:f}=jt(t.req),m=await n.data.loginSessions.create(c.tenant.id,{authParams:{...o,client_id:r,username:d},expires_at:new Date(Date.now()+no).toISOString(),csrf_token:xe(),ip:l,useragent:u,auth0Client:f}),w=await n.data.codes.create(c.tenant.id,{code_id:Dn(),code_type:"otp",login_id:m.id,expires_at:new Date(Date.now()+no).toISOString(),redirect_uri:o.redirect_uri});return i==="link"?await Ql(t,{to:d,code:w.code_id,authParams:{...o,client_id:r}}):await Rm(t,{to:d,code:w.code_id}),t.html("OK")}).openapi(s.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:s.z.object({scope:s.z.string(),response_type:s.z.nativeEnum(it),redirect_uri:s.z.string(),state:s.z.string(),nonce:s.z.string().optional(),verification_code:s.z.string(),connection:s.z.string(),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),audience:s.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:o,state:a,scope:c,audience:d,response_type:l,nonce:u}=t.req.valid("query"),f=await Ui(e,n);t.set("client_id",f.id),t.set("tenant_id",f.tenant.id),t.set("connection","email");const m={client_id:n,redirect_uri:o,state:a,nonce:u,scope:c,audience:d,response_type:l};let w="Something went wrong. Please try again later.";try{const E=await $a(t,{client_id:n,username:r,otp:i,authParams:m});if(E instanceof Response)return E;if(E&&typeof E=="object"&&"access_token"in E)return t.json(E)}catch(E){const C=E;"message"in C&&typeof C.message=="string"&&(w=C.message)}const{ip:h,useragent:y,auth0Client:v}=jt(t.req),b=await e.data.loginSessions.create(f.tenant.id,{authParams:{...m,username:r},expires_at:new Date(Date.now()+no).toISOString(),csrf_token:xe(),ip:h,useragent:y,auth0Client:v});return t.redirect(`/u/invalid-session?state=${b.id}&error=${encodeURIComponent(w)}`,302)});class Qn extends A{constructor(n,r){super(n,r);te(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function tu(t,e,n,r,i){const{env:o}=t,{username:a}=n;if(t.set("username",a),!a)throw new A(400,{message:"Username is required"});const c=await kr({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:a,provider:"auth2"});if(!c){const h=we(t,{type:he.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw It(t,t.env.data.logs.create(e.tenant.id,h)),new Qn(403,{message:"User not found",code:"USER_NOT_FOUND"})}const d=c.linked_to?await o.data.users.get(e.tenant.id,c.linked_to):c;if(!d)throw new Qn(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",c.connection),t.set("user_id",d.user_id);const l=await o.data.passwords.get(e.tenant.id,c.user_id);if(!(l&&await vi.compare(n.password,l.password))){const h=we(t,{type:he.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw It(t,t.env.data.logs.create(e.tenant.id,h)),new Qn(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await o.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${d.user_id}`})).logs.filter(h=>h.type===he.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(h.date)>new Date(Date.now()-1e3*60*5)).length>=3){const h=we(t,{type:he.FAILED_LOGIN,description:"Too many failed login attempts"});throw It(t,t.env.data.logs.create(e.tenant.id,h)),new Qn(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!c.email_verified&&e.email_validation==="enforced"){await eu(t,c);const h=we(t,{type:he.FAILED_LOGIN,description:"Email not verified"});throw await t.env.data.logs.create(e.tenant.id,h),new Qn(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}const w=we(t,{type:he.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return It(t,t.env.data.logs.create(e.tenant.id,w)),Zt(t,{client:e,authParams:n,user:d,ticketAuth:i,loginSession:r})}async function X4(t,e,n,r){await Is(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=Dn(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;o;)i=Dn(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const{ip:a,useragent:c,auth0Client:d}=jt(t.req),l=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+F_).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:xe(),ip:a,useragent:c,auth0Client:d}),u=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:l.id,expires_at:new Date(Date.now()+M_).toISOString()});await Tm(t,n,u.code_id,r)}const Z4=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:s.z.string(),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),realm:s.z.enum(["email"]),scope:s.z.string().optional()}),s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string(),realm:s.z.enum(["Username-Password-Authentication"]),scope:s.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async t=>{const e=t.req.valid("json"),{client_id:n,username:r}=e;t.set("username",r);const i=await t.env.data.clients.get(n);if(!i)throw new A(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const o=r.toLocaleLowerCase(),a=jt(t.req);let c;if("otp"in e)c=await $a(t,{client_id:n,username:o,otp:e.otp});else if("password"in e){const d=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:{client_id:n,username:o},csrf_token:xe(),ip:a.ip,useragent:a.useragent,auth0Client:a.auth0Client});c=await tu(t,i,{username:o,password:e.password,client_id:n},d,!0)}else throw new A(400,{message:"Code or password required"});if(!(c instanceof Response))throw new A(500,{message:"Unexpected response from loginWithPassword"});return c});function Y4(t,e){var r,i,o;if(!t||e.length===0)return!1;const n=((r=Va(t))==null?void 0:r.host)??null;if(!n)return!1;for(const a of e){let c;if(a.startsWith("http://")||a.startsWith("https://")?c=((i=Va(a))==null?void 0:i.host)??null:c=((o=Va("https://"+a))==null?void 0:o.host)??null,n===c)return!0}return!1}function Va(t){try{return new URL(t)}catch{return null}}async function Q4({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:o}){const a=new URL(t.req.url);t.var.custom_domain&&(a.hostname=t.var.custom_domain);const{ip:c,useragent:d,auth0Client:l}=jt(t.req),u=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:r,csrf_token:xe(),authorization_url:a.toString(),ip:c,useragent:d,auth0Client:l});if(e&&o){const f=await t.env.data.users.get(n.tenant.id,e.user_id);if((f==null?void 0:f.email)===o)return Zt(t,{client:n,loginSession:u,authParams:r,user:f,sessionId:e.id})}if(i==="email"&&o){const f=Dn();return await t.env.data.codes.create(n.tenant.id,{code_id:f,code_type:"otp",login_id:u.id,expires_at:new Date(Date.now()+Qr*1e3).toISOString(),redirect_uri:r.redirect_uri}),await Ql(t,{code:f,to:o,authParams:r}),t.redirect(`/u/enter-code?state=${u.id}`)}return e?t.redirect(`/u/check-account?state=${u.id}`):t.redirect(`/u/login/identifier?state=${u.id}`)}function e$(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new A(403,{message:"Invalid realm"})}async function t$(t,e,n,r,i){var m;const{env:o}=t;t.set("connection",i);const a=await o.data.codes.get(e,n,"ticket");if(!a||a.used_at)throw new A(403,{message:"Ticket not found"});const c=await o.data.loginSessions.get(e,a.login_id);if(!c||!c.authParams.username)throw new A(403,{message:"Session not found"});const d=await o.data.clients.get(c.authParams.client_id);if(!d)throw new A(403,{message:"Client not found"});t.set("client_id",c.authParams.client_id),await o.data.codes.used(e,n);const l=e$(i);let u=await Is(t,{username:c.authParams.username,provider:l,client:d,connection:l==="auth2"?"Username-Password-Authentication":"email",isSocial:!1,ip:t.req.header("x-real-ip")});t.set("username",u.email||u.phone_number),t.set("user_id",u.user_id);const f=await w0(t,{user:u,client:d,loginSession:c});return Zt(t,{authParams:{scope:(m=c.authParams)==null?void 0:m.scope,...r},loginSession:c,sessionId:f.id,user:u,client:d})}async function eh(t,e){return`<!DOCTYPE html>
|
|
153
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o4(t,e){if(t){if(typeof t=="string")return qf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qf(t,e)}}function qf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s4(t,e){var n=e.countries,r=e.metadata;r=new Ge(r);for(var i=i4(n),o;!(o=i()).done;){var a=o.value;if(r.country(a),r.leadingDigits()){if(t&&t.search(r.leadingDigits())===0)return a}else if(Gl({phone:t,country:a},void 0,r.metadata))return a}}function a4(t,e){var n=e.nationalNumber,r=e.defaultCountry,i=e.metadata,o=i.getCountryCodesForCallingCode(t);if(o)return o.length===1?o[0]:s4(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var jm="+",c4="[\\-\\.\\(\\)]?",Hf="(["+vt+"]|"+c4+")",d4="^\\"+jm+Hf+"*["+vt+"]"+Hf+"*$",l4=new RegExp(d4,"g"),zd=vt,u4="["+zd+"]+((\\-)*["+zd+"])*",p4="a-zA-Z",f4="["+p4+"]+((\\-)*["+zd+"])*",h4="^("+u4+"\\.)*"+f4+"\\.?$",g4=new RegExp(h4,"g"),Kf="tel:",Id=";phone-context=",m4=";isub=";function _4(t){var e=t.indexOf(Id);if(e<0)return null;var n=e+Id.length;if(n>=t.length)return"";var r=t.indexOf(";",n);return r>=0?t.substring(n,r):t.substring(n)}function y4(t){return t===null?!0:t.length===0?!1:l4.test(t)||g4.test(t)}function w4(t,e){var n=e.extractFormattedPhoneNumber,r=_4(t);if(!y4(r))throw new Bt("NOT_A_NUMBER");var i;if(r===null)i=n(t)||"";else{i="",r.charAt(0)===jm&&(i+=r);var o=t.indexOf(Kf),a;o>=0?a=o+Kf.length:a=0;var c=t.indexOf(Id);i+=t.substring(a,c)}var d=i.indexOf(m4);if(d>0&&(i=i.substring(0,d)),i!=="")return i}var v4=250,b4=new RegExp("["+Jl+vt+"]"),$4=new RegExp("[^"+vt+"#]+$");function x4(t,e,n){if(e=e||{},n=new Ge(n),e.defaultCountry&&!n.hasCountry(e.defaultCountry))throw e.v2?new Bt("INVALID_COUNTRY"):new Error("Unknown country: ".concat(e.defaultCountry));var r=S4(t,e.v2,e.extract),i=r.number,o=r.ext,a=r.error;if(!i){if(e.v2)throw a==="TOO_SHORT"?new Bt("TOO_SHORT"):new Bt("NOT_A_NUMBER");return{}}var c=E4(i,e.defaultCountry,e.defaultCallingCode,n),d=c.country,l=c.nationalNumber,u=c.countryCallingCode,f=c.countryCallingCodeSource,m=c.carrierCode;if(!n.hasSelectedNumberingPlan()){if(e.v2)throw new Bt("INVALID_COUNTRY");return{}}if(!l||l.length<Wl){if(e.v2)throw new Bt("TOO_SHORT");return{}}if(l.length>i3){if(e.v2)throw new Bt("TOO_LONG");return{}}if(e.v2){var w=new D3(u,l,n.metadata);return d&&(w.country=d),m&&(w.carrierCode=m),o&&(w.ext=o),w.__countryCallingCodeSource=f,w}var h=(e.extended?n.hasSelectedNumberingPlan():d)?Jt(l,n.nationalNumberPattern()):!1;return e.extended?{country:d,countryCallingCode:u,carrierCode:m,valid:h,possible:h?!0:!!(e.extended===!0&&n.possibleLengths()&&Em(l,n)),phone:l,ext:o}:h?A4(d,l,o):{}}function k4(t,e,n){if(t){if(t.length>v4){if(n)throw new Bt("TOO_LONG");return}if(e===!1)return t;var r=t.search(b4);if(!(r<0))return t.slice(r).replace($4,"")}}function S4(t,e,n){var r=w4(t,{extractFormattedPhoneNumber:function(a){return k4(a,n,e)}});if(!r)return{};if(!I3(r))return N3(r)?{error:"TOO_SHORT"}:{};var i=Y3(r);return i.ext?i:{number:r}}function A4(t,e,n){var r={country:t,phone:e};return n&&(r.ext=n),r}function E4(t,e,n,r){var i=zm(Vf(t),e,n,r.metadata),o=i.countryCallingCodeSource,a=i.countryCallingCode,c=i.number,d;if(a)r.selectNumberingPlan(a);else if(c&&(e||n))r.selectNumberingPlan(e,n),e&&(d=e),a=n||Hl(e,r.metadata);else return{};if(!c)return{countryCallingCodeSource:o,countryCallingCode:a};var l=Sd(Vf(c),r),u=l.nationalNumber,f=l.carrierCode,m=a4(a,{nationalNumber:u,defaultCountry:e,metadata:r});return m&&(d=m,m==="001"||r.country(d)),{country:d,countryCallingCode:a,countryCallingCodeSource:o,nationalNumber:u,carrierCode:f}}function Gf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gf(Object(n),!0).forEach(function(r){z4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function z4(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function I4(t,e,n){return x4(t,Wf(Wf({},e),{},{v2:!0}),n)}function Jf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function N4(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jf(Object(n),!0).forEach(function(r){C4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function C4(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function j4(t,e){return R4(t)||T4(t,e)||P4(t,e)||O4()}function O4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
154
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P4(t,e){if(t){if(typeof t=="string")return Xf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xf(t,e)}}function Xf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function T4(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,c;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(d){o=!0,c=d}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw c}}return r}}function R4(t){if(Array.isArray(t))return t}function B4(t){var e=Array.prototype.slice.call(t),n=j4(e,4),r=n[0],i=n[1],o=n[2],a=n[3],c,d,l;if(typeof r=="string")c=r;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")a?(d=o,l=a):(d=void 0,l=o),i&&(d=N4({defaultCountry:i},d));else if(dr(i))o?(d=i,l=o):l=i;else throw new Error("Invalid second argument: ".concat(i));return{text:c,options:d,metadata:l}}function Zf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Yf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zf(Object(n),!0).forEach(function(r){L4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function L4(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U4(t,e,n){e&&e.defaultCountry&&!Jb(e.defaultCountry,n)&&(e=Yf(Yf({},e),{},{defaultCountry:void 0}));try{return I4(t,e,n)}catch(r){if(!(r instanceof Bt))throw r}}function M4(){var t=B4(arguments),e=t.text,n=t.options,r=t.metadata;return U4(e,n,r)}function F4(){return Ub(M4,arguments)}function va(t,e="US"){const n=t.trim();if(n.includes("@")){const r=n.toLowerCase(),i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);return{connectionType:"email",normalized:i?r:null,isValid:i}}else if(/^\+?\d[\d\s\-().]*$/.test(n)){const r=F4(n,{defaultCountry:e});return r&&r.isValid()?{connectionType:"sms",normalized:r.number,isValid:!0}:{connectionType:"sms",normalized:null,isValid:!1}}else return{connectionType:"username",normalized:n,isValid:!0}}const D4=s.z.object({client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),otp:s.z.string(),authParams:Yr.optional()});async function ba(t,{client_id:e,username:n,otp:r,authParams:i}){const o=jt(t.req),{connectionType:a,normalized:c}=va(n,o.countryCode);if(!c)throw new A(400,{message:"Invalid username format"});const d=await t.env.data.clients.get(e);if(!d)throw new A(403,{message:"Client not found"});const{env:l}=t,u=await l.data.codes.get(d.tenant.id,r,"otp");if(!u)throw new A(400,{message:"Code not found or expired"});if(u.expires_at<new Date().toISOString())throw new A(400,{message:"Code expired"});if(u.used_at)throw new A(400,{message:"Code already used"});const f=await l.data.loginSessions.get(d.tenant.id,u.login_id);if(!f||f.authParams.username!==n)throw new A(400,{message:"Code not found or expired"});if(f.ip&&o.ip&&f.ip!==o.ip)return t.redirect(`${dt(t.env)}invalid-session?state=${f.id}`);const m=await Es(t,{client:d,username:c,provider:a,connection:a,isSocial:!1,ip:t.req.header("x-real-ip")});return await l.data.codes.used(d.tenant.id,r),Zt(t,{user:m,client:d,loginSession:f,authParams:i||{client_id:e,response_type:it.TOKEN_ID_TOKEN,response_mode:Dt.WEB_MESSAGE}})}const Qf=s.z.object({client_id:s.z.string().optional(),client_secret:s.z.string().optional()}),V4=s.z.union([km.extend(Qf.shape),s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string(),code_verifier:s.z.string().min(43).max(128)}),s.z.object({grant_type:s.z.literal("authorization_code"),code:s.z.string(),redirect_uri:s.z.string().optional(),...Qf.shape}),s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),refresh_token:s.z.string(),redirect_uri:s.z.string().optional()}),s.z.object({grant_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:s.z.string(),username:s.z.string(),otp:s.z.string(),realm:s.z.enum(["email","sms"])})]);function q4(t){if(!t)return{};const[e,n]=t.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&n){const[r,i]=atob(n).split(":");return{client_id:r,client_secret:i}}return{}}const H4=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:V4}}}},responses:{200:{content:{"application/json":{schema:Dd}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=q4(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new A(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case rr.AuthorizationCode:i=await Tb(t,Pb.parse(r));break;case rr.ClientCredential:i=await Ob(t,km.parse(r));break;case rr.RefreshToken:i=await Bb(t,Rb.parse(r));break;case rr.OTP:i=await ba(t,D4.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}if(i instanceof Response){const o=i.status,a=i.headers.get("Location");if(o===302&&a)return t.redirect(a,302);try{const c=await i.json();return t.json(c,o)}catch(c){return console.error("Failed to process raw Response from grant flow:",c),t.json({error:"server_error",error_description:"Invalid response format from authentication flow."},500)}}else return t.json(i)});var Xl={exports:{}};const Zl=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],Om=(t,e=Zl,n="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";e[0].minDiversity=0,e[0].minLength=0;const i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];n&&i.push({regex:`[${n}]`,message:"symbol"});let o={};o.contains=i.filter(c=>new RegExp(`${c.regex}`).test(r)).map(c=>c.message),o.length=r.length;let a=e.filter(c=>o.contains.length>=c.minDiversity).filter(c=>o.length>=c.minLength).sort((c,d)=>d.id-c.id).map(c=>({id:c.id,value:c.value}));return Object.assign(o,a[0]),o};Xl.exports={passwordStrength:Om,defaultOptions:Zl};var K4=Xl.exports.passwordStrength=Om;Xl.exports.defaultOptions=Zl;function Yl(t){return K4(t).id<2?!1:t.length>=8&&/[a-z]/.test(t)&&/[A-Z]/.test(t)&&/[0-9]/.test(t)&&/[^A-Za-z0-9]/.test(t)}async function Mi(t,e){var i;const n=await t.env.data.emailProviders.get(t.var.tenant_id)||(t.env.DEFAULT_TENANT_ID?await t.env.data.emailProviders.get(t.env.DEFAULT_TENANT_ID):null);if(!n)throw new A(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new A(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function Pm(t,e){var a,c;if(!t.var.client_id)throw new A(500,{message:"Client not found"});const n=await Ui(t.env,t.var.client_id),r=n.connections.find(d=>d.strategy==="sms");if(!r)throw new A(500,{message:"SMS provider not found"});const i=((a=r.options)==null?void 0:a.provider)||"twilio",o=(c=t.env.smsProviders)==null?void 0:c[i];if(!o)throw new A(500,{message:"SMS provider not found"});await o({options:r.options,to:e.to,from:e.from,text:e.text,template:"auth-code",data:{code:e.code,tenantName:n.tenant.name,tenantId:n.tenant.id}})}async function Tm(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new A(500,{message:"Tenant not found"});const o=`${dt(t.env)}reset-password?state=${r}&code=${n}`,a={vendorName:i.name,lng:i.language||"en"};await Mi(t,{to:e,subject:re("reset_password_title",a),html:`Click here to reset your password: ${dt(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:o,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:re("password_reset_title",a),resetPasswordEmailClickToReset:re("reset_password_email_click_to_reset",a),resetPasswordEmailReset:re("reset_password_email_reset",a),supportInfo:re("support_info",a),contactUs:re("contact_us",a),copyright:re("copyright",a),tenantName:i.name,tenantId:i.id}})}async function Rm(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new A(500,{message:"Tenant not found"});const{connectionType:i}=va(e),o=new URL(dt(t.env)),a={vendorName:r.name,vendorId:r.id,loginDomain:o.hostname,code:n,lng:r.language||"en"};i==="email"?await Mi(t,{to:e,subject:re("code_email_subject",a),html:`Click here to validate your email: ${dt(t.env)}validate-email`,template:"auth-code",data:{code:n,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",buttonColor:r.primary_color||"",welcomeToYourAccount:re("welcome_to_your_account",a),linkEmailClickToLogin:re("link_email_click_to_login",a),linkEmailLogin:re("link_email_login",a),linkEmailOrEnterCode:re("link_email_or_enter_code",a),codeValid30Mins:re("code_valid_30_minutes",a),supportInfo:re("support_info",a),contactUs:re("contact_us",a),copyright:re("copyright",a)}}):i==="sms"&&await Pm(t,{to:e,text:re("sms_code_text",a),code:n,from:r.name});const c=we(t,{type:he.CODE_LINK_SENT,description:e});It(t,t.env.data.logs.create(r.id,c))}async function Ql(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new A(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new A(400,{message:"redirect_uri is required"});const{connectionType:o}=va(e),a=new URL(Pe(t.env));a.pathname="passwordless/verify_redirect",a.searchParams.set("verification_code",n),a.searchParams.set("connection",o),a.searchParams.set("client_id",r.client_id),a.searchParams.set("redirect_uri",r.redirect_uri),a.searchParams.set("email",e),r.response_type&&a.searchParams.set("response_type",r.response_type),r.scope&&a.searchParams.set("scope",r.scope),r.state&&a.searchParams.set("state",r.state),r.nonce&&a.searchParams.set("nonce",r.nonce),r.code_challenge&&a.searchParams.set("code_challenge",r.code_challenge),r.code_challenge_method&&a.searchParams.set("code_challenge_method",r.code_challenge_method),r.audience&&a.searchParams.set("audience",r.audience);const c={vendorName:i.name,code:n,lng:i.language||"en"};if(o==="email")await Mi(t,{to:e,subject:re("code_email_subject",c),html:`Click here to validate your email: ${dt(t.env)}validate-email`,template:"auth-link",data:{code:n,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:a.toString(),buttonColor:i.primary_color||"",welcomeToYourAccount:re("welcome_to_your_account",c),linkEmailClickToLogin:re("link_email_click_to_login",c),linkEmailLogin:re("link_email_login",c),linkEmailOrEnterCode:re("link_email_or_enter_code",c),codeValid30Mins:re("code_valid_30_minutes",c),supportInfo:re("support_info",c),contactUs:re("contact_us",c),copyright:re("copyright",c)}});else if(o==="sms")await Pm(t,{to:e,text:`${re("link_sms_login",c)}: ${a.toString()}`,code:n,from:i.name});else throw new A(400,{message:"Only email and SMS connections are supported for magic links"});const d=we(t,{type:he.CODE_LINK_SENT,description:e});It(t,t.env.data.logs.create(i.id,d))}async function eu(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new A(500,{message:"Tenant not found"});if(!e.email)throw new A(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await Mi(t,{to:e.email,subject:re("welcome_to_your_account",r),html:`Click here to validate your email: ${dt(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${dt(t.env)}validate-email`,supportUrl:n.support_url||"https://support.sesamy.com",buttonColor:n.primary_color||"#7d68f4",welcomeToYourAccount:re("welcome_to_your_account",r),verifyEmailVerify:re("verify_email_verify",r),supportInfo:re("support_info",r),contactUs:re("contact_us",r),copyright:re("copyright",r)}})}async function G4(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new A(500,{message:"Tenant not found"});const o={vendorName:i.name,lng:i.language||"en"},a=`${dt(t.env)}signup?state=${r}&code=${n}`;await Mi(t,{to:e,subject:re("register_password_account",o),html:`Click here to register: ${a}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:a,setPassword:re("set_password",o),registerPasswordAccount:re("register_password_account",o),clickToSignUpDescription:re("click_to_sign_up_description",o),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:re("welcome_to_your_account",o),verifyEmailVerify:re("verify_email_verify",o),supportInfo:re("support_info",o),contactUs:re("contact_us",o),copyright:re("copyright",o)}})}const W4=new s.OpenAPIHono().openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string()})}}}},responses:{200:{content:{"application/json":{schema:s.z.object({_id:s.z.string(),email:s.z.string().optional(),email_verified:s.z.boolean(),app_metadata:s.z.object({}),user_metadata:s.z.object({})})}},description:"Created user"}}}),async t=>{const{email:e,password:n,client_id:r}=t.req.valid("json"),i=await t.env.data.clients.get(r);if(!i)throw new A(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!Yl(n))throw new A(400,{message:"Password does not meet the requirements"});if(await ei({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new A(400,{message:"Invalid sign up"});const a=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${$s()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});t.set("user_id",a.user_id),t.set("username",a.email),t.set("connection",a.connection);const c=await vi.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:a.user_id,password:c,algorithm:"bcrypt"}),await eu(t,a);const d=we(t,{type:he.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,d),t.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async t=>{const{email:e,client_id:n}=t.req.valid("json"),r=await t.env.data.clients.get(n);if(!r)throw new A(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await kr({userAdapter:t.env.data.users,tenant_id:r.tenant.id,username:e,provider:"auth2"}))return t.html("If an account with that email exists, we've sent instructions to reset your password.");const o={client_id:n,username:e},a=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:o,csrf_token:xe(),...jt(t.req)});return await Tm(t,e,a.id,a.authParams.state),t.html("If an account with that email exists, we've sent instructions to reset your password.")});function Dn(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const J4=new s.OpenAPIHono().openapi(s.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({connection:s.z.literal("email"),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),send:s.z.enum(["link","code"]),authParams:Yr.omit({client_id:!0})}),s.z.object({client_id:s.z.string(),connection:s.z.literal("sms"),phone_number:s.z.string(),send:s.z.enum(["link","code"]),authParams:Yr.omit({client_id:!0})})])}}}},responses:{200:{description:"Status"}}}),async t=>{const e=t.req.valid("json"),{env:n}=t,{client_id:r,send:i,authParams:o,connection:a}=e,c=await t.env.data.clients.get(r);if(!c)throw new A(400,{message:"Client not found"});t.set("client_id",c.id),t.set("tenant_id",c.tenant.id);const d=a==="email"?e.email:e.phone_number,{ip:l,useragent:u,auth0Client:f}=jt(t.req),m=await n.data.loginSessions.create(c.tenant.id,{authParams:{...o,client_id:r,username:d},expires_at:new Date(Date.now()+no).toISOString(),csrf_token:xe(),ip:l,useragent:u,auth0Client:f}),w=await n.data.codes.create(c.tenant.id,{code_id:Dn(),code_type:"otp",login_id:m.id,expires_at:new Date(Date.now()+no).toISOString(),redirect_uri:o.redirect_uri});return i==="link"?await Ql(t,{to:d,code:w.code_id,authParams:{...o,client_id:r}}):await Rm(t,{to:d,code:w.code_id}),t.html("OK")}).openapi(s.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:s.z.object({scope:s.z.string(),response_type:s.z.nativeEnum(it),redirect_uri:s.z.string(),state:s.z.string(),nonce:s.z.string().optional(),verification_code:s.z.string(),connection:s.z.string(),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),audience:s.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:o,state:a,scope:c,audience:d,response_type:l,nonce:u}=t.req.valid("query"),f=await Ui(e,n);t.set("client_id",f.id),t.set("tenant_id",f.tenant.id),t.set("connection","email");const m={client_id:n,redirect_uri:o,state:a,nonce:u,scope:c,audience:d,response_type:l};let w="Something went wrong. Please try again later.";try{const E=await ba(t,{client_id:n,username:r,otp:i,authParams:m});if(E instanceof Response)return E;if(E&&typeof E=="object"&&"access_token"in E)return t.json(E)}catch(E){const C=E;"message"in C&&typeof C.message=="string"&&(w=C.message)}const{ip:h,useragent:y,auth0Client:v}=jt(t.req),b=await e.data.loginSessions.create(f.tenant.id,{authParams:{...m,username:r},expires_at:new Date(Date.now()+no).toISOString(),csrf_token:xe(),ip:h,useragent:y,auth0Client:v});return t.redirect(`/u/invalid-session?state=${b.id}&error=${encodeURIComponent(w)}`,302)});class Qn extends A{constructor(n,r){super(n,r);te(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function tu(t,e,n,r,i){const{env:o}=t,{username:a}=n;if(t.set("username",a),!a)throw new A(400,{message:"Username is required"});const c=await kr({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:a,provider:"auth2"});if(!c){const h=we(t,{type:he.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw It(t,t.env.data.logs.create(e.tenant.id,h)),new Qn(403,{message:"User not found",code:"USER_NOT_FOUND"})}const d=c.linked_to?await o.data.users.get(e.tenant.id,c.linked_to):c;if(!d)throw new Qn(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",c.connection),t.set("user_id",d.user_id);const l=await o.data.passwords.get(e.tenant.id,c.user_id);if(!(l&&await vi.compare(n.password,l.password))){const h=we(t,{type:he.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw It(t,t.env.data.logs.create(e.tenant.id,h)),new Qn(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await o.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${d.user_id}`})).logs.filter(h=>h.type===he.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(h.date)>new Date(Date.now()-1e3*60*5)).length>=3){const h=we(t,{type:he.FAILED_LOGIN,description:"Too many failed login attempts"});throw It(t,t.env.data.logs.create(e.tenant.id,h)),new Qn(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!c.email_verified&&e.email_validation==="enforced"){await eu(t,c);const h=we(t,{type:he.FAILED_LOGIN,description:"Email not verified"});throw await t.env.data.logs.create(e.tenant.id,h),new Qn(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}const w=we(t,{type:he.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return It(t,t.env.data.logs.create(e.tenant.id,w)),Zt(t,{client:e,authParams:n,user:d,ticketAuth:i,loginSession:r})}async function X4(t,e,n,r){await Es(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=Dn(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;o;)i=Dn(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const{ip:a,useragent:c,auth0Client:d}=jt(t.req),l=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+F_).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:xe(),ip:a,useragent:c,auth0Client:d}),u=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:l.id,expires_at:new Date(Date.now()+M_).toISOString()});await Tm(t,n,u.code_id,r)}const Z4=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:s.z.string(),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),realm:s.z.enum(["email"]),scope:s.z.string().optional()}),s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string(),realm:s.z.enum(["Username-Password-Authentication"]),scope:s.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async t=>{const e=t.req.valid("json"),{client_id:n,username:r}=e;t.set("username",r);const i=await t.env.data.clients.get(n);if(!i)throw new A(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const o=r.toLocaleLowerCase(),a=jt(t.req);let c;if("otp"in e)c=await ba(t,{client_id:n,username:o,otp:e.otp});else if("password"in e){const d=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:{client_id:n,username:o},csrf_token:xe(),ip:a.ip,useragent:a.useragent,auth0Client:a.auth0Client});c=await tu(t,i,{username:o,password:e.password,client_id:n},d,!0)}else throw new A(400,{message:"Code or password required"});if(!(c instanceof Response))throw new A(500,{message:"Unexpected response from loginWithPassword"});return c});function Y4(t,e){var r,i,o;if(!t||e.length===0)return!1;const n=((r=Da(t))==null?void 0:r.host)??null;if(!n)return!1;for(const a of e){let c;if(a.startsWith("http://")||a.startsWith("https://")?c=((i=Da(a))==null?void 0:i.host)??null:c=((o=Da("https://"+a))==null?void 0:o.host)??null,n===c)return!0}return!1}function Da(t){try{return new URL(t)}catch{return null}}async function Q4({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:o}){const a=new URL(t.req.url);t.var.custom_domain&&(a.hostname=t.var.custom_domain);const{ip:c,useragent:d,auth0Client:l}=jt(t.req),u=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+Qr*1e3).toISOString(),authParams:r,csrf_token:xe(),authorization_url:a.toString(),ip:c,useragent:d,auth0Client:l});if(e&&o){const f=await t.env.data.users.get(n.tenant.id,e.user_id);if((f==null?void 0:f.email)===o)return Zt(t,{client:n,loginSession:u,authParams:r,user:f,sessionId:e.id})}if(i==="email"&&o){const f=Dn();return await t.env.data.codes.create(n.tenant.id,{code_id:f,code_type:"otp",login_id:u.id,expires_at:new Date(Date.now()+Qr*1e3).toISOString(),redirect_uri:r.redirect_uri}),await Ql(t,{code:f,to:o,authParams:r}),t.redirect(`/u/enter-code?state=${u.id}`)}return e?t.redirect(`/u/check-account?state=${u.id}`):t.redirect(`/u/login/identifier?state=${u.id}`)}function e$(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new A(403,{message:"Invalid realm"})}async function t$(t,e,n,r,i){var m;const{env:o}=t;t.set("connection",i);const a=await o.data.codes.get(e,n,"ticket");if(!a||a.used_at)throw new A(403,{message:"Ticket not found"});const c=await o.data.loginSessions.get(e,a.login_id);if(!c||!c.authParams.username)throw new A(403,{message:"Session not found"});const d=await o.data.clients.get(c.authParams.client_id);if(!d)throw new A(403,{message:"Client not found"});t.set("client_id",c.authParams.client_id),await o.data.codes.used(e,n);const l=e$(i);let u=await Es(t,{username:c.authParams.username,provider:l,client:d,connection:l==="auth2"?"Username-Password-Authentication":"email",isSocial:!1,ip:t.req.header("x-real-ip")});t.set("username",u.email||u.phone_number),t.set("user_id",u.user_id);const f=await w0(t,{user:u,client:d,loginSession:c});return Zt(t,{authParams:{scope:(m=c.authParams)==null?void 0:m.scope,...r},loginSession:c,sessionId:f.id,user:u,client:d})}async function eh(t,e){return`<!DOCTYPE html>
|
|
155
155
|
<html>
|
|
156
156
|
|
|
157
157
|
<head>
|
|
@@ -194,7 +194,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
194
194
|
<\/script>
|
|
195
195
|
</body>
|
|
196
196
|
|
|
197
|
-
</html>`}async function n$({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:o,code_challenge_method:a,code_challenge:c,audience:d,scope:l,response_type:u}){const{env:f}=t,m=new URL(r),w=`${m.protocol}//${m.host}`;async function h(se="Login required"){const ae=we(t,{type:he.FAILED_SILENT_AUTH,description:se});return await t.env.data.logs.create(e.tenant.id,ae),t.html(eh(w,JSON.stringify({error:"login_required",error_description:se,state:i})))}if(!n||(n==null?void 0:n.expires_at)&&new Date(n.expires_at)<new Date||(n==null?void 0:n.idle_expires_at)&&new Date(n.idle_expires_at)<new Date)return h();t.set("user_id",n.user_id);const v=await f.data.users.get(e.tenant.id,n.user_id);if(!v)return console.error("User not found",n.user_id),h("User not found");t.set("username",v.email),t.set("connection",v.connection);const b={client:e,authParams:{client_id:e.id,audience:d,code_challenge_method:a,code_challenge:c,scope:l,state:i,nonce:o,response_type:u,redirect_uri:r},user:v,session_id:n.id},E=u===it.CODE?await y0(t,{user:v,client:e,authParams:b.authParams,login_id:n.login_session_id}):await As(t,b);await f.data.sessions.update(e.tenant.id,n.id,{used_at:new Date().toISOString(),last_interaction_at:new Date().toISOString(),device:{...n.device,last_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||""},idle_expires_at:n.idle_expires_at?new Date(Date.now()+ks*1e3).toISOString():void 0});const C=we(t,{type:he.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,C);const L=new Headers;L.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const Y=rc(e.tenant.id,n.id,t.req.header("host"));return L.set("set-cookie",Y),t.html(eh(w,JSON.stringify(E)),{headers:L})}const r$=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),vendor_id:s.z.string().optional(),redirect_uri:s.z.string(),scope:s.z.string().optional(),state:s.z.string(),prompt:s.z.string().optional(),response_mode:s.z.nativeEnum(Dt).optional(),response_type:s.z.nativeEnum(it).optional(),audience:s.z.string().optional(),connection:s.z.string().optional(),nonce:s.z.string().optional(),max_age:s.z.string().optional(),login_ticket:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(vs).optional(),code_challenge:s.z.string().optional(),realm:s.z.string().optional(),auth0Client:s.z.string().optional(),organization:s.z.string().optional(),login_hint:s.z.string().optional(),screen_hint:s.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:s.z.string().optional()})},responses:{200:{description:"Successful authorization response. This can be an HTML page (e.g., for silent authentication iframe or universal login page) or a JSON object containing tokens (e.g., for response_mode=web_message).",content:{"text/html":{schema:s.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:Vd}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:o,state:a,audience:c,nonce:d,connection:l,response_type:u,response_mode:f,code_challenge:m,code_challenge_method:w,prompt:h,login_ticket:y,realm:v,auth0Client:b,login_hint:E,ui_locales:C,organization:L}=t.req.valid("query");t.set("log","authorize");const Y=await Ui(e,n);t.set("client_id",Y.id),t.set("tenant_id",Y.tenant.id);const se={redirect_uri:i,scope:o,state:a,client_id:n,vendor_id:r,audience:c,nonce:d,prompt:h,response_type:u,response_mode:f,code_challenge:m,code_challenge_method:w,username:E,ui_locales:C,organization:L},ae=t.req.header("origin");if(ae&&!Y4(ae,Y.web_origins||[]))throw new A(403,{message:`Origin ${ae} not allowed`});if(se.redirect_uri&&!xm(se.redirect_uri,Y.callbacks||[],{allowPathWildcards:!0}))throw new A(400,{message:`Invalid redirect URI - ${se.redirect_uri}`});const Se=zo(Y.tenant.id,t.req.header("cookie")),ze=Se?await e.data.sessions.get(Y.tenant.id,Se):void 0,Ce=ze&&!ze.revoked_at?ze:void 0;if(h=="none"){if(!u)throw new A(400,{message:"Missing response_type"});return n$({ctx:t,session:Ce||void 0,redirect_uri:i,state:a,response_type:u,client:Y,nonce:d,code_challenge_method:w,code_challenge:m,audience:c,scope:o})}if(l&&l!=="email")return Eb(t,Y,l,se);if(y){const N=await t$(t,Y.tenant.id,y,se,v);return N instanceof Response?N:t.json(N)}const j=await Q4({ctx:t,client:Y,auth0Client:b,authParams:se,session:Ce||void 0,connection:l,login_hint:E});return j instanceof Response?j:t.json(j)});function i$(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Es(r,t.dataAdapter),a=Vl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=Fl(r,a),i()}),e.use("/oauth/token",bh({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(Dl).use(fm(e));const n=e.route("/v2/logout",Nb).route("/userinfo",Cb).route("/.well-known",jb).route("/oauth/token",H4).route("/dbconnections",W4).route("/passwordless",J4).route("/co/authenticate",Z4).route("/authorize",r$).route("/callback",zb);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),pm(n),n}var o$={Stringify:1,BeforeStream:2,Stream:3},yt=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},s$=/[&<>'"]/,Bm=async(t,e)=>{let n="";e||(e=[]);const r=await Promise.all(t);for(let i=r.length-1;n+=r[i],i--,!(i<0);i--){let o=r[i];typeof o=="object"&&e.push(...o.callbacks||[]);const a=o.isEscaped;if(o=await(typeof o=="object"?o.toString():o),typeof o=="object"&&e.push(...o.callbacks||[]),o.isEscaped??a)n+=o;else{const c=[n];dn(o,c),n=c[0]}}return yt(n,e)},dn=(t,e)=>{const n=t.search(s$);if(n===-1){e[0]+=t;return}let r,i,o=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r=""";break;case 39:r="'";break;case 38:r="&";break;case 60:r="<";break;case 62:r=">";break;default:continue}e[0]+=t.substring(o,i)+r,o=i+1}e[0]+=t.substring(o,i)},Lm=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:o$.Stringify,buffer:n,context:r})),n[0]},Um=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const o=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let a=0,c=o.length;a<c;a++){const d=o[a];if(typeof d=="string")dn(d,n);else if(typeof d=="number")n[0]+=d;else{if(typeof d=="boolean"||d===null||d===void 0)continue;if(typeof d=="object"&&d.isEscaped)if(d.callbacks)n.unshift("",d);else{const l=d.toString();l instanceof Promise?n.unshift("",l):n[0]+=l}else d instanceof Promise?n.unshift("",d):dn(d.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?yt(Lm(yt(n[0],n.callbacks))):yt(n[0]):Bm(n,n.callbacks)},nu=Symbol("RENDERER"),Cd=Symbol("ERROR_HANDLER"),Ee=Symbol("STASH"),Mm=Symbol("INTERNAL"),a$=Symbol("MEMO"),hs=Symbol("PERMALINK"),th=t=>(t[Mm]=!0,t),Fm=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:th(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:th(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[Cd]=o=>{throw t.pop(),o},i},Dm=t=>{const e=[t],n=Fm(e);return n.values=e,n.Provider=n,br.push(n),n},br=[],c$=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new Km("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(o=>yt(o,o.callbacks)):yt(i)};return n.values=e,n.Provider=n,n[nu]=Fm(e),br.push(n),n},Tr=t=>t.values.at(-1),uo={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},jd={},po="data-precedence",Fi=t=>Array.isArray(t)?t:[t],nh=new WeakMap,rh=(t,e,n,r)=>({buffer:i,context:o})=>{if(!i)return;const a=nh.get(o)||{};nh.set(o,a);const c=a[t]||(a[t]=[]);let d=!1;const l=uo[t];if(l.length>0){e:for(const[,u]of c)for(const f of l)if(((u==null?void 0:u[f])??null)===(n==null?void 0:n[f])){d=!0;break e}}if(d?i[0]=i[0].replaceAll(e,""):l.length>0?c.push([e,n,r]):c.unshift([e,n,r]),i[0].indexOf("</head>")!==-1){let u;if(r===void 0)u=c.map(([f])=>f);else{const f=[];u=c.map(([m,,w])=>{let h=f.indexOf(w);return h===-1&&(f.push(w),h=f.length-1),[m,h]}).sort((m,w)=>m[1]-w[1]).map(([m])=>m)}u.forEach(f=>{i[0]=i[0].replaceAll(f,"")}),i[0]=i[0].replace(/(?=<\/head>)/,u.join(""))}},Di=(t,e,n)=>yt(new wt(t,n,Fi(e??[])).toString()),Vi=(t,e,n,r)=>{if("itemProp"in n)return Di(t,e,n);let{precedence:i,blocking:o,...a}=n;i=r?i??"":void 0,r&&(a[po]=i);const c=new wt(t,a,Fi(e||[])).toString();return c instanceof Promise?c.then(d=>yt(c,[...d.callbacks||[],rh(t,d,a,i)])):yt(c,[rh(t,c,a,i)])},d$=({children:t,...e})=>{const n=ru();if(n){const r=Tr(n);if(r==="svg"||r==="head")return new wt("title",e,Fi(t??[]))}return Vi("title",t,e,!1)},l$=({children:t,...e})=>{const n=ru();return["src","async"].some(r=>!e[r])||n&&Tr(n)==="head"?Di("script",t,e):Vi("script",t,e,!1)},u$=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,Vi("style",t,e,!0)):Di("style",t,e),p$=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?Di("link",t,e):Vi("link",t,e,"precedence"in e),f$=({children:t,...e})=>{const n=ru();return n&&Tr(n)==="head"?Di("meta",t,e):Vi("meta",t,e,!1)},Vm=(t,{children:e,...n})=>new wt(t,n,Fi(e??[])),h$=t=>(typeof t.action=="function"&&(t.action=hs in t.action?t.action[hs]:void 0),Vm("form",t)),qm=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=hs in e.formAction?e.formAction[hs]:void 0),Vm(t,e)),g$=t=>qm("input",t),m$=t=>qm("button",t);const qa=Object.freeze(Object.defineProperty({__proto__:null,button:m$,form:h$,input:g$,link:p$,meta:f$,script:l$,style:u$,title:d$},Symbol.toStringTag,{value:"Module"}));var _$=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),gs=t=>_$.get(t)||t,Hm=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e(i,r==null?null:typeof r=="number"?i.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`:r)}},_i=void 0,ru=()=>_i,y$=t=>/[A-Z]/.test(t)&&t.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/)?t.replace(/([A-Z])/g,"-$1").toLowerCase():t,w$=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],v$=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],iu=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")dn(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof wt?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):iu(i,e)}}},wt=class{constructor(t,e,n){te(this,"tag");te(this,"props");te(this,"key");te(this,"children");te(this,"isEscaped",!0);te(this,"localContexts");this.tag=t,this.props=e,this.children=n}get type(){return this.tag}get ref(){return this.props.ref||null}toString(){var e,n;const t=[""];(e=this.localContexts)==null||e.forEach(([r,i])=>{r.values.push(i)});try{this.toStringToBuffer(t)}finally{(n=this.localContexts)==null||n.forEach(([r])=>{r.values.pop()})}return t.length===1?"callbacks"in t?Lm(yt(t[0],t.callbacks)).toString():t[0]:Bm(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=_i&&Tr(_i)==="svg"?o=>y$(gs(o)):o=>gs(o);for(let[o,a]of Object.entries(n))if(o=i(o),o!=="children"){if(o==="style"&&typeof a=="object"){let c="";Hm(a,(d,l)=>{l!=null&&(c+=`${c?";":""}${d}:${l}`)}),t[0]+=' style="',dn(c,t),t[0]+='"'}else if(typeof a=="string")t[0]+=` ${o}="`,dn(a,t),t[0]+='"';else if(a!=null)if(typeof a=="number"||a.isEscaped)t[0]+=` ${o}="${a}"`;else if(typeof a=="boolean"&&v$.includes(o))a&&(t[0]+=` ${o}=""`);else if(o==="dangerouslySetInnerHTML"){if(r.length>0)throw"Can only set one of `children` or `props.dangerouslySetInnerHTML`.";r=[yt(a.__html)]}else if(a instanceof Promise)t[0]+=` ${o}="`,t.unshift('"',a);else if(typeof a=="function"){if(!o.startsWith("on"))throw`Invalid prop '${o}' of type 'function' supplied to '${e}'.`}else t[0]+=` ${o}="`,dn(a.toString(),t),t[0]+='"'}if(w$.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",iu(r,t),t[0]+=`</${e}>`}},Ha=class extends wt{toStringToBuffer(t){const{children:e}=this,n=this.tag.call(null,{...this.props,children:e.length<=1?e[0]:e});if(!(typeof n=="boolean"||n==null))if(n instanceof Promise)if(br.length===0)t.unshift("",n);else{const r=br.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof wt&&(i.localContexts=r),i)))}else n instanceof wt?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):dn(n,t)}},Km=class extends wt{toStringToBuffer(t){iu(this.children,t)}},b$=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=fo(t,e,n);return i.key=r,i},ih=!1,fo=(t,e,n)=>{if(!ih){for(const r in jd)qa[r][nu]=jd[r];ih=!0}return typeof t=="function"?new Ha(t,e,n):qa[t]?new Ha(qa[t],e,n):t==="svg"||t==="head"?(_i||(_i=c$("")),new wt(t,e,[new Ha(_i,{value:t},n)])):new wt(t,e,n)},ou=({children:t})=>new Km("",{children:t},Array.isArray(t)?t:t?[t]:[]),$$=(t,e,...n)=>b$(t.tag,{...t.props,...e},...n);function _(t,e,n){let r;if(!e||!("children"in e))r=fo(t,e,[]);else{const i=e.children;r=Array.isArray(i)?fo(t,e,i):fo(t,e,[i])}return r.key=n,r}const oh={name:"sesamy",logoUrl:"https://assets.sesamy.com/static/images/email/sesamy-logo.png",style:{primaryColor:"#7D68F4",buttonTextColor:"#FFFFFF",primaryHoverColor:"#A091F2"},loginBackgroundImage:"",checkoutHideSocial:!1,supportEmail:"support@sesamy.com",supportUrl:"https://support.sesamy.com",siteUrl:"https://sesamy.com",termsAndConditionsUrl:"https://store.sesamy.com/pages/terms-of-service",manageSubscriptionsUrl:"https://account.sesamy.com/manage-subscriptions"};async function Gm(t,e,n){if(!n&&!e)return oh;const r=n||e;try{const i=await fetch(`${t.API_URL}/profile/vendors/${r}/style`);if(!i.ok)throw new Error("Failed to fetch vendor settings");const o=await i.json();return Uh.parse(o)}catch(i){return console.error(i),oh}}async function ke(t,e,n=!1){var l;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new A(400,{message:"Login session not found"});t.set("loginSession",i);const o=await Ui(r,i.authParams.client_id);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const a=await r.data.tenants.get(o.tenant.id);if(a){if(i.session_id&&!n)throw new A(400,{message:"Login session closed"})}else throw new A(400,{message:"Tenant not found"});const c=await Gm(r,o.id,i.authParams.vendor_id),d=(l=i.authParams.ui_locales)==null?void 0:l.split(" ").map(u=>u.split("-")[0]).find(u=>{if(Array.isArray(O.options.supportedLngs))return O.options.supportedLngs.includes(u)});return await O.changeLanguage(d||a.language||"sv"),{vendorSettings:{...c,termsAndConditionsUrl:o.id==="fokus-app"?"https://www.fokus.se/kopvillkor-app/":c.termsAndConditionsUrl},client:o,tenant:a,loginSession:i}}async function x$(t,e,n,r){if(r!==void 0)return r==="password";const i=await zs({userAdapter:t.env.data.users,tenant_id:e.tenant.id,email:n});if(i){const a=await t.env.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,sort:{sort_by:"date",sort_order:"desc"},q:`type:${he.SUCCESS_LOGIN} user_id:${i.user_id}`}),[c]=a.logs.filter(d=>d.strategy&&["Username-Password-Authentication","passwordless","email"].includes(d.strategy));if(c)return c.strategy==="Username-Password-Authentication"}return(await t.env.data.promptSettings.get(e.tenant.id)).password_first}const Wm=({vendorSettings:t})=>t!=null&&t.logoUrl?_("div",{className:"flex h-9 items-center",children:_("img",{src:t.logoUrl,className:"max-h-full",alt:"Vendor logo"})}):_(ou,{}),Jm=({vendorSettings:t})=>{const{termsAndConditionsUrl:e}=t;return _("div",{className:"mt-8",children:e&&_("div",{className:"text-xs text-gray-300",children:[O.t("agree_to")," ",_("a",{href:e,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:O.t("terms")})]})})};var Xm={exports:{}};/*!
|
|
197
|
+
</html>`}async function n$({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:o,code_challenge_method:a,code_challenge:c,audience:d,scope:l,response_type:u}){const{env:f}=t,m=new URL(r),w=`${m.protocol}//${m.host}`;async function h(se="Login required"){const ae=we(t,{type:he.FAILED_SILENT_AUTH,description:se});return await t.env.data.logs.create(e.tenant.id,ae),t.html(eh(w,JSON.stringify({error:"login_required",error_description:se,state:i})))}if(!n||(n==null?void 0:n.expires_at)&&new Date(n.expires_at)<new Date||(n==null?void 0:n.idle_expires_at)&&new Date(n.idle_expires_at)<new Date)return h();t.set("user_id",n.user_id);const v=await f.data.users.get(e.tenant.id,n.user_id);if(!v)return console.error("User not found",n.user_id),h("User not found");t.set("username",v.email),t.set("connection",v.connection);const b={client:e,authParams:{client_id:e.id,audience:d,code_challenge_method:a,code_challenge:c,scope:l,state:i,nonce:o,response_type:u,redirect_uri:r},user:v,session_id:n.id},E=u===it.CODE?await y0(t,{user:v,client:e,authParams:b.authParams,login_id:n.login_session_id}):await Ss(t,b);await f.data.sessions.update(e.tenant.id,n.id,{used_at:new Date().toISOString(),last_interaction_at:new Date().toISOString(),device:{...n.device,last_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||""},idle_expires_at:n.idle_expires_at?new Date(Date.now()+xs*1e3).toISOString():void 0});const C=we(t,{type:he.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,C);const L=new Headers;L.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const Y=nc(e.tenant.id,n.id,t.req.header("host"));return L.set("set-cookie",Y),t.html(eh(w,JSON.stringify(E)),{headers:L})}const r$=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),vendor_id:s.z.string().optional(),redirect_uri:s.z.string(),scope:s.z.string().optional(),state:s.z.string(),prompt:s.z.string().optional(),response_mode:s.z.nativeEnum(Dt).optional(),response_type:s.z.nativeEnum(it).optional(),audience:s.z.string().optional(),connection:s.z.string().optional(),nonce:s.z.string().optional(),max_age:s.z.string().optional(),login_ticket:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(ws).optional(),code_challenge:s.z.string().optional(),realm:s.z.string().optional(),auth0Client:s.z.string().optional(),organization:s.z.string().optional(),login_hint:s.z.string().optional(),screen_hint:s.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:s.z.string().optional()})},responses:{200:{description:"Successful authorization response. This can be an HTML page (e.g., for silent authentication iframe or universal login page) or a JSON object containing tokens (e.g., for response_mode=web_message).",content:{"text/html":{schema:s.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:Dd}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:o,state:a,audience:c,nonce:d,connection:l,response_type:u,response_mode:f,code_challenge:m,code_challenge_method:w,prompt:h,login_ticket:y,realm:v,auth0Client:b,login_hint:E,ui_locales:C,organization:L}=t.req.valid("query");t.set("log","authorize");const Y=await Ui(e,n);t.set("client_id",Y.id),t.set("tenant_id",Y.tenant.id);const se={redirect_uri:i,scope:o,state:a,client_id:n,vendor_id:r,audience:c,nonce:d,prompt:h,response_type:u,response_mode:f,code_challenge:m,code_challenge_method:w,username:E,ui_locales:C,organization:L},ae=t.req.header("origin");if(ae&&!Y4(ae,Y.web_origins||[]))throw new A(403,{message:`Origin ${ae} not allowed`});if(se.redirect_uri&&!xm(se.redirect_uri,Y.callbacks||[],{allowPathWildcards:!0}))throw new A(400,{message:`Invalid redirect URI - ${se.redirect_uri}`});const Se=zo(Y.tenant.id,t.req.header("cookie")),ze=Se?await e.data.sessions.get(Y.tenant.id,Se):void 0,Ce=ze&&!ze.revoked_at?ze:void 0;if(h=="none"){if(!u)throw new A(400,{message:"Missing response_type"});return n$({ctx:t,session:Ce||void 0,redirect_uri:i,state:a,response_type:u,client:Y,nonce:d,code_challenge_method:w,code_challenge:m,audience:c,scope:o})}if(l&&l!=="email")return Eb(t,Y,l,se);if(y){const N=await t$(t,Y.tenant.id,y,se,v);return N instanceof Response?N:t.json(N)}const j=await Q4({ctx:t,client:Y,auth0Client:b,authParams:se,session:Ce||void 0,connection:l,login_hint:E});return j instanceof Response?j:t.json(j)});function i$(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=As(r,t.dataAdapter),a=Vl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=Fl(r,a),i()}),e.use("/oauth/token",bh({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(Dl).use(fm(e));const n=e.route("/v2/logout",Nb).route("/userinfo",Cb).route("/.well-known",jb).route("/oauth/token",H4).route("/dbconnections",W4).route("/passwordless",J4).route("/co/authenticate",Z4).route("/authorize",r$).route("/callback",zb);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),pm(n),n}var o$={Stringify:1,BeforeStream:2,Stream:3},yt=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},s$=/[&<>'"]/,Bm=async(t,e)=>{let n="";e||(e=[]);const r=await Promise.all(t);for(let i=r.length-1;n+=r[i],i--,!(i<0);i--){let o=r[i];typeof o=="object"&&e.push(...o.callbacks||[]);const a=o.isEscaped;if(o=await(typeof o=="object"?o.toString():o),typeof o=="object"&&e.push(...o.callbacks||[]),o.isEscaped??a)n+=o;else{const c=[n];dn(o,c),n=c[0]}}return yt(n,e)},dn=(t,e)=>{const n=t.search(s$);if(n===-1){e[0]+=t;return}let r,i,o=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r=""";break;case 39:r="'";break;case 38:r="&";break;case 60:r="<";break;case 62:r=">";break;default:continue}e[0]+=t.substring(o,i)+r,o=i+1}e[0]+=t.substring(o,i)},Lm=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:o$.Stringify,buffer:n,context:r})),n[0]},Um=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const o=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let a=0,c=o.length;a<c;a++){const d=o[a];if(typeof d=="string")dn(d,n);else if(typeof d=="number")n[0]+=d;else{if(typeof d=="boolean"||d===null||d===void 0)continue;if(typeof d=="object"&&d.isEscaped)if(d.callbacks)n.unshift("",d);else{const l=d.toString();l instanceof Promise?n.unshift("",l):n[0]+=l}else d instanceof Promise?n.unshift("",d):dn(d.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?yt(Lm(yt(n[0],n.callbacks))):yt(n[0]):Bm(n,n.callbacks)},nu=Symbol("RENDERER"),Nd=Symbol("ERROR_HANDLER"),Ee=Symbol("STASH"),Mm=Symbol("INTERNAL"),a$=Symbol("MEMO"),fs=Symbol("PERMALINK"),th=t=>(t[Mm]=!0,t),Fm=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:th(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:th(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[Nd]=o=>{throw t.pop(),o},i},Dm=t=>{const e=[t],n=Fm(e);return n.values=e,n.Provider=n,br.push(n),n},br=[],c$=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new Km("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(o=>yt(o,o.callbacks)):yt(i)};return n.values=e,n.Provider=n,n[nu]=Fm(e),br.push(n),n},Tr=t=>t.values.at(-1),uo={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},Cd={},po="data-precedence",Fi=t=>Array.isArray(t)?t:[t],nh=new WeakMap,rh=(t,e,n,r)=>({buffer:i,context:o})=>{if(!i)return;const a=nh.get(o)||{};nh.set(o,a);const c=a[t]||(a[t]=[]);let d=!1;const l=uo[t];if(l.length>0){e:for(const[,u]of c)for(const f of l)if(((u==null?void 0:u[f])??null)===(n==null?void 0:n[f])){d=!0;break e}}if(d?i[0]=i[0].replaceAll(e,""):l.length>0?c.push([e,n,r]):c.unshift([e,n,r]),i[0].indexOf("</head>")!==-1){let u;if(r===void 0)u=c.map(([f])=>f);else{const f=[];u=c.map(([m,,w])=>{let h=f.indexOf(w);return h===-1&&(f.push(w),h=f.length-1),[m,h]}).sort((m,w)=>m[1]-w[1]).map(([m])=>m)}u.forEach(f=>{i[0]=i[0].replaceAll(f,"")}),i[0]=i[0].replace(/(?=<\/head>)/,u.join(""))}},Di=(t,e,n)=>yt(new wt(t,n,Fi(e??[])).toString()),Vi=(t,e,n,r)=>{if("itemProp"in n)return Di(t,e,n);let{precedence:i,blocking:o,...a}=n;i=r?i??"":void 0,r&&(a[po]=i);const c=new wt(t,a,Fi(e||[])).toString();return c instanceof Promise?c.then(d=>yt(c,[...d.callbacks||[],rh(t,d,a,i)])):yt(c,[rh(t,c,a,i)])},d$=({children:t,...e})=>{const n=ru();if(n){const r=Tr(n);if(r==="svg"||r==="head")return new wt("title",e,Fi(t??[]))}return Vi("title",t,e,!1)},l$=({children:t,...e})=>{const n=ru();return["src","async"].some(r=>!e[r])||n&&Tr(n)==="head"?Di("script",t,e):Vi("script",t,e,!1)},u$=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,Vi("style",t,e,!0)):Di("style",t,e),p$=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?Di("link",t,e):Vi("link",t,e,"precedence"in e),f$=({children:t,...e})=>{const n=ru();return n&&Tr(n)==="head"?Di("meta",t,e):Vi("meta",t,e,!1)},Vm=(t,{children:e,...n})=>new wt(t,n,Fi(e??[])),h$=t=>(typeof t.action=="function"&&(t.action=fs in t.action?t.action[fs]:void 0),Vm("form",t)),qm=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=fs in e.formAction?e.formAction[fs]:void 0),Vm(t,e)),g$=t=>qm("input",t),m$=t=>qm("button",t);const Va=Object.freeze(Object.defineProperty({__proto__:null,button:m$,form:h$,input:g$,link:p$,meta:f$,script:l$,style:u$,title:d$},Symbol.toStringTag,{value:"Module"}));var _$=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),hs=t=>_$.get(t)||t,Hm=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e(i,r==null?null:typeof r=="number"?i.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`:r)}},_i=void 0,ru=()=>_i,y$=t=>/[A-Z]/.test(t)&&t.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/)?t.replace(/([A-Z])/g,"-$1").toLowerCase():t,w$=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],v$=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],iu=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")dn(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof wt?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):iu(i,e)}}},wt=class{constructor(t,e,n){te(this,"tag");te(this,"props");te(this,"key");te(this,"children");te(this,"isEscaped",!0);te(this,"localContexts");this.tag=t,this.props=e,this.children=n}get type(){return this.tag}get ref(){return this.props.ref||null}toString(){var e,n;const t=[""];(e=this.localContexts)==null||e.forEach(([r,i])=>{r.values.push(i)});try{this.toStringToBuffer(t)}finally{(n=this.localContexts)==null||n.forEach(([r])=>{r.values.pop()})}return t.length===1?"callbacks"in t?Lm(yt(t[0],t.callbacks)).toString():t[0]:Bm(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=_i&&Tr(_i)==="svg"?o=>y$(hs(o)):o=>hs(o);for(let[o,a]of Object.entries(n))if(o=i(o),o!=="children"){if(o==="style"&&typeof a=="object"){let c="";Hm(a,(d,l)=>{l!=null&&(c+=`${c?";":""}${d}:${l}`)}),t[0]+=' style="',dn(c,t),t[0]+='"'}else if(typeof a=="string")t[0]+=` ${o}="`,dn(a,t),t[0]+='"';else if(a!=null)if(typeof a=="number"||a.isEscaped)t[0]+=` ${o}="${a}"`;else if(typeof a=="boolean"&&v$.includes(o))a&&(t[0]+=` ${o}=""`);else if(o==="dangerouslySetInnerHTML"){if(r.length>0)throw"Can only set one of `children` or `props.dangerouslySetInnerHTML`.";r=[yt(a.__html)]}else if(a instanceof Promise)t[0]+=` ${o}="`,t.unshift('"',a);else if(typeof a=="function"){if(!o.startsWith("on"))throw`Invalid prop '${o}' of type 'function' supplied to '${e}'.`}else t[0]+=` ${o}="`,dn(a.toString(),t),t[0]+='"'}if(w$.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",iu(r,t),t[0]+=`</${e}>`}},qa=class extends wt{toStringToBuffer(t){const{children:e}=this,n=this.tag.call(null,{...this.props,children:e.length<=1?e[0]:e});if(!(typeof n=="boolean"||n==null))if(n instanceof Promise)if(br.length===0)t.unshift("",n);else{const r=br.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof wt&&(i.localContexts=r),i)))}else n instanceof wt?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):dn(n,t)}},Km=class extends wt{toStringToBuffer(t){iu(this.children,t)}},b$=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=fo(t,e,n);return i.key=r,i},ih=!1,fo=(t,e,n)=>{if(!ih){for(const r in Cd)Va[r][nu]=Cd[r];ih=!0}return typeof t=="function"?new qa(t,e,n):Va[t]?new qa(Va[t],e,n):t==="svg"||t==="head"?(_i||(_i=c$("")),new wt(t,e,[new qa(_i,{value:t},n)])):new wt(t,e,n)},ou=({children:t})=>new Km("",{children:t},Array.isArray(t)?t:t?[t]:[]),$$=(t,e,...n)=>b$(t.tag,{...t.props,...e},...n);function _(t,e,n){let r;if(!e||!("children"in e))r=fo(t,e,[]);else{const i=e.children;r=Array.isArray(i)?fo(t,e,i):fo(t,e,[i])}return r.key=n,r}const oh={name:"sesamy",logoUrl:"https://assets.sesamy.com/static/images/email/sesamy-logo.png",style:{primaryColor:"#7D68F4",buttonTextColor:"#FFFFFF",primaryHoverColor:"#A091F2"},loginBackgroundImage:"",checkoutHideSocial:!1,supportEmail:"support@sesamy.com",supportUrl:"https://support.sesamy.com",siteUrl:"https://sesamy.com",termsAndConditionsUrl:"https://store.sesamy.com/pages/terms-of-service",manageSubscriptionsUrl:"https://account.sesamy.com/manage-subscriptions"};async function Gm(t,e,n){if(!n&&!e)return oh;const r=n||e;try{const i=await fetch(`${t.API_URL}/profile/vendors/${r}/style`);if(!i.ok)throw new Error("Failed to fetch vendor settings");const o=await i.json();return Uh.parse(o)}catch(i){return console.error(i),oh}}async function ke(t,e,n=!1){var l;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new A(400,{message:"Login session not found"});t.set("loginSession",i);const o=await Ui(r,i.authParams.client_id);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const a=await r.data.tenants.get(o.tenant.id);if(a){if(i.session_id&&!n)throw new A(400,{message:"Login session closed"})}else throw new A(400,{message:"Tenant not found"});const c=await Gm(r,o.id,i.authParams.vendor_id),d=(l=i.authParams.ui_locales)==null?void 0:l.split(" ").map(u=>u.split("-")[0]).find(u=>{if(Array.isArray(O.options.supportedLngs))return O.options.supportedLngs.includes(u)});return await O.changeLanguage(d||a.language||"sv"),{vendorSettings:{...c,termsAndConditionsUrl:o.id==="fokus-app"?"https://www.fokus.se/kopvillkor-app/":c.termsAndConditionsUrl},client:o,tenant:a,loginSession:i}}async function x$(t,e,n,r){if(r!==void 0)return r==="password";const i=await Zd({userAdapter:t.env.data.users,tenant_id:e.tenant.id,email:n});if(i){const a=await t.env.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,sort:{sort_by:"date",sort_order:"desc"},q:`type:${he.SUCCESS_LOGIN} user_id:${i.user_id}`}),[c]=a.logs.filter(d=>d.strategy&&["Username-Password-Authentication","passwordless","email"].includes(d.strategy));if(c)return c.strategy==="Username-Password-Authentication"}return(await t.env.data.promptSettings.get(e.tenant.id)).password_first}const Wm=({vendorSettings:t})=>t!=null&&t.logoUrl?_("div",{className:"flex h-9 items-center",children:_("img",{src:t.logoUrl,className:"max-h-full",alt:"Vendor logo"})}):_(ou,{}),Jm=({vendorSettings:t})=>{const{termsAndConditionsUrl:e}=t;return _("div",{className:"mt-8",children:e&&_("div",{className:"text-xs text-gray-300",children:[O.t("agree_to")," ",_("a",{href:e,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:O.t("terms")})]})})};var Xm={exports:{}};/*!
|
|
198
198
|
Copyright (c) 2018 Jed Watson.
|
|
199
199
|
Licensed under the MIT License (MIT), see
|
|
200
200
|
http://jedwatson.github.io/classnames
|
|
@@ -221,7 +221,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
221
221
|
<\/script>
|
|
222
222
|
`])))]})},Gn=({children:t})=>_("div",{className:"mb-2 text-sm text-red",children:t}),N$=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",Zm=({size:t})=>{const e=N$(t);return _("div",{className:"relative inline-block leading-[0]",children:[_(Be,{className:fn("text-gray-200 dark:text-[#201a41]",{[e]:e}),name:"spinner-circle"}),_(Be,{className:fn("absolute inset-0 animate-spin text-primary",{[e]:e}),name:"spinner-inner"})]})},Le=({children:t,className:e,Component:n="button",variant:r="primary",href:i,disabled:o,isLoading:a,id:c})=>{const d=n==="a"?{href:i}:{};return _(n,{class:fn("btn relative w-full rounded-lg text-center",{"px-4 py-5":r!=="custom","bg-primary text-textOnPrimary hover:bg-primaryHover":r==="primary","border border-gray-300 bg-white text-black":r==="secondary","pointer-events-none cursor-not-allowed opacity-40":o,"is-loading":a},"focus:outline-none focus:ring",e),type:"submit",disabled:o,id:c,...d,children:[_("span",{className:"btn-label flex items-center justify-center space-x-2",children:t}),_("div",{className:"btn-spinner absolute left-0 top-0 flex h-full w-full items-center justify-center",children:_(Zm,{size:"medium"})})]})},Fr=({connection:t,text:e,icon:n=null,canResize:r=!1,loginSession:i})=>{const o=new URLSearchParams({client_id:i.authParams.client_id,connection:t});i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.redirect_uri&&o.set("redirect_uri",i.authParams.redirect_uri),i.authParams.scope&&o.set("scope",i.authParams.scope),i.authParams.nonce&&o.set("nonce",i.authParams.nonce),i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.state&&o.set("state",i.id);const a=`/authorize?${o.toString()}`;return _(Le,{className:fn("border border-gray-200 bg-white hover:bg-gray-100 dark:border-gray-400 dark:bg-black dark:hover:bg-black/90",{"px-0 py-3 sm:px-10 sm:py-4 short:px-0 short:py-3":r,"px-10 py-3":!r}),variant:"custom","aria-label":e,Component:"a",href:a,children:[n||"",_("div",{className:fn("text-left text-black dark:text-white sm:text-base",{"hidden sm:inline short:hidden":r}),children:e})]})},Ym=({...t})=>_("svg",{width:"45",height:"45",viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",...t,children:[_("path",{d:"M44.1035 23.0123C44.1054 21.4791 43.9758 19.9486 43.716 18.4375H22.498V27.1028H34.6507C34.4021 28.4868 33.8757 29.8061 33.1034 30.9812C32.3311 32.1562 31.3289 33.1628 30.1571 33.9401V39.5649H37.41C41.6567 35.6494 44.1035 29.859 44.1035 23.0123Z",fill:"#4285F4"}),_("path",{d:"M22.4982 44.9997C28.5698 44.9997 33.6821 43.0061 37.4101 39.5687L30.1573 33.9439C28.1386 35.3126 25.5387 36.0938 22.4982 36.0938C16.6296 36.0938 11.6485 32.1377 9.86736 26.8066H2.39575V32.6033C4.26839 36.3297 7.13989 39.4622 10.6896 41.6512C14.2394 43.8402 18.3277 44.9995 22.4982 44.9997Z",fill:"#34A853"}),_("path",{d:"M9.86737 26.8073C8.92572 24.0138 8.92572 20.9886 9.86737 18.1951V12.3984H2.39576C0.820432 15.5332 0 18.9929 0 22.5012C0 26.0095 0.820432 29.4692 2.39576 32.604L9.86737 26.8073Z",fill:"#FBBC04"}),_("path",{d:"M22.4982 8.90741C25.7068 8.85499 28.8071 10.0673 31.1291 12.2823L37.5507 5.86064C33.4788 2.03602 28.0843 -0.0637686 22.4982 0.00147616C18.3277 0.00166623 14.2394 1.16098 10.6896 3.34999C7.13989 5.539 4.26839 8.67155 2.39575 12.3979L9.86736 18.1946C11.6485 12.8635 16.6296 8.90741 22.4982 8.90741Z",fill:"#EA4335"})]}),tn=({children:t,className:e})=>_("form",{id:"form",method:"post",className:e,children:t}),Qm=({...t})=>_("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 48 48",enableBackground:"new 0 0 48 48",width:"45",height:"45",...t,children:[_("path",{fill:"#FF5B24",d:"M3.5,8h41c1.9,0,3.5,1.6,3.5,3.5v25c0,1.9-1.6,3.5-3.5,3.5h-41C1.6,40,0,38.4,0,36.5v-25C0,9.6,1.6,8,3.5,8z"}),_("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FFFFFF",d:`M27.9,20.3c1.4,0,2.6-1,2.6-2.5h0c0-1.5-1.2-2.5-2.6-2.5c-1.4,0-2.6,1-2.6,2.5C25.3,19.2,26.5,20.3,27.9,20.3z
|
|
223
223
|
M31.2,24.4c-1.7,2.2-3.5,3.8-6.7,3.8h0c-3.2,0-5.8-2-7.7-4.8c-0.8-1.2-2-1.4-2.9-0.8c-0.8,0.6-1,1.8-0.3,2.9
|
|
224
|
-
c2.7,4.1,6.5,6.6,10.9,6.6c4,0,7.2-2,9.6-5.2c0.9-1.2,0.9-2.5,0-3.1C33.3,22.9,32.1,23.2,31.2,24.4z`})]}),ho=({error:t,vendorSettings:e,loginSession:n,email:r,client:i})=>{const o=i.connections.map(({strategy:C})=>C),a=o.includes("email")||o.includes("Username-Password-Authentication"),c=o.includes("sms"),d=o.includes("facebook"),l=o.includes("google-oauth2"),u=o.includes("apple"),f=o.includes("vipps"),m=d||l||u||f,w=a||c;let h="text",y="username";const v=a&&c?"email_or_phone_placeholder":a?"email_placeholder":"phone_placeholder";let b=O.t(v,a&&c?"Email or Phone Number":a?"Email Address":"Phone Number");return _(De,{title:O.t("welcome"),vendorSettings:e,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("welcome")}),_("div",{className:"mb-8 text-gray-300",children:O.t("login_description_template",{authMethod:O.t(v,{defaultValue:a&&c?"email or phone number":a?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),_("div",{className:"flex flex-1 flex-col justify-center",children:[w&&_(tn,{className:"mb-7",children:[_("input",{type:h,name:y,placeholder:b,className:fn("mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),required:!0,value:r||""}),t&&_(Gn,{children:t}),_(Le,{className:"sm:mt-4 !text-base",children:[_("span",{children:O.t("continue")}),_(Be,{className:"text-xs",name:"arrow-right"})]})]}),w&&m&&_("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[_("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),_("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:O.t("continue_social_login")})]}),_("div",{className:"flex space-x-4 sm:flex-col sm:space-x-0 sm:space-y-4 short:flex-row short:space-x-4 short:space-y-0",children:[d&&_(Fr,{connection:"facebook",text:O.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:_(Be,{className:"text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"facebook"}),loginSession:n}),l&&_(Fr,{connection:"google-oauth2",text:O.t("continue_with",{provider:"Google"}),canResize:!0,icon:_(Ym,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n}),u&&_(Fr,{connection:"apple",text:O.t("continue_with",{provider:"Apple"}),canResize:!0,icon:_(Be,{className:"text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"apple"}),loginSession:n}),f&&_(Fr,{connection:"vipps",text:O.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:_(Qm,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n})]})]})]})},C$=["Auth0.swift"];function j$(t){if(!t)return"code";const e=atob(t),n=JSON.parse(e);return C$.includes(n.name)?"code":"link"}const O$=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:s.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r,client:i}=await ke(t,e);return t.html(_(ho,{vendorSettings:n,loginSession:r,client:i,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({username:s.z.string().transform(t=>t.toLowerCase()),login_selection:s.z.enum(["code","password"]).optional()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form");t.set("body",r),t.set("username",r.username);const{client:i,loginSession:o,vendorSettings:a}=await ke(t,n);t.set("client_id",i.id);const{countryCode:c}=jt(t.req),{normalized:d}=mi(r.username,c);if(!d)return t.html(_(ho,{vendorSettings:a,loginSession:o,error:O.t("invalid_identifier"),email:r.username,client:i}),400);const l=await zs({userAdapter:e.data.users,tenant_id:i.tenant.id,email:d});if(l&&t.set("user_id",l.user_id),!l)try{await v2(t,i,t.env.data,d)}catch{const v=we(t,{type:he.FAILED_SIGNUP,description:"Public signup is disabled"});return await t.env.data.logs.create(i.tenant.id,v),t.html(_(ho,{vendorSettings:a,loginSession:o,error:O.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(o.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,o.id,o),await x$(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let u=Dn(),f=await e.data.codes.get(i.tenant.id,u,"otp");for(;f;)u=Dn(),f=await e.data.codes.get(i.tenant.id,u,"otp");const m=await t.env.data.codes.create(i.tenant.id,{code_id:u,code_type:"otp",login_id:o.id,expires_at:new Date(Date.now()+no).toISOString(),redirect_uri:o.authParams.redirect_uri}),w=j$(o.auth0Client),{connectionType:h}=mi(d),y=i.connections.find(v=>v.strategy===h);if(!y)throw new A(400,{message:O.t("connection_not_found",{connection:h})});return h==="email"&&w==="link"&&y.options.authentication_method==="magic_link"?await Ql(t,{to:d,code:m.code_id,authParams:o.authParams}):await Rm(t,{to:d,code:m.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),bt=t=>_("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:O.t("go_back")});var yi="_hp",P$={Change:"Input",DoubleClick:"DblClick"},T$={svg:"2000/svg",math:"1998/Math/MathML"},wi=[],Od=new WeakMap,$r=void 0,R$=()=>$r,Lt=t=>"t"in t,Ka={onClick:["click",!1]},ch=t=>{if(!t.startsWith("on"))return;if(Ka[t])return Ka[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return Ka[t]=[(P$[n]||n).toLowerCase(),!!r]}},dh=(t,e)=>$r&&t instanceof SVGElement&&/[A-Z]/.test(e)&&(e in t.style||e.match(/^(?:o|pai|str|u|ve)/))?e.replace(/([A-Z])/g,"-$1").toLowerCase():e,B$=(t,e,n)=>{var r;e||(e={});for(let i in e){const o=e[i];if(i!=="children"&&(!n||n[i]!==o)){i=gs(i);const a=ch(i);if(a){if((n==null?void 0:n[i])!==o&&(n&&t.removeEventListener(a[0],n[i],a[1]),o!=null)){if(typeof o!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(a[0],o,a[1])}}else if(i==="dangerouslySetInnerHTML"&&o)t.innerHTML=o.__html;else if(i==="ref"){let c;typeof o=="function"?c=o(t)||(()=>o(null)):o&&"current"in o&&(o.current=t,c=()=>o.current=null),Od.set(t,c)}else if(i==="style"){const c=t.style;typeof o=="string"?c.cssText=o:(c.cssText="",o!=null&&Hm(o,c.setProperty.bind(c)))}else{if(i==="value"){const d=t.nodeName;if(d==="INPUT"||d==="TEXTAREA"||d==="SELECT"){if(t.value=o==null||o===!1?null:o,d==="TEXTAREA"){t.textContent=o;continue}else if(d==="SELECT"){t.selectedIndex===-1&&(t.selectedIndex=0);continue}}}else(i==="checked"&&t.nodeName==="INPUT"||i==="selected"&&t.nodeName==="OPTION")&&(t[i]=o);const c=dh(t,i);o==null||o===!1?t.removeAttribute(c):o===!0?t.setAttribute(c,""):typeof o=="string"||typeof o=="number"?t.setAttribute(c,o):t.setAttribute(c,o.toString())}}}if(n)for(let i in n){const o=n[i];if(i!=="children"&&!(i in e)){i=gs(i);const a=ch(i);a?t.removeEventListener(a[0],o,a[1]):i==="ref"?(r=Od.get(t))==null||r():t.removeAttribute(dh(t,i))}}},L$=(t,e)=>{e[Ee][0]=0,wi.push([t,e]);const n=e.tag[nu]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{wi.pop()}},e1=(t,e,n,r,i)=>{var o,a;(o=t.vR)!=null&&o.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((a=t[Ee][1][i1])==null||a.forEach(c=>i.push(c))),t.vC.forEach(c=>{var d;if(Lt(c))n.push(c);else if(typeof c.tag=="function"||c.tag===""){c.c=e;const l=n.length;if(e1(c,e,n,r,i),c.s){for(let u=l;u<n.length;u++)n[u].s=!0;c.s=!1}}else n.push(c),(d=c.vR)!=null&&d.length&&(r.push(...c.vR),delete c.vR)})},U$=t=>{for(;;t=t.tag===yi||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==yi&&t.e)return t.e}},t1=t=>{var e,n,r,i,o,a;Lt(t)||((n=(e=t[Ee])==null?void 0:e[1][i1])==null||n.forEach(c=>{var d;return(d=c[2])==null?void 0:d.call(c)}),(r=Od.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(c=>c.p=2)),(o=t.vC)==null||o.forEach(t1)),t.p||((a=t.e)==null||a.remove(),delete t.e),typeof t.tag=="function"&&(Dr.delete(t),go.delete(t),delete t[Ee][3],t.a=!0)},n1=(t,e,n)=>{t.c=e,r1(t,e,n)},lh=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},uh=Symbol(),r1=(t,e,n)=>{var l;const r=[],i=[],o=[];e1(t,e,r,i,o),i.forEach(t1);const a=n?void 0:e.childNodes;let c,d=null;if(n)c=-1;else if(!a.length)c=0;else{const u=lh(a,U$(t.nN));u!==void 0?(d=a[u],c=u):c=lh(a,(l=r.find(f=>f.tag!==yi&&f.e))==null?void 0:l.e)??-1,c===-1&&(n=!0)}for(let u=0,f=r.length;u<f;u++,c++){const m=r[u];let w;if(m.s&&m.e)w=m.e,m.s=!1;else{const h=n||!m.e;Lt(m)?(m.e&&m.d&&(m.e.textContent=m.t),m.d=!1,w=m.e||(m.e=document.createTextNode(m.t))):(w=m.e||(m.e=m.n?document.createElementNS(m.n,m.tag):document.createElement(m.tag)),B$(w,m.props,m.pP),r1(m,w,h))}m.tag===yi?c--:n?w.parentNode||e.appendChild(w):a[c]!==w&&a[c-1]!==w&&(a[c+1]===w?e.appendChild(a[c]):e.insertBefore(w,d||a[c]||null))}if(t.pP&&delete t.pP,o.length){const u=[],f=[];o.forEach(([,m,,w,h])=>{m&&u.push(m),w&&f.push(w),h==null||h()}),u.forEach(m=>m()),f.length&&requestAnimationFrame(()=>{f.forEach(m=>m())})}},go=new WeakMap,Pd=(t,e,n)=>{var o,a,c,d,l,u;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?L$(t,e):Fi(e.props.children)),((o=n[0])==null?void 0:o.tag)===""&&n[0][Cd]&&(i=n[0][Cd],t[5].push([t,i,e]));const f=r?[...e.pC]:e.vC?[...e.vC]:void 0,m=[];let w;for(let h=0;h<n.length;h++){Array.isArray(n[h])&&n.splice(h,1,...n[h].flat());let y=M$(n[h]);if(y){typeof y.tag=="function"&&!y.tag[Mm]&&(br.length>0&&(y[Ee][2]=br.map(b=>[b,b.values.at(-1)])),(a=t[5])!=null&&a.length&&(y[Ee][3]=t[5].at(-1)));let v;if(f&&f.length){const b=f.findIndex(Lt(y)?E=>Lt(E):y.key!==void 0?E=>E.key===y.key&&E.tag===y.tag:E=>E.tag===y.tag);b!==-1&&(v=f[b],f.splice(b,1))}if(v)if(Lt(y))v.t!==y.t&&(v.t=y.t,v.d=!0),y=v;else{const b=v.pP=v.props;v.props=y.props,v.f||(v.f=y.f||e.f),typeof y.tag=="function"&&(v[Ee][2]=y[Ee][2]||[],v[Ee][3]=y[Ee][3],!v.f&&((v.o||v)===y.o||(d=(c=v.tag)[a$])!=null&&d.call(c,b,v.props))&&(v.s=!0)),y=v}else if(!Lt(y)&&$r){const b=Tr($r);b&&(y.n=b)}if(!Lt(y)&&!y.s&&(Pd(t,y),delete y.f),m.push(y),w&&!w.s&&!y.s)for(let b=w;b&&!Lt(b);b=(l=b.vC)==null?void 0:l.at(-1))b.nN=y;w=y}}e.vR=r?[...e.vC,...f||[]]:f||[],e.vC=m,r&&delete e.pC}catch(f){if(e.f=!0,f===uh){if(i)return;throw f}const[m,w,h]=((u=e[Ee])==null?void 0:u[3])||[];if(w){const y=()=>mo([0,!1,t[2]],h),v=go.get(h)||[];v.push(y),go.set(h,v);const b=w(f,()=>{const E=go.get(h);if(E){const C=E.indexOf(y);if(C!==-1)return E.splice(C,1),y()}});if(b){if(t[0]===1)t[1]=!0;else if(Pd(t,h,[b]),(w.length===1||t!==m)&&h.c){n1(h,h.c,!1);return}throw uh}}throw f}finally{i&&t[5].pop()}},M$=t=>{if(!(t==null||typeof t=="boolean")){if(typeof t=="string"||typeof t=="number")return{t:t.toString(),d:!0};if("vR"in t&&(t={tag:t.tag,props:t.props,key:t.key,f:t.f,type:t.tag,ref:t.props.ref,o:t.o||t}),typeof t.tag=="function")t[Ee]=[0,[]];else{const e=T$[t.tag];e&&($r||($r=Dm("")),t.props.children=[{tag:$r,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},ph=(t,e)=>{var n,r;(n=e[Ee][2])==null||n.forEach(([i,o])=>{i.values.push(o)});try{Pd(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Ee][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&n1(e,e.c,!1)},Dr=new WeakMap,fh=[],mo=async(t,e)=>{t[5]||(t[5]=[]);const n=Dr.get(e);n&&n[0](void 0);let r;const i=new Promise(o=>r=o);if(Dr.set(e,[r,()=>{t[2]?t[2](t,e,o=>{ph(o,e)}).then(()=>r(e)):(ph(t,e),r(e))}]),fh.length)fh.at(-1).add(e);else{await Promise.resolve();const o=Dr.get(e);o&&(Dr.delete(e),o[1]())}return i},F$=(t,e,n)=>({tag:yi,props:{children:t},key:n,e,p:1}),Ga=0,i1=1,Wa=2,Ja=3,Xa=new WeakMap,o1=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),D$=void 0,hh=[],V$=t=>{var a;const e=()=>typeof t=="function"?t():t,n=wi.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(a=r[Ee][1])[Ga]||(a[Ga]=[]),o=r[Ee][0]++;return i[o]||(i[o]=[e(),c=>{const d=D$,l=i[o];if(typeof c=="function"&&(c=c(l[0])),!Object.is(c,l[0]))if(l[0]=c,hh.length){const[u,f]=hh.at(-1);Promise.all([u===3?r:mo([u,!1,d],r),f]).then(([m])=>{if(!m||!(u===2||u===3))return;const w=m.vC;requestAnimationFrame(()=>{setTimeout(()=>{w===m.vC&&mo([u===3?1:0,!1,d],m)})})})}else mo([0,!1,d],r)}])},su=(t,e)=>{var c;const n=wi.at(-1);if(!n)return t;const[,r]=n,i=(c=r[Ee][1])[Wa]||(c[Wa]=[]),o=r[Ee][0]++,a=i[o];return o1(a==null?void 0:a[1],e)?i[o]=[t,e]:t=i[o][0],t},q$=t=>{const e=Xa.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>Xa.set(t,[n]),n=>Xa.set(t,[void 0,n])),t},H$=(t,e)=>{var c;const n=wi.at(-1);if(!n)return t();const[,r]=n,i=(c=r[Ee][1])[Ja]||(c[Ja]=[]),o=r[Ee][0]++,a=i[o];return o1(a==null?void 0:a[1],e)&&(i[o]=[t(),e]),i[o][0]},K$=Dm({pending:!1,data:null,method:null,action:null}),gh=new Set,G$=t=>{gh.add(t),t.finally(()=>gh.delete(t))},au=(t,e)=>H$(()=>n=>{let r;t&&(typeof t=="function"?r=t(n)||(()=>{t(null)}):t&&"current"in t&&(t.current=n,r=()=>{t.current=null}));const i=e(n);return()=>{i==null||i(),r==null||r()}},[t]),Yn=Object.create(null),Yi=Object.create(null),qi=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const o=document.head;let{onLoad:a,onError:c,precedence:d,blocking:l,...u}=e,f=null,m=!1;const w=uo[t];let h;if(w.length>0){const E=o.querySelectorAll(t);e:for(const C of E)for(const L of uo[t])if(C.getAttribute(L)===e[L]){f=C;break e}if(!f){const C=w.reduce((L,Y)=>e[Y]===void 0?L:`${L}-${Y}-${e[Y]}`,t);m=!Yi[C],f=Yi[C]||(Yi[C]=(()=>{const L=document.createElement(t);for(const Y of w)e[Y]!==void 0&&L.setAttribute(Y,e[Y]),e.rel&&L.setAttribute("rel",e.rel);return L})())}}else h=o.querySelectorAll(t);d=r?d??"":void 0,r&&(u[po]=d);const y=su(E=>{if(w.length>0){let C=!1;for(const L of o.querySelectorAll(t)){if(C&&L.getAttribute(po)!==d){o.insertBefore(E,L);return}L.getAttribute(po)===d&&(C=!0)}o.appendChild(E)}else if(h){let C=!1;for(const L of h)if(L===E){C=!0;break}C||o.insertBefore(E,o.contains(h[0])?h[0]:o.querySelector(t)),h=void 0}},[d]),v=au(e.ref,E=>{var Y;const C=w[0];if(n===2&&(E.innerHTML=""),(m||h)&&y(E),!c&&!a)return;let L=Yn[Y=E.getAttribute(C)]||(Yn[Y]=new Promise((se,ae)=>{E.addEventListener("load",se),E.addEventListener("error",ae)}));a&&(L=L.then(a)),c&&(L=L.catch(c)),L.catch(()=>{})});if(i&&l==="render"){const E=uo[t][0];if(e[E]){const C=e[E],L=Yn[C]||(Yn[C]=new Promise((Y,se)=>{y(f),f.addEventListener("load",Y),f.addEventListener("error",se)}));q$(L)}}const b={tag:t,type:t,props:{...u,ref:v},ref:v};return b.p=n,f&&(b.e=f),F$(b,o)},W$=t=>{const e=R$(),n=e&&Tr(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:qi("title",t,void 0,!1,!1)},J$=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:qi("script",t,1,!1,!0),X$=t=>!t||!["href","precedence"].every(e=>e in t)?{tag:"style",props:t,type:"style",ref:t.ref}:(t["data-href"]=t.href,delete t.href,qi("style",t,2,!0,!0)),Z$=t=>!t||["onLoad","onError"].some(e=>e in t)||t.rel==="stylesheet"&&(!("precedence"in t)||"disabled"in t)?{tag:"link",props:t,type:"link",ref:t.ref}:qi("link",t,1,"precedence"in t,!0),Y$=t=>qi("meta",t,void 0,!1,!1),s1=Symbol(),Q$=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=V$([null,!1]),o=su(async l=>{const u=l.isTrusted?e:l.detail[s1];if(typeof u!="function")return;l.preventDefault();const f=new FormData(l.target);i([f,!0]);const m=u(f);m instanceof Promise&&(G$(m),await m),i([null,!0])},[]),a=au(t.ref,l=>(l.addEventListener("submit",o),()=>{l.removeEventListener("submit",o)})),[c,d]=r;return r[1]=!1,{tag:K$,props:{value:{pending:c!==null,data:c,method:c?"post":null,action:c?e:null},children:{tag:"form",props:{...n,ref:a},type:"form",ref:a}},f:d}},a1=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=su(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[s1]:e}}))},[]);n.ref=au(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},e6=t=>a1("input",t),t6=t=>a1("button",t);Object.assign(jd,{title:W$,script:J$,style:X$,link:Z$,meta:Y$,form:Q$,input:e6,button:t6});new TextEncoder;const xa=t=>{const{i18nKey:e,values:n,components:r}=t,i=O.t(e,n),o=/<(\d+)>(.*?)<\/\d+>/g,a=[];let c=0,d;for(;(d=o.exec(i))!==null;){const[,l,u]=d,f=i.substring(c,d.index);f&&a.push(f);const m=parseInt(l,10);a.push($$(r[m],{},u)),c=o.lastIndex}return c<i.length&&a.push(i.substring(c)),_(ou,{children:a})},mh=6,Td=({error:t,vendorSettings:e,email:n,state:r,client:i,hasPasswordLogin:o})=>{const a=new URLSearchParams({state:r}),d=i.connections.map(({name:l})=>l).includes("auth2");return _(De,{title:O.t("verify_your_email"),vendorSettings:e,children:[_("div",{className:"mb-4 text-2xl font-medium",children:O.t("verify_your_email")}),_("div",{className:"mb-8 text-gray-300",children:_(xa,{i18nKey:"code_sent_template",components:[_("span",{className:"text-black dark:text-white"},"span")],values:{username:n}})}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{className:"pt-2",children:[_("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:mh,inputMode:"numeric",name:"code",placeholder:"******",className:fn("mb-2 w-full rounded-lg border bg-gray-100 px-4 pb-2 pt-2.5 text-center indent-[5px] font-mono text-3xl placeholder:text-gray-300 dark:bg-gray-600 md:text-3xl",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),minLength:mh,required:!0,id:"code-input"}),t&&_(Gn,{children:t}),_(Le,{className:"sm:mt-4 !text-base",children:[_("span",{children:O.t("login")}),_(Be,{className:"text-xs",name:"arrow-right"})]}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]}),d&&_("div",{className:"text-center mb-12",children:[_("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[_("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),_("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:O.t("or")})]}),_(Le,{Component:"a",href:`/u/${o?"enter-password":"pre-signup"}?${a.toString()}`,variant:"secondary",className:"block",children:O.t("enter_your_password_btn")})]})]}),_(bt,{state:r})]})]})},Ct=t=>{const{message:e,vendorSettings:n,pageTitle:r,state:i}=t;return _(De,{title:"Login",vendorSettings:n,children:[r?_("div",{className:"mb-6 text-gray-300",children:r}):"",_("div",{className:"flex flex-1 flex-col justify-center",children:e}),i?_(bt,{state:i}):""]})},n6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:s.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i;try{if({vendorSettings:n,loginSession:r,client:i}=await ke(t,e),!r.authParams.username)return t.html(_(Ct,{vendorSettings:n,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("username_not_found_error")||"Username not found in session."}),400);const o=await Io({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:r.authParams.username,provider:"auth2"});return t.html(_(Td,{vendorSettings:n,email:r.authParams.username,state:e,client:i,hasPasswordLogin:!!o}))}catch(o){return console.error("Error in GET /u/enter-code:",o),n||(n={styles:"",disable_signup:!1,disable_connection_signup:!1,domains:[],client:{id:"",tenant:{id:""}}}),t.html(_(Ct,{vendorSettings:n,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var a;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{vendorSettings:r,client:i,loginSession:o}=await ke(t,e);if(!o.authParams.username)throw new A(400,{message:O.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",i.id);const c=await $a(t,{client_id:i.id,authParams:o.authParams,username:o.authParams.username,otp:n});if(c instanceof Response)return c;throw new A(500,{message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(c){let d;try{d=await Io({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:o.authParams.username,provider:"auth2"})}catch{d=null}return t.html(_(Td,{vendorSettings:r,email:(a=o.authParams)==null?void 0:a.username,state:e,client:i,error:c.message,hasPasswordLogin:!!d}),400)}}),c1=t=>{const{vendorSettings:e,state:n}=t;return _(De,{title:O.t("unverified_email"),vendorSettings:e,children:[_("div",{className:"flex flex-1 flex-col justify-center",children:[_("p",{className:"mb-8 text-gray-300 text-lg",children:O.t("unverified_email")}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]}),_(bt,{state:n})]}),_(bt,{state:n})]})},r6=({width:t=22,height:e=17})=>_("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:_("path",{fill:"currentColor",d:"M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32M144 256a144 144 0 1 1 288 0 144 144 0 1 1-288 0m144-64c0 35.3-28.7 64-64 64-7.1 0-13.9-1.2-20.3-3.3-5.5-1.8-11.9 1.6-11.7 7.4.3 6.9 1.3 13.8 3.2 20.7 13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3"})}),i6=({width:t=23,height:e=18})=>_("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:_("path",{fill:"currentColor",d:"M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2s-6.3 25.5 4.1 33.7l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7l-105.2-82.4c39.6-40.6 66.4-86.1 79.9-118.4 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8zm184.3 144.4c25.5-23.3 59.6-37.5 96.9-37.5 79.5 0 144 64.5 144 144 0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3 0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1-79.5 0-144-64.5-144-144 0-6.9.5-13.6 1.4-20.2l-94.3-74.3c-22.8 29.7-39.1 59.3-48.6 82.2-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47 43.8 111.7 80.6 192.5 80.6 47.8 0 89.9-12.9 126.2-32.5z"})}),Rd=({name:t,placeholder:e=O.t("password")})=>_("div",{className:"password-input relative mb-2",children:[_("input",{type:"password",name:t,placeholder:e,className:"w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0}),_("button",{type:"button","aria-label":O.t("show_password"),title:O.t("show_password"),className:"show-password-toggle-show absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:_(r6,{})}),_("button",{type:"button","aria-label":O.t("hide_password"),title:O.t("hide_password"),className:"show-password-toggle-hide !hidden absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:_(i6,{})})]});var _h=Object.freeze,o6=Object.defineProperty,s6=(t,e)=>_h(o6(t,"raw",{value:_h(t.slice())})),yh;const Vr=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t,o=new URLSearchParams({state:i});return _(De,{title:O.t("enter_password"),vendorSettings:n,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("enter_password")}),_("div",{className:"mb-6 text-gray-300",children:O.t("enter_password_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{className:"mb-7",children:[_("input",{type:"text",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r}),_(Rd,{name:"password"}),e&&_(Gn,{children:e}),_(Le,{className:"sm:mt-4 !text-base",children:[_("span",{children:O.t("login")}),_(Be,{className:"text-xs",name:"arrow-right"})]})]}),_("a",{href:`/u/forgot-password?${o.toString()}`,className:"text-primary hover:underline mb-4",children:O.t("forgot_password_link")}),_("div",{className:"text-center mb-12",children:[_("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[_("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),_("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:O.t("or")})]}),_("form",{method:"post",action:`/u/login/identifier?${o.toString()}`,children:[_("input",{type:"hidden",name:"login_selection",value:"code"}),_("input",{type:"hidden",name:"username",value:r}),_(Le,{variant:"secondary",className:"block",children:O.t("enter_a_code_btn")})]})]}),_(bt,{state:i})]}),Um(yh||(yh=s6([`
|
|
224
|
+
c2.7,4.1,6.5,6.6,10.9,6.6c4,0,7.2-2,9.6-5.2c0.9-1.2,0.9-2.5,0-3.1C33.3,22.9,32.1,23.2,31.2,24.4z`})]}),ho=({error:t,vendorSettings:e,loginSession:n,email:r,client:i})=>{const o=i.connections.map(({strategy:C})=>C),a=o.includes("email")||o.includes("Username-Password-Authentication"),c=o.includes("sms"),d=o.includes("facebook"),l=o.includes("google-oauth2"),u=o.includes("apple"),f=o.includes("vipps"),m=d||l||u||f,w=a||c;let h="text",y="username";const v=a&&c?"email_or_phone_placeholder":a?"email_placeholder":"phone_placeholder";let b=O.t(v,a&&c?"Email or Phone Number":a?"Email Address":"Phone Number");return _(De,{title:O.t("welcome"),vendorSettings:e,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("welcome")}),_("div",{className:"mb-8 text-gray-300",children:O.t("login_description_template",{authMethod:O.t(v,{defaultValue:a&&c?"email or phone number":a?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),_("div",{className:"flex flex-1 flex-col justify-center",children:[w&&_(tn,{className:"mb-7",children:[_("input",{type:h,name:y,placeholder:b,className:fn("mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),required:!0,value:r||""}),t&&_(Gn,{children:t}),_(Le,{className:"sm:mt-4 !text-base",children:[_("span",{children:O.t("continue")}),_(Be,{className:"text-xs",name:"arrow-right"})]})]}),w&&m&&_("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[_("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),_("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:O.t("continue_social_login")})]}),_("div",{className:"flex space-x-4 sm:flex-col sm:space-x-0 sm:space-y-4 short:flex-row short:space-x-4 short:space-y-0",children:[d&&_(Fr,{connection:"facebook",text:O.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:_(Be,{className:"text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"facebook"}),loginSession:n}),l&&_(Fr,{connection:"google-oauth2",text:O.t("continue_with",{provider:"Google"}),canResize:!0,icon:_(Ym,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n}),u&&_(Fr,{connection:"apple",text:O.t("continue_with",{provider:"Apple"}),canResize:!0,icon:_(Be,{className:"text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"apple"}),loginSession:n}),f&&_(Fr,{connection:"vipps",text:O.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:_(Qm,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n})]})]})]})},C$=["Auth0.swift"];function j$(t){if(!t)return"code";const e=atob(t),n=JSON.parse(e);return C$.includes(n.name)?"code":"link"}const O$=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:s.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r,client:i}=await ke(t,e);return t.html(_(ho,{vendorSettings:n,loginSession:r,client:i,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({username:s.z.string().transform(t=>t.toLowerCase()),login_selection:s.z.enum(["code","password"]).optional()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form");t.set("body",r),t.set("username",r.username);const{client:i,loginSession:o,vendorSettings:a}=await ke(t,n);t.set("client_id",i.id);const{countryCode:c}=jt(t.req),{normalized:d,connectionType:l}=va(r.username,c);if(!d)return t.html(_(ho,{vendorSettings:a,loginSession:o,error:O.t("invalid_identifier"),email:r.username,client:i}),400);const u=await ei({userAdapter:e.data.users,tenant_id:i.tenant.id,username:d,provider:l});if(u&&t.set("user_id",u.user_id),!u)try{await v2(t,i,t.env.data,d)}catch{const v=we(t,{type:he.FAILED_SIGNUP,description:"Public signup is disabled"});return await t.env.data.logs.create(i.tenant.id,v),t.html(_(ho,{vendorSettings:a,loginSession:o,error:O.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(o.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,o.id,o),await x$(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let f=Dn(),m=await e.data.codes.get(i.tenant.id,f,"otp");for(;m;)f=Dn(),m=await e.data.codes.get(i.tenant.id,f,"otp");const w=await t.env.data.codes.create(i.tenant.id,{code_id:f,code_type:"otp",login_id:o.id,expires_at:new Date(Date.now()+no).toISOString(),redirect_uri:o.authParams.redirect_uri}),h=j$(o.auth0Client),y=i.connections.find(v=>v.strategy===l);if(!y)throw new A(400,{message:O.t("connection_not_found",{connection:l})});return l==="email"&&h==="link"&&y.options.authentication_method==="magic_link"?await Ql(t,{to:d,code:w.code_id,authParams:o.authParams}):await Rm(t,{to:d,code:w.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),bt=t=>_("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:O.t("go_back")});var yi="_hp",P$={Change:"Input",DoubleClick:"DblClick"},T$={svg:"2000/svg",math:"1998/Math/MathML"},wi=[],jd=new WeakMap,$r=void 0,R$=()=>$r,Lt=t=>"t"in t,Ha={onClick:["click",!1]},ch=t=>{if(!t.startsWith("on"))return;if(Ha[t])return Ha[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return Ha[t]=[(P$[n]||n).toLowerCase(),!!r]}},dh=(t,e)=>$r&&t instanceof SVGElement&&/[A-Z]/.test(e)&&(e in t.style||e.match(/^(?:o|pai|str|u|ve)/))?e.replace(/([A-Z])/g,"-$1").toLowerCase():e,B$=(t,e,n)=>{var r;e||(e={});for(let i in e){const o=e[i];if(i!=="children"&&(!n||n[i]!==o)){i=hs(i);const a=ch(i);if(a){if((n==null?void 0:n[i])!==o&&(n&&t.removeEventListener(a[0],n[i],a[1]),o!=null)){if(typeof o!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(a[0],o,a[1])}}else if(i==="dangerouslySetInnerHTML"&&o)t.innerHTML=o.__html;else if(i==="ref"){let c;typeof o=="function"?c=o(t)||(()=>o(null)):o&&"current"in o&&(o.current=t,c=()=>o.current=null),jd.set(t,c)}else if(i==="style"){const c=t.style;typeof o=="string"?c.cssText=o:(c.cssText="",o!=null&&Hm(o,c.setProperty.bind(c)))}else{if(i==="value"){const d=t.nodeName;if(d==="INPUT"||d==="TEXTAREA"||d==="SELECT"){if(t.value=o==null||o===!1?null:o,d==="TEXTAREA"){t.textContent=o;continue}else if(d==="SELECT"){t.selectedIndex===-1&&(t.selectedIndex=0);continue}}}else(i==="checked"&&t.nodeName==="INPUT"||i==="selected"&&t.nodeName==="OPTION")&&(t[i]=o);const c=dh(t,i);o==null||o===!1?t.removeAttribute(c):o===!0?t.setAttribute(c,""):typeof o=="string"||typeof o=="number"?t.setAttribute(c,o):t.setAttribute(c,o.toString())}}}if(n)for(let i in n){const o=n[i];if(i!=="children"&&!(i in e)){i=hs(i);const a=ch(i);a?t.removeEventListener(a[0],o,a[1]):i==="ref"?(r=jd.get(t))==null||r():t.removeAttribute(dh(t,i))}}},L$=(t,e)=>{e[Ee][0]=0,wi.push([t,e]);const n=e.tag[nu]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{wi.pop()}},e1=(t,e,n,r,i)=>{var o,a;(o=t.vR)!=null&&o.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((a=t[Ee][1][i1])==null||a.forEach(c=>i.push(c))),t.vC.forEach(c=>{var d;if(Lt(c))n.push(c);else if(typeof c.tag=="function"||c.tag===""){c.c=e;const l=n.length;if(e1(c,e,n,r,i),c.s){for(let u=l;u<n.length;u++)n[u].s=!0;c.s=!1}}else n.push(c),(d=c.vR)!=null&&d.length&&(r.push(...c.vR),delete c.vR)})},U$=t=>{for(;;t=t.tag===yi||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==yi&&t.e)return t.e}},t1=t=>{var e,n,r,i,o,a;Lt(t)||((n=(e=t[Ee])==null?void 0:e[1][i1])==null||n.forEach(c=>{var d;return(d=c[2])==null?void 0:d.call(c)}),(r=jd.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(c=>c.p=2)),(o=t.vC)==null||o.forEach(t1)),t.p||((a=t.e)==null||a.remove(),delete t.e),typeof t.tag=="function"&&(Dr.delete(t),go.delete(t),delete t[Ee][3],t.a=!0)},n1=(t,e,n)=>{t.c=e,r1(t,e,n)},lh=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},uh=Symbol(),r1=(t,e,n)=>{var l;const r=[],i=[],o=[];e1(t,e,r,i,o),i.forEach(t1);const a=n?void 0:e.childNodes;let c,d=null;if(n)c=-1;else if(!a.length)c=0;else{const u=lh(a,U$(t.nN));u!==void 0?(d=a[u],c=u):c=lh(a,(l=r.find(f=>f.tag!==yi&&f.e))==null?void 0:l.e)??-1,c===-1&&(n=!0)}for(let u=0,f=r.length;u<f;u++,c++){const m=r[u];let w;if(m.s&&m.e)w=m.e,m.s=!1;else{const h=n||!m.e;Lt(m)?(m.e&&m.d&&(m.e.textContent=m.t),m.d=!1,w=m.e||(m.e=document.createTextNode(m.t))):(w=m.e||(m.e=m.n?document.createElementNS(m.n,m.tag):document.createElement(m.tag)),B$(w,m.props,m.pP),r1(m,w,h))}m.tag===yi?c--:n?w.parentNode||e.appendChild(w):a[c]!==w&&a[c-1]!==w&&(a[c+1]===w?e.appendChild(a[c]):e.insertBefore(w,d||a[c]||null))}if(t.pP&&delete t.pP,o.length){const u=[],f=[];o.forEach(([,m,,w,h])=>{m&&u.push(m),w&&f.push(w),h==null||h()}),u.forEach(m=>m()),f.length&&requestAnimationFrame(()=>{f.forEach(m=>m())})}},go=new WeakMap,Od=(t,e,n)=>{var o,a,c,d,l,u;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?L$(t,e):Fi(e.props.children)),((o=n[0])==null?void 0:o.tag)===""&&n[0][Nd]&&(i=n[0][Nd],t[5].push([t,i,e]));const f=r?[...e.pC]:e.vC?[...e.vC]:void 0,m=[];let w;for(let h=0;h<n.length;h++){Array.isArray(n[h])&&n.splice(h,1,...n[h].flat());let y=M$(n[h]);if(y){typeof y.tag=="function"&&!y.tag[Mm]&&(br.length>0&&(y[Ee][2]=br.map(b=>[b,b.values.at(-1)])),(a=t[5])!=null&&a.length&&(y[Ee][3]=t[5].at(-1)));let v;if(f&&f.length){const b=f.findIndex(Lt(y)?E=>Lt(E):y.key!==void 0?E=>E.key===y.key&&E.tag===y.tag:E=>E.tag===y.tag);b!==-1&&(v=f[b],f.splice(b,1))}if(v)if(Lt(y))v.t!==y.t&&(v.t=y.t,v.d=!0),y=v;else{const b=v.pP=v.props;v.props=y.props,v.f||(v.f=y.f||e.f),typeof y.tag=="function"&&(v[Ee][2]=y[Ee][2]||[],v[Ee][3]=y[Ee][3],!v.f&&((v.o||v)===y.o||(d=(c=v.tag)[a$])!=null&&d.call(c,b,v.props))&&(v.s=!0)),y=v}else if(!Lt(y)&&$r){const b=Tr($r);b&&(y.n=b)}if(!Lt(y)&&!y.s&&(Od(t,y),delete y.f),m.push(y),w&&!w.s&&!y.s)for(let b=w;b&&!Lt(b);b=(l=b.vC)==null?void 0:l.at(-1))b.nN=y;w=y}}e.vR=r?[...e.vC,...f||[]]:f||[],e.vC=m,r&&delete e.pC}catch(f){if(e.f=!0,f===uh){if(i)return;throw f}const[m,w,h]=((u=e[Ee])==null?void 0:u[3])||[];if(w){const y=()=>mo([0,!1,t[2]],h),v=go.get(h)||[];v.push(y),go.set(h,v);const b=w(f,()=>{const E=go.get(h);if(E){const C=E.indexOf(y);if(C!==-1)return E.splice(C,1),y()}});if(b){if(t[0]===1)t[1]=!0;else if(Od(t,h,[b]),(w.length===1||t!==m)&&h.c){n1(h,h.c,!1);return}throw uh}}throw f}finally{i&&t[5].pop()}},M$=t=>{if(!(t==null||typeof t=="boolean")){if(typeof t=="string"||typeof t=="number")return{t:t.toString(),d:!0};if("vR"in t&&(t={tag:t.tag,props:t.props,key:t.key,f:t.f,type:t.tag,ref:t.props.ref,o:t.o||t}),typeof t.tag=="function")t[Ee]=[0,[]];else{const e=T$[t.tag];e&&($r||($r=Dm("")),t.props.children=[{tag:$r,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},ph=(t,e)=>{var n,r;(n=e[Ee][2])==null||n.forEach(([i,o])=>{i.values.push(o)});try{Od(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Ee][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&n1(e,e.c,!1)},Dr=new WeakMap,fh=[],mo=async(t,e)=>{t[5]||(t[5]=[]);const n=Dr.get(e);n&&n[0](void 0);let r;const i=new Promise(o=>r=o);if(Dr.set(e,[r,()=>{t[2]?t[2](t,e,o=>{ph(o,e)}).then(()=>r(e)):(ph(t,e),r(e))}]),fh.length)fh.at(-1).add(e);else{await Promise.resolve();const o=Dr.get(e);o&&(Dr.delete(e),o[1]())}return i},F$=(t,e,n)=>({tag:yi,props:{children:t},key:n,e,p:1}),Ka=0,i1=1,Ga=2,Wa=3,Ja=new WeakMap,o1=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),D$=void 0,hh=[],V$=t=>{var a;const e=()=>typeof t=="function"?t():t,n=wi.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(a=r[Ee][1])[Ka]||(a[Ka]=[]),o=r[Ee][0]++;return i[o]||(i[o]=[e(),c=>{const d=D$,l=i[o];if(typeof c=="function"&&(c=c(l[0])),!Object.is(c,l[0]))if(l[0]=c,hh.length){const[u,f]=hh.at(-1);Promise.all([u===3?r:mo([u,!1,d],r),f]).then(([m])=>{if(!m||!(u===2||u===3))return;const w=m.vC;requestAnimationFrame(()=>{setTimeout(()=>{w===m.vC&&mo([u===3?1:0,!1,d],m)})})})}else mo([0,!1,d],r)}])},su=(t,e)=>{var c;const n=wi.at(-1);if(!n)return t;const[,r]=n,i=(c=r[Ee][1])[Ga]||(c[Ga]=[]),o=r[Ee][0]++,a=i[o];return o1(a==null?void 0:a[1],e)?i[o]=[t,e]:t=i[o][0],t},q$=t=>{const e=Ja.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>Ja.set(t,[n]),n=>Ja.set(t,[void 0,n])),t},H$=(t,e)=>{var c;const n=wi.at(-1);if(!n)return t();const[,r]=n,i=(c=r[Ee][1])[Wa]||(c[Wa]=[]),o=r[Ee][0]++,a=i[o];return o1(a==null?void 0:a[1],e)&&(i[o]=[t(),e]),i[o][0]},K$=Dm({pending:!1,data:null,method:null,action:null}),gh=new Set,G$=t=>{gh.add(t),t.finally(()=>gh.delete(t))},au=(t,e)=>H$(()=>n=>{let r;t&&(typeof t=="function"?r=t(n)||(()=>{t(null)}):t&&"current"in t&&(t.current=n,r=()=>{t.current=null}));const i=e(n);return()=>{i==null||i(),r==null||r()}},[t]),Yn=Object.create(null),Yi=Object.create(null),qi=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const o=document.head;let{onLoad:a,onError:c,precedence:d,blocking:l,...u}=e,f=null,m=!1;const w=uo[t];let h;if(w.length>0){const E=o.querySelectorAll(t);e:for(const C of E)for(const L of uo[t])if(C.getAttribute(L)===e[L]){f=C;break e}if(!f){const C=w.reduce((L,Y)=>e[Y]===void 0?L:`${L}-${Y}-${e[Y]}`,t);m=!Yi[C],f=Yi[C]||(Yi[C]=(()=>{const L=document.createElement(t);for(const Y of w)e[Y]!==void 0&&L.setAttribute(Y,e[Y]),e.rel&&L.setAttribute("rel",e.rel);return L})())}}else h=o.querySelectorAll(t);d=r?d??"":void 0,r&&(u[po]=d);const y=su(E=>{if(w.length>0){let C=!1;for(const L of o.querySelectorAll(t)){if(C&&L.getAttribute(po)!==d){o.insertBefore(E,L);return}L.getAttribute(po)===d&&(C=!0)}o.appendChild(E)}else if(h){let C=!1;for(const L of h)if(L===E){C=!0;break}C||o.insertBefore(E,o.contains(h[0])?h[0]:o.querySelector(t)),h=void 0}},[d]),v=au(e.ref,E=>{var Y;const C=w[0];if(n===2&&(E.innerHTML=""),(m||h)&&y(E),!c&&!a)return;let L=Yn[Y=E.getAttribute(C)]||(Yn[Y]=new Promise((se,ae)=>{E.addEventListener("load",se),E.addEventListener("error",ae)}));a&&(L=L.then(a)),c&&(L=L.catch(c)),L.catch(()=>{})});if(i&&l==="render"){const E=uo[t][0];if(e[E]){const C=e[E],L=Yn[C]||(Yn[C]=new Promise((Y,se)=>{y(f),f.addEventListener("load",Y),f.addEventListener("error",se)}));q$(L)}}const b={tag:t,type:t,props:{...u,ref:v},ref:v};return b.p=n,f&&(b.e=f),F$(b,o)},W$=t=>{const e=R$(),n=e&&Tr(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:qi("title",t,void 0,!1,!1)},J$=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:qi("script",t,1,!1,!0),X$=t=>!t||!["href","precedence"].every(e=>e in t)?{tag:"style",props:t,type:"style",ref:t.ref}:(t["data-href"]=t.href,delete t.href,qi("style",t,2,!0,!0)),Z$=t=>!t||["onLoad","onError"].some(e=>e in t)||t.rel==="stylesheet"&&(!("precedence"in t)||"disabled"in t)?{tag:"link",props:t,type:"link",ref:t.ref}:qi("link",t,1,"precedence"in t,!0),Y$=t=>qi("meta",t,void 0,!1,!1),s1=Symbol(),Q$=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=V$([null,!1]),o=su(async l=>{const u=l.isTrusted?e:l.detail[s1];if(typeof u!="function")return;l.preventDefault();const f=new FormData(l.target);i([f,!0]);const m=u(f);m instanceof Promise&&(G$(m),await m),i([null,!0])},[]),a=au(t.ref,l=>(l.addEventListener("submit",o),()=>{l.removeEventListener("submit",o)})),[c,d]=r;return r[1]=!1,{tag:K$,props:{value:{pending:c!==null,data:c,method:c?"post":null,action:c?e:null},children:{tag:"form",props:{...n,ref:a},type:"form",ref:a}},f:d}},a1=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=su(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[s1]:e}}))},[]);n.ref=au(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},e6=t=>a1("input",t),t6=t=>a1("button",t);Object.assign(Cd,{title:W$,script:J$,style:X$,link:Z$,meta:Y$,form:Q$,input:e6,button:t6});new TextEncoder;const $a=t=>{const{i18nKey:e,values:n,components:r}=t,i=O.t(e,n),o=/<(\d+)>(.*?)<\/\d+>/g,a=[];let c=0,d;for(;(d=o.exec(i))!==null;){const[,l,u]=d,f=i.substring(c,d.index);f&&a.push(f);const m=parseInt(l,10);a.push($$(r[m],{},u)),c=o.lastIndex}return c<i.length&&a.push(i.substring(c)),_(ou,{children:a})},mh=6,Pd=({error:t,vendorSettings:e,email:n,state:r,client:i,hasPasswordLogin:o})=>{const a=new URLSearchParams({state:r}),d=i.connections.map(({name:l})=>l).includes("auth2");return _(De,{title:O.t("verify_your_email"),vendorSettings:e,children:[_("div",{className:"mb-4 text-2xl font-medium",children:O.t("verify_your_email")}),_("div",{className:"mb-8 text-gray-300",children:_($a,{i18nKey:"code_sent_template",components:[_("span",{className:"text-black dark:text-white"},"span")],values:{username:n}})}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{className:"pt-2",children:[_("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:mh,inputMode:"numeric",name:"code",placeholder:"******",className:fn("mb-2 w-full rounded-lg border bg-gray-100 px-4 pb-2 pt-2.5 text-center indent-[5px] font-mono text-3xl placeholder:text-gray-300 dark:bg-gray-600 md:text-3xl",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),minLength:mh,required:!0,id:"code-input"}),t&&_(Gn,{children:t}),_(Le,{className:"sm:mt-4 !text-base",children:[_("span",{children:O.t("login")}),_(Be,{className:"text-xs",name:"arrow-right"})]}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]}),d&&_("div",{className:"text-center mb-12",children:[_("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[_("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),_("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:O.t("or")})]}),_(Le,{Component:"a",href:`/u/${o?"enter-password":"pre-signup"}?${a.toString()}`,variant:"secondary",className:"block",children:O.t("enter_your_password_btn")})]})]}),_(bt,{state:r})]})]})},Ct=t=>{const{message:e,vendorSettings:n,pageTitle:r,state:i}=t;return _(De,{title:"Login",vendorSettings:n,children:[r?_("div",{className:"mb-6 text-gray-300",children:r}):"",_("div",{className:"flex flex-1 flex-col justify-center",children:e}),i?_(bt,{state:i}):""]})},n6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:s.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i;try{if({vendorSettings:n,loginSession:r,client:i}=await ke(t,e),!r.authParams.username)return t.html(_(Ct,{vendorSettings:n,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("username_not_found_error")||"Username not found in session."}),400);const o=await ei({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:r.authParams.username,provider:"auth2"});return t.html(_(Pd,{vendorSettings:n,email:r.authParams.username,state:e,client:i,hasPasswordLogin:!!o}))}catch(o){return console.error("Error in GET /u/enter-code:",o),n||(n={styles:"",disable_signup:!1,disable_connection_signup:!1,domains:[],client:{id:"",tenant:{id:""}}}),t.html(_(Ct,{vendorSettings:n,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var a;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{vendorSettings:r,client:i,loginSession:o}=await ke(t,e);if(!o.authParams.username)throw new A(400,{message:O.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",i.id);const c=await ba(t,{client_id:i.id,authParams:o.authParams,username:o.authParams.username,otp:n});if(c instanceof Response)return c;throw new A(500,{message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(c){let d;try{d=await ei({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:o.authParams.username,provider:"auth2"})}catch{d=null}return t.html(_(Pd,{vendorSettings:r,email:(a=o.authParams)==null?void 0:a.username,state:e,client:i,error:c.message,hasPasswordLogin:!!d}),400)}}),c1=t=>{const{vendorSettings:e,state:n}=t;return _(De,{title:O.t("unverified_email"),vendorSettings:e,children:[_("div",{className:"flex flex-1 flex-col justify-center",children:[_("p",{className:"mb-8 text-gray-300 text-lg",children:O.t("unverified_email")}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]}),_(bt,{state:n})]}),_(bt,{state:n})]})},r6=({width:t=22,height:e=17})=>_("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:_("path",{fill:"currentColor",d:"M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32M144 256a144 144 0 1 1 288 0 144 144 0 1 1-288 0m144-64c0 35.3-28.7 64-64 64-7.1 0-13.9-1.2-20.3-3.3-5.5-1.8-11.9 1.6-11.7 7.4.3 6.9 1.3 13.8 3.2 20.7 13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3"})}),i6=({width:t=23,height:e=18})=>_("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:_("path",{fill:"currentColor",d:"M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2s-6.3 25.5 4.1 33.7l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7l-105.2-82.4c39.6-40.6 66.4-86.1 79.9-118.4 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8zm184.3 144.4c25.5-23.3 59.6-37.5 96.9-37.5 79.5 0 144 64.5 144 144 0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3 0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1-79.5 0-144-64.5-144-144 0-6.9.5-13.6 1.4-20.2l-94.3-74.3c-22.8 29.7-39.1 59.3-48.6 82.2-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47 43.8 111.7 80.6 192.5 80.6 47.8 0 89.9-12.9 126.2-32.5z"})}),Td=({name:t,placeholder:e=O.t("password")})=>_("div",{className:"password-input relative mb-2",children:[_("input",{type:"password",name:t,placeholder:e,className:"w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0}),_("button",{type:"button","aria-label":O.t("show_password"),title:O.t("show_password"),className:"show-password-toggle-show absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:_(r6,{})}),_("button",{type:"button","aria-label":O.t("hide_password"),title:O.t("hide_password"),className:"show-password-toggle-hide !hidden absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:_(i6,{})})]});var _h=Object.freeze,o6=Object.defineProperty,s6=(t,e)=>_h(o6(t,"raw",{value:_h(t.slice())})),yh;const Vr=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t,o=new URLSearchParams({state:i});return _(De,{title:O.t("enter_password"),vendorSettings:n,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("enter_password")}),_("div",{className:"mb-6 text-gray-300",children:O.t("enter_password_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{className:"mb-7",children:[_("input",{type:"text",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r}),_(Td,{name:"password"}),e&&_(Gn,{children:e}),_(Le,{className:"sm:mt-4 !text-base",children:[_("span",{children:O.t("login")}),_(Be,{className:"text-xs",name:"arrow-right"})]})]}),_("a",{href:`/u/forgot-password?${o.toString()}`,className:"text-primary hover:underline mb-4",children:O.t("forgot_password_link")}),_("div",{className:"text-center mb-12",children:[_("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[_("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),_("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:O.t("or")})]}),_("form",{method:"post",action:`/u/login/identifier?${o.toString()}`,children:[_("input",{type:"hidden",name:"login_selection",value:"code"}),_("input",{type:"hidden",name:"username",value:r}),_(Le,{variant:"secondary",className:"block",children:O.t("enter_a_code_btn")})]})]}),_(bt,{state:i})]}),Um(yh||(yh=s6([`
|
|
225
225
|
<script>
|
|
226
226
|
// Show password toggle
|
|
227
227
|
var passwordInputs = document.querySelectorAll(".password-input");
|
|
@@ -245,10 +245,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
245
245
|
});
|
|
246
246
|
});
|
|
247
247
|
<\/script>
|
|
248
|
-
`])))]})},a6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await ke(t,e);if(!i.authParams.username)throw new A(400,{message:"Username required"});return t.html(_(Vr,{vendorSettings:n,email:i.authParams.username,state:e,client:r}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string()})}}}},responses:{200:{description:"HTML page indicating success or a next step (if not redirecting).",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent).",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid password, username required).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{password:r}=n,{vendorSettings:i,client:o,loginSession:a}=await ke(t,e),{username:c}=a.authParams;if(!c)throw new A(400,{message:"Username required"});try{const d=await tu(t,o,{...a.authParams,password:r},a);return d instanceof Response?d:(console.error("Unexpected TokenResponse in POST /u/enter-password. This might indicate a flow misconfiguration as this route expects HTML or redirect.",d),t.html(_(Vr,{vendorSettings:i,email:c,error:"An unexpected error occurred. Please try again.",state:e,client:o}),500))}catch(d){const l=d;return l.code==="INVALID_PASSWORD"||l.code==="USER_NOT_FOUND"?t.html(_(Vr,{vendorSettings:i,email:c,error:O.t("invalid_password"),state:e,client:o}),400):l.code==="EMAIL_NOT_VERIFIED"?t.html(_(c1,{vendorSettings:i,state:e}),400):t.html(_(Vr,{vendorSettings:i,email:c,error:l.message||"An unknown error occurred.",state:e,client:o}),l.code?400:500)}}),vn=t=>{const{state:e,error:n,vendorSettings:r,email:i,code:o}=t;return _(De,{title:O.t("create_account_title"),vendorSettings:r,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("create_account_title")}),_("div",{className:"mb-6 text-gray-300",children:O.t("create_account_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{children:[_("input",{type:"hidden",name:"code",value:o}),_("input",{type:"email",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:i,disabled:!!i}),_("input",{type:"password",name:"password",placeholder:O.t("enter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),_("input",{type:"password",name:"re-enter-password",placeholder:O.t("reenter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),n&&_(Gn,{children:n}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("continue")})]}),_(bt,{state:e})]})]})},c6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().optional().openapi({description:"The code parameter from an email verification link"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{vendorSettings:r,loginSession:i}=await ke(t,e),{username:o}=i.authParams;if(!o)throw new A(400,{message:"Username required"});return n?t.html(_(vn,{state:e,vendorSettings:r,email:o,code:n})):t.html(_(vn,{state:e,vendorSettings:r,email:o}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string(),code:s.z.string().optional()})}}}},responses:{200:{description:"HTML page indicating success (e.g., email verification sent) or a next step.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent) after successful login.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., passwords don't match, weak password, user exists).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{env:r}=t;let i,o,a,c;try{({vendorSettings:i,client:o,loginSession:a}=await ke(t,e));const d="Username-Password-Authentication";if(t.set("client_id",o.id),t.set("connection",d),{username:c}=a.authParams,!c)return t.html(_(Ct,{vendorSettings:i,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("username_required_error")||"Username required"}),400);if(n.password!==n["re-enter-password"])return t.html(_(vn,{state:e,code:n.code,vendorSettings:i,error:O.t("create_account_passwords_didnt_match"),email:c}),400);if(!Yl(n.password))return t.html(_(vn,{state:e,code:n.code,vendorSettings:i,error:O.t("create_account_weak_password"),email:c}),400);const l=n.code?await r.data.codes.get(o.tenant.id,n.code,"email_verification"):void 0,u=l?await r.data.loginSessions.get(o.tenant.id,l.login_id):void 0;if(await kr({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:c,provider:"auth2"}))return t.html(_(vn,{state:e,code:n.code,vendorSettings:i,error:O.t("user_exists_error")||"User already exists",email:c}),400);const m=(u==null?void 0:u.authParams.username)===c,w=await b0(t).users.create(o.tenant.id,{user_id:`auth2|${xs()}`,email:c,email_verified:m,provider:"auth2",connection:d,is_social:!1});if(await r.data.passwords.create(o.tenant.id,{user_id:w.user_id,password:await vi.hash(n.password,10),algorithm:"bcrypt"}),!m)return await eu(t,w),t.html(_(Ct,{message:O.t("validate_email_body"),pageTitle:O.t("validate_email_title"),vendorSettings:i,state:e}));const h=await tu(t,o,{...a.authParams,password:n.password},a);return h instanceof Response?h:(console.error("Unexpected TokenResponse in POST /u/signup after login. This might indicate a flow misconfiguration as this route expects HTML or redirect.",h),t.html(_(Ct,{vendorSettings:i,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500))}catch(d){let l=O.t("unknown_error_message")||"An unknown error occurred.",u=400;return d instanceof A?(l=d.message||l,u=d.status===400?400:500):d instanceof Qn?l=d.message||l:d instanceof Error&&(l=d.message||l,u=500),t.html(_(vn,{state:e,vendorSettings:i,error:l,email:c,code:n.code}),u)}}),er=t=>{const{error:e,vendorSettings:n,email:r}=t;return _(De,{title:O.t("reset_password_title"),vendorSettings:n,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("reset_password_title")}),_("div",{className:"mb-6 text-gray-300",children:`${O.t("reset_password_description")} ${r}`}),_("div",{className:"flex flex-1 flex-col justify-center",children:_(tn,{children:[_(Rd,{name:"password",placeholder:O.t("enter_new_password_placeholder")}),_(Rd,{name:"re-enter-password",placeholder:O.t("reenter_new_password_placeholder")}),e&&_(Gn,{children:e}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("reset_password_cta")})]})})]})},d6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e);if(!r.authParams.username)throw new A(400,{message:"Username required"});return t.html(_(er,{vendorSettings:n,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{password:r,"re-enter-password":i}=t.req.valid("form"),{env:o}=t,{vendorSettings:a,client:c,loginSession:d}=await ke(t,e);if(!d.authParams.username)throw new A(400,{message:"Username required"});if(r!==i)return t.html(_(er,{error:O.t("create_account_passwords_didnt_match"),vendorSettings:a,email:d.authParams.username}),400);if(!Yl(r))return t.html(_(er,{error:O.t("create_account_weak_password"),vendorSettings:a,email:d.authParams.username}),400);const l=await kr({userAdapter:o.data.users,tenant_id:c.tenant.id,username:d.authParams.username,provider:"auth2"});if(!l)throw new A(400,{message:"User not found"});try{if(!await o.data.codes.get(c.tenant.id,n,"password_reset"))return t.html(_(er,{error:"Code not found or expired",vendorSettings:a,email:d.authParams.username}),400);const f={user_id:l.user_id,password:await vi.hash(r,10),algorithm:"bcrypt"};await o.data.passwords.get(c.tenant.id,l.user_id)?await o.data.passwords.update(c.tenant.id,f):await o.data.passwords.create(c.tenant.id,f),l.email_verified||await o.data.users.update(c.tenant.id,l.user_id,{email_verified:!0})}catch{return t.html(_(er,{error:"The password could not be reset",vendorSettings:a,email:d.authParams.username}),400)}return t.html(_(Ct,{message:O.t("password_has_been_reset"),vendorSettings:a,state:e}))}),d1=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t;return _(De,{title:O.t("forgot_password_title"),vendorSettings:n,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("forgot_password_title")}),_("div",{className:"mb-6 text-gray-300",children:O.t("forgot_password_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{className:"pt-2",children:[_("input",{type:"email",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r,disabled:!!r}),e&&_(Gn,{children:e}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("forgot_password_cta")})]}),_(bt,{state:i})]})]})},l1=t=>{const{vendorSettings:e,state:n}=t;return _(De,{title:"Login",vendorSettings:e,children:[_("div",{className:"flex flex-1 flex-col justify-center",children:[_("div",{children:O.t("forgot_password_email_sent")}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]})]}),_(bt,{state:n})]})},l6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e);return t.html(_(d1,{vendorSettings:n,state:e,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await ke(t,e);return await X4(t,r,i.authParams.username,i.id),t.html(_(l1,{vendorSettings:n,state:e}))}),u1=({vendorSettings:t,state:e,user:n})=>_(De,{title:re("check_email_title"),vendorSettings:t,children:_("div",{className:"flex flex-1 flex-col justify-center",children:[_("div",{className:"mb-8 text-gray-700 dark:text-gray-300",children:[_(xa,{i18nKey:"currently_logged_in_as",components:[_("span",{className:"font-semibold text-gray-900 dark:text-white"},"span")],values:{email:n.email||""}}),_("br",{}),re("continue_with_sso_provider_headline")]}),_("div",{className:"space-y-6",children:[_(tn,{children:_(Le,{className:"!text-base",children:_("span",{children:O.t("yes_continue_with_existing_account")})})}),_("a",{className:"block text-center text-primary hover:text-primaryHover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 dark:focus:ring-offset-gray-900",href:`/u/login/identifier?state=${encodeURIComponent(e)}`,children:O.t("no_use_another")})]})]})}),u6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page to check account status or verify email.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login identifier page if no valid session.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i}=await ke(t,n);if(!i||!((d=i.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/check-account after initJSXRoute"),t.html(_(Ct,{vendorSettings:r,state:n,pageTitle:O.t("error_page_title")||"Error",message:O.t("configuration_error_message")||"A configuration error occurred."}),500);const o=zo(i.tenant.id,t.req.header("cookie")),a=o?await e.data.sessions.get(i.tenant.id,o):null;if(!a)return t.redirect(`/u/login/identifier?state=${n}`);const c=await e.data.users.get(i.tenant.id,a.user_id);return c?t.html(_(u1,{vendorSettings:r,state:n,user:c})):t.redirect(`/u/login/identifier?state=${n}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow or to login identifier.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues or if TokenResponse is returned.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var u;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i,loginSession:o}=await ke(t,n);if(!i||!((u=i.tenant)!=null&&u.id))return console.error("Client or tenant ID missing in POST /u/check-account after initJSXRoute"),t.html(_(Ct,{vendorSettings:r,state:n,pageTitle:O.t("error_page_title")||"Error",message:O.t("configuration_error_message")||"A configuration error occurred."}),500);const a=zo(i.tenant.id,t.req.header("cookie")),c=a?await e.data.sessions.get(i.tenant.id,a):null;if(!c)return t.redirect(`/u/login/identifier?state=${n}`);const d=await e.data.users.get(i.tenant.id,c.user_id);if(!d)return t.redirect(`/u/login/identifier?state=${n}`);const l=await Zt(t,{user:d,authParams:o.authParams,client:i,loginSession:o});if(!(l instanceof Response))throw new A(500,{message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."});return l}),p1=t=>{const{vendorSettings:e,email:n,state:r}=t;return _(De,{title:O.t("create_password_account_title"),vendorSettings:e,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("create_password_account_title")}),_("div",{className:"mb-6 text-gray-300",children:O.t("enter_email_for_verification_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:_(tn,{className:"pt-2",children:[_("input",{type:"email",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:n,disabled:!0}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("send")})]})}),_(bt,{state:r})]})},p6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e),{username:i}=r.authParams;if(!i)throw new A(400,{message:"Username required"});return t.html(_(p1,{state:e,vendorSettings:n,email:i}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{loginSession:n,client:r}=await ke(t,e),{username:i}=n.authParams;if(!i)throw new A(400,{message:"Username required"});const o=await t.env.data.codes.create(r.tenant.id,{code_id:Dn(),code_type:"email_verification",login_id:n.id,expires_at:new Date(Date.now()+R_).toISOString()});return await G4(t,i,o.code_id,n.id),t.redirect(`/u/pre-signup-sent?state=${e}`)}),f1=t=>{const{redirectUrl:e,vendorSettings:n}=t;return _(De,{title:O.t("invalid_session_title"),vendorSettings:n,children:[_("div",{className:"flex flex-1 flex-col justify-center",children:O.t("invalid_session_body")}),_("div",{className:"flex flex-1 flex-col justify-center",children:e&&_("a",{className:"block text-primary hover:text-primaryHover text-center",href:e,children:O.t("go_back")})})]})},f6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e);let i;return r.authParams.redirect_uri&&r.authParams.state&&(i=new URL(r.authParams.redirect_uri),i.searchParams.set("state",r.authParams.state),i.searchParams.set("error","invalid_session"),i.searchParams.set("error_description",r.authParams.username||"")),t.html(_(f1,{redirectUrl:i==null?void 0:i.href,vendorSettings:n}))}),h6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const e=await Gm(t.env),{state:n}=t.req.valid("query");return t.html(_(Ct,{message:"Not implemented",pageTitle:"User info",vendorSettings:e,state:n}))}),h1=({vendorSettings:t,state:e})=>{const n=new URLSearchParams({state:e});return _(De,{title:O.t("email_validated"),vendorSettings:t,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("email_validated")}),_("div",{className:"flex flex-1 flex-col justify-center mb-7",children:_(Le,{Component:"a",href:`/u/enter-password?${n}`,className:"text-base sm:mt-4 md:text-base",children:_("div",{className:"flex items-center space-x-2",children:[_("span",{children:O.t("email_validated_cta")}),_(Be,{className:"text-xs",name:"arrow-right"})]})})})]})},g6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{var m;const{state:e,code:n}=t.req.valid("query"),{env:r}=t,{client:i,loginSession:o,vendorSettings:a}=await ke(t,e),{username:c}=o.authParams;if(!c)throw new A(400,{message:"Username not found in state"});const d=await kr({userAdapter:r.data.users,tenant_id:i.tenant.id,username:c,provider:"auth2"});if(!d)throw new A(500,{message:"No user found"});if(!await r.data.codes.get(i.tenant.id,n,"email_verification"))throw new A(400,{message:"Code not found or expired"});await r.data.users.update(i.tenant.id,d.user_id,{email_verified:!0});const f=(await Zd(r.data.users,i.tenant.id,c)).filter(w=>w.provider!=="auth2");if(f.length>0){const w=f.filter(h=>!h.linked_to);w.length>1&&console.error("More than one primary user found for email",c),w.length===0&&console.error("No primary user found for email",c),w.length===1&&await r.data.users.update(i.tenant.id,d.user_id,{linked_to:(m=w[0])==null?void 0:m.user_id})}return t.html(_(h1,{vendorSettings:a,state:e}))}),g1=t=>{const{vendorSettings:e,email:n,state:r}=t;return _(De,{title:O.t("email_verification_for_signup_sent_title"),vendorSettings:e,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("email_verification_for_signup_sent_title")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_("div",{className:"mb-6 text-gray-300",children:_(xa,{i18nKey:"email_verification_for_signup_sent_description",components:[_("span",{className:"text-black dark:text-white"},"span")],values:{email:n}})}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]})]}),_(bt,{state:r})]})},m6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e),{username:i}=r.authParams;if(!i)throw new A(400,{message:"Username required"});return t.html(_(g1,{vendorSettings:n,state:e,email:i}))}),cu=`
|
|
248
|
+
`])))]})},a6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await ke(t,e);if(!i.authParams.username)throw new A(400,{message:"Username required"});return t.html(_(Vr,{vendorSettings:n,email:i.authParams.username,state:e,client:r}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string()})}}}},responses:{200:{description:"HTML page indicating success or a next step (if not redirecting).",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent).",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid password, username required).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{password:r}=n,{vendorSettings:i,client:o,loginSession:a}=await ke(t,e),{username:c}=a.authParams;if(!c)throw new A(400,{message:"Username required"});try{const d=await tu(t,o,{...a.authParams,password:r},a);return d instanceof Response?d:(console.error("Unexpected TokenResponse in POST /u/enter-password. This might indicate a flow misconfiguration as this route expects HTML or redirect.",d),t.html(_(Vr,{vendorSettings:i,email:c,error:"An unexpected error occurred. Please try again.",state:e,client:o}),500))}catch(d){const l=d;return l.code==="INVALID_PASSWORD"||l.code==="USER_NOT_FOUND"?t.html(_(Vr,{vendorSettings:i,email:c,error:O.t("invalid_password"),state:e,client:o}),400):l.code==="EMAIL_NOT_VERIFIED"?t.html(_(c1,{vendorSettings:i,state:e}),400):t.html(_(Vr,{vendorSettings:i,email:c,error:l.message||"An unknown error occurred.",state:e,client:o}),l.code?400:500)}}),vn=t=>{const{state:e,error:n,vendorSettings:r,email:i,code:o}=t;return _(De,{title:O.t("create_account_title"),vendorSettings:r,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("create_account_title")}),_("div",{className:"mb-6 text-gray-300",children:O.t("create_account_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{children:[_("input",{type:"hidden",name:"code",value:o}),_("input",{type:"email",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:i,disabled:!!i}),_("input",{type:"password",name:"password",placeholder:O.t("enter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),_("input",{type:"password",name:"re-enter-password",placeholder:O.t("reenter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),n&&_(Gn,{children:n}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("continue")})]}),_(bt,{state:e})]})]})},c6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().optional().openapi({description:"The code parameter from an email verification link"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{vendorSettings:r,loginSession:i}=await ke(t,e),{username:o}=i.authParams;if(!o)throw new A(400,{message:"Username required"});return n?t.html(_(vn,{state:e,vendorSettings:r,email:o,code:n})):t.html(_(vn,{state:e,vendorSettings:r,email:o}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string(),code:s.z.string().optional()})}}}},responses:{200:{description:"HTML page indicating success (e.g., email verification sent) or a next step.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent) after successful login.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., passwords don't match, weak password, user exists).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{env:r}=t;let i,o,a,c;try{({vendorSettings:i,client:o,loginSession:a}=await ke(t,e));const d="Username-Password-Authentication";if(t.set("client_id",o.id),t.set("connection",d),{username:c}=a.authParams,!c)return t.html(_(Ct,{vendorSettings:i,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("username_required_error")||"Username required"}),400);if(n.password!==n["re-enter-password"])return t.html(_(vn,{state:e,code:n.code,vendorSettings:i,error:O.t("create_account_passwords_didnt_match"),email:c}),400);if(!Yl(n.password))return t.html(_(vn,{state:e,code:n.code,vendorSettings:i,error:O.t("create_account_weak_password"),email:c}),400);const l=n.code?await r.data.codes.get(o.tenant.id,n.code,"email_verification"):void 0,u=l?await r.data.loginSessions.get(o.tenant.id,l.login_id):void 0;if(await kr({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:c,provider:"auth2"}))return t.html(_(vn,{state:e,code:n.code,vendorSettings:i,error:O.t("user_exists_error")||"User already exists",email:c}),400);const m=(u==null?void 0:u.authParams.username)===c,w=await b0(t).users.create(o.tenant.id,{user_id:`auth2|${$s()}`,email:c,email_verified:m,provider:"auth2",connection:d,is_social:!1});if(await r.data.passwords.create(o.tenant.id,{user_id:w.user_id,password:await vi.hash(n.password,10),algorithm:"bcrypt"}),!m)return await eu(t,w),t.html(_(Ct,{message:O.t("validate_email_body"),pageTitle:O.t("validate_email_title"),vendorSettings:i,state:e}));const h=await tu(t,o,{...a.authParams,password:n.password},a);return h instanceof Response?h:(console.error("Unexpected TokenResponse in POST /u/signup after login. This might indicate a flow misconfiguration as this route expects HTML or redirect.",h),t.html(_(Ct,{vendorSettings:i,state:e,pageTitle:O.t("error_page_title")||"Error",message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500))}catch(d){let l=O.t("unknown_error_message")||"An unknown error occurred.",u=400;return d instanceof A?(l=d.message||l,u=d.status===400?400:500):d instanceof Qn?l=d.message||l:d instanceof Error&&(l=d.message||l,u=500),t.html(_(vn,{state:e,vendorSettings:i,error:l,email:c,code:n.code}),u)}}),er=t=>{const{error:e,vendorSettings:n,email:r}=t;return _(De,{title:O.t("reset_password_title"),vendorSettings:n,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("reset_password_title")}),_("div",{className:"mb-6 text-gray-300",children:`${O.t("reset_password_description")} ${r}`}),_("div",{className:"flex flex-1 flex-col justify-center",children:_(tn,{children:[_(Td,{name:"password",placeholder:O.t("enter_new_password_placeholder")}),_(Td,{name:"re-enter-password",placeholder:O.t("reenter_new_password_placeholder")}),e&&_(Gn,{children:e}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("reset_password_cta")})]})})]})},d6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e);if(!r.authParams.username)throw new A(400,{message:"Username required"});return t.html(_(er,{vendorSettings:n,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{password:r,"re-enter-password":i}=t.req.valid("form"),{env:o}=t,{vendorSettings:a,client:c,loginSession:d}=await ke(t,e);if(!d.authParams.username)throw new A(400,{message:"Username required"});if(r!==i)return t.html(_(er,{error:O.t("create_account_passwords_didnt_match"),vendorSettings:a,email:d.authParams.username}),400);if(!Yl(r))return t.html(_(er,{error:O.t("create_account_weak_password"),vendorSettings:a,email:d.authParams.username}),400);const l=await kr({userAdapter:o.data.users,tenant_id:c.tenant.id,username:d.authParams.username,provider:"auth2"});if(!l)throw new A(400,{message:"User not found"});try{if(!await o.data.codes.get(c.tenant.id,n,"password_reset"))return t.html(_(er,{error:"Code not found or expired",vendorSettings:a,email:d.authParams.username}),400);const f={user_id:l.user_id,password:await vi.hash(r,10),algorithm:"bcrypt"};await o.data.passwords.get(c.tenant.id,l.user_id)?await o.data.passwords.update(c.tenant.id,f):await o.data.passwords.create(c.tenant.id,f),l.email_verified||await o.data.users.update(c.tenant.id,l.user_id,{email_verified:!0})}catch{return t.html(_(er,{error:"The password could not be reset",vendorSettings:a,email:d.authParams.username}),400)}return t.html(_(Ct,{message:O.t("password_has_been_reset"),vendorSettings:a,state:e}))}),d1=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t;return _(De,{title:O.t("forgot_password_title"),vendorSettings:n,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("forgot_password_title")}),_("div",{className:"mb-6 text-gray-300",children:O.t("forgot_password_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_(tn,{className:"pt-2",children:[_("input",{type:"email",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r,disabled:!!r}),e&&_(Gn,{children:e}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("forgot_password_cta")})]}),_(bt,{state:i})]})]})},l1=t=>{const{vendorSettings:e,state:n}=t;return _(De,{title:"Login",vendorSettings:e,children:[_("div",{className:"flex flex-1 flex-col justify-center",children:[_("div",{children:O.t("forgot_password_email_sent")}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]})]}),_(bt,{state:n})]})},l6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e);return t.html(_(d1,{vendorSettings:n,state:e,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await ke(t,e);return await X4(t,r,i.authParams.username,i.id),t.html(_(l1,{vendorSettings:n,state:e}))}),u1=({vendorSettings:t,state:e,user:n})=>_(De,{title:re("check_email_title"),vendorSettings:t,children:_("div",{className:"flex flex-1 flex-col justify-center",children:[_("div",{className:"mb-8 text-gray-700 dark:text-gray-300",children:[_($a,{i18nKey:"currently_logged_in_as",components:[_("span",{className:"font-semibold text-gray-900 dark:text-white"},"span")],values:{email:n.email||""}}),_("br",{}),re("continue_with_sso_provider_headline")]}),_("div",{className:"space-y-6",children:[_(tn,{children:_(Le,{className:"!text-base",children:_("span",{children:O.t("yes_continue_with_existing_account")})})}),_("a",{className:"block text-center text-primary hover:text-primaryHover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 dark:focus:ring-offset-gray-900",href:`/u/login/identifier?state=${encodeURIComponent(e)}`,children:O.t("no_use_another")})]})]})}),u6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page to check account status or verify email.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login identifier page if no valid session.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i}=await ke(t,n);if(!i||!((d=i.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/check-account after initJSXRoute"),t.html(_(Ct,{vendorSettings:r,state:n,pageTitle:O.t("error_page_title")||"Error",message:O.t("configuration_error_message")||"A configuration error occurred."}),500);const o=zo(i.tenant.id,t.req.header("cookie")),a=o?await e.data.sessions.get(i.tenant.id,o):null;if(!a)return t.redirect(`/u/login/identifier?state=${n}`);const c=await e.data.users.get(i.tenant.id,a.user_id);return c?t.html(_(u1,{vendorSettings:r,state:n,user:c})):t.redirect(`/u/login/identifier?state=${n}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow or to login identifier.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues or if TokenResponse is returned.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var u;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i,loginSession:o}=await ke(t,n);if(!i||!((u=i.tenant)!=null&&u.id))return console.error("Client or tenant ID missing in POST /u/check-account after initJSXRoute"),t.html(_(Ct,{vendorSettings:r,state:n,pageTitle:O.t("error_page_title")||"Error",message:O.t("configuration_error_message")||"A configuration error occurred."}),500);const a=zo(i.tenant.id,t.req.header("cookie")),c=a?await e.data.sessions.get(i.tenant.id,a):null;if(!c)return t.redirect(`/u/login/identifier?state=${n}`);const d=await e.data.users.get(i.tenant.id,c.user_id);if(!d)return t.redirect(`/u/login/identifier?state=${n}`);const l=await Zt(t,{user:d,authParams:o.authParams,client:i,loginSession:o});if(!(l instanceof Response))throw new A(500,{message:O.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."});return l}),p1=t=>{const{vendorSettings:e,email:n,state:r}=t;return _(De,{title:O.t("create_password_account_title"),vendorSettings:e,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("create_password_account_title")}),_("div",{className:"mb-6 text-gray-300",children:O.t("enter_email_for_verification_description")}),_("div",{className:"flex flex-1 flex-col justify-center",children:_(tn,{className:"pt-2",children:[_("input",{type:"email",name:"username",placeholder:O.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:n,disabled:!0}),_(Le,{className:"sm:mt-4 !text-base",children:O.t("send")})]})}),_(bt,{state:r})]})},p6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e),{username:i}=r.authParams;if(!i)throw new A(400,{message:"Username required"});return t.html(_(p1,{state:e,vendorSettings:n,email:i}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{loginSession:n,client:r}=await ke(t,e),{username:i}=n.authParams;if(!i)throw new A(400,{message:"Username required"});const o=await t.env.data.codes.create(r.tenant.id,{code_id:Dn(),code_type:"email_verification",login_id:n.id,expires_at:new Date(Date.now()+R_).toISOString()});return await G4(t,i,o.code_id,n.id),t.redirect(`/u/pre-signup-sent?state=${e}`)}),f1=t=>{const{redirectUrl:e,vendorSettings:n}=t;return _(De,{title:O.t("invalid_session_title"),vendorSettings:n,children:[_("div",{className:"flex flex-1 flex-col justify-center",children:O.t("invalid_session_body")}),_("div",{className:"flex flex-1 flex-col justify-center",children:e&&_("a",{className:"block text-primary hover:text-primaryHover text-center",href:e,children:O.t("go_back")})})]})},f6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e);let i;return r.authParams.redirect_uri&&r.authParams.state&&(i=new URL(r.authParams.redirect_uri),i.searchParams.set("state",r.authParams.state),i.searchParams.set("error","invalid_session"),i.searchParams.set("error_description",r.authParams.username||"")),t.html(_(f1,{redirectUrl:i==null?void 0:i.href,vendorSettings:n}))}),h6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const e=await Gm(t.env),{state:n}=t.req.valid("query");return t.html(_(Ct,{message:"Not implemented",pageTitle:"User info",vendorSettings:e,state:n}))}),h1=({vendorSettings:t,state:e})=>{const n=new URLSearchParams({state:e});return _(De,{title:O.t("email_validated"),vendorSettings:t,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("email_validated")}),_("div",{className:"flex flex-1 flex-col justify-center mb-7",children:_(Le,{Component:"a",href:`/u/enter-password?${n}`,className:"text-base sm:mt-4 md:text-base",children:_("div",{className:"flex items-center space-x-2",children:[_("span",{children:O.t("email_validated_cta")}),_(Be,{className:"text-xs",name:"arrow-right"})]})})})]})},g6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{var m;const{state:e,code:n}=t.req.valid("query"),{env:r}=t,{client:i,loginSession:o,vendorSettings:a}=await ke(t,e),{username:c}=o.authParams;if(!c)throw new A(400,{message:"Username not found in state"});const d=await kr({userAdapter:r.data.users,tenant_id:i.tenant.id,username:c,provider:"auth2"});if(!d)throw new A(500,{message:"No user found"});if(!await r.data.codes.get(i.tenant.id,n,"email_verification"))throw new A(400,{message:"Code not found or expired"});await r.data.users.update(i.tenant.id,d.user_id,{email_verified:!0});const f=(await Xd(r.data.users,i.tenant.id,c)).filter(w=>w.provider!=="auth2");if(f.length>0){const w=f.filter(h=>!h.linked_to);w.length>1&&console.error("More than one primary user found for email",c),w.length===0&&console.error("No primary user found for email",c),w.length===1&&await r.data.users.update(i.tenant.id,d.user_id,{linked_to:(m=w[0])==null?void 0:m.user_id})}return t.html(_(h1,{vendorSettings:a,state:e}))}),g1=t=>{const{vendorSettings:e,email:n,state:r}=t;return _(De,{title:O.t("email_verification_for_signup_sent_title"),vendorSettings:e,children:[_("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:O.t("email_verification_for_signup_sent_title")}),_("div",{className:"flex flex-1 flex-col justify-center",children:[_("div",{className:"mb-6 text-gray-300",children:_($a,{i18nKey:"email_verification_for_signup_sent_description",components:[_("span",{className:"text-black dark:text-white"},"span")],values:{email:n}})}),_("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[_(Be,{className:"text-base",name:"info-bubble"}),_("div",{className:"text-sm text-gray-300 md:text-sm",children:O.t("sent_code_spam")})]})]}),_(bt,{state:r})]})},m6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await ke(t,e),{username:i}=r.authParams;if(!i)throw new A(400,{message:"Username required"});return t.html(_(g1,{vendorSettings:n,state:e,email:i}))}),cu=`
|
|
249
249
|
@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:400;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2) format("woff2")}@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:500;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2) format("woff2")}@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:600;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2) format("woff2")}@font-face{font-family:uicon;src:url(https://login2.sesamy.com/_next/static/media/uicon.0b00e08a.woff2)}[class*=" uicon-"],[class^=uicon-]{font-family:uicon!important;font-size:inherit;font-style:normal;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.uicon-apple:before{content:"\\ea01"}.uicon-arrow-down:before{content:"\\ea02"}.uicon-arrow-left:before{content:"\\ea03"}.uicon-arrow-right:before{content:"\\ea04"}.uicon-arrow-up:before{content:"\\ea05"}.uicon-facebook:before{content:"\\ea06"}.uicon-google:before{content:"\\ea07"}.uicon-info-bubble:before{content:"\\ea08"}.uicon-info:before{content:"\\ea09"}.uicon-sesamy:before{content:"\\ea0a"}.uicon-spinner-circle:before{content:"\\ea0b"}.uicon-spinner-inner:before{content:"\\ea0c"}
|
|
250
250
|
|
|
251
|
-
/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #bfbcd7;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:KHTeka,Helvetica Neue,HelveticaNeue,TeX Gyre Heros,TeXGyreHeros,FreeSans,Nimbus Sans L,Liberation Sans,Arimo,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#4b4a58;opacity:1}input::placeholder,textarea::placeholder{color:#4b4a58;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}body,html{height:100%}body{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity));font-size:1rem;letter-spacing:.0125rem;line-height:120%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:1280px){body{font-size:1.125rem;line-height:120%}}:is(.dark body){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}button,input,optgroup,select,textarea{font-size:.875rem;letter-spacing:.0125rem;line-height:120%}@media (min-width:1280px){button,input,optgroup,select,textarea{font-size:1rem;line-height:120%}}h1{font-size:1.5rem;font-weight:500;line-height:120%}@media (min-width:1280px){h1{font-size:2rem;line-height:120%}}@media (min-width:640px){h1{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}@media (min-width:1280px){h1{font-size:3.5rem;letter-spacing:-.0625rem;line-height:100%}}h2{font-size:1.25rem;font-weight:500;line-height:120%}@media (min-width:1280px){h2{font-size:1.5rem;line-height:120%}}@media (min-width:640px){h2{font-size:2rem;letter-spacing:0;line-height:120%}}@media (min-width:1280px){h2{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}h3{font-size:1.125rem;font-weight:500;line-height:120%}@media (min-width:1280px){h3{font-size:1.25rem;line-height:120%}}@media (min-width:640px){h3{font-size:1.5rem;line-height:120%}}@media (min-width:1280px){h3{font-size:2rem;line-height:120%}}h4{font-size:1rem;font-weight:500;line-height:120%}@media (min-width:1280px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:640px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:1280px){h4{font-size:1.5rem;line-height:120%}}h5{font-size:.875rem;font-weight:500;line-height:120%}@media (min-width:1280px){h5{font-size:1rem;line-height:120%}}@media (min-width:640px){h5{font-size:1rem;line-height:120%}}@media (min-width:1280px){h5{font-size:1.125rem;line-height:120%}}h6{font-size:.75rem;font-weight:500;line-height:135%}@media (min-width:1280px){h6{font-size:.875rem;line-height:120%}}@media (min-width:640px){h6{font-size:.875rem;line-height:120%}}@media (min-width:1280px){h6{font-size:1rem;line-height:120%}}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1920px){.container{max-width:1920px}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\\/2{top:50%}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-12{margin-bottom:3rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-8{margin-bottom:2rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.\\!hidden{display:none!important}.hidden{display:none}.h-5{height:1.25rem}.h-9{height:2.25rem}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-\\[calc\\(100vh-83px\\)\\]{min-height:calc(100vh - 83px)}.min-h-full{min-height:100%}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-\\[calc\\(100\\%-theme\\(space\\.2\\)-theme\\(space\\.2\\)\\)\\]{width:calc(100% - 1rem)}.w-full{width:100%}.max-w-\\[1295px\\]{max-width:1295px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.\\!flex-nowrap{flex-wrap:nowrap!important}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:1.25rem}.rounded-lg{border-radius:.625rem}.rounded-r-lg{border-bottom-right-radius:.625rem;border-top-right-radius:.625rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(248 249 251/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(191 188 215/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(136 134 159/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}.border-red{--tw-border-opacity:1;border-color:rgb(252 90 90/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary-color)}.bg-primaryHover{background-color:var(--primary-hover)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.px-0{padding-left:0;padding-right:0}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-2{padding-top:.5rem}.pt-2\\.5{padding-top:.625rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.indent-\\[5px\\]{text-indent:5px}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.\\!text-base{font-size:1rem!important;line-height:120%!important}.text-2xl{font-size:1.5rem;line-height:120%}.text-3xl{font-size:2rem;line-height:120%}.text-base{font-size:1rem;line-height:120%}.text-lg{font-size:1.125rem;line-height:120%}.text-sm{font-size:.875rem;line-height:120%}.text-xl{font-size:1.25rem;line-height:120%}.text-xs{font-size:.75rem;line-height:135%}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-\\[0\\]{line-height:0}.leading-tight{line-height:1.25}.text-\\[\\#1196F5\\]{--tw-text-opacity:1;color:rgb(17 150 245/var(--tw-text-opacity))}.text-\\[\\#B2B2B2\\]{--tw-text-opacity:1;color:rgb(178 178 178/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(191 188 215/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(75 74 88/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(30 30 39/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(8 8 14/var(--tw-text-opacity))}.text-primary{color:var(--primary-color)}.text-red{--tw-text-opacity:1;color:rgb(252 90 90/var(--tw-text-opacity))}.text-textOnPrimary{color:var(--text-on-primary)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.accent-\\[\\#4F2D7F\\]{accent-color:#4f2d7f}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.row-up-left{align-content:flex-start;justify-content:flex-start}.row,.row-up-left{display:flex;flex-direction:row;flex-wrap:wrap}.row{align-content:center;align-items:center;justify-content:center}.column-left{align-items:flex-start}.column,.column-left{display:flex;flex-direction:column;justify-content:center}.column{align-items:center}@media (min-width:1280px){.text-5xl{font-size:5.125rem;letter-spacing:-.125rem;line-height:100%}.text-4xl{font-size:3.5rem}.text-3xl,.text-4xl{letter-spacing:-.0625rem;line-height:100%}.text-3xl{font-size:3rem}.text-2xl{font-size:2rem}.text-2xl,.text-xl{line-height:120%}.text-xl{font-size:1.5rem}.text-lg{font-size:1.25rem}.text-base,.text-lg{line-height:120%}.text-base{font-size:1.125rem}.text-sm{font-size:1rem}.text-sm,.text-xs{line-height:120%}.text-xs{font-size:.875rem}}:root{--primary-color:#7d68f4;--primary-hover:#7e69f4;--text-on-primary:#fff}svg{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}*,:after,:before{text-underline-offset:4px}input[type=number],input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield!important}.btn.is-loading{cursor:not-allowed;opacity:.4;pointer-events:none}.btn .btn-spinner,.btn.is-loading .btn-label{opacity:0;visibility:hidden}.btn.is-loading .btn-spinner{opacity:1;visibility:visible}[class*=" uicon-"],[class^=uicon-]{letter-spacing:0;line-height:100%}.placeholder\\:text-gray-300::-moz-placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.placeholder\\:text-gray-300::placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.hover\\:bg-black\\/5:hover{background-color:rgba(0,0,0,.05)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.hover\\:bg-primaryHover:hover{background-color:var(--primary-hover)}.hover\\:text-primaryHover:hover{color:var(--primary-hover)}.hover\\:underline:hover{text-decoration-line:underline}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-2:focus,.focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-primary:focus{--tw-ring-color:var(--primary-color)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}:is(.dark .dark\\:border-gray-400){--tw-border-opacity:1;border-color:rgb(75 74 88/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-500){--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-600){--tw-border-opacity:1;border-color:rgb(40 40 52/var(--tw-border-opacity))}:is(.dark .dark\\:bg-black){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(40 40 52/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(20 20 26/var(--tw-bg-opacity))}:is(.dark .dark\\:text-\\[\\#201a41\\]){--tw-text-opacity:1;color:rgb(32 26 65/var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-300){--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}:is(.dark .dark\\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\\:hover\\:bg-black\\/90:hover){background-color:rgba(0,0,0,.9)}:is(.dark .dark\\:focus\\:ring-offset-gray-900:focus){--tw-ring-offset-color:#08080e}@media (min-width:640px){.sm\\:absolute{position:absolute}.sm\\:left-4{left:1rem}.sm\\:top-1\\/2{top:50%}.sm\\:mt-4{margin-top:1rem}.sm\\:inline{display:inline}.sm\\:h-6{height:1.5rem}.sm\\:min-h-\\[700px\\]{min-height:700px}.sm\\:w-6{width:1.5rem}.sm\\:w-\\[calc\\(100\\%-theme\\(space\\.16\\)-theme\\(space\\.16\\)\\)\\]{width:calc(100% - 8rem)}.sm\\:w-auto{width:auto}.sm\\:max-w-md{max-width:28rem}.sm\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:flex-col{flex-direction:column}.sm\\:justify-normal{justify-content:normal}.sm\\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(0px*(1 - var(--tw-space-x-reverse)));margin-right:calc(0px*var(--tw-space-x-reverse))}.sm\\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.sm\\:bg-fixed{background-attachment:fixed}.sm\\:bg-left-top{background-position:0 0}.sm\\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\\:px-14{padding-left:3.5rem;padding-right:3.5rem}.sm\\:py-14{padding-bottom:3.5rem;padding-top:3.5rem}.sm\\:py-4{padding-bottom:1rem;padding-top:1rem}.sm\\:pt-16{padding-top:4rem}.sm\\:text-2xl{font-size:1.5rem;line-height:120%}.sm\\:text-base{font-size:1rem;line-height:120%}}@media (min-width:1280px){.md\\:min-w-\\[448px\\]{min-width:448px}.md\\:text-3xl{font-size:2rem;line-height:120%}.md\\:text-base{font-size:1rem;line-height:120%}.md\\:text-sm{font-size:.875rem;line-height:120%}.md\\:text-xs{font-size:.75rem;line-height:135%}}@media (max-height:900px) and (min-width:640px){.short\\:static{position:static}.short\\:left-auto{left:auto}.short\\:top-auto{top:auto}.short\\:hidden{display:none}.short\\:h-5{height:1.25rem}.short\\:min-h-\\[558px\\]{min-height:558px}.short\\:w-5{width:1.25rem}.short\\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.short\\:flex-row{flex-direction:row}.short\\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.short\\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(0px*var(--tw-space-y-reverse));margin-top:calc(0px*(1 - var(--tw-space-y-reverse)))}.short\\:px-0{padding-left:0;padding-right:0}.short\\:py-3{padding-bottom:.75rem;padding-top:.75rem}.short\\:text-xl{font-size:1.25rem;line-height:120%}}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:0}.\\[\\&_h1\\]\\:mb-6 h1,.\\[\\&_h2\\]\\:mb-6 h2{margin-bottom:1.5rem}`;function _6(){if(typeof document<"u"){const t=document.createElement("style");t.innerHTML=cu,t.setAttribute("data-authhero-tailwind",""),document.head.appendChild(t)}}const y6=t=>_("div",{className:"rich-text mb-6 prose prose-gray max-w-none [&>*:last-child]:mb-0 [&_h1]:mb-6 [&_h2]:mb-6",dangerouslySetInnerHTML:{__html:t.config.content}},t.id),w6=t=>_("div",{className:"flex items-center gap-2",children:[_("input",{type:"checkbox",name:t.id,required:!!t.required,className:"w-5 h-5 accent-[#4F2D7F] align-middle",id:t.id}),_("span",{className:"text-base leading-tight",children:_("span",{dangerouslySetInnerHTML:{__html:t.config.text}})})]},t.id);function v6(t){switch(t.type){case"RICH_TEXT":return y6(t);case"LEGAL":return w6(t);default:return null}}const Za=({vendorSettings:t,formName:e,error:n,components:r})=>{const i=r==null?void 0:r.find(c=>c.type==="LEGAL"&&c.required),o=i==null?void 0:i.id,a=r==null?void 0:r.find(c=>c.type==="NEXT_BUTTON");return _(De,{title:e,vendorSettings:t,children:[n&&_("div",{className:"mb-4 text-red-500",children:n}),_("div",{className:"flex flex-1 flex-col justify-center",children:_("form",{className:"pt-2",method:"post",children:[o&&_("style",{dangerouslySetInnerHTML:{__html:`
|
|
251
|
+
/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #bfbcd7;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:KHTeka,Helvetica Neue,HelveticaNeue,TeX Gyre Heros,TeXGyreHeros,FreeSans,Nimbus Sans L,Liberation Sans,Arimo,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#4b4a58;opacity:1}input::placeholder,textarea::placeholder{color:#4b4a58;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}body,html{height:100%}body{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity));font-size:1rem;letter-spacing:.0125rem;line-height:120%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:1280px){body{font-size:1.125rem;line-height:120%}}:is(.dark body){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}button,input,optgroup,select,textarea{font-size:.875rem;letter-spacing:.0125rem;line-height:120%}@media (min-width:1280px){button,input,optgroup,select,textarea{font-size:1rem;line-height:120%}}h1{font-size:1.5rem;font-weight:500;line-height:120%}@media (min-width:1280px){h1{font-size:2rem;line-height:120%}}@media (min-width:640px){h1{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}@media (min-width:1280px){h1{font-size:3.5rem;letter-spacing:-.0625rem;line-height:100%}}h2{font-size:1.25rem;font-weight:500;line-height:120%}@media (min-width:1280px){h2{font-size:1.5rem;line-height:120%}}@media (min-width:640px){h2{font-size:2rem;letter-spacing:0;line-height:120%}}@media (min-width:1280px){h2{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}h3{font-size:1.125rem;font-weight:500;line-height:120%}@media (min-width:1280px){h3{font-size:1.25rem;line-height:120%}}@media (min-width:640px){h3{font-size:1.5rem;line-height:120%}}@media (min-width:1280px){h3{font-size:2rem;line-height:120%}}h4{font-size:1rem;font-weight:500;line-height:120%}@media (min-width:1280px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:640px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:1280px){h4{font-size:1.5rem;line-height:120%}}h5{font-size:.875rem;font-weight:500;line-height:120%}@media (min-width:1280px){h5{font-size:1rem;line-height:120%}}@media (min-width:640px){h5{font-size:1rem;line-height:120%}}@media (min-width:1280px){h5{font-size:1.125rem;line-height:120%}}h6{font-size:.75rem;font-weight:500;line-height:135%}@media (min-width:1280px){h6{font-size:.875rem;line-height:120%}}@media (min-width:640px){h6{font-size:.875rem;line-height:120%}}@media (min-width:1280px){h6{font-size:1rem;line-height:120%}}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1920px){.container{max-width:1920px}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\\/2{top:50%}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-12{margin-bottom:3rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-8{margin-bottom:2rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.\\!hidden{display:none!important}.hidden{display:none}.h-5{height:1.25rem}.h-9{height:2.25rem}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-\\[calc\\(100vh-83px\\)\\]{min-height:calc(100vh - 83px)}.min-h-full{min-height:100%}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-\\[calc\\(100\\%-theme\\(space\\.2\\)-theme\\(space\\.2\\)\\)\\]{width:calc(100% - 1rem)}.w-full{width:100%}.max-w-\\[1295px\\]{max-width:1295px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.\\!flex-nowrap{flex-wrap:nowrap!important}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:1.25rem}.rounded-lg{border-radius:.625rem}.rounded-r-lg{border-bottom-right-radius:.625rem;border-top-right-radius:.625rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(248 249 251/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(191 188 215/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(136 134 159/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}.border-red{--tw-border-opacity:1;border-color:rgb(252 90 90/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary-color)}.bg-primaryHover{background-color:var(--primary-hover)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.px-0{padding-left:0;padding-right:0}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-2{padding-top:.5rem}.pt-2\\.5{padding-top:.625rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.indent-\\[5px\\]{text-indent:5px}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.\\!text-base{font-size:1rem!important;line-height:120%!important}.text-2xl{font-size:1.5rem;line-height:120%}.text-3xl{font-size:2rem;line-height:120%}.text-base{font-size:1rem;line-height:120%}.text-lg{font-size:1.125rem;line-height:120%}.text-sm{font-size:.875rem;line-height:120%}.text-xl{font-size:1.25rem;line-height:120%}.text-xs{font-size:.75rem;line-height:135%}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-\\[0\\]{line-height:0}.leading-tight{line-height:1.25}.text-\\[\\#1196F5\\]{--tw-text-opacity:1;color:rgb(17 150 245/var(--tw-text-opacity))}.text-\\[\\#B2B2B2\\]{--tw-text-opacity:1;color:rgb(178 178 178/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(191 188 215/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(75 74 88/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(30 30 39/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(8 8 14/var(--tw-text-opacity))}.text-primary{color:var(--primary-color)}.text-red{--tw-text-opacity:1;color:rgb(252 90 90/var(--tw-text-opacity))}.text-textOnPrimary{color:var(--text-on-primary)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.accent-\\[\\#4F2D7F\\]{accent-color:#4f2d7f}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.row-up-left{align-content:flex-start;justify-content:flex-start}.row,.row-up-left{display:flex;flex-direction:row;flex-wrap:wrap}.row{align-content:center;align-items:center;justify-content:center}.column-left{align-items:flex-start}.column,.column-left{display:flex;flex-direction:column;justify-content:center}.column{align-items:center}@media (min-width:1280px){.text-5xl{font-size:5.125rem;letter-spacing:-.125rem;line-height:100%}.text-4xl{font-size:3.5rem}.text-3xl,.text-4xl{letter-spacing:-.0625rem;line-height:100%}.text-3xl{font-size:3rem}.text-2xl{font-size:2rem}.text-2xl,.text-xl{line-height:120%}.text-xl{font-size:1.5rem}.text-lg{font-size:1.25rem}.text-base,.text-lg{line-height:120%}.text-base{font-size:1.125rem}.text-sm{font-size:1rem}.text-sm,.text-xs{line-height:120%}.text-xs{font-size:.875rem}}:root{--primary-color:#7d68f4;--primary-hover:#7e69f4;--text-on-primary:#fff}svg{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}*,:after,:before{text-underline-offset:4px}input[type=number],input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield!important}.btn.is-loading{cursor:not-allowed;opacity:.4;pointer-events:none}.btn .btn-spinner,.btn.is-loading .btn-label{opacity:0;visibility:hidden}.btn.is-loading .btn-spinner{opacity:1;visibility:visible}[class*=" uicon-"],[class^=uicon-]{letter-spacing:0;line-height:100%}.placeholder\\:text-gray-300::-moz-placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.placeholder\\:text-gray-300::placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.hover\\:bg-black\\/5:hover{background-color:rgba(0,0,0,.05)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.hover\\:bg-primaryHover:hover{background-color:var(--primary-hover)}.hover\\:text-primaryHover:hover{color:var(--primary-hover)}.hover\\:underline:hover{text-decoration-line:underline}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-2:focus,.focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-primary:focus{--tw-ring-color:var(--primary-color)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}:is(.dark .dark\\:border-gray-400){--tw-border-opacity:1;border-color:rgb(75 74 88/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-500){--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-600){--tw-border-opacity:1;border-color:rgb(40 40 52/var(--tw-border-opacity))}:is(.dark .dark\\:bg-black){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(40 40 52/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(20 20 26/var(--tw-bg-opacity))}:is(.dark .dark\\:text-\\[\\#201a41\\]){--tw-text-opacity:1;color:rgb(32 26 65/var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-300){--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}:is(.dark .dark\\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\\:hover\\:bg-black\\/90:hover){background-color:rgba(0,0,0,.9)}:is(.dark .dark\\:focus\\:ring-offset-gray-900:focus){--tw-ring-offset-color:#08080e}@media (min-width:640px){.sm\\:absolute{position:absolute}.sm\\:left-4{left:1rem}.sm\\:top-1\\/2{top:50%}.sm\\:mt-4{margin-top:1rem}.sm\\:inline{display:inline}.sm\\:h-6{height:1.5rem}.sm\\:min-h-\\[700px\\]{min-height:700px}.sm\\:w-6{width:1.5rem}.sm\\:w-\\[calc\\(100\\%-theme\\(space\\.16\\)-theme\\(space\\.16\\)\\)\\]{width:calc(100% - 8rem)}.sm\\:w-auto{width:auto}.sm\\:max-w-md{max-width:28rem}.sm\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:flex-col{flex-direction:column}.sm\\:justify-normal{justify-content:normal}.sm\\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(0px*(1 - var(--tw-space-x-reverse)));margin-right:calc(0px*var(--tw-space-x-reverse))}.sm\\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.sm\\:bg-fixed{background-attachment:fixed}.sm\\:bg-left-top{background-position:0 0}.sm\\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\\:px-14{padding-left:3.5rem;padding-right:3.5rem}.sm\\:py-14{padding-bottom:3.5rem;padding-top:3.5rem}.sm\\:py-4{padding-bottom:1rem;padding-top:1rem}.sm\\:pt-16{padding-top:4rem}.sm\\:text-2xl{font-size:1.5rem;line-height:120%}.sm\\:text-base{font-size:1rem;line-height:120%}}@media (min-width:1280px){.md\\:min-w-\\[448px\\]{min-width:448px}.md\\:text-3xl{font-size:2rem;line-height:120%}.md\\:text-base{font-size:1rem;line-height:120%}.md\\:text-sm{font-size:.875rem;line-height:120%}.md\\:text-xs{font-size:.75rem;line-height:135%}}@media (max-height:900px) and (min-width:640px){.short\\:static{position:static}.short\\:left-auto{left:auto}.short\\:top-auto{top:auto}.short\\:hidden{display:none}.short\\:h-5{height:1.25rem}.short\\:min-h-\\[558px\\]{min-height:558px}.short\\:w-5{width:1.25rem}.short\\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.short\\:flex-row{flex-direction:row}.short\\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.short\\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(0px*var(--tw-space-y-reverse));margin-top:calc(0px*(1 - var(--tw-space-y-reverse)))}.short\\:px-0{padding-left:0;padding-right:0}.short\\:py-3{padding-bottom:.75rem;padding-top:.75rem}.short\\:text-xl{font-size:1.25rem;line-height:120%}}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:0}.\\[\\&_h1\\]\\:mb-6 h1,.\\[\\&_h2\\]\\:mb-6 h2{margin-bottom:1.5rem}`;function _6(){if(typeof document<"u"){const t=document.createElement("style");t.innerHTML=cu,t.setAttribute("data-authhero-tailwind",""),document.head.appendChild(t)}}const y6=t=>_("div",{className:"rich-text mb-6 prose prose-gray max-w-none [&>*:last-child]:mb-0 [&_h1]:mb-6 [&_h2]:mb-6",dangerouslySetInnerHTML:{__html:t.config.content}},t.id),w6=t=>_("div",{className:"flex items-center gap-2",children:[_("input",{type:"checkbox",name:t.id,required:!!t.required,className:"w-5 h-5 accent-[#4F2D7F] align-middle",id:t.id}),_("span",{className:"text-base leading-tight",children:_("span",{dangerouslySetInnerHTML:{__html:t.config.text}})})]},t.id),v6=t=>{var e;return _("div",{className:"mb-4",children:_("input",{type:"text",name:t.id,placeholder:((e=t.config)==null?void 0:e.placeholder)||"",required:!!t.required,className:"w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 border-gray-100 dark:border-gray-500",id:t.id})},t.id)};function b6(t){switch(t.type){case"RICH_TEXT":return y6(t);case"LEGAL":return w6(t);case"TEXT":return v6(t);default:return null}}const Xa=({vendorSettings:t,formName:e,error:n,components:r})=>{const i=r==null?void 0:r.find(c=>c.type==="LEGAL"&&c.required),o=i==null?void 0:i.id,a=r==null?void 0:r.find(c=>c.type==="NEXT_BUTTON");return _(De,{title:e,vendorSettings:t,children:[n&&_("div",{className:"mb-4 text-red-500",children:n}),_("div",{className:"flex flex-1 flex-col justify-center",children:_("form",{className:"pt-2",method:"post",children:[o&&_("style",{dangerouslySetInnerHTML:{__html:`
|
|
252
252
|
#_legalWrapper:has(#${o}:checked) #continueBtn {
|
|
253
253
|
display: block;
|
|
254
254
|
}
|
|
@@ -261,32 +261,32 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
261
261
|
#_legalWrapper:not(:has(#${o}:checked)) #continueBtnDisabled {
|
|
262
262
|
display: block;
|
|
263
263
|
}
|
|
264
|
-
`}}),_("div",{id:"_legalWrapper",children:[r&&r.map(c=>{if(c.type==="NEXT_BUTTON")return null;const d=
|
|
264
|
+
`}}),_("div",{id:"_legalWrapper",children:[r&&r.map(c=>{if(c.type==="NEXT_BUTTON")return null;const d=b6(c);return d?_("div",{className:c.type==="RICH_TEXT"?"mb-6":"mb-4",children:d},c.id):null}),a&&_("div",{className:"mb-4",children:o?_(ou,{children:[_(Le,{id:"continueBtn",className:"sm:mt-4 !text-base w-full",children:[_("span",{children:a.config.text||"Continue"}),_(Be,{className:"text-xs",name:"arrow-right"})]}),_(Le,{id:"continueBtnDisabled",className:"sm:mt-4 !text-base w-full opacity-50 cursor-not-allowed",disabled:!0,children:[_("span",{children:a.config.text||"Continue"}),_(Be,{className:"text-xs",name:"arrow-right"})]})]}):_(Le,{className:"sm:mt-4 !text-base w-full",children:[_("span",{children:a.config.text||"Continue"}),_(Be,{className:"text-xs",name:"arrow-right"})]})})]})]})})]})},$6=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()})},responses:{200:{description:"Form node HTML"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{client:i,vendorSettings:o}=await ke(t,r,!0),a=await t.env.data.forms.get(i.tenant.id,e);if(!a)throw new A(404,{message:"Form not found"});const c=(a.nodes||[]).find(d=>d.id===n&&d.type==="STEP");if(!c)throw new A(404,{message:"Node not found or not a STEP node"});return t.html(_(Xa,{vendorSettings:o,client:i,state:r,formName:a.name,nodeAlias:c.alias||c.type,components:"components"in c.config?c.config.components:[]}))}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.record(s.z.string())}}}},responses:{200:{description:"Form node submitted"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{vendorSettings:i,client:o}=await ke(t,r,!0);let a,c,d=[];try{if(a=await t.env.data.forms.get(o.tenant.id,e),!a)throw new A(404,{message:"Form not found"});if(c=(a.nodes||[]).find(v=>v.id===n&&v.type==="STEP"),!c)throw new A(404,{message:"Node not found or not a STEP node"});d="components"in c.config?c.config.components:[];const l=await t.req.parseBody(),u=[],f={};for(const v of d)if(v.type==="LEGAL"){const b=v.id,E=!!v.required,C=l[b];E&&(!C||C==="")?u.push(b):typeof C=="string"&&(f[b]=C)}if(u.length>0)return t.html(_(Xa,{vendorSettings:i,client:o,state:r,formName:a.name,nodeAlias:c.alias||c.type,components:d,error:`Missing required fields: ${u.join(", ")}`}));const m=await t.env.data.loginSessions.get(o.tenant.id,r);if(!m||!m.session_id||!m.authParams)throw new Error("Session expired");const w=await t.env.data.sessions.get(o.tenant.id,m.session_id);if(!w||!w.user_id)throw new Error("Session expired");const h=await t.env.data.users.get(t.var.tenant_id,w.user_id);if(!h)throw new Error("Session expired");const y=await Zt(t,{authParams:m.authParams,client:o,user:h,loginSession:m});return y instanceof Response?y:t.json(y)}catch{return t.html(_(Xa,{vendorSettings:i,client:o,state:r,formName:(a==null?void 0:a.name)||"",nodeAlias:(c==null?void 0:c.alias)||n||"",components:d||[],error:"Your session has expired. Please try again."}))}});function x6(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=As(r,t.dataAdapter),a=Vl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=Fl(r,a),i()}).use(Dl),e.get("/css/tailwind.css",async r=>{const i=cu;return r.text(i,200,{"content-type":"text/css; charset=utf-8"})});const n=e.route("/info",h6).route("/check-account",u6).route("/login/identifier",O$).route("/enter-code",n6).route("/enter-password",a6).route("/invalid-session",f6).route("/pre-signup",p6).route("/pre-signup-sent",m6).route("/reset-password",d6).route("/forgot-password",l6).route("/validate-email",g6).route("/signup",c6).route("/forms",$6);return n.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),n}const k6="Account detected",S6="We have detected that you have already created an account through",A6="By signing in, you agree to our",E6="and",z6="email address",I6="email or phone number",N6="phone number",C6="Callback URL mismatch",j6="The provided redirect_uri is not in the list of allowed callback URLs.",O6="continue with user",P6="Please click the button to create a new password account.",T6="Enter the code at {{vendorName}} to complete the login",R6="Welcome to {{vendorName}}! {{code}} is the login code",B6="Welcome to {{vendorName}}! {{code}} is the login code",L6="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",U6="The code is valid for 30 minutes",M6="Confirm password",F6="Need Help?",D6="Contact us",V6="or continue with social account",q6="Continue with {{provider}}",H6="Would you like to continue with your existing account?",K6="Copyright © 2023 SESAMY. All rights reserved.",G6="©2023 Sesamy",W6="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",J6="Please enter a valid email address.",X6="The passwords didn't match. Try again.",Z6="Choose password",Y6="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",Q6="Create new account",e8="Sign up with password",t8="You are currently logged in as <0>{{email}}</0>",n8="Email",r8="Email or Phone Number",i8="Email address",o8="Your email address has been validated",s8="Now enter your password to login again",a8="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",c8="Email verification sent",d8="Enter a code",l8="We'll send you a verification link to ensure you own this email address.",u8="Enter new password",p8="Enter password",f8="Enter your email address and password to login.",h8="Enter your password",g8="The magic link has expired. Please click on the button below to receive a new link in your inbox.",m8="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",_8="Send password reset email",y8="Click the button below and we’ll send instructions on how to reset your password.",w8="Password reset email sent",v8="Forgot password?",b8="Forgot password?",$8="Go back",x8="Hide password",k8="Invalid password",S8=`The link is no longer valid.
|
|
265
265
|
|
|
266
266
|
Please make sure to open the login link in the same browser you started the login with.
|
|
267
267
|
|
|
268
|
-
You can click the link below to start a new login.`,
|
|
268
|
+
You can click the link below to start a new login.`,A8="Invalid link",E8="Click the button to log in",z8="Login",I8="Or enter the code at {{vendorName}} to complete the login.",N8="Enter your email address to unlock this show on {{service}}",C8="Link your account with {{service}}",j8="You are logged in as",O8="Login",P8="Enter your email address to sign in.",T8="Enter your email address and we will send you a login code.",R8="Enter your email or phone number to sign in",B8="Enter your email address and we will send you a login link.",L8="Enter your phone number to sign in",U8="Enter your {{authMethod}} to sign in.",M8="Log out",F8="No, I want to use another account",D8="or",V8="Password",q8="The password has been reset",H8="Success",K8="Change password for your {{vendorName}} account",G8="Change password for your {{vendorName}} account",W8="Phone number",J8="Privacy Policy",X8="Redirecting",Z8="Confirm password",Y8="Register a new password",Q8="Resend code",e5="Change password",t5="Enter your new password below for the email account: ",n5="Click the button to reset your password",r5="Click the button to reset your password",i5="Reset your password",o5="Change password for your {{vendorName}} account",s5="Reset password",a5="Send",c5="Send me a new magic link",d5="Remember to check your spam folder if the email did not arrive.",l5="Set password",u5="Show password",p5="Sign in",f5="Signup",h5="Sign up successful",g5="{{code}} is your login code for {{vendorName}}",m5="It appears that your Spotify account is currently linked to another Sesamy account. But fear not, we're here to guide you through the process to get this fixed.",_5="Go to Spotify's Content Access page",y5=`Let's start by unlinking your Spotify account. Click the button below to go to Spotify's Content Access page. After you've logged in to your Spotify account, find Sesamy on the list of connected platforms. Click "Unlink" next to the Sesamy logo.`,w5="Step 1: Unlink Your Spotify Account",v5="Once you've successfully unlinked your Spotify account, you can relink it to Sesamy. Simply repeat the steps you previously took that led you to this page.",b5="Step 2: Relink Your Spotify Account to Sesamy",$5="Oops! Your Spotify Account Is Already Linked",x5="If you have questions or need assistance, you can contact our support team",k5="Terms and Conditions",S5="Your email address needs validating. We have sent a new email to your inbox",A5="User account does not exist",E5="User account does not exist",z5="We could not find a user with the provided email address. Please, try again.",I5="Try again.",N5="Validate code",C5="Check your inbox for email validation instructions.",j5="Signed up",O5="Click the button to verify your email address",P5="Validate your email address",T5="Validate your email address",R5="Verify account",B5="Verify your email",L5="Please check your email at <0>{{email}}</0> and enter the six-digit code that we've sent you.",U5="Welcome",M5="Welcome to your {{vendorName}} account!",F5="Continue with this account",D5="Yes, continue with {{text}}",V5="Yes, continue with existing account",q5={"Server error: Invalid code":"Invalid code","Wrong email or verification code":{"":"Wrong email or verification code."},account_detected:k6,account_with_sso_provider:S6,agree_to:A6,and:E6,auth_method_email:z6,auth_method_email_or_phone:I6,auth_method_phone:N6,callback_url_mismatch:C6,callback_url_not_allowed:j6,check_email_title:O6,click_to_sign_up_description:P6,code_email_enter_code:T6,code_email_subject:R6,code_email_title:B6,code_sent_template:L6,code_valid_30_minutes:U6,confirm_password:M6,contact_support:F6,contact_us:D6,continue:"Continue",continue_social_login:V6,continue_with:q6,continue_with_sso_provider_headline:H6,copyright:K6,copyright_sesamy:G6,create_account_description:W6,create_account_email_invalid:J6,create_account_passwords_didnt_match:X6,create_account_title:Z6,create_account_weak_password:Y6,create_new_account_link:Q6,create_password_account_title:e8,currently_logged_in_as:t8,email:n8,email_or_phone_placeholder:r8,email_placeholder:i8,email_validated:o8,email_validated_cta:s8,email_verification_for_signup_sent_description:a8,email_verification_for_signup_sent_title:c8,enter_a_code_btn:d8,enter_email_for_verification_description:l8,enter_new_password_placeholder:u8,enter_password:p8,enter_password_description:f8,enter_your_password_btn:h8,expired_code:g8,fokus_info_message:m8,forgot_password_cta:_8,forgot_password_description:y8,forgot_password_email_sent:w8,forgot_password_link:v8,forgot_password_title:b8,go_back:$8,hide_password:x8,"invalid-email":"Invalid email",invalid_password:k8,invalid_session_body:S8,invalid_session_title:A8,link_email_click_to_login:E8,link_email_login:z8,link_email_or_enter_code:I8,link_page_body:N8,link_page_headline:C8,logged_in_as:j8,login:O8,login_description:P8,login_description_code:T8,login_description_combined:R8,login_description_link:B8,login_description_phone:L8,login_description_template:U8,logout:M8,no_use_another:F8,or:D8,password:V8,password_has_been_reset:q8,password_has_been_reset_title:H8,password_reset_subject:K8,password_reset_title:G8,phone_placeholder:W8,privacy_policy:J8,redirecting:X8,reenter_new_password_placeholder:Z8,register_password_account:Y8,resend_code:Q8,reset_password_cta:e5,reset_password_description:t5,reset_password_email_click_to_reset:n5,reset_password_email_cta:r5,reset_password_email_reset:i5,reset_password_subject:o5,reset_password_title:s5,send:a5,send_me_a_new_magic_link:c5,sent_code_spam:d5,set_password:l5,show_password:u5,sign_in:p5,signup:f5,signup_success:h5,sms_code_text:g5,spotify_already_linked_body:m5,spotify_already_linked_cta:_5,spotify_already_linked_step1_body:y5,spotify_already_linked_step1_title:w5,spotify_already_linked_step2_body:v5,spotify_already_linked_step2_title:b5,spotify_already_linked_title:$5,support_info:x5,terms:k5,unverified_email:S5,user_account_does_not_exist:A5,user_not_found:E5,user_not_found_body:z5,user_not_found_cta:I5,validate_code:N5,validate_email_body:C5,validate_email_title:j5,verify_email_click_to_verify:O5,verify_email_subject:P5,verify_email_title:T5,verify_email_verify:R5,verify_your_email:B5,we_sent_a_code_to:L5,welcome:U5,welcome_to_your_account:M5,yes_continue:F5,yes_continue_with:D5,yes_continue_with_existing_account:V5},H5="Account rilevato",K5="Abbiamo rilevato che l'utente ha già creato un account tramite",G5="Effettuando l'accesso, l'utente accetta la nostra",W5="e",J5="indirizzo e-mail",X5="e-mail o numero di telefono",Z5="numero di telefono",Y5="Mancata corrispondenza dell'URL di callback",Q5="Il redirect_uri fornito non è nell'elenco degli URL di callback consentiti.",ex="continuare con l'utente",tx="Fare clic sul pulsante per creare un nuovo account con password.",nx="Inserite il codice all'indirizzo {{vendorName}} per completare il login.",rx="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",ix="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",ox="Controllare <0>{{username}}</0> e inserire il codice a sei cifre che vi abbiamo inviato.",sx="Il codice è valido per 30 minuti",ax="Confermare la password",cx="Avete bisogno di aiuto?",dx="Contattateci",lx="o continuare con il conto sociale",ux="Continua con {{provider}}",px="Desidera continuare a utilizzare l'account esistente?",fx="Copyright © 2023 SESAMY. Tutti i diritti riservati.",hx="©2023 Sesamy",gx="Scegliete una password con un mix di lettere maiuscole e minuscole, numeri e simboli.",mx="Inserire un indirizzo e-mail valido.",_x="Le password non corrispondono. Riprovare.",yx="Scegliere la password",wx="La password deve essere lunga almeno 8 caratteri e contenere almeno una lettera minuscola, una lettera maiuscola, un numero e un simbolo.",vx="Creare un nuovo account",bx="Iscriviti con la password",$x="Attualmente si è connessi come <0>{{email}}</0>",xx="Email",kx="Indirizzo e-mail o numero di telefono",Sx="Indirizzo e-mail",Ax="Il tuo indirizzo e-mail è stato convalidato",Ex="Ora inserire la password per accedere nuovamente",zx="È stata inviata un'e-mail a <0>{{email}}</0> con un link di verifica. Fare clic sul link per verificare l'indirizzo e-mail e impostare una password.",Ix="Email di verifica inviata",Nx="Inserire un codice",Cx="Vi invieremo un link di verifica per assicurarvi di possedere questo indirizzo e-mail.",jx="Inserire la nuova password",Ox="Inserire la password",Px="Inserire l'indirizzo e-mail e la password per accedere.",Tx="Inserire la password",Rx="Il link magico è scaduto. Cliccate sul pulsante sottostante per ricevere un nuovo link nella vostra casella di posta elettronica.",Bx="Abbiamo aggiornato la nostra esperienza di accesso. <0>Clicca qui per saperne di più.</0>",Lx="Inviare l'e-mail di reimpostazione della password",Ux="Fare clic sul pulsante sottostante per ricevere le istruzioni su come reimpostare la password.",Mx="Email di reimpostazione della password inviata",Fx="Hai dimenticato la password?",Dx="Hai dimenticato la password?",Vx="Torna indietro",qx="Nascondere la password",Hx="Password non valida",Kx=`Il link non è più valido.
|
|
269
269
|
|
|
270
270
|
Assicuratevi di aprire il link di accesso con lo stesso browser con cui avete iniziato l'accesso.
|
|
271
271
|
|
|
272
|
-
Potete fare clic sul link sottostante per iniziare un nuovo accesso.`,
|
|
272
|
+
Potete fare clic sul link sottostante per iniziare un nuovo accesso.`,Gx="Collegamento non valido",Wx="Fare clic sul pulsante per accedere",Jx="Accedi",Xx="Oppure inserire il codice all'indirizzo {{vendorName}} per completare il login.",Zx="Inserisci il tuo indirizzo e-mail per sbloccare questo spettacolo su {{service}}",Yx="Collegate il vostro account con {{service}}",Qx="L'utente ha effettuato l'accesso come",e9="Accesso",t9="Inserire l'indirizzo e-mail per accedere.",n9="Inserite il vostro indirizzo e-mail e vi invieremo un codice di accesso.",r9="Inserire l'e-mail o il numero di telefono per accedere",i9="Inserite il vostro indirizzo e-mail e vi invieremo un link di accesso.",o9="Inserire il numero di telefono per accedere",s9="Inserite il vostro {{authMethod}} per accedere.",a9="Disconnettersi",c9="No, voglio usare un altro account",d9="o",l9="Password",u9="La password è stata reimpostata",p9="Il successo",f9="Modifica della password dell'account {{vendorName}}",h9="Modifica della password dell'account {{vendorName}} ",g9="Numero di telefono",m9="Informativa sulla privacy",_9="Reindirizzamento",y9="Confermare la password",w9="Registrazione di una nuova password",v9="Reinvio del codice",b9="Modifica della password",$9="Immettere di seguito la nuova password per l'account e-mail: ",x9="Fare clic sul pulsante per reimpostare la password",k9="Fare clic sul pulsante per reimpostare la password",S9="Reimpostare la password",A9="Modifica della password dell'account {{vendorName}} ",E9="Reimpostare la password",z9="Inviare",I9="Inviami un nuovo link magico",N9="Ricordate di controllare la cartella spam se l'e-mail non è arrivata.",C9="Impostare la password",j9="Mostra password",O9="Accedi",P9="Iscriviti",T9="Iscriviti con successo",R9="{{code}} è il codice di accesso per {{vendorName}}",B9="Sembra che il vostro account Spotify sia attualmente collegato a un altro account Sesamy. Ma non temete, siamo qui per guidarvi attraverso la procedura per risolvere il problema.",L9="Vai alla pagina di accesso ai contenuti di Spotify",U9=`Cominciamo con lo scollegare il vostro account Spotify. Fare clic sul pulsante sottostante per accedere alla pagina di accesso ai contenuti di Spotify. Dopo aver effettuato l'accesso al vostro account Spotify, trovate Sesamy nell'elenco delle piattaforme collegate. Fate clic su "Unlink" accanto al logo di Sesamy.`,M9="Passo 1: Disconnettere l'account Spotify",F9="Dopo aver scollegato con successo il proprio account Spotify, è possibile ricollegarlo a Sesamy. È sufficiente ripetere i passaggi precedenti che vi hanno portato a questa pagina.",D9="Passo 2: ricollegare l'account Spotify a Sesamy",V9="Ops! Il tuo account Spotify è già collegato",q9="Se avete domande o bisogno di assistenza, potete contattare il nostro team di supporto",H9="Termini e condizioni",K9="Il tuo indirizzo e-mail deve essere convalidato. Abbiamo inviato una nuova e-mail alla tua casella di posta.",G9="L'account utente non esiste",W9="L'account utente non esiste",J9="Non è stato possibile trovare un utente con l'indirizzo e-mail fornito. Si prega di riprovare.",X9="Riprova.",Z9="Convalida del codice",Y9="Controllate la vostra casella di posta per le istruzioni di convalida dell'e-mail.",Q9="Iscritta",ek="Fare clic sul pulsante per verificare l'indirizzo e-mail",tk="Convalidare l'indirizzo e-mail",nk="Convalidare l'indirizzo e-mail",rk="Verifica dell'account",ik="Verificare l'e-mail",ok="Controllate la vostra e-mail all'indirizzo <0>{{email}}</0> e inserisca il codice a sei cifre che le abbiamo inviato.",sk="Benvenuti",ak="Benvenuto nel tuo account {{vendorName}}!",ck="Continuare con questo account",dk="Sì, continuare con {{text}}",lk="Sì, continuare con l'account esistente",uk={"Server error: Invalid code":"Codice non valido","Wrong email or verification code":{"":"Email o codice di verifica errati."},account_detected:H5,account_with_sso_provider:K5,agree_to:G5,and:W5,auth_method_email:J5,auth_method_email_or_phone:X5,auth_method_phone:Z5,callback_url_mismatch:Y5,callback_url_not_allowed:Q5,check_email_title:ex,click_to_sign_up_description:tx,code_email_enter_code:nx,code_email_subject:rx,code_email_title:ix,code_sent_template:ox,code_valid_30_minutes:sx,confirm_password:ax,contact_support:cx,contact_us:dx,continue:"Continua",continue_social_login:lx,continue_with:ux,continue_with_sso_provider_headline:px,copyright:fx,copyright_sesamy:hx,create_account_description:gx,create_account_email_invalid:mx,create_account_passwords_didnt_match:_x,create_account_title:yx,create_account_weak_password:wx,create_new_account_link:vx,create_password_account_title:bx,currently_logged_in_as:$x,email:xx,email_or_phone_placeholder:kx,email_placeholder:Sx,email_validated:Ax,email_validated_cta:Ex,email_verification_for_signup_sent_description:zx,email_verification_for_signup_sent_title:Ix,enter_a_code_btn:Nx,enter_email_for_verification_description:Cx,enter_new_password_placeholder:jx,enter_password:Ox,enter_password_description:Px,enter_your_password_btn:Tx,expired_code:Rx,fokus_info_message:Bx,forgot_password_cta:Lx,forgot_password_description:Ux,forgot_password_email_sent:Mx,forgot_password_link:Fx,forgot_password_title:Dx,go_back:Vx,hide_password:qx,"invalid-email":"Email non valida",invalid_password:Hx,invalid_session_body:Kx,invalid_session_title:Gx,link_email_click_to_login:Wx,link_email_login:Jx,link_email_or_enter_code:Xx,link_page_body:Zx,link_page_headline:Yx,logged_in_as:Qx,login:e9,login_description:t9,login_description_code:n9,login_description_combined:r9,login_description_link:i9,login_description_phone:o9,login_description_template:s9,logout:a9,no_use_another:c9,or:d9,password:l9,password_has_been_reset:u9,password_has_been_reset_title:p9,password_reset_subject:f9,password_reset_title:h9,phone_placeholder:g9,privacy_policy:m9,redirecting:_9,reenter_new_password_placeholder:y9,register_password_account:w9,resend_code:v9,reset_password_cta:b9,reset_password_description:$9,reset_password_email_click_to_reset:x9,reset_password_email_cta:k9,reset_password_email_reset:S9,reset_password_subject:A9,reset_password_title:E9,send:z9,send_me_a_new_magic_link:I9,sent_code_spam:N9,set_password:C9,show_password:j9,sign_in:O9,signup:P9,signup_success:T9,sms_code_text:R9,spotify_already_linked_body:B9,spotify_already_linked_cta:L9,spotify_already_linked_step1_body:U9,spotify_already_linked_step1_title:M9,spotify_already_linked_step2_body:F9,spotify_already_linked_step2_title:D9,spotify_already_linked_title:V9,support_info:q9,terms:H9,unverified_email:K9,user_account_does_not_exist:G9,user_not_found:W9,user_not_found_body:J9,user_not_found_cta:X9,validate_code:Z9,validate_email_body:Y9,validate_email_title:Q9,verify_email_click_to_verify:ek,verify_email_subject:tk,verify_email_title:nk,verify_email_verify:rk,verify_your_email:ik,we_sent_a_code_to:ok,welcome:sk,welcome_to_your_account:ak,yes_continue:ck,yes_continue_with:dk,yes_continue_with_existing_account:lk},pk="Konto oppdaget",fk="Vi har oppdaget at du allerede har opprettet en konto gjennom",hk="Ved å logge på godtar du våre",gk="og",mk="e-postadresse",_k="e-post eller telefonnummer",yk="telefonnummer",wk="Callback-URLen samsvarer ikke",vk="Den oppgitte redirect_uri er ikke på listen over tillatte tilbakeringings-URLer.",bk="fortsett med bruker",$k="Klikk på knappen for å opprette en ny passordkonto.",xk="Skriv inn koden på {{vendorName}} for å fullføre påloggingen",kk="Velkommen til {{vendorName}} ! {{code}} er påloggingskoden",Sk="Velkommen til {{vendorName}}! {{code}} er påloggingskoden",Ak="Vennligst sjekk <0>{{username}}</0> og skriv inn den sekssifrede koden som vi har sendt deg.",Ek="Koden er gyldig i 30 minutter",zk="Bekreft passord",Ik="Trenger hjelp?",Nk="Kontakt oss",Ck="eller fortsett med sosial konto",jk="Fortsett med {{provider}}",Ok="Vil du fortsette med din eksisterende konto?",Pk="Opphavsrett © 2023 SESAMY. Alle rettigheter forbeholdt.",Tk="©2023 Sesamy",Rk="Velg et passord med en blanding av store og små bokstaver, tall og symboler.",Bk="Vennligst skriv inn en gyldig e-postadresse.",Lk="Passordene stemte ikke overens. Prøv igjen.",Uk="Velg passord",Mk="Passordet må være på minst 8 tegn og inneholde minst én liten bokstav, én stor bokstav, ett tall og ett symbol.",Fk="Opprett ny konto",Dk="Registrer deg med passord",Vk="Du er logget på som <0> {{email}}</0>",qk="E-post",Hk="E-post eller telefonnummer",Kk="E-postadresse",Gk="E-postadressen din har blitt validert",Wk="Skriv nå inn passordet ditt for å logge inn igjen",Jk="En e-post har blitt sendt til <0>{{email}}</0> med en bekreftelseslenke. Klikk på lenken for å bekrefte e-postadressen din og angi et passord.",Xk="E-postbekreftelse sendt",Zk="Angi en kode",Yk="Vi sender deg en bekreftelseskobling for å sikre at du eier denne e-postadressen.",Qk="Skriv inn nytt passord",e7="Oppgi passord",t7="Skriv inn e-postadressen og passordet ditt for å logge inn.",n7="Skriv inn passordet ditt",r7="Den magiske lenken er utløpt. Vennligst klikk på knappen nedenfor for å motta en ny lenke i innboksen din.",i7="Hei! Vi oppdaterte påloggingsopplevelsen vår. <0>Klikk her for å lære mer om det.</0>",o7="Send e-post om tilbakestilling av passord",s7="Klikk på knappen nedenfor, så sender vi deg instruksjoner om hvordan du tilbakestiller passordet ditt.",a7="E-post om tilbakestilling av passord sendt",c7="Har du glemt passordet?",d7="Har du glemt passordet?",l7="Gå tilbake",u7="Skjul passord",p7="Ugyldig passord",f7=`Lenken er ikke lenger gyldig.
|
|
273
273
|
|
|
274
274
|
Sørg for å åpne påloggingslenken i samme nettleser som du startet påloggingen med.
|
|
275
275
|
|
|
276
|
-
Du kan klikke på lenken nedenfor for å starte en ny pålogging.`,
|
|
276
|
+
Du kan klikke på lenken nedenfor for å starte en ny pålogging.`,h7="Ugyldig lenke",g7="Klikk på knappen for å logge inn",m7="Logg inn",_7="Eller skriv inn koden på {{vendorName}} for å fullføre påloggingen.",y7="Skriv inn e-postadressen din for å låse opp dette programmet på {{service}}",w7="Koble kontoen din til {{service}}",v7="Du er innlogget som",b7="Logg inn",$7="Skriv inn e-postadressen din for å logge på.",x7="Skriv inn e-postadressen din og vi sender deg en påloggingskode.",k7="Skriv inn e-postadressen eller telefonnummeret ditt for å logge på",S7="Skriv inn e-postadressen din og vi sender deg en påloggingslenke.",A7="Skriv inn telefonnummeret ditt for å logge på",E7="Skriv inn din {{authMethod}} for å logge inn.",z7="Logg ut",I7="Nei, jeg vil bruke en annen konto",N7="eller",C7="Passord",j7="Passordet har blitt tilbakestilt",O7="Suksess",P7="Endre passord for {{vendorName}} kontoen din",T7="Endre passord for {{vendorName}} kontoen din",R7="Telefonnummer",B7="Personvernerklæring",L7="Omdirigerer",U7="Bekreft passord",M7="Registrer et nytt passord",F7="Send kode på nytt",D7="Endre passord",V7="Skriv inn det nye passordet for e-postkontoen nedenfor: ",q7="Klikk på knappen for å tilbakestille passordet ditt",H7="Klikk på knappen for å tilbakestille passordet ditt",K7="Tilbakestill passordet ditt",G7="Endre passord for {{vendorName}} -kontoen din",W7="Tilbakestill passord",J7="Send",X7="Send meg en ny magisk lenke",Z7="Husk å sjekke søppelpostmappen din hvis e-posten ikke kom.",Y7="Angi passord",Q7="Vis passord",eS="Logg inn",tS="Påmelding",nS="Vellykket registrering",rS="{{code}} er innloggingskoden din for {{vendorName}}",iS="Det ser ut til at Spotify-kontoen din for øyeblikket er koblet til en annen Sesamy-konto. Men ikke vær redd, vi er her for å veilede deg gjennom prosessen for å få dette fikset.",oS="Gå til Spotifys innholdstilgangsside",sS='La oss starte med å koble fra Spotify-kontoen din. Klikk på knappen nedenfor for å gå til Spotifys innholdstilgang-side. Etter at du har logget på Spotify-kontoen din, finner du Sesamy på listen over tilkoblede plattformer. Klikk "Fjern kobling" ved siden av Sesamy-logoen.',aS="Trinn 1: Koble fra Spotify-kontoen din",cS="Når du har koblet fra Spotify-kontoen din, kan du koble den til Sesamy på nytt. Bare gjenta trinnene du tidligere tok som førte deg til denne siden.",dS="Trinn 2: Koble Spotify-kontoen din til Sesamy på nytt",lS="Oops! Spotify-kontoen din er allerede koblet",uS="Hvis du har spørsmål eller trenger hjelp, kan du kontakte supportteamet vårt",pS="vilkår",fS="E-postadressen din må bekreftes. Vi har sendt en ny e-post til innboksen din.",hS="Brukerkonto eksisterer ikke",gS="Brukerkonto eksisterer ikke",mS="Vi kunne ikke finne en bruker med den oppgitte e-postadressen. Vær så snill, prøv på nytt.",_S="Prøv igjen.",yS="Bekreft koden",wS="Sjekk innboksen din for instruksjoner om e-postvalidering.",vS="Registrerte seg",bS="Klikk på knappen for å bekrefte e-postadressen din",$S="Bekreft e-postadressen din",xS="Bekreft e-postadressen din",kS="Bekreft konto",SS="Bekreft e-posten din",AS="Vennligst sjekk e-posten din på <0>{{email}}</0> og skriv inn den sekssifrede koden som vi har sendt deg.",ES="Velkommen",zS="Velkommen til din brukerkonto hos {{vendorName}} !",IS="Fortsett med denne kontoen",NS="Ja, fortsett med {{text}}",CS="Ja, fortsett med eksisterende konto",jS={"Server error: Invalid code":"Ugyldig kode","Wrong email or verification code":{"":"Feil e-post eller bekreftelseskode."},account_detected:pk,account_with_sso_provider:fk,agree_to:hk,and:gk,auth_method_email:mk,auth_method_email_or_phone:_k,auth_method_phone:yk,callback_url_mismatch:wk,callback_url_not_allowed:vk,check_email_title:bk,click_to_sign_up_description:$k,code_email_enter_code:xk,code_email_subject:kk,code_email_title:Sk,code_sent_template:Ak,code_valid_30_minutes:Ek,confirm_password:zk,contact_support:Ik,contact_us:Nk,continue:"Fortsette",continue_social_login:Ck,continue_with:jk,continue_with_sso_provider_headline:Ok,copyright:Pk,copyright_sesamy:Tk,create_account_description:Rk,create_account_email_invalid:Bk,create_account_passwords_didnt_match:Lk,create_account_title:Uk,create_account_weak_password:Mk,create_new_account_link:Fk,create_password_account_title:Dk,currently_logged_in_as:Vk,email:qk,email_or_phone_placeholder:Hk,email_placeholder:Kk,email_validated:Gk,email_validated_cta:Wk,email_verification_for_signup_sent_description:Jk,email_verification_for_signup_sent_title:Xk,enter_a_code_btn:Zk,enter_email_for_verification_description:Yk,enter_new_password_placeholder:Qk,enter_password:e7,enter_password_description:t7,enter_your_password_btn:n7,expired_code:r7,fokus_info_message:i7,forgot_password_cta:o7,forgot_password_description:s7,forgot_password_email_sent:a7,forgot_password_link:c7,forgot_password_title:d7,go_back:l7,hide_password:u7,"invalid-email":"Ugyldig epost",invalid_password:p7,invalid_session_body:f7,invalid_session_title:h7,link_email_click_to_login:g7,link_email_login:m7,link_email_or_enter_code:_7,link_page_body:y7,link_page_headline:w7,logged_in_as:v7,login:b7,login_description:$7,login_description_code:x7,login_description_combined:k7,login_description_link:S7,login_description_phone:A7,login_description_template:E7,logout:z7,no_use_another:I7,or:N7,password:C7,password_has_been_reset:j7,password_has_been_reset_title:O7,password_reset_subject:P7,password_reset_title:T7,phone_placeholder:R7,privacy_policy:B7,redirecting:L7,reenter_new_password_placeholder:U7,register_password_account:M7,resend_code:F7,reset_password_cta:D7,reset_password_description:V7,reset_password_email_click_to_reset:q7,reset_password_email_cta:H7,reset_password_email_reset:K7,reset_password_subject:G7,reset_password_title:W7,send:J7,send_me_a_new_magic_link:X7,sent_code_spam:Z7,set_password:Y7,show_password:Q7,sign_in:eS,signup:tS,signup_success:nS,sms_code_text:rS,spotify_already_linked_body:iS,spotify_already_linked_cta:oS,spotify_already_linked_step1_body:sS,spotify_already_linked_step1_title:aS,spotify_already_linked_step2_body:cS,spotify_already_linked_step2_title:dS,spotify_already_linked_title:lS,support_info:uS,terms:pS,unverified_email:fS,user_account_does_not_exist:hS,user_not_found:gS,user_not_found_body:mS,user_not_found_cta:_S,validate_code:yS,validate_email_body:wS,validate_email_title:vS,verify_email_click_to_verify:bS,verify_email_subject:$S,verify_email_title:xS,verify_email_verify:kS,verify_your_email:SS,we_sent_a_code_to:AS,welcome:ES,welcome_to_your_account:zS,yes_continue:IS,yes_continue_with:NS,yes_continue_with_existing_account:CS},OS="Fortsätt med existerande konto",PS="Det verkar som att du redan har skapat ett konto genom",TS="Genom att logga in godkänner du våra",RS="och",BS="E-postadress",LS="e-post eller telefonnummer",US="telefonnummer",MS="Callback URL mismatch",FS="The provided redirect_uri is not in the list of allowed callback URLs.",DS="fortsätt med användaren",VS="Klicka på knappen för att skapa ett nytt lösenordskonto.",qS="Skriv in koden på {{vendorName}} för att slutföra inloggningen",HS="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",KS="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",GS="Vänligen kontrollera <0>{{username}}</0> och ange den sexsiffriga koden som vi har skickat till dig.",WS="Koden är giltig i 30 minuter",JS="Bekräfta lösenord",XS="Behöver du hjälp?",ZS="Kontakta oss",YS="eller via sociala medier",QS="Fortsätt med {{provider}}",eA="Vill du fortsätta med det här kontot?",tA="Copyright © 2023 SESAMY. Alla rättigheter förbehållna.",nA="©2023 Sesamy",rA="Välj ett lösenord med en blandning av stora och små bokstäver, siffror och symboler.",iA="Ange en giltig e-postadress.",oA="Lösenorden stämde inte överens. Försök igen.",sA="Välj lösenord",aA="Lösenordet måste vara minst 8 tecken långt och innehålla minst en gemen bokstav, en versal bokstav, en siffra och en symbol.",cA="Skapa nytt konto",dA="Registrera dig med lösenord",lA="Du är inloggad som <0>{{email}}</0>",uA="E-postadress",pA="E-post eller telefonnummer",fA="E-postadress",hA="Din e-postadress har validerats",gA="Ange nu ditt lösenord för att logga in igen",mA="Ett e-postmeddelande har skickats till <0>{{email}}</0> med en verifieringslänk. Vänligen klicka på länken för att verifiera din e-postadress och välja ett lösenord.",_A="E-postverifiering skickad",yA="Logga in med kod",wA="Vi skickar dig en verifieringslänk för att säkerställa att du äger den här e-postadressen.",vA="Ange nytt lösenord",bA="Ange lösenord",$A="Ange din e-postadress och ditt lösenord för att logga in.",xA="Logga in med lösenord",kA="Länken är inte längre giltig. Klicka på knappen för att skicka en ny länk till din epost.",SA="Vi har bytt inloggningssystem, <0>här kan du läsa mer om vad det innebär</0>",AA="Skicka",EA="Klicka på knappen nedan så skickar vi instruktioner om hur du återställer ditt lösenord.",zA="Vi har skickat ett e-postmeddelande med instruktioner om hur du återställer ditt lösenord till den e-postadress du angav.",IA="Har du glömt lösenordet?",NA="Har du glömt lösenordet?",CA="Gå tillbaka",jA="Dölj lösenord",OA="Ogiltigt lösenord",PA=`Länken är inte längre giltig.
|
|
277
277
|
|
|
278
278
|
Vänligen se till att öppna inloggningslänken i samma webbläsare som du startade inloggningen med.
|
|
279
279
|
|
|
280
|
-
Du kan klicka på länken nedan för att starta en ny inloggning.`,
|
|
280
|
+
Du kan klicka på länken nedan för att starta en ny inloggning.`,TA="Ogiltig länk",RA="Klicka på knappen för att logga in",BA="Logga in",LA="Eller skriv in koden på {{vendorName}} för att slutföra inloggningen.",UA="Ange din epost för att låsa upp den här showen på {{service}}",MA="Koppla ditt konto till {{service}}",FA="Du är inloggad som",DA="Logga in",VA="Ange din e-postadress för att logga in.",qA="Ange din mejladress, så skickar vi en kod till dig som du kan logga in med.",HA="Ange din e-postadress eller ditt telefonnummer för att logga in",KA="Ange din mejladress, så skickar vi en länk till dig som du kan logga in med.",GA="Ange ditt telefonnummer för att logga in",WA="Ange din {{authMethod}} för att logga in.",JA="Logga ut",XA="Nej, jag vill använda ett annat konto",ZA="eller",YA="Lösenord",QA="Lösenordet har återställts",eE="Framgång",tE="Byt lösenord för ditt {{vendorName}} konto",nE="Byt lösenord för ditt {{vendorName}} konto",rE="Telefonnummer",iE="Integritetspolicy",oE="Du skickas vidare",sE="Bekräfta lösenord",aE="Registrera ett nytt lösenord",cE="Skicka koden igen",dE="Ändra lösenord",lE="Ange ditt nya lösenord nedan för e-postkontot: ",uE="Klicka på knappen för att återställa ditt lösenord",pE="Klicka på knappen för att återställa ditt lösenord",fE="Återställ ditt lösenord",hE="Byt lösenord för ditt {{vendorName}} konto",gE="Återställ lösenord",mE="Skicka",_E="Skicka en ny inloggninglänk",yE="Kom ihåg att kontrollera din skräppost om du inte kan hitta mailet vi har skickat.",wE="Välj lösenord",vE="Visa lösenord",bE="Logga in",$E="Registrera dig",xE="Registrera dig framgångsrik",kE="{{code}} är din inloggningskod för {{vendorName}}",SE="Det verkar som att ditt Spotify-konto för närvarande är kopplat till ett annat Sesamy-konto. Ingen fara, vi är här för att guida dig genom processen för att lösa detta.",AE="Gå till Spotify's Content Access sida",EE=`Vi börjar med att avlänka ditt Spotify-konto. Klicka på knappen nedan för att komma till Spotify's Content Access sida. När du har loggat in på ditt Spotify-konto, leta upp Sesamy i listan över anslutna plattformar. Klicka på "Unlink" bredvid Sesamys logotyp.`,zE="Steg 1: Avlänka ditt Spotify-konto",IE="När du har avlänkat ditt Spotify-konto kan du koppla det till Sesamy igen. Upprepa helt enkelt de steg du tog som ledde dig till den här sidan.",NE="Steg 2: Koppla ditt Spotify-konto till Sesamy igen",CE="Oj! Ditt Spotify-konto är redan kopplat",jE="Om du har frågor eller behöver hjälp kan du kontakta vårt supportteam",OE="Villkor",PE="Din e-postadress behöver valideras. Vi har skickat ett nytt e-postmeddelande till din inkorg",TE="Kontot existerar inte",RE="Kontot extisterar inte",BE="Vi kan inte hitta en användare med denna eposten. Vänligen försök igen.",LE="Försök igen.",UE="Validera kod",ME="Kontrollera din inkorg för instruktioner om validering av e-post.",FE="Registrerad",DE="Klicka på knappen för att verifiera din e-postadress",VE="Bekräfta din e-postadress",qE="Bekräfta din e-postadress",HE="Verifiera konto",KE="Ange engångskod",GE="Vänligen kontrollera din e-post för <0>{{email}}</0> och ange den sexsiffriga koden som vi har skickat till dig.",WE="Välkommen",JE="Välkommen till ditt {{vendorName}}-konto!",XE="Fortsätt med konto",ZE="Ja, fortsätt med {{text}}",YE="Ja, fortsätt med detta kontot",QE={"Server error: Invalid code":"Koden är inte giltig","Wrong email or verification code":{"":"Fel e-post eller verifieringskod."},account_detected:OS,account_with_sso_provider:PS,agree_to:TS,and:RS,auth_method_email:BS,auth_method_email_or_phone:LS,auth_method_phone:US,callback_url_mismatch:MS,callback_url_not_allowed:FS,check_email_title:DS,click_to_sign_up_description:VS,code_email_enter_code:qS,code_email_subject:HS,code_email_title:KS,code_sent_template:GS,code_valid_30_minutes:WS,confirm_password:JS,contact_support:XS,contact_us:ZS,continue:"Fortsätt",continue_social_login:YS,continue_with:QS,continue_with_sso_provider_headline:eA,copyright:tA,copyright_sesamy:nA,create_account_description:rA,create_account_email_invalid:iA,create_account_passwords_didnt_match:oA,create_account_title:sA,create_account_weak_password:aA,create_new_account_link:cA,create_password_account_title:dA,currently_logged_in_as:lA,email:uA,email_or_phone_placeholder:pA,email_placeholder:fA,email_validated:hA,email_validated_cta:gA,email_verification_for_signup_sent_description:mA,email_verification_for_signup_sent_title:_A,enter_a_code_btn:yA,enter_email_for_verification_description:wA,enter_new_password_placeholder:vA,enter_password:bA,enter_password_description:$A,enter_your_password_btn:xA,expired_code:kA,fokus_info_message:SA,forgot_password_cta:AA,forgot_password_description:EA,forgot_password_email_sent:zA,forgot_password_link:IA,forgot_password_title:NA,go_back:CA,hide_password:jA,"invalid-email":"Ogiltig e-postadress",invalid_password:OA,invalid_session_body:PA,invalid_session_title:TA,link_email_click_to_login:RA,link_email_login:BA,link_email_or_enter_code:LA,link_page_body:UA,link_page_headline:MA,logged_in_as:FA,login:DA,login_description:VA,login_description_code:qA,login_description_combined:HA,login_description_link:KA,login_description_phone:GA,login_description_template:WA,logout:JA,no_use_another:XA,or:ZA,password:YA,password_has_been_reset:QA,password_has_been_reset_title:eE,password_reset_subject:tE,password_reset_title:nE,phone_placeholder:rE,privacy_policy:iE,redirecting:oE,reenter_new_password_placeholder:sE,register_password_account:aE,resend_code:cE,reset_password_cta:dE,reset_password_description:lE,reset_password_email_click_to_reset:uE,reset_password_email_cta:pE,reset_password_email_reset:fE,reset_password_subject:hE,reset_password_title:gE,send:mE,send_me_a_new_magic_link:_E,sent_code_spam:yE,set_password:wE,show_password:vE,sign_in:bE,signup:$E,signup_success:xE,sms_code_text:kE,spotify_already_linked_body:SE,spotify_already_linked_cta:AE,spotify_already_linked_step1_body:EE,spotify_already_linked_step1_title:zE,spotify_already_linked_step2_body:IE,spotify_already_linked_step2_title:NE,spotify_already_linked_title:CE,support_info:jE,terms:OE,unverified_email:PE,user_account_does_not_exist:TE,user_not_found:RE,user_not_found_body:BE,user_not_found_cta:LE,validate_code:UE,validate_email_body:ME,validate_email_title:FE,verify_email_click_to_verify:DE,verify_email_subject:VE,verify_email_title:qE,verify_email_verify:HE,verify_your_email:KE,we_sent_a_code_to:GE,welcome:WE,welcome_to_your_account:JE,yes_continue:XE,yes_continue_with:ZE,yes_continue_with_existing_account:YE},ez="Wykryto konto",tz="Wykryliśmy, że użytkownik utworzył już konto za pośrednictwem",nz="Logując się, wyrażasz zgodę na nasze",rz="i",iz="adres e-mail",oz="e-mail lub numer telefonu",sz="numer telefonu",az="Niezgodność adresu URL wywołania zwrotnego",cz="Podany adres redirect_uri nie znajduje się na liście dozwolonych adresów URL wywołania zwrotnego.",dz="kontynuować z użytkownikiem",lz="Kliknij przycisk, aby utworzyć nowe konto z hasłem.",uz="Wpisz kod na stronie {{vendorName}}, aby się zalogować.",pz="Witamy na {{vendorName}}! {{code}} to kod logowania do Twojego konta.",fz="Witamy na {{vendorName}}! {{code}} to kod logowania.",hz="Sprawdź <0>{{username}}</0> i wprowadź sześciocyfrowy kod, który wysłaliśmy.",gz="Kod jest ważny przez 30 minut",mz="Potwierdź hasło",_z="Potrzebujesz pomocy?",yz="Skontaktuj się z nami",wz="lub kontynuować korzystanie z konta społecznościowego",vz="Kontynuuj {{provider}}",bz="Czy chcesz kontynuować korzystanie z istniejącego konta?",$z="Copyright © 2023 SESAMY. Wszelkie prawa zastrzeżone.",xz="©2023 Sesamy",kz="Wybierz hasło składające się z małych i wielkich liter, cyfr i symboli.",Sz="Wprowadź prawidłowy adres e-mail.",Az="Hasła nie są zgodne. Spróbuj ponownie.",Ez="Wybierz hasło",zz="Hasło musi mieć co najmniej 8 znaków i zawierać co najmniej jedną małą literę, jedną wielką literę, jedną cyfrę i jeden symbol.",Iz="Utwórz nowe konto",Nz="Zarejestruj się przy użyciu hasła",Cz="Jesteś obecnie zalogowany jako <0>{{email}}</0>",jz="E-mail",Oz="E-mail lub numer telefonu",Pz="Adres e-mail",Tz="Twój adres e-mail został zweryfikowany",Rz="Teraz wprowadź hasło, aby zalogować się ponownie",Bz="Wiadomość e-mail została wysłana do <0>{{email}}</0> z linkiem weryfikacyjnym. Kliknij łącze, aby zweryfikować swój adres e-mail i ustawić hasło.",Lz="Wysłano weryfikację e-mail",Uz="Wprowadź kod",Mz="Wyślemy Ci link weryfikacyjny, aby upewnić się, że posiadasz ten adres e-mail.",Fz="Wprowadź nowe hasło",Dz="Wprowadź hasło",Vz="Wprowadź swój adres e-mail i hasło, aby się zalogować.",qz="Wprowadź hasło",Hz="Magiczny link wygasł. Kliknij poniższy przycisk, aby otrzymać nowy link w skrzynce odbiorczej.",Kz="Zaktualizowaliśmy sposób logowania. <0>Kliknij tutaj, aby dowiedzieć się więcej.</0>",Gz="Wyślij wiadomość e-mail z resetem hasła",Wz="Kliknij poniższy przycisk, a my wyślemy Ci instrukcje, jak zresetować hasło.",Jz="Wysłano wiadomość e-mail z resetem hasła",Xz="Zapomniałeś hasła?",Zz="Zapomniałeś hasła?",Yz="Wróć",Qz="Ukryj hasło",eI="Nieprawidłowe hasło",tI=`Link jest już nieaktualny.
|
|
281
281
|
|
|
282
282
|
Upewnij się, że otworzyłeś link logowania w tej samej przeglądarce, w której rozpocząłeś logowanie.
|
|
283
283
|
|
|
284
|
-
Możesz kliknąć poniższy link, aby rozpocząć nowe logowanie.`,
|
|
284
|
+
Możesz kliknąć poniższy link, aby rozpocząć nowe logowanie.`,nI="Nieprawidłowy link",rI="Kliknij przycisk, aby się zalogować",iI="Zaloguj się",oI="Lub wprowadź kod na stronie {{vendorName}}, aby dokończyć logowanie.",sI="Wprowadź swój adres e-mail, aby odblokować ten program na {{service}}",aI="Połącz swoje konto z {{service}}",cI="Jesteś zalogowany jako",dI="Logowanie",lI="Wprowadź swój adres e-mail, aby się zalogować.",uI="Wprowadź swój adres e-mail, a my wyślemy Ci kod logowania.",pI="Wprowadź swój adres e-mail lub numer telefonu, aby się zalogować",fI="Wprowadź swój adres e-mail, a my wyślemy Ci link do logowania.",hI="Wprowadź swój numer telefonu, aby się zalogować",gI="Wprowadź swój adres {{authMethod}}, aby się zalogować.",mI="Wylogowanie",_I="Nie, chcę użyć innego konta",yI="lub",wI="Hasło",vI="Hasło zostało zresetowane",bI="Sukces",$I="Zmień hasło do konta {{vendorName}} ",xI="Zmiana hasła do konta {{vendorName}} ",kI="Numer telefonu",SI="Polityka prywatności",AI="Przekierowanie",EI="Potwierdź hasło",zI="Zarejestruj nowe hasło",II="Wyślij ponownie kod",NI="Zmiana hasła",CI="Wprowadź poniżej nowe hasło do konta e-mail: ",jI="Kliknij przycisk, aby zresetować hasło",OI="Kliknij przycisk, aby zresetować hasło",PI="Zmień hasło",TI="Zmiana hasła do konta {{vendorName}} ",RI="Resetowanie hasła",BI="Wyślij",LI="Wyślij mi nowy magiczny link",UI="Pamiętaj, aby sprawdzić folder spamu, jeśli wiadomość e-mail nie dotarła.",MI="Ustaw hasło",FI="Pokaż hasło",DI="Zaloguj się",VI="Rejestracja",qI="Rejestracja zakończona sukcesem",HI="{{code}} to kod logowania do {{vendorName}}",KI="Wygląda na to, że Twoje konto Spotify jest obecnie połączone z innym kontem Sesamy. Ale nie martw się, jesteśmy tutaj, aby poprowadzić Cię przez proces, aby to naprawić.",GI="Przejdź do strony dostępu do treści Spotify",WI='Zacznijmy od odłączenia konta Spotify. Kliknij poniższy przycisk, aby przejść do strony dostępu do treści Spotify. Po zalogowaniu się na swoje konto Spotify, znajdź Sesamy na liście połączonych platform. Kliknij "Odłącz" obok logo Sesamy.',JI="Krok 1: Odłącz swoje konto Spotify",XI="Po pomyślnym odłączeniu konta Spotify możesz ponownie połączyć je z Sesamy. Wystarczy powtórzyć poprzednie kroki, które doprowadziły Cię do tej strony.",ZI="Krok 2: Połącz ponownie swoje konto Spotify z Sesamy",YI="Ups! Twoje konto Spotify jest już połączone",QI="Jeśli masz pytania lub potrzebujesz pomocy, skontaktuj się z nami",eN="Zasady i warunki",tN="Twój adres e-mail wymaga weryfikacji. Wysłaliśmy nową wiadomość e-mail na Twoją skrzynkę odbiorczą",nN="Konto użytkownika nie istnieje",rN="Konto użytkownika nie istnieje",iN="Nie mogliśmy znaleźć użytkownika o podanym adresie e-mail. Spróbuj ponownie.",oN="Spróbuj ponownie.",sN="Sprawdź poprawność kodu",aN="Sprawdź swoją skrzynkę odbiorczą, aby uzyskać instrukcje dotyczące weryfikacji wiadomości e-mail.",cN="Zarejestrowany",dN="Kliknij przycisk, aby zweryfikować swój adres e-mail",lN="Potwierdź swój adres e-mail",uN="Potwierdź swój adres e-mail",pN="Zweryfikuj konto",fN="Zweryfikuj swój adres e-mail",hN="Sprawdź swoją skrzynkę e-mail pod adresem <0>{{email}}</0> i wprowadź sześciocyfrowy kod, który wysłaliśmy.",gN="Witamy",mN="Witamy na koncie {{vendorName}}!",_N="Kontynuuj korzystanie z tego konta",yN="Tak, kontynuuj {{text}}",wN="Tak, kontynuuj korzystanie z istniejącego konta",vN={"Server error: Invalid code":"Nieprawidłowy kod","Wrong email or verification code":{"":"Nieprawidłowy adres e-mail lub kod weryfikacyjny."},account_detected:ez,account_with_sso_provider:tz,agree_to:nz,and:rz,auth_method_email:iz,auth_method_email_or_phone:oz,auth_method_phone:sz,callback_url_mismatch:az,callback_url_not_allowed:cz,check_email_title:dz,click_to_sign_up_description:lz,code_email_enter_code:uz,code_email_subject:pz,code_email_title:fz,code_sent_template:hz,code_valid_30_minutes:gz,confirm_password:mz,contact_support:_z,contact_us:yz,continue:"Kontynuuj",continue_social_login:wz,continue_with:vz,continue_with_sso_provider_headline:bz,copyright:$z,copyright_sesamy:xz,create_account_description:kz,create_account_email_invalid:Sz,create_account_passwords_didnt_match:Az,create_account_title:Ez,create_account_weak_password:zz,create_new_account_link:Iz,create_password_account_title:Nz,currently_logged_in_as:Cz,email:jz,email_or_phone_placeholder:Oz,email_placeholder:Pz,email_validated:Tz,email_validated_cta:Rz,email_verification_for_signup_sent_description:Bz,email_verification_for_signup_sent_title:Lz,enter_a_code_btn:Uz,enter_email_for_verification_description:Mz,enter_new_password_placeholder:Fz,enter_password:Dz,enter_password_description:Vz,enter_your_password_btn:qz,expired_code:Hz,fokus_info_message:Kz,forgot_password_cta:Gz,forgot_password_description:Wz,forgot_password_email_sent:Jz,forgot_password_link:Xz,forgot_password_title:Zz,go_back:Yz,hide_password:Qz,"invalid-email":"Nieprawidłowy adres e-mail",invalid_password:eI,invalid_session_body:tI,invalid_session_title:nI,link_email_click_to_login:rI,link_email_login:iI,link_email_or_enter_code:oI,link_page_body:sI,link_page_headline:aI,logged_in_as:cI,login:dI,login_description:lI,login_description_code:uI,login_description_combined:pI,login_description_link:fI,login_description_phone:hI,login_description_template:gI,logout:mI,no_use_another:_I,or:yI,password:wI,password_has_been_reset:vI,password_has_been_reset_title:bI,password_reset_subject:$I,password_reset_title:xI,phone_placeholder:kI,privacy_policy:SI,redirecting:AI,reenter_new_password_placeholder:EI,register_password_account:zI,resend_code:II,reset_password_cta:NI,reset_password_description:CI,reset_password_email_click_to_reset:jI,reset_password_email_cta:OI,reset_password_email_reset:PI,reset_password_subject:TI,reset_password_title:RI,send:BI,send_me_a_new_magic_link:LI,sent_code_spam:UI,set_password:MI,show_password:FI,sign_in:DI,signup:VI,signup_success:qI,sms_code_text:HI,spotify_already_linked_body:KI,spotify_already_linked_cta:GI,spotify_already_linked_step1_body:WI,spotify_already_linked_step1_title:JI,spotify_already_linked_step2_body:XI,spotify_already_linked_step2_title:ZI,spotify_already_linked_title:YI,support_info:QI,terms:eN,unverified_email:tN,user_account_does_not_exist:nN,user_not_found:rN,user_not_found_body:iN,user_not_found_cta:oN,validate_code:sN,validate_email_body:aN,validate_email_title:cN,verify_email_click_to_verify:dN,verify_email_subject:lN,verify_email_title:uN,verify_email_verify:pN,verify_your_email:fN,we_sent_a_code_to:hN,welcome:gN,welcome_to_your_account:mN,yes_continue:_N,yes_continue_with:yN,yes_continue_with_existing_account:wN},bN="Zjištěný účet",$N="Zjistili jsme, že jste si již vytvořili účet prostřednictvím",xN="Přihlášením souhlasíte s našimi",kN="a",SN="e-mailová adresa",AN="e-mail nebo telefonní číslo",EN="telefonní číslo",zN="Neshoda adresy URL zpětného volání",IN="Zadané redirect_uri není v seznamu povolených zpětných adres URL.",NN="pokračovat s uživatelem",CN="Klikněte na tlačítko pro vytvoření nového účtu s heslem.",jN="Pro dokončení přihlášení zadejte kód na adrese {{vendorName}}.",ON="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",PN="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",TN="Zkontrolujte prosím <0>{{username}}</0> a zadejte šestimístný kód, který jsme vám zaslali.",RN="Kód je platný po dobu 30 minut",BN="Potvrzení hesla",LN="Potřebujete pomoc?",UN="Kontaktujte nás",MN="nebo pokračovat v sociálním účtu",FN="Pokračovat s {{provider}}",DN="Chcete pokračovat ve svém stávajícím účtu?",VN="Copyright © 2023 SESAMY. Všechna práva vyhrazena.",qN="©2023 Sesamy",HN="Zvolte heslo složené z velkých a malých písmen, číslic a symbolů.",KN="Zadejte prosím platnou e-mailovou adresu.",GN="Hesla se neshodovala. Zkuste to znovu.",WN="Zvolte heslo",JN="Heslo musí mít alespoň 8 znaků a obsahovat alespoň jedno malé písmeno, jedno velké písmeno, jednu číslici a jeden symbol.",XN="Vytvořit nový účet",ZN="Zaregistrujte se pomocí hesla",YN="V současné době jste přihlášeni jako <0>{{email}}</0>",QN="E-mail",eC="E-mail nebo telefonní číslo",tC="E-mailová adresa",nC="Vaše e-mailová adresa byla ověřena",rC="Nyní zadejte své heslo a znovu se přihlaste",iC="E-mail byl odeslán na adresu <0>{{email}}</0> s ověřovacím odkazem. Kliknutím na odkaz ověřte svou e-mailovou adresu a nastavte heslo.",oC="Ověření e-mailem odesláno",sC="Zadejte kód",aC="Pošleme vám ověřovací odkaz, abychom se ujistili, že tuto e-mailovou adresu vlastníte.",cC="Zadejte nové heslo",dC="Zadejte heslo",lC="Pro přihlášení zadejte svou e-mailovou adresu a heslo.",uC="Zadejte své heslo",pC="Platnost kouzelného odkazu vypršela. Klikněte na tlačítko níže, abyste obdrželi nový odkaz do své e-mailové schránky.",fC="Ahoj! Aktualizovali jsme naše přihlašovací prostředí. <0>Klikněte sem a dozvíte se o něm více.</0>",hC="Odeslání e-mailu pro obnovení hesla",gC="Klikněte na tlačítko níže a my vám zašleme pokyny k obnovení hesla.",mC="Odeslání e-mailu s žádostí o obnovení hesla",_C="Zapomněli jste heslo?",yC="Zapomněli jste heslo?",wC="Vrátit se zpět",vC="Skrýt heslo",bC="Neplatné heslo",$C=`Odkaz již není platný.
|
|
285
285
|
|
|
286
286
|
Ujistěte se, že jste odkaz na přihlášení otevřeli ve stejném prohlížeči, ve kterém jste přihlášení zahájili.
|
|
287
287
|
|
|
288
|
-
Kliknutím na odkaz níže můžete zahájit nové přihlášen
|
|
288
|
+
Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,xC="Neplatný odkaz",kC="Kliknutím na tlačítko se přihlásíte",SC="Přihlášení",AC="Nebo zadejte kód na adrese {{vendorName}} a dokončete přihlášení.",EC="Zadejte svou e-mailovou adresu pro odemknutí tohoto pořadu na {{service}}",zC="Propojte svůj účet s {{service}}",IC="Jste přihlášeni jako",NC="Přihlášení",CC="Pro přihlášení zadejte svou e-mailovou adresu.",jC="Zadejte svou e-mailovou adresu a my vám zašleme přihlašovací kód.",OC="Pro přihlášení zadejte svůj e-mail nebo telefonní číslo",PC="Zadejte svou e-mailovou adresu a my vám zašleme odkaz pro přihlášení.",TC="Zadejte své telefonní číslo a přihlaste se",RC="Pro přihlášení zadejte adresu {{authMethod}}.",BC="Odhlášení",LC="Ne, chci použít jiný účet",UC="nebo",MC="Heslo",FC="Heslo bylo resetováno",DC="Úspěch",VC="Změna hesla k účtu {{vendorName}} ",qC="Změna hesla k účtu {{vendorName}} ",HC="Telefonní číslo",KC="Zásady ochrany osobních údajů",GC="Přesměrování",WC="Potvrzení hesla",JC="Registrace nového hesla",XC="Opětovné odeslání kódu",ZC="Změna hesla",YC="Níže zadejte nové heslo k e-mailovému účtu: ",QC="Kliknutím na tlačítko obnovíte své heslo",ej="Kliknutím na tlačítko obnovíte své heslo",tj="Obnovení hesla",nj="Změna hesla k účtu {{vendorName}} ",rj="Obnovení hesla",ij="Odeslat",oj="Pošlete mi nový kouzelný odkaz",sj="Pokud e-mail nedorazil, nezapomeňte zkontrolovat složku nevyžádané pošty.",aj="Nastavení hesla",cj="Zobrazit heslo",dj="Přihlásit se",lj="Registrace",uj="Úspěšná registrace",pj="{{code}} je váš přihlašovací kód pro {{vendorName}}",fj="Zdá se, že váš účet Spotify je v současné době propojen s jiným účtem Sesamy. Ale nebojte se, jsme tu, abychom vás provedli procesem, jak to napravit.",hj="Přejděte na stránku Spotify pro přístup k obsahu",gj='Začněme odpojením účtu Spotify. Kliknutím na tlačítko níže přejděte na stránku přístupu k obsahu služby Spotify. Po přihlášení k účtu Spotify najděte v seznamu připojených platforem položku Sesamy. Klikněte na tlačítko "Unlink" vedle loga Sesamy.',mj="Krok 1: Odpojení účtu Spotify",_j="Po úspěšném odpojení účtu Spotify jej můžete znovu propojit se službou Sesamy. Stačí zopakovat předchozí kroky, které vás přivedly na tuto stránku.",yj="Krok 2: Propojení účtu Spotify s aplikací Sesamy",wj="Ups! Váš účet Spotify je již propojen",vj="Pokud máte dotazy nebo potřebujete pomoc, můžete se obrátit na náš tým podpory.",bj="Podmínky a pravidla",$j="Vaši e-mailovou adresu je třeba ověřit. Do vaší e-mailové schránky jsme odeslali nový e-mail.",xj="Uživatelský účet neexistuje",kj="Uživatelský účet neexistuje",Sj="Nepodařilo se nám najít uživatele se zadanou e-mailovou adresou. Zkuste to prosím znovu.",Aj="Zkuste to znovu.",Ej="Ověření kódu",zj="Pokyny k ověření e-mailu najdete ve své e-mailové schránce.",Ij="Zaregistrovali jste se",Nj="Klikněte na tlačítko pro ověření e-mailové adresy",Cj="Ověřte svou e-mailovou adresu",jj="Ověřte svou e-mailovou adresu",Oj="Ověření účtu",Pj="Ověření e-mailu",Tj="Zkontrolujte si prosím svůj e-mail na adrese <0>{{email}}</0> a zadejte šestimístný kód, který jsme vám zaslali.",Rj="Vítejte na",Bj="Vítejte na svém účtu {{vendorName}}!",Lj="Pokračujte s tímto účtem",Uj="Ano, pokračujte {{text}}",Mj="Ano, pokračujte ve stávajícím účtu",Fj={"Server error: Invalid code":"Neplatný kód","Wrong email or verification code":{"":"Špatný e-mail nebo ověřovací kód."},account_detected:bN,account_with_sso_provider:$N,agree_to:xN,and:kN,auth_method_email:SN,auth_method_email_or_phone:AN,auth_method_phone:EN,callback_url_mismatch:zN,callback_url_not_allowed:IN,check_email_title:NN,click_to_sign_up_description:CN,code_email_enter_code:jN,code_email_subject:ON,code_email_title:PN,code_sent_template:TN,code_valid_30_minutes:RN,confirm_password:BN,contact_support:LN,contact_us:UN,continue:"Pokračovat",continue_social_login:MN,continue_with:FN,continue_with_sso_provider_headline:DN,copyright:VN,copyright_sesamy:qN,create_account_description:HN,create_account_email_invalid:KN,create_account_passwords_didnt_match:GN,create_account_title:WN,create_account_weak_password:JN,create_new_account_link:XN,create_password_account_title:ZN,currently_logged_in_as:YN,email:QN,email_or_phone_placeholder:eC,email_placeholder:tC,email_validated:nC,email_validated_cta:rC,email_verification_for_signup_sent_description:iC,email_verification_for_signup_sent_title:oC,enter_a_code_btn:sC,enter_email_for_verification_description:aC,enter_new_password_placeholder:cC,enter_password:dC,enter_password_description:lC,enter_your_password_btn:uC,expired_code:pC,fokus_info_message:fC,forgot_password_cta:hC,forgot_password_description:gC,forgot_password_email_sent:mC,forgot_password_link:_C,forgot_password_title:yC,go_back:wC,hide_password:vC,"invalid-email":"Neplatný e-mail",invalid_password:bC,invalid_session_body:$C,invalid_session_title:xC,link_email_click_to_login:kC,link_email_login:SC,link_email_or_enter_code:AC,link_page_body:EC,link_page_headline:zC,logged_in_as:IC,login:NC,login_description:CC,login_description_code:jC,login_description_combined:OC,login_description_link:PC,login_description_phone:TC,login_description_template:RC,logout:BC,no_use_another:LC,or:UC,password:MC,password_has_been_reset:FC,password_has_been_reset_title:DC,password_reset_subject:VC,password_reset_title:qC,phone_placeholder:HC,privacy_policy:KC,redirecting:GC,reenter_new_password_placeholder:WC,register_password_account:JC,resend_code:XC,reset_password_cta:ZC,reset_password_description:YC,reset_password_email_click_to_reset:QC,reset_password_email_cta:ej,reset_password_email_reset:tj,reset_password_subject:nj,reset_password_title:rj,send:ij,send_me_a_new_magic_link:oj,sent_code_spam:sj,set_password:aj,show_password:cj,sign_in:dj,signup:lj,signup_success:uj,sms_code_text:pj,spotify_already_linked_body:fj,spotify_already_linked_cta:hj,spotify_already_linked_step1_body:gj,spotify_already_linked_step1_title:mj,spotify_already_linked_step2_body:_j,spotify_already_linked_step2_title:yj,spotify_already_linked_title:wj,support_info:vj,terms:bj,unverified_email:$j,user_account_does_not_exist:xj,user_not_found:kj,user_not_found_body:Sj,user_not_found_cta:Aj,validate_code:Ej,validate_email_body:zj,validate_email_title:Ij,verify_email_click_to_verify:Nj,verify_email_subject:Cj,verify_email_title:jj,verify_email_verify:Oj,verify_your_email:Pj,we_sent_a_code_to:Tj,welcome:Rj,welcome_to_your_account:Bj,yes_continue:Lj,yes_continue_with:Uj,yes_continue_with_existing_account:Mj},Dj="Tili havaittu",Vj="Olemme havainneet, että olet jo luonut tilin kautta",qj="Kirjautumalla sisään hyväksyt",Hj="ja",Kj="sähköpostiosoite",Gj="sähköpostiosoite tai puhelinnumero",Wj="puhelinnumero",Jj="Takaisinkutsun URL-osoite ei vastaa toisiaan",Xj="Annettu redirect_uri ei ole sallittujen takaisinsoitto-URL-osoitteiden luettelossa.",Zj="jatka käyttäjän kanssa",Yj="Klikkaa painiketta luodaksesi uuden salasanatilin.",Qj="Kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",eO="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",tO="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",nO="Tarkista <0>{{username}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",rO="Koodi on voimassa 30 minuuttia",iO="Vahvista salasana",oO="Tarvitsetko apua?",sO="Ota yhteyttä",aO="tai jatka sosiaalisella tilillä",cO="Jatka {{provider}}",dO="Haluatko jatkaa olemassa olevalla tililläsi?",lO="Copyright © 2023 SESAMY. Kaikki oikeudet pidätetään.",uO="©2023 Sesamy",pO="Valitse salasana, jossa on isoja ja pieniä kirjaimia, numeroita ja symboleja.",fO="Kirjoita voimassa oleva sähköpostiosoite.",hO="Salasanat eivät vastanneet toisiaan. Yritä uudelleen.",gO="Valitse salasana",mO="Salasanan on oltava vähintään 8 merkkiä pitkä ja sisällettävä vähintään yksi pieni kirjain, yksi iso kirjain, yksi numero ja yksi symboli.",_O="Luo uusi tili",yO="Rekisteröidy salasanalla",wO="Olet tällä hetkellä kirjautuneena sisään nimellä <0>{{email}}</0>",vO="Sähköposti",bO="Sähköposti tai puhelinnumero",$O="Sähköpostiosoite",xO="Sähköpostiosoitteesi on vahvistettu",kO="Kirjoita nyt salasanasi kirjautuaksesi uudelleen",SO="Sähköposti on lähetetty osoitteeseen <0>{{email}}</0> jossa on vahvistuslinkki. Klikkaa linkkiä vahvistaaksesi sähköpostiosoitteesi ja asettaaksesi salasanan.",AO="Sähköpostivarmennus lähetetty",EO="Syötä koodi",zO="Lähetämme sinulle vahvistuslinkin varmistaaksemme, että omistat tämän sähköpostiosoitteen.",IO="Anna uusi salasana",NO="Anna salasana",CO="Anna sähköpostiosoitteesi ja salasanasi kirjautuaksesi sisään.",jO="Syötä salasanasi",OO="Taikalinkki on vanhentunut. Klikkaa alla olevaa painiketta saadaksesi uuden linkin sähköpostiisi.",PO="Hei! Päivitimme kirjautumiskokemuksemme. <0>Klikkaa tästä saadaksesi lisätietoja siitä.</0>",TO="Lähetä salasanan palautussähköposti",RO="Napsauta alla olevaa painiketta, niin lähetämme ohjeet salasanasi palauttamiseen.",BO="Salasanan palautussähköposti lähetetty",LO="Unohditko salasanan?",UO="Unohditko salasanan?",MO="Palaa takaisin",FO="Piilota salasana",DO="Virheellinen salasana",VO=`Linkki ei ole enää voimassa.
|
|
289
289
|
|
|
290
290
|
Varmista, että avaat kirjautumislinkin samalla selaimella, jolla aloitit kirjautumisen.
|
|
291
291
|
|
|
292
|
-
Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,VO="Virheellinen linkki",qO="Kirjaudu sisään napsauttamalla painiketta",HO="Kirjaudu sisään",KO="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",GO="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",WO="Yhdistä tilisi {{service}}",JO="Olet kirjautunut sisään nimellä",XO="Kirjaudu sisään",ZO="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",YO="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",QO="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",eP="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",tP="Anna puhelinnumerosi kirjautuaksesi sisään",nP="Kirjoita {{authMethod}} kirjautuaksesi sisään.",rP="Kirjaudu ulos",iP="Ei, haluan käyttää toista tiliä",oP="tai",sP="Salasana",aP="Salasana on nollattu",cP="Menestys",dP="Vaihda salasana tilillesi {{vendorName}} ",lP="Vaihda salasana tilillesi {{vendorName}} ",uP="Puhelinnumero",pP="Tietosuojakäytäntö",fP="Uudelleenohjaus",hP="Vahvista salasana",gP="Rekisteröi uusi salasana",mP="Lähetä koodi uudelleen",_P="Vaihda salasana",yP="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",wP="Napsauta painiketta salasanasi palauttamiseksi",vP="Napsauta painiketta salasanasi palauttamiseksi",bP="Nollaa salasanasi",$P="Vaihda salasana tilillesi {{vendorName}} ",xP="Nollaa salasana",kP="Lähetä",SP="Lähetä minulle uusi maaginen linkki",AP="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",EP="Aseta salasana",zP="Näytä salasana",IP="Kirjaudu sisään",NP="Rekisteröityminen",CP="Rekisteröidy onnistuneesti",jP="{{code}} on kirjautumiskoodisi {{vendorName}}",OP="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",PP="Siirry Spotifyn Content Access -sivulle",TP='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',RP="Vaihe 1: Poista Spotify-tilisi linkitys",BP="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",LP="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",UP="Hups! Spotify-tilisi on jo linkitetty",MP="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",FP="Ehdot ja edellytykset",DP="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",VP="Käyttäjätiliä ei ole olemassa",qP="Käyttäjätiliä ei ole olemassa",HP="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",KP="Yritä uudelleen.",GP="Validoi koodi",WP="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",JP="Rekisteröitynyt",XP="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",ZP="Vahvista sähköpostiosoitteesi",YP="Vahvista sähköpostiosoitteesi",QP="Vahvista tili",eT="Vahvista sähköpostiosoitteesi",tT="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",nT="Tervetuloa",rT="Tervetuloa tilillesi {{vendorName}}!",iT="Jatka tällä tilillä",oT="Kyllä, jatka {{text}}",sT="Kyllä, jatka olemassa olevalla tilillä",aT={"Server error: Invalid code":"Virheellinen koodi","Wrong email or verification code":{"":"Väärä sähköpostiosoite tai vahvistuskoodi."},account_detected:Fj,account_with_sso_provider:Dj,agree_to:Vj,and:qj,auth_method_email:Hj,auth_method_email_or_phone:Kj,auth_method_phone:Gj,callback_url_mismatch:Wj,callback_url_not_allowed:Jj,check_email_title:Xj,click_to_sign_up_description:Zj,code_email_enter_code:Yj,code_email_subject:Qj,code_email_title:eO,code_sent_template:tO,code_valid_30_minutes:nO,confirm_password:rO,contact_support:iO,contact_us:oO,continue:"Jatka",continue_social_login:sO,continue_with:aO,continue_with_sso_provider_headline:cO,copyright:dO,copyright_sesamy:lO,create_account_description:uO,create_account_email_invalid:pO,create_account_passwords_didnt_match:fO,create_account_title:hO,create_account_weak_password:gO,create_new_account_link:mO,create_password_account_title:_O,currently_logged_in_as:yO,email:wO,email_or_phone_placeholder:vO,email_placeholder:bO,email_validated:$O,email_validated_cta:xO,email_verification_for_signup_sent_description:kO,email_verification_for_signup_sent_title:SO,enter_a_code_btn:AO,enter_email_for_verification_description:EO,enter_new_password_placeholder:zO,enter_password:IO,enter_password_description:NO,enter_your_password_btn:CO,expired_code:jO,fokus_info_message:OO,forgot_password_cta:PO,forgot_password_description:TO,forgot_password_email_sent:RO,forgot_password_link:BO,forgot_password_title:LO,go_back:UO,hide_password:MO,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:FO,invalid_session_body:DO,invalid_session_title:VO,link_email_click_to_login:qO,link_email_login:HO,link_email_or_enter_code:KO,link_page_body:GO,link_page_headline:WO,logged_in_as:JO,login:XO,login_description:ZO,login_description_code:YO,login_description_combined:QO,login_description_link:eP,login_description_phone:tP,login_description_template:nP,logout:rP,no_use_another:iP,or:oP,password:sP,password_has_been_reset:aP,password_has_been_reset_title:cP,password_reset_subject:dP,password_reset_title:lP,phone_placeholder:uP,privacy_policy:pP,redirecting:fP,reenter_new_password_placeholder:hP,register_password_account:gP,resend_code:mP,reset_password_cta:_P,reset_password_description:yP,reset_password_email_click_to_reset:wP,reset_password_email_cta:vP,reset_password_email_reset:bP,reset_password_subject:$P,reset_password_title:xP,send:kP,send_me_a_new_magic_link:SP,sent_code_spam:AP,set_password:EP,show_password:zP,sign_in:IP,signup:NP,signup_success:CP,sms_code_text:jP,spotify_already_linked_body:OP,spotify_already_linked_cta:PP,spotify_already_linked_step1_body:TP,spotify_already_linked_step1_title:RP,spotify_already_linked_step2_body:BP,spotify_already_linked_step2_title:LP,spotify_already_linked_title:UP,support_info:MP,terms:FP,unverified_email:DP,user_account_does_not_exist:VP,user_not_found:qP,user_not_found_body:HP,user_not_found_cta:KP,validate_code:GP,validate_email_body:WP,validate_email_title:JP,verify_email_click_to_verify:XP,verify_email_subject:ZP,verify_email_title:YP,verify_email_verify:QP,verify_your_email:eT,we_sent_a_code_to:tT,welcome:nT,welcome_to_your_account:rT,yes_continue:iT,yes_continue_with:oT,yes_continue_with_existing_account:sT},cT=t=>{const{vendorSettings:e,authParams:n}=t,i=`/authorize?${new URLSearchParams({...n})}`;return _(De,{vendorSettings:e,title:O.t("user_not_found"),children:_("div",{className:"flex flex-1 flex-col justify-center",children:[_("p",{className:"mb-8 text-gray-300 text-lg",children:O.t("user_not_found_body")}),_(Le,{Component:"a",href:i,children:O.t("user_not_found_cta")})]})})};O.init({supportedLngs:["en","it","nb","sv","pl","cs","fi"],fallbackLng:"en",resources:{en:{translation:V5},it:{translation:lk},nb:{translation:CS},sv:{translation:YE},pl:{translation:wN},cs:{translation:Mj},fi:{translation:aT}}});function dT(t){const e=new s.OpenAPIHono;e.get("/",o=>o.json({name:"authhero"}));const n=qv(t);e.route("/api/v2",n);const r=i$(t);e.route("/",r);const i=$6(t);return e.route("/u",i),{app:e,managementApp:n,oauthApp:r,universalApp:i,createX509Certificate:xd}}exports.AppLogo=Wm;exports.Auth0Client=Wh;exports.AuthorizationResponseMode=Dt;exports.AuthorizationResponseType=it;exports.Button=Le;exports.CheckEmailPage=u1;exports.CodeChallengeMethod=vs;exports.ComponentCategory=Ud;exports.ComponentType=Ld;exports.EmailValidatedPage=h1;exports.EnterCodePage=Td;exports.EnterPasswordPage=Vr;exports.ErrorMessage=Gn;exports.Footer=Jm;exports.ForgotPasswordPage=d1;exports.ForgotPasswordSentPage=l1;exports.FormComponent=tn;exports.GoBack=bt;exports.GoogleLogo=Ym;exports.GrantType=rr;exports.Icon=Be;exports.IdentifierPage=ho;exports.InvalidSession=f1;exports.Layout=De;exports.LogTypes=he;exports.Message=Ct;exports.NodeType=Ch;exports.PreSignUpConfirmationPage=g1;exports.PreSignUpPage=p1;exports.ResetPasswordPage=er;exports.SignUpPage=vn;exports.SocialButton=Fr;exports.Spinner=Zm;exports.Trans=xa;exports.UnverifiedEmailPage=c1;exports.UserNotFoundPage=cT;exports.VippsLogo=Qm;exports.applicationInsertSchema=$o;exports.applicationSchema=xn;exports.auth0FlowInsertSchema=Z1;exports.auth0FlowSchema=Lh;exports.auth0UserResponseSchema=Et;exports.authParamsSchema=Yr;exports.baseUserSchema=ys;exports.bordersSchema=Yh;exports.brandingSchema=Qa;exports.buttonComponentSchema=Ah;exports.codeInsertSchema=Fh;exports.codeSchema=Y1;exports.codeTypeSchema=Mh;exports.colorsSchema=Qh;exports.componentSchema=Nh;exports.connectionInsertSchema=xo;exports.connectionOptionsSchema=Md;exports.connectionSchema=rn;exports.coordinatesSchema=xr;exports.customDomainInsertSchema=Fd;exports.customDomainSchema=nn;exports.customDomainWithTenantIdSchema=Q1;exports.emailProviderSchema=to;exports.endingSchema=Bh;exports.fieldComponentSchema=zh;exports.flowNodeSchema=Oh;exports.fontDetailsSchema=wn;exports.fontsSchema=e0;exports.formControlSchema=e_;exports.formInsertSchema=So;exports.formNodeComponentDefinition=Vh;exports.formSchema=tr;exports.genericComponentSchema=Ih;exports.genericNodeSchema=Ph;exports.hookInsertSchema=Qi;exports.hookSchema=nr;exports.identitySchema=xh;exports.init=dT;exports.injectTailwindCSS=_6;exports.jwksKeySchema=Kh;exports.jwksSchema=Dd;exports.legalComponentSchema=Eh;exports.logSchema=Ao;exports.loginSessionInsertSchema=Gh;exports.loginSessionSchema=o_;exports.nodeSchema=Th;exports.openIDConfigurationSchema=ec;exports.pageBackgroundSchema=t0;exports.parseUserId=p_;exports.passwordInsertSchema=Jh;exports.passwordSchema=a_;exports.profileDataSchema=$h;exports.promptSettingSchema=eo;exports.refreshTokenInsertSchema=qd;exports.refreshTokenSchema=d_;exports.richTextComponentSchema=Sh;exports.samlpAddon=kh;exports.sessionInsertSchema=Zh;exports.sessionSchema=$s;exports.signingKeySchema=tc;exports.smsProviderSchema=u_;exports.smsSendParamsSchema=l_;exports.startSchema=Rh;exports.stepNodeSchema=jh;exports.tailwindCss=cu;exports.tenantInsertSchema=ko;exports.tenantSchema=or;exports.themeInsertSchema=r0;exports.themeSchema=c_;exports.tokenResponseSchema=Vd;exports.totalsSchema=Xt;exports.userInsertSchema=bo;exports.userResponseSchema=W1;exports.userSchema=Bd;exports.vendorSettingsSchema=Uh;exports.verificationMethodsSchema=Dh;exports.widgetSchema=n0;
|
|
292
|
+
Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,qO="Virheellinen linkki",HO="Kirjaudu sisään napsauttamalla painiketta",KO="Kirjaudu sisään",GO="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",WO="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",JO="Yhdistä tilisi {{service}}",XO="Olet kirjautunut sisään nimellä",ZO="Kirjaudu sisään",YO="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",QO="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",eP="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",tP="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",nP="Anna puhelinnumerosi kirjautuaksesi sisään",rP="Kirjoita {{authMethod}} kirjautuaksesi sisään.",iP="Kirjaudu ulos",oP="Ei, haluan käyttää toista tiliä",sP="tai",aP="Salasana",cP="Salasana on nollattu",dP="Menestys",lP="Vaihda salasana tilillesi {{vendorName}} ",uP="Vaihda salasana tilillesi {{vendorName}} ",pP="Puhelinnumero",fP="Tietosuojakäytäntö",hP="Uudelleenohjaus",gP="Vahvista salasana",mP="Rekisteröi uusi salasana",_P="Lähetä koodi uudelleen",yP="Vaihda salasana",wP="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",vP="Napsauta painiketta salasanasi palauttamiseksi",bP="Napsauta painiketta salasanasi palauttamiseksi",$P="Nollaa salasanasi",xP="Vaihda salasana tilillesi {{vendorName}} ",kP="Nollaa salasana",SP="Lähetä",AP="Lähetä minulle uusi maaginen linkki",EP="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",zP="Aseta salasana",IP="Näytä salasana",NP="Kirjaudu sisään",CP="Rekisteröityminen",jP="Rekisteröidy onnistuneesti",OP="{{code}} on kirjautumiskoodisi {{vendorName}}",PP="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",TP="Siirry Spotifyn Content Access -sivulle",RP='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',BP="Vaihe 1: Poista Spotify-tilisi linkitys",LP="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",UP="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",MP="Hups! Spotify-tilisi on jo linkitetty",FP="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",DP="Ehdot ja edellytykset",VP="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",qP="Käyttäjätiliä ei ole olemassa",HP="Käyttäjätiliä ei ole olemassa",KP="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",GP="Yritä uudelleen.",WP="Validoi koodi",JP="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",XP="Rekisteröitynyt",ZP="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",YP="Vahvista sähköpostiosoitteesi",QP="Vahvista sähköpostiosoitteesi",eT="Vahvista tili",tT="Vahvista sähköpostiosoitteesi",nT="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",rT="Tervetuloa",iT="Tervetuloa tilillesi {{vendorName}}!",oT="Jatka tällä tilillä",sT="Kyllä, jatka {{text}}",aT="Kyllä, jatka olemassa olevalla tilillä",cT={"Server error: Invalid code":"Virheellinen koodi","Wrong email or verification code":{"":"Väärä sähköpostiosoite tai vahvistuskoodi."},account_detected:Dj,account_with_sso_provider:Vj,agree_to:qj,and:Hj,auth_method_email:Kj,auth_method_email_or_phone:Gj,auth_method_phone:Wj,callback_url_mismatch:Jj,callback_url_not_allowed:Xj,check_email_title:Zj,click_to_sign_up_description:Yj,code_email_enter_code:Qj,code_email_subject:eO,code_email_title:tO,code_sent_template:nO,code_valid_30_minutes:rO,confirm_password:iO,contact_support:oO,contact_us:sO,continue:"Jatka",continue_social_login:aO,continue_with:cO,continue_with_sso_provider_headline:dO,copyright:lO,copyright_sesamy:uO,create_account_description:pO,create_account_email_invalid:fO,create_account_passwords_didnt_match:hO,create_account_title:gO,create_account_weak_password:mO,create_new_account_link:_O,create_password_account_title:yO,currently_logged_in_as:wO,email:vO,email_or_phone_placeholder:bO,email_placeholder:$O,email_validated:xO,email_validated_cta:kO,email_verification_for_signup_sent_description:SO,email_verification_for_signup_sent_title:AO,enter_a_code_btn:EO,enter_email_for_verification_description:zO,enter_new_password_placeholder:IO,enter_password:NO,enter_password_description:CO,enter_your_password_btn:jO,expired_code:OO,fokus_info_message:PO,forgot_password_cta:TO,forgot_password_description:RO,forgot_password_email_sent:BO,forgot_password_link:LO,forgot_password_title:UO,go_back:MO,hide_password:FO,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:DO,invalid_session_body:VO,invalid_session_title:qO,link_email_click_to_login:HO,link_email_login:KO,link_email_or_enter_code:GO,link_page_body:WO,link_page_headline:JO,logged_in_as:XO,login:ZO,login_description:YO,login_description_code:QO,login_description_combined:eP,login_description_link:tP,login_description_phone:nP,login_description_template:rP,logout:iP,no_use_another:oP,or:sP,password:aP,password_has_been_reset:cP,password_has_been_reset_title:dP,password_reset_subject:lP,password_reset_title:uP,phone_placeholder:pP,privacy_policy:fP,redirecting:hP,reenter_new_password_placeholder:gP,register_password_account:mP,resend_code:_P,reset_password_cta:yP,reset_password_description:wP,reset_password_email_click_to_reset:vP,reset_password_email_cta:bP,reset_password_email_reset:$P,reset_password_subject:xP,reset_password_title:kP,send:SP,send_me_a_new_magic_link:AP,sent_code_spam:EP,set_password:zP,show_password:IP,sign_in:NP,signup:CP,signup_success:jP,sms_code_text:OP,spotify_already_linked_body:PP,spotify_already_linked_cta:TP,spotify_already_linked_step1_body:RP,spotify_already_linked_step1_title:BP,spotify_already_linked_step2_body:LP,spotify_already_linked_step2_title:UP,spotify_already_linked_title:MP,support_info:FP,terms:DP,unverified_email:VP,user_account_does_not_exist:qP,user_not_found:HP,user_not_found_body:KP,user_not_found_cta:GP,validate_code:WP,validate_email_body:JP,validate_email_title:XP,verify_email_click_to_verify:ZP,verify_email_subject:YP,verify_email_title:QP,verify_email_verify:eT,verify_your_email:tT,we_sent_a_code_to:nT,welcome:rT,welcome_to_your_account:iT,yes_continue:oT,yes_continue_with:sT,yes_continue_with_existing_account:aT},dT=t=>{const{vendorSettings:e,authParams:n}=t,i=`/authorize?${new URLSearchParams({...n})}`;return _(De,{vendorSettings:e,title:O.t("user_not_found"),children:_("div",{className:"flex flex-1 flex-col justify-center",children:[_("p",{className:"mb-8 text-gray-300 text-lg",children:O.t("user_not_found_body")}),_(Le,{Component:"a",href:i,children:O.t("user_not_found_cta")})]})})};O.init({supportedLngs:["en","it","nb","sv","pl","cs","fi"],fallbackLng:"en",resources:{en:{translation:q5},it:{translation:uk},nb:{translation:jS},sv:{translation:QE},pl:{translation:vN},cs:{translation:Fj},fi:{translation:cT}}});function lT(t){const e=new s.OpenAPIHono;e.get("/",o=>o.json({name:"authhero"}));const n=qv(t);e.route("/api/v2",n);const r=i$(t);e.route("/",r);const i=x6(t);return e.route("/u",i),{app:e,managementApp:n,oauthApp:r,universalApp:i,createX509Certificate:$d}}exports.AppLogo=Wm;exports.Auth0Client=Wh;exports.AuthorizationResponseMode=Dt;exports.AuthorizationResponseType=it;exports.Button=Le;exports.CheckEmailPage=u1;exports.CodeChallengeMethod=ws;exports.ComponentCategory=Ld;exports.ComponentType=Bd;exports.EmailValidatedPage=h1;exports.EnterCodePage=Pd;exports.EnterPasswordPage=Vr;exports.ErrorMessage=Gn;exports.Footer=Jm;exports.ForgotPasswordPage=d1;exports.ForgotPasswordSentPage=l1;exports.FormComponent=tn;exports.GoBack=bt;exports.GoogleLogo=Ym;exports.GrantType=rr;exports.Icon=Be;exports.IdentifierPage=ho;exports.InvalidSession=f1;exports.Layout=De;exports.LogTypes=he;exports.Message=Ct;exports.NodeType=Ch;exports.PreSignUpConfirmationPage=g1;exports.PreSignUpPage=p1;exports.ResetPasswordPage=er;exports.SignUpPage=vn;exports.SocialButton=Fr;exports.Spinner=Zm;exports.Trans=$a;exports.UnverifiedEmailPage=c1;exports.UserNotFoundPage=dT;exports.VippsLogo=Qm;exports.applicationInsertSchema=$o;exports.applicationSchema=xn;exports.auth0FlowInsertSchema=Z1;exports.auth0FlowSchema=Lh;exports.auth0UserResponseSchema=Et;exports.authParamsSchema=Yr;exports.baseUserSchema=_s;exports.bordersSchema=Yh;exports.brandingSchema=Ya;exports.buttonComponentSchema=Ah;exports.codeInsertSchema=Fh;exports.codeSchema=Y1;exports.codeTypeSchema=Mh;exports.colorsSchema=Qh;exports.componentSchema=Nh;exports.connectionInsertSchema=xo;exports.connectionOptionsSchema=Ud;exports.connectionSchema=rn;exports.coordinatesSchema=xr;exports.customDomainInsertSchema=Md;exports.customDomainSchema=nn;exports.customDomainWithTenantIdSchema=Q1;exports.emailProviderSchema=to;exports.endingSchema=Bh;exports.fieldComponentSchema=zh;exports.flowNodeSchema=Oh;exports.fontDetailsSchema=wn;exports.fontsSchema=e0;exports.formControlSchema=e_;exports.formInsertSchema=So;exports.formNodeComponentDefinition=Vh;exports.formSchema=tr;exports.genericComponentSchema=Ih;exports.genericNodeSchema=Ph;exports.hookInsertSchema=Qi;exports.hookSchema=nr;exports.identitySchema=xh;exports.init=lT;exports.injectTailwindCSS=_6;exports.jwksKeySchema=Kh;exports.jwksSchema=Fd;exports.legalComponentSchema=Eh;exports.logSchema=Ao;exports.loginSessionInsertSchema=Gh;exports.loginSessionSchema=o_;exports.nodeSchema=Th;exports.openIDConfigurationSchema=Qa;exports.pageBackgroundSchema=t0;exports.parseUserId=p_;exports.passwordInsertSchema=Jh;exports.passwordSchema=a_;exports.profileDataSchema=$h;exports.promptSettingSchema=eo;exports.refreshTokenInsertSchema=Vd;exports.refreshTokenSchema=d_;exports.richTextComponentSchema=Sh;exports.samlpAddon=kh;exports.sessionInsertSchema=Zh;exports.sessionSchema=bs;exports.signingKeySchema=ec;exports.smsProviderSchema=u_;exports.smsSendParamsSchema=l_;exports.startSchema=Rh;exports.stepNodeSchema=jh;exports.tailwindCss=cu;exports.tenantInsertSchema=ko;exports.tenantSchema=or;exports.themeInsertSchema=r0;exports.themeSchema=c_;exports.tokenResponseSchema=Dd;exports.totalsSchema=Xt;exports.userInsertSchema=bo;exports.userResponseSchema=W1;exports.userSchema=Rd;exports.vendorSettingsSchema=Uh;exports.verificationMethodsSchema=Dh;exports.widgetSchema=n0;
|