authhero 0.197.0 → 0.198.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 CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var vw=Object.defineProperty;var bw=(t,e,n)=>e in t?vw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var be=(t,e,n)=>bw(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@hono/zod-openapi"),Ee=t=>typeof t=="string",us=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},Yf=t=>t==null?"":""+t,xw=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},$w=/###/g,Zf=t=>t&&t.indexOf("###")>-1?t.replace($w,"."):t,Qf=t=>!t||Ee(t),vs=(t,e,n)=>{const r=Ee(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(Qf(t))return{};const s=Zf(r[i]);!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++i}return Qf(t)?{}:{obj:t,k:Zf(r[i])}},eh=(t,e,n)=>{const{obj:r,k:i}=vs(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let s=e[e.length-1],a=e.slice(0,e.length-1),l=vs(t,a,Object);for(;l.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),l=vs(t,a,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${s}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${s}`]=n},Aw=(t,e,n,r)=>{const{obj:i,k:s}=vs(t,e,Object);i[s]=i[s]||[],i[s].push(n)},ma=(t,e)=>{const{obj:n,k:r}=vs(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Ew=(t,e,n)=>{const r=ma(t,n);return r!==void 0?r:ma(e,n)},_m=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?Ee(t[r])||t[r]instanceof String||Ee(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):_m(t[r],e[r],n):t[r]=e[r]);return t},ai=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Sw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const kw=t=>Ee(t)?t.replace(/[&<>"'\/]/g,e=>Sw[e]):t;class Nw{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 Cw=[" ",",","?","!",";"],Tw=new Nw(20),Iw=(t,e,n)=>{e=e||"",n=n||"";const r=Cw.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=Tw.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!i.test(t);if(!s){const a=t.indexOf(n);a>0&&!i.test(t.substring(0,a))&&(s=!0)}return s},yu=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 s=0;s<r.length;){if(!i||typeof i!="object")return;let a,l="";for(let u=s;u<r.length;++u)if(u!==s&&(l+=n),l+=r[u],a=i[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&u<r.length-1)continue;s+=u-s+1;break}i=a}return i},_a=t=>t==null?void 0:t.replace("_","-"),Ow={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 ya{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||Ow,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:(Ee(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new ya(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new ya(this.logger,e)}}var $n=new ya;class wc{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[l,u]=a;for(let d=0;d<u;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,u]=a;for(let d=0;d<u;d++)l.apply(l,[e,...r])})}}class th extends wc{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 d,p;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],r&&(Array.isArray(r)?l.push(...r):Ee(r)&&s?l.push(...r.split(s)):l.push(r)));const u=ma(this.data,l);return!u&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),u||!a||!Ee(r)?u:yu((p=(d=this.data)==null?void 0:d[e])==null?void 0:p[n],r,s)}addResource(e,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[e,n];r&&(l=l.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(l=e.split("."),i=n,n=l[1]),this.addNamespaces(n),eh(this.data,l,i),s.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 s in r)(Ee(r[s])||Array.isArray(r[s]))&&this.addResource(e,n,s,r[s],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),i=r,r=n,n=l[1]),this.addNamespaces(n);let u=ma(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?_m(u,r,s):u={...u,...r},eh(this.data,l,u),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 ym={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{var a;e=((a=this.processors[s])==null?void 0:a.process(e,n,r,i))??e}),e}};const nh={};class wa extends wc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xw(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=$n.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 s=n.ns||this.options.defaultNS||[];const a=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Iw(e,r,i);if(a&&!l){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:Ee(s)?[s]:s};const d=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),e=d.join(i)}return{key:e,namespaces:Ee(s)?[s]:s}}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,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],n),u=l[l.length-1],d=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(p){const G=n.nsSeparator||this.options.nsSeparator;return i?{res:`${u}${G}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${G}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:a}const h=this.resolve(e,n);let g=h==null?void 0:h.res;const A=(h==null?void 0:h.usedKey)||a,$=(h==null?void 0:h.exactUsedKey)||a,I=Object.prototype.toString.apply(g),R=["[object Number]","[object Function]","[object RegExp]"],D=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,M=!Ee(g)&&typeof g!="boolean"&&typeof g!="number";if(x&&g&&M&&R.indexOf(I)<0&&!(Ee(D)&&Array.isArray(g))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(A,g,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(h.res=G,h.usedParams=this.getUsedParamsDetails(n),h):G}if(s){const G=Array.isArray(g),F=G?[]:{},H=G?$:A;for(const X in g)if(Object.prototype.hasOwnProperty.call(g,X)){const Y=`${H}${s}${X}`;F[X]=this.translate(Y,{...n,joinArrays:!1,ns:l}),F[X]===Y&&(F[X]=g[X])}g=F}}else if(x&&Ee(D)&&Array.isArray(g))g=g.join(D),g&&(g=this.extendTranslation(g,e,n,r));else{let G=!1,F=!1;const H=n.count!==void 0&&!Ee(n.count),X=wa.hasDefaultValue(n),Y=H?this.pluralResolver.getSuffix(d,n.count,n):"",fe=n.ordinal&&H?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",Ce=H&&!n.ordinal&&n.count===0,P=Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${Y}`]||n[`defaultValue${fe}`]||n.defaultValue;!this.isValidLookup(g)&&X&&(G=!0,g=P),this.isValidLookup(g)||(F=!0,g=a);const z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&F?void 0:g,k=X&&P!==g&&this.options.updateMissing;if(F||G||k){if(this.logger.log(k?"updateKey":"missingKey",d,u,a,k?P:g),s){const ue=this.resolve(a,{...n,keySeparator:!1});ue&&ue.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 S=[];const B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&B&&B[0])for(let ue=0;ue<B.length;ue++)S.push(B[ue]);else this.options.saveMissingTo==="all"?S=this.languageUtils.toResolveHierarchy(n.lng||this.language):S.push(n.lng||this.language);const V=(ue,re,ve)=>{var Z;const Se=X&&ve!==g?ve:z;this.options.missingKeyHandler?this.options.missingKeyHandler(ue,u,re,Se,k,n):(Z=this.backendConnector)!=null&&Z.saveMissing&&this.backendConnector.saveMissing(ue,u,re,Se,k,n),this.emit("missingKey",ue,u,re,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&H?S.forEach(ue=>{const re=this.pluralResolver.getSuffixes(ue,n);Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]&&re.indexOf(`${this.options.pluralSeparator}zero`)<0&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(ve=>{V([ue],a+ve,n[`defaultValue${ve}`]||P)})}):V(S,a,P))}g=this.extendTranslation(g,e,n,h,r),F&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${u}:${a}`),(F||G)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${a}`:a,G?g:void 0))}return i?(h.res=g,h.usedParams=this.getUsedParamsDetails(n),h):g}extendTranslation(e,n,r,i,s){var d,p;var a=this;if((d=this.i18nFormat)!=null&&d.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 h=Ee(e)&&(((p=r==null?void 0:r.interpolation)==null?void 0:p.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let g;if(h){const $=e.match(this.interpolator.nestingRegexp);g=$&&$.length}let A=r.replace&&!Ee(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(A={...this.options.interpolation.defaultVariables,...A}),e=this.interpolator.interpolate(e,A,r.lng||this.language||i.usedLng,r),h){const $=e.match(this.interpolator.nestingRegexp),I=$&&$.length;g<I&&(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 $=arguments.length,I=new Array($),R=0;R<$;R++)I[R]=arguments[R];return(s==null?void 0:s[0])===I[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${I[0]} in key: ${n[0]}`),null):a.translate(...I,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=Ee(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=ym.handle(u,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,s,a,l;return Ee(e)&&(e=[e]),e.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),p=d.key;i=p;let h=d.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const g=n.count!==void 0&&!Ee(n.count),A=g&&!n.ordinal&&n.count===0,$=n.context!==void 0&&(Ee(n.context)||typeof n.context=="number")&&n.context!=="",I=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(R=>{var D,x;this.isValidLookup(r)||(l=R,!nh[`${I[0]}-${R}`]&&((D=this.utils)!=null&&D.hasLoadedNamespace)&&!((x=this.utils)!=null&&x.hasLoadedNamespace(l))&&(nh[`${I[0]}-${R}`]=!0,this.logger.warn(`key "${i}" for languages "${I.join(", ")}" won't get resolved as namespace "${l}" 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!!!")),I.forEach(M=>{var H;if(this.isValidLookup(r))return;a=M;const G=[p];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(G,p,M,R,n);else{let X;g&&(X=this.pluralResolver.getSuffix(M,n.count,n));const Y=`${this.options.pluralSeparator}zero`,fe=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(G.push(p+X),n.ordinal&&X.indexOf(fe)===0&&G.push(p+X.replace(fe,this.options.pluralSeparator)),A&&G.push(p+Y)),$){const Ce=`${p}${this.options.contextSeparator}${n.context}`;G.push(Ce),g&&(G.push(Ce+X),n.ordinal&&X.indexOf(fe)===0&&G.push(Ce+X.replace(fe,this.options.pluralSeparator)),A&&G.push(Ce+Y))}}let F;for(;F=G.pop();)this.isValidLookup(r)||(s=F,r=this.getResource(M,R,F,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:a,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(s=this.i18nFormat)!=null&&s.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&&!Ee(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 s of n)delete i[s]}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 rh{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$n.create("languageUtils")}getScriptPartFromCode(e){if(e=_a(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=_a(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ee(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(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&(s.indexOf("-")>0&&i.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===i||s.indexOf(i)===0&&i.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Ee(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=[],s=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return Ee(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):Ee(e)&&s(this.formatLanguageCode(e)),r.forEach(a=>{i.indexOf(a)<0&&s(this.formatLanguageCode(a))}),i}}const ih={zero:0,one:1,two:2,few:3,many:4,other:5},sh={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class zw{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=$n.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=_a(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];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!"),sh;if(!e.match(/-|_/))return sh;const u=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(u,n)}return this.pluralRulesCache[s]=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,s)=>ih[i]-ih[s]).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 oh=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,s=Ew(t,e,n);return!s&&i&&Ee(n)&&(s=yu(t,n,r),s===void 0&&(s=yu(e,n,r))),s},Ll=t=>t.replace(/\$/g,"$$$$");class Dw{constructor(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$n.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:s,prefixEscaped:a,suffix:l,suffixEscaped:u,formatSeparator:d,unescapeSuffix:p,unescapePrefix:h,nestingPrefix:g,nestingPrefixEscaped:A,nestingSuffix:$,nestingSuffixEscaped:I,nestingOptionsSeparator:R,maxReplaces:D,alwaysFormat:x}=e.interpolation;this.escape=n!==void 0?n:kw,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?ai(s):a||"{{",this.suffix=l?ai(l):u||"}}",this.formatSeparator=d||",",this.unescapePrefix=p?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=g?ai(g):A||ai("$t("),this.nestingSuffix=$?ai($):I||ai(")"),this.nestingOptionsSeparator=R||",",this.maxReplaces=D||1e3,this.alwaysFormat=x!==void 0?x:!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 A;let s,a,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=$=>{if($.indexOf(this.formatSeparator)<0){const x=oh(n,u,$,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(x,void 0,r,{...i,...n,interpolationkey:$}):x}const I=$.split(this.formatSeparator),R=I.shift().trim(),D=I.join(this.formatSeparator).trim();return this.format(oh(n,u,R,this.options.keySeparator,this.options.ignoreJSONStructure),D,r,{...i,...n,interpolationkey:R})};this.resetRegExp();const p=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((A=i==null?void 0:i.interpolation)==null?void 0:A.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:$=>Ll($)},{regex:this.regexp,safeValue:$=>this.escapeValue?Ll(this.escape($)):Ll($)}].forEach($=>{for(l=0;s=$.regex.exec(e);){const I=s[1].trim();if(a=d(I),a===void 0)if(typeof p=="function"){const D=p(e,s,i);a=Ee(D)?D:""}else if(i&&Object.prototype.hasOwnProperty.call(i,I))a="";else if(h){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${I} for interpolating ${e}`),a="";else!Ee(a)&&!this.useRawValueToEscape&&(a=Yf(a));const R=$.safeValue(a);if(e=e.replace(s[0],R),h?($.regex.lastIndex+=a.length,$.regex.lastIndex-=s[0].length):$.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,a;const l=(u,d)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const h=u.split(new RegExp(`${p}[ ]*{`));let g=`{${h[1]}`;u=h[0],g=this.interpolate(g,a);const A=g.match(/'/g),$=g.match(/"/g);(((A==null?void 0:A.length)??0)%2===0&&!$||$.length%2!==0)&&(g=g.replace(/'/g,'"'));try{a=JSON.parse(g),d&&(a={...d,...a})}catch(I){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,I),`${u}${p}${g}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,u};for(;i=this.nestingRegexp.exec(e);){let u=[];a={...r},a=a.replace&&!Ee(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const p=i[1].split(this.formatSeparator).map(h=>h.trim());i[1]=p.shift(),u=p,d=!0}if(s=n(l.call(this,i[1].trim(),a),a),s&&i[0]===e&&!Ee(s))return s;Ee(s)||(s=Yf(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),d&&(s=u.reduce((p,h)=>this.format(p,h,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}const Rw=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[l,...u]=a.split(":"),d=u.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},ci=t=>{const e={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const a=r+JSON.stringify(s);let l=e[a];return l||(l=t(_a(r),i),e[a]=l),l(n)}};class Pw{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$n.create("formatter"),this.options=e,this.formats={number:ci((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:ci((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:ci((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:ci((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:ci((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},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()]=ci(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(l=>l.indexOf(")")>-1)){const l=s.findIndex(u=>u.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,l)].join(this.formatSeparator)}return s.reduce((l,u)=>{var h;const{formatName:d,formatOptions:p}=Rw(u);if(this.formats[d]){let g=l;try{const A=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},$=A.locale||A.lng||i.locale||i.lng||r;g=this.formats[d](l,$,{...p,...i,...A})}catch(A){this.logger.warn(A)}return g}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Bw=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class jw extends wc{constructor(e,n,r){var s,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=$n.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=(s=this.backend)==null?void 0:s.init)==null||a.call(s,r,i.backend,i)}queueLoad(e,n,r,i){const s={},a={},l={},u={};return e.forEach(d=>{let p=!0;n.forEach(h=>{const g=`${d}|${h}`;!r.reload&&this.store.hasResourceBundle(d,h)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?a[g]===void 0&&(a[g]=!0):(this.state[g]=1,p=!1,a[g]===void 0&&(a[g]=!0),s[g]===void 0&&(s[g]=!0),u[h]===void 0&&(u[h]=!0)))}),p||(l[d]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(u)}}loaded(e,n,r){const i=e.split("|"),s=i[0],a=i[1];n&&this.emit("failedLoading",s,a,n),!n&&r&&this.store.addResourceBundle(s,a,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const l={};this.queue.forEach(u=>{Aw(u.loaded,[s],a),Bw(u,e),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const p=u.loaded[d];p.length&&p.forEach(h=>{l[d][h]===void 0&&(l[d][h]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(u=>!u.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=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:s,callback:a});return}this.readingCalls++;const l=(d,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(d&&p&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,s*2,a)},s);return}a(d,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(e,n);d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}return}return u(e,n,l)}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();Ee(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ee(n)&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.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],s=r[1];this.read(i,s,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,l),this.loaded(e,a,l)})}saveMissing(e,n,r,i,s){var u,d,p,h,g;let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((d=(u=this.services)==null?void 0:u.utils)!=null&&d.hasLoadedNamespace&&!((h=(p=this.services)==null?void 0:p.utils)!=null&&h.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((g=this.backend)!=null&&g.create){const A={...a,isUpdate:s},$=this.backend.create.bind(this.backend);if($.length<6)try{let I;$.length===5?I=$(e,n,r,i,A):I=$(e,n,r,i),I&&typeof I.then=="function"?I.then(R=>l(null,R)).catch(l):l(null,I)}catch(I){l(I)}else $(e,n,r,i,l,A)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const ah=()=>({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]),Ee(t[1])&&(e.defaultValue=t[1]),Ee(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}}),ch=t=>{var e,n;return Ee(t.ns)&&(t.ns=[t.ns]),Ee(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ee(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},jo=()=>{},Lw=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Cs extends wc{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=ch(e),this.services={},this.logger=$n,this.modules={external:[]},Lw(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&&(Ee(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=ah();this.options={...i,...this.options,...ch(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 s=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?$n.init(s(this.modules.logger),this.options):$n.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Pw;const h=new rh(this.options);this.store=new th(this.options.resources,this.options);const g=this.services;g.logger=$n,g.resourceStore=this.store,g.languageUtils=h,g.pluralResolver=new zw(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(g.formatter=s(p),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new Dw(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new jw(s(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(A){for(var $=arguments.length,I=new Array($>1?$-1:0),R=1;R<$;R++)I[R-1]=arguments[R];e.emit(A,...I)}),this.modules.languageDetector&&(g.languageDetector=s(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=s(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new wa(this.services,this.options),this.translator.on("*",function(A){for(var $=arguments.length,I=new Array($>1?$-1:0),R=1;R<$;R++)I[R-1]=arguments[R];e.emit(A,...I)}),this.modules.external.forEach(A=>{A.init&&A.init(this)})}if(this.format=this.options.interpolation.format,r||(r=jo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const u=us(),d=()=>{const p=(h,g)=>{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),u.resolve(g),r(h,g)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e){var s,a;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jo;const i=Ee(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 l=[],u=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(h=>{h!=="cimode"&&l.indexOf(h)<0&&l.push(h)})};i?u(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>u(p)),(a=(s=this.options.preload)==null?void 0:s.forEach)==null||a.call(s,d=>u(d)),this.services.backendConnector.load(l,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(e,n,r){const i=us();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=jo),this.services.backendConnector.reload(e,n,s=>{i.resolve(),r(s)}),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"&&ym.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=us();this.emit("languageChanging",e);const s=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},a=(u,d)=>{d?(s(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(u,function(){return r.t(...arguments)})},l=u=>{var p,h;!e&&!u&&this.services.languageDetector&&(u=[]);const d=Ee(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||s(d),this.translator.language||this.translator.changeLanguage(d),(h=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||h.call(p,d)),this.loadResources(d,g=>{a(g,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),i}getFixedT(e,n,r){var i=this;const s=function(a,l){let u;if(typeof l!="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),h=2;h<d;h++)p[h-2]=arguments[h];u=i.options.overloadTranslationOptionHandler([a,l].concat(p))}else u={...l};u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs,u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||s.keyPrefix);const g=i.options.keySeparator||".";let A;return u.keyPrefix&&Array.isArray(a)?A=a.map($=>`${u.keyPrefix}${g}${$}`):A=u.keyPrefix?`${u.keyPrefix}${g}${a}`:a,i.t(A,u)};return Ee(e)?s.lng=e:s.lngs=e,s.ns=n,s.keyPrefix=r,s}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,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,u)=>{const d=this.services.backendConnector.state[`${l}|${u}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,e)&&(!i||a(s,e)))}loadNamespaces(e,n){const r=us();return this.options.ns?(Ee(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=us();Ee(e)&&(e=[e]);const i=this.options.preload||[],s=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=i.concat(s),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(e){var i,s;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=((s=this.services)==null?void 0:s.languageUtils)||new rh(ah());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 Cs(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jo;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new Cs(i);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const l=Object.keys(this.store.data).reduce((u,d)=>(u[d]={...this.store.data[d]},Object.keys(u[d]).reduce((p,h)=>(p[h]={...u[d][h]},p),{})),{});s.store=new th(l,i),s.services.resourceStore=s.store}return s.translator=new wa(s.services,i),s.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p<u;p++)d[p-1]=arguments[p];s.emit(l,...d)}),s.init(i,n),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const L=Cs.createInstance();L.createInstance=Cs.createInstance;L.createInstance;L.dir;L.init;L.loadResources;L.reloadResources;L.use;L.changeLanguage;L.getFixedT;const $e=L.t;L.exists;L.setDefaultNamespace;L.hasLoadedNamespace;L.loadNamespaces;L.loadLanguages;var wm=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(s=>typeof s=="string"?s==="*"?()=>s:a=>s===a?a:null:typeof s=="function"?s:a=>s.includes(a)?a:null)(n.origin),i=(s=>typeof s=="function"?s:Array.isArray(s)?()=>s:()=>[])(n.allowMethods);return async function(a,l){var p;function u(h,g){a.res.headers.set(h,g)}const d=r(a.req.header("origin")||"",a);if(d&&u("Access-Control-Allow-Origin",d),n.origin!=="*"){const h=a.req.header("Vary");h?u("Vary",h):u("Vary","Origin")}if(n.credentials&&u("Access-Control-Allow-Credentials","true"),(p=n.exposeHeaders)!=null&&p.length&&u("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),a.req.method==="OPTIONS"){n.maxAge!=null&&u("Access-Control-Max-Age",n.maxAge.toString());const h=i(a.req.header("origin")||"",a);h.length&&u("Access-Control-Allow-Methods",h.join(","));let g=n.allowHeaders;if(!(g!=null&&g.length)){const A=a.req.header("Access-Control-Request-Headers");A&&(g=A.split(/\s*,\s*/))}return g!=null&&g.length&&(u("Access-Control-Allow-Headers",g.join(",")),a.res.headers.append("Vary","Access-Control-Request-Headers")),a.res.headers.delete("Content-Length"),a.res.headers.delete("Content-Type"),new Response(null,{headers:a.res.headers,status:204,statusText:"No Content"})}await l()}};const gn=o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()}),vc=o.z.object({created_at:o.z.string(),updated_at:o.z.string()}),vm=o.z.object({email:o.z.string().optional(),email_verified:o.z.boolean().optional(),name:o.z.string().optional(),username:o.z.string().optional(),given_name:o.z.string().optional(),phone_number:o.z.string().optional(),phone_verified:o.z.boolean().optional(),family_name:o.z.string().optional()}).catchall(o.z.any()),bm=o.z.object({connection:o.z.string(),user_id:o.z.string(),provider:o.z.string(),isSocial:o.z.boolean(),access_token:o.z.string().optional(),access_token_secret:o.z.string().optional(),refresh_token:o.z.string().optional(),profileData:vm.optional()}),bc=o.z.object({email:o.z.string().optional().transform(t=>t&&t.toLowerCase()),username:o.z.string().optional(),phone_number:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),nickname:o.z.string().optional(),name:o.z.string().optional(),picture:o.z.string().optional(),locale:o.z.string().optional(),linked_to:o.z.string().optional(),profileData:o.z.string().optional(),user_id:o.z.string().optional(),app_metadata:o.z.any().default({}).optional(),user_metadata:o.z.any().default({}).optional()}),va=bc.extend({email_verified:o.z.boolean().default(!1),verify_email:o.z.boolean().optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string().optional(),provider:o.z.string().default("email"),connection:o.z.string().default("email"),is_social:o.z.boolean().optional()}),up=o.z.object({...va.shape,...vc.shape,user_id:o.z.string(),is_social:o.z.boolean(),email:o.z.string().optional(),login_count:o.z.number().default(0),identities:o.z.array(bm).optional()}),xn=up,Fw=bc.extend({login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any()),Uw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Mw=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Uw[n[t]&63];return e};const xm=o.z.object({audience:o.z.string().optional(),recipient:o.z.string().optional(),createUpnClaim:o.z.boolean().optional(),mapUnknownClaimsAsIs:o.z.boolean().optional(),passthroughClaimsWithNoMapping:o.z.boolean().optional(),mapIdentities:o.z.boolean().optional(),signatureAlgorithm:o.z.string().optional(),digestAlgorithm:o.z.string().optional(),issuer:o.z.string().optional(),destination:o.z.string().optional(),lifetimeInSeconds:o.z.number().optional(),signResponse:o.z.boolean().optional(),nameIdentifierFormat:o.z.string().optional(),nameIdentifierProbes:o.z.array(o.z.string()).optional(),authnContextClassRef:o.z.string().optional(),mappings:o.z.record(o.z.string()).optional()}),ba=o.z.object({id:o.z.string(),name:o.z.string(),callbacks:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:o.z.array(o.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:o.z.array(o.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:o.z.array(o.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:o.z.array(o.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:o.z.object({samlp:xm.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:o.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:o.z.string().default(()=>Mw()).optional(),disable_sign_ups:o.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"}),client_metadata:o.z.record(o.z.string().length(255)).optional()}),zr=o.z.object({created_at:o.z.string().transform(t=>t===null?"":t),updated_at:o.z.string().transform(t=>t===null?"":t),...ba.shape}),Gi=o.z.object({x:o.z.number(),y:o.z.number()});var dp=(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))(dp||{}),pp=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(pp||{});const xc=o.z.object({id:o.z.string(),category:o.z.nativeEnum(pp),type:o.z.nativeEnum(dp)}),$m=xc.extend({category:o.z.literal("BLOCK"),type:o.z.literal("RICH_TEXT"),config:o.z.object({content:o.z.string()}).passthrough()}),Am=xc.extend({category:o.z.literal("BLOCK"),type:o.z.union([o.z.literal("NEXT_BUTTON"),o.z.literal("BACK_BUTTON"),o.z.literal("SUBMIT_BUTTON")]),config:o.z.object({text:o.z.string()}).passthrough()}),Em=xc.extend({category:o.z.literal("FIELD"),type:o.z.literal("LEGAL"),required:o.z.boolean().optional(),sensitive:o.z.boolean().optional(),config:o.z.object({text:o.z.string()}).passthrough()}),Sm=xc.extend({category:o.z.literal("FIELD"),type:o.z.union([o.z.literal("TEXT"),o.z.literal("EMAIL"),o.z.literal("PASSWORD"),o.z.literal("NUMBER"),o.z.literal("PHONE"),o.z.literal("DATE"),o.z.literal("CHECKBOX"),o.z.literal("RADIO"),o.z.literal("SELECT"),o.z.literal("HIDDEN")]),required:o.z.boolean().optional(),sensitive:o.z.boolean().optional(),config:o.z.object({label:o.z.string().optional(),placeholder:o.z.string().optional()}).passthrough()}),km=o.z.object({id:o.z.string(),category:o.z.string(),type:o.z.string()}).passthrough(),Nm=o.z.union([$m,Am,Em,Sm,km]);var Cm=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(Cm||{});const Tm=o.z.object({id:o.z.string(),type:o.z.literal("STEP"),coordinates:Gi,alias:o.z.string().optional(),config:o.z.object({components:o.z.array(Nm),next_node:o.z.string()}).passthrough()}),Im=o.z.object({id:o.z.string(),type:o.z.literal("FLOW"),coordinates:Gi,alias:o.z.string().optional(),config:o.z.object({flow_id:o.z.string(),next_node:o.z.string()})}),Om=o.z.object({id:o.z.string(),type:o.z.string(),coordinates:Gi}).passthrough(),zm=o.z.union([Tm,Im,Om]),Dm=o.z.object({next_node:o.z.string(),coordinates:Gi}).passthrough(),Rm=o.z.object({resume_flow:o.z.boolean().optional(),coordinates:Gi}).passthrough(),Pm=o.z.object({id:o.z.string(),name:o.z.string(),languages:o.z.object({primary:o.z.string()}).passthrough(),nodes:o.z.array(zm),start:Dm,ending:Rm,created_at:o.z.string(),updated_at:o.z.string(),links:o.z.object({sdkSrc:o.z.string().optional(),sdk_src:o.z.string().optional()}).passthrough()}).passthrough(),qw=Pm.omit({id:!0,created_at:!0,updated_at:!0});var nn=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(nn||{}),En=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(En||{}),$c=(t=>(t.S256="S256",t.Plain="plain",t))($c||{});const Ts=o.z.object({client_id:o.z.string(),act_as:o.z.string().optional(),response_type:o.z.nativeEnum(nn).optional(),response_mode:o.z.nativeEnum(En).optional(),redirect_uri:o.z.string().optional(),audience:o.z.string().optional(),organization:o.z.string().optional(),state:o.z.string().optional(),nonce:o.z.string().optional(),scope:o.z.string().optional(),prompt:o.z.string().optional(),code_challenge_method:o.z.nativeEnum($c).optional(),code_challenge:o.z.string().optional(),username:o.z.string().optional(),ui_locales:o.z.string().optional(),vendor_id:o.z.string().optional()}),wu=o.z.object({colors:o.z.object({primary:o.z.string(),page_background:o.z.object({type:o.z.string().optional(),start:o.z.string().optional(),end:o.z.string().optional(),angle_deg:o.z.number().optional()}).optional()}).optional(),logo_url:o.z.string().optional(),favicon_url:o.z.string().optional(),font:o.z.object({url:o.z.string()}).optional()}),$i=o.z.object({kid:o.z.string().optional(),team_id:o.z.string().optional(),realms:o.z.string().optional(),authentication_method:o.z.string().optional(),client_id:o.z.string().optional(),client_secret:o.z.string().optional(),app_secret:o.z.string().optional(),scope:o.z.string().optional(),authorization_endpoint:o.z.string().optional(),token_endpoint:o.z.string().optional(),userinfo_endpoint:o.z.string().optional(),jwks_uri:o.z.string().optional(),discovery_url:o.z.string().optional(),issuer:o.z.string().optional(),provider:o.z.string().optional(),from:o.z.string().optional(),twilio_sid:o.z.string().optional(),twilio_token:o.z.string().optional()}),xa=o.z.object({id:o.z.string().optional(),name:o.z.string(),strategy:o.z.string(),options:$i.default({}),enabled_clients:o.z.array(o.z.string()).default([]).optional(),response_type:o.z.custom().optional(),response_mode:o.z.custom().optional()}),rn=o.z.object({id:o.z.string(),created_at:o.z.string().transform(t=>t===null?"":t),updated_at:o.z.string().transform(t=>t===null?"":t)}).extend(xa.shape),$a=o.z.object({name:o.z.string(),audience:o.z.string(),sender_email:o.z.string().email(),sender_name:o.z.string(),support_url:o.z.string().url().optional(),logo:o.z.string().url().optional(),primary_color:o.z.string().optional(),secondary_color:o.z.string().optional(),language:o.z.string().optional(),id:o.z.string().optional()}),Ai=o.z.object({created_at:o.z.string().transform(t=>t===null?"":t),updated_at:o.z.string().transform(t=>t===null?"":t),...$a.shape,id:o.z.string()});o.z.object({...zr.shape,tenant:Ai,connections:o.z.array(rn)});const Bm=o.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),jm=o.z.object({code_id:o.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:o.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:o.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Bm,code_verifier:o.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:o.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:o.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:o.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:o.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:o.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:o.z.string(),used_at:o.z.string().optional(),user_id:o.z.string().optional()}),Vw=o.z.object({...jm.shape,created_at:o.z.string()}),fp=o.z.object({domain:o.z.string(),custom_domain_id:o.z.string().optional(),type:o.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:o.z.enum(["txt"]).optional(),tls_policy:o.z.enum(["recommended"]).optional(),custom_client_ip_header:o.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:o.z.record(o.z.string().max(255)).optional()}),Lm=o.z.object({name:o.z.literal("txt"),record:o.z.string(),domain:o.z.string()}),cr=o.z.object({...fp.shape,custom_domain_id:o.z.string(),primary:o.z.boolean(),status:o.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:o.z.string().optional(),verification:o.z.object({methods:o.z.array(Lm)}).optional(),tls_policy:o.z.string().optional()}),Hw=cr.extend({tenant_id:o.z.string()}),Kw=o.z.object({id:o.z.string(),type:o.z.literal("submit"),label:o.z.string(),className:o.z.string().optional(),disabled:o.z.boolean().optional().default(!1),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0),customizations:o.z.record(o.z.string(),o.z.any()).optional()}),Fm=o.z.discriminatedUnion("type",[o.z.object({id:o.z.string(),type:o.z.literal("RICH_TEXT"),config:o.z.object({content:o.z.string()}),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)}),o.z.object({id:o.z.string(),type:o.z.literal("LEGAL"),config:o.z.object({text:o.z.string(),html:o.z.boolean().optional()}),required:o.z.boolean().optional(),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)}),o.z.object({id:o.z.string(),type:o.z.literal("TEXT"),config:o.z.object({placeholder:o.z.string().optional(),multiline:o.z.boolean().optional()}),required:o.z.boolean().optional(),sensitive:o.z.boolean().optional(),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)}),o.z.object({id:o.z.string(),type:o.z.literal("NEXT_BUTTON"),config:o.z.object({text:o.z.string().optional()}),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)})]),Aa=o.z.object({name:o.z.string().openapi({description:"The name of the form"}),messages:o.z.object({errors:o.z.record(o.z.string(),o.z.any()).optional(),custom:o.z.record(o.z.string(),o.z.any()).optional()}).optional(),languages:o.z.object({primary:o.z.string().optional(),default:o.z.string().optional()}).optional(),translations:o.z.record(o.z.string(),o.z.any()).optional(),nodes:o.z.array(o.z.discriminatedUnion("type",[o.z.object({id:o.z.string(),type:o.z.literal("FLOW"),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}),alias:o.z.string().min(1).max(150).optional(),config:o.z.object({flow_id:o.z.string().max(30),next_node:o.z.string()})}),o.z.object({id:o.z.string(),type:o.z.literal("ROUTER"),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}),alias:o.z.string().min(1).max(150),config:o.z.object({rules:o.z.array(o.z.object({id:o.z.string(),alias:o.z.string().min(1).max(150).optional(),condition:o.z.any(),next_node:o.z.string()})),fallback:o.z.array(o.z.string())})}),o.z.object({id:o.z.string(),type:o.z.literal("STEP"),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}),alias:o.z.string().min(1).max(150).optional(),config:o.z.object({components:o.z.array(Fm),next_node:o.z.string()})})])).optional(),start:o.z.object({hidden_fields:o.z.array(o.z.object({key:o.z.string(),value:o.z.string()})).optional(),next_node:o.z.string().optional(),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}).optional()}).optional(),ending:o.z.object({redirection:o.z.object({delay:o.z.number().optional(),target:o.z.string().optional()}).optional(),after_submit:o.z.object({flow_id:o.z.string().optional()}).optional(),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}).optional(),resume_flow:o.z.boolean().optional()}).optional(),style:o.z.object({css:o.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches new JSON structure)"}),yi=o.z.object({...vc.shape,...Aa.shape,id:o.z.string()}),Um=o.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Mm=o.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Ac={enabled:o.z.boolean().default(!1),synchronous:o.z.boolean().default(!1),priority:o.z.number().optional(),hook_id:o.z.string().optional()},Gw=o.z.object({...Ac,trigger_id:Um,url:o.z.string()}),Ww=o.z.object({...Ac,trigger_id:Mm,form_id:o.z.string()}),Yo=o.z.union([Gw,Ww]),Xw=o.z.object({...Ac,trigger_id:Um,...vc.shape,hook_id:o.z.string(),url:o.z.string()}),Jw=o.z.object({...Ac,trigger_id:Mm,...vc.shape,hook_id:o.z.string(),form_id:o.z.string()}),wi=o.z.union([Xw,Jw]),hp=o.z.object({alg:o.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:o.z.string(),kid:o.z.string(),kty:o.z.enum(["RSA","EC","oct"]),n:o.z.string(),x5t:o.z.string().optional(),x5c:o.z.array(o.z.string()).optional(),use:o.z.enum(["sig","enc"]).optional()}),qm=o.z.object({keys:o.z.array(hp)}),vu=o.z.object({issuer:o.z.string(),authorization_endpoint:o.z.string(),token_endpoint:o.z.string(),device_authorization_endpoint:o.z.string(),userinfo_endpoint:o.z.string(),mfa_challenge_endpoint:o.z.string(),jwks_uri:o.z.string(),registration_endpoint:o.z.string(),revocation_endpoint:o.z.string(),scopes_supported:o.z.array(o.z.string()),response_types_supported:o.z.array(o.z.string()),code_challenge_methods_supported:o.z.array(o.z.string()),response_modes_supported:o.z.array(o.z.string()),subject_types_supported:o.z.array(o.z.string()),id_token_signing_alg_values_supported:o.z.array(o.z.string()),token_endpoint_auth_methods_supported:o.z.array(o.z.string()),claims_supported:o.z.array(o.z.string()),request_uri_parameter_supported:o.z.boolean(),request_parameter_supported:o.z.boolean(),token_endpoint_auth_signing_alg_values_supported:o.z.array(o.z.string())}),Vm=o.z.object({csrf_token:o.z.string(),auth0Client:o.z.string().optional(),authParams:Ts,expires_at:o.z.string(),deleted_at:o.z.string().optional(),ip:o.z.string().optional(),useragent:o.z.string().optional(),session_id:o.z.string().optional(),authorization_url:o.z.string().optional(),login_completed:o.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),Yw=o.z.object({...Vm.shape,id:o.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:o.z.string(),updated_at:o.z.string()}),Le={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},Zw=o.z.string().refine(t=>Object.values(Le).includes(t),{message:"Invalid log type"}),Hm=o.z.object({name:o.z.string(),version:o.z.string(),env:o.z.object({node:o.z.string().optional()}).optional()}),Ea=o.z.object({type:Zw,date:o.z.string(),description:o.z.string().optional(),log_id:o.z.string().optional(),_id:o.z.string().optional(),ip:o.z.string(),user_agent:o.z.string(),details:o.z.any().optional(),isMobile:o.z.boolean(),user_id:o.z.string().optional(),user_name:o.z.string().optional(),connection:o.z.string().optional(),connection_id:o.z.string().optional(),client_id:o.z.string().optional(),client_name:o.z.string().optional(),audience:o.z.string().optional(),scope:o.z.array(o.z.string()).optional(),strategy:o.z.string().optional(),strategy_type:o.z.string().optional(),hostname:o.z.string().optional(),auth0_client:Hm.optional()}),Km=o.z.object({user_id:o.z.string(),password:o.z.string(),algorithm:o.z.enum(["bcrypt","argon2id"]).default("argon2id")}),Qw=o.z.object({...Km.shape,created_at:o.z.string(),updated_at:o.z.string()}),Gm=o.z.object({initial_user_agent:o.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:o.z.string().describe("First IP address associated with this session"),initial_asn:o.z.string().describe("First autonomous system number associated with this session"),last_user_agent:o.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:o.z.string().describe("Last IP address from which this user logged in"),last_asn:o.z.string().describe("Last autonomous system number from which this user logged in")}),Wm=o.z.object({id:o.z.string(),revoked_at:o.z.string().optional(),used_at:o.z.string().optional(),user_id:o.z.string().describe("The user ID associated with the session"),expires_at:o.z.string().optional(),login_session_id:o.z.string(),idle_expires_at:o.z.string().optional(),device:Gm.describe("Metadata related to the device used in the session"),clients:o.z.array(o.z.string()).describe("List of client details for the session")}),Ec=o.z.object({created_at:o.z.string(),updated_at:o.z.string(),authenticated_at:o.z.string(),last_interaction_at:o.z.string(),...Wm.shape}),bu=o.z.object({kid:o.z.string().openapi({description:"The key id of the signing key"}),cert:o.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:o.z.string().openapi({description:"The cert fingerprint"}),thumbprint:o.z.string().openapi({description:"The cert thumbprint"}),pkcs7:o.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:o.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:o.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:o.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:o.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:o.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:o.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:o.z.string().optional().openapi({description:"The date and time when the key was revoked"}),connection:o.z.string().optional().openapi({description:"The connection identifier associated with the key"}),type:o.z.enum(["jwt_signing","saml_encryption"]).openapi({description:"The type of the signing key"})});var vi=(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))(vi||{});const gp=o.z.object({access_token:o.z.string(),id_token:o.z.string().optional(),scope:o.z.string().optional(),state:o.z.string().optional(),refresh_token:o.z.string().optional(),token_type:o.z.string(),expires_in:o.z.number()});o.z.object({code:o.z.string(),state:o.z.string().optional()});const Xm=o.z.object({button_border_radius:o.z.number(),button_border_weight:o.z.number(),buttons_style:o.z.enum(["pill","rounded","sharp"]),input_border_radius:o.z.number(),input_border_weight:o.z.number(),inputs_style:o.z.enum(["pill","rounded","sharp"]),show_widget_shadow:o.z.boolean(),widget_border_weight:o.z.number(),widget_corner_radius:o.z.number()}),Jm=o.z.object({base_focus_color:o.z.string(),base_hover_color:o.z.string(),body_text:o.z.string(),captcha_widget_theme:o.z.enum(["auto","dark","light"]),error:o.z.string(),header:o.z.string(),icons:o.z.string(),input_background:o.z.string(),input_border:o.z.string(),input_filled_text:o.z.string(),input_labels_placeholders:o.z.string(),links_focused_components:o.z.string(),primary_button:o.z.string(),primary_button_label:o.z.string(),secondary_button_border:o.z.string(),secondary_button_label:o.z.string(),success:o.z.string(),widget_background:o.z.string(),widget_border:o.z.string()}),Tr=o.z.object({bold:o.z.boolean(),size:o.z.number()}),Ym=o.z.object({body_text:Tr,buttons_text:Tr,font_url:o.z.string(),input_labels:Tr,links:Tr,links_style:o.z.enum(["normal","underlined"]),reference_text_size:o.z.number(),subtitle:Tr,title:Tr}),Zm=o.z.object({background_color:o.z.string(),background_image_url:o.z.string(),page_layout:o.z.enum(["center","left","right"])}),Qm=o.z.object({header_text_alignment:o.z.enum(["center","left","right"]),logo_height:o.z.number(),logo_position:o.z.enum(["center","left","none","right"]),logo_url:o.z.string(),social_buttons_layout:o.z.enum(["bottom","top"])}),e_=o.z.object({borders:Xm,colors:Jm,displayName:o.z.string(),fonts:Ym,page_background:Zm,widget:Qm}),Zo=e_.extend({themeId:o.z.string()}),Qo=o.z.object({universal_login_experience:o.z.enum(["new","classic"]).default("new"),identifier_first:o.z.boolean().default(!0),password_first:o.z.boolean().default(!1),webauthn_platform_first_factor:o.z.boolean()}),ea=o.z.object({name:o.z.string(),enabled:o.z.boolean().optional().default(!0),default_from_address:o.z.string().optional(),credentials:o.z.union([o.z.object({accessKeyId:o.z.string(),secretAccessKey:o.z.string(),region:o.z.string()}),o.z.object({smtp_host:o.z.array(o.z.string()),smtp_port:o.z.number(),smtp_user:o.z.string(),smtp_pass:o.z.string()}),o.z.object({api_key:o.z.string(),domain:o.z.string().optional()}),o.z.object({connectionString:o.z.string()}),o.z.object({tenantId:o.z.string(),clientId:o.z.string(),clientSecret:o.z.string()})]),settings:o.z.object({}).optional()}),mp=o.z.object({id:o.z.string(),session_id:o.z.string(),user_id:o.z.string(),client_id:o.z.string(),expires_at:o.z.string().optional(),idle_expires_at:o.z.string().optional(),last_exchanged_at:o.z.string().optional(),device:Gm,resource_servers:o.z.array(o.z.object({audience:o.z.string(),scopes:o.z.string()})),rotating:o.z.boolean()}),ev=o.z.object({created_at:o.z.string(),...mp.shape}),tv=o.z.object({to:o.z.string(),message:o.z.string()}),nv=o.z.object({name:o.z.string(),options:o.z.object({})}),t_=o.z.object({value:o.z.string(),description:o.z.string().optional()}),n_=o.z.object({token_dialect:o.z.enum(["access_token","access_token_authz"]).optional(),enforce_policies:o.z.boolean().optional(),allow_skipping_userinfo:o.z.boolean().optional(),skip_userinfo:o.z.boolean().optional(),persist_client_authorization:o.z.boolean().optional(),enable_introspection_endpoint:o.z.boolean().optional(),mtls:o.z.object({bound_access_tokens:o.z.boolean().optional()}).optional()}),Sa=o.z.object({name:o.z.string(),identifier:o.z.string(),scopes:o.z.array(t_).optional(),signing_alg:o.z.string().optional(),signing_secret:o.z.string().optional(),token_lifetime:o.z.number().optional(),token_lifetime_for_web:o.z.number().optional(),skip_consent_for_verifiable_first_party_clients:o.z.boolean().optional(),allow_offline_access:o.z.boolean().optional(),verificationKey:o.z.string().optional(),options:n_.optional()}),Dr=o.z.object({id:o.z.string().optional(),...Sa.shape,created_at:o.z.string().optional(),updated_at:o.z.string().optional()}),rv=o.z.array(Dr),r_=o.z.object({role_id:o.z.string(),resource_server_identifier:o.z.string(),permission_name:o.z.string()}),i_=o.z.object({...r_.shape,tenant_id:o.z.string(),created_at:o.z.string().optional()}),iv=o.z.array(i_),s_=o.z.object({role_id:o.z.string(),resource_server_identifier:o.z.string(),resource_server_name:o.z.string(),permission_name:o.z.string(),description:o.z.string().nullable().optional(),created_at:o.z.string().optional()}),o_=o.z.array(s_),a_=o.z.object({user_id:o.z.string(),resource_server_identifier:o.z.string(),permission_name:o.z.string()}),c_=o.z.object({...a_.shape,tenant_id:o.z.string(),created_at:o.z.string().optional()}),sv=o.z.array(c_),l_=o.z.object({user_id:o.z.string(),resource_server_identifier:o.z.string(),resource_server_name:o.z.string(),permission_name:o.z.string(),description:o.z.string().nullable().optional(),created_at:o.z.string().optional()}),u_=o.z.array(l_),ka=o.z.object({name:o.z.string().min(1).max(50).openapi({description:"The name of the role. Cannot include '<' or '>'"}),description:o.z.string().max(255).optional().openapi({description:"The description of the role"})}),Rr=o.z.object({id:o.z.string().openapi({description:"The unique identifier of the role"}),...ka.shape,created_at:o.z.string().optional(),updated_at:o.z.string().optional()}),d_=o.z.array(Rr);function ov(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const lh={themeId:"default",borders:{button_border_radius:8,button_border_weight:1,buttons_style:"pill",input_border_radius:8,input_border_weight:1,inputs_style:"pill",show_widget_shadow:!0,widget_border_weight:1,widget_corner_radius:16},colors:{base_focus_color:"#7D68F4",base_hover_color:"#A091F2",body_text:"#000000",captcha_widget_theme:"auto",error:"#FC5A5A",header:"#000000",icons:"#666666",input_background:"#FFFFFF",input_border:"#BFBCD7",input_filled_text:"#000000",input_labels_placeholders:"#88869F",links_focused_components:"#7D68F4",primary_button:"#7D68F4",primary_button_label:"#FFFFFF",secondary_button_border:"#BFBCD7",secondary_button_label:"#000000",success:"#36BF76",widget_background:"#FFFFFF",widget_border:"#BFBCD7"},displayName:"Default Theme",fonts:{body_text:{bold:!1,size:16},buttons_text:{bold:!1,size:16},font_url:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",input_labels:{bold:!1,size:14},links:{bold:!1,size:16},links_style:"normal",reference_text_size:16,subtitle:{bold:!1,size:18},title:{bold:!0,size:24}},page_background:{background_color:"#F8F9FB",background_image_url:"https://assets.sesamy.com/images/login-bg.jpg",page_layout:"center"},widget:{header_text_alignment:"center",logo_height:36,logo_position:"center",logo_url:"https://assets.sesamy.com/static/images/sesamy/logos/sesamy_logo_black.svg",social_buttons_layout:"bottom"}};function uh(t,e){const n=structuredClone(t);function r(i,s){for(const a in s)s[a]!==void 0&&typeof s[a]=="object"&&!Array.isArray(s[a])&&typeof i[a]=="object"&&i[a]!==null?r(i[a],s[a]):i[a]=s[a];return i}return r(n,e)}const av=new o.OpenAPIHono().openapi(o.createRoute({tags:["branding"],method:"get",path:"/default",request:{headers:o.z.object({"tenant-id":o.z.string().optional()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Zo}},description:"Default theme settings"}}}),async t=>{const e=await t.env.data.themes.get(t.var.tenant_id,"default");return e?t.json(e):t.json(lh)}).openapi(o.createRoute({tags:["branding"],method:"patch",path:"/default",request:{body:{content:{"application/json":{schema:Zo.deepPartial()}}},headers:o.z.object({"tenant-id":o.z.string().optional()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Zo}},description:"Updated theme settings"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.themes.get(t.var.tenant_id,"default");if(n){const r=uh(n,e);await t.env.data.themes.update(t.var.tenant_id,"default",r);const i=await t.env.data.themes.get(t.var.tenant_id,"default");return t.json(i)}else{const r=uh(lh,e),i=await t.env.data.themes.create(t.var.tenant_id,r);return t.json(i)}}),cv={colors:{primary:"#7D68F4",page_background:{type:"solid",start:"#F8F9FB",end:"#F8F9FB",angle_deg:0}},logo_url:"https://assets.sesamy.com/static/images/sesamy/logos/sesamy_logo_black.svg",favicon_url:"https://assets.sesamy.com/images/favicon.ico",font:{url:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2"}},lv=new o.OpenAPIHono().openapi(o.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:wu}},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(cv)}).openapi(o.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(wu.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")}).route("/themes",av);var N=class extends Error{constructor(e=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});be(this,"res");be(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})}},Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function p_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function uv(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 dv(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 f_={exports:{}};const pv={},fv=Object.freeze(Object.defineProperty({__proto__:null,default:pv},Symbol.toStringTag,{value:"Module"})),Sc=uv(fv);(function(t){/**
1
+ "use strict";var vw=Object.defineProperty;var bw=(t,e,n)=>e in t?vw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var be=(t,e,n)=>bw(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@hono/zod-openapi"),Ee=t=>typeof t=="string",us=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},Yf=t=>t==null?"":""+t,xw=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},$w=/###/g,Zf=t=>t&&t.indexOf("###")>-1?t.replace($w,"."):t,Qf=t=>!t||Ee(t),vs=(t,e,n)=>{const r=Ee(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(Qf(t))return{};const s=Zf(r[i]);!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++i}return Qf(t)?{}:{obj:t,k:Zf(r[i])}},eh=(t,e,n)=>{const{obj:r,k:i}=vs(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let s=e[e.length-1],a=e.slice(0,e.length-1),l=vs(t,a,Object);for(;l.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),l=vs(t,a,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${s}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${s}`]=n},Aw=(t,e,n,r)=>{const{obj:i,k:s}=vs(t,e,Object);i[s]=i[s]||[],i[s].push(n)},ma=(t,e)=>{const{obj:n,k:r}=vs(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Ew=(t,e,n)=>{const r=ma(t,n);return r!==void 0?r:ma(e,n)},_m=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?Ee(t[r])||t[r]instanceof String||Ee(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):_m(t[r],e[r],n):t[r]=e[r]);return t},ai=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Sw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const kw=t=>Ee(t)?t.replace(/[&<>"'\/]/g,e=>Sw[e]):t;class Nw{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 Cw=[" ",",","?","!",";"],Tw=new Nw(20),Iw=(t,e,n)=>{e=e||"",n=n||"";const r=Cw.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=Tw.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!i.test(t);if(!s){const a=t.indexOf(n);a>0&&!i.test(t.substring(0,a))&&(s=!0)}return s},yu=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 s=0;s<r.length;){if(!i||typeof i!="object")return;let a,l="";for(let u=s;u<r.length;++u)if(u!==s&&(l+=n),l+=r[u],a=i[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&u<r.length-1)continue;s+=u-s+1;break}i=a}return i},_a=t=>t==null?void 0:t.replace("_","-"),Ow={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 ya{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||Ow,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:(Ee(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new ya(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new ya(this.logger,e)}}var $n=new ya;class wc{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[l,u]=a;for(let d=0;d<u;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,u]=a;for(let d=0;d<u;d++)l.apply(l,[e,...r])})}}class th extends wc{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 d,p;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],r&&(Array.isArray(r)?l.push(...r):Ee(r)&&s?l.push(...r.split(s)):l.push(r)));const u=ma(this.data,l);return!u&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),u||!a||!Ee(r)?u:yu((p=(d=this.data)==null?void 0:d[e])==null?void 0:p[n],r,s)}addResource(e,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[e,n];r&&(l=l.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(l=e.split("."),i=n,n=l[1]),this.addNamespaces(n),eh(this.data,l,i),s.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 s in r)(Ee(r[s])||Array.isArray(r[s]))&&this.addResource(e,n,s,r[s],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),i=r,r=n,n=l[1]),this.addNamespaces(n);let u=ma(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?_m(u,r,s):u={...u,...r},eh(this.data,l,u),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 ym={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{var a;e=((a=this.processors[s])==null?void 0:a.process(e,n,r,i))??e}),e}};const nh={};class wa extends wc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xw(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=$n.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 s=n.ns||this.options.defaultNS||[];const a=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Iw(e,r,i);if(a&&!l){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:Ee(s)?[s]:s};const d=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),e=d.join(i)}return{key:e,namespaces:Ee(s)?[s]:s}}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,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],n),u=l[l.length-1],d=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(p){const G=n.nsSeparator||this.options.nsSeparator;return i?{res:`${u}${G}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${G}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:a}const h=this.resolve(e,n);let g=h==null?void 0:h.res;const A=(h==null?void 0:h.usedKey)||a,$=(h==null?void 0:h.exactUsedKey)||a,I=Object.prototype.toString.apply(g),R=["[object Number]","[object Function]","[object RegExp]"],D=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,M=!Ee(g)&&typeof g!="boolean"&&typeof g!="number";if(x&&g&&M&&R.indexOf(I)<0&&!(Ee(D)&&Array.isArray(g))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(A,g,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(h.res=G,h.usedParams=this.getUsedParamsDetails(n),h):G}if(s){const G=Array.isArray(g),F=G?[]:{},H=G?$:A;for(const W in g)if(Object.prototype.hasOwnProperty.call(g,W)){const Y=`${H}${s}${W}`;F[W]=this.translate(Y,{...n,joinArrays:!1,ns:l}),F[W]===Y&&(F[W]=g[W])}g=F}}else if(x&&Ee(D)&&Array.isArray(g))g=g.join(D),g&&(g=this.extendTranslation(g,e,n,r));else{let G=!1,F=!1;const H=n.count!==void 0&&!Ee(n.count),W=wa.hasDefaultValue(n),Y=H?this.pluralResolver.getSuffix(d,n.count,n):"",ue=n.ordinal&&H?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",Ce=H&&!n.ordinal&&n.count===0,P=Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${Y}`]||n[`defaultValue${ue}`]||n.defaultValue;!this.isValidLookup(g)&&W&&(G=!0,g=P),this.isValidLookup(g)||(F=!0,g=a);const z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&F?void 0:g,k=W&&P!==g&&this.options.updateMissing;if(F||G||k){if(this.logger.log(k?"updateKey":"missingKey",d,u,a,k?P:g),s){const de=this.resolve(a,{...n,keySeparator:!1});de&&de.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 S=[];const B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&B&&B[0])for(let de=0;de<B.length;de++)S.push(B[de]);else this.options.saveMissingTo==="all"?S=this.languageUtils.toResolveHierarchy(n.lng||this.language):S.push(n.lng||this.language);const V=(de,re,ve)=>{var Z;const Se=W&&ve!==g?ve:z;this.options.missingKeyHandler?this.options.missingKeyHandler(de,u,re,Se,k,n):(Z=this.backendConnector)!=null&&Z.saveMissing&&this.backendConnector.saveMissing(de,u,re,Se,k,n),this.emit("missingKey",de,u,re,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&H?S.forEach(de=>{const re=this.pluralResolver.getSuffixes(de,n);Ce&&n[`defaultValue${this.options.pluralSeparator}zero`]&&re.indexOf(`${this.options.pluralSeparator}zero`)<0&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(ve=>{V([de],a+ve,n[`defaultValue${ve}`]||P)})}):V(S,a,P))}g=this.extendTranslation(g,e,n,h,r),F&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${u}:${a}`),(F||G)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${a}`:a,G?g:void 0))}return i?(h.res=g,h.usedParams=this.getUsedParamsDetails(n),h):g}extendTranslation(e,n,r,i,s){var d,p;var a=this;if((d=this.i18nFormat)!=null&&d.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 h=Ee(e)&&(((p=r==null?void 0:r.interpolation)==null?void 0:p.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let g;if(h){const $=e.match(this.interpolator.nestingRegexp);g=$&&$.length}let A=r.replace&&!Ee(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(A={...this.options.interpolation.defaultVariables,...A}),e=this.interpolator.interpolate(e,A,r.lng||this.language||i.usedLng,r),h){const $=e.match(this.interpolator.nestingRegexp),I=$&&$.length;g<I&&(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 $=arguments.length,I=new Array($),R=0;R<$;R++)I[R]=arguments[R];return(s==null?void 0:s[0])===I[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${I[0]} in key: ${n[0]}`),null):a.translate(...I,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=Ee(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=ym.handle(u,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,s,a,l;return Ee(e)&&(e=[e]),e.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),p=d.key;i=p;let h=d.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const g=n.count!==void 0&&!Ee(n.count),A=g&&!n.ordinal&&n.count===0,$=n.context!==void 0&&(Ee(n.context)||typeof n.context=="number")&&n.context!=="",I=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(R=>{var D,x;this.isValidLookup(r)||(l=R,!nh[`${I[0]}-${R}`]&&((D=this.utils)!=null&&D.hasLoadedNamespace)&&!((x=this.utils)!=null&&x.hasLoadedNamespace(l))&&(nh[`${I[0]}-${R}`]=!0,this.logger.warn(`key "${i}" for languages "${I.join(", ")}" won't get resolved as namespace "${l}" 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!!!")),I.forEach(M=>{var H;if(this.isValidLookup(r))return;a=M;const G=[p];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(G,p,M,R,n);else{let W;g&&(W=this.pluralResolver.getSuffix(M,n.count,n));const Y=`${this.options.pluralSeparator}zero`,ue=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(G.push(p+W),n.ordinal&&W.indexOf(ue)===0&&G.push(p+W.replace(ue,this.options.pluralSeparator)),A&&G.push(p+Y)),$){const Ce=`${p}${this.options.contextSeparator}${n.context}`;G.push(Ce),g&&(G.push(Ce+W),n.ordinal&&W.indexOf(ue)===0&&G.push(Ce+W.replace(ue,this.options.pluralSeparator)),A&&G.push(Ce+Y))}}let F;for(;F=G.pop();)this.isValidLookup(r)||(s=F,r=this.getResource(M,R,F,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:a,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(s=this.i18nFormat)!=null&&s.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&&!Ee(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 s of n)delete i[s]}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 rh{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$n.create("languageUtils")}getScriptPartFromCode(e){if(e=_a(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=_a(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ee(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(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&(s.indexOf("-")>0&&i.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===i||s.indexOf(i)===0&&i.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Ee(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=[],s=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return Ee(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):Ee(e)&&s(this.formatLanguageCode(e)),r.forEach(a=>{i.indexOf(a)<0&&s(this.formatLanguageCode(a))}),i}}const ih={zero:0,one:1,two:2,few:3,many:4,other:5},sh={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class zw{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=$n.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=_a(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];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!"),sh;if(!e.match(/-|_/))return sh;const u=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(u,n)}return this.pluralRulesCache[s]=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,s)=>ih[i]-ih[s]).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 oh=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,s=Ew(t,e,n);return!s&&i&&Ee(n)&&(s=yu(t,n,r),s===void 0&&(s=yu(e,n,r))),s},Ll=t=>t.replace(/\$/g,"$$$$");class Dw{constructor(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$n.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:s,prefixEscaped:a,suffix:l,suffixEscaped:u,formatSeparator:d,unescapeSuffix:p,unescapePrefix:h,nestingPrefix:g,nestingPrefixEscaped:A,nestingSuffix:$,nestingSuffixEscaped:I,nestingOptionsSeparator:R,maxReplaces:D,alwaysFormat:x}=e.interpolation;this.escape=n!==void 0?n:kw,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?ai(s):a||"{{",this.suffix=l?ai(l):u||"}}",this.formatSeparator=d||",",this.unescapePrefix=p?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=g?ai(g):A||ai("$t("),this.nestingSuffix=$?ai($):I||ai(")"),this.nestingOptionsSeparator=R||",",this.maxReplaces=D||1e3,this.alwaysFormat=x!==void 0?x:!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 A;let s,a,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=$=>{if($.indexOf(this.formatSeparator)<0){const x=oh(n,u,$,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(x,void 0,r,{...i,...n,interpolationkey:$}):x}const I=$.split(this.formatSeparator),R=I.shift().trim(),D=I.join(this.formatSeparator).trim();return this.format(oh(n,u,R,this.options.keySeparator,this.options.ignoreJSONStructure),D,r,{...i,...n,interpolationkey:R})};this.resetRegExp();const p=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((A=i==null?void 0:i.interpolation)==null?void 0:A.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:$=>Ll($)},{regex:this.regexp,safeValue:$=>this.escapeValue?Ll(this.escape($)):Ll($)}].forEach($=>{for(l=0;s=$.regex.exec(e);){const I=s[1].trim();if(a=d(I),a===void 0)if(typeof p=="function"){const D=p(e,s,i);a=Ee(D)?D:""}else if(i&&Object.prototype.hasOwnProperty.call(i,I))a="";else if(h){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${I} for interpolating ${e}`),a="";else!Ee(a)&&!this.useRawValueToEscape&&(a=Yf(a));const R=$.safeValue(a);if(e=e.replace(s[0],R),h?($.regex.lastIndex+=a.length,$.regex.lastIndex-=s[0].length):$.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,a;const l=(u,d)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const h=u.split(new RegExp(`${p}[ ]*{`));let g=`{${h[1]}`;u=h[0],g=this.interpolate(g,a);const A=g.match(/'/g),$=g.match(/"/g);(((A==null?void 0:A.length)??0)%2===0&&!$||$.length%2!==0)&&(g=g.replace(/'/g,'"'));try{a=JSON.parse(g),d&&(a={...d,...a})}catch(I){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,I),`${u}${p}${g}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,u};for(;i=this.nestingRegexp.exec(e);){let u=[];a={...r},a=a.replace&&!Ee(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const p=i[1].split(this.formatSeparator).map(h=>h.trim());i[1]=p.shift(),u=p,d=!0}if(s=n(l.call(this,i[1].trim(),a),a),s&&i[0]===e&&!Ee(s))return s;Ee(s)||(s=Yf(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),d&&(s=u.reduce((p,h)=>this.format(p,h,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}const Rw=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[l,...u]=a.split(":"),d=u.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},ci=t=>{const e={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const a=r+JSON.stringify(s);let l=e[a];return l||(l=t(_a(r),i),e[a]=l),l(n)}};class Pw{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$n.create("formatter"),this.options=e,this.formats={number:ci((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:ci((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:ci((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:ci((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:ci((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},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()]=ci(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(l=>l.indexOf(")")>-1)){const l=s.findIndex(u=>u.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,l)].join(this.formatSeparator)}return s.reduce((l,u)=>{var h;const{formatName:d,formatOptions:p}=Rw(u);if(this.formats[d]){let g=l;try{const A=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},$=A.locale||A.lng||i.locale||i.lng||r;g=this.formats[d](l,$,{...p,...i,...A})}catch(A){this.logger.warn(A)}return g}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Bw=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class jw extends wc{constructor(e,n,r){var s,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=$n.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=(s=this.backend)==null?void 0:s.init)==null||a.call(s,r,i.backend,i)}queueLoad(e,n,r,i){const s={},a={},l={},u={};return e.forEach(d=>{let p=!0;n.forEach(h=>{const g=`${d}|${h}`;!r.reload&&this.store.hasResourceBundle(d,h)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?a[g]===void 0&&(a[g]=!0):(this.state[g]=1,p=!1,a[g]===void 0&&(a[g]=!0),s[g]===void 0&&(s[g]=!0),u[h]===void 0&&(u[h]=!0)))}),p||(l[d]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(u)}}loaded(e,n,r){const i=e.split("|"),s=i[0],a=i[1];n&&this.emit("failedLoading",s,a,n),!n&&r&&this.store.addResourceBundle(s,a,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const l={};this.queue.forEach(u=>{Aw(u.loaded,[s],a),Bw(u,e),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const p=u.loaded[d];p.length&&p.forEach(h=>{l[d][h]===void 0&&(l[d][h]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(u=>!u.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=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:s,callback:a});return}this.readingCalls++;const l=(d,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(d&&p&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,s*2,a)},s);return}a(d,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(e,n);d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}return}return u(e,n,l)}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();Ee(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ee(n)&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.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],s=r[1];this.read(i,s,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,l),this.loaded(e,a,l)})}saveMissing(e,n,r,i,s){var u,d,p,h,g;let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((d=(u=this.services)==null?void 0:u.utils)!=null&&d.hasLoadedNamespace&&!((h=(p=this.services)==null?void 0:p.utils)!=null&&h.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((g=this.backend)!=null&&g.create){const A={...a,isUpdate:s},$=this.backend.create.bind(this.backend);if($.length<6)try{let I;$.length===5?I=$(e,n,r,i,A):I=$(e,n,r,i),I&&typeof I.then=="function"?I.then(R=>l(null,R)).catch(l):l(null,I)}catch(I){l(I)}else $(e,n,r,i,l,A)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const ah=()=>({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]),Ee(t[1])&&(e.defaultValue=t[1]),Ee(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}}),ch=t=>{var e,n;return Ee(t.ns)&&(t.ns=[t.ns]),Ee(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ee(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},jo=()=>{},Lw=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Cs extends wc{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=ch(e),this.services={},this.logger=$n,this.modules={external:[]},Lw(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&&(Ee(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=ah();this.options={...i,...this.options,...ch(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 s=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?$n.init(s(this.modules.logger),this.options):$n.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Pw;const h=new rh(this.options);this.store=new th(this.options.resources,this.options);const g=this.services;g.logger=$n,g.resourceStore=this.store,g.languageUtils=h,g.pluralResolver=new zw(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(g.formatter=s(p),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new Dw(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new jw(s(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(A){for(var $=arguments.length,I=new Array($>1?$-1:0),R=1;R<$;R++)I[R-1]=arguments[R];e.emit(A,...I)}),this.modules.languageDetector&&(g.languageDetector=s(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=s(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new wa(this.services,this.options),this.translator.on("*",function(A){for(var $=arguments.length,I=new Array($>1?$-1:0),R=1;R<$;R++)I[R-1]=arguments[R];e.emit(A,...I)}),this.modules.external.forEach(A=>{A.init&&A.init(this)})}if(this.format=this.options.interpolation.format,r||(r=jo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const u=us(),d=()=>{const p=(h,g)=>{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),u.resolve(g),r(h,g)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e){var s,a;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jo;const i=Ee(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 l=[],u=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(h=>{h!=="cimode"&&l.indexOf(h)<0&&l.push(h)})};i?u(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>u(p)),(a=(s=this.options.preload)==null?void 0:s.forEach)==null||a.call(s,d=>u(d)),this.services.backendConnector.load(l,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(e,n,r){const i=us();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=jo),this.services.backendConnector.reload(e,n,s=>{i.resolve(),r(s)}),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"&&ym.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=us();this.emit("languageChanging",e);const s=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},a=(u,d)=>{d?(s(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(u,function(){return r.t(...arguments)})},l=u=>{var p,h;!e&&!u&&this.services.languageDetector&&(u=[]);const d=Ee(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||s(d),this.translator.language||this.translator.changeLanguage(d),(h=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||h.call(p,d)),this.loadResources(d,g=>{a(g,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),i}getFixedT(e,n,r){var i=this;const s=function(a,l){let u;if(typeof l!="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),h=2;h<d;h++)p[h-2]=arguments[h];u=i.options.overloadTranslationOptionHandler([a,l].concat(p))}else u={...l};u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs,u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||s.keyPrefix);const g=i.options.keySeparator||".";let A;return u.keyPrefix&&Array.isArray(a)?A=a.map($=>`${u.keyPrefix}${g}${$}`):A=u.keyPrefix?`${u.keyPrefix}${g}${a}`:a,i.t(A,u)};return Ee(e)?s.lng=e:s.lngs=e,s.ns=n,s.keyPrefix=r,s}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,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,u)=>{const d=this.services.backendConnector.state[`${l}|${u}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,e)&&(!i||a(s,e)))}loadNamespaces(e,n){const r=us();return this.options.ns?(Ee(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=us();Ee(e)&&(e=[e]);const i=this.options.preload||[],s=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=i.concat(s),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(e){var i,s;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=((s=this.services)==null?void 0:s.languageUtils)||new rh(ah());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 Cs(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jo;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new Cs(i);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const l=Object.keys(this.store.data).reduce((u,d)=>(u[d]={...this.store.data[d]},Object.keys(u[d]).reduce((p,h)=>(p[h]={...u[d][h]},p),{})),{});s.store=new th(l,i),s.services.resourceStore=s.store}return s.translator=new wa(s.services,i),s.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p<u;p++)d[p-1]=arguments[p];s.emit(l,...d)}),s.init(i,n),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const L=Cs.createInstance();L.createInstance=Cs.createInstance;L.createInstance;L.dir;L.init;L.loadResources;L.reloadResources;L.use;L.changeLanguage;L.getFixedT;const $e=L.t;L.exists;L.setDefaultNamespace;L.hasLoadedNamespace;L.loadNamespaces;L.loadLanguages;var wm=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(s=>typeof s=="string"?s==="*"?()=>s:a=>s===a?a:null:typeof s=="function"?s:a=>s.includes(a)?a:null)(n.origin),i=(s=>typeof s=="function"?s:Array.isArray(s)?()=>s:()=>[])(n.allowMethods);return async function(a,l){var p;function u(h,g){a.res.headers.set(h,g)}const d=r(a.req.header("origin")||"",a);if(d&&u("Access-Control-Allow-Origin",d),n.origin!=="*"){const h=a.req.header("Vary");h?u("Vary",h):u("Vary","Origin")}if(n.credentials&&u("Access-Control-Allow-Credentials","true"),(p=n.exposeHeaders)!=null&&p.length&&u("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),a.req.method==="OPTIONS"){n.maxAge!=null&&u("Access-Control-Max-Age",n.maxAge.toString());const h=i(a.req.header("origin")||"",a);h.length&&u("Access-Control-Allow-Methods",h.join(","));let g=n.allowHeaders;if(!(g!=null&&g.length)){const A=a.req.header("Access-Control-Request-Headers");A&&(g=A.split(/\s*,\s*/))}return g!=null&&g.length&&(u("Access-Control-Allow-Headers",g.join(",")),a.res.headers.append("Vary","Access-Control-Request-Headers")),a.res.headers.delete("Content-Length"),a.res.headers.delete("Content-Type"),new Response(null,{headers:a.res.headers,status:204,statusText:"No Content"})}await l()}};const gn=o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()}),vc=o.z.object({created_at:o.z.string(),updated_at:o.z.string()}),vm=o.z.object({email:o.z.string().optional(),email_verified:o.z.boolean().optional(),name:o.z.string().optional(),username:o.z.string().optional(),given_name:o.z.string().optional(),phone_number:o.z.string().optional(),phone_verified:o.z.boolean().optional(),family_name:o.z.string().optional()}).catchall(o.z.any()),bm=o.z.object({connection:o.z.string(),user_id:o.z.string(),provider:o.z.string(),isSocial:o.z.boolean(),access_token:o.z.string().optional(),access_token_secret:o.z.string().optional(),refresh_token:o.z.string().optional(),profileData:vm.optional()}),bc=o.z.object({email:o.z.string().optional().transform(t=>t&&t.toLowerCase()),username:o.z.string().optional(),phone_number:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),nickname:o.z.string().optional(),name:o.z.string().optional(),picture:o.z.string().optional(),locale:o.z.string().optional(),linked_to:o.z.string().optional(),profileData:o.z.string().optional(),user_id:o.z.string().optional(),app_metadata:o.z.any().default({}).optional(),user_metadata:o.z.any().default({}).optional()}),va=bc.extend({email_verified:o.z.boolean().default(!1),verify_email:o.z.boolean().optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string().optional(),provider:o.z.string().default("email"),connection:o.z.string().default("email"),is_social:o.z.boolean().optional()}),up=o.z.object({...va.shape,...vc.shape,user_id:o.z.string(),is_social:o.z.boolean(),email:o.z.string().optional(),login_count:o.z.number().default(0),identities:o.z.array(bm).optional()}),xn=up,Fw=bc.extend({login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any()),Uw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Mw=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Uw[n[t]&63];return e};const xm=o.z.object({audience:o.z.string().optional(),recipient:o.z.string().optional(),createUpnClaim:o.z.boolean().optional(),mapUnknownClaimsAsIs:o.z.boolean().optional(),passthroughClaimsWithNoMapping:o.z.boolean().optional(),mapIdentities:o.z.boolean().optional(),signatureAlgorithm:o.z.string().optional(),digestAlgorithm:o.z.string().optional(),issuer:o.z.string().optional(),destination:o.z.string().optional(),lifetimeInSeconds:o.z.number().optional(),signResponse:o.z.boolean().optional(),nameIdentifierFormat:o.z.string().optional(),nameIdentifierProbes:o.z.array(o.z.string()).optional(),authnContextClassRef:o.z.string().optional(),mappings:o.z.record(o.z.string()).optional()}),ba=o.z.object({id:o.z.string(),name:o.z.string(),callbacks:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:o.z.array(o.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:o.z.array(o.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:o.z.array(o.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:o.z.array(o.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:o.z.object({samlp:xm.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:o.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:o.z.string().default(()=>Mw()).optional(),disable_sign_ups:o.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"}),client_metadata:o.z.record(o.z.string().length(255)).optional()}),zr=o.z.object({created_at:o.z.string().transform(t=>t===null?"":t),updated_at:o.z.string().transform(t=>t===null?"":t),...ba.shape}),Gi=o.z.object({x:o.z.number(),y:o.z.number()});var dp=(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))(dp||{}),pp=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(pp||{});const xc=o.z.object({id:o.z.string(),category:o.z.nativeEnum(pp),type:o.z.nativeEnum(dp)}),$m=xc.extend({category:o.z.literal("BLOCK"),type:o.z.literal("RICH_TEXT"),config:o.z.object({content:o.z.string()}).passthrough()}),Am=xc.extend({category:o.z.literal("BLOCK"),type:o.z.union([o.z.literal("NEXT_BUTTON"),o.z.literal("BACK_BUTTON"),o.z.literal("SUBMIT_BUTTON")]),config:o.z.object({text:o.z.string()}).passthrough()}),Em=xc.extend({category:o.z.literal("FIELD"),type:o.z.literal("LEGAL"),required:o.z.boolean().optional(),sensitive:o.z.boolean().optional(),config:o.z.object({text:o.z.string()}).passthrough()}),Sm=xc.extend({category:o.z.literal("FIELD"),type:o.z.union([o.z.literal("TEXT"),o.z.literal("EMAIL"),o.z.literal("PASSWORD"),o.z.literal("NUMBER"),o.z.literal("PHONE"),o.z.literal("DATE"),o.z.literal("CHECKBOX"),o.z.literal("RADIO"),o.z.literal("SELECT"),o.z.literal("HIDDEN")]),required:o.z.boolean().optional(),sensitive:o.z.boolean().optional(),config:o.z.object({label:o.z.string().optional(),placeholder:o.z.string().optional()}).passthrough()}),km=o.z.object({id:o.z.string(),category:o.z.string(),type:o.z.string()}).passthrough(),Nm=o.z.union([$m,Am,Em,Sm,km]);var Cm=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(Cm||{});const Tm=o.z.object({id:o.z.string(),type:o.z.literal("STEP"),coordinates:Gi,alias:o.z.string().optional(),config:o.z.object({components:o.z.array(Nm),next_node:o.z.string()}).passthrough()}),Im=o.z.object({id:o.z.string(),type:o.z.literal("FLOW"),coordinates:Gi,alias:o.z.string().optional(),config:o.z.object({flow_id:o.z.string(),next_node:o.z.string()})}),Om=o.z.object({id:o.z.string(),type:o.z.string(),coordinates:Gi}).passthrough(),zm=o.z.union([Tm,Im,Om]),Dm=o.z.object({next_node:o.z.string(),coordinates:Gi}).passthrough(),Rm=o.z.object({resume_flow:o.z.boolean().optional(),coordinates:Gi}).passthrough(),Pm=o.z.object({id:o.z.string(),name:o.z.string(),languages:o.z.object({primary:o.z.string()}).passthrough(),nodes:o.z.array(zm),start:Dm,ending:Rm,created_at:o.z.string(),updated_at:o.z.string(),links:o.z.object({sdkSrc:o.z.string().optional(),sdk_src:o.z.string().optional()}).passthrough()}).passthrough(),qw=Pm.omit({id:!0,created_at:!0,updated_at:!0});var nn=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(nn||{}),En=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(En||{}),$c=(t=>(t.S256="S256",t.Plain="plain",t))($c||{});const Ts=o.z.object({client_id:o.z.string(),act_as:o.z.string().optional(),response_type:o.z.nativeEnum(nn).optional(),response_mode:o.z.nativeEnum(En).optional(),redirect_uri:o.z.string().optional(),audience:o.z.string().optional(),organization:o.z.string().optional(),state:o.z.string().optional(),nonce:o.z.string().optional(),scope:o.z.string().optional(),prompt:o.z.string().optional(),code_challenge_method:o.z.nativeEnum($c).optional(),code_challenge:o.z.string().optional(),username:o.z.string().optional(),ui_locales:o.z.string().optional(),vendor_id:o.z.string().optional()}),wu=o.z.object({colors:o.z.object({primary:o.z.string(),page_background:o.z.object({type:o.z.string().optional(),start:o.z.string().optional(),end:o.z.string().optional(),angle_deg:o.z.number().optional()}).optional()}).optional(),logo_url:o.z.string().optional(),favicon_url:o.z.string().optional(),font:o.z.object({url:o.z.string()}).optional()}),$i=o.z.object({kid:o.z.string().optional(),team_id:o.z.string().optional(),realms:o.z.string().optional(),authentication_method:o.z.string().optional(),client_id:o.z.string().optional(),client_secret:o.z.string().optional(),app_secret:o.z.string().optional(),scope:o.z.string().optional(),authorization_endpoint:o.z.string().optional(),token_endpoint:o.z.string().optional(),userinfo_endpoint:o.z.string().optional(),jwks_uri:o.z.string().optional(),discovery_url:o.z.string().optional(),issuer:o.z.string().optional(),provider:o.z.string().optional(),from:o.z.string().optional(),twilio_sid:o.z.string().optional(),twilio_token:o.z.string().optional()}),xa=o.z.object({id:o.z.string().optional(),name:o.z.string(),strategy:o.z.string(),options:$i.default({}),enabled_clients:o.z.array(o.z.string()).default([]).optional(),response_type:o.z.custom().optional(),response_mode:o.z.custom().optional()}),rn=o.z.object({id:o.z.string(),created_at:o.z.string().transform(t=>t===null?"":t),updated_at:o.z.string().transform(t=>t===null?"":t)}).extend(xa.shape),$a=o.z.object({name:o.z.string(),audience:o.z.string(),sender_email:o.z.string().email(),sender_name:o.z.string(),support_url:o.z.string().url().optional(),logo:o.z.string().url().optional(),primary_color:o.z.string().optional(),secondary_color:o.z.string().optional(),language:o.z.string().optional(),id:o.z.string().optional()}),Ai=o.z.object({created_at:o.z.string().transform(t=>t===null?"":t),updated_at:o.z.string().transform(t=>t===null?"":t),...$a.shape,id:o.z.string()});o.z.object({...zr.shape,tenant:Ai,connections:o.z.array(rn)});const Bm=o.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),jm=o.z.object({code_id:o.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:o.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:o.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Bm,code_verifier:o.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:o.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:o.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:o.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:o.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:o.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:o.z.string(),used_at:o.z.string().optional(),user_id:o.z.string().optional()}),Vw=o.z.object({...jm.shape,created_at:o.z.string()}),fp=o.z.object({domain:o.z.string(),custom_domain_id:o.z.string().optional(),type:o.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:o.z.enum(["txt"]).optional(),tls_policy:o.z.enum(["recommended"]).optional(),custom_client_ip_header:o.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:o.z.record(o.z.string().max(255)).optional()}),Lm=o.z.object({name:o.z.literal("txt"),record:o.z.string(),domain:o.z.string()}),cr=o.z.object({...fp.shape,custom_domain_id:o.z.string(),primary:o.z.boolean(),status:o.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:o.z.string().optional(),verification:o.z.object({methods:o.z.array(Lm)}).optional(),tls_policy:o.z.string().optional()}),Hw=cr.extend({tenant_id:o.z.string()}),Kw=o.z.object({id:o.z.string(),type:o.z.literal("submit"),label:o.z.string(),className:o.z.string().optional(),disabled:o.z.boolean().optional().default(!1),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0),customizations:o.z.record(o.z.string(),o.z.any()).optional()}),Fm=o.z.discriminatedUnion("type",[o.z.object({id:o.z.string(),type:o.z.literal("RICH_TEXT"),config:o.z.object({content:o.z.string()}),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)}),o.z.object({id:o.z.string(),type:o.z.literal("LEGAL"),config:o.z.object({text:o.z.string(),html:o.z.boolean().optional()}),required:o.z.boolean().optional(),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)}),o.z.object({id:o.z.string(),type:o.z.literal("TEXT"),config:o.z.object({placeholder:o.z.string().optional(),multiline:o.z.boolean().optional()}),required:o.z.boolean().optional(),sensitive:o.z.boolean().optional(),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)}),o.z.object({id:o.z.string(),type:o.z.literal("NEXT_BUTTON"),config:o.z.object({text:o.z.string().optional()}),order:o.z.number().optional(),visible:o.z.boolean().optional().default(!0)})]),Aa=o.z.object({name:o.z.string().openapi({description:"The name of the form"}),messages:o.z.object({errors:o.z.record(o.z.string(),o.z.any()).optional(),custom:o.z.record(o.z.string(),o.z.any()).optional()}).optional(),languages:o.z.object({primary:o.z.string().optional(),default:o.z.string().optional()}).optional(),translations:o.z.record(o.z.string(),o.z.any()).optional(),nodes:o.z.array(o.z.discriminatedUnion("type",[o.z.object({id:o.z.string(),type:o.z.literal("FLOW"),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}),alias:o.z.string().min(1).max(150).optional(),config:o.z.object({flow_id:o.z.string().max(30),next_node:o.z.string()})}),o.z.object({id:o.z.string(),type:o.z.literal("ROUTER"),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}),alias:o.z.string().min(1).max(150),config:o.z.object({rules:o.z.array(o.z.object({id:o.z.string(),alias:o.z.string().min(1).max(150).optional(),condition:o.z.any(),next_node:o.z.string()})),fallback:o.z.array(o.z.string())})}),o.z.object({id:o.z.string(),type:o.z.literal("STEP"),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}),alias:o.z.string().min(1).max(150).optional(),config:o.z.object({components:o.z.array(Fm),next_node:o.z.string()})})])).optional(),start:o.z.object({hidden_fields:o.z.array(o.z.object({key:o.z.string(),value:o.z.string()})).optional(),next_node:o.z.string().optional(),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}).optional()}).optional(),ending:o.z.object({redirection:o.z.object({delay:o.z.number().optional(),target:o.z.string().optional()}).optional(),after_submit:o.z.object({flow_id:o.z.string().optional()}).optional(),coordinates:o.z.object({x:o.z.number(),y:o.z.number()}).optional(),resume_flow:o.z.boolean().optional()}).optional(),style:o.z.object({css:o.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches new JSON structure)"}),yi=o.z.object({...vc.shape,...Aa.shape,id:o.z.string()}),Um=o.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Mm=o.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Ac={enabled:o.z.boolean().default(!1),synchronous:o.z.boolean().default(!1),priority:o.z.number().optional(),hook_id:o.z.string().optional()},Gw=o.z.object({...Ac,trigger_id:Um,url:o.z.string()}),Ww=o.z.object({...Ac,trigger_id:Mm,form_id:o.z.string()}),Yo=o.z.union([Gw,Ww]),Xw=o.z.object({...Ac,trigger_id:Um,...vc.shape,hook_id:o.z.string(),url:o.z.string()}),Jw=o.z.object({...Ac,trigger_id:Mm,...vc.shape,hook_id:o.z.string(),form_id:o.z.string()}),wi=o.z.union([Xw,Jw]),hp=o.z.object({alg:o.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:o.z.string(),kid:o.z.string(),kty:o.z.enum(["RSA","EC","oct"]),n:o.z.string(),x5t:o.z.string().optional(),x5c:o.z.array(o.z.string()).optional(),use:o.z.enum(["sig","enc"]).optional()}),qm=o.z.object({keys:o.z.array(hp)}),vu=o.z.object({issuer:o.z.string(),authorization_endpoint:o.z.string(),token_endpoint:o.z.string(),device_authorization_endpoint:o.z.string(),userinfo_endpoint:o.z.string(),mfa_challenge_endpoint:o.z.string(),jwks_uri:o.z.string(),registration_endpoint:o.z.string(),revocation_endpoint:o.z.string(),scopes_supported:o.z.array(o.z.string()),response_types_supported:o.z.array(o.z.string()),code_challenge_methods_supported:o.z.array(o.z.string()),response_modes_supported:o.z.array(o.z.string()),subject_types_supported:o.z.array(o.z.string()),id_token_signing_alg_values_supported:o.z.array(o.z.string()),token_endpoint_auth_methods_supported:o.z.array(o.z.string()),claims_supported:o.z.array(o.z.string()),request_uri_parameter_supported:o.z.boolean(),request_parameter_supported:o.z.boolean(),token_endpoint_auth_signing_alg_values_supported:o.z.array(o.z.string())}),Vm=o.z.object({csrf_token:o.z.string(),auth0Client:o.z.string().optional(),authParams:Ts,expires_at:o.z.string(),deleted_at:o.z.string().optional(),ip:o.z.string().optional(),useragent:o.z.string().optional(),session_id:o.z.string().optional(),authorization_url:o.z.string().optional(),login_completed:o.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),Yw=o.z.object({...Vm.shape,id:o.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:o.z.string(),updated_at:o.z.string()}),Le={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},Zw=o.z.string().refine(t=>Object.values(Le).includes(t),{message:"Invalid log type"}),Hm=o.z.object({name:o.z.string(),version:o.z.string(),env:o.z.object({node:o.z.string().optional()}).optional()}),Ea=o.z.object({type:Zw,date:o.z.string(),description:o.z.string().optional(),log_id:o.z.string().optional(),_id:o.z.string().optional(),ip:o.z.string(),user_agent:o.z.string(),details:o.z.any().optional(),isMobile:o.z.boolean(),user_id:o.z.string().optional(),user_name:o.z.string().optional(),connection:o.z.string().optional(),connection_id:o.z.string().optional(),client_id:o.z.string().optional(),client_name:o.z.string().optional(),audience:o.z.string().optional(),scope:o.z.array(o.z.string()).optional(),strategy:o.z.string().optional(),strategy_type:o.z.string().optional(),hostname:o.z.string().optional(),auth0_client:Hm.optional()}),Km=o.z.object({user_id:o.z.string(),password:o.z.string(),algorithm:o.z.enum(["bcrypt","argon2id"]).default("argon2id")}),Qw=o.z.object({...Km.shape,created_at:o.z.string(),updated_at:o.z.string()}),Gm=o.z.object({initial_user_agent:o.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:o.z.string().describe("First IP address associated with this session"),initial_asn:o.z.string().describe("First autonomous system number associated with this session"),last_user_agent:o.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:o.z.string().describe("Last IP address from which this user logged in"),last_asn:o.z.string().describe("Last autonomous system number from which this user logged in")}),Wm=o.z.object({id:o.z.string(),revoked_at:o.z.string().optional(),used_at:o.z.string().optional(),user_id:o.z.string().describe("The user ID associated with the session"),expires_at:o.z.string().optional(),login_session_id:o.z.string(),idle_expires_at:o.z.string().optional(),device:Gm.describe("Metadata related to the device used in the session"),clients:o.z.array(o.z.string()).describe("List of client details for the session")}),Ec=o.z.object({created_at:o.z.string(),updated_at:o.z.string(),authenticated_at:o.z.string(),last_interaction_at:o.z.string(),...Wm.shape}),bu=o.z.object({kid:o.z.string().openapi({description:"The key id of the signing key"}),cert:o.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:o.z.string().openapi({description:"The cert fingerprint"}),thumbprint:o.z.string().openapi({description:"The cert thumbprint"}),pkcs7:o.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:o.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:o.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:o.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:o.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:o.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:o.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:o.z.string().optional().openapi({description:"The date and time when the key was revoked"}),connection:o.z.string().optional().openapi({description:"The connection identifier associated with the key"}),type:o.z.enum(["jwt_signing","saml_encryption"]).openapi({description:"The type of the signing key"})});var vi=(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))(vi||{});const gp=o.z.object({access_token:o.z.string(),id_token:o.z.string().optional(),scope:o.z.string().optional(),state:o.z.string().optional(),refresh_token:o.z.string().optional(),token_type:o.z.string(),expires_in:o.z.number()});o.z.object({code:o.z.string(),state:o.z.string().optional()});const Xm=o.z.object({button_border_radius:o.z.number(),button_border_weight:o.z.number(),buttons_style:o.z.enum(["pill","rounded","sharp"]),input_border_radius:o.z.number(),input_border_weight:o.z.number(),inputs_style:o.z.enum(["pill","rounded","sharp"]),show_widget_shadow:o.z.boolean(),widget_border_weight:o.z.number(),widget_corner_radius:o.z.number()}),Jm=o.z.object({base_focus_color:o.z.string(),base_hover_color:o.z.string(),body_text:o.z.string(),captcha_widget_theme:o.z.enum(["auto","dark","light"]),error:o.z.string(),header:o.z.string(),icons:o.z.string(),input_background:o.z.string(),input_border:o.z.string(),input_filled_text:o.z.string(),input_labels_placeholders:o.z.string(),links_focused_components:o.z.string(),primary_button:o.z.string(),primary_button_label:o.z.string(),secondary_button_border:o.z.string(),secondary_button_label:o.z.string(),success:o.z.string(),widget_background:o.z.string(),widget_border:o.z.string()}),Tr=o.z.object({bold:o.z.boolean(),size:o.z.number()}),Ym=o.z.object({body_text:Tr,buttons_text:Tr,font_url:o.z.string(),input_labels:Tr,links:Tr,links_style:o.z.enum(["normal","underlined"]),reference_text_size:o.z.number(),subtitle:Tr,title:Tr}),Zm=o.z.object({background_color:o.z.string(),background_image_url:o.z.string(),page_layout:o.z.enum(["center","left","right"])}),Qm=o.z.object({header_text_alignment:o.z.enum(["center","left","right"]),logo_height:o.z.number(),logo_position:o.z.enum(["center","left","none","right"]),logo_url:o.z.string(),social_buttons_layout:o.z.enum(["bottom","top"])}),e_=o.z.object({borders:Xm,colors:Jm,displayName:o.z.string(),fonts:Ym,page_background:Zm,widget:Qm}),Zo=e_.extend({themeId:o.z.string()}),Qo=o.z.object({universal_login_experience:o.z.enum(["new","classic"]).default("new"),identifier_first:o.z.boolean().default(!0),password_first:o.z.boolean().default(!1),webauthn_platform_first_factor:o.z.boolean()}),ea=o.z.object({name:o.z.string(),enabled:o.z.boolean().optional().default(!0),default_from_address:o.z.string().optional(),credentials:o.z.union([o.z.object({accessKeyId:o.z.string(),secretAccessKey:o.z.string(),region:o.z.string()}),o.z.object({smtp_host:o.z.array(o.z.string()),smtp_port:o.z.number(),smtp_user:o.z.string(),smtp_pass:o.z.string()}),o.z.object({api_key:o.z.string(),domain:o.z.string().optional()}),o.z.object({connectionString:o.z.string()}),o.z.object({tenantId:o.z.string(),clientId:o.z.string(),clientSecret:o.z.string()})]),settings:o.z.object({}).optional()}),mp=o.z.object({id:o.z.string(),session_id:o.z.string(),user_id:o.z.string(),client_id:o.z.string(),expires_at:o.z.string().optional(),idle_expires_at:o.z.string().optional(),last_exchanged_at:o.z.string().optional(),device:Gm,resource_servers:o.z.array(o.z.object({audience:o.z.string(),scopes:o.z.string()})),rotating:o.z.boolean()}),ev=o.z.object({created_at:o.z.string(),...mp.shape}),tv=o.z.object({to:o.z.string(),message:o.z.string()}),nv=o.z.object({name:o.z.string(),options:o.z.object({})}),t_=o.z.object({value:o.z.string(),description:o.z.string().optional()}),n_=o.z.object({token_dialect:o.z.enum(["access_token","access_token_authz"]).optional(),enforce_policies:o.z.boolean().optional(),allow_skipping_userinfo:o.z.boolean().optional(),skip_userinfo:o.z.boolean().optional(),persist_client_authorization:o.z.boolean().optional(),enable_introspection_endpoint:o.z.boolean().optional(),mtls:o.z.object({bound_access_tokens:o.z.boolean().optional()}).optional()}),Sa=o.z.object({name:o.z.string(),identifier:o.z.string(),scopes:o.z.array(t_).optional(),signing_alg:o.z.string().optional(),signing_secret:o.z.string().optional(),token_lifetime:o.z.number().optional(),token_lifetime_for_web:o.z.number().optional(),skip_consent_for_verifiable_first_party_clients:o.z.boolean().optional(),allow_offline_access:o.z.boolean().optional(),verificationKey:o.z.string().optional(),options:n_.optional()}),Dr=o.z.object({id:o.z.string().optional(),...Sa.shape,created_at:o.z.string().optional(),updated_at:o.z.string().optional()}),rv=o.z.array(Dr),r_=o.z.object({role_id:o.z.string(),resource_server_identifier:o.z.string(),permission_name:o.z.string()}),i_=o.z.object({...r_.shape,tenant_id:o.z.string(),created_at:o.z.string().optional()}),iv=o.z.array(i_),s_=o.z.object({role_id:o.z.string(),resource_server_identifier:o.z.string(),resource_server_name:o.z.string(),permission_name:o.z.string(),description:o.z.string().nullable().optional(),created_at:o.z.string().optional()}),o_=o.z.array(s_),a_=o.z.object({user_id:o.z.string(),resource_server_identifier:o.z.string(),permission_name:o.z.string()}),c_=o.z.object({...a_.shape,tenant_id:o.z.string(),created_at:o.z.string().optional()}),sv=o.z.array(c_),l_=o.z.object({user_id:o.z.string(),resource_server_identifier:o.z.string(),resource_server_name:o.z.string(),permission_name:o.z.string(),description:o.z.string().nullable().optional(),created_at:o.z.string().optional()}),u_=o.z.array(l_),ka=o.z.object({name:o.z.string().min(1).max(50).openapi({description:"The name of the role. Cannot include '<' or '>'"}),description:o.z.string().max(255).optional().openapi({description:"The description of the role"})}),Rr=o.z.object({id:o.z.string().openapi({description:"The unique identifier of the role"}),...ka.shape,created_at:o.z.string().optional(),updated_at:o.z.string().optional()}),d_=o.z.array(Rr);function ov(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const lh={themeId:"default",borders:{button_border_radius:8,button_border_weight:1,buttons_style:"pill",input_border_radius:8,input_border_weight:1,inputs_style:"pill",show_widget_shadow:!0,widget_border_weight:1,widget_corner_radius:16},colors:{base_focus_color:"#7D68F4",base_hover_color:"#A091F2",body_text:"#000000",captcha_widget_theme:"auto",error:"#FC5A5A",header:"#000000",icons:"#666666",input_background:"#FFFFFF",input_border:"#BFBCD7",input_filled_text:"#000000",input_labels_placeholders:"#88869F",links_focused_components:"#7D68F4",primary_button:"#7D68F4",primary_button_label:"#FFFFFF",secondary_button_border:"#BFBCD7",secondary_button_label:"#000000",success:"#36BF76",widget_background:"#FFFFFF",widget_border:"#BFBCD7"},displayName:"Default Theme",fonts:{body_text:{bold:!1,size:16},buttons_text:{bold:!1,size:16},font_url:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",input_labels:{bold:!1,size:14},links:{bold:!1,size:16},links_style:"normal",reference_text_size:16,subtitle:{bold:!1,size:18},title:{bold:!0,size:24}},page_background:{background_color:"#F8F9FB",background_image_url:"https://assets.sesamy.com/images/login-bg.jpg",page_layout:"center"},widget:{header_text_alignment:"center",logo_height:36,logo_position:"center",logo_url:"https://assets.sesamy.com/static/images/sesamy/logos/sesamy_logo_black.svg",social_buttons_layout:"bottom"}};function uh(t,e){const n=structuredClone(t);function r(i,s){for(const a in s)s[a]!==void 0&&typeof s[a]=="object"&&!Array.isArray(s[a])&&typeof i[a]=="object"&&i[a]!==null?r(i[a],s[a]):i[a]=s[a];return i}return r(n,e)}const av=new o.OpenAPIHono().openapi(o.createRoute({tags:["branding"],method:"get",path:"/default",request:{headers:o.z.object({"tenant-id":o.z.string().optional()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Zo}},description:"Default theme settings"}}}),async t=>{const e=await t.env.data.themes.get(t.var.tenant_id,"default");return e?t.json(e):t.json(lh)}).openapi(o.createRoute({tags:["branding"],method:"patch",path:"/default",request:{body:{content:{"application/json":{schema:Zo.deepPartial()}}},headers:o.z.object({"tenant-id":o.z.string().optional()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Zo}},description:"Updated theme settings"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.themes.get(t.var.tenant_id,"default");if(n){const r=uh(n,e);await t.env.data.themes.update(t.var.tenant_id,"default",r);const i=await t.env.data.themes.get(t.var.tenant_id,"default");return t.json(i)}else{const r=uh(lh,e),i=await t.env.data.themes.create(t.var.tenant_id,r);return t.json(i)}}),cv={colors:{primary:"#7D68F4",page_background:{type:"solid",start:"#F8F9FB",end:"#F8F9FB",angle_deg:0}},logo_url:"https://assets.sesamy.com/static/images/sesamy/logos/sesamy_logo_black.svg",favicon_url:"https://assets.sesamy.com/images/favicon.ico",font:{url:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2"}},lv=new o.OpenAPIHono().openapi(o.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:wu}},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(cv)}).openapi(o.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(wu.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")}).route("/themes",av);var N=class extends Error{constructor(e=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});be(this,"res");be(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})}},Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function p_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function uv(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 dv(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 f_={exports:{}};const pv={},fv=Object.freeze(Object.defineProperty({__proto__:null,default:pv},Symbol.toStringTag,{value:"Module"})),Sc=uv(fv);(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 dv=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Pr,function(){var e={},n=null;function r(P){if(t&&t.exports)try{return Sc.randomBytes(P)}catch{}try{var j;return(self.crypto||self.msCrypto).getRandomValues(j=new Uint32Array(P)),Array.prototype.slice.call(j)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(P)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(P){n=P},e.genSaltSync=function(P,j){if(P=P||I,typeof P!="number")throw Error("Illegal arguments: "+typeof P+", "+typeof j);P<4?P=4:P>31&&(P=31);var z=[];return z.push("$2a$"),P<10&&z.push("0"),z.push(P.toString()),z.push("$"),z.push(h(r($),$)),z.join("")},e.genSalt=function(P,j,z){if(typeof j=="function"&&(z=j,j=void 0),typeof P=="function"&&(z=P,P=void 0),typeof P>"u")P=I;else if(typeof P!="number")throw Error("illegal arguments: "+typeof P);function k(S){a(function(){try{S(null,e.genSaltSync(P))}catch(B){S(B)}})}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(S,B){k(function(V,ue){if(V){B(V);return}S(ue)})})},e.hashSync=function(P,j){if(typeof j>"u"&&(j=I),typeof j=="number"&&(j=e.genSaltSync(j)),typeof P!="string"||typeof j!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof j);return Ce(P,j)},e.hash=function(P,j,z,k){function S(B){typeof P=="string"&&typeof j=="number"?e.genSalt(j,function(V,ue){Ce(P,ue,B,k)}):typeof P=="string"&&typeof j=="string"?Ce(P,j,B,k):a(B.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof j)))}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);S(z)}else return new Promise(function(B,V){S(function(ue,re){if(ue){V(ue);return}B(re)})})};function s(P,j){for(var z=0,k=0,S=0,B=P.length;S<B;++S)P.charCodeAt(S)===j.charCodeAt(S)?++z:++k;return z<0?!1:k===0}e.compareSync=function(P,j){if(typeof P!="string"||typeof j!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof j);return j.length!==60?!1:s(e.hashSync(P,j.substr(0,j.length-31)),j)},e.compare=function(P,j,z,k){function S(B){if(typeof P!="string"||typeof j!="string"){a(B.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof j)));return}if(j.length!==60){a(B.bind(this,null,!1));return}e.hash(P,j.substr(0,29),function(V,ue){V?B(V):B(null,s(ue,j))},k)}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);S(z)}else return new Promise(function(B,V){S(function(ue,re){if(ue){V(ue);return}B(re)})})},e.getRounds=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);return parseInt(P.split("$")[2],10)},e.getSalt=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);if(P.length!==60)throw Error("Illegal hash length: "+P.length+" != 60");return P.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function l(P){var j=[],z=0;return A.encodeUTF16toUTF8(function(){return z>=P.length?null:P.charCodeAt(z++)},function(k){j.push(k)}),j}var u="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-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],p=String.fromCharCode;function h(P,j){var z=0,k=[],S,B;if(j<=0||j>P.length)throw Error("Illegal len: "+j);for(;z<j;){if(S=P[z++]&255,k.push(u[S>>2&63]),S=(S&3)<<4,z>=j){k.push(u[S&63]);break}if(B=P[z++]&255,S|=B>>4&15,k.push(u[S&63]),S=(B&15)<<2,z>=j){k.push(u[S&63]);break}B=P[z++]&255,S|=B>>6&3,k.push(u[S&63]),k.push(u[B&63])}return k.join("")}function g(P,j){var z=0,k=P.length,S=0,B=[],V,ue,re,ve,Se,Z;if(j<=0)throw Error("Illegal len: "+j);for(;z<k-1&&S<j&&(Z=P.charCodeAt(z++),V=Z<d.length?d[Z]:-1,Z=P.charCodeAt(z++),ue=Z<d.length?d[Z]:-1,!(V==-1||ue==-1||(Se=V<<2>>>0,Se|=(ue&48)>>4,B.push(p(Se)),++S>=j||z>=k)||(Z=P.charCodeAt(z++),re=Z<d.length?d[Z]:-1,re==-1)||(Se=(ue&15)<<4>>>0,Se|=(re&60)>>2,B.push(p(Se)),++S>=j||z>=k)));)Z=P.charCodeAt(z++),ve=Z<d.length?d[Z]:-1,Se=(re&3)<<6>>>0,Se|=ve,B.push(p(Se)),++S;var ye=[];for(z=0;z<S;z++)ye.push(B[z].charCodeAt(0));return ye}var A=function(){var P={};return P.MAX_CODEPOINT=1114111,P.encodeUTF8=function(j,z){var k=null;for(typeof j=="number"&&(k=j,j=function(){return null});k!==null||(k=j())!==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},P.decodeUTF8=function(j,z){for(var k,S,B,V,ue=function(re){re=re.slice(0,re.indexOf(null));var ve=Error(re.toString());throw ve.name="TruncatedError",ve.bytes=re,ve};(k=j())!==null;)if(!(k&128))z(k);else if((k&224)===192)(S=j())===null&&ue([k,S]),z((k&31)<<6|S&63);else if((k&240)===224)((S=j())===null||(B=j())===null)&&ue([k,S,B]),z((k&15)<<12|(S&63)<<6|B&63);else if((k&248)===240)((S=j())===null||(B=j())===null||(V=j())===null)&&ue([k,S,B,V]),z((k&7)<<18|(S&63)<<12|(B&63)<<6|V&63);else throw RangeError("Illegal starting byte: "+k)},P.UTF16toUTF8=function(j,z){for(var k,S=null;(k=S!==null?S:j())!==null;){if(k>=55296&&k<=57343&&(S=j())!==null&&S>=56320&&S<=57343){z((k-55296)*1024+S-56320+65536),S=null;continue}z(k)}S!==null&&z(S)},P.UTF8toUTF16=function(j,z){var k=null;for(typeof j=="number"&&(k=j,j=function(){return null});k!==null||(k=j())!==null;)k<=65535?z(k):(k-=65536,z((k>>10)+55296),z(k%1024+56320)),k=null},P.encodeUTF16toUTF8=function(j,z){P.UTF16toUTF8(j,function(k){P.encodeUTF8(k,z)})},P.decodeUTF8toUTF16=function(j,z){P.decodeUTF8(j,function(k){P.UTF8toUTF16(k,z)})},P.calculateCodePoint=function(j){return j<128?1:j<2048?2:j<65536?3:4},P.calculateUTF8=function(j){for(var z,k=0;(z=j())!==null;)k+=P.calculateCodePoint(z);return k},P.calculateUTF16asUTF8=function(j){var z=0,k=0;return P.UTF16toUTF8(j,function(S){++z,k+=P.calculateCodePoint(S)}),[z,k]},P}();Date.now=Date.now||function(){return+new Date};var $=16,I=10,R=16,D=100,x=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],M=[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],G=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function F(P,j,z,k){var S,B=P[j],V=P[j+1];return B^=z[0],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[1],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[2],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[3],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[4],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[5],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[6],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[7],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[8],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[9],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[10],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[11],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[12],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[13],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[14],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[15],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[16],P[j]=V^z[R+1],P[j+1]=B,P}function H(P,j){for(var z=0,k=0;z<4;++z)k=k<<8|P[j]&255,j=(j+1)%P.length;return{key:k,offp:j}}function X(P,j,z){for(var k=0,S=[0,0],B=j.length,V=z.length,ue,re=0;re<B;re++)ue=H(P,k),k=ue.offp,j[re]=j[re]^ue.key;for(re=0;re<B;re+=2)S=F(S,0,j,z),j[re]=S[0],j[re+1]=S[1];for(re=0;re<V;re+=2)S=F(S,0,j,z),z[re]=S[0],z[re+1]=S[1]}function Y(P,j,z,k){for(var S=0,B=[0,0],V=z.length,ue=k.length,re,ve=0;ve<V;ve++)re=H(j,S),S=re.offp,z[ve]=z[ve]^re.key;for(S=0,ve=0;ve<V;ve+=2)re=H(P,S),S=re.offp,B[0]^=re.key,re=H(P,S),S=re.offp,B[1]^=re.key,B=F(B,0,z,k),z[ve]=B[0],z[ve+1]=B[1];for(ve=0;ve<ue;ve+=2)re=H(P,S),S=re.offp,B[0]^=re.key,re=H(P,S),S=re.offp,B[1]^=re.key,B=F(B,0,z,k),k[ve]=B[0],k[ve+1]=B[1]}function fe(P,j,z,k,S){var B=G.slice(),V=B.length,ue;if(z<4||z>31)if(ue=Error("Illegal number of rounds (4-31): "+z),k){a(k.bind(this,ue));return}else throw ue;if(j.length!==$)if(ue=Error("Illegal salt length: "+j.length+" != "+$),k){a(k.bind(this,ue));return}else throw ue;z=1<<z>>>0;var re,ve,Se=0,Z;Int32Array?(re=new Int32Array(x),ve=new Int32Array(M)):(re=x.slice(),ve=M.slice()),Y(j,P,re,ve);function ye(){if(S&&S(Se/z),Se<z)for(var Be=Date.now();Se<z&&(Se=Se+1,X(P,re,ve),X(j,re,ve),!(Date.now()-Be>D)););else{for(Se=0;Se<64;Se++)for(Z=0;Z<V>>1;Z++)F(B,Z<<1,re,ve);var He=[];for(Se=0;Se<V;Se++)He.push((B[Se]>>24&255)>>>0),He.push((B[Se]>>16&255)>>>0),He.push((B[Se]>>8&255)>>>0),He.push((B[Se]&255)>>>0);if(k){k(null,He);return}else return He}k&&a(ye)}if(typeof k<"u")ye();else for(var Rn;;)if(typeof(Rn=ye())<"u")return Rn||[]}function Ce(P,j,z,k){var S;if(typeof P!="string"||typeof j!="string")if(S=Error("Invalid string / salt: Not a string"),z){a(z.bind(this,S));return}else throw S;var B,V;if(j.charAt(0)!=="$"||j.charAt(1)!=="2")if(S=Error("Invalid salt version: "+j.substring(0,2)),z){a(z.bind(this,S));return}else throw S;if(j.charAt(2)==="$")B="\0",V=3;else{if(B=j.charAt(2),B!=="a"&&B!=="b"&&B!=="y"||j.charAt(3)!=="$")if(S=Error("Invalid salt revision: "+j.substring(2,4)),z){a(z.bind(this,S));return}else throw S;V=4}if(j.charAt(V+2)>"$")if(S=Error("Missing salt rounds"),z){a(z.bind(this,S));return}else throw S;var ue=parseInt(j.substring(V,V+1),10)*10,re=parseInt(j.substring(V+1,V+2),10),ve=ue+re,Se=j.substring(V+3,V+25);P+=B>="a"?"\0":"";var Z=l(P),ye=g(Se,$);function Rn(Be){var He=[];return He.push("$2"),B>="a"&&He.push(B),He.push("$"),ve<10&&He.push("0"),He.push(ve.toString()),He.push("$"),He.push(h(ye,ye.length)),He.push(h(Be,G.length*4-1)),He.join("")}if(typeof z>"u")return Rn(fe(Z,ye,ve));fe(Z,ye,ve,function(Be,He){Be?z(Be,null):z(null,Rn(He))},k)}return e.encodeBase64=h,e.decodeBase64=g,e})})(f_);var hv=f_.exports;const no=p_(hv),gv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let mv=t=>crypto.getRandomValues(new Uint8Array(t)),_v=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(s=e)=>{let a="";for(;;){let l=n(i),u=i;for(;u--;)if(a+=t[l[u]&r]||"",a.length===s)return a}}},yv=(t,e=21)=>_v(t,e,mv),qe=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=gv[n[t]&63];return e};const wv=24;function kc(){return yv("0123456789abcdef",wv)()}function dh(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function vv(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await Ep({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 Ue(t,e){return{type:e.type,description:e.description||"",ip:t.var.ip,user_agent:t.var.useragent||"",auth0_client:t.var.auth0_client,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 _p{constructor(e,n){be(this,"value");be(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 _p(Math.round(this.milliseconds()*e),"ms")}}class bv{constructor(e){be(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 h_(t){return await crypto.subtle.digest("SHA-256",t)}const ph="0123456789abcdef";function xu(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=ph[i];const s=e[r]&15;n+=ph[s]}return n}class g_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(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,s=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],s+=8;s>=5;)s-=5,r+=this.alphabet[i>>s&31];if(s>0&&(r+=this.alphabet[i<<5-s&31]),(n==null?void 0:n.includePadding)??!0){const l=(8-r.length%8)%8;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),s=[];for(let a=0;a<i;a++){let l=0;const u=[];for(let p=0;p<8;p++){const h=e[a*8+p];if(h==="="){if(a+1!==i)throw new Error(`Invalid character: ${h}`);l+=1;continue}if(h===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const g=this.decodeMap.get(h)??null;if(g===null)throw new Error(`Invalid character: ${h}`);u.push(g)}if(l===8||l===7||l===5||l===2)throw new Error("Invalid padding");const d=(u[0]<<3)+(u[1]>>2);if(s.push(d),l<6){const p=((u[1]&3)<<6)+(u[2]<<1)+(u[3]>>4);s.push(p)}if(l<4){const p=((u[3]&255)<<4)+(u[4]>>1);s.push(p)}if(l<3){const p=((u[4]&1)<<7)+(u[5]<<2)+(u[6]>>3);s.push(p)}if(l<1){const p=((u[6]&7)<<5)+u[7];s.push(p)}}return Uint8Array.from(s)}}new g_("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new g_("0123456789ABCDEFGHIJKLMNOPQRSTUV");class m_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(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,s=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],s+=8;s>=6;)s+=-6,r+=this.alphabet[i>>s&63];if(s>0&&(r+=this.alphabet[i<<6-s&63]),(n==null?void 0:n.includePadding)??!0){const l=(4-r.length%4)%4;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),s=[];for(let a=0;a<i;a++){let l=0,u=0;for(let d=0;d<4;d++){const p=e[a*4+d];if(p==="="){if(a+1!==i)throw new Error(`Invalid character: ${p}`);l+=1;continue}if(p===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const h=this.decodeMap.get(p)??null;if(h===null)throw new Error(`Invalid character: ${p}`);u+=h<<6*(3-d)}s.push(u>>16&255),l<2&&s.push(u>>8&255),l<1&&s.push(u&255)}return Uint8Array.from(s)}}const __=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Lr=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function fh(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},s={...n};(r==null?void 0:r.audiences)!==void 0&&(s.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(s.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(s.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(s.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(s.nbf=Math.floor(r.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,l=Lr.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),u=Lr.encode(a.encode(JSON.stringify(s)),{includePadding:!1}),d=a.encode([l,u].join(".")),p=await $v(t).sign(e,d),h=Lr.encode(new Uint8Array(p),{includePadding:!1});return[l,u,h].join(".")}function xv(t){const e=t.split(".");return e.length!==3?null:e}function yp(t){const e=xv(t);if(!e)return null;const n=new TextDecoder,r=Lr.decode(e[0],{strict:!1}),i=Lr.decode(e[1],{strict:!1}),s=JSON.parse(n.decode(r));if(typeof s!="object"||s===null||!("alg"in s)||!Av(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const l={algorithm:s.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;l.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;l.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;l.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const u of a.aud)if(typeof u!="string")return null;l.audiences=a.aud}else{if(typeof a.aud!="string")return null;l.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;l.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;l.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;l.jwtId=a.jti}return{value:t,header:{...s,typ:"JWT",alg:s.alg},payload:{...a},parts:e,...l}}function $v(t){return new bv(Ev[t])}function Av(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const Ev={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function Sv(){const t=new Uint8Array(32);return crypto.getRandomValues(t),Lr.encode(t,{includePadding:!1})}function kv(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 Nv(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await h_(n);return Lr.encode(new Uint8Array(r),{includePadding:!1})}const Lo=60*5,Nc=30*24*60*60,Ci=24*60*60,Cv="auth-token",ta=30*60*1e3,$u=7*24*60*60*1e3,Tv=5*60,Iv=5*60,Ov=30*60*1e3,zv=30*60*1e3,Dv=24*60*60*1e3;function y_(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 Rv(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),s=i[0],a=i[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(a))}return e}function wp(t){return`${t}-${Cv}`}function w_(t){if(!t)return;const[e]=t.split(":");if(!e||e==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(e))return;const n=e.split(".");return n.length>2?`.${n.slice(-2).join(".")}`:`.${e}`}function Is(t,e){return e?Rv(e).get(wp(t)):void 0}function Pv(t,e){return y_(wp(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?w_(e):void 0})}function Na(t,e,n){return y_(wp(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:Nc,sameSite:"none",domain:n?w_(n):void 0})}var vp={},Cc={};(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+"$"),s=function(l,u){const d=[];let p=u.exec(l);for(;p;){const h=[];h.startIndex=u.lastIndex-p[0].length;const g=p.length;for(let A=0;A<g;A++)h.push(p[A]);d.push(h),p=u.exec(l)}return d},a=function(l){const u=i.exec(l);return!(u===null||typeof u>"u")};t.isExist=function(l){return typeof l<"u"},t.isEmptyObject=function(l){return Object.keys(l).length===0},t.merge=function(l,u,d){if(u){const p=Object.keys(u),h=p.length;for(let g=0;g<h;g++)d==="strict"?l[p[g]]=[u[p[g]]]:l[p[g]]=u[p[g]]}},t.getValue=function(l){return t.isExist(l)?l:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(Cc);const bp=Cc,Bv={allowBooleanAttributes:!1,unpairedTags:[]};vp.validate=function(t,e){e=Object.assign({},Bv,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=gh(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=mh(t,s);continue}else{let l=!1;t[s]==="/"&&(l=!0,s++);let u="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
5
+ */(function(e,n){typeof dv=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Pr,function(){var e={},n=null;function r(P){if(t&&t.exports)try{return Sc.randomBytes(P)}catch{}try{var j;return(self.crypto||self.msCrypto).getRandomValues(j=new Uint32Array(P)),Array.prototype.slice.call(j)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(P)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(P){n=P},e.genSaltSync=function(P,j){if(P=P||I,typeof P!="number")throw Error("Illegal arguments: "+typeof P+", "+typeof j);P<4?P=4:P>31&&(P=31);var z=[];return z.push("$2a$"),P<10&&z.push("0"),z.push(P.toString()),z.push("$"),z.push(h(r($),$)),z.join("")},e.genSalt=function(P,j,z){if(typeof j=="function"&&(z=j,j=void 0),typeof P=="function"&&(z=P,P=void 0),typeof P>"u")P=I;else if(typeof P!="number")throw Error("illegal arguments: "+typeof P);function k(S){a(function(){try{S(null,e.genSaltSync(P))}catch(B){S(B)}})}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(S,B){k(function(V,de){if(V){B(V);return}S(de)})})},e.hashSync=function(P,j){if(typeof j>"u"&&(j=I),typeof j=="number"&&(j=e.genSaltSync(j)),typeof P!="string"||typeof j!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof j);return Ce(P,j)},e.hash=function(P,j,z,k){function S(B){typeof P=="string"&&typeof j=="number"?e.genSalt(j,function(V,de){Ce(P,de,B,k)}):typeof P=="string"&&typeof j=="string"?Ce(P,j,B,k):a(B.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof j)))}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);S(z)}else return new Promise(function(B,V){S(function(de,re){if(de){V(de);return}B(re)})})};function s(P,j){for(var z=0,k=0,S=0,B=P.length;S<B;++S)P.charCodeAt(S)===j.charCodeAt(S)?++z:++k;return z<0?!1:k===0}e.compareSync=function(P,j){if(typeof P!="string"||typeof j!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof j);return j.length!==60?!1:s(e.hashSync(P,j.substr(0,j.length-31)),j)},e.compare=function(P,j,z,k){function S(B){if(typeof P!="string"||typeof j!="string"){a(B.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof j)));return}if(j.length!==60){a(B.bind(this,null,!1));return}e.hash(P,j.substr(0,29),function(V,de){V?B(V):B(null,s(de,j))},k)}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);S(z)}else return new Promise(function(B,V){S(function(de,re){if(de){V(de);return}B(re)})})},e.getRounds=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);return parseInt(P.split("$")[2],10)},e.getSalt=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);if(P.length!==60)throw Error("Illegal hash length: "+P.length+" != 60");return P.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function l(P){var j=[],z=0;return A.encodeUTF16toUTF8(function(){return z>=P.length?null:P.charCodeAt(z++)},function(k){j.push(k)}),j}var u="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-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],p=String.fromCharCode;function h(P,j){var z=0,k=[],S,B;if(j<=0||j>P.length)throw Error("Illegal len: "+j);for(;z<j;){if(S=P[z++]&255,k.push(u[S>>2&63]),S=(S&3)<<4,z>=j){k.push(u[S&63]);break}if(B=P[z++]&255,S|=B>>4&15,k.push(u[S&63]),S=(B&15)<<2,z>=j){k.push(u[S&63]);break}B=P[z++]&255,S|=B>>6&3,k.push(u[S&63]),k.push(u[B&63])}return k.join("")}function g(P,j){var z=0,k=P.length,S=0,B=[],V,de,re,ve,Se,Z;if(j<=0)throw Error("Illegal len: "+j);for(;z<k-1&&S<j&&(Z=P.charCodeAt(z++),V=Z<d.length?d[Z]:-1,Z=P.charCodeAt(z++),de=Z<d.length?d[Z]:-1,!(V==-1||de==-1||(Se=V<<2>>>0,Se|=(de&48)>>4,B.push(p(Se)),++S>=j||z>=k)||(Z=P.charCodeAt(z++),re=Z<d.length?d[Z]:-1,re==-1)||(Se=(de&15)<<4>>>0,Se|=(re&60)>>2,B.push(p(Se)),++S>=j||z>=k)));)Z=P.charCodeAt(z++),ve=Z<d.length?d[Z]:-1,Se=(re&3)<<6>>>0,Se|=ve,B.push(p(Se)),++S;var ye=[];for(z=0;z<S;z++)ye.push(B[z].charCodeAt(0));return ye}var A=function(){var P={};return P.MAX_CODEPOINT=1114111,P.encodeUTF8=function(j,z){var k=null;for(typeof j=="number"&&(k=j,j=function(){return null});k!==null||(k=j())!==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},P.decodeUTF8=function(j,z){for(var k,S,B,V,de=function(re){re=re.slice(0,re.indexOf(null));var ve=Error(re.toString());throw ve.name="TruncatedError",ve.bytes=re,ve};(k=j())!==null;)if(!(k&128))z(k);else if((k&224)===192)(S=j())===null&&de([k,S]),z((k&31)<<6|S&63);else if((k&240)===224)((S=j())===null||(B=j())===null)&&de([k,S,B]),z((k&15)<<12|(S&63)<<6|B&63);else if((k&248)===240)((S=j())===null||(B=j())===null||(V=j())===null)&&de([k,S,B,V]),z((k&7)<<18|(S&63)<<12|(B&63)<<6|V&63);else throw RangeError("Illegal starting byte: "+k)},P.UTF16toUTF8=function(j,z){for(var k,S=null;(k=S!==null?S:j())!==null;){if(k>=55296&&k<=57343&&(S=j())!==null&&S>=56320&&S<=57343){z((k-55296)*1024+S-56320+65536),S=null;continue}z(k)}S!==null&&z(S)},P.UTF8toUTF16=function(j,z){var k=null;for(typeof j=="number"&&(k=j,j=function(){return null});k!==null||(k=j())!==null;)k<=65535?z(k):(k-=65536,z((k>>10)+55296),z(k%1024+56320)),k=null},P.encodeUTF16toUTF8=function(j,z){P.UTF16toUTF8(j,function(k){P.encodeUTF8(k,z)})},P.decodeUTF8toUTF16=function(j,z){P.decodeUTF8(j,function(k){P.UTF8toUTF16(k,z)})},P.calculateCodePoint=function(j){return j<128?1:j<2048?2:j<65536?3:4},P.calculateUTF8=function(j){for(var z,k=0;(z=j())!==null;)k+=P.calculateCodePoint(z);return k},P.calculateUTF16asUTF8=function(j){var z=0,k=0;return P.UTF16toUTF8(j,function(S){++z,k+=P.calculateCodePoint(S)}),[z,k]},P}();Date.now=Date.now||function(){return+new Date};var $=16,I=10,R=16,D=100,x=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],M=[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],G=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function F(P,j,z,k){var S,B=P[j],V=P[j+1];return B^=z[0],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[1],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[2],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[3],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[4],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[5],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[6],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[7],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[8],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[9],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[10],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[11],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[12],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[13],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[14],S=k[B>>>24],S+=k[256|B>>16&255],S^=k[512|B>>8&255],S+=k[768|B&255],V^=S^z[15],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],B^=S^z[16],P[j]=V^z[R+1],P[j+1]=B,P}function H(P,j){for(var z=0,k=0;z<4;++z)k=k<<8|P[j]&255,j=(j+1)%P.length;return{key:k,offp:j}}function W(P,j,z){for(var k=0,S=[0,0],B=j.length,V=z.length,de,re=0;re<B;re++)de=H(P,k),k=de.offp,j[re]=j[re]^de.key;for(re=0;re<B;re+=2)S=F(S,0,j,z),j[re]=S[0],j[re+1]=S[1];for(re=0;re<V;re+=2)S=F(S,0,j,z),z[re]=S[0],z[re+1]=S[1]}function Y(P,j,z,k){for(var S=0,B=[0,0],V=z.length,de=k.length,re,ve=0;ve<V;ve++)re=H(j,S),S=re.offp,z[ve]=z[ve]^re.key;for(S=0,ve=0;ve<V;ve+=2)re=H(P,S),S=re.offp,B[0]^=re.key,re=H(P,S),S=re.offp,B[1]^=re.key,B=F(B,0,z,k),z[ve]=B[0],z[ve+1]=B[1];for(ve=0;ve<de;ve+=2)re=H(P,S),S=re.offp,B[0]^=re.key,re=H(P,S),S=re.offp,B[1]^=re.key,B=F(B,0,z,k),k[ve]=B[0],k[ve+1]=B[1]}function ue(P,j,z,k,S){var B=G.slice(),V=B.length,de;if(z<4||z>31)if(de=Error("Illegal number of rounds (4-31): "+z),k){a(k.bind(this,de));return}else throw de;if(j.length!==$)if(de=Error("Illegal salt length: "+j.length+" != "+$),k){a(k.bind(this,de));return}else throw de;z=1<<z>>>0;var re,ve,Se=0,Z;Int32Array?(re=new Int32Array(x),ve=new Int32Array(M)):(re=x.slice(),ve=M.slice()),Y(j,P,re,ve);function ye(){if(S&&S(Se/z),Se<z)for(var Be=Date.now();Se<z&&(Se=Se+1,W(P,re,ve),W(j,re,ve),!(Date.now()-Be>D)););else{for(Se=0;Se<64;Se++)for(Z=0;Z<V>>1;Z++)F(B,Z<<1,re,ve);var He=[];for(Se=0;Se<V;Se++)He.push((B[Se]>>24&255)>>>0),He.push((B[Se]>>16&255)>>>0),He.push((B[Se]>>8&255)>>>0),He.push((B[Se]&255)>>>0);if(k){k(null,He);return}else return He}k&&a(ye)}if(typeof k<"u")ye();else for(var Rn;;)if(typeof(Rn=ye())<"u")return Rn||[]}function Ce(P,j,z,k){var S;if(typeof P!="string"||typeof j!="string")if(S=Error("Invalid string / salt: Not a string"),z){a(z.bind(this,S));return}else throw S;var B,V;if(j.charAt(0)!=="$"||j.charAt(1)!=="2")if(S=Error("Invalid salt version: "+j.substring(0,2)),z){a(z.bind(this,S));return}else throw S;if(j.charAt(2)==="$")B="\0",V=3;else{if(B=j.charAt(2),B!=="a"&&B!=="b"&&B!=="y"||j.charAt(3)!=="$")if(S=Error("Invalid salt revision: "+j.substring(2,4)),z){a(z.bind(this,S));return}else throw S;V=4}if(j.charAt(V+2)>"$")if(S=Error("Missing salt rounds"),z){a(z.bind(this,S));return}else throw S;var de=parseInt(j.substring(V,V+1),10)*10,re=parseInt(j.substring(V+1,V+2),10),ve=de+re,Se=j.substring(V+3,V+25);P+=B>="a"?"\0":"";var Z=l(P),ye=g(Se,$);function Rn(Be){var He=[];return He.push("$2"),B>="a"&&He.push(B),He.push("$"),ve<10&&He.push("0"),He.push(ve.toString()),He.push("$"),He.push(h(ye,ye.length)),He.push(h(Be,G.length*4-1)),He.join("")}if(typeof z>"u")return Rn(ue(Z,ye,ve));ue(Z,ye,ve,function(Be,He){Be?z(Be,null):z(null,Rn(He))},k)}return e.encodeBase64=h,e.decodeBase64=g,e})})(f_);var hv=f_.exports;const no=p_(hv),gv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let mv=t=>crypto.getRandomValues(new Uint8Array(t)),_v=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(s=e)=>{let a="";for(;;){let l=n(i),u=i;for(;u--;)if(a+=t[l[u]&r]||"",a.length===s)return a}}},yv=(t,e=21)=>_v(t,e,mv),qe=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=gv[n[t]&63];return e};const wv=24;function kc(){return yv("0123456789abcdef",wv)()}function dh(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function vv(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await Ep({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 Ue(t,e){return{type:e.type,description:e.description||"",ip:t.var.ip,user_agent:t.var.useragent||"",auth0_client:t.var.auth0_client,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 _p{constructor(e,n){be(this,"value");be(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 _p(Math.round(this.milliseconds()*e),"ms")}}class bv{constructor(e){be(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 h_(t){return await crypto.subtle.digest("SHA-256",t)}const ph="0123456789abcdef";function xu(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=ph[i];const s=e[r]&15;n+=ph[s]}return n}class g_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(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,s=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],s+=8;s>=5;)s-=5,r+=this.alphabet[i>>s&31];if(s>0&&(r+=this.alphabet[i<<5-s&31]),(n==null?void 0:n.includePadding)??!0){const l=(8-r.length%8)%8;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),s=[];for(let a=0;a<i;a++){let l=0;const u=[];for(let p=0;p<8;p++){const h=e[a*8+p];if(h==="="){if(a+1!==i)throw new Error(`Invalid character: ${h}`);l+=1;continue}if(h===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const g=this.decodeMap.get(h)??null;if(g===null)throw new Error(`Invalid character: ${h}`);u.push(g)}if(l===8||l===7||l===5||l===2)throw new Error("Invalid padding");const d=(u[0]<<3)+(u[1]>>2);if(s.push(d),l<6){const p=((u[1]&3)<<6)+(u[2]<<1)+(u[3]>>4);s.push(p)}if(l<4){const p=((u[3]&255)<<4)+(u[4]>>1);s.push(p)}if(l<3){const p=((u[4]&1)<<7)+(u[5]<<2)+(u[6]>>3);s.push(p)}if(l<1){const p=((u[6]&7)<<5)+u[7];s.push(p)}}return Uint8Array.from(s)}}new g_("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new g_("0123456789ABCDEFGHIJKLMNOPQRSTUV");class m_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(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,s=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],s+=8;s>=6;)s+=-6,r+=this.alphabet[i>>s&63];if(s>0&&(r+=this.alphabet[i<<6-s&63]),(n==null?void 0:n.includePadding)??!0){const l=(4-r.length%4)%4;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),s=[];for(let a=0;a<i;a++){let l=0,u=0;for(let d=0;d<4;d++){const p=e[a*4+d];if(p==="="){if(a+1!==i)throw new Error(`Invalid character: ${p}`);l+=1;continue}if(p===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const h=this.decodeMap.get(p)??null;if(h===null)throw new Error(`Invalid character: ${p}`);u+=h<<6*(3-d)}s.push(u>>16&255),l<2&&s.push(u>>8&255),l<1&&s.push(u&255)}return Uint8Array.from(s)}}const __=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Lr=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function fh(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},s={...n};(r==null?void 0:r.audiences)!==void 0&&(s.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(s.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(s.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(s.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(s.nbf=Math.floor(r.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,l=Lr.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),u=Lr.encode(a.encode(JSON.stringify(s)),{includePadding:!1}),d=a.encode([l,u].join(".")),p=await $v(t).sign(e,d),h=Lr.encode(new Uint8Array(p),{includePadding:!1});return[l,u,h].join(".")}function xv(t){const e=t.split(".");return e.length!==3?null:e}function yp(t){const e=xv(t);if(!e)return null;const n=new TextDecoder,r=Lr.decode(e[0],{strict:!1}),i=Lr.decode(e[1],{strict:!1}),s=JSON.parse(n.decode(r));if(typeof s!="object"||s===null||!("alg"in s)||!Av(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const l={algorithm:s.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;l.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;l.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;l.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const u of a.aud)if(typeof u!="string")return null;l.audiences=a.aud}else{if(typeof a.aud!="string")return null;l.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;l.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;l.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;l.jwtId=a.jti}return{value:t,header:{...s,typ:"JWT",alg:s.alg},payload:{...a},parts:e,...l}}function $v(t){return new bv(Ev[t])}function Av(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const Ev={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function Sv(){const t=new Uint8Array(32);return crypto.getRandomValues(t),Lr.encode(t,{includePadding:!1})}function kv(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 Nv(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await h_(n);return Lr.encode(new Uint8Array(r),{includePadding:!1})}const Lo=60*5,Nc=30*24*60*60,Ci=24*60*60,Cv="auth-token",ta=30*60*1e3,$u=7*24*60*60*1e3,Tv=5*60,Iv=5*60,Ov=30*60*1e3,zv=30*60*1e3,Dv=24*60*60*1e3;function y_(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 Rv(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),s=i[0],a=i[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(a))}return e}function wp(t){return`${t}-${Cv}`}function w_(t){if(!t)return;const[e]=t.split(":");if(!e||e==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(e))return;const n=e.split(".");return n.length>2?`.${n.slice(-2).join(".")}`:`.${e}`}function Is(t,e){return e?Rv(e).get(wp(t)):void 0}function Pv(t,e){return y_(wp(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?w_(e):void 0})}function Na(t,e,n){return y_(wp(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:Nc,sameSite:"none",domain:n?w_(n):void 0})}var vp={},Cc={};(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+"$"),s=function(l,u){const d=[];let p=u.exec(l);for(;p;){const h=[];h.startIndex=u.lastIndex-p[0].length;const g=p.length;for(let A=0;A<g;A++)h.push(p[A]);d.push(h),p=u.exec(l)}return d},a=function(l){const u=i.exec(l);return!(u===null||typeof u>"u")};t.isExist=function(l){return typeof l<"u"},t.isEmptyObject=function(l){return Object.keys(l).length===0},t.merge=function(l,u,d){if(u){const p=Object.keys(u),h=p.length;for(let g=0;g<h;g++)d==="strict"?l[p[g]]=[u[p[g]]]:l[p[g]]=u[p[g]]}},t.getValue=function(l){return t.isExist(l)?l:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(Cc);const bp=Cc,Bv={allowBooleanAttributes:!1,unpairedTags:[]};vp.validate=function(t,e){e=Object.assign({},Bv,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=gh(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=mh(t,s);continue}else{let l=!1;t[s]==="/"&&(l=!0,s++);let u="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
6
6
  `&&t[s]!=="\r";s++)u+=t[s];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),s--),!Hv(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Xe("InvalidTag",h,mt(t,s))}const d=Fv(t,s);if(d===!1)return Xe("InvalidAttr","Attributes for '"+u+"' have open quote.",mt(t,s));let p=d.value;if(s=d.index,p[p.length-1]==="/"){const h=s-p.length;p=p.substring(0,p.length-1);const g=_h(p,e);if(g===!0)r=!0;else return Xe(g.err.code,g.err.msg,mt(t,h+g.err.line))}else if(l)if(d.tagClosed){if(p.trim().length>0)return Xe("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",mt(t,a));if(n.length===0)return Xe("InvalidTag","Closing tag '"+u+"' has not been opened.",mt(t,a));{const h=n.pop();if(u!==h.tagName){let g=mt(t,h.tagStartPos);return Xe("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+u+"'.",mt(t,a))}n.length==0&&(i=!0)}}else return Xe("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",mt(t,s));else{const h=_h(p,e);if(h!==!0)return Xe(h.err.code,h.err.msg,mt(t,s-p.length+h.err.line));if(i===!0)return Xe("InvalidXml","Multiple possible root nodes found.",mt(t,s));e.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:a}),r=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=mh(t,s);continue}else if(t[s+1]==="?"){if(s=gh(t,++s),s.err)return s}else break;else if(t[s]==="&"){const h=qv(t,s);if(h==-1)return Xe("InvalidChar","char '&' is not expected.",mt(t,s));s=h}else if(i===!0&&!hh(t[s]))return Xe("InvalidXml","Extra text at the end",mt(t,s));t[s]==="<"&&s--}}else{if(hh(t[s]))continue;return Xe("InvalidChar","char '"+t[s]+"' is not expected.",mt(t,s))}if(r){if(n.length==1)return Xe("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",mt(t,n[0].tagStartPos));if(n.length>0)return Xe("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Xe("InvalidXml","Start tag expected.",1);return!0};function hh(t){return t===" "||t===" "||t===`
7
7
  `||t==="\r"}function gh(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 Xe("InvalidXml","XML declaration allowed only at the start of the document.",mt(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function mh(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 jv='"',Lv="'";function Fv(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===jv||t[e]===Lv)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 Uv=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function _h(t,e){const n=bp.getAllMatches(t,Uv),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Xe("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",ds(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Xe("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",ds(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Xe("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",ds(n[i]));const s=n[i][2];if(!Vv(s))return Xe("InvalidAttr","Attribute '"+s+"' is an invalid name.",ds(n[i]));if(!r.hasOwnProperty(s))r[s]=1;else return Xe("InvalidAttr","Attribute '"+s+"' is repeated.",ds(n[i]))}return!0}function Mv(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 qv(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Mv(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 Xe(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Vv(t){return bp.isName(t)}function Hv(t){return bp.isName(t)}function mt(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function ds(t){return t.startIndex+t[1].length}var xp={};const v_={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}},Kv=function(t){return Object.assign({},v_,t)};xp.buildOptions=Kv;xp.defaultOptions=v_;class Gv{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 Wv=Gv;const Xv=Cc;function Jv(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,s=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!s){if(i&&Qv(t,e)){e+=7;let l,u;[l,u,e]=Yv(t,e+1),u.indexOf("&")===-1&&(n[rb(l)]={regx:RegExp(`&${l};`,"g"),val:u})}else if(i&&eb(t,e))e+=8;else if(i&&tb(t,e))e+=8;else if(i&&nb(t,e))e+=9;else if(Zv)s=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(s?t[e-1]==="-"&&t[e-2]==="-"&&(s=!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 Yv(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 Zv(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Qv(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 eb(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 tb(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 nb(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 rb(t){if(Xv.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var ib=Jv;const sb=/^[-+]?0x[a-fA-F0-9]+$/,ob=/^([\-\+])?(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 ab={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function cb(t,e={}){if(e=Object.assign({},ab,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&&sb.test(n))return Number.parseInt(n,16);{const r=ob.exec(n);if(r){const i=r[1],s=r[2];let a=lb(r[3]);const l=r[4]||r[6];if(!e.leadingZeros&&s.length>0&&i&&n[2]!==".")return t;if(!e.leadingZeros&&s.length>0&&!i&&n[1]!==".")return t;{const u=Number(n),d=""+u;return d.search(/[eE]/)!==-1||l?e.eNotation?u:t:n.indexOf(".")!==-1?d==="0"&&a===""||d===a||i&&d==="-"+a?u:t:s?a===d||i+a===d?u:t:n===d||n===i+d?u:t}}else return t}}function lb(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 ub=cb;function db(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 b_=db;const x_=Cc,ps=Wv,pb=ib,fb=ub,hb=b_;let gb=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=mb,this.parseXml=bb,this.parseTextData=_b,this.resolveNameSpace=yb,this.buildAttributesMap=vb,this.isItStopNode=Eb,this.replaceEntitiesValue=$b,this.readStopNodeData=kb,this.saveTextToParentTag=Ab,this.addChild=xb,this.ignoreAttributesFn=hb(this.options.ignoreAttributes)}};function mb(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 _b(t,e,n,r,i,s,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const l=this.options.tagValueProcessor(e,t,n,i,s);return l==null?t:typeof l!=typeof t||l!==t?l:this.options.trimValues?Eu(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Eu(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function yb(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 wb=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function vb(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=x_.getAllMatches(t,wb),i=r.length,s={};for(let a=0;a<i;a++){const l=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(l,e))continue;let u=r[a][4],d=this.options.attributeNamePrefix+l;if(l.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);const p=this.options.attributeValueProcessor(l,u,e);p==null?s[d]=u:typeof p!=typeof u||p!==u?s[d]=p:s[d]=Eu(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[d]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const bb=function(t){t=t.replace(/\r\n?/g,`
8
8
  `);const e=new ps("!xml");let n=e,r="",i="";for(let s=0;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="/"){const l=Br(t,">",s,"Closing Tag is not closed.");let u=t.substring(s+2,l).trim();if(this.options.removeNSPrefix){const h=u.indexOf(":");h!==-1&&(u=u.substr(h+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,i));const d=i.substring(i.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(p=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=i.lastIndexOf("."),i=i.substring(0,p),n=this.tagsNodeStack.pop(),r="",s=l}else if(t[s+1]==="?"){let l=Au(t,s,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new ps(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,i,l.tagName)),this.addChild(n,u,i)}s=l.closeIndex+1}else if(t.substr(s+1,3)==="!--"){const l=Br(t,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const u=t.substring(s+4,l-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}s=l}else if(t.substr(s+1,2)==="!D"){const l=pb(t,s);this.docTypeEntities=l.entities,s=l.i}else if(t.substr(s+1,2)==="!["){const l=Br(t,"]]>",s,"CDATA is not closed.")-2,u=t.substring(s+9,l);r=this.saveTextToParentTag(r,n,i);let d=this.parseTextData(u,n.tagname,i,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),s=l+2}else{let l=Au(t,s,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let p=l.tagExp,h=l.attrExpPresent,g=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const A=n;if(A&&this.options.unpairedTags.indexOf(A.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),u!==e.tagname&&(i+=i?"."+u:u),this.isItStopNode(this.options.stopNodes,i,u)){let $="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),p=u):p=p.substr(0,p.length-1),s=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)s=l.closeIndex;else{const R=this.readStopNodeData(t,d,g+1);if(!R)throw new Error(`Unexpected end of ${d}`);s=R.i,$=R.tagContent}const I=new ps(u);u!==p&&h&&(I[":@"]=this.buildAttributesMap(p,i,u)),$&&($=this.parseTextData($,u,i,!0,h,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),I.add(this.options.textNodeName,$),this.addChild(n,I,i)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const $=new ps(u);u!==p&&h&&($[":@"]=this.buildAttributesMap(p,i,u)),this.addChild(n,$,i),i=i.substr(0,i.lastIndexOf("."))}else{const $=new ps(u);this.tagsNodeStack.push(n),u!==p&&h&&($[":@"]=this.buildAttributesMap(p,i,u)),this.addChild(n,$,i),n=$}r="",s=g}}else r+=t[s];return e.child};function xb(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const $b=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 Ab(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 Eb(t,e,n){const r="*."+n;for(const i in t){const s=t[i];if(r===s||e===s)return!0}return!1}function Sb(t,e,n=">"){let r,i="";for(let s=e;s<t.length;s++){let a=t[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(t[s+1]===n[1])return{data:i,index:s}}else return{data:i,index:s};else a===" "&&(a=" ");i+=a}}function Br(t,e,n,r){const i=t.indexOf(e,n);if(i===-1)throw new Error(r);return i+e.length-1}function Au(t,e,n,r=">"){const i=Sb(t,e+1,r);if(!i)return;let s=i.data;const a=i.index,l=s.search(/\s/);let u=s,d=!0;l!==-1&&(u=s.substring(0,l),s=s.substring(l+1).trimStart());const p=u;if(n){const h=u.indexOf(":");h!==-1&&(u=u.substr(h+1),d=u!==i.data.substr(h+1))}return{tagName:u,tagExp:s,closeIndex:a,attrExpPresent:d,rawTagName:p}}function kb(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const s=Br(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:s};n=s}else if(t[n+1]==="?")n=Br(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=Br(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=Br(t,"]]>",n,"StopNode is not closed.")-2;else{const s=Au(t,n,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,n=s.closeIndex)}}function Eu(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:fb(t,n)}else return x_.isExist(t)?t:""}var Nb=gb,$_={};function Cb(t,e){return A_(t,e)}function A_(t,e,n){let r;const i={};for(let s=0;s<t.length;s++){const a=t[s],l=Tb(a);let u="";if(n===void 0?u=l:u=n+"."+l,l===e.textNodeName)r===void 0?r=a[l]:r+=""+a[l];else{if(l===void 0)continue;if(a[l]){let d=A_(a[l],e,u);const p=Ob(d,e);a[":@"]?Ib(d,a[":@"],u,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),i[l]!==void 0&&i.hasOwnProperty(l)?(Array.isArray(i[l])||(i[l]=[i[l]]),i[l].push(d)):e.isArray(l,u,p)?i[l]=[d]:i[l]=d}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function Tb(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Ib(t,e,n,r){if(e){const i=Object.keys(e),s=i.length;for(let a=0;a<s;a++){const l=i[a];r.isArray(l,n+"."+l,!0,!0)?t[l]=[e[l]]:t[l]=e[l]}}}function Ob(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))}$_.prettify=Cb;const{buildOptions:zb}=xp,Db=Nb,{prettify:Rb}=$_,Pb=vp;let Bb=class{constructor(e){this.externalEntities={},this.options=zb(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 s=Pb.validate(e,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new Db(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Rb(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 '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}};var jb=Bb;const Lb=`
@@ -82,7 +82,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
82
82
 
83
83
  See the Apache Version 2.0 License for specific language governing permissions
84
84
  and limitations under the License.
85
- ***************************************************************************** */var $h;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof Pr=="object"?Pr:typeof self=="object"?self:typeof this=="object"?this:l(),r=i(t);typeof n.Reflect<"u"&&(r=i(n.Reflect,r)),e(r,n),typeof n.Reflect>"u"&&(n.Reflect=t);function i(u,d){return function(p,h){Object.defineProperty(u,p,{configurable:!0,writable:!0,value:h}),d&&d(p,h)}}function s(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function l(){return s()||a()}})(function(e,n){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",l=typeof Object.create=="function",u={__proto__:[]}instanceof Array,d=!l&&!u,p={create:l?function(){return wn(Object.create(null))}:u?function(){return wn({__proto__:null})}:function(){return wn({})},has:d?function(O,T){return r.call(O,T)}:function(O,T){return T in O},get:d?function(O,T){return r.call(O,T)?O[T]:void 0}:function(O,T){return O[T]}},h=Object.getPrototypeOf(Function),g=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ae(),A=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ht(),$=typeof WeakMap=="function"?WeakMap:Dt(),I=i?Symbol.for("@reflect-metadata:registry"):void 0,R=yn(),D=vt(R);function x(O,T,U,ee){if(Z(U)){if(!Ot(O))throw new TypeError;if(!he(T))throw new TypeError;return j(O,T)}else{if(!Ot(O))throw new TypeError;if(!Be(T))throw new TypeError;if(!Be(ee)&&!Z(ee)&&!ye(ee))throw new TypeError;return ye(ee)&&(ee=void 0),U=Ze(U),z(O,T,U,ee)}}e("decorate",x);function M(O,T){function U(ee,we){if(!Be(ee))throw new TypeError;if(!Z(we)&&!ge(we))throw new TypeError;ue(O,T,ee,we)}return U}e("metadata",M);function G(O,T,U,ee){if(!Be(U))throw new TypeError;return Z(ee)||(ee=Ze(ee)),ue(O,T,U,ee)}e("defineMetadata",G);function F(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),k(O,T,U)}e("hasMetadata",F);function H(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),S(O,T,U)}e("hasOwnMetadata",H);function X(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),B(O,T,U)}e("getMetadata",X);function Y(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),V(O,T,U)}e("getOwnMetadata",Y);function fe(O,T){if(!Be(O))throw new TypeError;return Z(T)||(T=Ze(T)),re(O,T)}e("getMetadataKeys",fe);function Ce(O,T){if(!Be(O))throw new TypeError;return Z(T)||(T=Ze(T)),ve(O,T)}e("getOwnMetadataKeys",Ce);function P(O,T,U){if(!Be(T))throw new TypeError;if(Z(U)||(U=Ze(U)),!Be(T))throw new TypeError;Z(U)||(U=Ze(U));var ee=me(T,U,!1);return Z(ee)?!1:ee.OrdinaryDeleteMetadata(O,T,U)}e("deleteMetadata",P);function j(O,T){for(var U=O.length-1;U>=0;--U){var ee=O[U],we=ee(T);if(!Z(we)&&!ye(we)){if(!he(we))throw new TypeError;T=we}}return T}function z(O,T,U,ee){for(var we=O.length-1;we>=0;--we){var Qe=O[we],Re=Qe(T,U,ee);if(!Z(Re)&&!ye(Re)){if(!Be(Re))throw new TypeError;ee=Re}}return ee}function k(O,T,U){var ee=S(O,T,U);if(ee)return!0;var we=zt(T);return ye(we)?!1:k(O,we,U)}function S(O,T,U){var ee=me(T,U,!1);return Z(ee)?!1:Q(ee.OrdinaryHasOwnMetadata(O,T,U))}function B(O,T,U){var ee=S(O,T,U);if(ee)return V(O,T,U);var we=zt(T);if(!ye(we))return B(O,we,U)}function V(O,T,U){var ee=me(T,U,!1);if(!Z(ee))return ee.OrdinaryGetOwnMetadata(O,T,U)}function ue(O,T,U,ee){var we=me(U,ee,!0);we.OrdinaryDefineOwnMetadata(O,T,U,ee)}function re(O,T){var U=ve(O,T),ee=zt(O);if(ee===null)return U;var we=re(ee,T);if(we.length<=0)return U;if(U.length<=0)return we;for(var Qe=new A,Re=[],c=0,f=U;c<f.length;c++){var _=f[c],b=Qe.has(_);b||(Qe.add(_),Re.push(_))}for(var v=0,E=we;v<E.length;v++){var _=E[v],b=Qe.has(_);b||(Qe.add(_),Re.push(_))}return Re}function ve(O,T){var U=me(O,T,!1);return U?U.OrdinaryOwnMetadataKeys(O,T):[]}function Se(O){if(O===null)return 1;switch(typeof O){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return O===null?1:6;default:return 6}}function Z(O){return O===void 0}function ye(O){return O===null}function Rn(O){return typeof O=="symbol"}function Be(O){return typeof O=="object"?O!==null:typeof O=="function"}function He(O,T){switch(Se(O)){case 0:return O;case 1:return O;case 2:return O;case 3:return O;case 4:return O;case 5:return O}var U="string",ee=Po(O,s);if(ee!==void 0){var we=ee.call(O,U);if(Be(we))throw new TypeError;return we}return Zt(O)}function Zt(O,T){var U,ee;{var we=O.toString;if(Fe(we)){var ee=we.call(O);if(!Be(ee))return ee}var U=O.valueOf;if(Fe(U)){var ee=U.call(O);if(!Be(ee))return ee}}throw new TypeError}function Q(O){return!!O}function se(O){return""+O}function Ze(O){var T=He(O);return Rn(T)?T:se(T)}function Ot(O){return Array.isArray?Array.isArray(O):O instanceof Object?O instanceof Array:Object.prototype.toString.call(O)==="[object Array]"}function Fe(O){return typeof O=="function"}function he(O){return typeof O=="function"}function ge(O){switch(Se(O)){case 3:return!0;case 4:return!0;default:return!1}}function ls(O,T){return O===T||O!==O&&T!==T}function Po(O,T){var U=O[T];if(U!=null){if(!Fe(U))throw new TypeError;return U}}function de(O){var T=Po(O,a);if(!Fe(T))throw new TypeError;var U=T.call(O);if(!Be(U))throw new TypeError;return U}function at(O){return O.value}function Bo(O){var T=O.next();return T.done?!1:T}function oe(O){var T=O.return;T&&T.call(O)}function zt(O){var T=Object.getPrototypeOf(O);if(typeof O!="function"||O===h||T!==h)return T;var U=O.prototype,ee=U&&Object.getPrototypeOf(U);if(ee==null||ee===Object.prototype)return T;var we=ee.constructor;return typeof we!="function"||we===O?T:we}function Vt(){var O;!Z(I)&&typeof n.Reflect<"u"&&!(I in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(O=Qt(n.Reflect));var T,U,ee,we=new $,Qe={registerProvider:Re,getProvider:f,setProvider:b};return Qe;function Re(v){if(!Object.isExtensible(Qe))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case O===v:break;case Z(T):T=v;break;case T===v:break;case Z(U):U=v;break;case U===v:break;default:ee===void 0&&(ee=new A),ee.add(v);break}}function c(v,E){if(!Z(T)){if(T.isProviderFor(v,E))return T;if(!Z(U)){if(U.isProviderFor(v,E))return T;if(!Z(ee))for(var K=de(ee);;){var _e=Bo(K);if(!_e)return;var Ne=at(_e);if(Ne.isProviderFor(v,E))return oe(K),Ne}}}if(!Z(O)&&O.isProviderFor(v,E))return O}function f(v,E){var K=we.get(v),_e;return Z(K)||(_e=K.get(E)),Z(_e)&&(_e=c(v,E),Z(_e)||(Z(K)&&(K=new g,we.set(v,K)),K.set(E,_e))),_e}function _(v){if(Z(v))throw new TypeError;return T===v||U===v||!Z(ee)&&ee.has(v)}function b(v,E,K){if(!_(K))throw new Error("Metadata provider not registered.");var _e=f(v,E);if(_e!==K){if(!Z(_e))return!1;var Ne=we.get(v);Z(Ne)&&(Ne=new g,we.set(v,Ne)),Ne.set(E,K)}return!0}}function yn(){var O;return!Z(I)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&(O=n.Reflect[I]),Z(O)&&(O=Vt()),!Z(I)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,I,{enumerable:!1,configurable:!1,writable:!1,value:O}),O}function vt(O){var T=new $,U={isProviderFor:function(_,b){var v=T.get(_);return Z(v)?!1:v.has(b)},OrdinaryDefineOwnMetadata:Re,OrdinaryHasOwnMetadata:we,OrdinaryGetOwnMetadata:Qe,OrdinaryOwnMetadataKeys:c,OrdinaryDeleteMetadata:f};return R.registerProvider(U),U;function ee(_,b,v){var E=T.get(_),K=!1;if(Z(E)){if(!v)return;E=new g,T.set(_,E),K=!0}var _e=E.get(b);if(Z(_e)){if(!v)return;if(_e=new g,E.set(b,_e),!O.setProvider(_,b,U))throw E.delete(b),K&&T.delete(_),new Error("Wrong provider for target.")}return _e}function we(_,b,v){var E=ee(b,v,!1);return Z(E)?!1:Q(E.has(_))}function Qe(_,b,v){var E=ee(b,v,!1);if(!Z(E))return E.get(_)}function Re(_,b,v,E){var K=ee(v,E,!0);K.set(_,b)}function c(_,b){var v=[],E=ee(_,b,!1);if(Z(E))return v;for(var K=E.keys(),_e=de(K),Ne=0;;){var ie=Bo(_e);if(!ie)return v.length=Ne,v;var Ae=at(ie);try{v[Ne]=Ae}catch(bt){try{oe(_e)}finally{throw bt}}Ne++}}function f(_,b,v){var E=ee(b,v,!1);if(Z(E)||!E.delete(_))return!1;if(E.size===0){var K=T.get(b);Z(K)||(K.delete(v),K.size===0&&T.delete(K))}return!0}}function Qt(O){var T=O.defineMetadata,U=O.hasOwnMetadata,ee=O.getOwnMetadata,we=O.getOwnMetadataKeys,Qe=O.deleteMetadata,Re=new $,c={isProviderFor:function(f,_){var b=Re.get(f);return!Z(b)&&b.has(_)?!0:we(f,_).length?(Z(b)&&(b=new A,Re.set(f,b)),b.add(_),!0):!1},OrdinaryDefineOwnMetadata:T,OrdinaryHasOwnMetadata:U,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:we,OrdinaryDeleteMetadata:Qe};return c}function me(O,T,U){var ee=R.getProvider(O,T);if(!Z(ee))return ee;if(U){if(R.setProvider(O,T,D))return D;throw new Error("Illegal state.")}}function ae(){var O={},T=[],U=function(){function c(f,_,b){this._index=0,this._keys=f,this._values=_,this._selector=b}return c.prototype["@@iterator"]=function(){return this},c.prototype[a]=function(){return this},c.prototype.next=function(){var f=this._index;if(f>=0&&f<this._keys.length){var _=this._selector(this._keys[f],this._values[f]);return f+1>=this._keys.length?(this._index=-1,this._keys=T,this._values=T):this._index++,{value:_,done:!1}}return{value:void 0,done:!0}},c.prototype.throw=function(f){throw this._index>=0&&(this._index=-1,this._keys=T,this._values=T),f},c.prototype.return=function(f){return this._index>=0&&(this._index=-1,this._keys=T,this._values=T),{value:f,done:!0}},c}(),ee=function(){function c(){this._keys=[],this._values=[],this._cacheKey=O,this._cacheIndex=-2}return Object.defineProperty(c.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),c.prototype.has=function(f){return this._find(f,!1)>=0},c.prototype.get=function(f){var _=this._find(f,!1);return _>=0?this._values[_]:void 0},c.prototype.set=function(f,_){var b=this._find(f,!0);return this._values[b]=_,this},c.prototype.delete=function(f){var _=this._find(f,!1);if(_>=0){for(var b=this._keys.length,v=_+1;v<b;v++)this._keys[v-1]=this._keys[v],this._values[v-1]=this._values[v];return this._keys.length--,this._values.length--,ls(f,this._cacheKey)&&(this._cacheKey=O,this._cacheIndex=-2),!0}return!1},c.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=O,this._cacheIndex=-2},c.prototype.keys=function(){return new U(this._keys,this._values,we)},c.prototype.values=function(){return new U(this._keys,this._values,Qe)},c.prototype.entries=function(){return new U(this._keys,this._values,Re)},c.prototype["@@iterator"]=function(){return this.entries()},c.prototype[a]=function(){return this.entries()},c.prototype._find=function(f,_){if(!ls(this._cacheKey,f)){this._cacheIndex=-1;for(var b=0;b<this._keys.length;b++)if(ls(this._keys[b],f)){this._cacheIndex=b;break}}return this._cacheIndex<0&&_&&(this._cacheIndex=this._keys.length,this._keys.push(f),this._values.push(void 0)),this._cacheIndex},c}();return ee;function we(c,f){return c}function Qe(c,f){return f}function Re(c,f){return[c,f]}}function Ht(){var O=function(){function T(){this._map=new g}return Object.defineProperty(T.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),T.prototype.has=function(U){return this._map.has(U)},T.prototype.add=function(U){return this._map.set(U,U),this},T.prototype.delete=function(U){return this._map.delete(U)},T.prototype.clear=function(){this._map.clear()},T.prototype.keys=function(){return this._map.keys()},T.prototype.values=function(){return this._map.keys()},T.prototype.entries=function(){return this._map.entries()},T.prototype["@@iterator"]=function(){return this.keys()},T.prototype[a]=function(){return this.keys()},T}();return O}function Dt(){var O=16,T=p.create(),U=ee();return function(){function f(){this._key=ee()}return f.prototype.has=function(_){var b=we(_,!1);return b!==void 0?p.has(b,this._key):!1},f.prototype.get=function(_){var b=we(_,!1);return b!==void 0?p.get(b,this._key):void 0},f.prototype.set=function(_,b){var v=we(_,!0);return v[this._key]=b,this},f.prototype.delete=function(_){var b=we(_,!1);return b!==void 0?delete b[this._key]:!1},f.prototype.clear=function(){this._key=ee()},f}();function ee(){var f;do f="@@WeakMap@@"+c();while(p.has(T,f));return T[f]=!0,f}function we(f,_){if(!r.call(f,U)){if(!_)return;Object.defineProperty(f,U,{value:p.create()})}return f[U]}function Qe(f,_){for(var b=0;b<_;++b)f[b]=Math.random()*255|0;return f}function Re(f){if(typeof Uint8Array=="function"){var _=new Uint8Array(f);return typeof crypto<"u"?crypto.getRandomValues(_):typeof msCrypto<"u"?msCrypto.getRandomValues(_):Qe(_,f),_}return Qe(new Array(f),f)}function c(){var f=Re(O);f[6]=f[6]&79|64,f[8]=f[8]&191|128;for(var _="",b=0;b<O;++b){var v=f[b];(b===4||b===6||b===8)&&(_+="-"),v<16&&(_+="0"),_+=v.toString(16).toLowerCase()}return _}}function wn(O){return O.__=void 0,delete O.__,O}})})($h||($h={}));/*!
85
+ ***************************************************************************** */var $h;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof Pr=="object"?Pr:typeof self=="object"?self:typeof this=="object"?this:l(),r=i(t);typeof n.Reflect<"u"&&(r=i(n.Reflect,r)),e(r,n),typeof n.Reflect>"u"&&(n.Reflect=t);function i(u,d){return function(p,h){Object.defineProperty(u,p,{configurable:!0,writable:!0,value:h}),d&&d(p,h)}}function s(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function l(){return s()||a()}})(function(e,n){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",l=typeof Object.create=="function",u={__proto__:[]}instanceof Array,d=!l&&!u,p={create:l?function(){return wn(Object.create(null))}:u?function(){return wn({__proto__:null})}:function(){return wn({})},has:d?function(O,T){return r.call(O,T)}:function(O,T){return T in O},get:d?function(O,T){return r.call(O,T)?O[T]:void 0}:function(O,T){return O[T]}},h=Object.getPrototypeOf(Function),g=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ae(),A=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ht(),$=typeof WeakMap=="function"?WeakMap:Dt(),I=i?Symbol.for("@reflect-metadata:registry"):void 0,R=yn(),D=vt(R);function x(O,T,U,ee){if(Z(U)){if(!Ot(O))throw new TypeError;if(!he(T))throw new TypeError;return j(O,T)}else{if(!Ot(O))throw new TypeError;if(!Be(T))throw new TypeError;if(!Be(ee)&&!Z(ee)&&!ye(ee))throw new TypeError;return ye(ee)&&(ee=void 0),U=Ze(U),z(O,T,U,ee)}}e("decorate",x);function M(O,T){function U(ee,we){if(!Be(ee))throw new TypeError;if(!Z(we)&&!ge(we))throw new TypeError;de(O,T,ee,we)}return U}e("metadata",M);function G(O,T,U,ee){if(!Be(U))throw new TypeError;return Z(ee)||(ee=Ze(ee)),de(O,T,U,ee)}e("defineMetadata",G);function F(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),k(O,T,U)}e("hasMetadata",F);function H(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),S(O,T,U)}e("hasOwnMetadata",H);function W(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),B(O,T,U)}e("getMetadata",W);function Y(O,T,U){if(!Be(T))throw new TypeError;return Z(U)||(U=Ze(U)),V(O,T,U)}e("getOwnMetadata",Y);function ue(O,T){if(!Be(O))throw new TypeError;return Z(T)||(T=Ze(T)),re(O,T)}e("getMetadataKeys",ue);function Ce(O,T){if(!Be(O))throw new TypeError;return Z(T)||(T=Ze(T)),ve(O,T)}e("getOwnMetadataKeys",Ce);function P(O,T,U){if(!Be(T))throw new TypeError;if(Z(U)||(U=Ze(U)),!Be(T))throw new TypeError;Z(U)||(U=Ze(U));var ee=me(T,U,!1);return Z(ee)?!1:ee.OrdinaryDeleteMetadata(O,T,U)}e("deleteMetadata",P);function j(O,T){for(var U=O.length-1;U>=0;--U){var ee=O[U],we=ee(T);if(!Z(we)&&!ye(we)){if(!he(we))throw new TypeError;T=we}}return T}function z(O,T,U,ee){for(var we=O.length-1;we>=0;--we){var Qe=O[we],Re=Qe(T,U,ee);if(!Z(Re)&&!ye(Re)){if(!Be(Re))throw new TypeError;ee=Re}}return ee}function k(O,T,U){var ee=S(O,T,U);if(ee)return!0;var we=zt(T);return ye(we)?!1:k(O,we,U)}function S(O,T,U){var ee=me(T,U,!1);return Z(ee)?!1:Q(ee.OrdinaryHasOwnMetadata(O,T,U))}function B(O,T,U){var ee=S(O,T,U);if(ee)return V(O,T,U);var we=zt(T);if(!ye(we))return B(O,we,U)}function V(O,T,U){var ee=me(T,U,!1);if(!Z(ee))return ee.OrdinaryGetOwnMetadata(O,T,U)}function de(O,T,U,ee){var we=me(U,ee,!0);we.OrdinaryDefineOwnMetadata(O,T,U,ee)}function re(O,T){var U=ve(O,T),ee=zt(O);if(ee===null)return U;var we=re(ee,T);if(we.length<=0)return U;if(U.length<=0)return we;for(var Qe=new A,Re=[],c=0,f=U;c<f.length;c++){var _=f[c],b=Qe.has(_);b||(Qe.add(_),Re.push(_))}for(var v=0,E=we;v<E.length;v++){var _=E[v],b=Qe.has(_);b||(Qe.add(_),Re.push(_))}return Re}function ve(O,T){var U=me(O,T,!1);return U?U.OrdinaryOwnMetadataKeys(O,T):[]}function Se(O){if(O===null)return 1;switch(typeof O){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return O===null?1:6;default:return 6}}function Z(O){return O===void 0}function ye(O){return O===null}function Rn(O){return typeof O=="symbol"}function Be(O){return typeof O=="object"?O!==null:typeof O=="function"}function He(O,T){switch(Se(O)){case 0:return O;case 1:return O;case 2:return O;case 3:return O;case 4:return O;case 5:return O}var U="string",ee=Po(O,s);if(ee!==void 0){var we=ee.call(O,U);if(Be(we))throw new TypeError;return we}return Zt(O)}function Zt(O,T){var U,ee;{var we=O.toString;if(Fe(we)){var ee=we.call(O);if(!Be(ee))return ee}var U=O.valueOf;if(Fe(U)){var ee=U.call(O);if(!Be(ee))return ee}}throw new TypeError}function Q(O){return!!O}function se(O){return""+O}function Ze(O){var T=He(O);return Rn(T)?T:se(T)}function Ot(O){return Array.isArray?Array.isArray(O):O instanceof Object?O instanceof Array:Object.prototype.toString.call(O)==="[object Array]"}function Fe(O){return typeof O=="function"}function he(O){return typeof O=="function"}function ge(O){switch(Se(O)){case 3:return!0;case 4:return!0;default:return!1}}function ls(O,T){return O===T||O!==O&&T!==T}function Po(O,T){var U=O[T];if(U!=null){if(!Fe(U))throw new TypeError;return U}}function pe(O){var T=Po(O,a);if(!Fe(T))throw new TypeError;var U=T.call(O);if(!Be(U))throw new TypeError;return U}function at(O){return O.value}function Bo(O){var T=O.next();return T.done?!1:T}function oe(O){var T=O.return;T&&T.call(O)}function zt(O){var T=Object.getPrototypeOf(O);if(typeof O!="function"||O===h||T!==h)return T;var U=O.prototype,ee=U&&Object.getPrototypeOf(U);if(ee==null||ee===Object.prototype)return T;var we=ee.constructor;return typeof we!="function"||we===O?T:we}function Vt(){var O;!Z(I)&&typeof n.Reflect<"u"&&!(I in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(O=Qt(n.Reflect));var T,U,ee,we=new $,Qe={registerProvider:Re,getProvider:f,setProvider:b};return Qe;function Re(v){if(!Object.isExtensible(Qe))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case O===v:break;case Z(T):T=v;break;case T===v:break;case Z(U):U=v;break;case U===v:break;default:ee===void 0&&(ee=new A),ee.add(v);break}}function c(v,E){if(!Z(T)){if(T.isProviderFor(v,E))return T;if(!Z(U)){if(U.isProviderFor(v,E))return T;if(!Z(ee))for(var K=pe(ee);;){var _e=Bo(K);if(!_e)return;var Ne=at(_e);if(Ne.isProviderFor(v,E))return oe(K),Ne}}}if(!Z(O)&&O.isProviderFor(v,E))return O}function f(v,E){var K=we.get(v),_e;return Z(K)||(_e=K.get(E)),Z(_e)&&(_e=c(v,E),Z(_e)||(Z(K)&&(K=new g,we.set(v,K)),K.set(E,_e))),_e}function _(v){if(Z(v))throw new TypeError;return T===v||U===v||!Z(ee)&&ee.has(v)}function b(v,E,K){if(!_(K))throw new Error("Metadata provider not registered.");var _e=f(v,E);if(_e!==K){if(!Z(_e))return!1;var Ne=we.get(v);Z(Ne)&&(Ne=new g,we.set(v,Ne)),Ne.set(E,K)}return!0}}function yn(){var O;return!Z(I)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&(O=n.Reflect[I]),Z(O)&&(O=Vt()),!Z(I)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,I,{enumerable:!1,configurable:!1,writable:!1,value:O}),O}function vt(O){var T=new $,U={isProviderFor:function(_,b){var v=T.get(_);return Z(v)?!1:v.has(b)},OrdinaryDefineOwnMetadata:Re,OrdinaryHasOwnMetadata:we,OrdinaryGetOwnMetadata:Qe,OrdinaryOwnMetadataKeys:c,OrdinaryDeleteMetadata:f};return R.registerProvider(U),U;function ee(_,b,v){var E=T.get(_),K=!1;if(Z(E)){if(!v)return;E=new g,T.set(_,E),K=!0}var _e=E.get(b);if(Z(_e)){if(!v)return;if(_e=new g,E.set(b,_e),!O.setProvider(_,b,U))throw E.delete(b),K&&T.delete(_),new Error("Wrong provider for target.")}return _e}function we(_,b,v){var E=ee(b,v,!1);return Z(E)?!1:Q(E.has(_))}function Qe(_,b,v){var E=ee(b,v,!1);if(!Z(E))return E.get(_)}function Re(_,b,v,E){var K=ee(v,E,!0);K.set(_,b)}function c(_,b){var v=[],E=ee(_,b,!1);if(Z(E))return v;for(var K=E.keys(),_e=pe(K),Ne=0;;){var ie=Bo(_e);if(!ie)return v.length=Ne,v;var Ae=at(ie);try{v[Ne]=Ae}catch(bt){try{oe(_e)}finally{throw bt}}Ne++}}function f(_,b,v){var E=ee(b,v,!1);if(Z(E)||!E.delete(_))return!1;if(E.size===0){var K=T.get(b);Z(K)||(K.delete(v),K.size===0&&T.delete(K))}return!0}}function Qt(O){var T=O.defineMetadata,U=O.hasOwnMetadata,ee=O.getOwnMetadata,we=O.getOwnMetadataKeys,Qe=O.deleteMetadata,Re=new $,c={isProviderFor:function(f,_){var b=Re.get(f);return!Z(b)&&b.has(_)?!0:we(f,_).length?(Z(b)&&(b=new A,Re.set(f,b)),b.add(_),!0):!1},OrdinaryDefineOwnMetadata:T,OrdinaryHasOwnMetadata:U,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:we,OrdinaryDeleteMetadata:Qe};return c}function me(O,T,U){var ee=R.getProvider(O,T);if(!Z(ee))return ee;if(U){if(R.setProvider(O,T,D))return D;throw new Error("Illegal state.")}}function ae(){var O={},T=[],U=function(){function c(f,_,b){this._index=0,this._keys=f,this._values=_,this._selector=b}return c.prototype["@@iterator"]=function(){return this},c.prototype[a]=function(){return this},c.prototype.next=function(){var f=this._index;if(f>=0&&f<this._keys.length){var _=this._selector(this._keys[f],this._values[f]);return f+1>=this._keys.length?(this._index=-1,this._keys=T,this._values=T):this._index++,{value:_,done:!1}}return{value:void 0,done:!0}},c.prototype.throw=function(f){throw this._index>=0&&(this._index=-1,this._keys=T,this._values=T),f},c.prototype.return=function(f){return this._index>=0&&(this._index=-1,this._keys=T,this._values=T),{value:f,done:!0}},c}(),ee=function(){function c(){this._keys=[],this._values=[],this._cacheKey=O,this._cacheIndex=-2}return Object.defineProperty(c.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),c.prototype.has=function(f){return this._find(f,!1)>=0},c.prototype.get=function(f){var _=this._find(f,!1);return _>=0?this._values[_]:void 0},c.prototype.set=function(f,_){var b=this._find(f,!0);return this._values[b]=_,this},c.prototype.delete=function(f){var _=this._find(f,!1);if(_>=0){for(var b=this._keys.length,v=_+1;v<b;v++)this._keys[v-1]=this._keys[v],this._values[v-1]=this._values[v];return this._keys.length--,this._values.length--,ls(f,this._cacheKey)&&(this._cacheKey=O,this._cacheIndex=-2),!0}return!1},c.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=O,this._cacheIndex=-2},c.prototype.keys=function(){return new U(this._keys,this._values,we)},c.prototype.values=function(){return new U(this._keys,this._values,Qe)},c.prototype.entries=function(){return new U(this._keys,this._values,Re)},c.prototype["@@iterator"]=function(){return this.entries()},c.prototype[a]=function(){return this.entries()},c.prototype._find=function(f,_){if(!ls(this._cacheKey,f)){this._cacheIndex=-1;for(var b=0;b<this._keys.length;b++)if(ls(this._keys[b],f)){this._cacheIndex=b;break}}return this._cacheIndex<0&&_&&(this._cacheIndex=this._keys.length,this._keys.push(f),this._values.push(void 0)),this._cacheIndex},c}();return ee;function we(c,f){return c}function Qe(c,f){return f}function Re(c,f){return[c,f]}}function Ht(){var O=function(){function T(){this._map=new g}return Object.defineProperty(T.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),T.prototype.has=function(U){return this._map.has(U)},T.prototype.add=function(U){return this._map.set(U,U),this},T.prototype.delete=function(U){return this._map.delete(U)},T.prototype.clear=function(){this._map.clear()},T.prototype.keys=function(){return this._map.keys()},T.prototype.values=function(){return this._map.keys()},T.prototype.entries=function(){return this._map.entries()},T.prototype["@@iterator"]=function(){return this.keys()},T.prototype[a]=function(){return this.keys()},T}();return O}function Dt(){var O=16,T=p.create(),U=ee();return function(){function f(){this._key=ee()}return f.prototype.has=function(_){var b=we(_,!1);return b!==void 0?p.has(b,this._key):!1},f.prototype.get=function(_){var b=we(_,!1);return b!==void 0?p.get(b,this._key):void 0},f.prototype.set=function(_,b){var v=we(_,!0);return v[this._key]=b,this},f.prototype.delete=function(_){var b=we(_,!1);return b!==void 0?delete b[this._key]:!1},f.prototype.clear=function(){this._key=ee()},f}();function ee(){var f;do f="@@WeakMap@@"+c();while(p.has(T,f));return T[f]=!0,f}function we(f,_){if(!r.call(f,U)){if(!_)return;Object.defineProperty(f,U,{value:p.create()})}return f[U]}function Qe(f,_){for(var b=0;b<_;++b)f[b]=Math.random()*255|0;return f}function Re(f){if(typeof Uint8Array=="function"){var _=new Uint8Array(f);return typeof crypto<"u"?crypto.getRandomValues(_):typeof msCrypto<"u"?msCrypto.getRandomValues(_):Qe(_,f),_}return Qe(new Array(f),f)}function c(){var f=Re(O);f[6]=f[6]&79|64,f[8]=f[8]&191|128;for(var _="",b=0;b<O;++b){var v=f[b];(b===4||b===6||b===8)&&(_+="-"),v<16&&(_+="0"),_+=v.toString(16).toLowerCase()}return _}}function wn(O){return O.__=void 0,delete O.__,O}})})($h||($h={}));/*!
86
86
  * MIT License
87
87
  *
88
88
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC
@@ -105,7 +105,7 @@ and limitations under the License.
105
105
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
106
106
  * SOFTWARE.
107
107
  *
108
- */const m3="[object ArrayBuffer]";class ne{static isArrayBuffer(e){return Object.prototype.toString.call(e)===m3}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=ne.toUint8Array(e),i=ne.toUint8Array(n);if(r.length!==i.byteLength)return!1;for(let s=0;s<r.length;s++)if(r[s]!==i[s])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 s=0;for(const a of n){const l=this.toUint8Array(a);i.set(l,s),s+=l.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const Fl="string",_3=/^[0-9a-f\s]+$/i,y3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,w3=/^[a-zA-Z0-9-_]+$/;class Ah{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=ne.toUint8Array(e);let r="";for(let s=0;s<n.length;s++)r+=String.fromCharCode(n[s]);return decodeURIComponent(escape(r))}}class vn{static toString(e,n=!1){const r=ne.toArrayBuffer(e),i=new DataView(r);let s="";for(let a=0;a<r.byteLength;a+=2){const l=i.getUint16(a,n);s+=String.fromCharCode(l)}return s}static fromString(e,n=!1){const r=new ArrayBuffer(e.length*2),i=new DataView(r);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),n);return r}}class pe{static isHex(e){return typeof e===Fl&&_3.test(e)}static isBase64(e){return typeof e===Fl&&y3.test(e)}static isBase64Url(e){return typeof e===Fl&&w3.test(e)}static ToString(e,n="utf8"){const r=ne.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 vn.toString(r,!0);case"utf16":case"utf16be":return vn.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 vn.fromString(e,!0);case"utf16":case"utf16be":return vn.fromString(e);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToBase64(e){const n=ne.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(!pe.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(!pe.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=pe.DEFAULT_UTF8_ENCODING){switch(n){case"ascii":return this.FromBinary(e);case"utf8":return Ah.fromString(e);case"utf16":case"utf16be":return vn.fromString(e);case"utf16le":case"usc2":return vn.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToUtf8String(e,n=pe.DEFAULT_UTF8_ENCODING){switch(n){case"ascii":return this.ToBinary(e);case"utf8":return Ah.toString(e);case"utf16":case"utf16be":return vn.toString(e);case"utf16le":case"usc2":return vn.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=ne.toUint8Array(e);let r="";for(let i=0;i<n.length;i++)r+=String.fromCharCode(n[i]);return r}static ToHex(e){const n=ne.toUint8Array(e);let r="";const i=n.length;for(let s=0;s<i;s++){const a=n[s];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(!pe.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 s=n.slice(i,i+2);r[i/2]=parseInt(s,16)}return r.buffer}static ToUtf16String(e,n=!1){return vn.toString(e,n)}static FromUtf16String(e,n=!1){return vn.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,""))||""}}pe.DEFAULT_UTF8_ENCODING="utf8";function v3(...t){const e=t.map(i=>i.byteLength).reduce((i,s)=>i+s),n=new Uint8Array(e);let r=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(const s of i)n[r++]=s}),n.buffer}function O_(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}/*!
108
+ */const m3="[object ArrayBuffer]";class ne{static isArrayBuffer(e){return Object.prototype.toString.call(e)===m3}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=ne.toUint8Array(e),i=ne.toUint8Array(n);if(r.length!==i.byteLength)return!1;for(let s=0;s<r.length;s++)if(r[s]!==i[s])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 s=0;for(const a of n){const l=this.toUint8Array(a);i.set(l,s),s+=l.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const Fl="string",_3=/^[0-9a-f\s]+$/i,y3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,w3=/^[a-zA-Z0-9-_]+$/;class Ah{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=ne.toUint8Array(e);let r="";for(let s=0;s<n.length;s++)r+=String.fromCharCode(n[s]);return decodeURIComponent(escape(r))}}class vn{static toString(e,n=!1){const r=ne.toArrayBuffer(e),i=new DataView(r);let s="";for(let a=0;a<r.byteLength;a+=2){const l=i.getUint16(a,n);s+=String.fromCharCode(l)}return s}static fromString(e,n=!1){const r=new ArrayBuffer(e.length*2),i=new DataView(r);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),n);return r}}class fe{static isHex(e){return typeof e===Fl&&_3.test(e)}static isBase64(e){return typeof e===Fl&&y3.test(e)}static isBase64Url(e){return typeof e===Fl&&w3.test(e)}static ToString(e,n="utf8"){const r=ne.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 vn.toString(r,!0);case"utf16":case"utf16be":return vn.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 vn.fromString(e,!0);case"utf16":case"utf16be":return vn.fromString(e);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToBase64(e){const n=ne.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(!fe.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(!fe.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=fe.DEFAULT_UTF8_ENCODING){switch(n){case"ascii":return this.FromBinary(e);case"utf8":return Ah.fromString(e);case"utf16":case"utf16be":return vn.fromString(e);case"utf16le":case"usc2":return vn.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToUtf8String(e,n=fe.DEFAULT_UTF8_ENCODING){switch(n){case"ascii":return this.ToBinary(e);case"utf8":return Ah.toString(e);case"utf16":case"utf16be":return vn.toString(e);case"utf16le":case"usc2":return vn.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=ne.toUint8Array(e);let r="";for(let i=0;i<n.length;i++)r+=String.fromCharCode(n[i]);return r}static ToHex(e){const n=ne.toUint8Array(e);let r="";const i=n.length;for(let s=0;s<i;s++){const a=n[s];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(!fe.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 s=n.slice(i,i+2);r[i/2]=parseInt(s,16)}return r.buffer}static ToUtf16String(e,n=!1){return vn.toString(e,n)}static FromUtf16String(e,n=!1){return vn.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,""))||""}}fe.DEFAULT_UTF8_ENCODING="utf8";function v3(...t){const e=t.map(i=>i.byteLength).reduce((i,s)=>i+s),n=new Uint8Array(e);let r=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(const s of i)n[r++]=s}),n.buffer}function O_(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}/*!
109
109
  Copyright (c) Peculiar Ventures, LLC
110
110
  */function Ti(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 Mr(t,e,n=-1){const r=n;let i=t,s=0,a=Math.pow(2,e);for(let l=1;l<8;l++){if(t<a){let u;if(r<0)u=new ArrayBuffer(l),s=l;else{if(r<l)return new ArrayBuffer(0);u=new ArrayBuffer(r),s=r}const d=new Uint8Array(u);for(let p=l-1;p>=0;p--){const h=Math.pow(2,p*e);d[s-p-1]=Math.floor(i/h),i-=d[s-p-1]*h}return u}a*=Math.pow(2,e)}return new ArrayBuffer(0)}function ku(...t){let e=0,n=0;for(const s of t)e+=s.length;const r=new ArrayBuffer(e),i=new Uint8Array(r);for(const s of t)i.set(s,n),n+=s.length;return i}function z_(){const t=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const l=t[0]===255&&t[1]&128,u=t[0]===0&&(t[1]&128)===0;(l||u)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),n=new Uint8Array(e);for(let l=0;l<this.valueHex.byteLength;l++)n[l]=0;n[0]=t[0]&128;const r=Ti(n,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let l=0;l<this.valueHex.byteLength;l++)s[l]=t[l];return s[0]&=127,Ti(s,8)-r}function b3(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,l=Mr(a,8,r),u=new Uint8Array(l);return u[0]|=128,l}let i=Mr(e,8,r),s=new Uint8Array(i);if(s[0]&128){const a=i.slice(0),l=new Uint8Array(a);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let u=0;u<a.byteLength;u++)s[u+1]=l[u];s[0]=0}return i}n*=Math.pow(2,8)}return new ArrayBuffer(0)}function x3(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 Pt(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)}/*!
111
111
  * Copyright (c) 2014, GMO GlobalSign
@@ -139,11 +139,11 @@ and limitations under the License.
139
139
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
140
140
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
141
141
  *
142
- */function Ca(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Sp(t){let e=0,n=0;for(let i=0;i<t.length;i++){const s=t[i];e+=s.byteLength}const r=new Uint8Array(e);for(let i=0;i<t.length;i++){const s=t[i];r.set(new Uint8Array(s),n),n+=s.byteLength}return r.buffer}function Jn(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 Oc{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Sp(this.items)}}const fs=[new Uint8Array([1])],Eh="0123456789",Ul="name",Sh="valueHexView",$3="isHexOnly",A3="idBlock",E3="tagClass",S3="tagNumber",k3="isConstructed",N3="fromBER",C3="toBER",T3="local",At="",mn=new ArrayBuffer(0),zc=new Uint8Array(0),zs="EndOfContent",D_="OCTET STRING",R_="BIT STRING";function Tn(t){var e;return e=class extends t{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(r){this.valueHexView=new Uint8Array(r)}constructor(...r){var i;super(...r);const s=r[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?ne.toUint8Array(s.valueHex):zc}fromBER(r,i,s){const a=r instanceof ArrayBuffer?new Uint8Array(r):r;if(!Jn(this,a,i,s))return-1;const l=i+s;return this.valueHexView=a.subarray(i,l),this.valueHexView.length?(this.blockLength=s,l):(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",mn)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:pe.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class ii{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:n=At,warnings:r=[],valueBeforeDecode:i=zc}={}){this.blockLength=e,this.error=n,this.warnings=r,this.valueBeforeDecodeView=ne.toUint8Array(i)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:pe.ToHex(this.valueBeforeDecodeView)}}}ii.NAME="baseBlock";class yt extends ii{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'")}}yt.NAME="valueBlock";class P_ extends Tn(ii){constructor({idBlock:e={}}={}){var n,r,i,s;super(),e?(this.isHexOnly=(n=e.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=e.valueHex?ne.toUint8Array(e.valueHex):zc,this.tagClass=(r=e.tagClass)!==null&&r!==void 0?r:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!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",mn}if(this.isConstructed&&(n|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,n|=s,i[0]=n}return i.buffer}if(!this.isHexOnly){const i=Mr(this.tagNumber,7),s=new Uint8Array(i),a=i.byteLength,l=new Uint8Array(a+1);if(l[0]=n|31,!e){for(let u=0;u<a-1;u++)l[u+1]=s[u]|128;l[a]=s[a-1]}return l.buffer}const r=new Uint8Array(this.valueHexView.byteLength+1);if(r[0]=n|31,!e){const i=this.valueHexView;for(let s=0;s<i.length-1;s++)r[s+1]=i[s]|128;r[this.valueHexView.byteLength]=i[i.length-1]}return r.buffer}fromBER(e,n,r){const i=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[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=(s[0]&32)===32,this.isHexOnly=!1;const l=s[0]&31;if(l!==31)this.tagNumber=l,this.blockLength=1;else{let u=1,d=this.valueHexView=new Uint8Array(255),p=255;for(;s[u]&128;){if(d[u-1]=s[u]&127,u++,u>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(u===p){p+=255;const g=new Uint8Array(p);for(let A=0;A<d.length;A++)g[A]=d[A];d=this.valueHexView=new Uint8Array(p)}}this.blockLength=u+1,d[u-1]=s[u]&127;const h=new Uint8Array(u);for(let g=0;g<u;g++)h[g]=d[g];d=this.valueHexView=new Uint8Array(u),d.set(h),this.blockLength<=9?this.tagNumber=Ti(d,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}}}P_.NAME="identificationBlock";class B_ extends ii{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=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,n+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,n+this.blockLength;const a=s[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const l=n+1,u=i.subarray(l,l+a);return u[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Ti(u,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=Mr(this.length,8);if(i.byteLength>127)return this.error="Too big length",mn;if(n=new ArrayBuffer(i.byteLength+1),e)return n;const s=new Uint8Array(i);r=new Uint8Array(n),r[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)r[a+1]=s[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}}}B_.NAME="lengthBlock";const le={};class ut extends ii{constructor({name:e=At,optional:n=!1,primitiveSchema:r,...i}={},s){super(i),this.name=e,this.optional=n,r&&(this.primitiveSchema=r),this.idBlock=new P_(i),this.lenBlock=new B_(i),this.valueBlock=s?new s(i):new yt(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 Oc;n||j_(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 s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const a=this.lenBlock.toBER(e);r.write(a),r.write(s)}return n?mn: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():pe.ToHex(this.toBER())}onAsciiEncoding(){const e=this.constructor.NAME,n=pe.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${n}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const n=this.toBER(),r=e.toBER();return x3(n,r)}}ut.NAME="BaseBlock";function j_(t){var e;if(t instanceof le.Constructed)for(const n of t.valueBlock.value)j_(n)&&(t.lenBlock.isIndefiniteForm=!0);return!!(!((e=t.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}class kp extends ut{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=At,...n}={},r){super(n,r),e&&this.fromString(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}'`}}kp.NAME="BaseStringBlock";class L_ extends Tn(yt){constructor({isHexOnly:e=!0,...n}={}){super(n),this.isHexOnly=e}}L_.NAME="PrimitiveValueBlock";var F_;class io extends ut{constructor(e={}){super(e,L_),this.idBlock.isConstructed=!1}}F_=io;le.Primitive=F_;io.NAME="PRIMITIVE";function I3(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 Xi(t,e=0,n=t.length){const r=e;let i=new ut({},yt);const s=new ii;if(!Jn(s,t,e,n))return i.error=s.error,{offset:-1,result:i};if(!t.subarray(e,e+n).length)return i.error="Zero buffer length",{offset:-1,result:i};let l=i.idBlock.fromBER(t,e,n);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),l===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=l,n-=i.idBlock.blockLength,l=i.lenBlock.fromBER(t,e,n),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),l===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=l,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 u=ut;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};u=le.EndOfContent;break;case 1:u=le.Boolean;break;case 2:u=le.Integer;break;case 3:u=le.BitString;break;case 4:u=le.OctetString;break;case 5:u=le.Null;break;case 6:u=le.ObjectIdentifier;break;case 10:u=le.Enumerated;break;case 12:u=le.Utf8String;break;case 13:u=le.RelativeObjectIdentifier;break;case 14:u=le.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:u=le.Sequence;break;case 17:u=le.Set;break;case 18:u=le.NumericString;break;case 19:u=le.PrintableString;break;case 20:u=le.TeletexString;break;case 21:u=le.VideotexString;break;case 22:u=le.IA5String;break;case 23:u=le.UTCTime;break;case 24:u=le.GeneralizedTime;break;case 25:u=le.GraphicString;break;case 26:u=le.VisibleString;break;case 27:u=le.GeneralString;break;case 28:u=le.UniversalString;break;case 29:u=le.CharacterString;break;case 30:u=le.BmpString;break;case 31:u=le.DATE;break;case 32:u=le.TimeOfDay;break;case 33:u=le.DateTime;break;case 34:u=le.Duration;break;default:{const d=i.idBlock.isConstructed?new le.Constructed:new le.Primitive;d.idBlock=i.idBlock,d.lenBlock=i.lenBlock,d.warnings=i.warnings,i=d}}break;case 2:case 3:case 4:default:u=i.idBlock.isConstructed?le.Constructed:le.Primitive}return i=I3(i,u),l=i.fromBER(t,e,i.lenBlock.isIndefiniteForm?n:i.lenBlock.length),i.valueBeforeDecodeView=t.subarray(r,r+i.blockLength),{offset:l,result:i}}function Ei(t){if(!t.byteLength){const e=new ut({},yt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Xi(ne.toUint8Array(t).slice(),0,t.byteLength)}function O3(t,e){return t?1:e}class pr extends yt{constructor({value:e=[],isIndefiniteForm:n=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=n}fromBER(e,n,r){const i=ne.toUint8Array(e);if(!Jn(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 s=n;for(;O3(this.isIndefiniteForm,r)>0;){const a=Xi(i,s,r);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(s=a.offset,this.blockLength+=a.result.blockLength,r-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===zs)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===zs?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,n){const r=n||new Oc;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,r);return n?mn:r.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const n of this.value)e.value.push(n.toJSON());return e}}pr.NAME="ConstructedValueBlock";var U_;class _t extends ut{constructor(e={}){super(e,pr),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(`
142
+ */function Ca(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Sp(t){let e=0,n=0;for(let i=0;i<t.length;i++){const s=t[i];e+=s.byteLength}const r=new Uint8Array(e);for(let i=0;i<t.length;i++){const s=t[i];r.set(new Uint8Array(s),n),n+=s.byteLength}return r.buffer}function Jn(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 Oc{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Sp(this.items)}}const fs=[new Uint8Array([1])],Eh="0123456789",Ul="name",Sh="valueHexView",$3="isHexOnly",A3="idBlock",E3="tagClass",S3="tagNumber",k3="isConstructed",N3="fromBER",C3="toBER",T3="local",At="",mn=new ArrayBuffer(0),zc=new Uint8Array(0),zs="EndOfContent",D_="OCTET STRING",R_="BIT STRING";function Tn(t){var e;return e=class extends t{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(r){this.valueHexView=new Uint8Array(r)}constructor(...r){var i;super(...r);const s=r[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?ne.toUint8Array(s.valueHex):zc}fromBER(r,i,s){const a=r instanceof ArrayBuffer?new Uint8Array(r):r;if(!Jn(this,a,i,s))return-1;const l=i+s;return this.valueHexView=a.subarray(i,l),this.valueHexView.length?(this.blockLength=s,l):(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",mn)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:fe.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class ii{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:n=At,warnings:r=[],valueBeforeDecode:i=zc}={}){this.blockLength=e,this.error=n,this.warnings=r,this.valueBeforeDecodeView=ne.toUint8Array(i)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:fe.ToHex(this.valueBeforeDecodeView)}}}ii.NAME="baseBlock";class yt extends ii{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'")}}yt.NAME="valueBlock";class P_ extends Tn(ii){constructor({idBlock:e={}}={}){var n,r,i,s;super(),e?(this.isHexOnly=(n=e.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=e.valueHex?ne.toUint8Array(e.valueHex):zc,this.tagClass=(r=e.tagClass)!==null&&r!==void 0?r:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!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",mn}if(this.isConstructed&&(n|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,n|=s,i[0]=n}return i.buffer}if(!this.isHexOnly){const i=Mr(this.tagNumber,7),s=new Uint8Array(i),a=i.byteLength,l=new Uint8Array(a+1);if(l[0]=n|31,!e){for(let u=0;u<a-1;u++)l[u+1]=s[u]|128;l[a]=s[a-1]}return l.buffer}const r=new Uint8Array(this.valueHexView.byteLength+1);if(r[0]=n|31,!e){const i=this.valueHexView;for(let s=0;s<i.length-1;s++)r[s+1]=i[s]|128;r[this.valueHexView.byteLength]=i[i.length-1]}return r.buffer}fromBER(e,n,r){const i=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[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=(s[0]&32)===32,this.isHexOnly=!1;const l=s[0]&31;if(l!==31)this.tagNumber=l,this.blockLength=1;else{let u=1,d=this.valueHexView=new Uint8Array(255),p=255;for(;s[u]&128;){if(d[u-1]=s[u]&127,u++,u>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(u===p){p+=255;const g=new Uint8Array(p);for(let A=0;A<d.length;A++)g[A]=d[A];d=this.valueHexView=new Uint8Array(p)}}this.blockLength=u+1,d[u-1]=s[u]&127;const h=new Uint8Array(u);for(let g=0;g<u;g++)h[g]=d[g];d=this.valueHexView=new Uint8Array(u),d.set(h),this.blockLength<=9?this.tagNumber=Ti(d,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}}}P_.NAME="identificationBlock";class B_ extends ii{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=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,n+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,n+this.blockLength;const a=s[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const l=n+1,u=i.subarray(l,l+a);return u[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Ti(u,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=Mr(this.length,8);if(i.byteLength>127)return this.error="Too big length",mn;if(n=new ArrayBuffer(i.byteLength+1),e)return n;const s=new Uint8Array(i);r=new Uint8Array(n),r[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)r[a+1]=s[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}}}B_.NAME="lengthBlock";const le={};class ut extends ii{constructor({name:e=At,optional:n=!1,primitiveSchema:r,...i}={},s){super(i),this.name=e,this.optional=n,r&&(this.primitiveSchema=r),this.idBlock=new P_(i),this.lenBlock=new B_(i),this.valueBlock=s?new s(i):new yt(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 Oc;n||j_(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 s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const a=this.lenBlock.toBER(e);r.write(a),r.write(s)}return n?mn: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():fe.ToHex(this.toBER())}onAsciiEncoding(){const e=this.constructor.NAME,n=fe.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${n}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const n=this.toBER(),r=e.toBER();return x3(n,r)}}ut.NAME="BaseBlock";function j_(t){var e;if(t instanceof le.Constructed)for(const n of t.valueBlock.value)j_(n)&&(t.lenBlock.isIndefiniteForm=!0);return!!(!((e=t.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}class kp extends ut{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=At,...n}={},r){super(n,r),e&&this.fromString(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}'`}}kp.NAME="BaseStringBlock";class L_ extends Tn(yt){constructor({isHexOnly:e=!0,...n}={}){super(n),this.isHexOnly=e}}L_.NAME="PrimitiveValueBlock";var F_;class io extends ut{constructor(e={}){super(e,L_),this.idBlock.isConstructed=!1}}F_=io;le.Primitive=F_;io.NAME="PRIMITIVE";function I3(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 Xi(t,e=0,n=t.length){const r=e;let i=new ut({},yt);const s=new ii;if(!Jn(s,t,e,n))return i.error=s.error,{offset:-1,result:i};if(!t.subarray(e,e+n).length)return i.error="Zero buffer length",{offset:-1,result:i};let l=i.idBlock.fromBER(t,e,n);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),l===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=l,n-=i.idBlock.blockLength,l=i.lenBlock.fromBER(t,e,n),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),l===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=l,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 u=ut;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};u=le.EndOfContent;break;case 1:u=le.Boolean;break;case 2:u=le.Integer;break;case 3:u=le.BitString;break;case 4:u=le.OctetString;break;case 5:u=le.Null;break;case 6:u=le.ObjectIdentifier;break;case 10:u=le.Enumerated;break;case 12:u=le.Utf8String;break;case 13:u=le.RelativeObjectIdentifier;break;case 14:u=le.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:u=le.Sequence;break;case 17:u=le.Set;break;case 18:u=le.NumericString;break;case 19:u=le.PrintableString;break;case 20:u=le.TeletexString;break;case 21:u=le.VideotexString;break;case 22:u=le.IA5String;break;case 23:u=le.UTCTime;break;case 24:u=le.GeneralizedTime;break;case 25:u=le.GraphicString;break;case 26:u=le.VisibleString;break;case 27:u=le.GeneralString;break;case 28:u=le.UniversalString;break;case 29:u=le.CharacterString;break;case 30:u=le.BmpString;break;case 31:u=le.DATE;break;case 32:u=le.TimeOfDay;break;case 33:u=le.DateTime;break;case 34:u=le.Duration;break;default:{const d=i.idBlock.isConstructed?new le.Constructed:new le.Primitive;d.idBlock=i.idBlock,d.lenBlock=i.lenBlock,d.warnings=i.warnings,i=d}}break;case 2:case 3:case 4:default:u=i.idBlock.isConstructed?le.Constructed:le.Primitive}return i=I3(i,u),l=i.fromBER(t,e,i.lenBlock.isIndefiniteForm?n:i.lenBlock.length),i.valueBeforeDecodeView=t.subarray(r,r+i.blockLength),{offset:l,result:i}}function Ei(t){if(!t.byteLength){const e=new ut({},yt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Xi(ne.toUint8Array(t).slice(),0,t.byteLength)}function O3(t,e){return t?1:e}class pr extends yt{constructor({value:e=[],isIndefiniteForm:n=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=n}fromBER(e,n,r){const i=ne.toUint8Array(e);if(!Jn(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 s=n;for(;O3(this.isIndefiniteForm,r)>0;){const a=Xi(i,s,r);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(s=a.offset,this.blockLength+=a.result.blockLength,r-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===zs)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===zs?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,n){const r=n||new Oc;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,r);return n?mn:r.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const n of this.value)e.value.push(n.toJSON());return e}}pr.NAME="ConstructedValueBlock";var U_;class _t extends ut{constructor(e={}){super(e,pr),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(`
143
143
  `).map(i=>` ${i}`).join(`
144
144
  `));const n=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${n} :
145
145
  ${e.join(`
146
- `)}`:`${n} :`}}U_=_t;le.Constructed=U_;_t.NAME="CONSTRUCTED";class M_ extends yt{fromBER(e,n,r){return n}toBER(e){return mn}}M_.override="EndOfContentValueBlock";var q_;class Np extends ut{constructor(e={}){super(e,M_),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}q_=Np;le.EndOfContent=q_;Np.NAME=zs;var V_;class qr extends ut{constructor(e={}){super(e,yt),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}`}}V_=qr;le.Null=V_;qr.NAME="NULL";class H_ extends Tn(yt){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=ne.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,n,r){const i=ne.toUint8Array(e);return Jn(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,z_.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}H_.NAME="BooleanValueBlock";var K_;let Dc=class extends ut{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,H_),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};K_=Dc;le.Boolean=K_;Dc.NAME="BOOLEAN";class G_ extends Tn(pr){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=pr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let s=0;s<this.value.length;s++){const a=this.value[s].constructor.NAME;if(a===zs){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==D_)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?pr.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}G_.NAME="OctetStringValueBlock";var Cp;let Fr=class extends ut{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,s;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((s=r.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},G_),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 s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(s.byteLength){const a=Xi(s,0,s.byteLength);a.offset!==-1&&a.offset===r&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return _t.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,n=pe.ToHex(this.valueBlock.valueHexView);return`${e} : ${n}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof Cp&&e.push(n.valueBlock.valueHexView);return ne.concat(e)}};Cp=Fr;le.OctetString=Cp;Fr.NAME=D_;class W_ extends Tn(pr){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=pr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const l of this.value){const u=l.constructor.NAME;if(u===zs){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==R_)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=l.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return i}const s=ne.toUint8Array(e);if(!Jn(this,s,n,r))return-1;const a=s.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 l=a.subarray(1);try{if(l.byteLength){const u=Xi(l,0,l.byteLength);u.offset!==-1&&u.offset===r-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,n+r}toBER(e,n){if(this.isConstructed)return pr.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return mn;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}}}W_.NAME="BitStringValueBlock";var X_;let Ur=class extends ut{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,s;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((s=r.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},W_),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 _t.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const a of n)e.push(a.toString(2).padStart(8,"0"));const r=e.join(""),i=this.constructor.NAME,s=r.substring(0,r.length-this.valueBlock.unusedBits);return`${i} : ${s}`}}};X_=Ur;le.BitString=X_;Ur.NAME=R_;var J_;function z3(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let s=r.slice(0);const a=s.length-1,l=i.slice(0),u=l.length-1;let d=0;const p=u<a?a:u;let h=0;for(let g=p;g>=0;g--,h++){switch(!0){case h<l.length:d=s[a-h]+l[u-h]+n[0];break;default:d=s[a-h]+n[0]}switch(n[0]=d/10,!0){case h>=s.length:s=ku(new Uint8Array([d%10]),s);break;default:s[a-h]=d%10}}return n[0]>0&&(s=ku(n,s)),s}function kh(t){if(t>=fs.length)for(let e=fs.length;e<=t;e++){const n=new Uint8Array([0]);let r=fs[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const s=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=s[0]/10,r[i]=s[0]%10}n[0]>0&&(r=ku(n,r)),fs.push(r)}return fs[t]}function D3(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),s=r.slice(0),a=s.length-1,l=i.slice(0),u=l.length-1;let d,p=0;for(let h=u;h>=0;h--,p++)switch(d=s[a-p]-l[u-p]-n,!0){case d<0:n=1,s[a-p]=d+10;break;default:n=0,s[a-p]=d}if(n>0)for(let h=a-u+1;h>=0;h--,p++)if(d=s[a-p]-n,d<0)n=1,s[a-p]=d+10;else{n=0,s[a-p]=d;break}return s.slice()}class Tp extends Tn(yt){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=z_.call(this)))}constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(b3(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const s=this.fromBER(e,n,r);if(s===-1)return s;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)),s}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 s=this.valueHexView;let a="",l=!1;for(let u=s.byteLength-1;u>=0;u--){i=s[u];for(let d=0;d<8;d++){if((i&1)===1)switch(r){case e:n=D3(kh(r),n),a="-";break;default:n=z3(n,kh(r))}r++,i>>=1}}for(let u=0;u<n.length;u++)n[u]&&(l=!0),l&&(a+=Eh.charAt(n[u]));return l===!1&&(a+=Eh.charAt(0)),a}}J_=Tp;Tp.NAME="IntegerValueBlock";Object.defineProperty(J_.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var bs;class Ji extends ut{constructor(e={}){super(e,Tp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Ca(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Ca();const n=BigInt(e),r=new Oc,i=n.toString(16).replace(/^-/,""),s=new Uint8Array(pe.FromHex(i));if(n<0){const l=new Uint8Array(s.length+(s[0]&128?1:0));l[0]|=128;const d=BigInt(`0x${pe.ToHex(l)}`)+n,p=ne.toUint8Array(pe.FromHex(d.toString(16)));p[0]|=128,r.write(p)}else s[0]&128&&r.write(new Uint8Array([0])),r.write(s);return new bs({valueHex:r.final()})}convertToDER(){const e=new bs({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new bs({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}bs=Ji;le.Integer=bs;Ji.NAME="INTEGER";var Y_;class Rc extends Ji{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Y_=Rc;le.Enumerated=Y_;Rc.NAME="ENUMERATED";class Nu extends Tn(yt){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=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=s[l]&127,this.blockLength++,!!(s[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,s[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=Ti(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){Ca();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,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const n=Mr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",mn;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),s=n.byteLength-1;for(let a=0;a<s;a++)r[a]=i[a]|128;r[s]=i[s]}return r}toString(){let e="";if(this.isHexOnly)e=pe.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}}}Nu.NAME="sidBlock";class Z_ extends yt{constructor({value:e=At,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const s=new Nu;if(i=s.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,r-=s.blockLength,this.value.push(s)}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,mn;n.push(i)}return Sp(n)}fromString(e){this.value=[];let n=0,r=0,i="",s=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,s){const a=this.value[0];let l=0;switch(a.valueDec){case 0:break;case 1:l=40;break;case 2:l=80;break;default:this.value=[];return}const u=parseInt(i,10);if(isNaN(u))return;a.valueDec=u+l,s=!1}else{const a=new Nu;if(i>Number.MAX_SAFE_INTEGER){Ca();const l=BigInt(i);a.valueBigInt=l}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,s=!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}}Z_.NAME="ObjectIdentifierValueBlock";var Q_;class Pc extends ut{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Z_),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Q_=Pc;le.ObjectIdentifier=Q_;Pc.NAME="OBJECT IDENTIFIER";class Cu extends Tn(ii){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=s[l]&127,this.blockLength++,!!(s[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,s[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=Ti(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,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const n=Mr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",mn;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),s=n.byteLength-1;for(let a=0;a<s;a++)r[a]=i[a]|128;r[s]=i[s]}return r.buffer}toString(){let e="";return this.isHexOnly?e=pe.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Cu.NAME="relativeSidBlock";class e2 extends yt{constructor({value:e=At,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const s=new Cu;if(i=s.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,r-=s.blockLength,this.value.push(s)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,mn;r.push(s)}return Sp(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 s=new Cu;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}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}}e2.NAME="RelativeObjectIdentifierValueBlock";var t2;class Ip extends ut{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,e2),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}t2=Ip;le.RelativeObjectIdentifier=t2;Ip.NAME="RelativeObjectIdentifier";var n2;class on extends _t{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}n2=on;le.Sequence=n2;on.NAME="SEQUENCE";var r2;let Sn=class extends _t{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};r2=Sn;le.Set=r2;Sn.NAME="SET";class i2 extends Tn(yt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=At}toJSON(){return{...super.toJSON(),value:this.value}}}i2.NAME="StringValueBlock";class s2 extends i2{}s2.NAME="SimpleStringValueBlock";class Ft extends kp{constructor({...e}={}){super(e,s2)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,ne.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}}Ft.NAME="SIMPLE STRING";class o2 extends Ft{fromBuffer(e){this.valueBlock.valueHexView=ne.toUint8Array(e);try{this.valueBlock.value=pe.ToUtf8String(e)}catch(n){this.warnings.push(`Error during "decodeURIComponent": ${n}, using raw string`),this.valueBlock.value=pe.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(pe.FromUtf8String(e)),this.valueBlock.value=e}}o2.NAME="Utf8StringValueBlock";var a2;class Yn extends o2{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}a2=Yn;le.Utf8String=a2;Yn.NAME="UTF8String";class c2 extends Ft{fromBuffer(e){this.valueBlock.value=pe.ToUtf16String(e),this.valueBlock.valueHexView=ne.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(pe.FromUtf16String(e))}}c2.NAME="BmpStringValueBlock";var l2;class Bc extends c2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}l2=Bc;le.BmpString=l2;Bc.NAME="BMPString";class u2 extends Ft{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 s=Mr(e.charCodeAt(i),8),a=new Uint8Array(s);if(a.length>4)continue;const l=4-a.length;for(let u=a.length-1;u>=0;u--)r[i*4+u+l]=a[u]}this.valueBlock.value=e}}u2.NAME="UniversalStringValueBlock";var d2;class jc extends u2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}d2=jc;le.UniversalString=d2;jc.NAME="UniversalString";var p2;class Lc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}p2=Lc;le.NumericString=p2;Lc.NAME="NumericString";var f2;class Fc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}f2=Fc;le.PrintableString=f2;Fc.NAME="PrintableString";var h2;class Uc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}h2=Uc;le.TeletexString=h2;Uc.NAME="TeletexString";var g2;class Mc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}g2=Mc;le.VideotexString=g2;Mc.NAME="VideotexString";var m2;class qc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}m2=qc;le.IA5String=m2;qc.NAME="IA5String";var _2;class Vc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_2=Vc;le.GraphicString=_2;Vc.NAME="GraphicString";var y2;class so extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}y2=so;le.VisibleString=y2;so.NAME="VisibleString";var w2;class Hc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}w2=Hc;le.GeneralString=w2;Hc.NAME="GeneralString";var v2;class Kc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}v2=Kc;le.CharacterString=v2;Kc.NAME="CharacterString";var b2;class oo extends so{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,ne.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]=Pt(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=Pt(this.month,2),n[2]=Pt(this.day,2),n[3]=Pt(this.hour,2),n[4]=Pt(this.minute,2),n[5]=Pt(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}}}b2=oo;le.UTCTime=b2;oo.NAME="UTCTime";var x2;class Gc extends oo{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(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let n=!1,r="",i="",s=0,a,l=0,u=0;if(e[e.length-1]==="Z")r=e.substring(0,e.length-1),n=!0;else{const h=new Number(e[e.length-1]);if(isNaN(h.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 h=1,g=r.indexOf("+"),A="";if(g===-1&&(g=r.indexOf("-"),h=-1),g!==-1){if(A=r.substring(g+1),r=r.substring(0,g),A.length!==2&&A.length!==4)throw new Error("Wrong input string for conversion");let $=parseInt(A.substring(0,2),10);if(isNaN($.valueOf()))throw new Error("Wrong input string for conversion");if(l=h*$,A.length===4){if($=parseInt(A.substring(2,4),10),isNaN($.valueOf()))throw new Error("Wrong input string for conversion");u=h*$}}}let d=r.indexOf(".");if(d===-1&&(d=r.indexOf(",")),d!==-1){const h=new Number(`0${r.substring(d)}`);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");s=h.valueOf(),i=r.substring(0,d)}else i=r;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,d!==-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,d!==-1){let h=60*s;this.minute=Math.floor(h),h=60*(h-this.minute),this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*s;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const h=1e3*s;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}const p=a.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let h=1;h<p.length;h++)switch(h){case 1:this.year=parseInt(p[h],10);break;case 2:this.month=parseInt(p[h],10);break;case 3:this.day=parseInt(p[h],10);break;case 4:this.hour=parseInt(p[h],10)+l;break;case 5:this.minute=parseInt(p[h],10)+u;break;case 6:this.second=parseInt(p[h],10);break;default:throw new Error("Wrong input string for conversion")}if(n===!1){const h=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=h.getUTCFullYear(),this.month=h.getUTCMonth(),this.day=h.getUTCDay(),this.hour=h.getUTCHours(),this.minute=h.getUTCMinutes(),this.second=h.getUTCSeconds(),this.millisecond=h.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const n=[];return n.push(Pt(this.year,4)),n.push(Pt(this.month,2)),n.push(Pt(this.day,2)),n.push(Pt(this.hour,2)),n.push(Pt(this.minute,2)),n.push(Pt(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(Pt(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}x2=Gc;le.GeneralizedTime=x2;Gc.NAME="GeneralizedTime";var $2;class Op extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}$2=Op;le.DATE=$2;Op.NAME="DATE";var A2;class zp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}A2=zp;le.TimeOfDay=A2;zp.NAME="TimeOfDay";var E2;class Dp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}E2=Dp;le.DateTime=E2;Dp.NAME="DateTime";var S2;class Rp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}S2=Rp;le.Duration=S2;Rp.NAME="Duration";var k2;class Pp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}k2=Pp;le.TIME=k2;Pp.NAME="TIME";class Vr{constructor({name:e=At,optional:n=!1}={}){this.name=e,this.optional=n}}class Bp extends Vr{constructor({value:e=[],...n}={}){super(n),this.value=e}}class Ta extends Vr{constructor({value:e=new Vr,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class R3{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=ne.toUint8Array(e)}constructor({data:e=zc}={}){this.dataView=ne.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=ne.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function lr(t,e,n){if(n instanceof Bp){for(const s of n.value)if(lr(t,e,s).verified)return{verified:!0,result:t};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Ul)&&(s.name=n.name),s}}if(n instanceof Vr)return n.hasOwnProperty(Ul)&&(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(!(A3 in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(N3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(C3 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(E3)===!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(S3)===!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(k3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!($3 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(!(Sh in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=n.idBlock.valueHexView,a=e.idBlock.valueHexView;if(s.length!==a.length)return{verified:!1,result:t};for(let l=0;l<s.length;l++)if(s[l]!==a[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&(t[n.name]=e)),n instanceof le.Constructed){let s=0,a={verified:!1,result:{error:"Unknown error"}},l=n.valueBlock.value.length;if(l>0&&n.valueBlock.value[0]instanceof Ta&&(l=e.valueBlock.value.length),l===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&n.valueBlock.value.length!==0){let u=!0;for(let d=0;d<n.valueBlock.value.length;d++)u=u&&(n.valueBlock.value[d].optional||!1);return u?{verified:!0,result:t}:(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let u=0;u<l;u++)if(u-s>=e.valueBlock.value.length){if(n.valueBlock.value[u].optional===!1){const d={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,At),n.name&&(delete t[n.name],d.name=n.name)),d}}else if(n.valueBlock.value[0]instanceof Ta){if(a=lr(t,e.valueBlock.value[u],n.valueBlock.value[0].value),a.verified===!1)if(n.valueBlock.value[0].optional)s++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&delete t[n.name]),a;if(Ul in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let d={};T3 in n.valueBlock.value[0]&&n.valueBlock.value[0].local?d=e:d=t,typeof d[n.valueBlock.value[0].name]>"u"&&(d[n.valueBlock.value[0].name]=[]),d[n.valueBlock.value[0].name].push(e.valueBlock.value[u])}}else if(a=lr(t,e.valueBlock.value[u-s],n.valueBlock.value[u]),a.verified===!1)if(n.valueBlock.value[u].optional)s++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&delete t[n.name]),a;if(a.verified===!1){const u={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&(delete t[n.name],u.name=n.name)),u}return{verified:!0,result:t}}if(n.primitiveSchema&&Sh in e.valueBlock){const s=Xi(e.valueBlock.valueHexView);if(s.offset===-1){const a={verified:!1,result:s.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&(delete t[n.name],a.name=n.name)),a}return lr(t,s.result,n.primitiveSchema)}return{verified:!0,result:t}}function P3(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Xi(ne.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:lr(n.result,n.result,e)}const N2=Object.freeze(Object.defineProperty({__proto__:null,Any:Vr,BaseBlock:ut,BaseStringBlock:kp,BitString:Ur,BmpString:Bc,Boolean:Dc,CharacterString:Kc,Choice:Bp,Constructed:_t,DATE:Op,DateTime:Dp,Duration:Rp,EndOfContent:Np,Enumerated:Rc,GeneralString:Hc,GeneralizedTime:Gc,GraphicString:Vc,HexBlock:Tn,IA5String:qc,Integer:Ji,Null:qr,NumericString:Lc,ObjectIdentifier:Pc,OctetString:Fr,Primitive:io,PrintableString:Fc,RawData:R3,RelativeObjectIdentifier:Ip,Repeated:Ta,Sequence:on,Set:Sn,TIME:Pp,TeletexString:Uc,TimeOfDay:zp,UTCTime:oo,UniversalString:jc,Utf8String:Yn,ValueBlock:yt,VideotexString:Mc,ViewWriter:Oc,VisibleString:so,compareSchema:lr,fromBER:Ei,verifySchema:P3},Symbol.toStringTag,{value:"Module"}));var q;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(q||(q={}));var C;(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"})(C||(C={}));class Wc{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(ne.isBufferSource(e))this.unusedBits=n,this.value=ne.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Ur))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 Ur({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Ur({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 s=0;for(;s<r;)i[s]=parseInt(n.slice(s<<3,(s<<3)+8),2),s++;this.value=i.buffer}}class Ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):ne.isBufferSource(e)?this.buffer=ne.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Fr))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Fr({valueHex:this.buffer})}toSchema(e){return new Fr({name:e})}}const B3={fromASN:t=>t instanceof qr?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new qr;const e=Ei(t);if(e.result.error)throw new Error(e.result.error);return e.result}},j3={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new Ji({value:+t})},L3={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new Rc({value:t})},Me={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Ji({valueHex:t})},F3={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Ur({valueHex:t})},U3={fromASN:t=>t.valueBlock.toString(),toASN:t=>new Pc({value:t})},M3={fromASN:t=>t.valueBlock.value,toASN:t=>new Dc({value:t})},Ia={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Fr({valueHex:t})},q3={fromASN:t=>new Ie(t.getValue()),toASN:t=>t.toASN()};function Yt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const C2=Yt(Yn),V3=Yt(Bc),H3=Yt(jc),K3=Yt(Lc),G3=Yt(Fc),W3=Yt(Uc),X3=Yt(Mc),J3=Yt(qc),Y3=Yt(Vc),Z3=Yt(so),Q3=Yt(Hc),e4=Yt(Kc),t4={fromASN:t=>t.toDate(),toASN:t=>new oo({valueDate:t})},n4={fromASN:t=>t.toDate(),toASN:t=>new Gc({valueDate:t})},r4={fromASN:()=>null,toASN:()=>new qr};function xs(t){switch(t){case C.Any:return B3;case C.BitString:return F3;case C.BmpString:return V3;case C.Boolean:return M3;case C.CharacterString:return e4;case C.Enumerated:return L3;case C.GeneralString:return Q3;case C.GeneralizedTime:return n4;case C.GraphicString:return Y3;case C.IA5String:return J3;case C.Integer:return j3;case C.Null:return r4;case C.NumericString:return K3;case C.ObjectIdentifier:return U3;case C.OctetString:return Ia;case C.PrintableString:return G3;case C.TeletexString:return W3;case C.UTCTime:return t4;case C.UniversalString:return H3;case C.Utf8String:return C2;case C.VideotexString:return X3;case C.VisibleString:return Z3;default:return null}}function Ln(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Ln(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function T2(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:T2(n)}return!1}function i4(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 s4{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:q.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 s in r.items){const a=r.items[s],l=n?s:"";let u;if(typeof a.type=="number"){const p=C[a.type],h=N2[p];if(!h)throw new Error(`Cannot get ASN1 class by name '${p}'`);u=new h({name:l})}else Ln(a.type)?u=new a.type().toSchema(l):a.optional?this.get(a.type).type===q.Choice?u=new Vr({name:l}):(u=this.create(a.type,!1),u.name=l):u=new Vr({name:l});const d=!!a.optional||a.defaultValue!==void 0;if(a.repeated){u.name="";const p=a.repeated==="set"?Sn:on;u=new p({name:"",value:[new Ta({name:l,value:u})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||Ln(a.type)){const p=a.repeated?_t:io;i.push(new p({name:l,optional:d,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const p=!!a.repeated;let h=p?u:this.get(a.type,!0).schema;h="valueBlock"in h?h.valueBlock.value:h.value,i.push(new _t({name:p?"":l,optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:h}))}else i.push(new _t({optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:[u]}));else u.optional=d,i.push(u)}switch(r.type){case q.Sequence:return new on({value:i,name:""});case q.Set:return new Sn({value:i,name:""});case q.Choice:return new Bp({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 rt=new s4,W=t=>e=>{let n;rt.has(e)?n=rt.get(e):(n=rt.createDefault(e),rt.set(e,n)),Object.assign(n,t)},y=t=>(e,n)=>{let r;rt.has(e.constructor)?r=rt.get(e.constructor):(r=rt.createDefault(e.constructor),rt.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const s=xs(t.type);if(!s)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=s}r.items[n]=i};class hs extends Error{constructor(){super(...arguments),this.schemas=[]}}class o4{static parse(e,n){const r=Ei(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){try{if(Ln(n))return new n().fromASN(e);const r=rt.get(n);rt.cache(n);let i=r.schema;const s=this.handleChoiceTypes(e,r,n,i);if(s!=null&&s.result)return s.result;s!=null&&s.targetSchema&&(i=s.targetSchema);const a=this.handleSequenceTypes(e,r,n,i);if(a&&"isManualMapping"in a)return a.result;const l=a,u=new n;return T2(n)?this.handleArrayTypes(e,r,n):(this.processSchemaItems(r,l,u),u)}catch(r){throw r instanceof hs&&r.schemas.push(n.name),r}}static handleChoiceTypes(e,n,r,i){if(e.constructor===_t&&n.type===q.Choice&&e.idBlock.tagClass===3)for(const s in n.items){const a=n.items[s];if(a.context===e.idBlock.tagNumber&&a.implicit&&typeof a.type=="function"&&rt.has(a.type)){const l=rt.get(a.type);if(l&&l.type===q.Sequence){const u=new on;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in u.valueBlock){u.valueBlock.value=e.valueBlock.value;const d=this.fromASN(u,a.type),p=new r;return p[s]=d,{result:p}}}}}else if(e.constructor===_t&&n.type!==q.Choice){const s=new _t({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const a in n.items)delete e[a];return{targetSchema:s}}return null}static handleSequenceTypes(e,n,r,i){if(n.type===q.Sequence){if(Object.keys(n.items).filter(l=>{const u=n.items[l];return u.optional&&typeof u.type=="function"&&rt.has(u.type)&&rt.get(u.type).type===q.Choice}).length>0&&"value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&r.name==="CertReqMsg")return this.handleManualMapping(e,n,r);const a=lr({},e,i);if(!a.verified)throw new hs(`Data does not match to ${r.name} ASN1 schema. ${a.result.error}`);return a}else{const s=lr({},e,i);if(!s.verified)throw new hs(`Data does not match to ${r.name} ASN1 schema. ${s.result.error}`);return s}}static handleManualMapping(e,n,r){const i=new r,s=e.valueBlock.value,a=Object.keys(n.items);let l=0;for(let u=0;u<a.length;u++){const d=a[u],p=n.items[d];if(l>=s.length)break;if(p.repeated){i[d]=this.processRepeatedField(s,l,p);break}else if(typeof p.type=="number")i[d]=this.processPrimitiveField(s[l],p),l++;else if(this.isOptionalChoiceField(p)){const h=this.processOptionalChoiceField(s[l],p);h.processed&&(i[d]=h.value,l++)}else i[d]=this.fromASN(s[l],p.type),l++}return{result:i,verified:!0,isManualMapping:!0}}static processRepeatedField(e,n,r){let i=e.slice(n);if(i.length===1&&i[0].constructor.name==="Sequence"){const s=i[0];s.valueBlock&&s.valueBlock.value&&Array.isArray(s.valueBlock.value)&&(i=s.valueBlock.value)}if(typeof r.type=="number"){const s=xs(r.type);if(!s)throw new Error(`No converter for ASN.1 type ${r.type}`);return i.filter(a=>a&&a.valueBlock).map(a=>{try{return s.fromASN(a)}catch{return}}).filter(a=>a!==void 0)}else return i.filter(s=>s&&s.valueBlock).map(s=>{try{return this.fromASN(s,r.type)}catch{return}}).filter(s=>s!==void 0)}static processPrimitiveField(e,n){const r=xs(n.type);if(!r)throw new Error(`No converter for ASN.1 type ${n.type}`);return r.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&rt.has(e.type)&&rt.get(e.type).type===q.Choice}static processOptionalChoiceField(e,n){try{return{processed:!0,value:this.fromASN(e,n.type)}}catch(r){if(r instanceof hs&&/Wrong values for Choice type/.test(r.message))return{processed:!1};throw r}}static handleArrayTypes(e,n,r){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 i=n.itemType;if(typeof i=="number"){const s=xs(i);if(!s)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);return r.from(e.valueBlock.value,a=>s.fromASN(a))}else return r.from(e.valueBlock.value,s=>this.fromASN(s,i))}static processSchemaItems(e,n,r){for(const i in e.items){const s=n.result[i];if(!s)continue;const a=e.items[i],l=a.type;typeof l=="number"||Ln(l)?r[i]=this.processPrimitiveSchemaItem(s,a,l):r[i]=this.processComplexSchemaItem(s,a,l)}}static processPrimitiveSchemaItem(e,n,r){var i;const s=(i=n.converter)!==null&&i!==void 0?i:Ln(r)?new r:null;if(!s)throw new Error("Converter is empty");return n.repeated?this.processRepeatedPrimitiveItem(e,n,s):this.processSinglePrimitiveItem(e,n,r,s)}static processRepeatedPrimitiveItem(e,n,r){if(n.implicit){const i=n.repeated==="sequence"?on:Sn,s=new i;s.valueBlock=e.valueBlock;const a=Ei(s.toBER(!1));if(a.offset===-1)throw new Error(`Cannot parse the child item. ${a.result.error}`);if(!("value"in a.result.valueBlock&&Array.isArray(a.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=a.result.valueBlock.value;return Array.from(l,u=>r.fromASN(u))}else return Array.from(e,i=>r.fromASN(i))}static processSinglePrimitiveItem(e,n,r,i){let s=e;if(n.implicit){let a;if(Ln(r))a=new r().toSchema("");else{const l=C[r],u=N2[l];if(!u)throw new Error(`Cannot get '${l}' class from asn1js module`);a=new u}a.valueBlock=s.valueBlock,s=Ei(a.toBER(!1)).result}return i.fromASN(s)}static processComplexSchemaItem(e,n,r){if(n.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,i=>this.fromASN(i,r))}else{const i=this.handleImplicitTagging(e,n,r);if(this.isOptionalChoiceField(n))try{return this.fromASN(i,r)}catch(s){if(s instanceof hs&&/Wrong values for Choice type/.test(s.message))return;throw s}else return this.fromASN(i,r)}}static handleImplicitTagging(e,n,r){if(n.implicit&&typeof n.context=="number"){const i=rt.get(r);if(i.type===q.Sequence){const s=new on;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in s.valueBlock)return s.valueBlock.value=e.valueBlock.value,s}else if(i.type===q.Set){const s=new Sn;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in s.valueBlock)return s.valueBlock.value=e.valueBlock.value,s}}return e}}class jp{static serialize(e){return e instanceof ut?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Ln(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=rt.get(n);rt.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=xs(r.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(l=>a.toASN(l))}else i=e.map(a=>this.toAsnItem({type:r.itemType},"[]",n,a))}else for(const a in r.items){const l=r.items[a],u=e[a];if(u===void 0||l.defaultValue===u||typeof l.defaultValue=="object"&&typeof u=="object"&&i4(this.serialize(l.defaultValue),this.serialize(u)))continue;const d=jp.toAsnItem(l,a,n,u);if(typeof l.context=="number")if(l.implicit)if(!l.repeated&&(typeof l.type=="number"||Ln(l.type))){const p={};p.valueHex=d instanceof qr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new io({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},...p}))}else i.push(new _t({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:d.valueBlock.value}));else i.push(new _t({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:[d]}));else l.repeated?i=i.concat(d):i.push(d)}let s;switch(r.type){case q.Sequence:s=new on({value:i});break;case q.Set:s=new Sn({value:i});break;case q.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,n,r,i){let s;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${n}' doesn't have converter for type ${C[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const l=Array.from(i,d=>a.toASN(d)),u=e.repeated==="sequence"?on:Sn;s=new u({value:l})}else s=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,u=>this.toASN(u)),l=e.repeated==="sequence"?on:Sn;s=new l({value:a})}else s=this.toASN(i);return s}}class De extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const n of e)this.push(n)}}}class te{static serialize(e){return jp.serialize(e)}static parse(e,n){return o4.parse(e,n)}static toString(e){const n=ne.isBufferSource(e)?ne.toArrayBuffer(e):te.serialize(e),r=Ei(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function m(t,e,n,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}class Nh{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const n=e.split(".");if(n.length!==4)throw new Error("Invalid IPv4 address");return n.map(r=>{const i=parseInt(r,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(e){const r=this.expandIPv6(e).split(":");if(r.length!==8)throw new Error("Invalid IPv6 address");return r.reduce((i,s)=>{const a=parseInt(s,16);if(isNaN(a)||a<0||a>65535)throw new Error("Invalid IPv6 address part");return i.push(a>>8&255),i.push(a&255),i},[])}static expandIPv6(e){if(!e.includes("::"))return e;const n=e.split("::");if(n.length>2)throw new Error("Invalid IPv6 address");const r=n[0]?n[0].split(":"):[],i=n[1]?n[1].split(":"):[],s=8-(r.length+i.length);if(s<0)throw new Error("Invalid IPv6 address");return[...r,...Array(s).fill("0"),...i].join(":")}static formatIPv6(e){const n=[];for(let r=0;r<16;r+=2)n.push((e[r]<<8|e[r+1]).toString(16));return this.compressIPv6(n.join(":"))}static compressIPv6(e){const n=e.split(":");let r=-1,i=0,s=-1,a=0;for(let l=0;l<n.length;l++)n[l]==="0"?(s===-1&&(s=l),a++):(a>i&&(r=s,i=a),s=-1,a=0);if(a>i&&(r=s,i=a),i>1){const l=n.slice(0,r).join(":"),u=n.slice(r+i).join(":");return`${l}::${u}`}return e}static parseCIDR(e){const[n,r]=e.split("/"),i=parseInt(r,10);if(this.isIPv4(n)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(n),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(n),i]}}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,s)=>i+ +s,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){const n=new Uint8Array(e);if(n.length===4)return Array.from(n).join(".");if(n.length===16)return this.formatIPv6(n);if(n.length===8||n.length===32){const r=n.length/2,i=n.slice(0,r),s=n.slice(r);if(n.every(u=>u===0))return n.length===8?"0.0.0.0/0":"::/0";const l=s.reduce((u,d)=>u+(d.toString(2).match(/1/g)||[]).length,0);return n.length===8?`${Array.from(i).join(".")}/${l}`:`${this.formatIPv6(i)}/${l}`}return this.decodeIP(pe.ToHex(e))}static fromString(e){if(e.includes("/")){const[r,i]=this.parseCIDR(e),s=new Uint8Array(r.length);let a=i;for(let u=0;u<s.length;u++)a>=8?(s[u]=255,a-=8):a>0&&(s[u]=255<<8-a,a=0);const l=new Uint8Array(r.length*2);return l.set(r,0),l.set(s,r.length),l.buffer}const n=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(n).buffer}}var Tu,Iu,Ou;let dt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};m([y({type:C.TeletexString})],dt.prototype,"teletexString",void 0);m([y({type:C.PrintableString})],dt.prototype,"printableString",void 0);m([y({type:C.UniversalString})],dt.prototype,"universalString",void 0);m([y({type:C.Utf8String})],dt.prototype,"utf8String",void 0);m([y({type:C.BmpString})],dt.prototype,"bmpString",void 0);dt=m([W({type:q.Choice})],dt);let Ii=class extends dt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?pe.ToHex(this.anyValue):super.toString())}};m([y({type:C.IA5String})],Ii.prototype,"ia5String",void 0);m([y({type:C.Any})],Ii.prototype,"anyValue",void 0);Ii=m([W({type:q.Choice})],Ii);class Xc{constructor(e={}){this.type="",this.value=new Ii,Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Xc.prototype,"type",void 0);m([y({type:Ii})],Xc.prototype,"value",void 0);let Oi=Tu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Tu.prototype)}};Oi=Tu=m([W({type:q.Set,itemType:Xc})],Oi);let zu=Iu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Iu.prototype)}};zu=Iu=m([W({type:q.Sequence,itemType:Oi})],zu);let Ye=Ou=class extends zu{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};Ye=Ou=m([W({type:q.Sequence})],Ye);const a4={fromASN:t=>Nh.toString(Ia.fromASN(t)),toASN:t=>Ia.toASN(Nh.fromString(t))};class Ds{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Ds.prototype,"typeId",void 0);m([y({type:C.Any,context:0})],Ds.prototype,"value",void 0);class Lp{constructor(e={}){this.partyName=new dt,Object.assign(this,e)}}m([y({type:dt,optional:!0,context:0,implicit:!0})],Lp.prototype,"nameAssigner",void 0);m([y({type:dt,context:1,implicit:!0})],Lp.prototype,"partyName",void 0);let ke=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Ds,context:0,implicit:!0})],ke.prototype,"otherName",void 0);m([y({type:C.IA5String,context:1,implicit:!0})],ke.prototype,"rfc822Name",void 0);m([y({type:C.IA5String,context:2,implicit:!0})],ke.prototype,"dNSName",void 0);m([y({type:C.Any,context:3,implicit:!0})],ke.prototype,"x400Address",void 0);m([y({type:Ye,context:4,implicit:!1})],ke.prototype,"directoryName",void 0);m([y({type:Lp,context:5})],ke.prototype,"ediPartyName",void 0);m([y({type:C.IA5String,context:6,implicit:!0})],ke.prototype,"uniformResourceIdentifier",void 0);m([y({type:C.OctetString,context:7,implicit:!0,converter:a4})],ke.prototype,"iPAddress",void 0);m([y({type:C.ObjectIdentifier,context:8,implicit:!0})],ke.prototype,"registeredID",void 0);ke=m([W({type:q.Choice})],ke);const Fp="1.3.6.1.5.5.7",c4=`${Fp}.1`,Yi=`${Fp}.3`,Jc=`${Fp}.48`,Ch=`${Jc}.1`,Th=`${Jc}.2`,Ih=`${Jc}.3`,Oh=`${Jc}.5`,Zn="2.5.29";var Du;const Ru=`${c4}.1`;class ao{constructor(e={}){this.accessMethod="",this.accessLocation=new ke,Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ao.prototype,"accessMethod",void 0);m([y({type:ke})],ao.prototype,"accessLocation",void 0);let bi=Du=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Du.prototype)}};bi=Du=m([W({type:q.Sequence,itemType:ao})],bi);const Pu=`${Zn}.35`;class Up extends Ie{}class jr{constructor(e={}){e&&Object.assign(this,e)}}m([y({type:Up,context:0,optional:!0,implicit:!0})],jr.prototype,"keyIdentifier",void 0);m([y({type:ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],jr.prototype,"authorityCertIssuer",void 0);m([y({type:C.Integer,context:2,optional:!0,implicit:!0,converter:Me})],jr.prototype,"authorityCertSerialNumber",void 0);const I2=`${Zn}.19`;class Oa{constructor(e={}){this.cA=!1,Object.assign(this,e)}}m([y({type:C.Boolean,defaultValue:!1})],Oa.prototype,"cA",void 0);m([y({type:C.Integer,optional:!0})],Oa.prototype,"pathLenConstraint",void 0);var Bu;let ht=Bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};ht=Bu=m([W({type:q.Sequence,itemType:ke})],ht);var ju;let zh=ju=class extends ht{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};zh=ju=m([W({type:q.Sequence})],zh);var Lu;const O2=`${Zn}.32`;let Un=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};m([y({type:C.IA5String})],Un.prototype,"ia5String",void 0);m([y({type:C.VisibleString})],Un.prototype,"visibleString",void 0);m([y({type:C.BmpString})],Un.prototype,"bmpString",void 0);m([y({type:C.Utf8String})],Un.prototype,"utf8String",void 0);Un=m([W({type:q.Choice})],Un);class Mp{constructor(e={}){this.organization=new Un,this.noticeNumbers=[],Object.assign(this,e)}}m([y({type:Un})],Mp.prototype,"organization",void 0);m([y({type:C.Integer,repeated:"sequence"})],Mp.prototype,"noticeNumbers",void 0);class qp{constructor(e={}){Object.assign(this,e)}}m([y({type:Mp,optional:!0})],qp.prototype,"noticeRef",void 0);m([y({type:Un,optional:!0})],qp.prototype,"explicitText",void 0);let za=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.IA5String})],za.prototype,"cPSuri",void 0);m([y({type:qp})],za.prototype,"userNotice",void 0);za=m([W({type:q.Choice})],za);class Vp{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Vp.prototype,"policyQualifierId",void 0);m([y({type:C.Any})],Vp.prototype,"qualifier",void 0);class Yc{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Yc.prototype,"policyIdentifier",void 0);m([y({type:Vp,repeated:"sequence",optional:!0})],Yc.prototype,"policyQualifiers",void 0);let Da=Lu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Lu.prototype)}};Da=Lu=m([W({type:q.Sequence,itemType:Yc})],Da);let Ra=class{constructor(e=0){this.value=e}};m([y({type:C.Integer})],Ra.prototype,"value",void 0);Ra=m([W({type:q.Choice})],Ra);let Dh=class extends Ra{};Dh=m([W({type:q.Choice})],Dh);var Fu;const Uu=`${Zn}.31`;var en;(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"})(en||(en={}));class z2 extends Wc{toJSON(){const e=[],n=this.toNumber();return n&en.aACompromise&&e.push("aACompromise"),n&en.affiliationChanged&&e.push("affiliationChanged"),n&en.cACompromise&&e.push("cACompromise"),n&en.certificateHold&&e.push("certificateHold"),n&en.cessationOfOperation&&e.push("cessationOfOperation"),n&en.keyCompromise&&e.push("keyCompromise"),n&en.privilegeWithdrawn&&e.push("privilegeWithdrawn"),n&en.superseded&&e.push("superseded"),n&en.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Hr=class{constructor(e={}){Object.assign(this,e)}};m([y({type:ke,context:0,repeated:"sequence",implicit:!0})],Hr.prototype,"fullName",void 0);m([y({type:Oi,context:1,implicit:!0})],Hr.prototype,"nameRelativeToCRLIssuer",void 0);Hr=m([W({type:q.Choice})],Hr);class Zi{constructor(e={}){Object.assign(this,e)}}m([y({type:Hr,context:0,optional:!0})],Zi.prototype,"distributionPoint",void 0);m([y({type:z2,context:1,optional:!0,implicit:!0})],Zi.prototype,"reasons",void 0);m([y({type:ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],Zi.prototype,"cRLIssuer",void 0);let Si=Fu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fu.prototype)}};Si=Fu=m([W({type:q.Sequence,itemType:Zi})],Si);var Mu;let Rh=Mu=class extends Si{constructor(e){super(e),Object.setPrototypeOf(this,Mu.prototype)}};Rh=Mu=m([W({type:q.Sequence,itemType:Zi})],Rh);class ft{constructor(e={}){this.onlyContainsUserCerts=ft.ONLY,this.onlyContainsCACerts=ft.ONLY,this.indirectCRL=ft.ONLY,this.onlyContainsAttributeCerts=ft.ONLY,Object.assign(this,e)}}ft.ONLY=!1;m([y({type:Hr,context:0,optional:!0})],ft.prototype,"distributionPoint",void 0);m([y({type:C.Boolean,context:1,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsUserCerts",void 0);m([y({type:C.Boolean,context:2,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsCACerts",void 0);m([y({type:z2,context:3,optional:!0,implicit:!0})],ft.prototype,"onlySomeReasons",void 0);m([y({type:C.Boolean,context:4,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"indirectCRL",void 0);m([y({type:C.Boolean,context:5,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsAttributeCerts",void 0);var $s;(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"})($s||($s={}));let qu=class{constructor(e=$s.unspecified){this.reason=$s.unspecified,this.reason=e}toJSON(){return $s[this.reason]}toString(){return this.toJSON()}};m([y({type:C.Enumerated})],qu.prototype,"reason",void 0);qu=m([W({type:q.Choice})],qu);var Vu;const D2=`${Zn}.37`;let Pa=Vu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Vu.prototype)}};Pa=Vu=m([W({type:q.Sequence,itemType:C.ObjectIdentifier})],Pa);const l4=`${Yi}.1`,u4=`${Yi}.2`,d4=`${Yi}.3`,p4=`${Yi}.4`,f4=`${Yi}.8`,h4=`${Yi}.9`;let Hu=class{constructor(e=new ArrayBuffer(0)){this.value=e}};m([y({type:C.Integer,converter:Me})],Hu.prototype,"value",void 0);Hu=m([W({type:q.Choice})],Hu);let Ku=class{constructor(e){this.value=new Date,e&&(this.value=e)}};m([y({type:C.GeneralizedTime})],Ku.prototype,"value",void 0);Ku=m([W({type:q.Choice})],Ku);var Gu;const R2=`${Zn}.18`;let Ph=Gu=class extends ht{constructor(e){super(e),Object.setPrototypeOf(this,Gu.prototype)}};Ph=Gu=m([W({type:q.Sequence})],Ph);const P2=`${Zn}.15`;var tn;(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"})(tn||(tn={}));class Ml extends Wc{toJSON(){const e=this.toNumber(),n=[];return e&tn.cRLSign&&n.push("crlSign"),e&tn.dataEncipherment&&n.push("dataEncipherment"),e&tn.decipherOnly&&n.push("decipherOnly"),e&tn.digitalSignature&&n.push("digitalSignature"),e&tn.encipherOnly&&n.push("encipherOnly"),e&tn.keyAgreement&&n.push("keyAgreement"),e&tn.keyCertSign&&n.push("keyCertSign"),e&tn.keyEncipherment&&n.push("keyEncipherment"),e&tn.nonRepudiation&&n.push("nonRepudiation"),n}toString(){return`[${this.toJSON().join(", ")}]`}}var Wu;class Zc{constructor(e={}){this.base=new ke,this.minimum=0,Object.assign(this,e)}}m([y({type:ke})],Zc.prototype,"base",void 0);m([y({type:C.Integer,context:0,defaultValue:0,implicit:!0})],Zc.prototype,"minimum",void 0);m([y({type:C.Integer,context:1,optional:!0,implicit:!0})],Zc.prototype,"maximum",void 0);let Ba=Wu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Wu.prototype)}};Ba=Wu=m([W({type:q.Sequence,itemType:Zc})],Ba);class B2{constructor(e={}){Object.assign(this,e)}}m([y({type:Ba,context:0,optional:!0,implicit:!0})],B2.prototype,"permittedSubtrees",void 0);m([y({type:Ba,context:1,optional:!0,implicit:!0})],B2.prototype,"excludedSubtrees",void 0);class j2{constructor(e={}){Object.assign(this,e)}}m([y({type:C.Integer,context:0,implicit:!0,optional:!0,converter:Me})],j2.prototype,"requireExplicitPolicy",void 0);m([y({type:C.Integer,context:1,implicit:!0,optional:!0,converter:Me})],j2.prototype,"inhibitPolicyMapping",void 0);var Xu;class Hp{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Hp.prototype,"issuerDomainPolicy",void 0);m([y({type:C.ObjectIdentifier})],Hp.prototype,"subjectDomainPolicy",void 0);let Bh=Xu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Xu.prototype)}};Bh=Xu=m([W({type:q.Sequence,itemType:Hp})],Bh);var Ju;const L2=`${Zn}.17`;let Yu=Ju=class extends ht{constructor(e){super(e),Object.setPrototypeOf(this,Ju.prototype)}};Yu=Ju=m([W({type:q.Sequence})],Yu);let Mn=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],Mn.prototype,"type",void 0);m([y({type:C.Any,repeated:"set"})],Mn.prototype,"values",void 0);var Zu;let jh=Zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Zu.prototype)}};jh=Zu=m([W({type:q.Sequence,itemType:Mn})],jh);const F2=`${Zn}.14`;class fr extends Up{}class U2{constructor(e={}){Object.assign(this,e)}}m([y({type:C.GeneralizedTime,context:0,implicit:!0,optional:!0})],U2.prototype,"notBefore",void 0);m([y({type:C.GeneralizedTime,context:1,implicit:!0,optional:!0})],U2.prototype,"notAfter",void 0);var As;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(As||(As={}));class M2 extends Wc{toJSON(){const e=[],n=this.toNumber();return n&As.pKIXCertificate&&e.push("pKIXCertificate"),n&As.newExtensions&&e.push("newExtensions"),n&As.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class q2{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new M2,Object.assign(this,e)}}m([y({type:C.GeneralString})],q2.prototype,"entrustVers",void 0);m([y({type:M2})],q2.prototype,"entrustInfoFlags",void 0);var Qu;let Lh=Qu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Qu.prototype)}};Lh=Qu=m([W({type:q.Sequence,itemType:ao})],Lh);class ce{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ce&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&O_(e.parameters,this.parameters)||e.parameters===this.parameters)}}m([y({type:C.ObjectIdentifier})],ce.prototype,"algorithm",void 0);m([y({type:C.Any,optional:!0})],ce.prototype,"parameters",void 0);class sn{constructor(e={}){this.algorithm=new ce,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:ce})],sn.prototype,"algorithm",void 0);m([y({type:C.BitString})],sn.prototype,"subjectPublicKey",void 0);let lt=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}};m([y({type:C.UTCTime})],lt.prototype,"utcTime",void 0);m([y({type:C.GeneralizedTime})],lt.prototype,"generalTime",void 0);lt=m([W({type:q.Choice})],lt);class co{constructor(e){this.notBefore=new lt(new Date),this.notAfter=new lt(new Date),e&&(this.notBefore=new lt(e.notBefore),this.notAfter=new lt(e.notAfter))}}m([y({type:lt})],co.prototype,"notBefore",void 0);m([y({type:lt})],co.prototype,"notAfter",void 0);var ed;let Jt=class V2{constructor(e={}){this.extnID="",this.critical=V2.CRITICAL,this.extnValue=new Ie,Object.assign(this,e)}};Jt.CRITICAL=!1;m([y({type:C.ObjectIdentifier})],Jt.prototype,"extnID",void 0);m([y({type:C.Boolean,defaultValue:Jt.CRITICAL})],Jt.prototype,"critical",void 0);m([y({type:Ie})],Jt.prototype,"extnValue",void 0);let mr=ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ed.prototype)}};mr=ed=m([W({type:q.Sequence,itemType:Jt})],mr);var Kr;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(Kr||(Kr={}));class Ut{constructor(e={}){this.version=Kr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ce,this.issuer=new Ye,this.validity=new co,this.subject=new Ye,this.subjectPublicKeyInfo=new sn,Object.assign(this,e)}}m([y({type:C.Integer,context:0,defaultValue:Kr.v1})],Ut.prototype,"version",void 0);m([y({type:C.Integer,converter:Me})],Ut.prototype,"serialNumber",void 0);m([y({type:ce})],Ut.prototype,"signature",void 0);m([y({type:Ye})],Ut.prototype,"issuer",void 0);m([y({type:co})],Ut.prototype,"validity",void 0);m([y({type:Ye})],Ut.prototype,"subject",void 0);m([y({type:sn})],Ut.prototype,"subjectPublicKeyInfo",void 0);m([y({type:C.BitString,context:1,implicit:!0,optional:!0})],Ut.prototype,"issuerUniqueID",void 0);m([y({type:C.BitString,context:2,implicit:!0,optional:!0})],Ut.prototype,"subjectUniqueID",void 0);m([y({type:mr,context:3,optional:!0})],Ut.prototype,"extensions",void 0);class Gr{constructor(e={}){this.tbsCertificate=new Ut,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:Ut})],Gr.prototype,"tbsCertificate",void 0);m([y({type:ce})],Gr.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],Gr.prototype,"signatureValue",void 0);class Qc{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new lt,Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],Qc.prototype,"userCertificate",void 0);m([y({type:lt})],Qc.prototype,"revocationDate",void 0);m([y({type:Jt,optional:!0,repeated:"sequence"})],Qc.prototype,"crlEntryExtensions",void 0);class Qn{constructor(e={}){this.signature=new ce,this.issuer=new Ye,this.thisUpdate=new lt,Object.assign(this,e)}}m([y({type:C.Integer,optional:!0})],Qn.prototype,"version",void 0);m([y({type:ce})],Qn.prototype,"signature",void 0);m([y({type:Ye})],Qn.prototype,"issuer",void 0);m([y({type:lt})],Qn.prototype,"thisUpdate",void 0);m([y({type:lt,optional:!0})],Qn.prototype,"nextUpdate",void 0);m([y({type:Qc,repeated:"sequence",optional:!0})],Qn.prototype,"revokedCertificates",void 0);m([y({type:Jt,optional:!0,context:0,repeated:"sequence"})],Qn.prototype,"crlExtensions",void 0);class Kp{constructor(e={}){this.tbsCertList=new Qn,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:Qn})],Kp.prototype,"tbsCertList",void 0);m([y({type:ce})],Kp.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],Kp.prototype,"signature",void 0);class Qi{constructor(e={}){this.issuer=new Ye,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:Ye})],Qi.prototype,"issuer",void 0);m([y({type:C.Integer,converter:Me})],Qi.prototype,"serialNumber",void 0);let zi=class{constructor(e={}){Object.assign(this,e)}};m([y({type:fr,context:0,implicit:!0})],zi.prototype,"subjectKeyIdentifier",void 0);m([y({type:Qi})],zi.prototype,"issuerAndSerialNumber",void 0);zi=m([W({type:q.Choice})],zi);var qn;(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"})(qn||(qn={}));let Rs=class extends ce{};Rs=m([W({type:q.Sequence})],Rs);let ja=class extends ce{};ja=m([W({type:q.Sequence})],ja);let Cn=class extends ce{};Cn=m([W({type:q.Sequence})],Cn);let La=class extends ce{};La=m([W({type:q.Sequence})],La);let Fh=class extends ce{};Fh=m([W({type:q.Sequence})],Fh);let td=class extends ce{};td=m([W({type:q.Sequence})],td);let es=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],es.prototype,"attrType",void 0);m([y({type:C.Any,repeated:"set"})],es.prototype,"attrValues",void 0);var nd;class In{constructor(e={}){this.version=qn.v0,this.sid=new zi,this.digestAlgorithm=new Rs,this.signatureAlgorithm=new ja,this.signature=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],In.prototype,"version",void 0);m([y({type:zi})],In.prototype,"sid",void 0);m([y({type:Rs})],In.prototype,"digestAlgorithm",void 0);m([y({type:es,repeated:"set",context:0,implicit:!0,optional:!0})],In.prototype,"signedAttrs",void 0);m([y({type:ja})],In.prototype,"signatureAlgorithm",void 0);m([y({type:Ie})],In.prototype,"signature",void 0);m([y({type:es,repeated:"set",context:1,implicit:!0,optional:!0})],In.prototype,"unsignedAttrs",void 0);let Fa=nd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,nd.prototype)}};Fa=nd=m([W({type:q.Set,itemType:In})],Fa);let Uh=class extends lt{};Uh=m([W({type:q.Choice})],Uh);let Mh=class extends In{};Mh=m([W({type:q.Sequence})],Mh);class Gp{constructor(e={}){this.acIssuer=new ke,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}m([y({type:ke})],Gp.prototype,"acIssuer",void 0);m([y({type:C.Integer})],Gp.prototype,"acSerial",void 0);m([y({type:Mn,repeated:"sequence"})],Gp.prototype,"attrs",void 0);var rd;let Ua=rd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};Ua=rd=m([W({type:q.Sequence,itemType:C.ObjectIdentifier})],Ua);class el{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}m([y({type:C.Integer,optional:!0})],el.prototype,"pathLenConstraint",void 0);m([y({type:Ua,implicit:!0,context:0,optional:!0})],el.prototype,"permittedAttrs",void 0);m([y({type:Ua,implicit:!0,context:1,optional:!0})],el.prototype,"excludedAttrs",void 0);m([y({type:C.Boolean,defaultValue:!0})],el.prototype,"permitUnSpecified",void 0);class si{constructor(e={}){this.issuer=new ht,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:ht})],si.prototype,"issuer",void 0);m([y({type:C.Integer,converter:Me})],si.prototype,"serial",void 0);m([y({type:C.BitString,optional:!0})],si.prototype,"issuerUID",void 0);var id;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(id||(id={}));class oi{constructor(e={}){this.digestedObjectType=id.publicKey,this.digestAlgorithm=new ce,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Enumerated})],oi.prototype,"digestedObjectType",void 0);m([y({type:C.ObjectIdentifier,optional:!0})],oi.prototype,"otherObjectTypeID",void 0);m([y({type:ce})],oi.prototype,"digestAlgorithm",void 0);m([y({type:C.BitString})],oi.prototype,"objectDigest",void 0);class tl{constructor(e={}){Object.assign(this,e)}}m([y({type:ht,optional:!0})],tl.prototype,"issuerName",void 0);m([y({type:si,context:0,implicit:!0,optional:!0})],tl.prototype,"baseCertificateID",void 0);m([y({type:oi,context:1,implicit:!0,optional:!0})],tl.prototype,"objectDigestInfo",void 0);let Di=class{constructor(e={}){Object.assign(this,e)}};m([y({type:ke,repeated:"sequence"})],Di.prototype,"v1Form",void 0);m([y({type:tl,context:0,implicit:!0})],Di.prototype,"v2Form",void 0);Di=m([W({type:q.Choice})],Di);class nl{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}m([y({type:C.GeneralizedTime})],nl.prototype,"notBeforeTime",void 0);m([y({type:C.GeneralizedTime})],nl.prototype,"notAfterTime",void 0);class lo{constructor(e={}){Object.assign(this,e)}}m([y({type:si,implicit:!0,context:0,optional:!0})],lo.prototype,"baseCertificateID",void 0);m([y({type:ht,implicit:!0,context:1,optional:!0})],lo.prototype,"entityName",void 0);m([y({type:oi,implicit:!0,context:2,optional:!0})],lo.prototype,"objectDigestInfo",void 0);var sd;(function(t){t[t.v2=1]="v2"})(sd||(sd={}));class _n{constructor(e={}){this.version=sd.v2,this.holder=new lo,this.issuer=new Di,this.signature=new ce,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new nl,this.attributes=[],Object.assign(this,e)}}m([y({type:C.Integer})],_n.prototype,"version",void 0);m([y({type:lo})],_n.prototype,"holder",void 0);m([y({type:Di})],_n.prototype,"issuer",void 0);m([y({type:ce})],_n.prototype,"signature",void 0);m([y({type:C.Integer,converter:Me})],_n.prototype,"serialNumber",void 0);m([y({type:nl})],_n.prototype,"attrCertValidityPeriod",void 0);m([y({type:Mn,repeated:"sequence"})],_n.prototype,"attributes",void 0);m([y({type:C.BitString,optional:!0})],_n.prototype,"issuerUniqueID",void 0);m([y({type:mr,optional:!0})],_n.prototype,"extensions",void 0);class rl{constructor(e={}){this.acinfo=new _n,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:_n})],rl.prototype,"acinfo",void 0);m([y({type:ce})],rl.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],rl.prototype,"signatureValue",void 0);var Ma;(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"})(Ma||(Ma={}));class od extends Wc{}class Wp{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier,implicit:!0,context:0})],Wp.prototype,"type",void 0);m([y({type:C.Any,implicit:!0,context:1})],Wp.prototype,"value",void 0);class Xp{constructor(e={}){this.policyId="",this.classList=new od(Ma.unclassified),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Xp.prototype,"policyId",void 0);m([y({type:od,defaultValue:new od(Ma.unclassified)})],Xp.prototype,"classList",void 0);m([y({type:Wp,repeated:"set"})],Xp.prototype,"securityCategories",void 0);class il{constructor(e={}){Object.assign(this,e)}}m([y({type:Ie})],il.prototype,"cotets",void 0);m([y({type:C.ObjectIdentifier})],il.prototype,"oid",void 0);m([y({type:C.Utf8String})],il.prototype,"string",void 0);class H2{constructor(e={}){this.values=[],Object.assign(this,e)}}m([y({type:ht,implicit:!0,context:0,optional:!0})],H2.prototype,"policyAuthority",void 0);m([y({type:il,repeated:"sequence"})],H2.prototype,"values",void 0);var ad;class sl{constructor(e={}){this.targetCertificate=new si,Object.assign(this,e)}}m([y({type:si})],sl.prototype,"targetCertificate",void 0);m([y({type:ke,optional:!0})],sl.prototype,"targetName",void 0);m([y({type:oi,optional:!0})],sl.prototype,"certDigestInfo",void 0);let Ri=class{constructor(e={}){Object.assign(this,e)}};m([y({type:ke,context:0,implicit:!0})],Ri.prototype,"targetName",void 0);m([y({type:ke,context:1,implicit:!0})],Ri.prototype,"targetGroup",void 0);m([y({type:sl,context:2,implicit:!0})],Ri.prototype,"targetCert",void 0);Ri=m([W({type:q.Choice})],Ri);let cd=ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ad.prototype)}};cd=ad=m([W({type:q.Sequence,itemType:Ri})],cd);var ld;let qh=ld=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};qh=ld=m([W({type:q.Sequence,itemType:cd})],qh);class K2{constructor(e={}){Object.assign(this,e)}}m([y({type:ht,implicit:!0,context:0,optional:!0})],K2.prototype,"roleAuthority",void 0);m([y({type:ke,implicit:!0,context:1})],K2.prototype,"roleName",void 0);class Jp{constructor(e={}){this.service=new ke,this.ident=new ke,Object.assign(this,e)}}m([y({type:ke})],Jp.prototype,"service",void 0);m([y({type:ke})],Jp.prototype,"ident",void 0);m([y({type:Ie,optional:!0})],Jp.prototype,"authInfo",void 0);var ud;class Yp{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Yp.prototype,"otherCertFormat",void 0);m([y({type:C.Any})],Yp.prototype,"otherCert",void 0);let Pi=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Gr})],Pi.prototype,"certificate",void 0);m([y({type:rl,context:2,implicit:!0})],Pi.prototype,"v2AttrCert",void 0);m([y({type:Yp,context:3,implicit:!0})],Pi.prototype,"other",void 0);Pi=m([W({type:q.Choice})],Pi);let qa=ud=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};qa=ud=m([W({type:q.Set,itemType:Pi})],qa);class ts{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ts.prototype,"contentType",void 0);m([y({type:C.Any,context:0})],ts.prototype,"content",void 0);let Ps=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Ie})],Ps.prototype,"single",void 0);m([y({type:C.Any})],Ps.prototype,"any",void 0);Ps=m([W({type:q.Choice})],Ps);class ol{constructor(e={}){this.eContentType="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ol.prototype,"eContentType",void 0);m([y({type:Ps,context:0,optional:!0})],ol.prototype,"eContent",void 0);let Bs=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Ie,context:0,implicit:!0,optional:!0})],Bs.prototype,"value",void 0);m([y({type:Ie,converter:q3,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Bs.prototype,"constructedValue",void 0);Bs=m([W({type:q.Choice})],Bs);class uo{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new La,Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],uo.prototype,"contentType",void 0);m([y({type:La})],uo.prototype,"contentEncryptionAlgorithm",void 0);m([y({type:Bs,optional:!0})],uo.prototype,"encryptedContent",void 0);class al{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],al.prototype,"keyAttrId",void 0);m([y({type:C.Any,optional:!0})],al.prototype,"keyAttr",void 0);var dd;class cl{constructor(e={}){this.subjectKeyIdentifier=new fr,Object.assign(this,e)}}m([y({type:fr})],cl.prototype,"subjectKeyIdentifier",void 0);m([y({type:C.GeneralizedTime,optional:!0})],cl.prototype,"date",void 0);m([y({type:al,optional:!0})],cl.prototype,"other",void 0);let Bi=class{constructor(e={}){Object.assign(this,e)}};m([y({type:cl,context:0,implicit:!0,optional:!0})],Bi.prototype,"rKeyId",void 0);m([y({type:Qi,optional:!0})],Bi.prototype,"issuerAndSerialNumber",void 0);Bi=m([W({type:q.Choice})],Bi);class Zp{constructor(e={}){this.rid=new Bi,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:Bi})],Zp.prototype,"rid",void 0);m([y({type:Ie})],Zp.prototype,"encryptedKey",void 0);let Va=dd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,dd.prototype)}};Va=dd=m([W({type:q.Sequence,itemType:Zp})],Va);class Qp{constructor(e={}){this.algorithm=new ce,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:ce})],Qp.prototype,"algorithm",void 0);m([y({type:C.BitString})],Qp.prototype,"publicKey",void 0);let Wr=class{constructor(e={}){Object.assign(this,e)}};m([y({type:fr,context:0,implicit:!0,optional:!0})],Wr.prototype,"subjectKeyIdentifier",void 0);m([y({type:Qp,context:1,implicit:!0,optional:!0})],Wr.prototype,"originatorKey",void 0);m([y({type:Qi,optional:!0})],Wr.prototype,"issuerAndSerialNumber",void 0);Wr=m([W({type:q.Choice})],Wr);class ns{constructor(e={}){this.version=qn.v3,this.originator=new Wr,this.keyEncryptionAlgorithm=new Cn,this.recipientEncryptedKeys=new Va,Object.assign(this,e)}}m([y({type:C.Integer})],ns.prototype,"version",void 0);m([y({type:Wr,context:0})],ns.prototype,"originator",void 0);m([y({type:Ie,context:1,optional:!0})],ns.prototype,"ukm",void 0);m([y({type:Cn})],ns.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Va})],ns.prototype,"recipientEncryptedKeys",void 0);let ji=class{constructor(e={}){Object.assign(this,e)}};m([y({type:fr,context:0,implicit:!0})],ji.prototype,"subjectKeyIdentifier",void 0);m([y({type:Qi})],ji.prototype,"issuerAndSerialNumber",void 0);ji=m([W({type:q.Choice})],ji);class po{constructor(e={}){this.version=qn.v0,this.rid=new ji,this.keyEncryptionAlgorithm=new Cn,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],po.prototype,"version",void 0);m([y({type:ji})],po.prototype,"rid",void 0);m([y({type:Cn})],po.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Ie})],po.prototype,"encryptedKey",void 0);class fo{constructor(e={}){this.keyIdentifier=new Ie,Object.assign(this,e)}}m([y({type:Ie})],fo.prototype,"keyIdentifier",void 0);m([y({type:C.GeneralizedTime,optional:!0})],fo.prototype,"date",void 0);m([y({type:al,optional:!0})],fo.prototype,"other",void 0);class ho{constructor(e={}){this.version=qn.v4,this.kekid=new fo,this.keyEncryptionAlgorithm=new Cn,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],ho.prototype,"version",void 0);m([y({type:fo})],ho.prototype,"kekid",void 0);m([y({type:Cn})],ho.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Ie})],ho.prototype,"encryptedKey",void 0);class go{constructor(e={}){this.version=qn.v0,this.keyEncryptionAlgorithm=new Cn,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],go.prototype,"version",void 0);m([y({type:td,context:0,optional:!0})],go.prototype,"keyDerivationAlgorithm",void 0);m([y({type:Cn})],go.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Ie})],go.prototype,"encryptedKey",void 0);class ef{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ef.prototype,"oriType",void 0);m([y({type:C.Any})],ef.prototype,"oriValue",void 0);let _r=class{constructor(e={}){Object.assign(this,e)}};m([y({type:po,optional:!0})],_r.prototype,"ktri",void 0);m([y({type:ns,context:1,implicit:!0,optional:!0})],_r.prototype,"kari",void 0);m([y({type:ho,context:2,implicit:!0,optional:!0})],_r.prototype,"kekri",void 0);m([y({type:go,context:3,implicit:!0,optional:!0})],_r.prototype,"pwri",void 0);m([y({type:ef,context:4,implicit:!0,optional:!0})],_r.prototype,"ori",void 0);_r=m([W({type:q.Choice})],_r);var pd;let Ha=pd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,pd.prototype)}};Ha=pd=m([W({type:q.Set,itemType:_r})],Ha);var fd;class ll{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ll.prototype,"otherRevInfoFormat",void 0);m([y({type:C.Any})],ll.prototype,"otherRevInfo",void 0);let Ka=class{constructor(e={}){this.other=new ll,Object.assign(this,e)}};m([y({type:ll,context:1,implicit:!0})],Ka.prototype,"other",void 0);Ka=m([W({type:q.Choice})],Ka);let Ga=fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}};Ga=fd=m([W({type:q.Set,itemType:Ka})],Ga);class tf{constructor(e={}){Object.assign(this,e)}}m([y({type:qa,context:0,implicit:!0,optional:!0})],tf.prototype,"certs",void 0);m([y({type:Ga,context:1,implicit:!0,optional:!0})],tf.prototype,"crls",void 0);var hd;let gd=hd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,hd.prototype)}};gd=hd=m([W({type:q.Set,itemType:es})],gd);class mo{constructor(e={}){this.version=qn.v0,this.recipientInfos=new Ha,this.encryptedContentInfo=new uo,Object.assign(this,e)}}m([y({type:C.Integer})],mo.prototype,"version",void 0);m([y({type:tf,context:0,implicit:!0,optional:!0})],mo.prototype,"originatorInfo",void 0);m([y({type:Ha})],mo.prototype,"recipientInfos",void 0);m([y({type:uo})],mo.prototype,"encryptedContentInfo",void 0);m([y({type:gd,context:1,implicit:!0,optional:!0})],mo.prototype,"unprotectedAttrs",void 0);const g4="1.2.840.113549.1.7.2";var md;let Wa=md=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,md.prototype)}};Wa=md=m([W({type:q.Set,itemType:Rs})],Wa);class rs{constructor(e={}){this.version=qn.v0,this.digestAlgorithms=new Wa,this.encapContentInfo=new ol,this.signerInfos=new Fa,Object.assign(this,e)}}m([y({type:C.Integer})],rs.prototype,"version",void 0);m([y({type:Wa})],rs.prototype,"digestAlgorithms",void 0);m([y({type:ol})],rs.prototype,"encapContentInfo",void 0);m([y({type:qa,context:0,implicit:!0,optional:!0})],rs.prototype,"certificates",void 0);m([y({type:Ga,context:1,implicit:!0,optional:!0})],rs.prototype,"crls",void 0);m([y({type:Fa})],rs.prototype,"signerInfos",void 0);const js="1.2.840.10045.2.1",nf="1.2.840.10045.4.1",G2="1.2.840.10045.4.3.1",rf="1.2.840.10045.4.3.2",sf="1.2.840.10045.4.3.3",of="1.2.840.10045.4.3.4",Vh="1.2.840.10045.3.1.7",Hh="1.3.132.0.34",Kh="1.3.132.0.35";function _o(t){return new ce({algorithm:t})}const m4=_o(nf);_o(G2);const _4=_o(rf),y4=_o(sf),w4=_o(of);let Ls=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],Ls.prototype,"fieldType",void 0);m([y({type:C.Any})],Ls.prototype,"parameters",void 0);Ls=m([W({type:q.Sequence})],Ls);class v4 extends Ie{}let Li=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.OctetString})],Li.prototype,"a",void 0);m([y({type:C.OctetString})],Li.prototype,"b",void 0);m([y({type:C.BitString,optional:!0})],Li.prototype,"seed",void 0);Li=m([W({type:q.Sequence})],Li);var _d;(function(t){t[t.ecpVer1=1]="ecpVer1"})(_d||(_d={}));let Vn=class{constructor(e={}){this.version=_d.ecpVer1,Object.assign(this,e)}};m([y({type:C.Integer})],Vn.prototype,"version",void 0);m([y({type:Ls})],Vn.prototype,"fieldID",void 0);m([y({type:Li})],Vn.prototype,"curve",void 0);m([y({type:v4})],Vn.prototype,"base",void 0);m([y({type:C.Integer,converter:Me})],Vn.prototype,"order",void 0);m([y({type:C.Integer,optional:!0})],Vn.prototype,"cofactor",void 0);Vn=m([W({type:q.Sequence})],Vn);let yr=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],yr.prototype,"namedCurve",void 0);m([y({type:C.Null})],yr.prototype,"implicitCurve",void 0);m([y({type:Vn})],yr.prototype,"specifiedCurve",void 0);yr=m([W({type:q.Choice})],yr);class ul{constructor(e={}){this.version=1,this.privateKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],ul.prototype,"version",void 0);m([y({type:Ie})],ul.prototype,"privateKey",void 0);m([y({type:yr,context:0,optional:!0})],ul.prototype,"parameters",void 0);m([y({type:C.BitString,context:1,optional:!0})],ul.prototype,"publicKey",void 0);class Xa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],Xa.prototype,"r",void 0);m([y({type:C.Integer,converter:Me})],Xa.prototype,"s",void 0);const Nt="1.2.840.113549.1.1",Xr=`${Nt}.1`,b4=`${Nt}.7`,x4=`${Nt}.9`,Es=`${Nt}.10`,$4=`${Nt}.2`,A4=`${Nt}.4`,Ja=`${Nt}.5`,E4=`${Nt}.14`,yd=`${Nt}.11`,Ya=`${Nt}.12`,Za=`${Nt}.13`,W2=`${Nt}.15`,X2=`${Nt}.16`,Qa="1.3.14.3.2.26",J2="2.16.840.1.101.3.4.2.4",ec="2.16.840.1.101.3.4.2.1",tc="2.16.840.1.101.3.4.2.2",nc="2.16.840.1.101.3.4.2.3",S4="2.16.840.1.101.3.4.2.5",k4="2.16.840.1.101.3.4.2.6",N4="1.2.840.113549.2.2",C4="1.2.840.113549.2.5",dl=`${Nt}.8`;function it(t){return new ce({algorithm:t,parameters:null})}it(N4);it(C4);const Jr=it(Qa);it(J2);it(ec);it(tc);it(nc);it(S4);it(k4);const Y2=new ce({algorithm:dl,parameters:te.serialize(Jr)}),Z2=new ce({algorithm:x4,parameters:te.serialize(Ia.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});it(Xr);it($4);it(A4);it(Ja);it(W2);it(X2);it(Ya);it(Za);it(W2);it(X2);class pl{constructor(e={}){this.hashAlgorithm=new ce(Jr),this.maskGenAlgorithm=new ce({algorithm:dl,parameters:te.serialize(Jr)}),this.pSourceAlgorithm=new ce(Z2),Object.assign(this,e)}}m([y({type:ce,context:0,defaultValue:Jr})],pl.prototype,"hashAlgorithm",void 0);m([y({type:ce,context:1,defaultValue:Y2})],pl.prototype,"maskGenAlgorithm",void 0);m([y({type:ce,context:2,defaultValue:Z2})],pl.prototype,"pSourceAlgorithm",void 0);new ce({algorithm:b4,parameters:te.serialize(new pl)});class Yr{constructor(e={}){this.hashAlgorithm=new ce(Jr),this.maskGenAlgorithm=new ce({algorithm:dl,parameters:te.serialize(Jr)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}m([y({type:ce,context:0,defaultValue:Jr})],Yr.prototype,"hashAlgorithm",void 0);m([y({type:ce,context:1,defaultValue:Y2})],Yr.prototype,"maskGenAlgorithm",void 0);m([y({type:C.Integer,context:2,defaultValue:20})],Yr.prototype,"saltLength",void 0);m([y({type:C.Integer,context:3,defaultValue:1})],Yr.prototype,"trailerField",void 0);new ce({algorithm:Es,parameters:te.serialize(new Yr)});class fl{constructor(e={}){this.digestAlgorithm=new ce,this.digest=new Ie,Object.assign(this,e)}}m([y({type:ce})],fl.prototype,"digestAlgorithm",void 0);m([y({type:Ie})],fl.prototype,"digest",void 0);var wd;class hl{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],hl.prototype,"prime",void 0);m([y({type:C.Integer,converter:Me})],hl.prototype,"exponent",void 0);m([y({type:C.Integer,converter:Me})],hl.prototype,"coefficient",void 0);let vd=wd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,wd.prototype)}};vd=wd=m([W({type:q.Sequence,itemType:hl})],vd);class On{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)}}m([y({type:C.Integer})],On.prototype,"version",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"modulus",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"publicExponent",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"privateExponent",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"prime1",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"prime2",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"exponent1",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"exponent2",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"coefficient",void 0);m([y({type:vd,optional:!0})],On.prototype,"otherPrimeInfos",void 0);class af{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],af.prototype,"modulus",void 0);m([y({type:C.Integer,converter:Me})],af.prototype,"publicExponent",void 0);var bd;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(bd||(bd={}));const $t=bd;/*! *****************************************************************************
146
+ `)}`:`${n} :`}}U_=_t;le.Constructed=U_;_t.NAME="CONSTRUCTED";class M_ extends yt{fromBER(e,n,r){return n}toBER(e){return mn}}M_.override="EndOfContentValueBlock";var q_;class Np extends ut{constructor(e={}){super(e,M_),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}q_=Np;le.EndOfContent=q_;Np.NAME=zs;var V_;class qr extends ut{constructor(e={}){super(e,yt),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}`}}V_=qr;le.Null=V_;qr.NAME="NULL";class H_ extends Tn(yt){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=ne.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,n,r){const i=ne.toUint8Array(e);return Jn(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,z_.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}H_.NAME="BooleanValueBlock";var K_;let Dc=class extends ut{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,H_),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};K_=Dc;le.Boolean=K_;Dc.NAME="BOOLEAN";class G_ extends Tn(pr){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=pr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let s=0;s<this.value.length;s++){const a=this.value[s].constructor.NAME;if(a===zs){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==D_)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?pr.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}G_.NAME="OctetStringValueBlock";var Cp;let Fr=class extends ut{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,s;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((s=r.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},G_),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 s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(s.byteLength){const a=Xi(s,0,s.byteLength);a.offset!==-1&&a.offset===r&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return _t.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,n=fe.ToHex(this.valueBlock.valueHexView);return`${e} : ${n}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof Cp&&e.push(n.valueBlock.valueHexView);return ne.concat(e)}};Cp=Fr;le.OctetString=Cp;Fr.NAME=D_;class W_ extends Tn(pr){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=pr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const l of this.value){const u=l.constructor.NAME;if(u===zs){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==R_)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=l.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return i}const s=ne.toUint8Array(e);if(!Jn(this,s,n,r))return-1;const a=s.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 l=a.subarray(1);try{if(l.byteLength){const u=Xi(l,0,l.byteLength);u.offset!==-1&&u.offset===r-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,n+r}toBER(e,n){if(this.isConstructed)return pr.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return mn;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}}}W_.NAME="BitStringValueBlock";var X_;let Ur=class extends ut{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,s;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((s=r.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},W_),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 _t.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const a of n)e.push(a.toString(2).padStart(8,"0"));const r=e.join(""),i=this.constructor.NAME,s=r.substring(0,r.length-this.valueBlock.unusedBits);return`${i} : ${s}`}}};X_=Ur;le.BitString=X_;Ur.NAME=R_;var J_;function z3(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let s=r.slice(0);const a=s.length-1,l=i.slice(0),u=l.length-1;let d=0;const p=u<a?a:u;let h=0;for(let g=p;g>=0;g--,h++){switch(!0){case h<l.length:d=s[a-h]+l[u-h]+n[0];break;default:d=s[a-h]+n[0]}switch(n[0]=d/10,!0){case h>=s.length:s=ku(new Uint8Array([d%10]),s);break;default:s[a-h]=d%10}}return n[0]>0&&(s=ku(n,s)),s}function kh(t){if(t>=fs.length)for(let e=fs.length;e<=t;e++){const n=new Uint8Array([0]);let r=fs[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const s=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=s[0]/10,r[i]=s[0]%10}n[0]>0&&(r=ku(n,r)),fs.push(r)}return fs[t]}function D3(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),s=r.slice(0),a=s.length-1,l=i.slice(0),u=l.length-1;let d,p=0;for(let h=u;h>=0;h--,p++)switch(d=s[a-p]-l[u-p]-n,!0){case d<0:n=1,s[a-p]=d+10;break;default:n=0,s[a-p]=d}if(n>0)for(let h=a-u+1;h>=0;h--,p++)if(d=s[a-p]-n,d<0)n=1,s[a-p]=d+10;else{n=0,s[a-p]=d;break}return s.slice()}class Tp extends Tn(yt){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=z_.call(this)))}constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(b3(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const s=this.fromBER(e,n,r);if(s===-1)return s;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)),s}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 s=this.valueHexView;let a="",l=!1;for(let u=s.byteLength-1;u>=0;u--){i=s[u];for(let d=0;d<8;d++){if((i&1)===1)switch(r){case e:n=D3(kh(r),n),a="-";break;default:n=z3(n,kh(r))}r++,i>>=1}}for(let u=0;u<n.length;u++)n[u]&&(l=!0),l&&(a+=Eh.charAt(n[u]));return l===!1&&(a+=Eh.charAt(0)),a}}J_=Tp;Tp.NAME="IntegerValueBlock";Object.defineProperty(J_.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var bs;class Ji extends ut{constructor(e={}){super(e,Tp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Ca(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Ca();const n=BigInt(e),r=new Oc,i=n.toString(16).replace(/^-/,""),s=new Uint8Array(fe.FromHex(i));if(n<0){const l=new Uint8Array(s.length+(s[0]&128?1:0));l[0]|=128;const d=BigInt(`0x${fe.ToHex(l)}`)+n,p=ne.toUint8Array(fe.FromHex(d.toString(16)));p[0]|=128,r.write(p)}else s[0]&128&&r.write(new Uint8Array([0])),r.write(s);return new bs({valueHex:r.final()})}convertToDER(){const e=new bs({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new bs({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}bs=Ji;le.Integer=bs;Ji.NAME="INTEGER";var Y_;class Rc extends Ji{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Y_=Rc;le.Enumerated=Y_;Rc.NAME="ENUMERATED";class Nu extends Tn(yt){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=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=s[l]&127,this.blockLength++,!!(s[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,s[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=Ti(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){Ca();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,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const n=Mr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",mn;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),s=n.byteLength-1;for(let a=0;a<s;a++)r[a]=i[a]|128;r[s]=i[s]}return r}toString(){let e="";if(this.isHexOnly)e=fe.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}}}Nu.NAME="sidBlock";class Z_ extends yt{constructor({value:e=At,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const s=new Nu;if(i=s.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,r-=s.blockLength,this.value.push(s)}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,mn;n.push(i)}return Sp(n)}fromString(e){this.value=[];let n=0,r=0,i="",s=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,s){const a=this.value[0];let l=0;switch(a.valueDec){case 0:break;case 1:l=40;break;case 2:l=80;break;default:this.value=[];return}const u=parseInt(i,10);if(isNaN(u))return;a.valueDec=u+l,s=!1}else{const a=new Nu;if(i>Number.MAX_SAFE_INTEGER){Ca();const l=BigInt(i);a.valueBigInt=l}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,s=!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}}Z_.NAME="ObjectIdentifierValueBlock";var Q_;class Pc extends ut{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Z_),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Q_=Pc;le.ObjectIdentifier=Q_;Pc.NAME="OBJECT IDENTIFIER";class Cu extends Tn(ii){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=ne.toUint8Array(e);if(!Jn(this,i,n,r))return-1;const s=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=s[l]&127,this.blockLength++,!!(s[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,s[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=Ti(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,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const n=Mr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",mn;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),s=n.byteLength-1;for(let a=0;a<s;a++)r[a]=i[a]|128;r[s]=i[s]}return r.buffer}toString(){let e="";return this.isHexOnly?e=fe.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Cu.NAME="relativeSidBlock";class e2 extends yt{constructor({value:e=At,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const s=new Cu;if(i=s.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,r-=s.blockLength,this.value.push(s)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,mn;r.push(s)}return Sp(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 s=new Cu;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}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}}e2.NAME="RelativeObjectIdentifierValueBlock";var t2;class Ip extends ut{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,e2),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}t2=Ip;le.RelativeObjectIdentifier=t2;Ip.NAME="RelativeObjectIdentifier";var n2;class on extends _t{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}n2=on;le.Sequence=n2;on.NAME="SEQUENCE";var r2;let Sn=class extends _t{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};r2=Sn;le.Set=r2;Sn.NAME="SET";class i2 extends Tn(yt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=At}toJSON(){return{...super.toJSON(),value:this.value}}}i2.NAME="StringValueBlock";class s2 extends i2{}s2.NAME="SimpleStringValueBlock";class Ft extends kp{constructor({...e}={}){super(e,s2)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,ne.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}}Ft.NAME="SIMPLE STRING";class o2 extends Ft{fromBuffer(e){this.valueBlock.valueHexView=ne.toUint8Array(e);try{this.valueBlock.value=fe.ToUtf8String(e)}catch(n){this.warnings.push(`Error during "decodeURIComponent": ${n}, using raw string`),this.valueBlock.value=fe.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf8String(e)),this.valueBlock.value=e}}o2.NAME="Utf8StringValueBlock";var a2;class Yn extends o2{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}a2=Yn;le.Utf8String=a2;Yn.NAME="UTF8String";class c2 extends Ft{fromBuffer(e){this.valueBlock.value=fe.ToUtf16String(e),this.valueBlock.valueHexView=ne.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf16String(e))}}c2.NAME="BmpStringValueBlock";var l2;class Bc extends c2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}l2=Bc;le.BmpString=l2;Bc.NAME="BMPString";class u2 extends Ft{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 s=Mr(e.charCodeAt(i),8),a=new Uint8Array(s);if(a.length>4)continue;const l=4-a.length;for(let u=a.length-1;u>=0;u--)r[i*4+u+l]=a[u]}this.valueBlock.value=e}}u2.NAME="UniversalStringValueBlock";var d2;class jc extends u2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}d2=jc;le.UniversalString=d2;jc.NAME="UniversalString";var p2;class Lc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}p2=Lc;le.NumericString=p2;Lc.NAME="NumericString";var f2;class Fc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}f2=Fc;le.PrintableString=f2;Fc.NAME="PrintableString";var h2;class Uc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}h2=Uc;le.TeletexString=h2;Uc.NAME="TeletexString";var g2;class Mc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}g2=Mc;le.VideotexString=g2;Mc.NAME="VideotexString";var m2;class qc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}m2=qc;le.IA5String=m2;qc.NAME="IA5String";var _2;class Vc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_2=Vc;le.GraphicString=_2;Vc.NAME="GraphicString";var y2;class so extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}y2=so;le.VisibleString=y2;so.NAME="VisibleString";var w2;class Hc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}w2=Hc;le.GeneralString=w2;Hc.NAME="GeneralString";var v2;class Kc extends Ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}v2=Kc;le.CharacterString=v2;Kc.NAME="CharacterString";var b2;class oo extends so{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,ne.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]=Pt(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=Pt(this.month,2),n[2]=Pt(this.day,2),n[3]=Pt(this.hour,2),n[4]=Pt(this.minute,2),n[5]=Pt(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}}}b2=oo;le.UTCTime=b2;oo.NAME="UTCTime";var x2;class Gc extends oo{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(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let n=!1,r="",i="",s=0,a,l=0,u=0;if(e[e.length-1]==="Z")r=e.substring(0,e.length-1),n=!0;else{const h=new Number(e[e.length-1]);if(isNaN(h.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 h=1,g=r.indexOf("+"),A="";if(g===-1&&(g=r.indexOf("-"),h=-1),g!==-1){if(A=r.substring(g+1),r=r.substring(0,g),A.length!==2&&A.length!==4)throw new Error("Wrong input string for conversion");let $=parseInt(A.substring(0,2),10);if(isNaN($.valueOf()))throw new Error("Wrong input string for conversion");if(l=h*$,A.length===4){if($=parseInt(A.substring(2,4),10),isNaN($.valueOf()))throw new Error("Wrong input string for conversion");u=h*$}}}let d=r.indexOf(".");if(d===-1&&(d=r.indexOf(",")),d!==-1){const h=new Number(`0${r.substring(d)}`);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");s=h.valueOf(),i=r.substring(0,d)}else i=r;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,d!==-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,d!==-1){let h=60*s;this.minute=Math.floor(h),h=60*(h-this.minute),this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*s;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const h=1e3*s;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}const p=a.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let h=1;h<p.length;h++)switch(h){case 1:this.year=parseInt(p[h],10);break;case 2:this.month=parseInt(p[h],10);break;case 3:this.day=parseInt(p[h],10);break;case 4:this.hour=parseInt(p[h],10)+l;break;case 5:this.minute=parseInt(p[h],10)+u;break;case 6:this.second=parseInt(p[h],10);break;default:throw new Error("Wrong input string for conversion")}if(n===!1){const h=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=h.getUTCFullYear(),this.month=h.getUTCMonth(),this.day=h.getUTCDay(),this.hour=h.getUTCHours(),this.minute=h.getUTCMinutes(),this.second=h.getUTCSeconds(),this.millisecond=h.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const n=[];return n.push(Pt(this.year,4)),n.push(Pt(this.month,2)),n.push(Pt(this.day,2)),n.push(Pt(this.hour,2)),n.push(Pt(this.minute,2)),n.push(Pt(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(Pt(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}x2=Gc;le.GeneralizedTime=x2;Gc.NAME="GeneralizedTime";var $2;class Op extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}$2=Op;le.DATE=$2;Op.NAME="DATE";var A2;class zp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}A2=zp;le.TimeOfDay=A2;zp.NAME="TimeOfDay";var E2;class Dp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}E2=Dp;le.DateTime=E2;Dp.NAME="DateTime";var S2;class Rp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}S2=Rp;le.Duration=S2;Rp.NAME="Duration";var k2;class Pp extends Yn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}k2=Pp;le.TIME=k2;Pp.NAME="TIME";class Vr{constructor({name:e=At,optional:n=!1}={}){this.name=e,this.optional=n}}class Bp extends Vr{constructor({value:e=[],...n}={}){super(n),this.value=e}}class Ta extends Vr{constructor({value:e=new Vr,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class R3{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=ne.toUint8Array(e)}constructor({data:e=zc}={}){this.dataView=ne.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=ne.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function lr(t,e,n){if(n instanceof Bp){for(const s of n.value)if(lr(t,e,s).verified)return{verified:!0,result:t};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Ul)&&(s.name=n.name),s}}if(n instanceof Vr)return n.hasOwnProperty(Ul)&&(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(!(A3 in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(N3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(C3 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(E3)===!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(S3)===!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(k3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!($3 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(!(Sh in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=n.idBlock.valueHexView,a=e.idBlock.valueHexView;if(s.length!==a.length)return{verified:!1,result:t};for(let l=0;l<s.length;l++)if(s[l]!==a[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&(t[n.name]=e)),n instanceof le.Constructed){let s=0,a={verified:!1,result:{error:"Unknown error"}},l=n.valueBlock.value.length;if(l>0&&n.valueBlock.value[0]instanceof Ta&&(l=e.valueBlock.value.length),l===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&n.valueBlock.value.length!==0){let u=!0;for(let d=0;d<n.valueBlock.value.length;d++)u=u&&(n.valueBlock.value[d].optional||!1);return u?{verified:!0,result:t}:(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let u=0;u<l;u++)if(u-s>=e.valueBlock.value.length){if(n.valueBlock.value[u].optional===!1){const d={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,At),n.name&&(delete t[n.name],d.name=n.name)),d}}else if(n.valueBlock.value[0]instanceof Ta){if(a=lr(t,e.valueBlock.value[u],n.valueBlock.value[0].value),a.verified===!1)if(n.valueBlock.value[0].optional)s++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&delete t[n.name]),a;if(Ul in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let d={};T3 in n.valueBlock.value[0]&&n.valueBlock.value[0].local?d=e:d=t,typeof d[n.valueBlock.value[0].name]>"u"&&(d[n.valueBlock.value[0].name]=[]),d[n.valueBlock.value[0].name].push(e.valueBlock.value[u])}}else if(a=lr(t,e.valueBlock.value[u-s],n.valueBlock.value[u]),a.verified===!1)if(n.valueBlock.value[u].optional)s++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&delete t[n.name]),a;if(a.verified===!1){const u={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&(delete t[n.name],u.name=n.name)),u}return{verified:!0,result:t}}if(n.primitiveSchema&&Sh in e.valueBlock){const s=Xi(e.valueBlock.valueHexView);if(s.offset===-1){const a={verified:!1,result:s.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,At),n.name&&(delete t[n.name],a.name=n.name)),a}return lr(t,s.result,n.primitiveSchema)}return{verified:!0,result:t}}function P3(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Xi(ne.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:lr(n.result,n.result,e)}const N2=Object.freeze(Object.defineProperty({__proto__:null,Any:Vr,BaseBlock:ut,BaseStringBlock:kp,BitString:Ur,BmpString:Bc,Boolean:Dc,CharacterString:Kc,Choice:Bp,Constructed:_t,DATE:Op,DateTime:Dp,Duration:Rp,EndOfContent:Np,Enumerated:Rc,GeneralString:Hc,GeneralizedTime:Gc,GraphicString:Vc,HexBlock:Tn,IA5String:qc,Integer:Ji,Null:qr,NumericString:Lc,ObjectIdentifier:Pc,OctetString:Fr,Primitive:io,PrintableString:Fc,RawData:R3,RelativeObjectIdentifier:Ip,Repeated:Ta,Sequence:on,Set:Sn,TIME:Pp,TeletexString:Uc,TimeOfDay:zp,UTCTime:oo,UniversalString:jc,Utf8String:Yn,ValueBlock:yt,VideotexString:Mc,ViewWriter:Oc,VisibleString:so,compareSchema:lr,fromBER:Ei,verifySchema:P3},Symbol.toStringTag,{value:"Module"}));var q;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(q||(q={}));var C;(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"})(C||(C={}));class Wc{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(ne.isBufferSource(e))this.unusedBits=n,this.value=ne.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Ur))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 Ur({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Ur({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 s=0;for(;s<r;)i[s]=parseInt(n.slice(s<<3,(s<<3)+8),2),s++;this.value=i.buffer}}class Ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):ne.isBufferSource(e)?this.buffer=ne.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Fr))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Fr({valueHex:this.buffer})}toSchema(e){return new Fr({name:e})}}const B3={fromASN:t=>t instanceof qr?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new qr;const e=Ei(t);if(e.result.error)throw new Error(e.result.error);return e.result}},j3={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new Ji({value:+t})},L3={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new Rc({value:t})},Me={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Ji({valueHex:t})},F3={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Ur({valueHex:t})},U3={fromASN:t=>t.valueBlock.toString(),toASN:t=>new Pc({value:t})},M3={fromASN:t=>t.valueBlock.value,toASN:t=>new Dc({value:t})},Ia={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Fr({valueHex:t})},q3={fromASN:t=>new Ie(t.getValue()),toASN:t=>t.toASN()};function Yt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const C2=Yt(Yn),V3=Yt(Bc),H3=Yt(jc),K3=Yt(Lc),G3=Yt(Fc),W3=Yt(Uc),X3=Yt(Mc),J3=Yt(qc),Y3=Yt(Vc),Z3=Yt(so),Q3=Yt(Hc),e4=Yt(Kc),t4={fromASN:t=>t.toDate(),toASN:t=>new oo({valueDate:t})},n4={fromASN:t=>t.toDate(),toASN:t=>new Gc({valueDate:t})},r4={fromASN:()=>null,toASN:()=>new qr};function xs(t){switch(t){case C.Any:return B3;case C.BitString:return F3;case C.BmpString:return V3;case C.Boolean:return M3;case C.CharacterString:return e4;case C.Enumerated:return L3;case C.GeneralString:return Q3;case C.GeneralizedTime:return n4;case C.GraphicString:return Y3;case C.IA5String:return J3;case C.Integer:return j3;case C.Null:return r4;case C.NumericString:return K3;case C.ObjectIdentifier:return U3;case C.OctetString:return Ia;case C.PrintableString:return G3;case C.TeletexString:return W3;case C.UTCTime:return t4;case C.UniversalString:return H3;case C.Utf8String:return C2;case C.VideotexString:return X3;case C.VisibleString:return Z3;default:return null}}function Ln(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Ln(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function T2(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:T2(n)}return!1}function i4(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 s4{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:q.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 s in r.items){const a=r.items[s],l=n?s:"";let u;if(typeof a.type=="number"){const p=C[a.type],h=N2[p];if(!h)throw new Error(`Cannot get ASN1 class by name '${p}'`);u=new h({name:l})}else Ln(a.type)?u=new a.type().toSchema(l):a.optional?this.get(a.type).type===q.Choice?u=new Vr({name:l}):(u=this.create(a.type,!1),u.name=l):u=new Vr({name:l});const d=!!a.optional||a.defaultValue!==void 0;if(a.repeated){u.name="";const p=a.repeated==="set"?Sn:on;u=new p({name:"",value:[new Ta({name:l,value:u})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||Ln(a.type)){const p=a.repeated?_t:io;i.push(new p({name:l,optional:d,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const p=!!a.repeated;let h=p?u:this.get(a.type,!0).schema;h="valueBlock"in h?h.valueBlock.value:h.value,i.push(new _t({name:p?"":l,optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:h}))}else i.push(new _t({optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:[u]}));else u.optional=d,i.push(u)}switch(r.type){case q.Sequence:return new on({value:i,name:""});case q.Set:return new Sn({value:i,name:""});case q.Choice:return new Bp({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 rt=new s4,X=t=>e=>{let n;rt.has(e)?n=rt.get(e):(n=rt.createDefault(e),rt.set(e,n)),Object.assign(n,t)},y=t=>(e,n)=>{let r;rt.has(e.constructor)?r=rt.get(e.constructor):(r=rt.createDefault(e.constructor),rt.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const s=xs(t.type);if(!s)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=s}r.items[n]=i};class hs extends Error{constructor(){super(...arguments),this.schemas=[]}}class o4{static parse(e,n){const r=Ei(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){try{if(Ln(n))return new n().fromASN(e);const r=rt.get(n);rt.cache(n);let i=r.schema;const s=this.handleChoiceTypes(e,r,n,i);if(s!=null&&s.result)return s.result;s!=null&&s.targetSchema&&(i=s.targetSchema);const a=this.handleSequenceTypes(e,r,n,i);if(a&&"isManualMapping"in a)return a.result;const l=a,u=new n;return T2(n)?this.handleArrayTypes(e,r,n):(this.processSchemaItems(r,l,u),u)}catch(r){throw r instanceof hs&&r.schemas.push(n.name),r}}static handleChoiceTypes(e,n,r,i){if(e.constructor===_t&&n.type===q.Choice&&e.idBlock.tagClass===3)for(const s in n.items){const a=n.items[s];if(a.context===e.idBlock.tagNumber&&a.implicit&&typeof a.type=="function"&&rt.has(a.type)){const l=rt.get(a.type);if(l&&l.type===q.Sequence){const u=new on;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in u.valueBlock){u.valueBlock.value=e.valueBlock.value;const d=this.fromASN(u,a.type),p=new r;return p[s]=d,{result:p}}}}}else if(e.constructor===_t&&n.type!==q.Choice){const s=new _t({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const a in n.items)delete e[a];return{targetSchema:s}}return null}static handleSequenceTypes(e,n,r,i){if(n.type===q.Sequence){if(Object.keys(n.items).filter(l=>{const u=n.items[l];return u.optional&&typeof u.type=="function"&&rt.has(u.type)&&rt.get(u.type).type===q.Choice}).length>0&&"value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&r.name==="CertReqMsg")return this.handleManualMapping(e,n,r);const a=lr({},e,i);if(!a.verified)throw new hs(`Data does not match to ${r.name} ASN1 schema. ${a.result.error}`);return a}else{const s=lr({},e,i);if(!s.verified)throw new hs(`Data does not match to ${r.name} ASN1 schema. ${s.result.error}`);return s}}static handleManualMapping(e,n,r){const i=new r,s=e.valueBlock.value,a=Object.keys(n.items);let l=0;for(let u=0;u<a.length;u++){const d=a[u],p=n.items[d];if(l>=s.length)break;if(p.repeated){i[d]=this.processRepeatedField(s,l,p);break}else if(typeof p.type=="number")i[d]=this.processPrimitiveField(s[l],p),l++;else if(this.isOptionalChoiceField(p)){const h=this.processOptionalChoiceField(s[l],p);h.processed&&(i[d]=h.value,l++)}else i[d]=this.fromASN(s[l],p.type),l++}return{result:i,verified:!0,isManualMapping:!0}}static processRepeatedField(e,n,r){let i=e.slice(n);if(i.length===1&&i[0].constructor.name==="Sequence"){const s=i[0];s.valueBlock&&s.valueBlock.value&&Array.isArray(s.valueBlock.value)&&(i=s.valueBlock.value)}if(typeof r.type=="number"){const s=xs(r.type);if(!s)throw new Error(`No converter for ASN.1 type ${r.type}`);return i.filter(a=>a&&a.valueBlock).map(a=>{try{return s.fromASN(a)}catch{return}}).filter(a=>a!==void 0)}else return i.filter(s=>s&&s.valueBlock).map(s=>{try{return this.fromASN(s,r.type)}catch{return}}).filter(s=>s!==void 0)}static processPrimitiveField(e,n){const r=xs(n.type);if(!r)throw new Error(`No converter for ASN.1 type ${n.type}`);return r.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&rt.has(e.type)&&rt.get(e.type).type===q.Choice}static processOptionalChoiceField(e,n){try{return{processed:!0,value:this.fromASN(e,n.type)}}catch(r){if(r instanceof hs&&/Wrong values for Choice type/.test(r.message))return{processed:!1};throw r}}static handleArrayTypes(e,n,r){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 i=n.itemType;if(typeof i=="number"){const s=xs(i);if(!s)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);return r.from(e.valueBlock.value,a=>s.fromASN(a))}else return r.from(e.valueBlock.value,s=>this.fromASN(s,i))}static processSchemaItems(e,n,r){for(const i in e.items){const s=n.result[i];if(!s)continue;const a=e.items[i],l=a.type;typeof l=="number"||Ln(l)?r[i]=this.processPrimitiveSchemaItem(s,a,l):r[i]=this.processComplexSchemaItem(s,a,l)}}static processPrimitiveSchemaItem(e,n,r){var i;const s=(i=n.converter)!==null&&i!==void 0?i:Ln(r)?new r:null;if(!s)throw new Error("Converter is empty");return n.repeated?this.processRepeatedPrimitiveItem(e,n,s):this.processSinglePrimitiveItem(e,n,r,s)}static processRepeatedPrimitiveItem(e,n,r){if(n.implicit){const i=n.repeated==="sequence"?on:Sn,s=new i;s.valueBlock=e.valueBlock;const a=Ei(s.toBER(!1));if(a.offset===-1)throw new Error(`Cannot parse the child item. ${a.result.error}`);if(!("value"in a.result.valueBlock&&Array.isArray(a.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=a.result.valueBlock.value;return Array.from(l,u=>r.fromASN(u))}else return Array.from(e,i=>r.fromASN(i))}static processSinglePrimitiveItem(e,n,r,i){let s=e;if(n.implicit){let a;if(Ln(r))a=new r().toSchema("");else{const l=C[r],u=N2[l];if(!u)throw new Error(`Cannot get '${l}' class from asn1js module`);a=new u}a.valueBlock=s.valueBlock,s=Ei(a.toBER(!1)).result}return i.fromASN(s)}static processComplexSchemaItem(e,n,r){if(n.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,i=>this.fromASN(i,r))}else{const i=this.handleImplicitTagging(e,n,r);if(this.isOptionalChoiceField(n))try{return this.fromASN(i,r)}catch(s){if(s instanceof hs&&/Wrong values for Choice type/.test(s.message))return;throw s}else return this.fromASN(i,r)}}static handleImplicitTagging(e,n,r){if(n.implicit&&typeof n.context=="number"){const i=rt.get(r);if(i.type===q.Sequence){const s=new on;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in s.valueBlock)return s.valueBlock.value=e.valueBlock.value,s}else if(i.type===q.Set){const s=new Sn;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in s.valueBlock)return s.valueBlock.value=e.valueBlock.value,s}}return e}}class jp{static serialize(e){return e instanceof ut?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Ln(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=rt.get(n);rt.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=xs(r.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(l=>a.toASN(l))}else i=e.map(a=>this.toAsnItem({type:r.itemType},"[]",n,a))}else for(const a in r.items){const l=r.items[a],u=e[a];if(u===void 0||l.defaultValue===u||typeof l.defaultValue=="object"&&typeof u=="object"&&i4(this.serialize(l.defaultValue),this.serialize(u)))continue;const d=jp.toAsnItem(l,a,n,u);if(typeof l.context=="number")if(l.implicit)if(!l.repeated&&(typeof l.type=="number"||Ln(l.type))){const p={};p.valueHex=d instanceof qr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new io({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},...p}))}else i.push(new _t({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:d.valueBlock.value}));else i.push(new _t({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:[d]}));else l.repeated?i=i.concat(d):i.push(d)}let s;switch(r.type){case q.Sequence:s=new on({value:i});break;case q.Set:s=new Sn({value:i});break;case q.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,n,r,i){let s;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${n}' doesn't have converter for type ${C[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const l=Array.from(i,d=>a.toASN(d)),u=e.repeated==="sequence"?on:Sn;s=new u({value:l})}else s=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,u=>this.toASN(u)),l=e.repeated==="sequence"?on:Sn;s=new l({value:a})}else s=this.toASN(i);return s}}class De extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const n of e)this.push(n)}}}class te{static serialize(e){return jp.serialize(e)}static parse(e,n){return o4.parse(e,n)}static toString(e){const n=ne.isBufferSource(e)?ne.toArrayBuffer(e):te.serialize(e),r=Ei(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function m(t,e,n,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}class Nh{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const n=e.split(".");if(n.length!==4)throw new Error("Invalid IPv4 address");return n.map(r=>{const i=parseInt(r,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(e){const r=this.expandIPv6(e).split(":");if(r.length!==8)throw new Error("Invalid IPv6 address");return r.reduce((i,s)=>{const a=parseInt(s,16);if(isNaN(a)||a<0||a>65535)throw new Error("Invalid IPv6 address part");return i.push(a>>8&255),i.push(a&255),i},[])}static expandIPv6(e){if(!e.includes("::"))return e;const n=e.split("::");if(n.length>2)throw new Error("Invalid IPv6 address");const r=n[0]?n[0].split(":"):[],i=n[1]?n[1].split(":"):[],s=8-(r.length+i.length);if(s<0)throw new Error("Invalid IPv6 address");return[...r,...Array(s).fill("0"),...i].join(":")}static formatIPv6(e){const n=[];for(let r=0;r<16;r+=2)n.push((e[r]<<8|e[r+1]).toString(16));return this.compressIPv6(n.join(":"))}static compressIPv6(e){const n=e.split(":");let r=-1,i=0,s=-1,a=0;for(let l=0;l<n.length;l++)n[l]==="0"?(s===-1&&(s=l),a++):(a>i&&(r=s,i=a),s=-1,a=0);if(a>i&&(r=s,i=a),i>1){const l=n.slice(0,r).join(":"),u=n.slice(r+i).join(":");return`${l}::${u}`}return e}static parseCIDR(e){const[n,r]=e.split("/"),i=parseInt(r,10);if(this.isIPv4(n)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(n),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(n),i]}}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,s)=>i+ +s,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){const n=new Uint8Array(e);if(n.length===4)return Array.from(n).join(".");if(n.length===16)return this.formatIPv6(n);if(n.length===8||n.length===32){const r=n.length/2,i=n.slice(0,r),s=n.slice(r);if(n.every(u=>u===0))return n.length===8?"0.0.0.0/0":"::/0";const l=s.reduce((u,d)=>u+(d.toString(2).match(/1/g)||[]).length,0);return n.length===8?`${Array.from(i).join(".")}/${l}`:`${this.formatIPv6(i)}/${l}`}return this.decodeIP(fe.ToHex(e))}static fromString(e){if(e.includes("/")){const[r,i]=this.parseCIDR(e),s=new Uint8Array(r.length);let a=i;for(let u=0;u<s.length;u++)a>=8?(s[u]=255,a-=8):a>0&&(s[u]=255<<8-a,a=0);const l=new Uint8Array(r.length*2);return l.set(r,0),l.set(s,r.length),l.buffer}const n=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(n).buffer}}var Tu,Iu,Ou;let dt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};m([y({type:C.TeletexString})],dt.prototype,"teletexString",void 0);m([y({type:C.PrintableString})],dt.prototype,"printableString",void 0);m([y({type:C.UniversalString})],dt.prototype,"universalString",void 0);m([y({type:C.Utf8String})],dt.prototype,"utf8String",void 0);m([y({type:C.BmpString})],dt.prototype,"bmpString",void 0);dt=m([X({type:q.Choice})],dt);let Ii=class extends dt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?fe.ToHex(this.anyValue):super.toString())}};m([y({type:C.IA5String})],Ii.prototype,"ia5String",void 0);m([y({type:C.Any})],Ii.prototype,"anyValue",void 0);Ii=m([X({type:q.Choice})],Ii);class Xc{constructor(e={}){this.type="",this.value=new Ii,Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Xc.prototype,"type",void 0);m([y({type:Ii})],Xc.prototype,"value",void 0);let Oi=Tu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Tu.prototype)}};Oi=Tu=m([X({type:q.Set,itemType:Xc})],Oi);let zu=Iu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Iu.prototype)}};zu=Iu=m([X({type:q.Sequence,itemType:Oi})],zu);let Ye=Ou=class extends zu{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};Ye=Ou=m([X({type:q.Sequence})],Ye);const a4={fromASN:t=>Nh.toString(Ia.fromASN(t)),toASN:t=>Ia.toASN(Nh.fromString(t))};class Ds{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Ds.prototype,"typeId",void 0);m([y({type:C.Any,context:0})],Ds.prototype,"value",void 0);class Lp{constructor(e={}){this.partyName=new dt,Object.assign(this,e)}}m([y({type:dt,optional:!0,context:0,implicit:!0})],Lp.prototype,"nameAssigner",void 0);m([y({type:dt,context:1,implicit:!0})],Lp.prototype,"partyName",void 0);let ke=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Ds,context:0,implicit:!0})],ke.prototype,"otherName",void 0);m([y({type:C.IA5String,context:1,implicit:!0})],ke.prototype,"rfc822Name",void 0);m([y({type:C.IA5String,context:2,implicit:!0})],ke.prototype,"dNSName",void 0);m([y({type:C.Any,context:3,implicit:!0})],ke.prototype,"x400Address",void 0);m([y({type:Ye,context:4,implicit:!1})],ke.prototype,"directoryName",void 0);m([y({type:Lp,context:5})],ke.prototype,"ediPartyName",void 0);m([y({type:C.IA5String,context:6,implicit:!0})],ke.prototype,"uniformResourceIdentifier",void 0);m([y({type:C.OctetString,context:7,implicit:!0,converter:a4})],ke.prototype,"iPAddress",void 0);m([y({type:C.ObjectIdentifier,context:8,implicit:!0})],ke.prototype,"registeredID",void 0);ke=m([X({type:q.Choice})],ke);const Fp="1.3.6.1.5.5.7",c4=`${Fp}.1`,Yi=`${Fp}.3`,Jc=`${Fp}.48`,Ch=`${Jc}.1`,Th=`${Jc}.2`,Ih=`${Jc}.3`,Oh=`${Jc}.5`,Zn="2.5.29";var Du;const Ru=`${c4}.1`;class ao{constructor(e={}){this.accessMethod="",this.accessLocation=new ke,Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ao.prototype,"accessMethod",void 0);m([y({type:ke})],ao.prototype,"accessLocation",void 0);let bi=Du=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Du.prototype)}};bi=Du=m([X({type:q.Sequence,itemType:ao})],bi);const Pu=`${Zn}.35`;class Up extends Ie{}class jr{constructor(e={}){e&&Object.assign(this,e)}}m([y({type:Up,context:0,optional:!0,implicit:!0})],jr.prototype,"keyIdentifier",void 0);m([y({type:ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],jr.prototype,"authorityCertIssuer",void 0);m([y({type:C.Integer,context:2,optional:!0,implicit:!0,converter:Me})],jr.prototype,"authorityCertSerialNumber",void 0);const I2=`${Zn}.19`;class Oa{constructor(e={}){this.cA=!1,Object.assign(this,e)}}m([y({type:C.Boolean,defaultValue:!1})],Oa.prototype,"cA",void 0);m([y({type:C.Integer,optional:!0})],Oa.prototype,"pathLenConstraint",void 0);var Bu;let ht=Bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};ht=Bu=m([X({type:q.Sequence,itemType:ke})],ht);var ju;let zh=ju=class extends ht{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};zh=ju=m([X({type:q.Sequence})],zh);var Lu;const O2=`${Zn}.32`;let Un=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};m([y({type:C.IA5String})],Un.prototype,"ia5String",void 0);m([y({type:C.VisibleString})],Un.prototype,"visibleString",void 0);m([y({type:C.BmpString})],Un.prototype,"bmpString",void 0);m([y({type:C.Utf8String})],Un.prototype,"utf8String",void 0);Un=m([X({type:q.Choice})],Un);class Mp{constructor(e={}){this.organization=new Un,this.noticeNumbers=[],Object.assign(this,e)}}m([y({type:Un})],Mp.prototype,"organization",void 0);m([y({type:C.Integer,repeated:"sequence"})],Mp.prototype,"noticeNumbers",void 0);class qp{constructor(e={}){Object.assign(this,e)}}m([y({type:Mp,optional:!0})],qp.prototype,"noticeRef",void 0);m([y({type:Un,optional:!0})],qp.prototype,"explicitText",void 0);let za=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.IA5String})],za.prototype,"cPSuri",void 0);m([y({type:qp})],za.prototype,"userNotice",void 0);za=m([X({type:q.Choice})],za);class Vp{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Vp.prototype,"policyQualifierId",void 0);m([y({type:C.Any})],Vp.prototype,"qualifier",void 0);class Yc{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Yc.prototype,"policyIdentifier",void 0);m([y({type:Vp,repeated:"sequence",optional:!0})],Yc.prototype,"policyQualifiers",void 0);let Da=Lu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Lu.prototype)}};Da=Lu=m([X({type:q.Sequence,itemType:Yc})],Da);let Ra=class{constructor(e=0){this.value=e}};m([y({type:C.Integer})],Ra.prototype,"value",void 0);Ra=m([X({type:q.Choice})],Ra);let Dh=class extends Ra{};Dh=m([X({type:q.Choice})],Dh);var Fu;const Uu=`${Zn}.31`;var en;(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"})(en||(en={}));class z2 extends Wc{toJSON(){const e=[],n=this.toNumber();return n&en.aACompromise&&e.push("aACompromise"),n&en.affiliationChanged&&e.push("affiliationChanged"),n&en.cACompromise&&e.push("cACompromise"),n&en.certificateHold&&e.push("certificateHold"),n&en.cessationOfOperation&&e.push("cessationOfOperation"),n&en.keyCompromise&&e.push("keyCompromise"),n&en.privilegeWithdrawn&&e.push("privilegeWithdrawn"),n&en.superseded&&e.push("superseded"),n&en.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Hr=class{constructor(e={}){Object.assign(this,e)}};m([y({type:ke,context:0,repeated:"sequence",implicit:!0})],Hr.prototype,"fullName",void 0);m([y({type:Oi,context:1,implicit:!0})],Hr.prototype,"nameRelativeToCRLIssuer",void 0);Hr=m([X({type:q.Choice})],Hr);class Zi{constructor(e={}){Object.assign(this,e)}}m([y({type:Hr,context:0,optional:!0})],Zi.prototype,"distributionPoint",void 0);m([y({type:z2,context:1,optional:!0,implicit:!0})],Zi.prototype,"reasons",void 0);m([y({type:ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],Zi.prototype,"cRLIssuer",void 0);let Si=Fu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fu.prototype)}};Si=Fu=m([X({type:q.Sequence,itemType:Zi})],Si);var Mu;let Rh=Mu=class extends Si{constructor(e){super(e),Object.setPrototypeOf(this,Mu.prototype)}};Rh=Mu=m([X({type:q.Sequence,itemType:Zi})],Rh);class ft{constructor(e={}){this.onlyContainsUserCerts=ft.ONLY,this.onlyContainsCACerts=ft.ONLY,this.indirectCRL=ft.ONLY,this.onlyContainsAttributeCerts=ft.ONLY,Object.assign(this,e)}}ft.ONLY=!1;m([y({type:Hr,context:0,optional:!0})],ft.prototype,"distributionPoint",void 0);m([y({type:C.Boolean,context:1,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsUserCerts",void 0);m([y({type:C.Boolean,context:2,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsCACerts",void 0);m([y({type:z2,context:3,optional:!0,implicit:!0})],ft.prototype,"onlySomeReasons",void 0);m([y({type:C.Boolean,context:4,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"indirectCRL",void 0);m([y({type:C.Boolean,context:5,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsAttributeCerts",void 0);var $s;(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"})($s||($s={}));let qu=class{constructor(e=$s.unspecified){this.reason=$s.unspecified,this.reason=e}toJSON(){return $s[this.reason]}toString(){return this.toJSON()}};m([y({type:C.Enumerated})],qu.prototype,"reason",void 0);qu=m([X({type:q.Choice})],qu);var Vu;const D2=`${Zn}.37`;let Pa=Vu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Vu.prototype)}};Pa=Vu=m([X({type:q.Sequence,itemType:C.ObjectIdentifier})],Pa);const l4=`${Yi}.1`,u4=`${Yi}.2`,d4=`${Yi}.3`,p4=`${Yi}.4`,f4=`${Yi}.8`,h4=`${Yi}.9`;let Hu=class{constructor(e=new ArrayBuffer(0)){this.value=e}};m([y({type:C.Integer,converter:Me})],Hu.prototype,"value",void 0);Hu=m([X({type:q.Choice})],Hu);let Ku=class{constructor(e){this.value=new Date,e&&(this.value=e)}};m([y({type:C.GeneralizedTime})],Ku.prototype,"value",void 0);Ku=m([X({type:q.Choice})],Ku);var Gu;const R2=`${Zn}.18`;let Ph=Gu=class extends ht{constructor(e){super(e),Object.setPrototypeOf(this,Gu.prototype)}};Ph=Gu=m([X({type:q.Sequence})],Ph);const P2=`${Zn}.15`;var tn;(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"})(tn||(tn={}));class Ml extends Wc{toJSON(){const e=this.toNumber(),n=[];return e&tn.cRLSign&&n.push("crlSign"),e&tn.dataEncipherment&&n.push("dataEncipherment"),e&tn.decipherOnly&&n.push("decipherOnly"),e&tn.digitalSignature&&n.push("digitalSignature"),e&tn.encipherOnly&&n.push("encipherOnly"),e&tn.keyAgreement&&n.push("keyAgreement"),e&tn.keyCertSign&&n.push("keyCertSign"),e&tn.keyEncipherment&&n.push("keyEncipherment"),e&tn.nonRepudiation&&n.push("nonRepudiation"),n}toString(){return`[${this.toJSON().join(", ")}]`}}var Wu;class Zc{constructor(e={}){this.base=new ke,this.minimum=0,Object.assign(this,e)}}m([y({type:ke})],Zc.prototype,"base",void 0);m([y({type:C.Integer,context:0,defaultValue:0,implicit:!0})],Zc.prototype,"minimum",void 0);m([y({type:C.Integer,context:1,optional:!0,implicit:!0})],Zc.prototype,"maximum",void 0);let Ba=Wu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Wu.prototype)}};Ba=Wu=m([X({type:q.Sequence,itemType:Zc})],Ba);class B2{constructor(e={}){Object.assign(this,e)}}m([y({type:Ba,context:0,optional:!0,implicit:!0})],B2.prototype,"permittedSubtrees",void 0);m([y({type:Ba,context:1,optional:!0,implicit:!0})],B2.prototype,"excludedSubtrees",void 0);class j2{constructor(e={}){Object.assign(this,e)}}m([y({type:C.Integer,context:0,implicit:!0,optional:!0,converter:Me})],j2.prototype,"requireExplicitPolicy",void 0);m([y({type:C.Integer,context:1,implicit:!0,optional:!0,converter:Me})],j2.prototype,"inhibitPolicyMapping",void 0);var Xu;class Hp{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Hp.prototype,"issuerDomainPolicy",void 0);m([y({type:C.ObjectIdentifier})],Hp.prototype,"subjectDomainPolicy",void 0);let Bh=Xu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Xu.prototype)}};Bh=Xu=m([X({type:q.Sequence,itemType:Hp})],Bh);var Ju;const L2=`${Zn}.17`;let Yu=Ju=class extends ht{constructor(e){super(e),Object.setPrototypeOf(this,Ju.prototype)}};Yu=Ju=m([X({type:q.Sequence})],Yu);let Mn=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],Mn.prototype,"type",void 0);m([y({type:C.Any,repeated:"set"})],Mn.prototype,"values",void 0);var Zu;let jh=Zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Zu.prototype)}};jh=Zu=m([X({type:q.Sequence,itemType:Mn})],jh);const F2=`${Zn}.14`;class fr extends Up{}class U2{constructor(e={}){Object.assign(this,e)}}m([y({type:C.GeneralizedTime,context:0,implicit:!0,optional:!0})],U2.prototype,"notBefore",void 0);m([y({type:C.GeneralizedTime,context:1,implicit:!0,optional:!0})],U2.prototype,"notAfter",void 0);var As;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(As||(As={}));class M2 extends Wc{toJSON(){const e=[],n=this.toNumber();return n&As.pKIXCertificate&&e.push("pKIXCertificate"),n&As.newExtensions&&e.push("newExtensions"),n&As.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class q2{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new M2,Object.assign(this,e)}}m([y({type:C.GeneralString})],q2.prototype,"entrustVers",void 0);m([y({type:M2})],q2.prototype,"entrustInfoFlags",void 0);var Qu;let Lh=Qu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Qu.prototype)}};Lh=Qu=m([X({type:q.Sequence,itemType:ao})],Lh);class ce{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ce&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&O_(e.parameters,this.parameters)||e.parameters===this.parameters)}}m([y({type:C.ObjectIdentifier})],ce.prototype,"algorithm",void 0);m([y({type:C.Any,optional:!0})],ce.prototype,"parameters",void 0);class sn{constructor(e={}){this.algorithm=new ce,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:ce})],sn.prototype,"algorithm",void 0);m([y({type:C.BitString})],sn.prototype,"subjectPublicKey",void 0);let lt=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}};m([y({type:C.UTCTime})],lt.prototype,"utcTime",void 0);m([y({type:C.GeneralizedTime})],lt.prototype,"generalTime",void 0);lt=m([X({type:q.Choice})],lt);class co{constructor(e){this.notBefore=new lt(new Date),this.notAfter=new lt(new Date),e&&(this.notBefore=new lt(e.notBefore),this.notAfter=new lt(e.notAfter))}}m([y({type:lt})],co.prototype,"notBefore",void 0);m([y({type:lt})],co.prototype,"notAfter",void 0);var ed;let Jt=class V2{constructor(e={}){this.extnID="",this.critical=V2.CRITICAL,this.extnValue=new Ie,Object.assign(this,e)}};Jt.CRITICAL=!1;m([y({type:C.ObjectIdentifier})],Jt.prototype,"extnID",void 0);m([y({type:C.Boolean,defaultValue:Jt.CRITICAL})],Jt.prototype,"critical",void 0);m([y({type:Ie})],Jt.prototype,"extnValue",void 0);let mr=ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ed.prototype)}};mr=ed=m([X({type:q.Sequence,itemType:Jt})],mr);var Kr;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(Kr||(Kr={}));class Ut{constructor(e={}){this.version=Kr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ce,this.issuer=new Ye,this.validity=new co,this.subject=new Ye,this.subjectPublicKeyInfo=new sn,Object.assign(this,e)}}m([y({type:C.Integer,context:0,defaultValue:Kr.v1})],Ut.prototype,"version",void 0);m([y({type:C.Integer,converter:Me})],Ut.prototype,"serialNumber",void 0);m([y({type:ce})],Ut.prototype,"signature",void 0);m([y({type:Ye})],Ut.prototype,"issuer",void 0);m([y({type:co})],Ut.prototype,"validity",void 0);m([y({type:Ye})],Ut.prototype,"subject",void 0);m([y({type:sn})],Ut.prototype,"subjectPublicKeyInfo",void 0);m([y({type:C.BitString,context:1,implicit:!0,optional:!0})],Ut.prototype,"issuerUniqueID",void 0);m([y({type:C.BitString,context:2,implicit:!0,optional:!0})],Ut.prototype,"subjectUniqueID",void 0);m([y({type:mr,context:3,optional:!0})],Ut.prototype,"extensions",void 0);class Gr{constructor(e={}){this.tbsCertificate=new Ut,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:Ut})],Gr.prototype,"tbsCertificate",void 0);m([y({type:ce})],Gr.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],Gr.prototype,"signatureValue",void 0);class Qc{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new lt,Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],Qc.prototype,"userCertificate",void 0);m([y({type:lt})],Qc.prototype,"revocationDate",void 0);m([y({type:Jt,optional:!0,repeated:"sequence"})],Qc.prototype,"crlEntryExtensions",void 0);class Qn{constructor(e={}){this.signature=new ce,this.issuer=new Ye,this.thisUpdate=new lt,Object.assign(this,e)}}m([y({type:C.Integer,optional:!0})],Qn.prototype,"version",void 0);m([y({type:ce})],Qn.prototype,"signature",void 0);m([y({type:Ye})],Qn.prototype,"issuer",void 0);m([y({type:lt})],Qn.prototype,"thisUpdate",void 0);m([y({type:lt,optional:!0})],Qn.prototype,"nextUpdate",void 0);m([y({type:Qc,repeated:"sequence",optional:!0})],Qn.prototype,"revokedCertificates",void 0);m([y({type:Jt,optional:!0,context:0,repeated:"sequence"})],Qn.prototype,"crlExtensions",void 0);class Kp{constructor(e={}){this.tbsCertList=new Qn,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:Qn})],Kp.prototype,"tbsCertList",void 0);m([y({type:ce})],Kp.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],Kp.prototype,"signature",void 0);class Qi{constructor(e={}){this.issuer=new Ye,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:Ye})],Qi.prototype,"issuer",void 0);m([y({type:C.Integer,converter:Me})],Qi.prototype,"serialNumber",void 0);let zi=class{constructor(e={}){Object.assign(this,e)}};m([y({type:fr,context:0,implicit:!0})],zi.prototype,"subjectKeyIdentifier",void 0);m([y({type:Qi})],zi.prototype,"issuerAndSerialNumber",void 0);zi=m([X({type:q.Choice})],zi);var qn;(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"})(qn||(qn={}));let Rs=class extends ce{};Rs=m([X({type:q.Sequence})],Rs);let ja=class extends ce{};ja=m([X({type:q.Sequence})],ja);let Cn=class extends ce{};Cn=m([X({type:q.Sequence})],Cn);let La=class extends ce{};La=m([X({type:q.Sequence})],La);let Fh=class extends ce{};Fh=m([X({type:q.Sequence})],Fh);let td=class extends ce{};td=m([X({type:q.Sequence})],td);let es=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],es.prototype,"attrType",void 0);m([y({type:C.Any,repeated:"set"})],es.prototype,"attrValues",void 0);var nd;class In{constructor(e={}){this.version=qn.v0,this.sid=new zi,this.digestAlgorithm=new Rs,this.signatureAlgorithm=new ja,this.signature=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],In.prototype,"version",void 0);m([y({type:zi})],In.prototype,"sid",void 0);m([y({type:Rs})],In.prototype,"digestAlgorithm",void 0);m([y({type:es,repeated:"set",context:0,implicit:!0,optional:!0})],In.prototype,"signedAttrs",void 0);m([y({type:ja})],In.prototype,"signatureAlgorithm",void 0);m([y({type:Ie})],In.prototype,"signature",void 0);m([y({type:es,repeated:"set",context:1,implicit:!0,optional:!0})],In.prototype,"unsignedAttrs",void 0);let Fa=nd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,nd.prototype)}};Fa=nd=m([X({type:q.Set,itemType:In})],Fa);let Uh=class extends lt{};Uh=m([X({type:q.Choice})],Uh);let Mh=class extends In{};Mh=m([X({type:q.Sequence})],Mh);class Gp{constructor(e={}){this.acIssuer=new ke,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}m([y({type:ke})],Gp.prototype,"acIssuer",void 0);m([y({type:C.Integer})],Gp.prototype,"acSerial",void 0);m([y({type:Mn,repeated:"sequence"})],Gp.prototype,"attrs",void 0);var rd;let Ua=rd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};Ua=rd=m([X({type:q.Sequence,itemType:C.ObjectIdentifier})],Ua);class el{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}m([y({type:C.Integer,optional:!0})],el.prototype,"pathLenConstraint",void 0);m([y({type:Ua,implicit:!0,context:0,optional:!0})],el.prototype,"permittedAttrs",void 0);m([y({type:Ua,implicit:!0,context:1,optional:!0})],el.prototype,"excludedAttrs",void 0);m([y({type:C.Boolean,defaultValue:!0})],el.prototype,"permitUnSpecified",void 0);class si{constructor(e={}){this.issuer=new ht,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:ht})],si.prototype,"issuer",void 0);m([y({type:C.Integer,converter:Me})],si.prototype,"serial",void 0);m([y({type:C.BitString,optional:!0})],si.prototype,"issuerUID",void 0);var id;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(id||(id={}));class oi{constructor(e={}){this.digestedObjectType=id.publicKey,this.digestAlgorithm=new ce,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Enumerated})],oi.prototype,"digestedObjectType",void 0);m([y({type:C.ObjectIdentifier,optional:!0})],oi.prototype,"otherObjectTypeID",void 0);m([y({type:ce})],oi.prototype,"digestAlgorithm",void 0);m([y({type:C.BitString})],oi.prototype,"objectDigest",void 0);class tl{constructor(e={}){Object.assign(this,e)}}m([y({type:ht,optional:!0})],tl.prototype,"issuerName",void 0);m([y({type:si,context:0,implicit:!0,optional:!0})],tl.prototype,"baseCertificateID",void 0);m([y({type:oi,context:1,implicit:!0,optional:!0})],tl.prototype,"objectDigestInfo",void 0);let Di=class{constructor(e={}){Object.assign(this,e)}};m([y({type:ke,repeated:"sequence"})],Di.prototype,"v1Form",void 0);m([y({type:tl,context:0,implicit:!0})],Di.prototype,"v2Form",void 0);Di=m([X({type:q.Choice})],Di);class nl{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}m([y({type:C.GeneralizedTime})],nl.prototype,"notBeforeTime",void 0);m([y({type:C.GeneralizedTime})],nl.prototype,"notAfterTime",void 0);class lo{constructor(e={}){Object.assign(this,e)}}m([y({type:si,implicit:!0,context:0,optional:!0})],lo.prototype,"baseCertificateID",void 0);m([y({type:ht,implicit:!0,context:1,optional:!0})],lo.prototype,"entityName",void 0);m([y({type:oi,implicit:!0,context:2,optional:!0})],lo.prototype,"objectDigestInfo",void 0);var sd;(function(t){t[t.v2=1]="v2"})(sd||(sd={}));class _n{constructor(e={}){this.version=sd.v2,this.holder=new lo,this.issuer=new Di,this.signature=new ce,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new nl,this.attributes=[],Object.assign(this,e)}}m([y({type:C.Integer})],_n.prototype,"version",void 0);m([y({type:lo})],_n.prototype,"holder",void 0);m([y({type:Di})],_n.prototype,"issuer",void 0);m([y({type:ce})],_n.prototype,"signature",void 0);m([y({type:C.Integer,converter:Me})],_n.prototype,"serialNumber",void 0);m([y({type:nl})],_n.prototype,"attrCertValidityPeriod",void 0);m([y({type:Mn,repeated:"sequence"})],_n.prototype,"attributes",void 0);m([y({type:C.BitString,optional:!0})],_n.prototype,"issuerUniqueID",void 0);m([y({type:mr,optional:!0})],_n.prototype,"extensions",void 0);class rl{constructor(e={}){this.acinfo=new _n,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:_n})],rl.prototype,"acinfo",void 0);m([y({type:ce})],rl.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],rl.prototype,"signatureValue",void 0);var Ma;(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"})(Ma||(Ma={}));class od extends Wc{}class Wp{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier,implicit:!0,context:0})],Wp.prototype,"type",void 0);m([y({type:C.Any,implicit:!0,context:1})],Wp.prototype,"value",void 0);class Xp{constructor(e={}){this.policyId="",this.classList=new od(Ma.unclassified),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Xp.prototype,"policyId",void 0);m([y({type:od,defaultValue:new od(Ma.unclassified)})],Xp.prototype,"classList",void 0);m([y({type:Wp,repeated:"set"})],Xp.prototype,"securityCategories",void 0);class il{constructor(e={}){Object.assign(this,e)}}m([y({type:Ie})],il.prototype,"cotets",void 0);m([y({type:C.ObjectIdentifier})],il.prototype,"oid",void 0);m([y({type:C.Utf8String})],il.prototype,"string",void 0);class H2{constructor(e={}){this.values=[],Object.assign(this,e)}}m([y({type:ht,implicit:!0,context:0,optional:!0})],H2.prototype,"policyAuthority",void 0);m([y({type:il,repeated:"sequence"})],H2.prototype,"values",void 0);var ad;class sl{constructor(e={}){this.targetCertificate=new si,Object.assign(this,e)}}m([y({type:si})],sl.prototype,"targetCertificate",void 0);m([y({type:ke,optional:!0})],sl.prototype,"targetName",void 0);m([y({type:oi,optional:!0})],sl.prototype,"certDigestInfo",void 0);let Ri=class{constructor(e={}){Object.assign(this,e)}};m([y({type:ke,context:0,implicit:!0})],Ri.prototype,"targetName",void 0);m([y({type:ke,context:1,implicit:!0})],Ri.prototype,"targetGroup",void 0);m([y({type:sl,context:2,implicit:!0})],Ri.prototype,"targetCert",void 0);Ri=m([X({type:q.Choice})],Ri);let cd=ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ad.prototype)}};cd=ad=m([X({type:q.Sequence,itemType:Ri})],cd);var ld;let qh=ld=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};qh=ld=m([X({type:q.Sequence,itemType:cd})],qh);class K2{constructor(e={}){Object.assign(this,e)}}m([y({type:ht,implicit:!0,context:0,optional:!0})],K2.prototype,"roleAuthority",void 0);m([y({type:ke,implicit:!0,context:1})],K2.prototype,"roleName",void 0);class Jp{constructor(e={}){this.service=new ke,this.ident=new ke,Object.assign(this,e)}}m([y({type:ke})],Jp.prototype,"service",void 0);m([y({type:ke})],Jp.prototype,"ident",void 0);m([y({type:Ie,optional:!0})],Jp.prototype,"authInfo",void 0);var ud;class Yp{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],Yp.prototype,"otherCertFormat",void 0);m([y({type:C.Any})],Yp.prototype,"otherCert",void 0);let Pi=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Gr})],Pi.prototype,"certificate",void 0);m([y({type:rl,context:2,implicit:!0})],Pi.prototype,"v2AttrCert",void 0);m([y({type:Yp,context:3,implicit:!0})],Pi.prototype,"other",void 0);Pi=m([X({type:q.Choice})],Pi);let qa=ud=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};qa=ud=m([X({type:q.Set,itemType:Pi})],qa);class ts{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ts.prototype,"contentType",void 0);m([y({type:C.Any,context:0})],ts.prototype,"content",void 0);let Ps=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Ie})],Ps.prototype,"single",void 0);m([y({type:C.Any})],Ps.prototype,"any",void 0);Ps=m([X({type:q.Choice})],Ps);class ol{constructor(e={}){this.eContentType="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ol.prototype,"eContentType",void 0);m([y({type:Ps,context:0,optional:!0})],ol.prototype,"eContent",void 0);let Bs=class{constructor(e={}){Object.assign(this,e)}};m([y({type:Ie,context:0,implicit:!0,optional:!0})],Bs.prototype,"value",void 0);m([y({type:Ie,converter:q3,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Bs.prototype,"constructedValue",void 0);Bs=m([X({type:q.Choice})],Bs);class uo{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new La,Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],uo.prototype,"contentType",void 0);m([y({type:La})],uo.prototype,"contentEncryptionAlgorithm",void 0);m([y({type:Bs,optional:!0})],uo.prototype,"encryptedContent",void 0);class al{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],al.prototype,"keyAttrId",void 0);m([y({type:C.Any,optional:!0})],al.prototype,"keyAttr",void 0);var dd;class cl{constructor(e={}){this.subjectKeyIdentifier=new fr,Object.assign(this,e)}}m([y({type:fr})],cl.prototype,"subjectKeyIdentifier",void 0);m([y({type:C.GeneralizedTime,optional:!0})],cl.prototype,"date",void 0);m([y({type:al,optional:!0})],cl.prototype,"other",void 0);let Bi=class{constructor(e={}){Object.assign(this,e)}};m([y({type:cl,context:0,implicit:!0,optional:!0})],Bi.prototype,"rKeyId",void 0);m([y({type:Qi,optional:!0})],Bi.prototype,"issuerAndSerialNumber",void 0);Bi=m([X({type:q.Choice})],Bi);class Zp{constructor(e={}){this.rid=new Bi,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:Bi})],Zp.prototype,"rid",void 0);m([y({type:Ie})],Zp.prototype,"encryptedKey",void 0);let Va=dd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,dd.prototype)}};Va=dd=m([X({type:q.Sequence,itemType:Zp})],Va);class Qp{constructor(e={}){this.algorithm=new ce,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:ce})],Qp.prototype,"algorithm",void 0);m([y({type:C.BitString})],Qp.prototype,"publicKey",void 0);let Wr=class{constructor(e={}){Object.assign(this,e)}};m([y({type:fr,context:0,implicit:!0,optional:!0})],Wr.prototype,"subjectKeyIdentifier",void 0);m([y({type:Qp,context:1,implicit:!0,optional:!0})],Wr.prototype,"originatorKey",void 0);m([y({type:Qi,optional:!0})],Wr.prototype,"issuerAndSerialNumber",void 0);Wr=m([X({type:q.Choice})],Wr);class ns{constructor(e={}){this.version=qn.v3,this.originator=new Wr,this.keyEncryptionAlgorithm=new Cn,this.recipientEncryptedKeys=new Va,Object.assign(this,e)}}m([y({type:C.Integer})],ns.prototype,"version",void 0);m([y({type:Wr,context:0})],ns.prototype,"originator",void 0);m([y({type:Ie,context:1,optional:!0})],ns.prototype,"ukm",void 0);m([y({type:Cn})],ns.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Va})],ns.prototype,"recipientEncryptedKeys",void 0);let ji=class{constructor(e={}){Object.assign(this,e)}};m([y({type:fr,context:0,implicit:!0})],ji.prototype,"subjectKeyIdentifier",void 0);m([y({type:Qi})],ji.prototype,"issuerAndSerialNumber",void 0);ji=m([X({type:q.Choice})],ji);class po{constructor(e={}){this.version=qn.v0,this.rid=new ji,this.keyEncryptionAlgorithm=new Cn,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],po.prototype,"version",void 0);m([y({type:ji})],po.prototype,"rid",void 0);m([y({type:Cn})],po.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Ie})],po.prototype,"encryptedKey",void 0);class fo{constructor(e={}){this.keyIdentifier=new Ie,Object.assign(this,e)}}m([y({type:Ie})],fo.prototype,"keyIdentifier",void 0);m([y({type:C.GeneralizedTime,optional:!0})],fo.prototype,"date",void 0);m([y({type:al,optional:!0})],fo.prototype,"other",void 0);class ho{constructor(e={}){this.version=qn.v4,this.kekid=new fo,this.keyEncryptionAlgorithm=new Cn,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],ho.prototype,"version",void 0);m([y({type:fo})],ho.prototype,"kekid",void 0);m([y({type:Cn})],ho.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Ie})],ho.prototype,"encryptedKey",void 0);class go{constructor(e={}){this.version=qn.v0,this.keyEncryptionAlgorithm=new Cn,this.encryptedKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],go.prototype,"version",void 0);m([y({type:td,context:0,optional:!0})],go.prototype,"keyDerivationAlgorithm",void 0);m([y({type:Cn})],go.prototype,"keyEncryptionAlgorithm",void 0);m([y({type:Ie})],go.prototype,"encryptedKey",void 0);class ef{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ef.prototype,"oriType",void 0);m([y({type:C.Any})],ef.prototype,"oriValue",void 0);let _r=class{constructor(e={}){Object.assign(this,e)}};m([y({type:po,optional:!0})],_r.prototype,"ktri",void 0);m([y({type:ns,context:1,implicit:!0,optional:!0})],_r.prototype,"kari",void 0);m([y({type:ho,context:2,implicit:!0,optional:!0})],_r.prototype,"kekri",void 0);m([y({type:go,context:3,implicit:!0,optional:!0})],_r.prototype,"pwri",void 0);m([y({type:ef,context:4,implicit:!0,optional:!0})],_r.prototype,"ori",void 0);_r=m([X({type:q.Choice})],_r);var pd;let Ha=pd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,pd.prototype)}};Ha=pd=m([X({type:q.Set,itemType:_r})],Ha);var fd;class ll{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],ll.prototype,"otherRevInfoFormat",void 0);m([y({type:C.Any})],ll.prototype,"otherRevInfo",void 0);let Ka=class{constructor(e={}){this.other=new ll,Object.assign(this,e)}};m([y({type:ll,context:1,implicit:!0})],Ka.prototype,"other",void 0);Ka=m([X({type:q.Choice})],Ka);let Ga=fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}};Ga=fd=m([X({type:q.Set,itemType:Ka})],Ga);class tf{constructor(e={}){Object.assign(this,e)}}m([y({type:qa,context:0,implicit:!0,optional:!0})],tf.prototype,"certs",void 0);m([y({type:Ga,context:1,implicit:!0,optional:!0})],tf.prototype,"crls",void 0);var hd;let gd=hd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,hd.prototype)}};gd=hd=m([X({type:q.Set,itemType:es})],gd);class mo{constructor(e={}){this.version=qn.v0,this.recipientInfos=new Ha,this.encryptedContentInfo=new uo,Object.assign(this,e)}}m([y({type:C.Integer})],mo.prototype,"version",void 0);m([y({type:tf,context:0,implicit:!0,optional:!0})],mo.prototype,"originatorInfo",void 0);m([y({type:Ha})],mo.prototype,"recipientInfos",void 0);m([y({type:uo})],mo.prototype,"encryptedContentInfo",void 0);m([y({type:gd,context:1,implicit:!0,optional:!0})],mo.prototype,"unprotectedAttrs",void 0);const g4="1.2.840.113549.1.7.2";var md;let Wa=md=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,md.prototype)}};Wa=md=m([X({type:q.Set,itemType:Rs})],Wa);class rs{constructor(e={}){this.version=qn.v0,this.digestAlgorithms=new Wa,this.encapContentInfo=new ol,this.signerInfos=new Fa,Object.assign(this,e)}}m([y({type:C.Integer})],rs.prototype,"version",void 0);m([y({type:Wa})],rs.prototype,"digestAlgorithms",void 0);m([y({type:ol})],rs.prototype,"encapContentInfo",void 0);m([y({type:qa,context:0,implicit:!0,optional:!0})],rs.prototype,"certificates",void 0);m([y({type:Ga,context:1,implicit:!0,optional:!0})],rs.prototype,"crls",void 0);m([y({type:Fa})],rs.prototype,"signerInfos",void 0);const js="1.2.840.10045.2.1",nf="1.2.840.10045.4.1",G2="1.2.840.10045.4.3.1",rf="1.2.840.10045.4.3.2",sf="1.2.840.10045.4.3.3",of="1.2.840.10045.4.3.4",Vh="1.2.840.10045.3.1.7",Hh="1.3.132.0.34",Kh="1.3.132.0.35";function _o(t){return new ce({algorithm:t})}const m4=_o(nf);_o(G2);const _4=_o(rf),y4=_o(sf),w4=_o(of);let Ls=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],Ls.prototype,"fieldType",void 0);m([y({type:C.Any})],Ls.prototype,"parameters",void 0);Ls=m([X({type:q.Sequence})],Ls);class v4 extends Ie{}let Li=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.OctetString})],Li.prototype,"a",void 0);m([y({type:C.OctetString})],Li.prototype,"b",void 0);m([y({type:C.BitString,optional:!0})],Li.prototype,"seed",void 0);Li=m([X({type:q.Sequence})],Li);var _d;(function(t){t[t.ecpVer1=1]="ecpVer1"})(_d||(_d={}));let Vn=class{constructor(e={}){this.version=_d.ecpVer1,Object.assign(this,e)}};m([y({type:C.Integer})],Vn.prototype,"version",void 0);m([y({type:Ls})],Vn.prototype,"fieldID",void 0);m([y({type:Li})],Vn.prototype,"curve",void 0);m([y({type:v4})],Vn.prototype,"base",void 0);m([y({type:C.Integer,converter:Me})],Vn.prototype,"order",void 0);m([y({type:C.Integer,optional:!0})],Vn.prototype,"cofactor",void 0);Vn=m([X({type:q.Sequence})],Vn);let yr=class{constructor(e={}){Object.assign(this,e)}};m([y({type:C.ObjectIdentifier})],yr.prototype,"namedCurve",void 0);m([y({type:C.Null})],yr.prototype,"implicitCurve",void 0);m([y({type:Vn})],yr.prototype,"specifiedCurve",void 0);yr=m([X({type:q.Choice})],yr);class ul{constructor(e={}){this.version=1,this.privateKey=new Ie,Object.assign(this,e)}}m([y({type:C.Integer})],ul.prototype,"version",void 0);m([y({type:Ie})],ul.prototype,"privateKey",void 0);m([y({type:yr,context:0,optional:!0})],ul.prototype,"parameters",void 0);m([y({type:C.BitString,context:1,optional:!0})],ul.prototype,"publicKey",void 0);class Xa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],Xa.prototype,"r",void 0);m([y({type:C.Integer,converter:Me})],Xa.prototype,"s",void 0);const Nt="1.2.840.113549.1.1",Xr=`${Nt}.1`,b4=`${Nt}.7`,x4=`${Nt}.9`,Es=`${Nt}.10`,$4=`${Nt}.2`,A4=`${Nt}.4`,Ja=`${Nt}.5`,E4=`${Nt}.14`,yd=`${Nt}.11`,Ya=`${Nt}.12`,Za=`${Nt}.13`,W2=`${Nt}.15`,X2=`${Nt}.16`,Qa="1.3.14.3.2.26",J2="2.16.840.1.101.3.4.2.4",ec="2.16.840.1.101.3.4.2.1",tc="2.16.840.1.101.3.4.2.2",nc="2.16.840.1.101.3.4.2.3",S4="2.16.840.1.101.3.4.2.5",k4="2.16.840.1.101.3.4.2.6",N4="1.2.840.113549.2.2",C4="1.2.840.113549.2.5",dl=`${Nt}.8`;function it(t){return new ce({algorithm:t,parameters:null})}it(N4);it(C4);const Jr=it(Qa);it(J2);it(ec);it(tc);it(nc);it(S4);it(k4);const Y2=new ce({algorithm:dl,parameters:te.serialize(Jr)}),Z2=new ce({algorithm:x4,parameters:te.serialize(Ia.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});it(Xr);it($4);it(A4);it(Ja);it(W2);it(X2);it(Ya);it(Za);it(W2);it(X2);class pl{constructor(e={}){this.hashAlgorithm=new ce(Jr),this.maskGenAlgorithm=new ce({algorithm:dl,parameters:te.serialize(Jr)}),this.pSourceAlgorithm=new ce(Z2),Object.assign(this,e)}}m([y({type:ce,context:0,defaultValue:Jr})],pl.prototype,"hashAlgorithm",void 0);m([y({type:ce,context:1,defaultValue:Y2})],pl.prototype,"maskGenAlgorithm",void 0);m([y({type:ce,context:2,defaultValue:Z2})],pl.prototype,"pSourceAlgorithm",void 0);new ce({algorithm:b4,parameters:te.serialize(new pl)});class Yr{constructor(e={}){this.hashAlgorithm=new ce(Jr),this.maskGenAlgorithm=new ce({algorithm:dl,parameters:te.serialize(Jr)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}m([y({type:ce,context:0,defaultValue:Jr})],Yr.prototype,"hashAlgorithm",void 0);m([y({type:ce,context:1,defaultValue:Y2})],Yr.prototype,"maskGenAlgorithm",void 0);m([y({type:C.Integer,context:2,defaultValue:20})],Yr.prototype,"saltLength",void 0);m([y({type:C.Integer,context:3,defaultValue:1})],Yr.prototype,"trailerField",void 0);new ce({algorithm:Es,parameters:te.serialize(new Yr)});class fl{constructor(e={}){this.digestAlgorithm=new ce,this.digest=new Ie,Object.assign(this,e)}}m([y({type:ce})],fl.prototype,"digestAlgorithm",void 0);m([y({type:Ie})],fl.prototype,"digest",void 0);var wd;class hl{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],hl.prototype,"prime",void 0);m([y({type:C.Integer,converter:Me})],hl.prototype,"exponent",void 0);m([y({type:C.Integer,converter:Me})],hl.prototype,"coefficient",void 0);let vd=wd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,wd.prototype)}};vd=wd=m([X({type:q.Sequence,itemType:hl})],vd);class On{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)}}m([y({type:C.Integer})],On.prototype,"version",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"modulus",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"publicExponent",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"privateExponent",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"prime1",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"prime2",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"exponent1",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"exponent2",void 0);m([y({type:C.Integer,converter:Me})],On.prototype,"coefficient",void 0);m([y({type:vd,optional:!0})],On.prototype,"otherPrimeInfos",void 0);class af{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.Integer,converter:Me})],af.prototype,"modulus",void 0);m([y({type:C.Integer,converter:Me})],af.prototype,"publicExponent",void 0);var bd;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(bd||(bd={}));const $t=bd;/*! *****************************************************************************
147
147
  Copyright (c) Microsoft Corporation.
148
148
 
149
149
  Permission to use, copy, modify, and/or distribute this software for any
@@ -158,7 +158,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
158
158
  PERFORMANCE OF THIS SOFTWARE.
159
159
  ***************************************************************************** */var xd=function(t,e){return xd=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])},xd(t,e)};function cf(t,e){xd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function T4(t,e,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function l(p){try{d(r.next(p))}catch(h){a(h)}}function u(p){try{d(r.throw(p))}catch(h){a(h)}}function d(p){p.done?s(p.value):i(p.value).then(l,u)}d((r=r.apply(t,[])).next())})}function I4(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(d){return function(p){return u([d,p])}}function u(d){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(s=d[0]&2?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=0,s&&(d=[d[0]&2,s.value]),d[0]){case 0:case 1:s=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!s||d[1]>s[0]&&d[1]<s[3])){n.label=d[1];break}if(d[0]===6&&n.label<s[1]){n.label=s[1],s=d;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(d);break}s[2]&&n.ops.pop(),n.trys.pop();continue}d=e.call(t,n)}catch(p){d=[6,p],i=0}finally{r=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Fo(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 rc(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return s}function Or(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(rc(arguments[e]));return t}var O4="injectionTokens";function z4(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],n=Reflect.getOwnMetadata(O4,t)||{};return Object.keys(n).forEach(function(r){e[+r]=n[r]}),e}function Q2(t){return!!t.useClass}function $d(t){return!!t.useFactory}var e1=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,s,a=function(){return i||(s=e(n.wrap()),i=!0),s};return new Proxy(r,this.createHandler(a))},t.prototype.createHandler=function(e){var n={},r=function(i){n[i]=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];s[0]=e();var l=Reflect[i];return l.apply(void 0,Or(s))}};return this.reflectMethods.forEach(r),n},t}();function li(t){return typeof t=="string"||typeof t=="symbol"}function D4(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function Gh(t){return typeof t=="object"&&"token"in t&&"transform"in t}function R4(t){return typeof t=="function"||t instanceof e1}function na(t){return!!t.useToken}function ra(t){return t.useValue!=null}function P4(t){return Q2(t)||ra(t)||na(t)||$d(t)}var lf=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}(),B4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),Uo=function(){function t(){this.scopedResolutions=new Map}return t}();function j4(t,e){if(t===null)return"at position #"+e;var n=t.split(",")[e].trim();return'"'+n+'" at position #'+e}function L4(t,e,n){return n===void 0&&(n=" "),Or([t],e.message.split(`
160
160
  `).map(function(r){return n+r})).join(`
161
- `)}function F4(t,e,n){var r=rc(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],s=i===void 0?null:i,a=j4(s,e);return L4("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',n)}function U4(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var M4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),q4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),V4=function(){function t(){this.preResolution=new M4,this.postResolution=new q4}return t}(),t1=new Map,H4=function(){function t(e){this.parent=e,this._registry=new B4,this.interceptors=new V4,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:$t.Transient}),this.ensureNotDisposed();var i;if(P4(n)?i=n:i={useClass:n},na(i))for(var s=[e],a=i;a!=null;){var l=a.useToken;if(s.includes(l))throw new Error("Token registration cycle detected! "+Or(s,[l]).join(" -> "));s.push(l);var u=this._registry.get(l);u&&na(u.provider)?a=u.provider:a=null}if((r.lifecycle===$t.Singleton||r.lifecycle==$t.ContainerScoped||r.lifecycle==$t.ResolutionScoped)&&(ra(i)||$d(i)))throw new Error('Cannot use lifecycle "'+$t[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(),li(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(),li(e)){if(li(n))return this.register(e,{useToken:n},{lifecycle:$t.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:$t.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!li(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:$t.Singleton})},t.prototype.resolve=function(e,n,r){n===void 0&&(n=new Uo),r===void 0&&(r=!1),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&li(e)){if(r)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),i){var s=this.resolveRegistration(i,n);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(R4(e)){var s=this.construct(e,n);return this.executePostResolutionInterceptor(e,s,"Single"),s}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 s=[];try{for(var a=Fo(this.interceptors.preResolution.getAll(e)),l=a.next();!l.done;l=a.next()){var u=l.value;u.options.frequency!="Once"&&s.push(u),u.callback(e,n)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,s)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,s;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var l=Fo(this.interceptors.postResolution.getAll(e)),u=l.next();!u.done;u=l.next()){var d=u.value;d.options.frequency!="Once"&&a.push(d),d.callback(e,n,r)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===$t.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===$t.Singleton,i=e.options.lifecycle===$t.ContainerScoped,s=r||i,a;return ra(e.provider)?a=e.provider.useValue:na(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):Q2(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):$d(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,n),e.options.lifecycle===$t.ResolutionScoped&&n.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,n,r){var i=this;n===void 0&&(n=new Uo),r===void 0&&(r=!1),this.ensureNotDisposed();var s=this.getAllRegistrations(e);if(!s&&li(e)){if(r)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),s){var a=s.map(function(u){return i.resolveRegistration(u,n)});return this.executePostResolutionInterceptor(e,a,"All"),a}var l=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,l,"All"),l},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=Fo(this._registry.entries()),i=r.next();!i.done;i=r.next()){var s=rc(i.value,2),a=s[0],l=s[1];this._registry.setAll(a,l.filter(function(u){return!ra(u.provider)}).map(function(u){return u.instance=void 0,u}))}}catch(u){e={error:u}}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=Fo(this._registry.entries()),s=i.next();!s.done;s=i.next()){var a=rc(s.value,2),l=a[0],u=a[1];u.some(function(d){var p=d.options;return p.lifecycle===$t.ContainerScoped})&&r._registry.setAll(l,u.map(function(d){return d.options.lifecycle===$t.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.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 T4(this,void 0,void 0,function(){var e;return I4(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 e1)return e.createProxy(function(s){return r.resolve(s,n)});var i=function(){var s=t1.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=s.map(r.resolveParams(n,e));return new(e.bind.apply(e,Or([void 0],a)))}();return U4(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,s){var a,l,u;try{return D4(i)?Gh(i)?i.multiple?(a=r.resolve(i.transform)).transform.apply(a,Or([r.resolveAll(i.token,new Uo,i.isOptional)],i.transformArgs)):(l=r.resolve(i.transform)).transform.apply(l,Or([r.resolve(i.token,e,i.isOptional)],i.transformArgs)):i.multiple?r.resolveAll(i.token,new Uo,i.isOptional):r.resolve(i.token,e,i.isOptional):Gh(i)?(u=r.resolve(i.transform,e)).transform.apply(u,Or([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(d){throw new Error(F4(n,s,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),pt=new H4;function gl(t){return function(e){t1.set(e,z4(e))}}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 Ad;class ml{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}m([y({type:C.ObjectIdentifier})],ml.prototype,"attrId",void 0);m([y({type:C.Any,repeated:"set"})],ml.prototype,"attrValues",void 0);let Wh=Ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ad.prototype)}};Wh=Ad=m([W({type:q.Sequence,itemType:ml})],Wh);var Ed;let Xh=Ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ed.prototype)}};Xh=Ed=m([W({type:q.Sequence,itemType:ts})],Xh);class n1{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],n1.prototype,"certId",void 0);m([y({type:C.Any,context:0})],n1.prototype,"certValue",void 0);class r1{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],r1.prototype,"crlId",void 0);m([y({type:C.Any,context:0})],r1.prototype,"crltValue",void 0);class i1 extends Ie{}let _l=class{constructor(e={}){this.encryptionAlgorithm=new ce,this.encryptedData=new i1,Object.assign(this,e)}};m([y({type:ce})],_l.prototype,"encryptionAlgorithm",void 0);m([y({type:i1})],_l.prototype,"encryptedData",void 0);var Sd,kd;(function(t){t[t.v1=0]="v1"})(kd||(kd={}));class s1 extends Ie{}let Nd=Sd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Sd.prototype)}};Nd=Sd=m([W({type:q.Sequence,itemType:Mn})],Nd);class yo{constructor(e={}){this.version=kd.v1,this.privateKeyAlgorithm=new ce,this.privateKey=new s1,Object.assign(this,e)}}m([y({type:C.Integer})],yo.prototype,"version",void 0);m([y({type:ce})],yo.prototype,"privateKeyAlgorithm",void 0);m([y({type:s1})],yo.prototype,"privateKey",void 0);m([y({type:Nd,implicit:!0,context:0,optional:!0})],yo.prototype,"attributes",void 0);let Jh=class extends yo{};Jh=m([W({type:q.Sequence})],Jh);let Yh=class extends _l{};Yh=m([W({type:q.Sequence})],Yh);class o1{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],o1.prototype,"secretTypeId",void 0);m([y({type:C.Any,context:0})],o1.prototype,"secretValue",void 0);class wo{constructor(e={}){this.mac=new fl,this.macSalt=new Ie,this.iterations=1,Object.assign(this,e)}}m([y({type:fl})],wo.prototype,"mac",void 0);m([y({type:Ie})],wo.prototype,"macSalt",void 0);m([y({type:C.Integer,defaultValue:1})],wo.prototype,"iterations",void 0);class yl{constructor(e={}){this.version=3,this.authSafe=new ts,this.macData=new wo,Object.assign(this,e)}}m([y({type:C.Integer})],yl.prototype,"version",void 0);m([y({type:ts})],yl.prototype,"authSafe",void 0);m([y({type:wo,optional:!0})],yl.prototype,"macData",void 0);var Cd;class wl{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],wl.prototype,"bagId",void 0);m([y({type:C.Any,context:0})],wl.prototype,"bagValue",void 0);m([y({type:ml,repeated:"set",optional:!0})],wl.prototype,"bagAttributes",void 0);let Zh=Cd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Cd.prototype)}};Zh=Cd=m([W({type:q.Sequence,itemType:wl})],Zh);var Td,Id,Od;const a1="1.2.840.113549.1.9",c1=`${a1}.7`,uf=`${a1}.14`;let ic=class extends dt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};m([y({type:C.IA5String})],ic.prototype,"ia5String",void 0);ic=m([W({type:q.Choice})],ic);let Qh=class extends ts{};Qh=m([W({type:q.Sequence})],Qh);let e0=class extends yl{};e0=m([W({type:q.Sequence})],e0);let t0=class extends _l{};t0=m([W({type:q.Sequence})],t0);let zd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.IA5String})],zd.prototype,"value",void 0);zd=m([W({type:q.Choice})],zd);let n0=class extends ic{};n0=m([W({type:q.Choice})],n0);let r0=class extends dt{};r0=m([W({type:q.Choice})],r0);let Dd=class{constructor(e=new Date){this.value=e}};m([y({type:C.GeneralizedTime})],Dd.prototype,"value",void 0);Dd=m([W({type:q.Choice})],Dd);let i0=class extends dt{};i0=m([W({type:q.Choice})],i0);let Rd=class{constructor(e="M"){this.value=e}toString(){return this.value}};m([y({type:C.PrintableString})],Rd.prototype,"value",void 0);Rd=m([W({type:q.Choice})],Rd);let sc=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.PrintableString})],sc.prototype,"value",void 0);sc=m([W({type:q.Choice})],sc);let s0=class extends sc{};s0=m([W({type:q.Choice})],s0);let o0=class extends dt{};o0=m([W({type:q.Choice})],o0);let Pd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.ObjectIdentifier})],Pd.prototype,"value",void 0);Pd=m([W({type:q.Choice})],Pd);let a0=class extends lt{};a0=m([W({type:q.Choice})],a0);let Bd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};m([y({type:C.Integer})],Bd.prototype,"value",void 0);Bd=m([W({type:q.Choice})],Bd);let c0=class extends In{};c0=m([W({type:q.Sequence})],c0);let oc=class extends dt{};oc=m([W({type:q.Choice})],oc);let l0=Td=class extends mr{constructor(e){super(e),Object.setPrototypeOf(this,Td.prototype)}};l0=Td=m([W({type:q.Sequence})],l0);let u0=Id=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Id.prototype)}};u0=Id=m([W({type:q.Set,itemType:es})],u0);let jd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.BmpString})],jd.prototype,"value",void 0);jd=m([W({type:q.Choice})],jd);let Ld=class extends ce{};Ld=m([W({type:q.Sequence})],Ld);let d0=Od=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Od.prototype)}};d0=Od=m([W({type:q.Sequence,itemType:Ld})],d0);var Fd;let ac=Fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fd.prototype)}};ac=Fd=m([W({type:q.Sequence,itemType:Mn})],ac);class is{constructor(e={}){this.version=0,this.subject=new Ye,this.subjectPKInfo=new sn,this.attributes=new ac,Object.assign(this,e)}}m([y({type:C.Integer})],is.prototype,"version",void 0);m([y({type:Ye})],is.prototype,"subject",void 0);m([y({type:sn})],is.prototype,"subjectPKInfo",void 0);m([y({type:ac,implicit:!0,context:0})],is.prototype,"attributes",void 0);class Fs{constructor(e={}){this.certificationRequestInfo=new is,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:is})],Fs.prototype,"certificationRequestInfo",void 0);m([y({type:ce})],Fs.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],Fs.prototype,"signature",void 0);/*!
161
+ `)}function F4(t,e,n){var r=rc(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],s=i===void 0?null:i,a=j4(s,e);return L4("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',n)}function U4(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var M4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),q4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),V4=function(){function t(){this.preResolution=new M4,this.postResolution=new q4}return t}(),t1=new Map,H4=function(){function t(e){this.parent=e,this._registry=new B4,this.interceptors=new V4,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:$t.Transient}),this.ensureNotDisposed();var i;if(P4(n)?i=n:i={useClass:n},na(i))for(var s=[e],a=i;a!=null;){var l=a.useToken;if(s.includes(l))throw new Error("Token registration cycle detected! "+Or(s,[l]).join(" -> "));s.push(l);var u=this._registry.get(l);u&&na(u.provider)?a=u.provider:a=null}if((r.lifecycle===$t.Singleton||r.lifecycle==$t.ContainerScoped||r.lifecycle==$t.ResolutionScoped)&&(ra(i)||$d(i)))throw new Error('Cannot use lifecycle "'+$t[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(),li(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(),li(e)){if(li(n))return this.register(e,{useToken:n},{lifecycle:$t.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:$t.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!li(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:$t.Singleton})},t.prototype.resolve=function(e,n,r){n===void 0&&(n=new Uo),r===void 0&&(r=!1),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&li(e)){if(r)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),i){var s=this.resolveRegistration(i,n);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(R4(e)){var s=this.construct(e,n);return this.executePostResolutionInterceptor(e,s,"Single"),s}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 s=[];try{for(var a=Fo(this.interceptors.preResolution.getAll(e)),l=a.next();!l.done;l=a.next()){var u=l.value;u.options.frequency!="Once"&&s.push(u),u.callback(e,n)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,s)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,s;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var l=Fo(this.interceptors.postResolution.getAll(e)),u=l.next();!u.done;u=l.next()){var d=u.value;d.options.frequency!="Once"&&a.push(d),d.callback(e,n,r)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===$t.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===$t.Singleton,i=e.options.lifecycle===$t.ContainerScoped,s=r||i,a;return ra(e.provider)?a=e.provider.useValue:na(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):Q2(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):$d(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,n),e.options.lifecycle===$t.ResolutionScoped&&n.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,n,r){var i=this;n===void 0&&(n=new Uo),r===void 0&&(r=!1),this.ensureNotDisposed();var s=this.getAllRegistrations(e);if(!s&&li(e)){if(r)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),s){var a=s.map(function(u){return i.resolveRegistration(u,n)});return this.executePostResolutionInterceptor(e,a,"All"),a}var l=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,l,"All"),l},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=Fo(this._registry.entries()),i=r.next();!i.done;i=r.next()){var s=rc(i.value,2),a=s[0],l=s[1];this._registry.setAll(a,l.filter(function(u){return!ra(u.provider)}).map(function(u){return u.instance=void 0,u}))}}catch(u){e={error:u}}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=Fo(this._registry.entries()),s=i.next();!s.done;s=i.next()){var a=rc(s.value,2),l=a[0],u=a[1];u.some(function(d){var p=d.options;return p.lifecycle===$t.ContainerScoped})&&r._registry.setAll(l,u.map(function(d){return d.options.lifecycle===$t.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.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 T4(this,void 0,void 0,function(){var e;return I4(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 e1)return e.createProxy(function(s){return r.resolve(s,n)});var i=function(){var s=t1.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=s.map(r.resolveParams(n,e));return new(e.bind.apply(e,Or([void 0],a)))}();return U4(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,s){var a,l,u;try{return D4(i)?Gh(i)?i.multiple?(a=r.resolve(i.transform)).transform.apply(a,Or([r.resolveAll(i.token,new Uo,i.isOptional)],i.transformArgs)):(l=r.resolve(i.transform)).transform.apply(l,Or([r.resolve(i.token,e,i.isOptional)],i.transformArgs)):i.multiple?r.resolveAll(i.token,new Uo,i.isOptional):r.resolve(i.token,e,i.isOptional):Gh(i)?(u=r.resolve(i.transform,e)).transform.apply(u,Or([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(d){throw new Error(F4(n,s,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),pt=new H4;function gl(t){return function(e){t1.set(e,z4(e))}}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 Ad;class ml{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}m([y({type:C.ObjectIdentifier})],ml.prototype,"attrId",void 0);m([y({type:C.Any,repeated:"set"})],ml.prototype,"attrValues",void 0);let Wh=Ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ad.prototype)}};Wh=Ad=m([X({type:q.Sequence,itemType:ml})],Wh);var Ed;let Xh=Ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ed.prototype)}};Xh=Ed=m([X({type:q.Sequence,itemType:ts})],Xh);class n1{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],n1.prototype,"certId",void 0);m([y({type:C.Any,context:0})],n1.prototype,"certValue",void 0);class r1{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],r1.prototype,"crlId",void 0);m([y({type:C.Any,context:0})],r1.prototype,"crltValue",void 0);class i1 extends Ie{}let _l=class{constructor(e={}){this.encryptionAlgorithm=new ce,this.encryptedData=new i1,Object.assign(this,e)}};m([y({type:ce})],_l.prototype,"encryptionAlgorithm",void 0);m([y({type:i1})],_l.prototype,"encryptedData",void 0);var Sd,kd;(function(t){t[t.v1=0]="v1"})(kd||(kd={}));class s1 extends Ie{}let Nd=Sd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Sd.prototype)}};Nd=Sd=m([X({type:q.Sequence,itemType:Mn})],Nd);class yo{constructor(e={}){this.version=kd.v1,this.privateKeyAlgorithm=new ce,this.privateKey=new s1,Object.assign(this,e)}}m([y({type:C.Integer})],yo.prototype,"version",void 0);m([y({type:ce})],yo.prototype,"privateKeyAlgorithm",void 0);m([y({type:s1})],yo.prototype,"privateKey",void 0);m([y({type:Nd,implicit:!0,context:0,optional:!0})],yo.prototype,"attributes",void 0);let Jh=class extends yo{};Jh=m([X({type:q.Sequence})],Jh);let Yh=class extends _l{};Yh=m([X({type:q.Sequence})],Yh);class o1{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],o1.prototype,"secretTypeId",void 0);m([y({type:C.Any,context:0})],o1.prototype,"secretValue",void 0);class wo{constructor(e={}){this.mac=new fl,this.macSalt=new Ie,this.iterations=1,Object.assign(this,e)}}m([y({type:fl})],wo.prototype,"mac",void 0);m([y({type:Ie})],wo.prototype,"macSalt",void 0);m([y({type:C.Integer,defaultValue:1})],wo.prototype,"iterations",void 0);class yl{constructor(e={}){this.version=3,this.authSafe=new ts,this.macData=new wo,Object.assign(this,e)}}m([y({type:C.Integer})],yl.prototype,"version",void 0);m([y({type:ts})],yl.prototype,"authSafe",void 0);m([y({type:wo,optional:!0})],yl.prototype,"macData",void 0);var Cd;class wl{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:C.ObjectIdentifier})],wl.prototype,"bagId",void 0);m([y({type:C.Any,context:0})],wl.prototype,"bagValue",void 0);m([y({type:ml,repeated:"set",optional:!0})],wl.prototype,"bagAttributes",void 0);let Zh=Cd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Cd.prototype)}};Zh=Cd=m([X({type:q.Sequence,itemType:wl})],Zh);var Td,Id,Od;const a1="1.2.840.113549.1.9",c1=`${a1}.7`,uf=`${a1}.14`;let ic=class extends dt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};m([y({type:C.IA5String})],ic.prototype,"ia5String",void 0);ic=m([X({type:q.Choice})],ic);let Qh=class extends ts{};Qh=m([X({type:q.Sequence})],Qh);let e0=class extends yl{};e0=m([X({type:q.Sequence})],e0);let t0=class extends _l{};t0=m([X({type:q.Sequence})],t0);let zd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.IA5String})],zd.prototype,"value",void 0);zd=m([X({type:q.Choice})],zd);let n0=class extends ic{};n0=m([X({type:q.Choice})],n0);let r0=class extends dt{};r0=m([X({type:q.Choice})],r0);let Dd=class{constructor(e=new Date){this.value=e}};m([y({type:C.GeneralizedTime})],Dd.prototype,"value",void 0);Dd=m([X({type:q.Choice})],Dd);let i0=class extends dt{};i0=m([X({type:q.Choice})],i0);let Rd=class{constructor(e="M"){this.value=e}toString(){return this.value}};m([y({type:C.PrintableString})],Rd.prototype,"value",void 0);Rd=m([X({type:q.Choice})],Rd);let sc=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.PrintableString})],sc.prototype,"value",void 0);sc=m([X({type:q.Choice})],sc);let s0=class extends sc{};s0=m([X({type:q.Choice})],s0);let o0=class extends dt{};o0=m([X({type:q.Choice})],o0);let Pd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.ObjectIdentifier})],Pd.prototype,"value",void 0);Pd=m([X({type:q.Choice})],Pd);let a0=class extends lt{};a0=m([X({type:q.Choice})],a0);let Bd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};m([y({type:C.Integer})],Bd.prototype,"value",void 0);Bd=m([X({type:q.Choice})],Bd);let c0=class extends In{};c0=m([X({type:q.Sequence})],c0);let oc=class extends dt{};oc=m([X({type:q.Choice})],oc);let l0=Td=class extends mr{constructor(e){super(e),Object.setPrototypeOf(this,Td.prototype)}};l0=Td=m([X({type:q.Sequence})],l0);let u0=Id=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Id.prototype)}};u0=Id=m([X({type:q.Set,itemType:es})],u0);let jd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([y({type:C.BmpString})],jd.prototype,"value",void 0);jd=m([X({type:q.Choice})],jd);let Ld=class extends ce{};Ld=m([X({type:q.Sequence})],Ld);let d0=Od=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Od.prototype)}};d0=Od=m([X({type:q.Sequence,itemType:Ld})],d0);var Fd;let ac=Fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fd.prototype)}};ac=Fd=m([X({type:q.Sequence,itemType:Mn})],ac);class is{constructor(e={}){this.version=0,this.subject=new Ye,this.subjectPKInfo=new sn,this.attributes=new ac,Object.assign(this,e)}}m([y({type:C.Integer})],is.prototype,"version",void 0);m([y({type:Ye})],is.prototype,"subject",void 0);m([y({type:sn})],is.prototype,"subjectPKInfo",void 0);m([y({type:ac,implicit:!0,context:0})],is.prototype,"attributes",void 0);class Fs{constructor(e={}){this.certificationRequestInfo=new is,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([y({type:is})],Fs.prototype,"certificationRequestInfo",void 0);m([y({type:ce})],Fs.prototype,"signatureAlgorithm",void 0);m([y({type:C.BitString})],Fs.prototype,"signature",void 0);/*!
162
162
  * MIT License
163
163
  *
164
164
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -182,19 +182,19 @@ PERFORMANCE OF THIS SOFTWARE.
182
182
  * SOFTWARE.
183
183
  *
184
184
  */const vo="crypto.algorithm";class K4{getAlgorithms(){return pt.resolveAll(vo)}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 ce({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 Zr="crypto.algorithmProvider";pt.registerSingleton(Zr,K4);var ia;const Ct="1.3.36.3.3.2.8.1.1",p0=`${Ct}.1`,f0=`${Ct}.2`,h0=`${Ct}.3`,g0=`${Ct}.4`,m0=`${Ct}.5`,_0=`${Ct}.6`,y0=`${Ct}.7`,w0=`${Ct}.8`,v0=`${Ct}.9`,b0=`${Ct}.10`,x0=`${Ct}.11`,$0=`${Ct}.12`,A0=`${Ct}.13`,E0=`${Ct}.14`,S0="brainpoolP160r1",k0="brainpoolP160t1",N0="brainpoolP192r1",C0="brainpoolP192t1",T0="brainpoolP224r1",I0="brainpoolP224t1",O0="brainpoolP256r1",z0="brainpoolP256t1",D0="brainpoolP320r1",R0="brainpoolP320t1",P0="brainpoolP384r1",B0="brainpoolP384t1",j0="brainpoolP512r1",L0="brainpoolP512t1",Ve="ECDSA";let Us=ia=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case Ve.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return m4;case"sha-256":return _4;case"sha-384":return y4;case"sha-512":return w4}else if("namedCurve"in e){let n="";switch(e.namedCurve){case"P-256":n=Vh;break;case"K-256":n=ia.SECP256K1;break;case"P-384":n=Hh;break;case"P-521":n=Kh;break;case S0:n=p0;break;case k0:n=f0;break;case N0:n=h0;break;case C0:n=g0;break;case T0:n=m0;break;case I0:n=_0;break;case O0:n=y0;break;case z0:n=w0;break;case D0:n=v0;break;case R0:n=b0;break;case P0:n=x0;break;case B0:n=$0;break;case j0:n=A0;break;case L0:n=E0;break}if(n)return new ce({algorithm:js,parameters:te.serialize(new yr({namedCurve:n}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case nf:return{name:Ve,hash:{name:"SHA-1"}};case rf:return{name:Ve,hash:{name:"SHA-256"}};case sf:return{name:Ve,hash:{name:"SHA-384"}};case of:return{name:Ve,hash:{name:"SHA-512"}};case js:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(te.parse(e.parameters,yr).namedCurve){case Vh:return{name:Ve,namedCurve:"P-256"};case ia.SECP256K1:return{name:Ve,namedCurve:"K-256"};case Hh:return{name:Ve,namedCurve:"P-384"};case Kh:return{name:Ve,namedCurve:"P-521"};case p0:return{name:Ve,namedCurve:S0};case f0:return{name:Ve,namedCurve:k0};case h0:return{name:Ve,namedCurve:N0};case g0:return{name:Ve,namedCurve:C0};case m0:return{name:Ve,namedCurve:T0};case _0:return{name:Ve,namedCurve:I0};case y0:return{name:Ve,namedCurve:O0};case w0:return{name:Ve,namedCurve:z0};case v0:return{name:Ve,namedCurve:D0};case b0:return{name:Ve,namedCurve:R0};case x0:return{name:Ve,namedCurve:P0};case $0:return{name:Ve,namedCurve:B0};case A0:return{name:Ve,namedCurve:j0};case E0:return{name:Ve,namedCurve:L0}}}}return null}};Us.SECP256K1="1.3.132.0.10";Us=ia=m([gl()],Us);pt.registerSingleton(vo,Us);const l1=Symbol("name"),u1=Symbol("value");class ze{constructor(e,n={},r=""){this[l1]=e,this[u1]=r;for(const i in n)this[i]=n[i]}}ze.NAME=l1;ze.VALUE=u1;class G4{static toTextObject(e){const n=new ze("Algorithm Identifier",{},Sr.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case js:{const r=new Us().toWebAlgorithm(e);r&&"namedCurve"in r?n["Named Curve"]=r.namedCurve:n.Parameters=e.parameters;break}default:n.Parameters=e.parameters}return n}}class Sr{static toString(e){const n=this.items[e];return n||e}}Sr.items={[Qa]:"sha1",[J2]:"sha224",[ec]:"sha256",[tc]:"sha384",[nc]:"sha512",[Xr]:"rsaEncryption",[Ja]:"sha1WithRSAEncryption",[E4]:"sha224WithRSAEncryption",[yd]:"sha256WithRSAEncryption",[Ya]:"sha384WithRSAEncryption",[Za]:"sha512WithRSAEncryption",[js]:"ecPublicKey",[nf]:"ecdsaWithSHA1",[G2]:"ecdsaWithSHA224",[rf]:"ecdsaWithSHA256",[sf]:"ecdsaWithSHA384",[of]:"ecdsaWithSHA512",[l4]:"TLS WWW server authentication",[u4]:"TLS WWW client authentication",[d4]:"Code Signing",[p4]:"E-mail Protection",[f4]:"Time Stamping",[h4]:"OCSP Signing",[g4]:"Signed Data"};class Qr{static serialize(e){return this.serializeObj(e).join(`
185
- `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,n=0){const r=[];let i=this.pad(n++),s="";const a=e[ze.VALUE];a&&(s=` ${a}`),r.push(`${i}${e[ze.NAME]}:${s}`),i=this.pad(n);for(const l in e){if(typeof l=="symbol")continue;const u=e[l],d=l?`${l}: `:"";if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")r.push(`${i}${d}${u}`);else if(u instanceof Date)r.push(`${i}${d}${u.toUTCString()}`);else if(Array.isArray(u))for(const p of u)p[ze.NAME]=l,r.push(...this.serializeObj(p,n));else if(u instanceof ze)u[ze.NAME]=l,r.push(...this.serializeObj(u,n));else if(ne.isBufferSource(u))l?(r.push(`${i}${d}`),r.push(...this.serializeBufferSource(u,n+1))):r.push(...this.serializeBufferSource(u,n));else if("toTextObject"in u){const p=u.toTextObject();p[ze.NAME]=l,r.push(...this.serializeObj(p,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=ne.toUint8Array(e),s=[];for(let a=0;a<i.length;){const l=[];for(let u=0;u<16&&a<i.length;u++){u===8&&l.push("");const d=i[a++].toString(16).padStart(2,"0");l.push(d)}s.push(`${r}${l.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Qr.oidSerializer=Sr;Qr.algorithmSerializer=G4;class kr{constructor(...e){if(e.length===1){const n=e[0];this.rawData=te.serialize(n),this.onInit(n)}else{const n=te.parse(e[0],e[1]);this.rawData=ne.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof kr?O_(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return te.toString(this.rawData);case"text":return Qr.serialize(this.toTextObject());case"hex":return pe.ToHex(this.rawData);case"base64":return pe.ToBase64(this.rawData);case"base64url":return pe.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 ze(this.getTextName(),{},e)}}kr.NAME="ASN";class Mt extends kr{constructor(...e){let n;ne.isBufferSource(e[0])?n=ne.toArrayBuffer(e[0]):n=te.serialize(new Jt({extnID:e[0],critical:e[1],extnValue:new Ie(ne.toArrayBuffer(e[2]))})),super(n,Jt)}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[ze.NAME]===Mt.NAME&&(e[ze.NAME]=Sr.toString(this.type)),e}}var d1;class ur{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[d1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(ur.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(ur.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=ur.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(ur.DEFAULT,e);return this}}d1=Symbol.toStringTag;ur.DEFAULT="default";const ct=new ur,W4=/^[0-2](?:\.[1-9][0-9]*)+$/;function X4(t){return new RegExp(W4).test(t)}class p1{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return X4(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const St=new p1;St.register("CN","2.5.4.3");St.register("L","2.5.4.7");St.register("ST","2.5.4.8");St.register("O","2.5.4.10");St.register("OU","2.5.4.11");St.register("C","2.5.4.6");St.register("DC","0.9.2342.19200300.100.1.25");St.register("E","1.2.840.113549.1.9.1");St.register("G","2.5.4.42");St.register("I","2.5.4.43");St.register("SN","2.5.4.4");St.register("T","2.5.4.12");function J4(t,e){return`\\${pe.ToHex(pe.FromUtf8String(e)).toUpperCase()}`}function Y4(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,J4)}class Wt{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 p1,this.asn=new Ye;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 Ye?this.asn=e:ne.isBufferSource(e)?this.asn=te.parse(e,Ye):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||St.findId(e),r=[];for(const i of this.asn)for(const s of i)s.type===n&&r.push(s.value.toString());return r}getName(e){return this.extraNames.get(e)||St.get(e)}toString(){return this.asn.map(e=>e.map(n=>{const r=this.getName(n.type)||n.type,i=n.value.anyValue?`#${pe.ToHex(n.value.anyValue)}`:Y4(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const s of r){const a=this.getName(s.type)||s.type;(e=i[a])!==null&&e!==void 0||(i[a]=[]),i[a].push(s.value.anyValue?`#${pe.ToHex(s.value.anyValue)}`:s.value.toString())}n.push(i)}return n}fromString(e){const n=new Ye,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,s=",";for(;i=r.exec(`${e},`);){let[,a,l]=i;const u=l[l.length-1];(u===","||u==="+")&&(l=l.slice(0,l.length-1),i[3]=u);const d=i[3];a=this.getTypeOid(a);const p=this.createAttribute(a,l);s==="+"?n[n.length-1].push(p):n.push(new Oi([p])),s=d}return n}fromJSON(e){const n=new Ye;for(const r of e){const i=new Oi;for(const s in r){const a=this.getTypeOid(s),l=r[s];for(const u of l){const d=this.createAttribute(a,u);i.push(d)}}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 Xc({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=pe.FromHex(n.slice(1));else{const i=this.processStringValue(n);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=i:Wt.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,`
186
- `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return te.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]||ct.get()):r=e[0]||ct.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const f1="Cannot initialize GeneralName from ASN.1 data.",F0=`${f1} Unsupported string format in use.`,Z4=`${f1} Value doesn't match to GUID regular expression.`,U0=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,M0="1.3.6.1.4.1.311.25.1",q0="1.3.6.1.4.1.311.20.2.3",ql="dns",Vl="dn",Hl="email",Kl="ip",Gl="url",Wl="guid",Xl="upn",Mo="id";class dr extends kr{constructor(...e){let n;if(e.length===2)switch(e[0]){case Vl:{const r=new Wt(e[1]).toArrayBuffer(),i=te.parse(r,Ye);n=new ke({directoryName:i});break}case ql:n=new ke({dNSName:e[1]});break;case Hl:n=new ke({rfc822Name:e[1]});break;case Wl:{const r=new RegExp(U0,"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((s,a)=>a<3?pe.ToHex(new Uint8Array(pe.FromHex(s)).reverse()):s).join("");n=new ke({otherName:new Ds({typeId:M0,value:te.serialize(new Ie(pe.FromHex(i)))})});break}case Kl:n=new ke({iPAddress:e[1]});break;case Mo:n=new ke({registeredID:e[1]});break;case Xl:{n=new ke({otherName:new Ds({typeId:q0,value:te.serialize(C2.toASN(e[1]))})});break}case Gl:n=new ke({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else ne.isBufferSource(e[0])?n=te.parse(e[0],ke):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=ql,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Hl,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Kl,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Gl,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Mo,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Vl,this.value=new Wt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===M0){this.type=Wl;const n=te.parse(e.otherName.value,Ie),r=new RegExp(U0,"i").exec(pe.ToHex(n));if(!r)throw new Error(Z4);this.value=r.slice(1).map((i,s)=>s<3?pe.ToHex(new Uint8Array(pe.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===q0)this.type=Xl,this.value=te.parse(e.otherName.value,dt).toString();else throw new Error(F0);else throw new Error(F0)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Vl:case ql:case Wl:case Kl:case Mo:case Xl:case Gl:e=this.type.toUpperCase();break;case Hl:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Mo&&(n=Sr.toString(n)),new ze(e,void 0,n)}}class ei extends kr{constructor(e){let n;if(e instanceof ht)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof ke)r.push(i);else{const s=te.parse(new dr(i.type,i.value).rawData,ke);r.push(s)}n=new ht(r)}else if(ne.isBufferSource(e))n=te.parse(e,ht);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 dr(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[ze.NAME]];Array.isArray(i)||(i=[],e[r[ze.NAME]]=i),i.push(r)}return e}}ei.NAME="GeneralNames";const Ss="-{5}",Ms="\\n",Q4=`[^${Ms}]+`,ex=`${Ss}BEGIN (${Q4}(?=${Ss}))${Ss}`,tx=`${Ss}END \\1${Ss}`,Fi="\\n",nx=`[^:${Ms}]+`,rx=`(?:[^${Ms}]+${Fi}(?: +[^${Ms}]+${Fi})*)`,ix="[a-zA-Z0-9=+/]+",sx=`(?:${ix}${Fi})+`,V0=`${ex}${Fi}(?:((?:${nx}: ${rx})+))?${Fi}?(${sx})${tx}`;class jt{static isPem(e){return typeof e=="string"&&new RegExp(V0,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(V0,"g"),r=[];let i=null;for(;i=n.exec(e);){const s=i[3].replace(new RegExp(`[${Ms}]+`,"g"),""),a={type:i[1],headers:[],rawData:pe.FromBase64(s)},l=i[2];if(l){const u=l.split(new RegExp(Fi,"g"));let d=null;for(const p of u){const[h,g]=p.split(/:(.*)/);if(g===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=h.trim()}else d&&a.headers.push(d),d={key:h,value:g.trim()}}d&&a.headers.push(d)}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(!ne.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:ne.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(`
187
- `)}else{if(!n)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:n,rawData:ne.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 d of e.headers)i.push(`${d.key}: ${d.value}`);i.push("")}const s=pe.ToBase64(e.rawData);let a,l=0;const u=Array();for(;l<s.length&&(s.length-l<64?a=s.substring(l):(a=s.substring(l,l+64),l+=64),a.length!==0);)if(u.push(a),a.length<64)break;return i.push(...u),i.push(`-----END ${r}-----`),i.join(`
188
- `)}}jt.CertificateTag="CERTIFICATE";jt.CrlTag="CRL";jt.CertificateRequestTag="CERTIFICATE REQUEST";jt.PublicKeyTag="PUBLIC KEY";jt.PrivateKeyTag="PRIVATE KEY";class Hn extends kr{static isAsnEncoded(e){return ne.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(jt.isPem(e))return jt.decode(e)[0];if(pe.isHex(e))return pe.FromHex(e);if(pe.isBase64(e))return pe.FromBase64(e);if(pe.isBase64Url(e))return pe.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const n=pe.ToBinary(e);return jt.isPem(n)?jt.decode(n)[0]:pe.isHex(n)?pe.FromHex(n):pe.isBase64(n)?pe.FromBase64(n):pe.isBase64Url(n)?pe.FromBase64Url(n):ne.toArrayBuffer(e)}}constructor(...e){Hn.isAsnEncoded(e[0])?super(Hn.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return jt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class an extends Hn{static async create(e,n=ct.get()){if(e instanceof an)return e;if(ur.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new an(r)}else{if(e.publicKey)return e.publicKey;if(ne.isBufferSource(e))return new an(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Hn.isAsnEncoded(e)?super(e,sn):super(e),this.tag=jt.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]||ct.get()):n=e[0]||ct.get();let s=this.rawData;const a=te.parse(this.rawData,sn);return a.algorithm.algorithm===Es&&(s=ox(a,s)),n.subtle.importKey("spki",s,i,!0,r)}onInit(e){const n=pt.resolve(Zr),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Xr:{const i=te.parse(e.subjectPublicKey,af),s=ne.toUint8Array(i.modulus);r.publicExponent=ne.toUint8Array(i.publicExponent),r.modulusLength=(s[0]?s:s.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]||ct.get()):r=e[0]||ct.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=ct.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=ct.get();const i=te.parse(this.rawData,sn);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,sn);switch(e.Algorithm=Qr.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case js:e["EC Point"]=n.subjectPublicKey;break;case Xr:default:e["Raw Data"]=n.subjectPublicKey}return e}}function ox(t,e){return t.algorithm=new ce({algorithm:Xr,parameters:null}),e=te.serialize(t),e}class qs extends Mt{static async create(e,n=!1,r=ct.get()){if("name"in e&&"serialNumber"in e)return new qs(e,n);const s=await(await an.create(e,r)).getKeyIdentifier(r);return new qs(pe.ToHex(s),n)}constructor(...e){if(ne.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new jr({keyIdentifier:new Up(pe.FromHex(e[0]))});super(Pu,e[1],te.serialize(n))}else{const n=e[0],r=n.name instanceof ei?te.parse(n.name.rawData,ht):n.name,i=new jr({authorityCertIssuer:r,authorityCertSerialNumber:pe.FromHex(n.serialNumber)});super(Pu,e[1],te.serialize(i))}}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,jr);n.keyIdentifier&&(this.keyId=pe.ToHex(n.keyIdentifier)),(n.authorityCertIssuer||n.authorityCertSerialNumber)&&(this.certId={name:n.authorityCertIssuer||[],serialNumber:n.authorityCertSerialNumber?pe.ToHex(n.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,jr);return n.authorityCertIssuer&&(e["Authority Issuer"]=new ei(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}qs.NAME="Authority Key Identifier";class df extends Mt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Oa);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new Oa({cA:e[0],pathLenConstraint:e[1]});super(I2,e[2],te.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}}df.NAME="Basic Constraints";var H0;(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"})(H0||(H0={}));class pf extends Mt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Pa);this.usages=n.map(r=>r)}else{const n=new Pa(e[0]);super(D2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>Sr.toString(n)).join(", "),e}}pf.NAME="Extended Key Usages";var cc;(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"})(cc||(cc={}));class ff extends Mt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ml);this.usages=n.toNumber()}else{const n=new Ml(e[0]);super(P2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Ml);return e[""]=n.toJSON().join(", "),e}}ff.NAME="Key Usages";class bo extends Mt{static async create(e,n=!1,r=ct.get()){const s=await(await an.create(e,r)).getKeyIdentifier(r);return new bo(pe.ToHex(s),n)}constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,fr);this.keyId=pe.ToHex(n)}else{const n=typeof e[0]=="string"?pe.FromHex(e[0]):e[0],r=new fr(n);super(F2,e[1],te.serialize(r)),this.keyId=pe.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,fr);return e[""]=n,e}}bo.NAME="Subject Key Identifier";class h1 extends Mt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(L2,e[1],new ei(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Yu);this.names=new ei(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}h1.NAME="Subject Alternative Name";class qt{static register(e,n){this.items.set(e,n)}static create(e){const n=new Mt(e),r=this.items.get(n.type);return r?new r(e):n}}qt.items=new Map;class g1 extends Mt{constructor(...e){var n;if(ne.isBufferSource(e[0])){super(e[0]);const r=te.parse(this.value,Da);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,s=new Da(r.map(a=>new Yc({policyIdentifier:a})));super(O2,i,te.serialize(s)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new ze("",{},Sr.toString(n))),e}}g1.NAME="Certificate Policies";qt.register(O2,g1);class m1 extends Mt{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(a=>new Zi({distributionPoint:new Hr({fullName:[new ke({uniformResourceIdentifier:a})]})})),s=new Si(i);super(Uu,e[1],te.serialize(s))}else{const r=new Si(e[0]);super(Uu,e[1],te.serialize(r))}(n=this.distributionPoints)!==null&&n!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Si);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(s=>new dr(s).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(s=>s.toString()).join(", ")),i}),e}}m1.NAME="CRL Distribution Points";class _1 extends Mt{constructor(...e){var n,r,i,s;if(ne.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof bi){const a=new bi(e[0]);super(Ru,e[1],te.serialize(a))}else{const a=e[0],l=new bi;Vo(l,a,Ch,"ocsp"),Vo(l,a,Th,"caIssuers"),Vo(l,a,Ih,"timeStamping"),Vo(l,a,Oh,"caRepository"),super(Ru,e[1],te.serialize(l))}(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=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],te.parse(e.extnValue,bi).forEach(r=>{switch(r.accessMethod){case Ch:this.ocsp.push(new dr(r.accessLocation));break;case Th:this.caIssuers.push(new dr(r.accessLocation));break;case Ih:this.timeStamping.push(new dr(r.accessLocation));break;case Oh:this.caRepository.push(new dr(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&qo(e,"OCSP",this.ocsp),this.caIssuers.length&&qo(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&qo(e,"Time Stamping",this.timeStamping),this.caRepository.length&&qo(e,"CA Repository",this.caRepository),e}}_1.NAME="Authority Info Access";function qo(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new ze("");n.forEach((i,s)=>{const a=i.toTextObject(),l=`${a[ze.NAME]} ${s+1}`;let u=r[l];Array.isArray(u)||(u=[],r[l]=u),u.push(a)}),t[e]=r}}function Vo(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(a=>{typeof a=="string"&&(a=new dr("url",a)),t.push(new ao({accessMethod:n,accessLocation:te.parse(a.rawData,ke)}))})}class y1 extends Mt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(R2,e[1],new ei(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,ht);this.names=new ei(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}y1.NAME="Issuer Alternative Name";class ss extends kr{constructor(...e){let n;if(ne.isBufferSource(e[0]))n=ne.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(s=>ne.toArrayBuffer(s)):[];n=te.serialize(new Mn({type:r,values:i}))}super(n,Mn)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(n=>new ze("",{"":n})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ze.NAME]===ss.NAME&&(e[ze.NAME]=Sr.toString(this.type)),e}}ss.NAME="Attribute";class w1 extends ss{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=new oc({printableString:e[0]});super(c1,[te.serialize(r)])}(n=this.password)!==null&&n!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],oc);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}w1.NAME="Challenge Password";class hf extends ss{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new mr;for(const s of r)i.push(te.parse(s.rawData,Jt));super(uf,[te.serialize(i)])}(n=this.items)!==null&&n!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],mr);this.items=n.map(r=>qt.create(te.serialize(r)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.items.map(r=>r.toTextObject());for(const r of n)e[r[ze.NAME]]=r;return e}}hf.NAME="Extensions";class vl{static register(e,n){this.items.set(e,n)}static create(e){const n=new ss(e),r=this.items.get(n.type);return r?new r(e):n}}vl.items=new Map;const xo="crypto.signatureFormatter";class ax{toAsnSignature(e,n){return ne.toArrayBuffer(n)}toWebSignature(e,n){return ne.toArrayBuffer(n)}}var sa;let Ud=sa=class{static createPssParams(e,n){const r=sa.getHashAlgorithm(e);return r?new Yr({hashAlgorithm:r,maskGenAlgorithm:new ce({algorithm:dl,parameters:te.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=pt.resolve(Zr);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 ce({algorithm:Ja,parameters:null});case"sha-256":return new ce({algorithm:yd,parameters:null});case"sha-384":return new ce({algorithm:Ya,parameters:null});case"sha-512":return new ce({algorithm:Za,parameters:null})}}else return new ce({algorithm:Xr,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=sa.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new ce({algorithm:Es,parameters:te.serialize(n)})}else return new ce({algorithm:Es,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Xr:return{name:"RSASSA-PKCS1-v1_5"};case Ja:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case yd:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ya:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Za:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Es:if(e.parameters){const n=te.parse(e.parameters,Yr);return{name:"RSA-PSS",hash:pt.resolve(Zr).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};Ud=sa=m([gl()],Ud);pt.registerSingleton(vo,Ud);let Md=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ce({algorithm:Qa});case"sha-256":return new ce({algorithm:ec});case"sha-384":return new ce({algorithm:tc});case"sha-512":return new ce({algorithm:nc})}return null}toWebAlgorithm(e){switch(e.algorithm){case Qa:return{name:"SHA-1"};case ec:return{name:"SHA-256"};case tc:return{name:"SHA-384"};case nc:return{name:"SHA-512"}}return null}};Md=m([gl()],Md);pt.registerSingleton(vo,Md);class Xt{addPadding(e,n){const r=ne.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=ne.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=Xt.namedCurveSize.get(r)||Xt.defaultNamedCurveSize,s=new Xa,a=ne.toUint8Array(n);return s.r=this.removePadding(a.slice(0,i),!0),s.s=this.removePadding(a.slice(i,i+i),!0),te.serialize(s)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=te.parse(n,Xa),i=e.namedCurve,s=Xt.namedCurveSize.get(i)||Xt.defaultNamedCurveSize,a=this.addPadding(s,this.removePadding(r.r)),l=this.addPadding(s,this.removePadding(r.s));return v3(a,l)}return null}}Xt.namedCurveSize=new Map;Xt.defaultNamedCurveSize=32;const Jl="1.3.101.110",K0="1.3.101.111",Yl="1.3.101.112",G0="1.3.101.113";let qd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Yl;break;case"x25519":n=Jl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Yl;break;case"ed448":n=G0;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Jl;break;case"x448":n=K0;break}}return n?new ce({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Yl:return{name:"Ed25519"};case G0:return{name:"EdDSA",namedCurve:"Ed448"};case Jl:return{name:"X25519"};case K0:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};qd=m([gl()],qd);pt.registerSingleton(vo,qd);class cx extends Hn{constructor(e){Hn.isAsnEncoded(e)?super(e,Fs):super(e),this.tag=jt.CertificateRequestTag}onInit(e){this.tbs=te.serialize(e.certificationRequestInfo),this.publicKey=new an(e.certificationRequestInfo.subjectPKInfo);const n=pt.resolve(Zr);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>vl.create(te.serialize(i)));const r=this.getAttribute(uf);this.extensions=[],r instanceof hf&&(this.extensions=r.items),this.subjectName=new Wt(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=ct.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=pt.resolveAll(xo).reverse();let s=null;for(const l of i)if(s=l.toWebSignature(n,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Fs),r=n.certificationRequestInfo,i=new ze("",{Version:`${Kr[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ze("");for(const a of this.attributes){const l=a.toTextObject();s[l[ze.NAME]]=l}i.Attributes=s}return e.Data=i,e.Signature=new ze("",{Algorithm:Qr.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}cx.NAME="PKCS#10 Certificate Request";class bl extends Hn{constructor(e){Hn.isAsnEncoded(e)?super(e,Gr):super(e),this.tag=jt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=te.serialize(n);let r=new Uint8Array(n.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),this.serialNumber=pe.ToHex(r),this.subjectName=new Wt(n.subject),this.subject=new Wt(n.subject).toString(),this.issuerName=new Wt(n.issuer),this.issuer=this.issuerName.toString();const i=pt.resolve(Zr);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const s=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!s)throw new Error("Cannot get 'notBefore' value");this.notBefore=s;const a=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!a)throw new Error("Cannot get 'notAfter' value");this.notAfter=a,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(l=>qt.create(te.serialize(l)))),this.publicKey=new an(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=ct.get()){let r,i;const s=e.publicKey;try{if(!s)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in s)r={...s.publicKey.algorithm,...this.signatureAlgorithm},i=await s.publicKey.export(r,["verify"],n);else if(s instanceof an)r={...s.algorithm,...this.signatureAlgorithm},i=await s.export(r,["verify"],n);else if(ne.isBufferSource(s)){const d=new an(s);r={...d.algorithm,...this.signatureAlgorithm},i=await d.export(r,["verify"],n)}else r={...s.algorithm,...this.signatureAlgorithm},i=s}catch{return!1}const a=pt.resolveAll(xo).reverse();let l=null;for(const d of a)if(l=d.toWebSignature(r,this.signature),l)break;if(!l)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const u=await n.subtle.verify(this.signatureAlgorithm,i,l,this.tbs);if(e.signatureOnly)return u;{const p=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<p&&p<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=ct.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=ct.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Gr),r=n.tbsCertificate,i=new ze("",{Version:`${Kr[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":Qr.serializeAlgorithm(r.signature),Issuer:this.issuer,Validity:new ze("",{"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 s=new ze("");for(const a of this.extensions){const l=a.toTextObject();s[l[ze.NAME]]=l}i.Extensions=s}return e.Data=i,e.Signature=new ze("",{Algorithm:Qr.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}bl.NAME="Certificate";class lx{static async createSelfSigned(e,n=ct.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=ct.get()){var r;let i;e.publicKey instanceof an?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:ne.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);let s=e.serialNumber?ne.toUint8Array(pe.FromHex(e.serialNumber)):void 0;s=this.generateSerialNumber(s,n);const a=e.notBefore||new Date,l=e.notAfter||new Date(a.getTime()+31536e6),u=new Gr({tbsCertificate:new Ut({version:Kr.v3,serialNumber:s,validity:new co({notBefore:a,notAfter:l}),extensions:new mr(((r=e.extensions)===null||r===void 0?void 0:r.map(R=>te.parse(R.rawData,Jt)))||[]),subjectPublicKeyInfo:te.parse(i,sn)})});if(e.subject){const R=e.subject instanceof Wt?e.subject:new Wt(e.subject);u.tbsCertificate.subject=te.parse(R.toArrayBuffer(),Ye)}if(e.issuer){const R=e.issuer instanceof Wt?e.issuer:new Wt(e.issuer);u.tbsCertificate.issuer=te.parse(R.toArrayBuffer(),Ye)}const d={hash:"SHA-256"},p="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},h=pt.resolve(Zr);u.tbsCertificate.signature=u.signatureAlgorithm=h.toAsnAlgorithm(p);const g=te.serialize(u.tbsCertificate),A="signingKey"in e?await n.subtle.sign(p,e.signingKey,g):e.signature,$=pt.resolveAll(xo).reverse();let I=null;for(const R of $)if(I=R.toAsnSignature(p,A),I)break;if(!I)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=I,new bl(te.serialize(u))}static generateSerialNumber(e,n){let r=e&&e.length&&e.some(s=>s>0)?new Uint8Array(e):void 0;r||(r=n.getRandomValues(new Uint8Array(16)));let i=0;for(;i<r.length-1&&r[i]===0;)i++;if(r=r.slice(i),r[0]>127){const s=new Uint8Array(r.length+1);s[0]=0,s.set(r,1),r=s}return r}}var W0;(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"})(W0||(W0={}));qt.register(I2,df);qt.register(D2,pf);qt.register(P2,ff);qt.register(F2,bo);qt.register(Pu,qs);qt.register(L2,h1);qt.register(Uu,m1);qt.register(Ru,_1);qt.register(R2,y1);vl.register(c1,w1);vl.register(uf,hf);pt.registerSingleton(xo,ax);pt.registerSingleton(xo,Xt);Xt.namedCurveSize.set("P-256",32);Xt.namedCurveSize.set("K-256",32);Xt.namedCurveSize.set("P-384",48);Xt.namedCurveSize.set("P-521",66);async function Vd(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=qe(),i=xu(new TextEncoder().encode(r)),s=await lx.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 df(!0,2,!0),new pf(["1.3.6.1.5.5.7.3.1"],!0),new ff(cc.keyCertSign|cc.cRLSign,!0),await bo.create(n.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",n.privateKey),l=s.toString("pem"),u=await dx(s),d=xu(await s.getThumbprint()),p=ux("PRIVATE",a);return{kid:s.serialNumber,cert:l,thumbprint:d,fingerprint:u,pkcs7:p,type:"jwt_signing"}}function ux(t,e){const n=__.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
185
+ `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,n=0){const r=[];let i=this.pad(n++),s="";const a=e[ze.VALUE];a&&(s=` ${a}`),r.push(`${i}${e[ze.NAME]}:${s}`),i=this.pad(n);for(const l in e){if(typeof l=="symbol")continue;const u=e[l],d=l?`${l}: `:"";if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")r.push(`${i}${d}${u}`);else if(u instanceof Date)r.push(`${i}${d}${u.toUTCString()}`);else if(Array.isArray(u))for(const p of u)p[ze.NAME]=l,r.push(...this.serializeObj(p,n));else if(u instanceof ze)u[ze.NAME]=l,r.push(...this.serializeObj(u,n));else if(ne.isBufferSource(u))l?(r.push(`${i}${d}`),r.push(...this.serializeBufferSource(u,n+1))):r.push(...this.serializeBufferSource(u,n));else if("toTextObject"in u){const p=u.toTextObject();p[ze.NAME]=l,r.push(...this.serializeObj(p,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=ne.toUint8Array(e),s=[];for(let a=0;a<i.length;){const l=[];for(let u=0;u<16&&a<i.length;u++){u===8&&l.push("");const d=i[a++].toString(16).padStart(2,"0");l.push(d)}s.push(`${r}${l.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Qr.oidSerializer=Sr;Qr.algorithmSerializer=G4;class kr{constructor(...e){if(e.length===1){const n=e[0];this.rawData=te.serialize(n),this.onInit(n)}else{const n=te.parse(e[0],e[1]);this.rawData=ne.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof kr?O_(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return te.toString(this.rawData);case"text":return Qr.serialize(this.toTextObject());case"hex":return fe.ToHex(this.rawData);case"base64":return fe.ToBase64(this.rawData);case"base64url":return fe.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 ze(this.getTextName(),{},e)}}kr.NAME="ASN";class Mt extends kr{constructor(...e){let n;ne.isBufferSource(e[0])?n=ne.toArrayBuffer(e[0]):n=te.serialize(new Jt({extnID:e[0],critical:e[1],extnValue:new Ie(ne.toArrayBuffer(e[2]))})),super(n,Jt)}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[ze.NAME]===Mt.NAME&&(e[ze.NAME]=Sr.toString(this.type)),e}}var d1;class ur{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[d1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(ur.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(ur.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=ur.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(ur.DEFAULT,e);return this}}d1=Symbol.toStringTag;ur.DEFAULT="default";const ct=new ur,W4=/^[0-2](?:\.[1-9][0-9]*)+$/;function X4(t){return new RegExp(W4).test(t)}class p1{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return X4(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const St=new p1;St.register("CN","2.5.4.3");St.register("L","2.5.4.7");St.register("ST","2.5.4.8");St.register("O","2.5.4.10");St.register("OU","2.5.4.11");St.register("C","2.5.4.6");St.register("DC","0.9.2342.19200300.100.1.25");St.register("E","1.2.840.113549.1.9.1");St.register("G","2.5.4.42");St.register("I","2.5.4.43");St.register("SN","2.5.4.4");St.register("T","2.5.4.12");function J4(t,e){return`\\${fe.ToHex(fe.FromUtf8String(e)).toUpperCase()}`}function Y4(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,J4)}class Wt{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 p1,this.asn=new Ye;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 Ye?this.asn=e:ne.isBufferSource(e)?this.asn=te.parse(e,Ye):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||St.findId(e),r=[];for(const i of this.asn)for(const s of i)s.type===n&&r.push(s.value.toString());return r}getName(e){return this.extraNames.get(e)||St.get(e)}toString(){return this.asn.map(e=>e.map(n=>{const r=this.getName(n.type)||n.type,i=n.value.anyValue?`#${fe.ToHex(n.value.anyValue)}`:Y4(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const s of r){const a=this.getName(s.type)||s.type;(e=i[a])!==null&&e!==void 0||(i[a]=[]),i[a].push(s.value.anyValue?`#${fe.ToHex(s.value.anyValue)}`:s.value.toString())}n.push(i)}return n}fromString(e){const n=new Ye,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,s=",";for(;i=r.exec(`${e},`);){let[,a,l]=i;const u=l[l.length-1];(u===","||u==="+")&&(l=l.slice(0,l.length-1),i[3]=u);const d=i[3];a=this.getTypeOid(a);const p=this.createAttribute(a,l);s==="+"?n[n.length-1].push(p):n.push(new Oi([p])),s=d}return n}fromJSON(e){const n=new Ye;for(const r of e){const i=new Oi;for(const s in r){const a=this.getTypeOid(s),l=r[s];for(const u of l){const d=this.createAttribute(a,u);i.push(d)}}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 Xc({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=fe.FromHex(n.slice(1));else{const i=this.processStringValue(n);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=i:Wt.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,`
186
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return te.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]||ct.get()):r=e[0]||ct.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const f1="Cannot initialize GeneralName from ASN.1 data.",F0=`${f1} Unsupported string format in use.`,Z4=`${f1} Value doesn't match to GUID regular expression.`,U0=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,M0="1.3.6.1.4.1.311.25.1",q0="1.3.6.1.4.1.311.20.2.3",ql="dns",Vl="dn",Hl="email",Kl="ip",Gl="url",Wl="guid",Xl="upn",Mo="id";class dr extends kr{constructor(...e){let n;if(e.length===2)switch(e[0]){case Vl:{const r=new Wt(e[1]).toArrayBuffer(),i=te.parse(r,Ye);n=new ke({directoryName:i});break}case ql:n=new ke({dNSName:e[1]});break;case Hl:n=new ke({rfc822Name:e[1]});break;case Wl:{const r=new RegExp(U0,"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((s,a)=>a<3?fe.ToHex(new Uint8Array(fe.FromHex(s)).reverse()):s).join("");n=new ke({otherName:new Ds({typeId:M0,value:te.serialize(new Ie(fe.FromHex(i)))})});break}case Kl:n=new ke({iPAddress:e[1]});break;case Mo:n=new ke({registeredID:e[1]});break;case Xl:{n=new ke({otherName:new Ds({typeId:q0,value:te.serialize(C2.toASN(e[1]))})});break}case Gl:n=new ke({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else ne.isBufferSource(e[0])?n=te.parse(e[0],ke):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=ql,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Hl,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Kl,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Gl,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Mo,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Vl,this.value=new Wt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===M0){this.type=Wl;const n=te.parse(e.otherName.value,Ie),r=new RegExp(U0,"i").exec(fe.ToHex(n));if(!r)throw new Error(Z4);this.value=r.slice(1).map((i,s)=>s<3?fe.ToHex(new Uint8Array(fe.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===q0)this.type=Xl,this.value=te.parse(e.otherName.value,dt).toString();else throw new Error(F0);else throw new Error(F0)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Vl:case ql:case Wl:case Kl:case Mo:case Xl:case Gl:e=this.type.toUpperCase();break;case Hl:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Mo&&(n=Sr.toString(n)),new ze(e,void 0,n)}}class ei extends kr{constructor(e){let n;if(e instanceof ht)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof ke)r.push(i);else{const s=te.parse(new dr(i.type,i.value).rawData,ke);r.push(s)}n=new ht(r)}else if(ne.isBufferSource(e))n=te.parse(e,ht);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 dr(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[ze.NAME]];Array.isArray(i)||(i=[],e[r[ze.NAME]]=i),i.push(r)}return e}}ei.NAME="GeneralNames";const Ss="-{5}",Ms="\\n",Q4=`[^${Ms}]+`,ex=`${Ss}BEGIN (${Q4}(?=${Ss}))${Ss}`,tx=`${Ss}END \\1${Ss}`,Fi="\\n",nx=`[^:${Ms}]+`,rx=`(?:[^${Ms}]+${Fi}(?: +[^${Ms}]+${Fi})*)`,ix="[a-zA-Z0-9=+/]+",sx=`(?:${ix}${Fi})+`,V0=`${ex}${Fi}(?:((?:${nx}: ${rx})+))?${Fi}?(${sx})${tx}`;class jt{static isPem(e){return typeof e=="string"&&new RegExp(V0,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(V0,"g"),r=[];let i=null;for(;i=n.exec(e);){const s=i[3].replace(new RegExp(`[${Ms}]+`,"g"),""),a={type:i[1],headers:[],rawData:fe.FromBase64(s)},l=i[2];if(l){const u=l.split(new RegExp(Fi,"g"));let d=null;for(const p of u){const[h,g]=p.split(/:(.*)/);if(g===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=h.trim()}else d&&a.headers.push(d),d={key:h,value:g.trim()}}d&&a.headers.push(d)}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(!ne.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:ne.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(`
187
+ `)}else{if(!n)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:n,rawData:ne.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 d of e.headers)i.push(`${d.key}: ${d.value}`);i.push("")}const s=fe.ToBase64(e.rawData);let a,l=0;const u=Array();for(;l<s.length&&(s.length-l<64?a=s.substring(l):(a=s.substring(l,l+64),l+=64),a.length!==0);)if(u.push(a),a.length<64)break;return i.push(...u),i.push(`-----END ${r}-----`),i.join(`
188
+ `)}}jt.CertificateTag="CERTIFICATE";jt.CrlTag="CRL";jt.CertificateRequestTag="CERTIFICATE REQUEST";jt.PublicKeyTag="PUBLIC KEY";jt.PrivateKeyTag="PRIVATE KEY";class Hn extends kr{static isAsnEncoded(e){return ne.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(jt.isPem(e))return jt.decode(e)[0];if(fe.isHex(e))return fe.FromHex(e);if(fe.isBase64(e))return fe.FromBase64(e);if(fe.isBase64Url(e))return fe.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const n=fe.ToBinary(e);return jt.isPem(n)?jt.decode(n)[0]:fe.isHex(n)?fe.FromHex(n):fe.isBase64(n)?fe.FromBase64(n):fe.isBase64Url(n)?fe.FromBase64Url(n):ne.toArrayBuffer(e)}}constructor(...e){Hn.isAsnEncoded(e[0])?super(Hn.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return jt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class an extends Hn{static async create(e,n=ct.get()){if(e instanceof an)return e;if(ur.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new an(r)}else{if(e.publicKey)return e.publicKey;if(ne.isBufferSource(e))return new an(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Hn.isAsnEncoded(e)?super(e,sn):super(e),this.tag=jt.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]||ct.get()):n=e[0]||ct.get();let s=this.rawData;const a=te.parse(this.rawData,sn);return a.algorithm.algorithm===Es&&(s=ox(a,s)),n.subtle.importKey("spki",s,i,!0,r)}onInit(e){const n=pt.resolve(Zr),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Xr:{const i=te.parse(e.subjectPublicKey,af),s=ne.toUint8Array(i.modulus);r.publicExponent=ne.toUint8Array(i.publicExponent),r.modulusLength=(s[0]?s:s.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]||ct.get()):r=e[0]||ct.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=ct.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=ct.get();const i=te.parse(this.rawData,sn);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,sn);switch(e.Algorithm=Qr.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case js:e["EC Point"]=n.subjectPublicKey;break;case Xr:default:e["Raw Data"]=n.subjectPublicKey}return e}}function ox(t,e){return t.algorithm=new ce({algorithm:Xr,parameters:null}),e=te.serialize(t),e}class qs extends Mt{static async create(e,n=!1,r=ct.get()){if("name"in e&&"serialNumber"in e)return new qs(e,n);const s=await(await an.create(e,r)).getKeyIdentifier(r);return new qs(fe.ToHex(s),n)}constructor(...e){if(ne.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new jr({keyIdentifier:new Up(fe.FromHex(e[0]))});super(Pu,e[1],te.serialize(n))}else{const n=e[0],r=n.name instanceof ei?te.parse(n.name.rawData,ht):n.name,i=new jr({authorityCertIssuer:r,authorityCertSerialNumber:fe.FromHex(n.serialNumber)});super(Pu,e[1],te.serialize(i))}}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,jr);n.keyIdentifier&&(this.keyId=fe.ToHex(n.keyIdentifier)),(n.authorityCertIssuer||n.authorityCertSerialNumber)&&(this.certId={name:n.authorityCertIssuer||[],serialNumber:n.authorityCertSerialNumber?fe.ToHex(n.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,jr);return n.authorityCertIssuer&&(e["Authority Issuer"]=new ei(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}qs.NAME="Authority Key Identifier";class df extends Mt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Oa);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new Oa({cA:e[0],pathLenConstraint:e[1]});super(I2,e[2],te.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}}df.NAME="Basic Constraints";var H0;(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"})(H0||(H0={}));class pf extends Mt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Pa);this.usages=n.map(r=>r)}else{const n=new Pa(e[0]);super(D2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>Sr.toString(n)).join(", "),e}}pf.NAME="Extended Key Usages";var cc;(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"})(cc||(cc={}));class ff extends Mt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ml);this.usages=n.toNumber()}else{const n=new Ml(e[0]);super(P2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Ml);return e[""]=n.toJSON().join(", "),e}}ff.NAME="Key Usages";class bo extends Mt{static async create(e,n=!1,r=ct.get()){const s=await(await an.create(e,r)).getKeyIdentifier(r);return new bo(fe.ToHex(s),n)}constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,fr);this.keyId=fe.ToHex(n)}else{const n=typeof e[0]=="string"?fe.FromHex(e[0]):e[0],r=new fr(n);super(F2,e[1],te.serialize(r)),this.keyId=fe.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,fr);return e[""]=n,e}}bo.NAME="Subject Key Identifier";class h1 extends Mt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(L2,e[1],new ei(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Yu);this.names=new ei(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}h1.NAME="Subject Alternative Name";class qt{static register(e,n){this.items.set(e,n)}static create(e){const n=new Mt(e),r=this.items.get(n.type);return r?new r(e):n}}qt.items=new Map;class g1 extends Mt{constructor(...e){var n;if(ne.isBufferSource(e[0])){super(e[0]);const r=te.parse(this.value,Da);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,s=new Da(r.map(a=>new Yc({policyIdentifier:a})));super(O2,i,te.serialize(s)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new ze("",{},Sr.toString(n))),e}}g1.NAME="Certificate Policies";qt.register(O2,g1);class m1 extends Mt{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(a=>new Zi({distributionPoint:new Hr({fullName:[new ke({uniformResourceIdentifier:a})]})})),s=new Si(i);super(Uu,e[1],te.serialize(s))}else{const r=new Si(e[0]);super(Uu,e[1],te.serialize(r))}(n=this.distributionPoints)!==null&&n!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Si);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(s=>new dr(s).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(s=>s.toString()).join(", ")),i}),e}}m1.NAME="CRL Distribution Points";class _1 extends Mt{constructor(...e){var n,r,i,s;if(ne.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof bi){const a=new bi(e[0]);super(Ru,e[1],te.serialize(a))}else{const a=e[0],l=new bi;Vo(l,a,Ch,"ocsp"),Vo(l,a,Th,"caIssuers"),Vo(l,a,Ih,"timeStamping"),Vo(l,a,Oh,"caRepository"),super(Ru,e[1],te.serialize(l))}(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=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],te.parse(e.extnValue,bi).forEach(r=>{switch(r.accessMethod){case Ch:this.ocsp.push(new dr(r.accessLocation));break;case Th:this.caIssuers.push(new dr(r.accessLocation));break;case Ih:this.timeStamping.push(new dr(r.accessLocation));break;case Oh:this.caRepository.push(new dr(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&qo(e,"OCSP",this.ocsp),this.caIssuers.length&&qo(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&qo(e,"Time Stamping",this.timeStamping),this.caRepository.length&&qo(e,"CA Repository",this.caRepository),e}}_1.NAME="Authority Info Access";function qo(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new ze("");n.forEach((i,s)=>{const a=i.toTextObject(),l=`${a[ze.NAME]} ${s+1}`;let u=r[l];Array.isArray(u)||(u=[],r[l]=u),u.push(a)}),t[e]=r}}function Vo(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(a=>{typeof a=="string"&&(a=new dr("url",a)),t.push(new ao({accessMethod:n,accessLocation:te.parse(a.rawData,ke)}))})}class y1 extends Mt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(R2,e[1],new ei(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,ht);this.names=new ei(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}y1.NAME="Issuer Alternative Name";class ss extends kr{constructor(...e){let n;if(ne.isBufferSource(e[0]))n=ne.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(s=>ne.toArrayBuffer(s)):[];n=te.serialize(new Mn({type:r,values:i}))}super(n,Mn)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(n=>new ze("",{"":n})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ze.NAME]===ss.NAME&&(e[ze.NAME]=Sr.toString(this.type)),e}}ss.NAME="Attribute";class w1 extends ss{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=new oc({printableString:e[0]});super(c1,[te.serialize(r)])}(n=this.password)!==null&&n!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],oc);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}w1.NAME="Challenge Password";class hf extends ss{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new mr;for(const s of r)i.push(te.parse(s.rawData,Jt));super(uf,[te.serialize(i)])}(n=this.items)!==null&&n!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],mr);this.items=n.map(r=>qt.create(te.serialize(r)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.items.map(r=>r.toTextObject());for(const r of n)e[r[ze.NAME]]=r;return e}}hf.NAME="Extensions";class vl{static register(e,n){this.items.set(e,n)}static create(e){const n=new ss(e),r=this.items.get(n.type);return r?new r(e):n}}vl.items=new Map;const xo="crypto.signatureFormatter";class ax{toAsnSignature(e,n){return ne.toArrayBuffer(n)}toWebSignature(e,n){return ne.toArrayBuffer(n)}}var sa;let Ud=sa=class{static createPssParams(e,n){const r=sa.getHashAlgorithm(e);return r?new Yr({hashAlgorithm:r,maskGenAlgorithm:new ce({algorithm:dl,parameters:te.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=pt.resolve(Zr);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 ce({algorithm:Ja,parameters:null});case"sha-256":return new ce({algorithm:yd,parameters:null});case"sha-384":return new ce({algorithm:Ya,parameters:null});case"sha-512":return new ce({algorithm:Za,parameters:null})}}else return new ce({algorithm:Xr,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=sa.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new ce({algorithm:Es,parameters:te.serialize(n)})}else return new ce({algorithm:Es,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Xr:return{name:"RSASSA-PKCS1-v1_5"};case Ja:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case yd:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ya:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Za:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Es:if(e.parameters){const n=te.parse(e.parameters,Yr);return{name:"RSA-PSS",hash:pt.resolve(Zr).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};Ud=sa=m([gl()],Ud);pt.registerSingleton(vo,Ud);let Md=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ce({algorithm:Qa});case"sha-256":return new ce({algorithm:ec});case"sha-384":return new ce({algorithm:tc});case"sha-512":return new ce({algorithm:nc})}return null}toWebAlgorithm(e){switch(e.algorithm){case Qa:return{name:"SHA-1"};case ec:return{name:"SHA-256"};case tc:return{name:"SHA-384"};case nc:return{name:"SHA-512"}}return null}};Md=m([gl()],Md);pt.registerSingleton(vo,Md);class Xt{addPadding(e,n){const r=ne.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=ne.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=Xt.namedCurveSize.get(r)||Xt.defaultNamedCurveSize,s=new Xa,a=ne.toUint8Array(n);return s.r=this.removePadding(a.slice(0,i),!0),s.s=this.removePadding(a.slice(i,i+i),!0),te.serialize(s)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=te.parse(n,Xa),i=e.namedCurve,s=Xt.namedCurveSize.get(i)||Xt.defaultNamedCurveSize,a=this.addPadding(s,this.removePadding(r.r)),l=this.addPadding(s,this.removePadding(r.s));return v3(a,l)}return null}}Xt.namedCurveSize=new Map;Xt.defaultNamedCurveSize=32;const Jl="1.3.101.110",K0="1.3.101.111",Yl="1.3.101.112",G0="1.3.101.113";let qd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Yl;break;case"x25519":n=Jl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Yl;break;case"ed448":n=G0;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Jl;break;case"x448":n=K0;break}}return n?new ce({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Yl:return{name:"Ed25519"};case G0:return{name:"EdDSA",namedCurve:"Ed448"};case Jl:return{name:"X25519"};case K0:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};qd=m([gl()],qd);pt.registerSingleton(vo,qd);class cx extends Hn{constructor(e){Hn.isAsnEncoded(e)?super(e,Fs):super(e),this.tag=jt.CertificateRequestTag}onInit(e){this.tbs=te.serialize(e.certificationRequestInfo),this.publicKey=new an(e.certificationRequestInfo.subjectPKInfo);const n=pt.resolve(Zr);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>vl.create(te.serialize(i)));const r=this.getAttribute(uf);this.extensions=[],r instanceof hf&&(this.extensions=r.items),this.subjectName=new Wt(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=ct.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=pt.resolveAll(xo).reverse();let s=null;for(const l of i)if(s=l.toWebSignature(n,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Fs),r=n.certificationRequestInfo,i=new ze("",{Version:`${Kr[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ze("");for(const a of this.attributes){const l=a.toTextObject();s[l[ze.NAME]]=l}i.Attributes=s}return e.Data=i,e.Signature=new ze("",{Algorithm:Qr.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}cx.NAME="PKCS#10 Certificate Request";class bl extends Hn{constructor(e){Hn.isAsnEncoded(e)?super(e,Gr):super(e),this.tag=jt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=te.serialize(n);let r=new Uint8Array(n.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),this.serialNumber=fe.ToHex(r),this.subjectName=new Wt(n.subject),this.subject=new Wt(n.subject).toString(),this.issuerName=new Wt(n.issuer),this.issuer=this.issuerName.toString();const i=pt.resolve(Zr);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const s=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!s)throw new Error("Cannot get 'notBefore' value");this.notBefore=s;const a=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!a)throw new Error("Cannot get 'notAfter' value");this.notAfter=a,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(l=>qt.create(te.serialize(l)))),this.publicKey=new an(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=ct.get()){let r,i;const s=e.publicKey;try{if(!s)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in s)r={...s.publicKey.algorithm,...this.signatureAlgorithm},i=await s.publicKey.export(r,["verify"],n);else if(s instanceof an)r={...s.algorithm,...this.signatureAlgorithm},i=await s.export(r,["verify"],n);else if(ne.isBufferSource(s)){const d=new an(s);r={...d.algorithm,...this.signatureAlgorithm},i=await d.export(r,["verify"],n)}else r={...s.algorithm,...this.signatureAlgorithm},i=s}catch{return!1}const a=pt.resolveAll(xo).reverse();let l=null;for(const d of a)if(l=d.toWebSignature(r,this.signature),l)break;if(!l)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const u=await n.subtle.verify(this.signatureAlgorithm,i,l,this.tbs);if(e.signatureOnly)return u;{const p=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<p&&p<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=ct.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=ct.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Gr),r=n.tbsCertificate,i=new ze("",{Version:`${Kr[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":Qr.serializeAlgorithm(r.signature),Issuer:this.issuer,Validity:new ze("",{"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 s=new ze("");for(const a of this.extensions){const l=a.toTextObject();s[l[ze.NAME]]=l}i.Extensions=s}return e.Data=i,e.Signature=new ze("",{Algorithm:Qr.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}bl.NAME="Certificate";class lx{static async createSelfSigned(e,n=ct.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=ct.get()){var r;let i;e.publicKey instanceof an?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:ne.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);let s=e.serialNumber?ne.toUint8Array(fe.FromHex(e.serialNumber)):void 0;s=this.generateSerialNumber(s,n);const a=e.notBefore||new Date,l=e.notAfter||new Date(a.getTime()+31536e6),u=new Gr({tbsCertificate:new Ut({version:Kr.v3,serialNumber:s,validity:new co({notBefore:a,notAfter:l}),extensions:new mr(((r=e.extensions)===null||r===void 0?void 0:r.map(R=>te.parse(R.rawData,Jt)))||[]),subjectPublicKeyInfo:te.parse(i,sn)})});if(e.subject){const R=e.subject instanceof Wt?e.subject:new Wt(e.subject);u.tbsCertificate.subject=te.parse(R.toArrayBuffer(),Ye)}if(e.issuer){const R=e.issuer instanceof Wt?e.issuer:new Wt(e.issuer);u.tbsCertificate.issuer=te.parse(R.toArrayBuffer(),Ye)}const d={hash:"SHA-256"},p="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},h=pt.resolve(Zr);u.tbsCertificate.signature=u.signatureAlgorithm=h.toAsnAlgorithm(p);const g=te.serialize(u.tbsCertificate),A="signingKey"in e?await n.subtle.sign(p,e.signingKey,g):e.signature,$=pt.resolveAll(xo).reverse();let I=null;for(const R of $)if(I=R.toAsnSignature(p,A),I)break;if(!I)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=I,new bl(te.serialize(u))}static generateSerialNumber(e,n){let r=e&&e.length&&e.some(s=>s>0)?new Uint8Array(e):void 0;r||(r=n.getRandomValues(new Uint8Array(16)));let i=0;for(;i<r.length-1&&r[i]===0;)i++;if(r=r.slice(i),r[0]>127){const s=new Uint8Array(r.length+1);s[0]=0,s.set(r,1),r=s}return r}}var W0;(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"})(W0||(W0={}));qt.register(I2,df);qt.register(D2,pf);qt.register(P2,ff);qt.register(F2,bo);qt.register(Pu,qs);qt.register(L2,h1);qt.register(Uu,m1);qt.register(Ru,_1);qt.register(R2,y1);vl.register(c1,w1);vl.register(uf,hf);pt.registerSingleton(xo,ax);pt.registerSingleton(xo,Xt);Xt.namedCurveSize.set("P-256",32);Xt.namedCurveSize.set("K-256",32);Xt.namedCurveSize.set("P-384",48);Xt.namedCurveSize.set("P-521",66);async function Vd(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=qe(),i=xu(new TextEncoder().encode(r)),s=await lx.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 df(!0,2,!0),new pf(["1.3.6.1.5.5.7.3.1"],!0),new ff(cc.keyCertSign|cc.cRLSign,!0),await bo.create(n.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",n.privateKey),l=s.toString("pem"),u=await dx(s),d=xu(await s.getThumbprint()),p=ux("PRIVATE",a);return{kid:s.serialNumber,cert:l,thumbprint:d,fingerprint:u,pkcs7:p,type:"jwt_signing"}}function ux(t,e){const n=__.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
189
189
  `,i=0;for(;i<n.length;)i+64<=n.length?r+=n.substr(i,64)+`\r
190
190
  `:r+=n.substr(i)+`\r
191
191
  `,i+=64;return r+=`-----END ${t} KEY-----\r
192
- `,r}async function dx(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),s=new TextEncoder().encode(r);return xu(await h_(s))}const px=1e3*60*60*24,fx=new o.OpenAPIHono().openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.array(bu)}},description:"List of keys"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"}),n=e.filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bu}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),{signingKeys:n}=await t.env.data.keys.list({q:"type:jwt_signing"}),r=n.find(i=>i.kid===e);if(!r)throw new N(404,{message:"Key not found"});return t.json(r)}).openapi(o.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"});for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+px).toISOString()});const n=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...n,type:"jwt_signing"}),t.text("OK",{status:201})}).openapi(o.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.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 N(404,{message:"Key not found"});const r=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...r,type:"jwt_signing"}),t.text("OK")}),hx=new o.OpenAPIHono().openapi(o.createRoute({tags:["users"],method:"get",path:"/",request:{query:o.z.object({email:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.array(up)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await Ap(t.env.data.users,e,n)).filter(s=>!s.linked_to);return t.json(i)}),gx=gn.extend({clients:o.z.array(zr)}),mx=new o.OpenAPIHono().openapi(o.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([gx,o.z.array(zr)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:s,q:a}=t.req.valid("query"),u=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a})).applications;return i?t.json({clients:u,start:0,limit:10,length:u.length}):t.json(u)}).openapi(o.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:zr}},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(s=>s.id===n);if(!i)throw new N(404);return t.json(i)}).openapi(o.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Application not found"});return t.text("OK")}).openapi(o.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(ba.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:zr}},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 s=await t.env.data.applications.get(e,n);if(!s)throw new N(404,{message:"Application not found"});return t.json(s)}).openapi(o.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(ba.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:o.z.object(zr.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||qe(),client_secret:n.client_secret||qe()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()});bc.extend({email:o.z.string(),login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any());const _x=gn.extend({tenants:o.z.array(Ai)}),yx=new o.OpenAPIHono().openapi(o.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.union([o.z.array(Ai),_x])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:s}=t.req.valid("query"),a=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:dn(i),q:s});return r?t.json(a):t.json(a.tenants)}).openapi(o.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:Ai}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new N(404);return t.json(n)}).openapi(o.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.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(o.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object($a.shape).partial()}}},params:o.z.object({id:o.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(o.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object($a.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"tenant/json":{schema:Ai}},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})}),wx=gn.extend({logs:o.z.array(Ea)}),vx=new o.OpenAPIHono().openapi(o.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Ea),wx])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:s}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.logs.list(a,{page:e,per_page:n,include_totals:r,sort:dn(i),q:s});return r?t.json(l):t.json(l.logs)}).openapi(o.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ea}},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 N(404);return t.json(r)}),bx=gn.extend({hooks:o.z.array(wi)}),xx=new o.OpenAPIHono().openapi(o.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(wi),bx])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.hooks)}).openapi(o.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:Yo}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:wi}},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(o.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()}),body:{content:{"application/json":{schema:o.z.union([Yo.options[0].omit({hook_id:!0}).partial(),Yo.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:wi}},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 N(404,{message:"Hook not found"});return t.json(i)}).openapi(o.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:wi}},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 N(404,{message:"Hook not found"});return t.json(r)}).openapi(o.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.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 N(404,{message:"Hook not found"});return t.text("OK")}),$x=gn.extend({connections:o.z.array(rn)}),Ax=new o.OpenAPIHono().openapi(o.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(rn),$x])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.connections)}).openapi(o.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Connection not found"});return t.text("OK")}).openapi(o.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(xa.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Connection not found"});const s=await t.env.data.connections.get(e,n);if(!s)throw new N(404,{message:"Connection not found"});return t.json(s)}).openapi(o.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(xa.shape)}}},headers:o.z.object({"tenant-id":o.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})}),Ex=new o.OpenAPIHono().openapi(o.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Qo}},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(Qo.parse({}))}).openapi(o.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(Qo.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 X0=!1;function gf(t){t.use(async(e,n)=>(X0||(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"}}}}),X0=!0),await n()))}var v1=t=>x1(t.replace(/_|-/g,e=>({_:"/","-":"+"})[e]??e)),b1=t=>Sx(t).replace(/\/|\+/g,e=>({"/":"_","+":"-"})[e]??e),Sx=t=>{let e="";const n=new Uint8Array(t);for(let r=0,i=n.length;r<i;r++)e+=String.fromCharCode(n[r]);return btoa(e)},x1=t=>{const e=atob(t),n=new Uint8Array(new ArrayBuffer(e.length)),r=e.length/2;for(let i=0,s=e.length-1;i<=r;i++,s--)n[i]=e.charCodeAt(i),n[s]=e.charCodeAt(s);return n},$1=(t=>(t.HS256="HS256",t.HS384="HS384",t.HS512="HS512",t.RS256="RS256",t.RS384="RS384",t.RS512="RS512",t.PS256="PS256",t.PS384="PS384",t.PS512="PS512",t.ES256="ES256",t.ES384="ES384",t.ES512="ES512",t.EdDSA="EdDSA",t))($1||{}),kx=class extends Error{constructor(t){super(`${t} is not an implemented algorithm`),this.name="JwtAlgorithmNotImplemented"}},xl=class extends Error{constructor(t){super(`invalid JWT token: ${t}`),this.name="JwtTokenInvalid"}},Nx=class extends Error{constructor(t){super(`token (${t}) is being used before it's valid`),this.name="JwtTokenNotBefore"}},Cx=class extends Error{constructor(t){super(`token (${t}) expired`),this.name="JwtTokenExpired"}},Tx=class extends Error{constructor(t,e){super(`Invalid "iat" claim, must be a valid number lower than "${t}" (iat: "${e}")`),this.name="JwtTokenIssuedAt"}},Zl=class extends Error{constructor(t,e){super(`expected issuer "${t}", got ${e?`"${e}"`:"none"} `),this.name="JwtTokenIssuer"}},A1=class extends Error{constructor(t){super(`jwt header is invalid: ${JSON.stringify(t)}`),this.name="JwtHeaderInvalid"}},Ix=class extends Error{constructor(t){super(`required "kid" in jwt header: ${JSON.stringify(t)}`),this.name="JwtHeaderRequiresKid"}},Ox=class extends Error{constructor(t){super(`token(${t}) signature mismatched`),this.name="JwtTokenSignatureMismatched"}},Vs=(t=>(t.Encrypt="encrypt",t.Decrypt="decrypt",t.Sign="sign",t.Verify="verify",t.DeriveKey="deriveKey",t.DeriveBits="deriveBits",t.WrapKey="wrapKey",t.UnwrapKey="unwrapKey",t))(Vs||{}),$o=new TextEncoder,zx=new TextDecoder;async function Dx(t,e,n){const r=E1(e),i=await Px(t,r);return await crypto.subtle.sign(r,i,n)}async function Rx(t,e,n,r){const i=E1(e),s=await Bx(t,i);return await crypto.subtle.verify(i,s,n,r)}function Hd(t){return x1(t.replace(/-+(BEGIN|END).*/g,"").replace(/\s/g,""))}async function Px(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type!=="private"&&t.type!=="secret")throw new Error(`unexpected key type: CryptoKey.type is ${t.type}, expected private or secret`);return t}const n=[Vs.Sign];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PRIVATE")?await crypto.subtle.importKey("pkcs8",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",$o.encode(t),e,!1,n)}async function Bx(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type==="public"||t.type==="secret")return t;t=await J0(t)}if(typeof t=="string"&&t.includes("PRIVATE")){const r=await crypto.subtle.importKey("pkcs8",Hd(t),e,!0,[Vs.Sign]);t=await J0(r)}const n=[Vs.Verify];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PUBLIC")?await crypto.subtle.importKey("spki",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",$o.encode(t),e,!1,n)}async function J0(t){if(t.type!=="private")throw new Error(`unexpected key type: ${t.type}`);if(!t.extractable)throw new Error("unexpected private key is unextractable");const e=await crypto.subtle.exportKey("jwk",t),{kty:n}=e,{alg:r,e:i,n:s}=e,{crv:a,x:l,y:u}=e;return{kty:n,alg:r,e:i,n:s,crv:a,x:l,y:u,key_ops:[Vs.Verify]}}function E1(t){switch(t){case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"},saltLength:32};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"},saltLength:48};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"},saltLength:64};case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"},namedCurve:"P-256"};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"},namedCurve:"P-384"};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"},namedCurve:"P-521"};case"EdDSA":return{name:"Ed25519",namedCurve:"Ed25519"};default:throw new kx(t)}}function S1(t){return k_()==="node"&&crypto.webcrypto?t instanceof crypto.webcrypto.CryptoKey:t instanceof CryptoKey}var Ql=t=>b1($o.encode(JSON.stringify(t)).buffer).replace(/=/g,""),jx=t=>b1(t).replace(/=/g,""),Kd=t=>JSON.parse(zx.decode(v1(t)));function k1(t){if(typeof t=="object"&&t!==null){const e=t;return"alg"in e&&Object.values($1).includes(e.alg)&&(!("typ"in e)||e.typ==="JWT")}return!1}var Lx=async(t,e,n="HS256")=>{const r=Ql(t);let i;typeof e=="object"&&"alg"in e?(n=e.alg,i=Ql({alg:n,typ:"JWT",kid:e.kid})):i=Ql({alg:n,typ:"JWT"});const s=`${i}.${r}`,a=await Dx(e,n,$o.encode(s)),l=jx(a);return`${s}.${l}`},N1=async(t,e,n)=>{const r=typeof n=="string"?{alg:n}:n||{},i={alg:r.alg??"HS256",iss:r.iss,nbf:r.nbf??!0,exp:r.exp??!0,iat:r.iat??!0},s=t.split(".");if(s.length!==3)throw new xl(t);const{header:a,payload:l}=C1(t);if(!k1(a))throw new A1(a);const u=Date.now()/1e3|0;if(i.nbf&&l.nbf&&l.nbf>u)throw new Nx(t);if(i.exp&&l.exp&&l.exp<=u)throw new Cx(t);if(i.iat&&l.iat&&u<l.iat)throw new Tx(u,l.iat);if(i.iss){if(!l.iss)throw new Zl(i.iss,null);if(typeof i.iss=="string"&&l.iss!==i.iss)throw new Zl(i.iss,l.iss);if(i.iss instanceof RegExp&&!i.iss.test(l.iss))throw new Zl(i.iss,l.iss)}const d=t.substring(0,t.lastIndexOf("."));if(!await Rx(e,i.alg,v1(s[2]),$o.encode(d)))throw new Ox(t);return l},Fx=async(t,e,n)=>{const r=e.verification||{},i=Ux(t);if(!k1(i))throw new A1(i);if(!i.kid)throw new Ix(i);if(e.jwks_uri){const a=await fetch(e.jwks_uri,n);if(!a.ok)throw new Error(`failed to fetch JWKS from ${e.jwks_uri}`);const l=await a.json();if(!l.keys)throw new Error('invalid JWKS response. "keys" field is missing');if(!Array.isArray(l.keys))throw new Error('invalid JWKS response. "keys" field is not an array');e.keys?e.keys.push(...l.keys):e.keys=l.keys}else if(!e.keys)throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both');const s=e.keys.find(a=>a.kid===i.kid);if(!s)throw new xl(t);return await N1(t,s,{alg:s.alg||i.alg,...r})},C1=t=>{try{const[e,n]=t.split("."),r=Kd(e),i=Kd(n);return{header:r,payload:i}}catch{throw new xl(t)}},Ux=t=>{try{const[e]=t.split(".");return Kd(e)}catch{throw new xl(t)}},T1={sign:Lx,verify:N1,decode:C1,verifyWithJwks:Fx},Mx={Stringify:1,BeforeStream:2,Stream:3},cn=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},qx=/[&<>'"]/,I1=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 s=r[i];typeof s=="object"&&e.push(...s.callbacks||[]);const a=s.isEscaped;if(s=await(typeof s=="object"?s.toString():s),typeof s=="object"&&e.push(...s.callbacks||[]),s.isEscaped??a)n+=s;else{const l=[n];hr(s,l),n=l[0]}}return cn(n,e)},hr=(t,e)=>{const n=t.search(qx);if(n===-1){e[0]+=t;return}let r,i,s=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r="&quot;";break;case 39:r="&#39;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}e[0]+=t.substring(s,i)+r,s=i+1}e[0]+=t.substring(s,i)},O1=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:Mx.Stringify,buffer:n,context:r})),n[0]},Vx=T1.verify,Hx=T1.decode;async function Gd(t){const{signingKeys:e}=await t.keys.list({q:"type:jwt_signing"});return await Promise.all(e.map(async r=>{const s=await new bl(r.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",s);return hp.parse({...a,kid:r.kid})}))}o.z.object({alg:o.z.literal("RS256"),kty:o.z.literal("RSA"),use:o.z.literal("sig"),n:o.z.string(),e:o.z.string(),kid:o.z.string(),x5t:o.z.string(),x5c:o.z.array(o.z.string())});async function Kx(t){if(t.JWKS_URL&&t.JWKS_SERVICE){const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);return e.ok?(await e.json()).keys:(console.warn(`JWKS fetch failed with status ${e.status}, falling back to database`),await Gd(t.data))}return await Gd(t.data)}async function Gx(t,e){try{const{header:n}=Hx(e),i=(await Kx(t.env)).find(l=>l.kid===n.kid);if(!i)throw new N(401,{message:"No matching kid found"});const s=await crypto.subtle.importKey("jwk",i,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return await Vx(e,s,"RS256")}catch(n){throw n instanceof N?n:new N(403,{message:"Invalid JWT signature"})}}function Wx(t){return t.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"{$1}")}function Xx(t,e){return e.startsWith(t)?e:t+e}function mf(t){return async(e,n)=>{var l,u,d;const r=e.req.matchedRoutes.find(p=>p.method.toUpperCase()===e.req.method&&p.path!=="/*");if(!r)return await n();const i=Wx(r.path),s="basePath"in r&&typeof r.basePath=="string"?r.basePath:"",a=t.openAPIRegistry.definitions.find(p=>"route"in p&&Xx(s,p.route.path)===i&&p.route.method.toUpperCase()===e.req.method.toUpperCase());if(a&&"route"in a){const p=(u=(l=a.route.security)==null?void 0:l[0])==null?void 0:u.Bearer;if(!(p!=null&&p.length))return await n();const h=e.req.header("authorization")||"",[g,A]=h.split(" ");if((g==null?void 0:g.toLowerCase())!=="bearer"||!A)throw new N(401,{message:"Missing bearer token"});try{const $=await Gx(e,A);e.set("user_id",$.sub),e.set("user",$);const I=$.permissions||[],R=((d=$.scope)==null?void 0:d.split(" "))||[];if(p.length&&!(p.some(D=>I.includes(D))||p.some(D=>R.includes(D))))throw new N(403,{message:"Unauthorized"})}catch($){throw $ instanceof N?$:new N(403,{message:"Invalid token"})}}return await n()}}const Jx=new o.OpenAPIHono().openapi(o.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ea}},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 N(404,{message:"Email provider not found"});return t.json(n)}).openapi(o.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(ea.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(o.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(ea.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")}),Yx=new o.OpenAPIHono().openapi(o.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ec}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Session not found"});return t.text("OK")}).openapi(o.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),Zx=new o.OpenAPIHono().openapi(o.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:mp}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Session not found"});return t.text("OK")}),Qx=new o.OpenAPIHono().openapi(o.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.array(cr)}},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(o.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:cr}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(o.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(cr.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:cr}},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 N(404);const s=await t.env.data.customDomains.get(e,n);if(!s)throw new N(404);return t.json(s)}).openapi(o.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(fp.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:cr}},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(o.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:cr}},description:"The custom domain"}}}),async()=>{throw new N(501,{message:"Not implemented"})});function $l(t,e){const n={};for(const[r,i]of Object.entries(e)){const s={};for(const[a,l]of Object.entries(i))typeof l=="function"?s[a]=async(...u)=>{const d=performance.now();try{const p=await l(...u),g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a};dur=${g.toFixed(2)}`:`${r}-${a};dur=${g.toFixed(2)}`;return t.res.headers.set("Server-Timing",$),p}catch(p){const g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a}-error;dur=${g.toFixed(2)}`:`${r}-${a}-error;dur=${g.toFixed(2)}`;throw t.res.headers.set("Server-Timing",$),p}}:s[a]=l;n[r]=s}return n}function _f(t){return t.ISSUER}function kt(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function st(t){return t.OAUTH_API_URL||t.ISSUER}async function Al(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),t.set("host",n),await e()}const r=t.req.header("host");if(r){t.set("host",r);const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const s=i[0];await t.env.data.tenants.get(s)&&t.set("tenant_id",s)}}else t.set("host",new URL(_f(t.env)).host);if(!t.var.tenant_id){const i=t.req.header("tenant-id");i&&t.set("tenant_id",i)}return await e()}const e$=o.z.object({name:o.z.string(),version:o.z.string(),env:o.z.object({node:o.z.string().optional()}).optional()});function t$(t){if(t)try{let e=t;try{e=atob(t)}catch{}try{const n=JSON.parse(e);return e$.parse(n)}catch{}}catch{return}}const El=async(t,e)=>{var l,u,d,p;const n=(l=t.req.query("auth0Client"))==null?void 0:l.slice(0,255),r=(u=t.req.header("x-forwarded-host")&&t.req.header("x-forwarded-for")?t.req.header("x-forwarded-for"):t.req.header("cf-connecting-ip")||t.req.header("x-real-ip"))==null?void 0:u.slice(0,45),i=(d=t.req.header("user-agent"))==null?void 0:d.slice(0,512),s=(p=t.req.header("cf-ipcountry"))==null?void 0:p.slice(0,2),a=n?t$(n):void 0;a&&t.set("auth0_client",a),r&&t.set("ip",r),i&&t.set("useragent",i),s&&t.set("countryCode",s),await e()};function n$(t,e,n,r){try{const i=`${t}:${e}:${JSON.stringify(n)}`;return r?`${r}:${i}`:i}catch{const s=`${t}:${e}:${Date.now()}-${Math.random()}`;return r?`${r}:${s}`:s}}function Sl(t,e){const{cache:n,defaultTtl:r,customTtls:i={},excludeMethods:s=[],cacheEntities:a=[],keyPrefix:l}=e,u=new Set(s),d=a.length===0,p=new Set(a),h={};for(const[g,A]of Object.entries(t)){const $=d||p.has(g),I={};for(const[R,D]of Object.entries(A))if(typeof D=="function"){if(!$){I[R]=D;continue}const x=`${g}:${R}`;if(u.has(x)){I[R]=D;continue}const M=i[x]??r,G=["create","update","remove","delete","set","used"].includes(R);I[R]=async(...F)=>{if(G)return await D.apply(A,F);const H=n$(g,R,F,l),X=await n.get(H);if(X!==null)return X;const Y=await D.apply(A,F);return M>=0&&await n.set(H,Y,M),Y}}else I[R]=D;h[g]=I}return h}class r${constructor(e={}){be(this,"cache",new Map);be(this,"accessOrder",new Map);be(this,"accessCounter",0);be(this,"cleanupTimer");this.config=e;const n=e.cleanupIntervalMs;n&&n>0&&(this.cleanupTimer=setInterval(()=>{this.cleanupExpired()},n))}async get(e){const n=this.cache.get(e);return n?n.expiresAt&&n.expiresAt<new Date?(this.cache.delete(e),this.accessOrder.delete(e),null):(this.accessOrder.set(e,++this.accessCounter),n.value):null}async set(e,n,r){let i;const s=r??this.config.defaultTtlSeconds,a=s!==void 0,l=a?Math.max(0,s):0;a&&(i=new Date(Date.now()+(l>0?l*1e3:-1))),this.config.maxEntries&&this.cache.size>=this.config.maxEntries&&!this.cache.has(e)&&this.evictLeastRecentlyUsed();const u={value:n,expiresAt:i};this.cache.set(e,u),this.accessOrder.set(e,++this.accessCounter)}async delete(e){const n=this.cache.has(e);return this.cache.delete(e),this.accessOrder.delete(e),n}async clear(){this.cache.clear(),this.accessOrder.clear(),this.accessCounter=0}getStats(){return{size:this.cache.size,maxEntries:this.config.maxEntries,defaultTtlSeconds:this.config.defaultTtlSeconds}}cleanupExpired(){const e=new Date,n=[];for(const[r,i]of this.cache.entries())i.expiresAt&&i.expiresAt<e&&n.push(r);for(const r of n)this.cache.delete(r),this.accessOrder.delete(r)}evictLeastRecentlyUsed(){let e=null,n=1/0;for(const[r,i]of this.accessOrder.entries())i<n&&(n=i,e=r);e&&(this.cache.delete(e),this.accessOrder.delete(e))}destroy(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0)}}function Ao(t={}){return new r$(t)}const i$=gn.extend({forms:o.z.array(yi)}),s$=new o.OpenAPIHono().openapi(o.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(yi),i$])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.forms)}).openapi(o.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yi}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Form not found"});return t.text("OK")}).openapi(o.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(Aa.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:yi}},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 N(404,{message:"Form not found"});const s=await t.env.data.forms.get(e,n);if(!s)throw new N(404,{message:"Form not found"});return t.json(s)}).openapi(o.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(Aa.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:yi}},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})}),o$=gn.extend({roles:o.z.array(Rr)}),a$=new o.OpenAPIHono().openapi(o.createRoute({tags:["roles"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Rr),o$])}},description:"List of roles"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:s}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.roles.list(a,{page:e,per_page:n,include_totals:r,sort:dn(i),q:s});return r?t.json(l):t.json(l.roles)}).openapi(o.createRoute({tags:["roles"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"A role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.roles.get(n,e);if(!r)throw new N(404);return t.json(r)}).openapi(o.createRoute({tags:["roles"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:ka}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Rr}},description:"Role created"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.roles.create(e,n);return t.json(r,{status:201})}).openapi(o.createRoute({tags:["roles"],method:"patch",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:ka.partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"Updated role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json");if(!await t.env.data.roles.update(n,e,r))throw new N(404);const s=await t.env.data.roles.get(n,e);return t.json(s)}).openapi(o.createRoute({tags:["roles"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.roles.remove(n,e))throw new N(404);return t.text("OK")}).openapi(o.createRoute({tags:["roles"],method:"get",path:"/{id}/permissions",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o_}},description:"Role permissions"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{page:r,per_page:i,sort:s,q:a}=t.req.valid("query");if(!await t.env.data.roles.get(n,e))throw new N(404,{message:"Role not found"});const u=await t.env.data.rolePermissions.list(n,e,{page:r,per_page:i,include_totals:!1,sort:dn(s),q:a});return t.json(u)}).openapi(o.createRoute({tags:["roles"],method:"post",path:"/{id}/permissions",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({permissions:o.z.array(o.z.object({permission_name:o.z.string(),resource_server_identifier:o.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Permissions assigned to role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new N(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.assign(n,e,r.map(a=>({role_id:e,resource_server_identifier:a.resource_server_identifier,permission_name:a.permission_name}))))throw new N(500,{message:"Failed to assign permissions to role"});return t.json({message:"Permissions assigned successfully"},{status:201})}).openapi(o.createRoute({tags:["roles"],method:"delete",path:"/{id}/permissions",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({permissions:o.z.array(o.z.object({permission_name:o.z.string(),resource_server_identifier:o.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Permissions removed from role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new N(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.remove(n,e,r))throw new N(500,{message:"Failed to remove permissions from role"});return t.json({message:"Permissions removed successfully"})}),c$=gn.extend({resource_servers:o.z.array(Dr)}),l$=new o.OpenAPIHono().openapi(o.createRoute({tags:["resource-servers"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Dr),c$])}},description:"List of resource servers"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.resourceServers.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.resource_servers)}).openapi(o.createRoute({tags:["resource-servers"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.resourceServers.get(e,n);if(!r)throw new N(404);return t.json(r)}).openapi(o.createRoute({tags:["resource-servers"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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.resourceServers.remove(e,n))throw new N(404,{message:"Resource server not found"});return t.text("OK")}).openapi(o.createRoute({tags:["resource-servers"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(Sa.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"The updated resource server"}}}),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.resourceServers.update(e,n,r))throw new N(404,{message:"Resource server not found"});const s=await t.env.data.resourceServers.get(e,n);if(!s)throw new N(404,{message:"Resource server not found"});return t.json(s)}).openapi(o.createRoute({tags:["resource-servers"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(Sa.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Dr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.resourceServers.create(e,n);return t.json(r,{status:201})});function u$(t){const e=new o.OpenAPIHono;e.use(wm({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})),gf(e),e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=Sl(s,{defaultTtl:0,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,l),i()}),e.use(El).use(Al).use(mf(e));const n=e.route("/branding",lv).route("/custom-domains",Qx).route("/email/providers",Jx).route("/users",g3).route("/keys",fx).route("/users-by-email",hx).route("/clients",mx).route("/tenants",yx).route("/logs",vx).route("/hooks",xx).route("/connections",Ax).route("/prompts",Ex).route("/sessions",Yx).route("/refresh_tokens",Zx).route("/forms",s$).route("/roles",a$).route("/resource-servers",l$);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 d$(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}function wr(t){var e;if(t)return`${t.name}/${t.version}${(e=t.env)!=null&&e.node?` (env: node/${t.env.node})`:""}`}var Y0;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Y0||(Y0={}));var Z0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Z0||(Z0={}));function p$(t){return D1(t,f$,Hs.Include)}function z1(t){return D1(t,h$,Hs.None)}function D1(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let s=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)s=s<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[s>>a-6&63],a-=6):a>0?(r+=e[s<<6-a&63],a=0):n===Hs.Include&&(r+="=")}return r}const f$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Hs;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Hs||(Hs={}));var Q0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Q0||(Q0={}));class g${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 eg=new g$;function bn(t,e){return(t<<32-e|t>>>e)>>>0}function m$(t){const e=new _$;return e.update(t),e.digest()}class _${constructor(){be(this,"blockSize",64);be(this,"size",32);be(this,"blocks",new Uint8Array(64));be(this,"currentBlockSize",0);be(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));be(this,"l",0n);be(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),eg.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)eg.putUint32(e,this.H[n],n*4);return e}process(){for(let d=0;d<16;d++)this.w[d]=(this.blocks[d*4]<<24|this.blocks[d*4+1]<<16|this.blocks[d*4+2]<<8|this.blocks[d*4+3])>>>0;for(let d=16;d<64;d++){const p=(bn(this.w[d-2],17)^bn(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,h=(bn(this.w[d-15],7)^bn(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=p+this.w[d-7]+h+this.w[d-16]|0}let e=this.H[0],n=this.H[1],r=this.H[2],i=this.H[3],s=this.H[4],a=this.H[5],l=this.H[6],u=this.H[7];for(let d=0;d<64;d++){const p=(bn(s,6)^bn(s,11)^bn(s,25))>>>0,h=(s&a^~s&l)>>>0,g=u+p+h+y$[d]+this.w[d]|0,A=(bn(e,2)^bn(e,13)^bn(e,22))>>>0,$=(e&n^e&r^n&r)>>>0,I=A+$|0;u=l,l=a,a=s,s=i+g|0,i=r,r=n,n=e,e=g+I|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]=s+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=l+this.H[6]|0,this.H[7]=u+this.H[7]|0}}const y$=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 w${constructor(e){be(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 v$(t){const e=m$(new TextEncoder().encode(t));return z1(e)}function b$(){const t=new Uint8Array(32);return crypto.getRandomValues(t),z1(t)}function ks(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 eu(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return p$(n)}async function lc(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);let r;try{r=R1(n)}catch{throw new ki(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);return new w$(n)}throw e.body!==null&&await e.body.cancel(),new oa(e.status)}async function x$(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new ki(e.status,null)}if(typeof n!="object"||n===null)throw new ki(e.status,n);let r;try{r=R1(n)}catch{throw new ki(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 oa(e.status)}function R1(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 $$(e,n,r,i)}class P1 extends Error{constructor(e){super("Failed to send request",{cause:e})}}class $$ extends Error{constructor(n,r,i,s){super(`OAuth request error: ${n}`);be(this,"code");be(this,"description");be(this,"uri");be(this,"state");this.code=n,this.description=r,this.uri=i,this.state=s}}class oa extends Error{constructor(n){super("Unexpected error response");be(this,"status");this.status=n}}class ki extends Error{constructor(n,r){super("Unexpected error response body");be(this,"status");be(this,"data");this.status=n,this.data=r}}class yf{constructor(e,n,r){be(this,"clientId");be(this,"clientPassword");be(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,s){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===Ks.S256){const l=v$(i);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",l)}else r===Ks.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",i));return s.length>0&&a.searchParams.set("scope",s.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 s=ks(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${l}`)}return await lc(s)}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 s=ks(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${l}`)}return await lc(s)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=ks(e,r);if(this.clientPassword!==null){const s=eu(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${s}`)}await x$(i)}}var Ks;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(Ks||(Ks={}));var tg;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(tg||(tg={}));var ng;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(ng||(ng={}));function Ns(t){return A$(t,E$,uc.None)}function A$(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let s=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)s=s<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[s>>a-6&63],a-=6):a>0?(r+=e[s<<6-a&63],a=0):n===uc.Include&&(r+="=")}return r}const E$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var uc;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(uc||(uc={}));var rg;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(rg||(rg={}));function S$(t,e,n){const r=Ns(new TextEncoder().encode(t)),i=Ns(new TextEncoder().encode(e)),s=Ns(n);return r+"."+i+"."+s}function k$(t,e){const n=Ns(new TextEncoder().encode(t)),r=Ns(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const N$="https://appleid.apple.com/auth/authorize",C$="https://appleid.apple.com/auth/token";class B1{constructor(e,n,r,i,s){be(this,"clientId");be(this,"teamId");be(this,"keyId");be(this,"pkcs8PrivateKey");be(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=s}createAuthorizationURL(e,n){const r=new URL(N$);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=ks(C$,n);return await lc(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}),s=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,k$(r,i)));return S$(r,i,s)}}const T$="https://www.facebook.com/v16.0/dialog/oauth",I$="https://graph.facebook.com/v16.0/oauth/access_token";class j1{constructor(e,n,r){be(this,"clientId");be(this,"clientSecret");be(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(T$);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=ks(I$,n);return await lc(r)}}const O$="https://accounts.google.com/o/oauth2/v2/auth",ig="https://oauth2.googleapis.com/token",z$="https://oauth2.googleapis.com/revoke";let L1=class{constructor(e,n,r){be(this,"client");this.client=new yf(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(O$,e,Ks.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(ig,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(ig,e,[])}async revokeToken(e){await this.client.revokeToken(z$,e)}};const kl=o.z.object({iss:o.z.string().url(),sub:o.z.string(),aud:o.z.string(),exp:o.z.number(),email:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),name:o.z.string().optional(),iat:o.z.number(),auth_time:o.z.number().optional(),nonce:o.z.string().optional(),acr:o.z.string().optional(),amr:o.z.array(o.z.string()).optional(),azp:o.z.string().optional(),at_hash:o.z.string().optional(),c_hash:o.z.string().optional()}).passthrough();kl.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function F1(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 D$(t,e){var d,p;const{options:n,keyArray:r}=F1(e),i=`${st(t.env)}callback`,s=new B1(n.client_id,n.team_id,n.kid,r,i),a=qe(),l=await s.createAuthorizationURL(a,((d=n.scope)==null?void 0:d.split(" "))||["name","email"]);return(((p=n.scope)==null?void 0:p.split(" "))||["name","email"]).some(h=>["email","name"].includes(h))&&l.searchParams.set("response_mode","form_post"),{redirectUrl:l.href,code:a}}async function R$(t,e,n){const{options:r,keyArray:i}=F1(e),a=await new B1(r.client_id,r.team_id,r.kid,i,`${st(t.env)}callback`).validateAuthorizationCode(n),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const P$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:D$,validateAuthorizationCodeAndGetUser:R$},Symbol.toStringTag,{value:"Module"}));async function B$(t,e){var l;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=`${st(t.env)}callback`,i=new j1(n.client_id,n.client_secret,r),s=qe();return{redirectUrl:i.createAuthorizationURL(s,((l=n.scope)==null?void 0:l.split(" "))||["email"]).href,code:s}}async function j$(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const s=await new j1(r.client_id,r.client_secret,`${st(t.env)}callback`).validateAuthorizationCode(n),a=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${s.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const l=await a.json();return t.set("log",`Userinfo: ${JSON.stringify(l)}`),{sub:l.id,email:l.email,name:l.name}}const L$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:B$,validateAuthorizationCodeAndGetUser:j$},Symbol.toStringTag,{value:"Module"}));async function F$(t,e){var u;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=`${st(t.env)}callback`,i=new L1(n.client_id,n.client_secret,r),s=qe(),a=b$();return{redirectUrl:i.createAuthorizationURL(s,a,((u=n.scope)==null?void 0:u.split(" "))??["email","profile"]).href,code:s,codeVerifier:a}}async function U$(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 L1(i.client_id,i.client_secret,`${st(t.env)}callback`).validateAuthorizationCode(n,r),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const M$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:F$,validateAuthorizationCodeAndGetUser:U$},Symbol.toStringTag,{value:"Module"}));async function q$(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 yf(n.client_id,n.client_secret,`${st(t.env)}callback`),i=qe(),s=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 s.searchParams.set("response_type","code"),s.searchParams.set("response_mode","query"),{redirectUrl:s.href,code:i}}async function V$(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const s=await new yf(r.client_id,r.client_secret,`${st(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),a=yp(s.idToken());if(!a)throw new Error("Invalid ID token");const l=kl.parse(a.payload);if(typeof l.msn!="string")throw new Error("msn not available in id token");const u=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${s.accessToken()}`,"Merchant-Serial-Number":l.msn}});if(!u.ok)throw new N(400,{message:"Failed to get user from vipps"});return await u.json()}const H$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:q$,validateAuthorizationCodeAndGetUser:V$},Symbol.toStringTag,{value:"Module"}));function U1(t,e){const n=t.env.STRATEGIES||{},i={apple:P$,facebook:L$,"google-oauth2":M$,vipps:H$,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function os(t,e){const n=await t.data.clients.get(e);if(!n)throw new N(403,{message:"Client not found"});let r=n;if(t.DEFAULT_CLIENT_ID||t.DEFAULT_TENANT_ID){const i=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,s=await t.data.connections.list(n.tenant.id),a=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},l=s.connections.map(u=>{var h;const d=(h=a.connections)==null?void 0:h.find(g=>g.name===u.name);if(!(d!=null&&d.options))return u;const p=rn.parse({...d||{},...u});return p.options=$i.passthrough().parse({...d.options||{},...u.options}),p}).filter(u=>u);r={...n,web_origins:[...(i==null?void 0:i.web_origins)||[],...n.web_origins||[]],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...n.allowed_logout_urls||[]],callbacks:[...(i==null?void 0:i.callbacks)||[],...n.callbacks||[]],connections:l,tenant:{...(i==null?void 0:i.tenant)||{},...n.tenant}}}return{...r,web_origins:[...r.web_origins||[],`${kt(t)}login`],allowed_logout_urls:[...r.allowed_logout_urls||[],t.ISSUER],callbacks:[...r.callbacks||[],`${kt(t)}info`]}}async function sg(t,e,n,r){if(!r.state)throw new N(400,{message:"State not found"});const i=e.connections.find(u=>u.name===n);if(!i){t.set("client_id",e.id);const u=Ue(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,u),new N(403,{message:"Connection Not Found"})}let s=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!s){const u=t.get("ip"),d=t.get("useragent"),p=t.get("auth0_client");s=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:r,csrf_token:qe(),ip:u,useragent:d,auth0Client:wr(p)})}const l=await U1(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:s.id,code_id:l.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:l.codeVerifier,expires_at:new Date(Date.now()+Iv*1e3).toISOString()}),new Response(null,{status:302,headers:{location:l.redirectUrl}})}async function og(t,{code:e,state:n}){var $;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new N(403,{message:"State not found"});const s=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!s)throw new N(403,{message:"Session not found"});if(s.authorization_url){const I=new URL(s.authorization_url).hostname,R=t.var.host||"";if(I!==R&&I){const D=new URL(`https://${I}/callback`);return D.searchParams.set("state",n),D.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:D.toString()}})}}const a=await os(r,s.authParams.client_id);t.set("client_id",a.id),t.set("tenant_id",a.tenant.id);const l=a.connections.find(I=>I.id===i.connection_id);if(!l){const I=Ue(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(a.tenant.id,I),new N(403,{message:"Connection not found"})}if(t.set("connection",l.name),!s.authParams.redirect_uri){const I=Ue(t,{type:Le.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(a.tenant.id,I),new N(403,{message:"Redirect URI not defined"})}const d=await U1(t,l.strategy).validateAuthorizationCodeAndGetUser(t,l,e,i.code_verifier),{sub:p,...h}=d;t.set("user_id",p);const g=(($=d.email)==null?void 0:$.toLocaleLowerCase())||`${l.name}.${p}@${new URL(t.env.ISSUER).hostname}`;t.set("username",g);const A=await Ic(t,{client:a,username:g,provider:l.strategy,connection:l.name,userId:p,profileData:h,isSocial:!0,ip:t.req.header("x-real-ip")});return Er(t,{client:a,authParams:s.authParams,loginSession:s,user:A})}async function ag(t,e,n,r,i,s){const a=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!a)throw new N(400,{message:"State not found"});const l=await t.env.data.loginSessions.get(t.var.tenant_id,a.login_id);if(!l)throw new N(400,{message:"Login not found"});const{redirect_uri:u}=l.authParams;if(!u)throw new N(400,{message:"Redirect uri not found"});const d=Ue(t,{type:Le.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});Bt(t,t.env.data.logs.create(t.var.tenant_id,d));const p=new URL(u);return d$(p,{error:n,error_description:r,error_reason:s,error_code:i,state:l.authParams.state}),t.redirect(`${kt(t.env)}login/identifier?state=${l.id}&error=${n}`)}const K$=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:s,error_reason:a}=t.req.valid("query");if(r)return ag(t,e,r,i,s,a);if(!n)throw new N(400,{message:"Code is required"});const l=await og(t,{code:n,state:e});if(!(l instanceof Response))throw new N(500,{message:"Internal server error"});return l}).openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:s,error_reason:a}=t.req.valid("form");if(r)return ag(t,e,r,i,s,a);if(!n)throw new N(400,{message:"Code is required"});const l=await og(t,{code:n,state:e});if(!(l instanceof Response))throw new N(500,{message:"Internal server error"});return l});function M1(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return G$(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function G$(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 W$=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),returnTo:o.z.string().optional()}),header:o.z.object({cookie:o.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 s=n||t.req.header("referer");if(!s)return t.text("OK");if(!M1(s,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new N(400,{message:"Invalid redirect uri"});const a=t.req.header("cookie");if(a){const u=Is(r.tenant.id,a);if(u){const d=await t.env.data.sessions.get(r.tenant.id,u);if(d){const p=await t.env.data.users.get(r.tenant.id,d.user_id);p&&(t.set("user_id",p.user_id),t.set("connection",p.connection));const h=await t.env.data.refreshTokens.list(r.tenant.id,{q:`session_id=${u}`,page:0,per_page:100,include_totals:!1});await Promise.all(h.refresh_tokens.map(g=>t.env.data.refreshTokens.remove(r.tenant.id,g.id))),await t.env.data.sessions.update(r.tenant.id,u,{revoked_at:new Date().toISOString()})}}}const l=Ue(t,{type:Le.SUCCESS_LOGOUT,description:"User successfully logged out"});return await t.env.data.logs.create(r.tenant.id,l),new Response("Redirecting",{status:302,headers:{"set-cookie":Pv(r.tenant.id,t.req.header("host")),location:s}})}),cg=o.z.object({sub:o.z.string(),email:o.z.string().optional(),family_name:o.z.string().optional(),given_name:o.z.string().optional(),email_verified:o.z.boolean()}),X$=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:cg}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new N(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 N(404,{message:"User not found"});return t.json(cg.parse({...e,sub:e.user_id}))}),J$=new o.OpenAPIHono().openapi(o.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:qm}},description:"List of tenants"}}}),async t=>{const e=await Gd(t.env.data);return t.json({keys:e},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Lo}, stale-while-revalidate=${Lo*2}, stale-if-error=86400`}})}).openapi(o.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:vu}},description:"List of tenants"}}}),async t=>{const e=vu.parse({issuer:_f(t.env),authorization_endpoint:`${st(t.env)}authorize`,token_endpoint:`${st(t.env)}oauth/token`,device_authorization_endpoint:`${st(t.env)}oauth/device/code`,userinfo_endpoint:`${st(t.env)}userinfo`,mfa_challenge_endpoint:`${st(t.env)}mfa/challenge`,jwks_uri:`${st(t.env)}.well-known/jwks.json`,registration_endpoint:`${st(t.env)}oidc/register`,revocation_endpoint:`${st(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=${Lo}, stale-while-revalidate=${Lo*2}, stale-if-error=86400`}})});function aa(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 q1=o.z.object({grant_type:o.z.literal("client_credentials"),scope:o.z.string().optional(),client_secret:o.z.string(),client_id:o.z.string(),audience:o.z.string().optional()});async function Y$(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new N(403,{message:"Invalid client credentials"});if(n.client_secret&&!aa(n.client_secret,e.client_secret))throw new N(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience};return{client:n,authParams:r}}const Z$=o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string().optional(),client_secret:o.z.string().optional(),code_verifier:o.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 Q$(t,e){var l;const n=await t.env.data.clients.get(e.client_id);if(!n)throw new N(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 N(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new N(403,{message:"Code expired"});if(r.used_at)throw new N(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new N(403,{message:"Invalid login"});if("client_secret"in e){const u=await t.env.data.clients.get("DEFAULT_CLIENT");if(!aa(n.client_secret,e.client_secret)&&!aa(u==null?void 0:u.client_secret,e.client_secret))throw new N(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const u=await Nv(e.code_verifier,r.code_challenge_method);if(!aa(u,r.code_challenge))throw new N(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new N(403,{message:"Invalid redirect uri"});const s=await t.env.data.users.get(n.tenant.id,r.user_id);if(!s)throw new N(403,{message:"User not found"});await t.env.data.codes.used(n.tenant.id,e.code);let a;return i.session_id&&((l=i.authParams.scope)!=null&&l.split(" ").includes("offline_access"))&&(a=await C_(t,{user:s,client:n,session_id:i.session_id,scope:i.authParams.scope,audience:i.authParams.audience})),{user:s,client:n,loginSession:i,session_id:i.session_id,refresh_token:a==null?void 0:a.id,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:En.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}}}const e5=o.z.object({grant_type:o.z.literal("refresh_token"),client_id:o.z.string(),redirect_uri:o.z.string().optional(),refresh_token:o.z.string()});async function t5(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new N(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 N(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new N(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 N(403,{message:"User not found"});const s=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{user:i,client:n,refresh_token:r.id,session_id:r.session_id,authParams:{client_id:n.id,audience:s==null?void 0:s.audience,scope:s==null?void 0:s.scopes,response_mode:En.WEB_MESSAGE}}}const n5={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 r5(t,e){var n=Array.prototype.slice.call(e);return n.push(n5),t.apply(this,n)}function lg(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var s=Number(n[i]),a=Number(r[i]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!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 i5={}.constructor;function Ni(t){return t!=null&&t.constructor===i5}function Wd(t){"@babel/helpers - typeof";return Wd=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},Wd(t)}function Nl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s5(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 Cl(t,e,n){return e&&s5(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var o5="1.2.0",a5="1.7.35",ug=" ext. ",c5=/^\d+$/,wt=function(){function t(e){Nl(this,t),V1(e),this.metadata=e,H1.call(this,e)}return Cl(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&&c5.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new dg(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new dg(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 s=this.countryCallingCodes()[n];if(s&&s.length===1&&s[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}(),dg=function(){function t(e,n){Nl(this,t),this.globalMetadataObject=n,this.metadata=e,H1.call(this,n.metadata)}return Cl(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 l5(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()&&pg(this.types(),n))return new d5(pg(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?ug:this.metadata[13]||ug}}]),t}(),l5=function(){function t(e,n){Nl(this,t),this._format=e,this.metadata=n}return Cl(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()&&!u5.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),u5=/^\(?\$1\)?$/,d5=function(){function t(e,n){Nl(this,t),this.type=e,this.metadata=n}return Cl(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 pg(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 V1(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Ni(t)||!Ni(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(Ni(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+p5(t)+": "+t,"."))}var p5=function(e){return Wd(e)};function wf(t,e){if(e=new wt(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function f5(t,e){return e.countries.hasOwnProperty(t)}function H1(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?lg(e,o5)===-1?this.v2=!0:lg(e,a5)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function vf(t,e){return h5(t,void 0,e)}function h5(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var s=t.length,a=i[0];return a===s?"IS_POSSIBLE":a>s?"TOO_SHORT":i[i.length-1]<s?"TOO_LONG":i.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function g5(t,e,n){if(e===void 0&&(e={}),n=new wt(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 K1(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 K1(t,e){switch(vf(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Kn(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function m5(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=_5(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.
192
+ `,r}async function dx(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),s=new TextEncoder().encode(r);return xu(await h_(s))}const px=1e3*60*60*24,fx=new o.OpenAPIHono().openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.array(bu)}},description:"List of keys"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"}),n=e.filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bu}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),{signingKeys:n}=await t.env.data.keys.list({q:"type:jwt_signing"}),r=n.find(i=>i.kid===e);if(!r)throw new N(404,{message:"Key not found"});return t.json(r)}).openapi(o.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"});for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+px).toISOString()});const n=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...n,type:"jwt_signing"}),t.text("OK",{status:201})}).openapi(o.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.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 N(404,{message:"Key not found"});const r=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...r,type:"jwt_signing"}),t.text("OK")}),hx=new o.OpenAPIHono().openapi(o.createRoute({tags:["users"],method:"get",path:"/",request:{query:o.z.object({email:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.array(up)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await Ap(t.env.data.users,e,n)).filter(s=>!s.linked_to);return t.json(i)}),gx=gn.extend({clients:o.z.array(zr)}),mx=new o.OpenAPIHono().openapi(o.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([gx,o.z.array(zr)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:s,q:a}=t.req.valid("query"),u=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a})).applications;return i?t.json({clients:u,start:0,limit:10,length:u.length}):t.json(u)}).openapi(o.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:zr}},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(s=>s.id===n);if(!i)throw new N(404);return t.json(i)}).openapi(o.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Application not found"});return t.text("OK")}).openapi(o.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(ba.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:zr}},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 s=await t.env.data.applications.get(e,n);if(!s)throw new N(404,{message:"Application not found"});return t.json(s)}).openapi(o.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(ba.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:o.z.object(zr.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||qe(),client_secret:n.client_secret||qe()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()});bc.extend({email:o.z.string(),login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any());const _x=gn.extend({tenants:o.z.array(Ai)}),yx=new o.OpenAPIHono().openapi(o.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.union([o.z.array(Ai),_x])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:s}=t.req.valid("query"),a=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:dn(i),q:s});return r?t.json(a):t.json(a.tenants)}).openapi(o.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:Ai}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new N(404);return t.json(n)}).openapi(o.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.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(o.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object($a.shape).partial()}}},params:o.z.object({id:o.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(o.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object($a.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"tenant/json":{schema:Ai}},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})}),wx=gn.extend({logs:o.z.array(Ea)}),vx=new o.OpenAPIHono().openapi(o.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Ea),wx])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:s}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.logs.list(a,{page:e,per_page:n,include_totals:r,sort:dn(i),q:s});return r?t.json(l):t.json(l.logs)}).openapi(o.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ea}},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 N(404);return t.json(r)}),bx=gn.extend({hooks:o.z.array(wi)}),xx=new o.OpenAPIHono().openapi(o.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(wi),bx])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.hooks)}).openapi(o.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:Yo}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:wi}},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(o.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()}),body:{content:{"application/json":{schema:o.z.union([Yo.options[0].omit({hook_id:!0}).partial(),Yo.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:wi}},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 N(404,{message:"Hook not found"});return t.json(i)}).openapi(o.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:wi}},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 N(404,{message:"Hook not found"});return t.json(r)}).openapi(o.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.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 N(404,{message:"Hook not found"});return t.text("OK")}),$x=gn.extend({connections:o.z.array(rn)}),Ax=new o.OpenAPIHono().openapi(o.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(rn),$x])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.connections)}).openapi(o.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Connection not found"});return t.text("OK")}).openapi(o.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(xa.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Connection not found"});const s=await t.env.data.connections.get(e,n);if(!s)throw new N(404,{message:"Connection not found"});return t.json(s)}).openapi(o.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(xa.shape)}}},headers:o.z.object({"tenant-id":o.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})}),Ex=new o.OpenAPIHono().openapi(o.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Qo}},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(Qo.parse({}))}).openapi(o.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(Qo.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 X0=!1;function gf(t){t.use(async(e,n)=>(X0||(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"}}}}),X0=!0),await n()))}var v1=t=>x1(t.replace(/_|-/g,e=>({_:"/","-":"+"})[e]??e)),b1=t=>Sx(t).replace(/\/|\+/g,e=>({"/":"_","+":"-"})[e]??e),Sx=t=>{let e="";const n=new Uint8Array(t);for(let r=0,i=n.length;r<i;r++)e+=String.fromCharCode(n[r]);return btoa(e)},x1=t=>{const e=atob(t),n=new Uint8Array(new ArrayBuffer(e.length)),r=e.length/2;for(let i=0,s=e.length-1;i<=r;i++,s--)n[i]=e.charCodeAt(i),n[s]=e.charCodeAt(s);return n},$1=(t=>(t.HS256="HS256",t.HS384="HS384",t.HS512="HS512",t.RS256="RS256",t.RS384="RS384",t.RS512="RS512",t.PS256="PS256",t.PS384="PS384",t.PS512="PS512",t.ES256="ES256",t.ES384="ES384",t.ES512="ES512",t.EdDSA="EdDSA",t))($1||{}),kx=class extends Error{constructor(t){super(`${t} is not an implemented algorithm`),this.name="JwtAlgorithmNotImplemented"}},xl=class extends Error{constructor(t){super(`invalid JWT token: ${t}`),this.name="JwtTokenInvalid"}},Nx=class extends Error{constructor(t){super(`token (${t}) is being used before it's valid`),this.name="JwtTokenNotBefore"}},Cx=class extends Error{constructor(t){super(`token (${t}) expired`),this.name="JwtTokenExpired"}},Tx=class extends Error{constructor(t,e){super(`Invalid "iat" claim, must be a valid number lower than "${t}" (iat: "${e}")`),this.name="JwtTokenIssuedAt"}},Zl=class extends Error{constructor(t,e){super(`expected issuer "${t}", got ${e?`"${e}"`:"none"} `),this.name="JwtTokenIssuer"}},A1=class extends Error{constructor(t){super(`jwt header is invalid: ${JSON.stringify(t)}`),this.name="JwtHeaderInvalid"}},Ix=class extends Error{constructor(t){super(`required "kid" in jwt header: ${JSON.stringify(t)}`),this.name="JwtHeaderRequiresKid"}},Ox=class extends Error{constructor(t){super(`token(${t}) signature mismatched`),this.name="JwtTokenSignatureMismatched"}},Vs=(t=>(t.Encrypt="encrypt",t.Decrypt="decrypt",t.Sign="sign",t.Verify="verify",t.DeriveKey="deriveKey",t.DeriveBits="deriveBits",t.WrapKey="wrapKey",t.UnwrapKey="unwrapKey",t))(Vs||{}),$o=new TextEncoder,zx=new TextDecoder;async function Dx(t,e,n){const r=E1(e),i=await Px(t,r);return await crypto.subtle.sign(r,i,n)}async function Rx(t,e,n,r){const i=E1(e),s=await Bx(t,i);return await crypto.subtle.verify(i,s,n,r)}function Hd(t){return x1(t.replace(/-+(BEGIN|END).*/g,"").replace(/\s/g,""))}async function Px(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type!=="private"&&t.type!=="secret")throw new Error(`unexpected key type: CryptoKey.type is ${t.type}, expected private or secret`);return t}const n=[Vs.Sign];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PRIVATE")?await crypto.subtle.importKey("pkcs8",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",$o.encode(t),e,!1,n)}async function Bx(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type==="public"||t.type==="secret")return t;t=await J0(t)}if(typeof t=="string"&&t.includes("PRIVATE")){const r=await crypto.subtle.importKey("pkcs8",Hd(t),e,!0,[Vs.Sign]);t=await J0(r)}const n=[Vs.Verify];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PUBLIC")?await crypto.subtle.importKey("spki",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",$o.encode(t),e,!1,n)}async function J0(t){if(t.type!=="private")throw new Error(`unexpected key type: ${t.type}`);if(!t.extractable)throw new Error("unexpected private key is unextractable");const e=await crypto.subtle.exportKey("jwk",t),{kty:n}=e,{alg:r,e:i,n:s}=e,{crv:a,x:l,y:u}=e;return{kty:n,alg:r,e:i,n:s,crv:a,x:l,y:u,key_ops:[Vs.Verify]}}function E1(t){switch(t){case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"},saltLength:32};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"},saltLength:48};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"},saltLength:64};case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"},namedCurve:"P-256"};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"},namedCurve:"P-384"};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"},namedCurve:"P-521"};case"EdDSA":return{name:"Ed25519",namedCurve:"Ed25519"};default:throw new kx(t)}}function S1(t){return k_()==="node"&&crypto.webcrypto?t instanceof crypto.webcrypto.CryptoKey:t instanceof CryptoKey}var Ql=t=>b1($o.encode(JSON.stringify(t)).buffer).replace(/=/g,""),jx=t=>b1(t).replace(/=/g,""),Kd=t=>JSON.parse(zx.decode(v1(t)));function k1(t){if(typeof t=="object"&&t!==null){const e=t;return"alg"in e&&Object.values($1).includes(e.alg)&&(!("typ"in e)||e.typ==="JWT")}return!1}var Lx=async(t,e,n="HS256")=>{const r=Ql(t);let i;typeof e=="object"&&"alg"in e?(n=e.alg,i=Ql({alg:n,typ:"JWT",kid:e.kid})):i=Ql({alg:n,typ:"JWT"});const s=`${i}.${r}`,a=await Dx(e,n,$o.encode(s)),l=jx(a);return`${s}.${l}`},N1=async(t,e,n)=>{const r=typeof n=="string"?{alg:n}:n||{},i={alg:r.alg??"HS256",iss:r.iss,nbf:r.nbf??!0,exp:r.exp??!0,iat:r.iat??!0},s=t.split(".");if(s.length!==3)throw new xl(t);const{header:a,payload:l}=C1(t);if(!k1(a))throw new A1(a);const u=Date.now()/1e3|0;if(i.nbf&&l.nbf&&l.nbf>u)throw new Nx(t);if(i.exp&&l.exp&&l.exp<=u)throw new Cx(t);if(i.iat&&l.iat&&u<l.iat)throw new Tx(u,l.iat);if(i.iss){if(!l.iss)throw new Zl(i.iss,null);if(typeof i.iss=="string"&&l.iss!==i.iss)throw new Zl(i.iss,l.iss);if(i.iss instanceof RegExp&&!i.iss.test(l.iss))throw new Zl(i.iss,l.iss)}const d=t.substring(0,t.lastIndexOf("."));if(!await Rx(e,i.alg,v1(s[2]),$o.encode(d)))throw new Ox(t);return l},Fx=async(t,e,n)=>{const r=e.verification||{},i=Ux(t);if(!k1(i))throw new A1(i);if(!i.kid)throw new Ix(i);if(e.jwks_uri){const a=await fetch(e.jwks_uri,n);if(!a.ok)throw new Error(`failed to fetch JWKS from ${e.jwks_uri}`);const l=await a.json();if(!l.keys)throw new Error('invalid JWKS response. "keys" field is missing');if(!Array.isArray(l.keys))throw new Error('invalid JWKS response. "keys" field is not an array');e.keys?e.keys.push(...l.keys):e.keys=l.keys}else if(!e.keys)throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both');const s=e.keys.find(a=>a.kid===i.kid);if(!s)throw new xl(t);return await N1(t,s,{alg:s.alg||i.alg,...r})},C1=t=>{try{const[e,n]=t.split("."),r=Kd(e),i=Kd(n);return{header:r,payload:i}}catch{throw new xl(t)}},Ux=t=>{try{const[e]=t.split(".");return Kd(e)}catch{throw new xl(t)}},T1={sign:Lx,verify:N1,decode:C1,verifyWithJwks:Fx},Mx={Stringify:1,BeforeStream:2,Stream:3},cn=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},qx=/[&<>'"]/,I1=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 s=r[i];typeof s=="object"&&e.push(...s.callbacks||[]);const a=s.isEscaped;if(s=await(typeof s=="object"?s.toString():s),typeof s=="object"&&e.push(...s.callbacks||[]),s.isEscaped??a)n+=s;else{const l=[n];hr(s,l),n=l[0]}}return cn(n,e)},hr=(t,e)=>{const n=t.search(qx);if(n===-1){e[0]+=t;return}let r,i,s=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r="&quot;";break;case 39:r="&#39;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}e[0]+=t.substring(s,i)+r,s=i+1}e[0]+=t.substring(s,i)},O1=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:Mx.Stringify,buffer:n,context:r})),n[0]},Vx=T1.verify,Hx=T1.decode;async function Gd(t){const{signingKeys:e}=await t.keys.list({q:"type:jwt_signing"});return await Promise.all(e.map(async r=>{const s=await new bl(r.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",s);return hp.parse({...a,kid:r.kid})}))}o.z.object({alg:o.z.literal("RS256"),kty:o.z.literal("RSA"),use:o.z.literal("sig"),n:o.z.string(),e:o.z.string(),kid:o.z.string(),x5t:o.z.string(),x5c:o.z.array(o.z.string())});async function Kx(t){if(t.JWKS_URL&&t.JWKS_SERVICE){const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);return e.ok?(await e.json()).keys:(console.warn(`JWKS fetch failed with status ${e.status}, falling back to database`),await Gd(t.data))}return await Gd(t.data)}async function Gx(t,e){try{const{header:n}=Hx(e),i=(await Kx(t.env)).find(l=>l.kid===n.kid);if(!i)throw new N(401,{message:"No matching kid found"});const s=await crypto.subtle.importKey("jwk",i,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return await Vx(e,s,"RS256")}catch(n){throw n instanceof N?n:new N(403,{message:"Invalid JWT signature"})}}function Wx(t){return t.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"{$1}")}function Xx(t,e){return e.startsWith(t)?e:t+e}function mf(t){return async(e,n)=>{var l,u,d;const r=e.req.matchedRoutes.find(p=>p.method.toUpperCase()===e.req.method&&p.path!=="/*");if(!r)return await n();const i=Wx(r.path),s="basePath"in r&&typeof r.basePath=="string"?r.basePath:"",a=t.openAPIRegistry.definitions.find(p=>"route"in p&&Xx(s,p.route.path)===i&&p.route.method.toUpperCase()===e.req.method.toUpperCase());if(a&&"route"in a){const p=(u=(l=a.route.security)==null?void 0:l[0])==null?void 0:u.Bearer;if(!(p!=null&&p.length))return await n();const h=e.req.header("authorization")||"",[g,A]=h.split(" ");if((g==null?void 0:g.toLowerCase())!=="bearer"||!A)throw new N(401,{message:"Missing bearer token"});try{const $=await Gx(e,A);e.set("user_id",$.sub),e.set("user",$);const I=$.permissions||[],R=((d=$.scope)==null?void 0:d.split(" "))||[];if(p.length&&!(p.some(D=>I.includes(D))||p.some(D=>R.includes(D))))throw new N(403,{message:"Unauthorized"})}catch($){throw $ instanceof N?$:new N(403,{message:"Invalid token"})}}return await n()}}const Jx=new o.OpenAPIHono().openapi(o.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ea}},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 N(404,{message:"Email provider not found"});return t.json(n)}).openapi(o.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(ea.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(o.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(ea.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")}),Yx=new o.OpenAPIHono().openapi(o.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ec}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Session not found"});return t.text("OK")}).openapi(o.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),Zx=new o.OpenAPIHono().openapi(o.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:mp}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Session not found"});return t.text("OK")}),Qx=new o.OpenAPIHono().openapi(o.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.array(cr)}},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(o.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:cr}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(o.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(cr.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:cr}},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 N(404);const s=await t.env.data.customDomains.get(e,n);if(!s)throw new N(404);return t.json(s)}).openapi(o.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(fp.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:cr}},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(o.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:cr}},description:"The custom domain"}}}),async()=>{throw new N(501,{message:"Not implemented"})});function $l(t,e){const n={};for(const[r,i]of Object.entries(e)){const s={};for(const[a,l]of Object.entries(i))typeof l=="function"?s[a]=async(...u)=>{const d=performance.now();try{const p=await l(...u),g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a};dur=${g.toFixed(2)}`:`${r}-${a};dur=${g.toFixed(2)}`;return t.res.headers.set("Server-Timing",$),p}catch(p){const g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a}-error;dur=${g.toFixed(2)}`:`${r}-${a}-error;dur=${g.toFixed(2)}`;throw t.res.headers.set("Server-Timing",$),p}}:s[a]=l;n[r]=s}return n}function _f(t){return t.ISSUER}function kt(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function st(t){return t.OAUTH_API_URL||t.ISSUER}async function Al(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),t.set("host",n),await e()}const r=t.req.header("host");if(r){t.set("host",r);const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const s=i[0];await t.env.data.tenants.get(s)&&t.set("tenant_id",s)}}else t.set("host",new URL(_f(t.env)).host);if(!t.var.tenant_id){const i=t.req.header("tenant-id");i&&t.set("tenant_id",i)}return await e()}const e$=o.z.object({name:o.z.string(),version:o.z.string(),env:o.z.object({node:o.z.string().optional()}).optional()});function t$(t){if(t)try{let e=t;try{e=atob(t)}catch{}try{const n=JSON.parse(e);return e$.parse(n)}catch{}}catch{return}}const El=async(t,e)=>{var l,u,d,p;const n=(l=t.req.query("auth0Client"))==null?void 0:l.slice(0,255),r=(u=t.req.header("x-forwarded-host")&&t.req.header("x-forwarded-for")?t.req.header("x-forwarded-for"):t.req.header("cf-connecting-ip")||t.req.header("x-real-ip"))==null?void 0:u.slice(0,45),i=(d=t.req.header("user-agent"))==null?void 0:d.slice(0,512),s=(p=t.req.header("cf-ipcountry"))==null?void 0:p.slice(0,2),a=n?t$(n):void 0;a&&t.set("auth0_client",a),r&&t.set("ip",r),i&&t.set("useragent",i),s&&t.set("countryCode",s),await e()};function n$(t,e,n,r){try{const i=`${t}:${e}:${JSON.stringify(n)}`;return r?`${r}:${i}`:i}catch{const s=`${t}:${e}:${Date.now()}-${Math.random()}`;return r?`${r}:${s}`:s}}function Sl(t,e){const{cache:n,defaultTtl:r,customTtls:i={},excludeMethods:s=[],cacheEntities:a=[],keyPrefix:l}=e,u=new Set(s),d=a.length===0,p=new Set(a),h={};for(const[g,A]of Object.entries(t)){const $=d||p.has(g),I={};for(const[R,D]of Object.entries(A))if(typeof D=="function"){if(!$){I[R]=D;continue}const x=`${g}:${R}`;if(u.has(x)){I[R]=D;continue}const M=i[x]??r,G=["create","update","remove","delete","set","used"].includes(R);I[R]=async(...F)=>{if(G)return await D.apply(A,F);const H=n$(g,R,F,l),W=await n.get(H);if(W!==null)if(W&&typeof W=="object"&&"isCachedNull"in W){const ue=W;return ue.isCachedNull?null:ue.value}else return W;const Y=await D.apply(A,F);if(M>=0)if(Y!==null)await n.set(H,Y,M);else{const ue={value:null,isCachedNull:!0};await n.set(H,ue,M)}return Y}}else I[R]=D;h[g]=I}return h}class r${constructor(e={}){be(this,"cache",new Map);be(this,"accessOrder",new Map);be(this,"accessCounter",0);be(this,"cleanupTimer");this.config=e;const n=e.cleanupIntervalMs;n&&n>0&&(this.cleanupTimer=setInterval(()=>{this.cleanupExpired()},n))}async get(e){const n=this.cache.get(e);return n?n.expiresAt&&n.expiresAt<new Date?(this.cache.delete(e),this.accessOrder.delete(e),null):(this.accessOrder.set(e,++this.accessCounter),n.value):null}async set(e,n,r){let i;const s=r??this.config.defaultTtlSeconds,a=s!==void 0,l=a?Math.max(0,s):0;a&&(i=new Date(Date.now()+(l>0?l*1e3:-1))),this.config.maxEntries&&this.cache.size>=this.config.maxEntries&&!this.cache.has(e)&&this.evictLeastRecentlyUsed();const u={value:n,expiresAt:i};this.cache.set(e,u),this.accessOrder.set(e,++this.accessCounter)}async delete(e){const n=this.cache.has(e);return this.cache.delete(e),this.accessOrder.delete(e),n}async clear(){this.cache.clear(),this.accessOrder.clear(),this.accessCounter=0}getStats(){return{size:this.cache.size,maxEntries:this.config.maxEntries,defaultTtlSeconds:this.config.defaultTtlSeconds}}cleanupExpired(){const e=new Date,n=[];for(const[r,i]of this.cache.entries())i.expiresAt&&i.expiresAt<e&&n.push(r);for(const r of n)this.cache.delete(r),this.accessOrder.delete(r)}evictLeastRecentlyUsed(){let e=null,n=1/0;for(const[r,i]of this.accessOrder.entries())i<n&&(n=i,e=r);e&&(this.cache.delete(e),this.accessOrder.delete(e))}destroy(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0)}}function Ao(t={}){return new r$(t)}const i$=gn.extend({forms:o.z.array(yi)}),s$=new o.OpenAPIHono().openapi(o.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(yi),i$])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.forms)}).openapi(o.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yi}},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 N(404);return t.json(r)}).openapi(o.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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 N(404,{message:"Form not found"});return t.text("OK")}).openapi(o.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(Aa.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:yi}},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 N(404,{message:"Form not found"});const s=await t.env.data.forms.get(e,n);if(!s)throw new N(404,{message:"Form not found"});return t.json(s)}).openapi(o.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(Aa.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:yi}},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})}),o$=gn.extend({roles:o.z.array(Rr)}),a$=new o.OpenAPIHono().openapi(o.createRoute({tags:["roles"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Rr),o$])}},description:"List of roles"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:s}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.roles.list(a,{page:e,per_page:n,include_totals:r,sort:dn(i),q:s});return r?t.json(l):t.json(l.roles)}).openapi(o.createRoute({tags:["roles"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"A role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.roles.get(n,e);if(!r)throw new N(404);return t.json(r)}).openapi(o.createRoute({tags:["roles"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:ka}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Rr}},description:"Role created"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.roles.create(e,n);return t.json(r,{status:201})}).openapi(o.createRoute({tags:["roles"],method:"patch",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:ka.partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"Updated role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json");if(!await t.env.data.roles.update(n,e,r))throw new N(404);const s=await t.env.data.roles.get(n,e);return t.json(s)}).openapi(o.createRoute({tags:["roles"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.roles.remove(n,e))throw new N(404);return t.text("OK")}).openapi(o.createRoute({tags:["roles"],method:"get",path:"/{id}/permissions",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o_}},description:"Role permissions"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{page:r,per_page:i,sort:s,q:a}=t.req.valid("query");if(!await t.env.data.roles.get(n,e))throw new N(404,{message:"Role not found"});const u=await t.env.data.rolePermissions.list(n,e,{page:r,per_page:i,include_totals:!1,sort:dn(s),q:a});return t.json(u)}).openapi(o.createRoute({tags:["roles"],method:"post",path:"/{id}/permissions",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({permissions:o.z.array(o.z.object({permission_name:o.z.string(),resource_server_identifier:o.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Permissions assigned to role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new N(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.assign(n,e,r.map(a=>({role_id:e,resource_server_identifier:a.resource_server_identifier,permission_name:a.permission_name}))))throw new N(500,{message:"Failed to assign permissions to role"});return t.json({message:"Permissions assigned successfully"},{status:201})}).openapi(o.createRoute({tags:["roles"],method:"delete",path:"/{id}/permissions",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({permissions:o.z.array(o.z.object({permission_name:o.z.string(),resource_server_identifier:o.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Permissions removed from role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new N(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.remove(n,e,r))throw new N(500,{message:"Failed to remove permissions from role"});return t.json({message:"Permissions removed successfully"})}),c$=gn.extend({resource_servers:o.z.array(Dr)}),l$=new o.OpenAPIHono().openapi(o.createRoute({tags:["resource-servers"],method:"get",path:"/",request:{query:Lt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Dr),c$])}},description:"List of resource servers"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:s,q:a}=t.req.valid("query"),l=await t.env.data.resourceServers.list(e,{page:n,per_page:r,include_totals:i,sort:dn(s),q:a});return i?t.json(l):t.json(l.resource_servers)}).openapi(o.createRoute({tags:["resource-servers"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.resourceServers.get(e,n);if(!r)throw new N(404);return t.json(r)}).openapi(o.createRoute({tags:["resource-servers"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.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.resourceServers.remove(e,n))throw new N(404,{message:"Resource server not found"});return t.text("OK")}).openapi(o.createRoute({tags:["resource-servers"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(Sa.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"The updated resource server"}}}),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.resourceServers.update(e,n,r))throw new N(404,{message:"Resource server not found"});const s=await t.env.data.resourceServers.get(e,n);if(!s)throw new N(404,{message:"Resource server not found"});return t.json(s)}).openapi(o.createRoute({tags:["resource-servers"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(Sa.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Dr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.resourceServers.create(e,n);return t.json(r,{status:201})});function u$(t){const e=new o.OpenAPIHono;e.use(wm({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})),gf(e),e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=Sl(s,{defaultTtl:0,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,l),i()}),e.use(El).use(Al).use(mf(e));const n=e.route("/branding",lv).route("/custom-domains",Qx).route("/email/providers",Jx).route("/users",g3).route("/keys",fx).route("/users-by-email",hx).route("/clients",mx).route("/tenants",yx).route("/logs",vx).route("/hooks",xx).route("/connections",Ax).route("/prompts",Ex).route("/sessions",Yx).route("/refresh_tokens",Zx).route("/forms",s$).route("/roles",a$).route("/resource-servers",l$);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 d$(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}function wr(t){var e;if(t)return`${t.name}/${t.version}${(e=t.env)!=null&&e.node?` (env: node/${t.env.node})`:""}`}var Y0;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Y0||(Y0={}));var Z0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Z0||(Z0={}));function p$(t){return D1(t,f$,Hs.Include)}function z1(t){return D1(t,h$,Hs.None)}function D1(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let s=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)s=s<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[s>>a-6&63],a-=6):a>0?(r+=e[s<<6-a&63],a=0):n===Hs.Include&&(r+="=")}return r}const f$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Hs;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Hs||(Hs={}));var Q0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Q0||(Q0={}));class g${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 eg=new g$;function bn(t,e){return(t<<32-e|t>>>e)>>>0}function m$(t){const e=new _$;return e.update(t),e.digest()}class _${constructor(){be(this,"blockSize",64);be(this,"size",32);be(this,"blocks",new Uint8Array(64));be(this,"currentBlockSize",0);be(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));be(this,"l",0n);be(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),eg.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)eg.putUint32(e,this.H[n],n*4);return e}process(){for(let d=0;d<16;d++)this.w[d]=(this.blocks[d*4]<<24|this.blocks[d*4+1]<<16|this.blocks[d*4+2]<<8|this.blocks[d*4+3])>>>0;for(let d=16;d<64;d++){const p=(bn(this.w[d-2],17)^bn(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,h=(bn(this.w[d-15],7)^bn(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=p+this.w[d-7]+h+this.w[d-16]|0}let e=this.H[0],n=this.H[1],r=this.H[2],i=this.H[3],s=this.H[4],a=this.H[5],l=this.H[6],u=this.H[7];for(let d=0;d<64;d++){const p=(bn(s,6)^bn(s,11)^bn(s,25))>>>0,h=(s&a^~s&l)>>>0,g=u+p+h+y$[d]+this.w[d]|0,A=(bn(e,2)^bn(e,13)^bn(e,22))>>>0,$=(e&n^e&r^n&r)>>>0,I=A+$|0;u=l,l=a,a=s,s=i+g|0,i=r,r=n,n=e,e=g+I|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]=s+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=l+this.H[6]|0,this.H[7]=u+this.H[7]|0}}const y$=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 w${constructor(e){be(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 v$(t){const e=m$(new TextEncoder().encode(t));return z1(e)}function b$(){const t=new Uint8Array(32);return crypto.getRandomValues(t),z1(t)}function ks(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 eu(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return p$(n)}async function lc(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);let r;try{r=R1(n)}catch{throw new ki(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);return new w$(n)}throw e.body!==null&&await e.body.cancel(),new oa(e.status)}async function x$(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new ki(e.status,null)}if(typeof n!="object"||n===null)throw new ki(e.status,n);let r;try{r=R1(n)}catch{throw new ki(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 oa(e.status)}function R1(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 $$(e,n,r,i)}class P1 extends Error{constructor(e){super("Failed to send request",{cause:e})}}class $$ extends Error{constructor(n,r,i,s){super(`OAuth request error: ${n}`);be(this,"code");be(this,"description");be(this,"uri");be(this,"state");this.code=n,this.description=r,this.uri=i,this.state=s}}class oa extends Error{constructor(n){super("Unexpected error response");be(this,"status");this.status=n}}class ki extends Error{constructor(n,r){super("Unexpected error response body");be(this,"status");be(this,"data");this.status=n,this.data=r}}class yf{constructor(e,n,r){be(this,"clientId");be(this,"clientPassword");be(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,s){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===Ks.S256){const l=v$(i);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",l)}else r===Ks.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",i));return s.length>0&&a.searchParams.set("scope",s.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 s=ks(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${l}`)}return await lc(s)}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 s=ks(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${l}`)}return await lc(s)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=ks(e,r);if(this.clientPassword!==null){const s=eu(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${s}`)}await x$(i)}}var Ks;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(Ks||(Ks={}));var tg;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(tg||(tg={}));var ng;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(ng||(ng={}));function Ns(t){return A$(t,E$,uc.None)}function A$(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let s=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)s=s<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[s>>a-6&63],a-=6):a>0?(r+=e[s<<6-a&63],a=0):n===uc.Include&&(r+="=")}return r}const E$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var uc;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(uc||(uc={}));var rg;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(rg||(rg={}));function S$(t,e,n){const r=Ns(new TextEncoder().encode(t)),i=Ns(new TextEncoder().encode(e)),s=Ns(n);return r+"."+i+"."+s}function k$(t,e){const n=Ns(new TextEncoder().encode(t)),r=Ns(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const N$="https://appleid.apple.com/auth/authorize",C$="https://appleid.apple.com/auth/token";class B1{constructor(e,n,r,i,s){be(this,"clientId");be(this,"teamId");be(this,"keyId");be(this,"pkcs8PrivateKey");be(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=s}createAuthorizationURL(e,n){const r=new URL(N$);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=ks(C$,n);return await lc(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}),s=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,k$(r,i)));return S$(r,i,s)}}const T$="https://www.facebook.com/v16.0/dialog/oauth",I$="https://graph.facebook.com/v16.0/oauth/access_token";class j1{constructor(e,n,r){be(this,"clientId");be(this,"clientSecret");be(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(T$);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=ks(I$,n);return await lc(r)}}const O$="https://accounts.google.com/o/oauth2/v2/auth",ig="https://oauth2.googleapis.com/token",z$="https://oauth2.googleapis.com/revoke";let L1=class{constructor(e,n,r){be(this,"client");this.client=new yf(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(O$,e,Ks.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(ig,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(ig,e,[])}async revokeToken(e){await this.client.revokeToken(z$,e)}};const kl=o.z.object({iss:o.z.string().url(),sub:o.z.string(),aud:o.z.string(),exp:o.z.number(),email:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),name:o.z.string().optional(),iat:o.z.number(),auth_time:o.z.number().optional(),nonce:o.z.string().optional(),acr:o.z.string().optional(),amr:o.z.array(o.z.string()).optional(),azp:o.z.string().optional(),at_hash:o.z.string().optional(),c_hash:o.z.string().optional()}).passthrough();kl.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function F1(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 D$(t,e){var d,p;const{options:n,keyArray:r}=F1(e),i=`${st(t.env)}callback`,s=new B1(n.client_id,n.team_id,n.kid,r,i),a=qe(),l=await s.createAuthorizationURL(a,((d=n.scope)==null?void 0:d.split(" "))||["name","email"]);return(((p=n.scope)==null?void 0:p.split(" "))||["name","email"]).some(h=>["email","name"].includes(h))&&l.searchParams.set("response_mode","form_post"),{redirectUrl:l.href,code:a}}async function R$(t,e,n){const{options:r,keyArray:i}=F1(e),a=await new B1(r.client_id,r.team_id,r.kid,i,`${st(t.env)}callback`).validateAuthorizationCode(n),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const P$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:D$,validateAuthorizationCodeAndGetUser:R$},Symbol.toStringTag,{value:"Module"}));async function B$(t,e){var l;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=`${st(t.env)}callback`,i=new j1(n.client_id,n.client_secret,r),s=qe();return{redirectUrl:i.createAuthorizationURL(s,((l=n.scope)==null?void 0:l.split(" "))||["email"]).href,code:s}}async function j$(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const s=await new j1(r.client_id,r.client_secret,`${st(t.env)}callback`).validateAuthorizationCode(n),a=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${s.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const l=await a.json();return t.set("log",`Userinfo: ${JSON.stringify(l)}`),{sub:l.id,email:l.email,name:l.name}}const L$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:B$,validateAuthorizationCodeAndGetUser:j$},Symbol.toStringTag,{value:"Module"}));async function F$(t,e){var u;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=`${st(t.env)}callback`,i=new L1(n.client_id,n.client_secret,r),s=qe(),a=b$();return{redirectUrl:i.createAuthorizationURL(s,a,((u=n.scope)==null?void 0:u.split(" "))??["email","profile"]).href,code:s,codeVerifier:a}}async function U$(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 L1(i.client_id,i.client_secret,`${st(t.env)}callback`).validateAuthorizationCode(n,r),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const M$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:F$,validateAuthorizationCodeAndGetUser:U$},Symbol.toStringTag,{value:"Module"}));async function q$(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 yf(n.client_id,n.client_secret,`${st(t.env)}callback`),i=qe(),s=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 s.searchParams.set("response_type","code"),s.searchParams.set("response_mode","query"),{redirectUrl:s.href,code:i}}async function V$(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const s=await new yf(r.client_id,r.client_secret,`${st(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),a=yp(s.idToken());if(!a)throw new Error("Invalid ID token");const l=kl.parse(a.payload);if(typeof l.msn!="string")throw new Error("msn not available in id token");const u=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${s.accessToken()}`,"Merchant-Serial-Number":l.msn}});if(!u.ok)throw new N(400,{message:"Failed to get user from vipps"});return await u.json()}const H$=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:q$,validateAuthorizationCodeAndGetUser:V$},Symbol.toStringTag,{value:"Module"}));function U1(t,e){const n=t.env.STRATEGIES||{},i={apple:P$,facebook:L$,"google-oauth2":M$,vipps:H$,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function os(t,e){const n=await t.data.clients.get(e);if(!n)throw new N(403,{message:"Client not found"});let r=n;if(t.DEFAULT_CLIENT_ID||t.DEFAULT_TENANT_ID){const i=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,s=await t.data.connections.list(n.tenant.id),a=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},l=s.connections.map(u=>{var h;const d=(h=a.connections)==null?void 0:h.find(g=>g.name===u.name);if(!(d!=null&&d.options))return u;const p=rn.parse({...d||{},...u});return p.options=$i.passthrough().parse({...d.options||{},...u.options}),p}).filter(u=>u);r={...n,web_origins:[...(i==null?void 0:i.web_origins)||[],...n.web_origins||[]],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...n.allowed_logout_urls||[]],callbacks:[...(i==null?void 0:i.callbacks)||[],...n.callbacks||[]],connections:l,tenant:{...(i==null?void 0:i.tenant)||{},...n.tenant}}}return{...r,web_origins:[...r.web_origins||[],`${kt(t)}login`],allowed_logout_urls:[...r.allowed_logout_urls||[],t.ISSUER],callbacks:[...r.callbacks||[],`${kt(t)}info`]}}async function sg(t,e,n,r){if(!r.state)throw new N(400,{message:"State not found"});const i=e.connections.find(u=>u.name===n);if(!i){t.set("client_id",e.id);const u=Ue(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,u),new N(403,{message:"Connection Not Found"})}let s=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!s){const u=t.get("ip"),d=t.get("useragent"),p=t.get("auth0_client");s=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:r,csrf_token:qe(),ip:u,useragent:d,auth0Client:wr(p)})}const l=await U1(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:s.id,code_id:l.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:l.codeVerifier,expires_at:new Date(Date.now()+Iv*1e3).toISOString()}),new Response(null,{status:302,headers:{location:l.redirectUrl}})}async function og(t,{code:e,state:n}){var $;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new N(403,{message:"State not found"});const s=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!s)throw new N(403,{message:"Session not found"});if(s.authorization_url){const I=new URL(s.authorization_url).hostname,R=t.var.host||"";if(I!==R&&I){const D=new URL(`https://${I}/callback`);return D.searchParams.set("state",n),D.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:D.toString()}})}}const a=await os(r,s.authParams.client_id);t.set("client_id",a.id),t.set("tenant_id",a.tenant.id);const l=a.connections.find(I=>I.id===i.connection_id);if(!l){const I=Ue(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(a.tenant.id,I),new N(403,{message:"Connection not found"})}if(t.set("connection",l.name),!s.authParams.redirect_uri){const I=Ue(t,{type:Le.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(a.tenant.id,I),new N(403,{message:"Redirect URI not defined"})}const d=await U1(t,l.strategy).validateAuthorizationCodeAndGetUser(t,l,e,i.code_verifier),{sub:p,...h}=d;t.set("user_id",p);const g=(($=d.email)==null?void 0:$.toLocaleLowerCase())||`${l.name}.${p}@${new URL(t.env.ISSUER).hostname}`;t.set("username",g);const A=await Ic(t,{client:a,username:g,provider:l.strategy,connection:l.name,userId:p,profileData:h,isSocial:!0,ip:t.req.header("x-real-ip")});return Er(t,{client:a,authParams:s.authParams,loginSession:s,user:A})}async function ag(t,e,n,r,i,s){const a=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!a)throw new N(400,{message:"State not found"});const l=await t.env.data.loginSessions.get(t.var.tenant_id,a.login_id);if(!l)throw new N(400,{message:"Login not found"});const{redirect_uri:u}=l.authParams;if(!u)throw new N(400,{message:"Redirect uri not found"});const d=Ue(t,{type:Le.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});Bt(t,t.env.data.logs.create(t.var.tenant_id,d));const p=new URL(u);return d$(p,{error:n,error_description:r,error_reason:s,error_code:i,state:l.authParams.state}),t.redirect(`${kt(t.env)}login/identifier?state=${l.id}&error=${n}`)}const K$=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:s,error_reason:a}=t.req.valid("query");if(r)return ag(t,e,r,i,s,a);if(!n)throw new N(400,{message:"Code is required"});const l=await og(t,{code:n,state:e});if(!(l instanceof Response))throw new N(500,{message:"Internal server error"});return l}).openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:s,error_reason:a}=t.req.valid("form");if(r)return ag(t,e,r,i,s,a);if(!n)throw new N(400,{message:"Code is required"});const l=await og(t,{code:n,state:e});if(!(l instanceof Response))throw new N(500,{message:"Internal server error"});return l});function M1(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return G$(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function G$(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 W$=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),returnTo:o.z.string().optional()}),header:o.z.object({cookie:o.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 s=n||t.req.header("referer");if(!s)return t.text("OK");if(!M1(s,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new N(400,{message:"Invalid redirect uri"});const a=t.req.header("cookie");if(a){const u=Is(r.tenant.id,a);if(u){const d=await t.env.data.sessions.get(r.tenant.id,u);if(d){const p=await t.env.data.users.get(r.tenant.id,d.user_id);p&&(t.set("user_id",p.user_id),t.set("connection",p.connection));const h=await t.env.data.refreshTokens.list(r.tenant.id,{q:`session_id=${u}`,page:0,per_page:100,include_totals:!1});await Promise.all(h.refresh_tokens.map(g=>t.env.data.refreshTokens.remove(r.tenant.id,g.id))),await t.env.data.sessions.update(r.tenant.id,u,{revoked_at:new Date().toISOString()})}}}const l=Ue(t,{type:Le.SUCCESS_LOGOUT,description:"User successfully logged out"});return await t.env.data.logs.create(r.tenant.id,l),new Response("Redirecting",{status:302,headers:{"set-cookie":Pv(r.tenant.id,t.req.header("host")),location:s}})}),cg=o.z.object({sub:o.z.string(),email:o.z.string().optional(),family_name:o.z.string().optional(),given_name:o.z.string().optional(),email_verified:o.z.boolean()}),X$=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:cg}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new N(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 N(404,{message:"User not found"});return t.json(cg.parse({...e,sub:e.user_id}))}),J$=new o.OpenAPIHono().openapi(o.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:qm}},description:"List of tenants"}}}),async t=>{const e=await Gd(t.env.data);return t.json({keys:e},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Lo}, stale-while-revalidate=${Lo*2}, stale-if-error=86400`}})}).openapi(o.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:vu}},description:"List of tenants"}}}),async t=>{const e=vu.parse({issuer:_f(t.env),authorization_endpoint:`${st(t.env)}authorize`,token_endpoint:`${st(t.env)}oauth/token`,device_authorization_endpoint:`${st(t.env)}oauth/device/code`,userinfo_endpoint:`${st(t.env)}userinfo`,mfa_challenge_endpoint:`${st(t.env)}mfa/challenge`,jwks_uri:`${st(t.env)}.well-known/jwks.json`,registration_endpoint:`${st(t.env)}oidc/register`,revocation_endpoint:`${st(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=${Lo}, stale-while-revalidate=${Lo*2}, stale-if-error=86400`}})});function aa(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 q1=o.z.object({grant_type:o.z.literal("client_credentials"),scope:o.z.string().optional(),client_secret:o.z.string(),client_id:o.z.string(),audience:o.z.string().optional()});async function Y$(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new N(403,{message:"Invalid client credentials"});if(n.client_secret&&!aa(n.client_secret,e.client_secret))throw new N(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience};return{client:n,authParams:r}}const Z$=o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string().optional(),client_secret:o.z.string().optional(),code_verifier:o.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 Q$(t,e){var l;const n=await t.env.data.clients.get(e.client_id);if(!n)throw new N(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 N(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new N(403,{message:"Code expired"});if(r.used_at)throw new N(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new N(403,{message:"Invalid login"});if("client_secret"in e){const u=await t.env.data.clients.get("DEFAULT_CLIENT");if(!aa(n.client_secret,e.client_secret)&&!aa(u==null?void 0:u.client_secret,e.client_secret))throw new N(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const u=await Nv(e.code_verifier,r.code_challenge_method);if(!aa(u,r.code_challenge))throw new N(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new N(403,{message:"Invalid redirect uri"});const s=await t.env.data.users.get(n.tenant.id,r.user_id);if(!s)throw new N(403,{message:"User not found"});await t.env.data.codes.used(n.tenant.id,e.code);let a;return i.session_id&&((l=i.authParams.scope)!=null&&l.split(" ").includes("offline_access"))&&(a=await C_(t,{user:s,client:n,session_id:i.session_id,scope:i.authParams.scope,audience:i.authParams.audience})),{user:s,client:n,loginSession:i,session_id:i.session_id,refresh_token:a==null?void 0:a.id,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:En.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}}}const e5=o.z.object({grant_type:o.z.literal("refresh_token"),client_id:o.z.string(),redirect_uri:o.z.string().optional(),refresh_token:o.z.string()});async function t5(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new N(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 N(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new N(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 N(403,{message:"User not found"});const s=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{user:i,client:n,refresh_token:r.id,session_id:r.session_id,authParams:{client_id:n.id,audience:s==null?void 0:s.audience,scope:s==null?void 0:s.scopes,response_mode:En.WEB_MESSAGE}}}const n5={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 r5(t,e){var n=Array.prototype.slice.call(e);return n.push(n5),t.apply(this,n)}function lg(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var s=Number(n[i]),a=Number(r[i]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!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 i5={}.constructor;function Ni(t){return t!=null&&t.constructor===i5}function Wd(t){"@babel/helpers - typeof";return Wd=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},Wd(t)}function Nl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s5(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 Cl(t,e,n){return e&&s5(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var o5="1.2.0",a5="1.7.35",ug=" ext. ",c5=/^\d+$/,wt=function(){function t(e){Nl(this,t),V1(e),this.metadata=e,H1.call(this,e)}return Cl(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&&c5.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new dg(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new dg(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 s=this.countryCallingCodes()[n];if(s&&s.length===1&&s[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}(),dg=function(){function t(e,n){Nl(this,t),this.globalMetadataObject=n,this.metadata=e,H1.call(this,n.metadata)}return Cl(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 l5(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()&&pg(this.types(),n))return new d5(pg(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?ug:this.metadata[13]||ug}}]),t}(),l5=function(){function t(e,n){Nl(this,t),this._format=e,this.metadata=n}return Cl(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()&&!u5.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),u5=/^\(?\$1\)?$/,d5=function(){function t(e,n){Nl(this,t),this.type=e,this.metadata=n}return Cl(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 pg(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 V1(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Ni(t)||!Ni(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(Ni(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+p5(t)+": "+t,"."))}var p5=function(e){return Wd(e)};function wf(t,e){if(e=new wt(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function f5(t,e){return e.countries.hasOwnProperty(t)}function H1(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?lg(e,o5)===-1?this.v2=!0:lg(e,a5)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function vf(t,e){return h5(t,void 0,e)}function h5(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var s=t.length,a=i[0];return a===s?"IS_POSSIBLE":a>s?"TOO_SHORT":i[i.length-1]<s?"TOO_LONG":i.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function g5(t,e,n){if(e===void 0&&(e={}),n=new wt(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 K1(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 K1(t,e){switch(vf(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Kn(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function m5(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=_5(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.
193
193
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _5(t,e){if(t){if(typeof t=="string")return fg(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 fg(t,e)}}function fg(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 y5=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function bf(t,e,n){if(e=e||{},!(!t.country&&!t.countryCallingCode)){n=new wt(n),n.selectNumberingPlan(t.country,t.countryCallingCode);var r=e.v2?t.nationalNumber:t.phone;if(Kn(r,n.nationalNumberPattern())){if(tu(r,"FIXED_LINE",n))return n.type("MOBILE")&&n.type("MOBILE").pattern()===""||!n.type("MOBILE")||tu(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var i=m5(y5),s;!(s=i()).done;){var a=s.value;if(tu(r,a,n))return a}}}}function tu(t,e,n){return e=n.type(e),!e||!e.pattern()||e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0?!1:Kn(t,e.pattern())}function w5(t,e,n){if(e=e||{},n=new wt(n),n.selectNumberingPlan(t.country,t.countryCallingCode),n.hasTypes())return bf(t,e,n.metadata)!==void 0;var r=e.v2?t.nationalNumber:t.phone;return Kn(r,n.nationalNumberPattern())}function v5(t,e,n){var r=new wt(n),i=r.getCountryCodesForCallingCode(t);return i?i.filter(function(s){return b5(e,s,n)}):[]}function b5(t,e,n){var r=new wt(n);return r.selectNumberingPlan(e),r.numberingPlan.possibleLengths().indexOf(t.length)>=0}var xf=2,x5=17,$5=3,pn="0-90-9٠-٩۰-۹",A5="-‐-―−ー-",E5="//",S5="..",k5="  ­​⁠ ",N5="()()[]\\[\\]",C5="~⁓∼~",dc="".concat(A5).concat(E5).concat(S5).concat(k5).concat(N5).concat(C5),$f="++",T5=new RegExp("(["+pn+"])");function I5(t,e,n,r){if(e){var i=new wt(r);i.selectNumberingPlan(e,n);var s=new RegExp(i.IDDPrefix());if(t.search(s)===0){t=t.slice(t.match(s)[0].length);var a=t.match(T5);if(!(a&&a[1]!=null&&a[1].length>0&&a[1]==="0"))return t}}}function O5(t,e){if(t&&e.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+e.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(t);if(r){var i,s,a=r.length-1,l=a>0&&r[a];if(e.nationalPrefixTransformRule()&&l)i=t.replace(n,e.nationalPrefixTransformRule()),a>1&&(s=r[1]);else{var u=r[0];i=t.slice(u.length),l&&(s=r[1])}var d;if(l){var p=t.indexOf(r[1]),h=t.slice(0,p);h===e.numberingPlan.nationalPrefix()&&(d=e.numberingPlan.nationalPrefix())}else d=r[0];return{nationalNumber:i,nationalPrefix:d,carrierCode:s}}}return{nationalNumber:t}}function Xd(t,e){var n=O5(t,e),r=n.carrierCode,i=n.nationalNumber;if(i!==t){if(!z5(t,i,e))return{nationalNumber:t};if(e.possibleLengths()&&!D5(i,e))return{nationalNumber:t}}return{nationalNumber:i,carrierCode:r}}function z5(t,e,n){return!(Kn(t,n.nationalNumberPattern())&&!Kn(e,n.nationalNumberPattern()))}function D5(t,e){switch(vf(t,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function R5(t,e,n,r){var i=e?wf(e,r):n;if(t.indexOf(i)===0){r=new wt(r),r.selectNumberingPlan(e,n);var s=t.slice(i.length),a=Xd(s,r),l=a.nationalNumber,u=Xd(t,r),d=u.nationalNumber;if(!Kn(d,r.nationalNumberPattern())&&Kn(l,r.nationalNumberPattern())||vf(d,r)==="TOO_LONG")return{countryCallingCode:i,number:s}}return{number:t}}function G1(t,e,n,r){if(!t)return{};var i;if(t[0]!=="+"){var s=I5(t,e,n,r);if(s&&s!==t)i=!0,t="+"+s;else{if(e||n){var a=R5(t,e,n,r),l=a.countryCallingCode,u=a.number;if(l)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:l,number:u}}return{number:t}}}if(t[1]==="0")return{};r=new wt(r);for(var d=2;d-1<=$5&&d<=t.length;){var p=t.slice(1,d);if(r.hasCallingCode(p))return r.selectNumberingPlan(p),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:p,number:t.slice(d)};d++}return{}}function P5(t){return t.replace(new RegExp("[".concat(dc,"]+"),"g")," ").trim()}var B5=/(\$\d)/;function j5(t,e,n){var r=n.useInternationalFormat,i=n.withNationalPrefix,s=t.replace(new RegExp(e.pattern()),r?e.internationalFormat():i&&e.nationalPrefixFormattingRule()?e.format().replace(B5,e.nationalPrefixFormattingRule()):e.format());return r?P5(s):s}var L5=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function F5(t,e,n){var r=new wt(n);if(r.selectNumberingPlan(t,e),r.defaultIDDPrefix())return r.defaultIDDPrefix();if(L5.test(r.IDDPrefix()))return r.IDDPrefix()}var U5=";ext=",ui=function(e){return"([".concat(pn,"]{1,").concat(e,"})")};function W1(t){var e="20",n="15",r="9",i="6",s="[  \\t,]*",a="[:\\..]?[  \\t,-]*",l="#?",u="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",d="(?:[xx##~~]|int|int)",p="[- ]+",h="[  \\t]*",g="(?:,{2}|;)",A=U5+ui(e),$=s+u+a+ui(e)+l,I=s+d+a+ui(r)+l,R=p+ui(i)+"#",D=h+g+a+ui(n)+l,x=h+"(?:,)+"+a+ui(r)+l;return A+"|"+$+"|"+I+"|"+R+"|"+D+"|"+x}var M5="["+pn+"]{"+xf+"}",q5="["+$f+"]{0,1}(?:["+dc+"]*["+pn+"]){3,}["+dc+pn+"]*",V5=new RegExp("^["+$f+"]{0,1}(?:["+dc+"]*["+pn+"]){1,2}$","i"),H5=q5+"(?:"+W1()+")?",K5=new RegExp("^"+M5+"$|^"+H5+"$","i");function G5(t){return t.length>=xf&&K5.test(t)}function W5(t){return V5.test(t)}function X5(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 J5(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=Y5(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.
194
194
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y5(t,e){if(t){if(typeof t=="string")return hg(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 hg(t,e)}}function hg(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 gg(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 mg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gg(Object(n),!0).forEach(function(r){Z5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Z5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _g={formatExtension:function(e,n,r){return"".concat(e).concat(r.ext()).concat(n)}};function Q5(t,e,n,r){if(n?n=mg(mg({},_g),n):n=_g,r=new wt(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(),s=n.v2?t.nationalNumber:t.phone,a;switch(e){case"NATIONAL":return s?(a=pc(s,t.carrierCode,"NATIONAL",r,n),nu(a,t.ext,r,n.formatExtension)):"";case"INTERNATIONAL":return s?(a=pc(s,null,"INTERNATIONAL",r,n),a="+".concat(i," ").concat(a),nu(a,t.ext,r,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(s);case"RFC3966":return X5({number:"+".concat(i).concat(s),ext:t.ext});case"IDD":if(!n.fromCountry)return;var l=tA(s,t.carrierCode,i,n.fromCountry,r);return nu(l,t.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(e,'"'))}}function pc(t,e,n,r,i){var s=eA(r.formats(),t);return s?j5(t,s,{useInternationalFormat:n==="INTERNATIONAL",withNationalPrefix:!(s.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&i&&i.nationalPrefix===!1),carrierCode:e,metadata:r}):t}function eA(t,e){for(var n=J5(t),r;!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var s=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(e.search(s)!==0)continue}if(Kn(e,i.pattern()))return i}}function nu(t,e,n,r){return e?r(t,e,n):t}function tA(t,e,n,r,i){var s=wf(r,i.metadata);if(s===n){var a=pc(t,e,"NATIONAL",i);return n==="1"?n+" "+a:a}var l=F5(r,void 0,i.metadata);if(l)return"".concat(l," ").concat(n," ").concat(pc(t,null,"INTERNATIONAL",i))}function yg(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 wg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yg(Object(n),!0).forEach(function(r){nA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rA(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iA(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 sA(t,e,n){return e&&iA(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var oA=function(){function t(e,n,r){if(rA(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(Ni(n)&&Ni(n.countries)){r=n;var i=e;if(!lA.test(i))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var s=G1(i,void 0,void 0,r),a=s.countryCallingCode,l=s.number;if(n=l,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");V1(r);var u=cA(e,r),d=u.country,p=u.countryCallingCode;this.country=d,this.countryCallingCode=p,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return sA(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:v5(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return g5(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return w5(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new wt(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 bf(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,r){return Q5(this,n,r?wg(wg({},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}(),aA=function(e){return/^[A-Z]{2}$/.test(e)};function cA(t,e){var n,r,i=new wt(e);return aA(t)?(n=t,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=t,{country:n,countryCallingCode:r}}var lA=/^\+\d+$/;function Jd(t){"@babel/helpers - typeof";return Jd=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},Jd(t)}function uA(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}function dA(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pA(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&&Gs(t,e)}function fA(t){var e=J1();return function(){var r=Ws(t),i;if(e){var s=Ws(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return hA(this,i)}}function hA(t,e){if(e&&(Jd(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return X1(t)}function X1(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yd(t){var e=typeof Map=="function"?new Map:void 0;return Yd=function(r){if(r===null||!gA(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 ca(r,arguments,Ws(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Gs(i,r)},Yd(t)}function ca(t,e,n){return J1()?ca=Reflect.construct:ca=function(i,s,a){var l=[null];l.push.apply(l,s);var u=Function.bind.apply(i,l),d=new u;return a&&Gs(d,a.prototype),d},ca.apply(null,arguments)}function J1(){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 gA(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Gs(t,e){return Gs=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Gs(t,e)}function Ws(t){return Ws=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Ws(t)}var Pn=function(t){pA(n,t);var e=fA(n);function n(r){var i;return dA(this,n),i=e.call(this,r),Object.setPrototypeOf(X1(i),n.prototype),i.name=i.constructor.name,i}return uA(n)}(Yd(Error)),vg=new RegExp("(?:"+W1()+")$","i");function mA(t){var e=t.search(vg);if(e<0)return{};for(var n=t.slice(0,e),r=t.match(vg),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}var _A={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 yA(t){return _A[t]}function wA(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=vA(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.
195
195
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vA(t,e){if(t){if(typeof t=="string")return bg(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 bg(t,e)}}function bg(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 xg(t){for(var e="",n=wA(t.split("")),r;!(r=n()).done;){var i=r.value;e+=bA(i,e)||""}return e}function bA(t,e,n){return t==="+"?e?void 0:"+":yA(t)}function xA(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=$A(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.
196
196
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $A(t,e){if(t){if(typeof t=="string")return $g(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 $g(t,e)}}function $g(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 AA(t,e){var n=e.countries,r=e.metadata;r=new wt(r);for(var i=xA(n),s;!(s=i()).done;){var a=s.value;if(r.country(a),r.leadingDigits()){if(t&&t.search(r.leadingDigits())===0)return a}else if(bf({phone:t,country:a},void 0,r.metadata))return a}}function EA(t,e){var n=e.nationalNumber,r=e.defaultCountry,i=e.metadata,s=i.getCountryCodesForCallingCode(t);if(s)return s.length===1?s[0]:AA(n,{countries:s,defaultCountry:r,metadata:i.metadata})}var Y1="+",SA="[\\-\\.\\(\\)]?",Ag="(["+pn+"]|"+SA+")",kA="^\\"+Y1+Ag+"*["+pn+"]"+Ag+"*$",NA=new RegExp(kA,"g"),Zd=pn,CA="["+Zd+"]+((\\-)*["+Zd+"])*",TA="a-zA-Z",IA="["+TA+"]+((\\-)*["+Zd+"])*",OA="^("+CA+"\\.)*"+IA+"\\.?$",zA=new RegExp(OA,"g"),Eg="tel:",Qd=";phone-context=",DA=";isub=";function RA(t){var e=t.indexOf(Qd);if(e<0)return null;var n=e+Qd.length;if(n>=t.length)return"";var r=t.indexOf(";",n);return r>=0?t.substring(n,r):t.substring(n)}function PA(t){return t===null?!0:t.length===0?!1:NA.test(t)||zA.test(t)}function BA(t,e){var n=e.extractFormattedPhoneNumber,r=RA(t);if(!PA(r))throw new Pn("NOT_A_NUMBER");var i;if(r===null)i=n(t)||"";else{i="",r.charAt(0)===Y1&&(i+=r);var s=t.indexOf(Eg),a;s>=0?a=s+Eg.length:a=0;var l=t.indexOf(Qd);i+=t.substring(a,l)}var u=i.indexOf(DA);if(u>0&&(i=i.substring(0,u)),i!=="")return i}var jA=250,LA=new RegExp("["+$f+pn+"]"),FA=new RegExp("[^"+pn+"#]+$");function UA(t,e,n){if(e=e||{},n=new wt(n),e.defaultCountry&&!n.hasCountry(e.defaultCountry))throw e.v2?new Pn("INVALID_COUNTRY"):new Error("Unknown country: ".concat(e.defaultCountry));var r=qA(t,e.v2,e.extract),i=r.number,s=r.ext,a=r.error;if(!i){if(e.v2)throw a==="TOO_SHORT"?new Pn("TOO_SHORT"):new Pn("NOT_A_NUMBER");return{}}var l=HA(i,e.defaultCountry,e.defaultCallingCode,n),u=l.country,d=l.nationalNumber,p=l.countryCallingCode,h=l.countryCallingCodeSource,g=l.carrierCode;if(!n.hasSelectedNumberingPlan()){if(e.v2)throw new Pn("INVALID_COUNTRY");return{}}if(!d||d.length<xf){if(e.v2)throw new Pn("TOO_SHORT");return{}}if(d.length>x5){if(e.v2)throw new Pn("TOO_LONG");return{}}if(e.v2){var A=new oA(p,d,n.metadata);return u&&(A.country=u),g&&(A.carrierCode=g),s&&(A.ext=s),A.__countryCallingCodeSource=h,A}var $=(e.extended?n.hasSelectedNumberingPlan():u)?Kn(d,n.nationalNumberPattern()):!1;return e.extended?{country:u,countryCallingCode:p,carrierCode:g,valid:$,possible:$?!0:!!(e.extended===!0&&n.possibleLengths()&&K1(d,n)),phone:d,ext:s}:$?VA(u,d,s):{}}function MA(t,e,n){if(t){if(t.length>jA){if(n)throw new Pn("TOO_LONG");return}if(e===!1)return t;var r=t.search(LA);if(!(r<0))return t.slice(r).replace(FA,"")}}function qA(t,e,n){var r=BA(t,{extractFormattedPhoneNumber:function(a){return MA(a,n,e)}});if(!r)return{};if(!G5(r))return W5(r)?{error:"TOO_SHORT"}:{};var i=mA(r);return i.ext?i:{number:r}}function VA(t,e,n){var r={country:t,phone:e};return n&&(r.ext=n),r}function HA(t,e,n,r){var i=G1(xg(t),e,n,r.metadata),s=i.countryCallingCodeSource,a=i.countryCallingCode,l=i.number,u;if(a)r.selectNumberingPlan(a);else if(l&&(e||n))r.selectNumberingPlan(e,n),e&&(u=e),a=n||wf(e,r.metadata);else return{};if(!l)return{countryCallingCodeSource:s,countryCallingCode:a};var d=Xd(xg(l),r),p=d.nationalNumber,h=d.carrierCode,g=EA(a,{nationalNumber:p,defaultCountry:e,metadata:r});return g&&(u=g,g==="001"||r.country(u)),{country:u,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:p,carrierCode:h}}function Sg(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 kg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sg(Object(n),!0).forEach(function(r){KA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GA(t,e,n){return UA(t,kg(kg({},e),{},{v2:!0}),n)}function Ng(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 WA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ng(Object(n),!0).forEach(function(r){XA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ng(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function XA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JA(t,e){return eE(t)||QA(t,e)||ZA(t,e)||YA()}function YA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
197
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZA(t,e){if(t){if(typeof t=="string")return Cg(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 Cg(t,e)}}function Cg(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 QA(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,s=!1,a,l;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(u){s=!0,l=u}finally{try{!i&&n.return!=null&&n.return()}finally{if(s)throw l}}return r}}function eE(t){if(Array.isArray(t))return t}function tE(t){var e=Array.prototype.slice.call(t),n=JA(e,4),r=n[0],i=n[1],s=n[2],a=n[3],l,u,d;if(typeof r=="string")l=r;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")a?(u=s,d=a):(u=void 0,d=s),i&&(u=WA({defaultCountry:i},u));else if(Ni(i))s?(u=i,d=s):d=i;else throw new Error("Invalid second argument: ".concat(i));return{text:l,options:u,metadata:d}}function Tg(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 Ig(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tg(Object(n),!0).forEach(function(r){nE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nE(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rE(t,e,n){e&&e.defaultCountry&&!f5(e.defaultCountry,n)&&(e=Ig(Ig({},e),{},{defaultCountry:void 0}));try{return GA(t,e,n)}catch(r){if(!(r instanceof Pn))throw r}}function iE(){var t=tE(arguments),e=t.text,n=t.options,r=t.metadata;return rE(e,n,r)}function sE(){return r5(iE,arguments)}function Tl(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=sE(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}}function Af(t){let e=t.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1));const n=e.indexOf("%");return n!==-1&&(e=e.slice(0,n)),e}function oE(t){const n=Af(t).split(".");return n.length!==4?!1:n.every(r=>/^\d+$/.test(r)&&Number(r)>=0&&Number(r)<=255)}function aE(t){const e=Af(t);if(e.length<2||e.indexOf(":")===-1||!/^[0-9a-fA-F:.]+$/.test(e))return!1;const n=e.split(":");return e.includes("::")?n.length<=8:n.length===8}function cE(t){let e=t.trim();const n=/^\[([^\]]+)\](?::\d+)?$/,r=e.match(n);if(r&&r[1])return r[1];const i=e.lastIndexOf(":");if(i!==-1){const s=e.slice(0,i),a=e.slice(i+1);/^[0-9.]+$/.test(s)&&/^\d+$/.test(a)&&(e=s)}return e}function Og(t){if(!t)return null;const e=Af(cE(t));return oE(e)?{family:4,normalized:e}:aE(e)?{family:6,normalized:e.toLowerCase()}:null}function zg(t){if(t.includes("::")){let[e,n]=t.split("::"),r=e?e.split(":").filter(Boolean):[],i=n?n.split(":").filter(Boolean):[],s=8-(r.length+i.length);return[...r.map(a=>a.toLowerCase()||"0"),...Array(s).fill("0"),...i.map(a=>a.toLowerCase()||"0")]}else return t.split(":").map(e=>e.toLowerCase()||"0")}function lE(t,e,n=!0){const r=Og(t),i=Og(e);if(!r||!i||r.family!==i.family)return!1;if(r.family===4)return r.normalized===i.normalized;const s=zg(r.normalized),a=zg(i.normalized);return n?s.length===8&&a.length===8&&s.join(":")===a.join(":"):s.slice(0,4).join(":")===a.slice(0,4).join(":")}class as extends Error{constructor(n,r=302){super(`Redirect to ${n}`);be(this,"location");be(this,"status");this.name=as.name,this.location=n,this.status=r}}const uE=o.z.object({client_id:o.z.string(),username:o.z.string().transform(t=>t.toLowerCase()),otp:o.z.string(),authParams:Ts.optional(),enforceIpCheck:o.z.boolean().optional().default(!1)});async function Z1(t,{client_id:e,username:n,otp:r,authParams:i,enforceIpCheck:s=!1}){var I;const a=t.get("ip"),l=t.get("countryCode"),{connectionType:u,normalized:d}=Tl(n,l);if(!d)throw new N(400,{message:"Invalid username format"});const p=await t.env.data.clients.get(e);if(!p)throw new N(403,{message:"Client not found"});const{env:h}=t,g=await h.data.codes.get(p.tenant.id,r,"otp");if(!g)throw new N(400,{message:$e("code_invalid")});if(g.expires_at<new Date().toISOString())throw new N(400,{message:$e("code_expired")});if(g.used_at)throw new N(400,{message:$e("code_used")});const A=await h.data.loginSessions.get(p.tenant.id,g.login_id);if(!A||A.authParams.username!==n)throw new N(400,{message:"Code not found or expired"});if(s&&A.ip&&a&&!lE(A.ip,a))throw new as(`${kt(t.env)}invalid-session?state=${A.id}`);const $=await Ic(t,{client:p,username:d,provider:u,connection:u,isSocial:!1,ip:t.req.header("x-real-ip")});return await h.data.codes.used(p.tenant.id,r),((I=$.app_metadata)==null?void 0:I.strategy)!=="email"&&Bt(t,t.env.data.users.update(p.tenant.id,$.user_id,{app_metadata:{...$.app_metadata||{},strategy:"email"}})),{user:$,client:p,loginSession:A,session_id:A.session_id,authParams:{...A.authParams,...i||{}}}}async function Ef(t,e){const n=await Z1(t,e);return Er(t,{authParams:n.authParams,client:n.client,user:n.user,loginSession:n.loginSession})}const Dg=o.z.object({client_id:o.z.string().optional(),client_secret:o.z.string().optional()}),dE=o.z.union([q1.extend(Dg.shape),o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string(),code_verifier:o.z.string().min(43).max(128)}),o.z.object({grant_type:o.z.literal("authorization_code"),code:o.z.string(),redirect_uri:o.z.string().optional(),...Dg.shape}),o.z.object({grant_type:o.z.literal("refresh_token"),client_id:o.z.string(),refresh_token:o.z.string(),redirect_uri:o.z.string().optional()}),o.z.object({grant_type:o.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:o.z.string(),username:o.z.string(),otp:o.z.string(),realm:o.z.enum(["email","sms"])})]);function pE(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 fE=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:dE}}}},responses:{200:{content:{"application/json":{schema:gp}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:o.z.object({Location:o.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=pE(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new N(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case vi.AuthorizationCode:i=await Q$(t,Z$.parse(r));break;case vi.ClientCredential:i=await Y$(t,q1.parse(r));break;case vi.RefreshToken:i=await t5(t,e5.parse(r));break;case vi.OTP:i=await Z1(t,uE.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}const s=new Headers;if(i.session_id){const l=Na(i.client.tenant.id,i.session_id,t.var.host||"");s.set("Set-Cookie",l)}const a=await Tc(t,i);return t.json(a,{headers:s})});var Sf={exports:{}};const kf=[{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}],Q1=(t,e=kf,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 s={};s.contains=i.filter(l=>new RegExp(`${l.regex}`).test(r)).map(l=>l.message),s.length=r.length;let a=e.filter(l=>s.contains.length>=l.minDiversity).filter(l=>s.length>=l.minLength).sort((l,u)=>u.id-l.id).map(l=>({id:l.id,value:l.value}));return Object.assign(s,a[0]),s};Sf.exports={passwordStrength:Q1,defaultOptions:kf};var hE=Sf.exports.passwordStrength=Q1;Sf.exports.defaultOptions=kf;function Nf(t){return hE(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 Eo(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 N(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new N(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function ey(t,e){var a,l;if(!t.var.client_id)throw new N(500,{message:"Client not found"});const n=await os(t.env,t.var.client_id),r=n.connections.find(u=>u.strategy==="sms");if(!r)throw new N(500,{message:"SMS provider not found"});const i=((a=r.options)==null?void 0:a.provider)||"twilio",s=(l=t.env.smsProviders)==null?void 0:l[i];if(!s)throw new N(500,{message:"SMS provider not found"});await s({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 ty(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new N(500,{message:"Tenant not found"});const s=`${kt(t.env)}reset-password?state=${r}&code=${n}`,a={vendorName:i.name,lng:i.language||"en"};await Eo(t,{to:e,subject:$e("reset_password_title",a),html:`Click here to reset your password: ${kt(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:s,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:$e("password_reset_title",a),resetPasswordEmailClickToReset:$e("reset_password_email_click_to_reset",a),resetPasswordEmailReset:$e("reset_password_email_reset",a),supportInfo:$e("support_info",a),contactUs:$e("contact_us",a),copyright:$e("copyright",a),tenantName:i.name,tenantId:i.id}})}async function Cf(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new N(500,{message:"Tenant not found"});const{connectionType:i}=Tl(e),s=new URL(kt(t.env)),a={vendorName:r.name,vendorId:r.id,loginDomain:s.hostname,code:n,lng:r.language||"en"};i==="email"?await Eo(t,{to:e,subject:$e("code_email_subject",a),html:`Click here to validate your email: ${kt(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:$e("welcome_to_your_account",a),linkEmailClickToLogin:$e("link_email_click_to_login",a),linkEmailLogin:$e("link_email_login",a),linkEmailOrEnterCode:$e("link_email_or_enter_code",a),codeValid30Mins:$e("code_valid_30_minutes",a),supportInfo:$e("support_info",a),contactUs:$e("contact_us",a),copyright:$e("copyright",a)}}):i==="sms"&&await ey(t,{to:e,text:$e("sms_code_text",a),code:n,from:r.name});const l=Ue(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(r.id,l))}async function Tf(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new N(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new N(400,{message:"redirect_uri is required"});const{connectionType:s}=Tl(e),a=new URL(st(t.env));a.pathname="passwordless/verify_redirect",a.searchParams.set("verification_code",n),a.searchParams.set("connection",s),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 l={vendorName:i.name,code:n,lng:i.language||"en"};if(s==="email")await Eo(t,{to:e,subject:$e("code_email_subject",l),html:`Click here to validate your email: ${kt(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:$e("welcome_to_your_account",l),linkEmailClickToLogin:$e("link_email_click_to_login",l),linkEmailLogin:$e("link_email_login",l),linkEmailOrEnterCode:$e("link_email_or_enter_code",l),codeValid30Mins:$e("code_valid_30_minutes",l),supportInfo:$e("support_info",l),contactUs:$e("contact_us",l),copyright:$e("copyright",l)}});else if(s==="sms")await ey(t,{to:e,text:`${$e("link_sms_login",l)}: ${a.toString()}`,code:n,from:i.name});else throw new N(400,{message:"Only email and SMS connections are supported for magic links"});const u=Ue(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(i.id,u))}async function If(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new N(500,{message:"Tenant not found"});if(!e.email)throw new N(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await Eo(t,{to:e.email,subject:$e("welcome_to_your_account",r),html:`Click here to validate your email: ${kt(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${kt(t.env)}validate-email`,supportUrl:n.support_url||"https://support.sesamy.com",buttonColor:n.primary_color||"#7d68f4",welcomeToYourAccount:$e("welcome_to_your_account",r),verifyEmailVerify:$e("verify_email_verify",r),supportInfo:$e("support_info",r),contactUs:$e("contact_us",r),copyright:$e("copyright",r)}})}async function gE(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new N(500,{message:"Tenant not found"});const s={vendorName:i.name,lng:i.language||"en"},a=`${kt(t.env)}signup?state=${r}&code=${n}`;await Eo(t,{to:e,subject:$e("register_password_account",s),html:`Click here to register: ${a}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:a,setPassword:$e("set_password",s),registerPasswordAccount:$e("register_password_account",s),clickToSignUpDescription:$e("click_to_sign_up_description",s),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:$e("welcome_to_your_account",s),verifyEmailVerify:$e("verify_email_verify",s),supportInfo:$e("support_info",s),contactUs:$e("contact_us",s),copyright:$e("copyright",s)}})}const mE=new o.OpenAPIHono().openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.z.string().transform(t=>t.toLowerCase()),password:o.z.string()})}}}},responses:{200:{content:{"application/json":{schema:o.z.object({_id:o.z.string(),email:o.z.string().optional(),email_verified:o.z.boolean(),app_metadata:o.z.object({}),user_metadata:o.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 N(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!Nf(n))throw new N(400,{message:"Password does not meet the requirements"});if(await Os({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new N(400,{message:"Invalid sign up"});const a=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${kc()}`,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 l=await no.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:a.user_id,password:l,algorithm:"bcrypt"}),await If(t,a);const u=Ue(t,{type:Le.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,u),t.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.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 N(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await Wi({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 s={client_id:n,username:e},a=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:s,csrf_token:qe(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:wr(t.get("auth0_client"))});return await ty(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 vr(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const _E=new o.OpenAPIHono().openapi(o.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:o.z.union([o.z.object({connection:o.z.literal("email"),client_id:o.z.string(),email:o.z.string().transform(t=>t.toLowerCase()),send:o.z.enum(["link","code"]),authParams:Ts.omit({client_id:!0})}),o.z.object({client_id:o.z.string(),connection:o.z.literal("sms"),phone_number:o.z.string(),send:o.z.enum(["link","code"]),authParams:Ts.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:s,connection:a}=e,l=await t.env.data.clients.get(r);if(!l)throw new N(400,{message:"Client not found"});t.set("client_id",l.id),t.set("tenant_id",l.tenant.id);const u=a==="email"?e.email:e.phone_number,d=t.get("ip"),p=t.get("useragent"),h=t.get("auth0_client"),g=wr(h),A=await n.data.loginSessions.create(l.tenant.id,{authParams:{...s,client_id:r,username:u},expires_at:new Date(Date.now()+ta).toISOString(),csrf_token:qe(),ip:d,useragent:p,auth0Client:g}),$=await n.data.codes.create(l.tenant.id,{code_id:vr(),code_type:"otp",login_id:A.id,expires_at:new Date(Date.now()+ta).toISOString(),redirect_uri:s.redirect_uri});return i==="link"?await Tf(t,{to:u,code:$.code_id,authParams:{...s,client_id:r}}):await Cf(t,{to:u,code:$.code_id}),t.html("OK")}).openapi(o.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:o.z.object({scope:o.z.string(),response_type:o.z.nativeEnum(nn),redirect_uri:o.z.string(),state:o.z.string(),nonce:o.z.string().optional(),verification_code:o.z.string(),connection:o.z.string(),client_id:o.z.string(),email:o.z.string().transform(t=>t.toLowerCase()),audience:o.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:o.z.object({Location:o.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:s,state:a,scope:l,audience:u,response_type:d,nonce:p}=t.req.valid("query"),h=await os(e,n);t.set("client_id",h.id),t.set("tenant_id",h.tenant.id),t.set("connection","email");const g={client_id:n,redirect_uri:s,state:a,nonce:p,scope:l,audience:u,response_type:d};let A="Something went wrong. Please try again later.";try{const M=await Ef(t,{client_id:n,username:r,otp:i,authParams:g,enforceIpCheck:!0});if(M instanceof Response)return M;if(M&&typeof M=="object"&&"access_token"in M)return t.json(M)}catch(M){const G=M;"message"in G&&typeof G.message=="string"&&(A=G.message)}const $=t.get("ip"),I=t.get("useragent"),R=t.get("auth0_client"),D=wr(R),x=await e.data.loginSessions.create(h.tenant.id,{authParams:{...g,username:r},expires_at:new Date(Date.now()+ta).toISOString(),csrf_token:qe(),ip:$,useragent:I,auth0Client:D});return t.redirect(`${kt(t.env)}invalid-session?state=${x.id}&error=${encodeURIComponent(A)}`,302)});class mi extends N{constructor(n,r){super(n,r);be(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function ny(t,e,n,r){var A;const{data:i}=t.env,{username:s}=n;if(t.set("username",s),!s)throw new N(400,{message:"Username is required"});const a=await Wi({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:s,provider:"auth2"});if(!a){const $=Ue(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Bt(t,i.logs.create(e.tenant.id,$)),new mi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const l=a.linked_to?await i.users.get(e.tenant.id,a.linked_to):a;if(!l)throw new mi(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",a.connection),t.set("user_id",l.user_id);const u=await i.passwords.get(e.tenant.id,a.user_id);if(!(u&&await no.compare(n.password,u.password))){const $=Ue(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Bt(t,i.logs.create(e.tenant.id,$)),new mi(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${l.user_id}`})).logs.filter($=>$.type===Le.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date($.date)>new Date(Date.now()-1e3*60*5)).length>=3){const $=Ue(t,{type:Le.FAILED_LOGIN,description:"Too many failed login attempts"});throw Bt(t,i.logs.create(e.tenant.id,$)),new mi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!a.email_verified&&e.email_validation==="enforced"){await If(t,a);const $=Ue(t,{type:Le.FAILED_LOGIN,description:"Email not verified"});throw await i.logs.create(e.tenant.id,$),new mi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}((A=l.app_metadata)==null?void 0:A.strategy)!=="Username-Password-Authentication"&&Bt(t,i.users.update(e.tenant.id,l.user_id,{app_metadata:{...l.app_metadata||{},strategy:"Username-Password-Authentication"}}));const g=Ue(t,{type:Le.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Bt(t,i.logs.create(e.tenant.id,g)),{client:e,authParams:n,user:l,loginSession:r}}async function ry(t,e,n,r,i){const s=await ny(t,e,n,r);return Er(t,{...s,ticketAuth:i})}async function yE(t,e,n,r){await Ic(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=vr(),s=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;s;)i=vr(),s=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client"),d=wr(u),p=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Dv).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:qe(),ip:a,useragent:l,auth0Client:d}),h=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:p.id,expires_at:new Date(Date.now()+zv).toISOString()});await ty(t,n,h.code_id,r)}const wE=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.union([o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:o.z.string(),client_id:o.z.string(),username:o.z.string().transform(t=>t.toLowerCase()),realm:o.z.enum(["email"]),scope:o.z.string().optional()}),o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:o.z.string(),username:o.z.string().transform(t=>t.toLowerCase()),password:o.z.string(),realm:o.z.enum(["Username-Password-Authentication"]),scope:o.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 N(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const s=r.toLocaleLowerCase(),a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client");let d;if("otp"in e)d=await Ef(t,{client_id:n,username:s,otp:e.otp});else if("password"in e){const p=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:{client_id:n,username:s},csrf_token:qe(),ip:a,useragent:l,auth0Client:wr(u)});d=await ry(t,i,{username:s,password:e.password,client_id:n},p,!0)}else throw new N(400,{message:"Code or password required"});if(!(d instanceof Response))throw new N(500,{message:"Unexpected response from loginWithPassword"});return d});function vE(t,e){var r,i,s;if(!t||e.length===0)return!1;const n=((r=ru(t))==null?void 0:r.host)??null;if(!n)return!1;for(const a of e){let l;if(a.startsWith("http://")||a.startsWith("https://")?l=((i=ru(a))==null?void 0:i.host)??null:l=((s=ru("https://"+a))==null?void 0:s.host)??null,n===l)return!0}return!1}function ru(t){try{return new URL(t)}catch{return null}}async function bE({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:s}){const a=new URL(t.req.url);t.var.custom_domain&&(a.hostname=t.var.custom_domain);const{ip:l,auth0_client:u,useragent:d}=t.var,p=wr(u),h=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:r,csrf_token:qe(),authorization_url:a.toString(),ip:l,useragent:d,auth0Client:p});if(e&&s){const g=await t.env.data.users.get(n.tenant.id,e.user_id);if((g==null?void 0:g.email)===s)return Er(t,{client:n,loginSession:h,authParams:r,user:g,sessionId:e.id})}if(i==="email"&&s){const g=vr();return await t.env.data.codes.create(n.tenant.id,{code_id:g,code_type:"otp",login_id:h.id,expires_at:new Date(Date.now()+Ci*1e3).toISOString(),redirect_uri:r.redirect_uri}),await Tf(t,{code:g,to:s,authParams:r}),t.redirect(`/u/enter-code?state=${h.id}`)}return e?t.redirect(`/u/check-account?state=${h.id}`):t.redirect(`/u/login/identifier?state=${h.id}`)}function xE(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new N(403,{message:"Invalid realm"})}async function $E(t,e,n,r,i){var g;const{env:s}=t;t.set("connection",i);const a=await s.data.codes.get(e,n,"ticket");if(!a||a.used_at)throw new N(403,{message:"Ticket not found"});const l=await s.data.loginSessions.get(e,a.login_id);if(!l||!l.authParams.username)throw new N(403,{message:"Session not found"});const u=await s.data.clients.get(l.authParams.client_id);if(!u)throw new N(403,{message:"Client not found"});t.set("client_id",l.authParams.client_id),await s.data.codes.used(e,n);const d=xE(i);let p=await Ic(t,{username:l.authParams.username,provider:d,client:u,connection:d==="auth2"?"Username-Password-Authentication":"email",isSocial:!1,ip:t.req.header("x-real-ip")});t.set("username",p.email||p.phone_number),t.set("user_id",p.user_id);const h=await T_(t,{user:p,client:u,loginSession:l});return Er(t,{authParams:{scope:(g=l.authParams)==null?void 0:g.scope,...r},loginSession:l,sessionId:h.id,user:p,client:u})}async function AE({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:s,code_challenge_method:a,code_challenge:l,audience:u,scope:d,response_type:p}){const{env:h}=t,g=new URL(r),A=`${g.protocol}//${g.host}`;async function $(H="Login required"){const X=Ue(t,{type:Le.FAILED_SILENT_AUTH,description:H});return await t.env.data.logs.create(e.tenant.id,X),t.html(Su(A,JSON.stringify({error:"login_required",error_description:H,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 $();t.set("user_id",n.user_id);const R=await h.data.users.get(e.tenant.id,n.user_id);if(!R)return console.error("User not found",n.user_id),$("User not found");t.set("username",R.email),t.set("connection",R.connection);const D={client:e,authParams:{client_id:e.id,audience:u,code_challenge_method:a,code_challenge:l,scope:d,state:i,nonce:s,response_type:p,redirect_uri:r},user:R,session_id:n.id},x=p===nn.CODE?await N_(t,{user:R,client:e,authParams:D.authParams,login_id:n.login_session_id}):await Tc(t,D);await h.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()+Nc*1e3).toISOString():void 0});const M=Ue(t,{type:Le.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,M);const G=new Headers;G.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const F=Na(e.tenant.id,n.id,t.req.header("host"));return G.set("set-cookie",F),t.html(Su(A,JSON.stringify({...x,state:i})),{headers:G})}const EE=["email","sms","Username-Password-Authentication"],SE=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),vendor_id:o.z.string().optional(),redirect_uri:o.z.string(),scope:o.z.string().optional(),state:o.z.string(),prompt:o.z.string().optional(),response_mode:o.z.nativeEnum(En).optional(),response_type:o.z.nativeEnum(nn).optional(),audience:o.z.string().optional(),connection:o.z.string().optional(),nonce:o.z.string().optional(),max_age:o.z.string().optional(),login_ticket:o.z.string().optional(),code_challenge_method:o.z.nativeEnum($c).optional(),code_challenge:o.z.string().optional(),realm:o.z.string().optional(),auth0Client:o.z.string().optional(),organization:o.z.string().optional(),login_hint:o.z.string().optional(),screen_hint:o.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:o.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:o.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:gp}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:o.z.object({Location:o.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:s,state:a,audience:l,nonce:u,connection:d,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,prompt:$,login_ticket:I,realm:R,auth0Client:D,login_hint:x,ui_locales:M,organization:G}=t.req.valid("query");t.set("log","authorize");const F=await os(e,n);t.set("client_id",F.id),t.set("tenant_id",F.tenant.id);const H={redirect_uri:i.split("#")[0],scope:s,state:a,client_id:n,vendor_id:r,audience:l,nonce:u,prompt:$,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,username:x,ui_locales:M,organization:G},X=t.req.header("origin");if(X&&!vE(X,F.web_origins||[]))throw new N(403,{message:`Origin ${X} not allowed`});if(H.redirect_uri){const j=F.callbacks||[];if(t.var.host&&(j.push(`${_f(t.env)}/*`),j.push(`${kt(t.env)}/*`)),!M1(H.redirect_uri,j,{allowPathWildcards:!0}))throw new N(400,{message:`Invalid redirect URI - ${H.redirect_uri}`})}const Y=Is(F.tenant.id,t.req.header("cookie")),fe=Y?await e.data.sessions.get(F.tenant.id,Y):void 0,Ce=fe&&!fe.revoked_at?fe:void 0;if($=="none"){if(!p)throw new N(400,{message:"Missing response_type"});return AE({ctx:t,session:Ce||void 0,redirect_uri:i,state:a,response_type:p,client:F,nonce:u,code_challenge_method:A,code_challenge:g,audience:l,scope:s})}if(F.connections.length===1&&F.connections[0]&&!EE.includes(F.connections[0].strategy||""))return sg(t,F,F.connections[0].name,H);if(d&&d!=="email")return sg(t,F,d,H);if(I){const j=await $E(t,F.tenant.id,I,H,R);return j instanceof Response?j:t.json(j)}const P=await bE({ctx:t,client:F,auth0Client:D,authParams:H,session:Ce||void 0,connection:d,login_hint:x});return P instanceof Response?P:t.json(P)});function kE(t){const e=new o.OpenAPIHono;e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=t.dataAdapter.cache||Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(s,{defaultTtl:l,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}),e.use("/oauth/token",wm({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(El).use(Al).use(mf(e));const n=e.route("/v2/logout",W$).route("/userinfo",X$).route("/.well-known",J$).route("/oauth/token",fE).route("/dbconnections",mE).route("/passwordless",_E).route("/co/authenticate",wE).route("/authorize",SE).route("/callback",K$);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),gf(n),n}var iy=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const s=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let a=0,l=s.length;a<l;a++){const u=s[a];if(typeof u=="string")hr(u,n);else if(typeof u=="number")n[0]+=u;else{if(typeof u=="boolean"||u===null||u===void 0)continue;if(typeof u=="object"&&u.isEscaped)if(u.callbacks)n.unshift("",u);else{const d=u.toString();d instanceof Promise?n.unshift("",d):n[0]+=d}else u instanceof Promise?n.unshift("",u):hr(u.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?cn(O1(cn(n[0],n.callbacks))):cn(n[0]):I1(n,n.callbacks)},Of=Symbol("RENDERER"),ep=Symbol("ERROR_HANDLER"),Ke=Symbol("STASH"),sy=Symbol("INTERNAL"),NE=Symbol("MEMO"),fc=Symbol("PERMALINK"),Rg=t=>(t[sy]=!0,t),oy=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:Rg(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:Rg(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[ep]=s=>{throw t.pop(),s},i},ay=t=>{const e=[t],n=oy(e);return n.values=e,n.Provider=n,Ui.push(n),n},Ui=[],cy=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new py("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(s=>cn(s,s.callbacks)):cn(i)};return n.values=e,n.Provider=n,n[Of]=oy(e),Ui.push(n),n},cs=t=>t.values.at(-1),la={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},tp={},ua="data-precedence",So=t=>Array.isArray(t)?t:[t],Pg=new WeakMap,Bg=(t,e,n,r)=>({buffer:i,context:s})=>{if(!i)return;const a=Pg.get(s)||{};Pg.set(s,a);const l=a[t]||(a[t]=[]);let u=!1;const d=la[t];if(d.length>0){e:for(const[,p]of l)for(const h of d)if(((p==null?void 0:p[h])??null)===(n==null?void 0:n[h])){u=!0;break e}}if(u?i[0]=i[0].replaceAll(e,""):d.length>0?l.push([e,n,r]):l.unshift([e,n,r]),i[0].indexOf("</head>")!==-1){let p;if(r===void 0)p=l.map(([h])=>h);else{const h=[];p=l.map(([g,,A])=>{let $=h.indexOf(A);return $===-1&&(h.push(A),$=h.length-1),[g,$]}).sort((g,A)=>g[1]-A[1]).map(([g])=>g)}p.forEach(h=>{i[0]=i[0].replaceAll(h,"")}),i[0]=i[0].replace(/(?=<\/head>)/,p.join(""))}},ko=(t,e,n)=>cn(new ln(t,n,So(e??[])).toString()),No=(t,e,n,r)=>{if("itemProp"in n)return ko(t,e,n);let{precedence:i,blocking:s,...a}=n;i=r?i??"":void 0,r&&(a[ua]=i);const l=new ln(t,a,So(e||[])).toString();return l instanceof Promise?l.then(u=>cn(l,[...u.callbacks||[],Bg(t,u,a,i)])):cn(l,[Bg(t,l,a,i)])},CE=({children:t,...e})=>{const n=zf();if(n){const r=cs(n);if(r==="svg"||r==="head")return new ln("title",e,So(t??[]))}return No("title",t,e,!1)},TE=({children:t,...e})=>{const n=zf();return["src","async"].some(r=>!e[r])||n&&cs(n)==="head"?ko("script",t,e):No("script",t,e,!1)},IE=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,No("style",t,e,!0)):ko("style",t,e),OE=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?ko("link",t,e):No("link",t,e,"precedence"in e),zE=({children:t,...e})=>{const n=zf();return n&&cs(n)==="head"?ko("meta",t,e):No("meta",t,e,!1)},ly=(t,{children:e,...n})=>new ln(t,n,So(e??[])),DE=t=>(typeof t.action=="function"&&(t.action=fc in t.action?t.action[fc]:void 0),ly("form",t)),uy=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=fc in e.formAction?e.formAction[fc]:void 0),ly(t,e)),RE=t=>uy("input",t),PE=t=>uy("button",t);const iu=Object.freeze(Object.defineProperty({__proto__:null,button:PE,form:DE,input:RE,link:OE,meta:zE,script:TE,style:IE,title:CE},Symbol.toStringTag,{value:"Module"}));var BE=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),hc=t=>BE.get(t)||t,dy=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,s=>`-${s.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)}},Xs=void 0,zf=()=>Xs,jE=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,LE=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],FE=["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"],Df=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")hr(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof ln?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):Df(i,e)}}},ln=class{constructor(t,e,n){be(this,"tag");be(this,"props");be(this,"key");be(this,"children");be(this,"isEscaped",!0);be(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?O1(cn(t[0],t.callbacks)).toString():t[0]:I1(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=Xs&&cs(Xs)==="svg"?s=>jE(hc(s)):s=>hc(s);for(let[s,a]of Object.entries(n))if(s=i(s),s!=="children"){if(s==="style"&&typeof a=="object"){let l="";dy(a,(u,d)=>{d!=null&&(l+=`${l?";":""}${u}:${d}`)}),t[0]+=' style="',hr(l,t),t[0]+='"'}else if(typeof a=="string")t[0]+=` ${s}="`,hr(a,t),t[0]+='"';else if(a!=null)if(typeof a=="number"||a.isEscaped)t[0]+=` ${s}="${a}"`;else if(typeof a=="boolean"&&FE.includes(s))a&&(t[0]+=` ${s}=""`);else if(s==="dangerouslySetInnerHTML"){if(r.length>0)throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");r=[cn(a.__html)]}else if(a instanceof Promise)t[0]+=` ${s}="`,t.unshift('"',a);else if(typeof a=="function"){if(!s.startsWith("on")&&s!=="ref")throw new Error(`Invalid prop '${s}' of type 'function' supplied to '${e}'.`)}else t[0]+=` ${s}="`,hr(a.toString(),t),t[0]+='"'}if(LE.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",Df(r,t),t[0]+=`</${e}>`}},su=class extends ln{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(Ui.length===0)t.unshift("",n);else{const r=Ui.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof ln&&(i.localContexts=r),i)))}else n instanceof ln?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):hr(n,t)}},py=class extends ln{toStringToBuffer(t){Df(this.children,t)}},UE=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=da(t,e,n);return i.key=r,i},jg=!1,da=(t,e,n)=>{if(!jg){for(const r in tp)iu[r][Of]=tp[r];jg=!0}return typeof t=="function"?new su(t,e,n):iu[t]?new su(iu[t],e,n):t==="svg"||t==="head"?(Xs||(Xs=cy("")),new ln(t,e,[new su(Xs,{value:t},n)])):new ln(t,e,n)},Rf=({children:t})=>new py("",{children:t},Array.isArray(t)?t:t?[t]:[]),ME=(t,e,...n)=>{let r;if(n.length>0)r=n;else{const i=t.props.children;r=Array.isArray(i)?i:[i]}return UE(t.tag,{...t.props,...e},...r)};function w(t,e,n){let r;if(!e||!("children"in e))r=da(t,e,[]);else{const i=e.children;r=Array.isArray(i)?da(t,e,i):da(t,e,[i])}return r.key=n,r}async function Ge(t,e,n=!1){var p;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new N(400,{message:"Login session not found"});t.set("loginSession",i);const s=await os(r,i.authParams.client_id);t.set("client_id",s.id),t.set("tenant_id",s.tenant.id);const a=await r.data.tenants.get(s.tenant.id);if(a){if(i.session_id&&!n){if(!i.authParams.redirect_uri)throw new N(400,{message:"Login session closed and no redirect URI available"});const h=new URL(i.authParams.redirect_uri);throw h.searchParams.set("error","access_denied"),h.searchParams.set("error_description","Login session closed"),i.authParams.state&&h.searchParams.set("state",i.authParams.state),new as(h.toString(),302)}}else throw new N(400,{message:"Tenant not found"});const l=await r.data.themes.get(a.id,"default"),u=await r.data.branding.get(a.id),d=(p=i.authParams.ui_locales)==null?void 0:p.split(" ").map(h=>h.split("-")[0]).find(h=>{if(Array.isArray(L.options.supportedLngs))return L.options.supportedLngs.includes(h)});return await L.changeLanguage(d||a.language||"sv"),{theme:l,branding:u,client:s,tenant:a,loginSession:i}}async function Js(t,e){const{env:n}=t,r=await os(n,e);t.set("client_id",r.id),t.set("tenant_id",r.tenant.id);const i=Is(r.tenant.id,t.req.header("cookie"));if(!i){const d=new URL(st(t.env));throw d.pathname="/authorize",d.searchParams.set("client_id",r.id),d.searchParams.set("redirect_uri",t.req.url),d.searchParams.set("state",qe()),new as(d.toString())}const s=await n.data.sessions.get(t.var.tenant_id||"",i);if(!s)throw new N(400,{message:"Session not found"});const a=await n.data.themes.get(r.tenant.id,"default"),l=await n.data.branding.get(r.tenant.id),u=await n.data.users.get(r.tenant.id,s.user_id);if(!u)throw new N(400,{message:"User not found"});return{theme:a,branding:l,client:r,user:u}}async function qE(t,e,n,r){if(r!==void 0)return r==="password";const i=await Ep({userAdapter:t.env.data.users,tenant_id:e.tenant.id,email:n});return i!=null&&i.app_metadata.strategy?i.app_metadata.strategy==="Username-Password-Authentication":(await t.env.data.promptSettings.get(e.tenant.id)).password_first}const fy=({theme:t,branding:e})=>{var r;const n=((r=t==null?void 0:t.widget)==null?void 0:r.logo_url)||(e==null?void 0:e.logo_url);return n?w("div",{className:"flex h-9 items-center",children:w("img",{src:n,className:"max-h-full",alt:"Logo"})}):w(Rf,{})},hy=t=>{var e,n;return w("div",{className:"mt-8",children:((n=(e=t.client)==null?void 0:e.client_metadata)==null?void 0:n.termsAndConditionsUrl)&&w("div",{className:"text-xs text-gray-300",children:[L.t("agree_to")," ",w("a",{href:t.client.client_metadata.termsAndConditionsUrl,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:L.t("terms")})]})})};var gy={exports:{}};/*!
197
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZA(t,e){if(t){if(typeof t=="string")return Cg(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 Cg(t,e)}}function Cg(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 QA(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,s=!1,a,l;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(u){s=!0,l=u}finally{try{!i&&n.return!=null&&n.return()}finally{if(s)throw l}}return r}}function eE(t){if(Array.isArray(t))return t}function tE(t){var e=Array.prototype.slice.call(t),n=JA(e,4),r=n[0],i=n[1],s=n[2],a=n[3],l,u,d;if(typeof r=="string")l=r;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")a?(u=s,d=a):(u=void 0,d=s),i&&(u=WA({defaultCountry:i},u));else if(Ni(i))s?(u=i,d=s):d=i;else throw new Error("Invalid second argument: ".concat(i));return{text:l,options:u,metadata:d}}function Tg(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 Ig(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tg(Object(n),!0).forEach(function(r){nE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nE(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rE(t,e,n){e&&e.defaultCountry&&!f5(e.defaultCountry,n)&&(e=Ig(Ig({},e),{},{defaultCountry:void 0}));try{return GA(t,e,n)}catch(r){if(!(r instanceof Pn))throw r}}function iE(){var t=tE(arguments),e=t.text,n=t.options,r=t.metadata;return rE(e,n,r)}function sE(){return r5(iE,arguments)}function Tl(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=sE(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}}function Af(t){let e=t.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1));const n=e.indexOf("%");return n!==-1&&(e=e.slice(0,n)),e}function oE(t){const n=Af(t).split(".");return n.length!==4?!1:n.every(r=>/^\d+$/.test(r)&&Number(r)>=0&&Number(r)<=255)}function aE(t){const e=Af(t);if(e.length<2||e.indexOf(":")===-1||!/^[0-9a-fA-F:.]+$/.test(e))return!1;const n=e.split(":");return e.includes("::")?n.length<=8:n.length===8}function cE(t){let e=t.trim();const n=/^\[([^\]]+)\](?::\d+)?$/,r=e.match(n);if(r&&r[1])return r[1];const i=e.lastIndexOf(":");if(i!==-1){const s=e.slice(0,i),a=e.slice(i+1);/^[0-9.]+$/.test(s)&&/^\d+$/.test(a)&&(e=s)}return e}function Og(t){if(!t)return null;const e=Af(cE(t));return oE(e)?{family:4,normalized:e}:aE(e)?{family:6,normalized:e.toLowerCase()}:null}function zg(t){if(t.includes("::")){let[e,n]=t.split("::"),r=e?e.split(":").filter(Boolean):[],i=n?n.split(":").filter(Boolean):[],s=8-(r.length+i.length);return[...r.map(a=>a.toLowerCase()||"0"),...Array(s).fill("0"),...i.map(a=>a.toLowerCase()||"0")]}else return t.split(":").map(e=>e.toLowerCase()||"0")}function lE(t,e,n=!0){const r=Og(t),i=Og(e);if(!r||!i||r.family!==i.family)return!1;if(r.family===4)return r.normalized===i.normalized;const s=zg(r.normalized),a=zg(i.normalized);return n?s.length===8&&a.length===8&&s.join(":")===a.join(":"):s.slice(0,4).join(":")===a.slice(0,4).join(":")}class as extends Error{constructor(n,r=302){super(`Redirect to ${n}`);be(this,"location");be(this,"status");this.name=as.name,this.location=n,this.status=r}}const uE=o.z.object({client_id:o.z.string(),username:o.z.string().transform(t=>t.toLowerCase()),otp:o.z.string(),authParams:Ts.optional(),enforceIpCheck:o.z.boolean().optional().default(!1)});async function Z1(t,{client_id:e,username:n,otp:r,authParams:i,enforceIpCheck:s=!1}){var I;const a=t.get("ip"),l=t.get("countryCode"),{connectionType:u,normalized:d}=Tl(n,l);if(!d)throw new N(400,{message:"Invalid username format"});const p=await t.env.data.clients.get(e);if(!p)throw new N(403,{message:"Client not found"});const{env:h}=t,g=await h.data.codes.get(p.tenant.id,r,"otp");if(!g)throw new N(400,{message:$e("code_invalid")});if(g.expires_at<new Date().toISOString())throw new N(400,{message:$e("code_expired")});if(g.used_at)throw new N(400,{message:$e("code_used")});const A=await h.data.loginSessions.get(p.tenant.id,g.login_id);if(!A||A.authParams.username!==n)throw new N(400,{message:"Code not found or expired"});if(s&&A.ip&&a&&!lE(A.ip,a))throw new as(`${kt(t.env)}invalid-session?state=${A.id}`);const $=await Ic(t,{client:p,username:d,provider:u,connection:u,isSocial:!1,ip:t.req.header("x-real-ip")});return await h.data.codes.used(p.tenant.id,r),((I=$.app_metadata)==null?void 0:I.strategy)!=="email"&&Bt(t,t.env.data.users.update(p.tenant.id,$.user_id,{app_metadata:{...$.app_metadata||{},strategy:"email"}})),{user:$,client:p,loginSession:A,session_id:A.session_id,authParams:{...A.authParams,...i||{}}}}async function Ef(t,e){const n=await Z1(t,e);return Er(t,{authParams:n.authParams,client:n.client,user:n.user,loginSession:n.loginSession})}const Dg=o.z.object({client_id:o.z.string().optional(),client_secret:o.z.string().optional()}),dE=o.z.union([q1.extend(Dg.shape),o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string(),code_verifier:o.z.string().min(43).max(128)}),o.z.object({grant_type:o.z.literal("authorization_code"),code:o.z.string(),redirect_uri:o.z.string().optional(),...Dg.shape}),o.z.object({grant_type:o.z.literal("refresh_token"),client_id:o.z.string(),refresh_token:o.z.string(),redirect_uri:o.z.string().optional()}),o.z.object({grant_type:o.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:o.z.string(),username:o.z.string(),otp:o.z.string(),realm:o.z.enum(["email","sms"])})]);function pE(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 fE=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:dE}}}},responses:{200:{content:{"application/json":{schema:gp}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:o.z.object({Location:o.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=pE(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new N(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case vi.AuthorizationCode:i=await Q$(t,Z$.parse(r));break;case vi.ClientCredential:i=await Y$(t,q1.parse(r));break;case vi.RefreshToken:i=await t5(t,e5.parse(r));break;case vi.OTP:i=await Z1(t,uE.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}const s=new Headers;if(i.session_id){const l=Na(i.client.tenant.id,i.session_id,t.var.host||"");s.set("Set-Cookie",l)}const a=await Tc(t,i);return t.json(a,{headers:s})});var Sf={exports:{}};const kf=[{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}],Q1=(t,e=kf,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 s={};s.contains=i.filter(l=>new RegExp(`${l.regex}`).test(r)).map(l=>l.message),s.length=r.length;let a=e.filter(l=>s.contains.length>=l.minDiversity).filter(l=>s.length>=l.minLength).sort((l,u)=>u.id-l.id).map(l=>({id:l.id,value:l.value}));return Object.assign(s,a[0]),s};Sf.exports={passwordStrength:Q1,defaultOptions:kf};var hE=Sf.exports.passwordStrength=Q1;Sf.exports.defaultOptions=kf;function Nf(t){return hE(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 Eo(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 N(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new N(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function ey(t,e){var a,l;if(!t.var.client_id)throw new N(500,{message:"Client not found"});const n=await os(t.env,t.var.client_id),r=n.connections.find(u=>u.strategy==="sms");if(!r)throw new N(500,{message:"SMS provider not found"});const i=((a=r.options)==null?void 0:a.provider)||"twilio",s=(l=t.env.smsProviders)==null?void 0:l[i];if(!s)throw new N(500,{message:"SMS provider not found"});await s({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 ty(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new N(500,{message:"Tenant not found"});const s=`${kt(t.env)}reset-password?state=${r}&code=${n}`,a={vendorName:i.name,lng:i.language||"en"};await Eo(t,{to:e,subject:$e("reset_password_title",a),html:`Click here to reset your password: ${kt(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:s,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:$e("password_reset_title",a),resetPasswordEmailClickToReset:$e("reset_password_email_click_to_reset",a),resetPasswordEmailReset:$e("reset_password_email_reset",a),supportInfo:$e("support_info",a),contactUs:$e("contact_us",a),copyright:$e("copyright",a),tenantName:i.name,tenantId:i.id}})}async function Cf(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new N(500,{message:"Tenant not found"});const{connectionType:i}=Tl(e),s=new URL(kt(t.env)),a={vendorName:r.name,vendorId:r.id,loginDomain:s.hostname,code:n,lng:r.language||"en"};i==="email"?await Eo(t,{to:e,subject:$e("code_email_subject",a),html:`Click here to validate your email: ${kt(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:$e("welcome_to_your_account",a),linkEmailClickToLogin:$e("link_email_click_to_login",a),linkEmailLogin:$e("link_email_login",a),linkEmailOrEnterCode:$e("link_email_or_enter_code",a),codeValid30Mins:$e("code_valid_30_minutes",a),supportInfo:$e("support_info",a),contactUs:$e("contact_us",a),copyright:$e("copyright",a)}}):i==="sms"&&await ey(t,{to:e,text:$e("sms_code_text",a),code:n,from:r.name});const l=Ue(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(r.id,l))}async function Tf(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new N(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new N(400,{message:"redirect_uri is required"});const{connectionType:s}=Tl(e),a=new URL(st(t.env));a.pathname="passwordless/verify_redirect",a.searchParams.set("verification_code",n),a.searchParams.set("connection",s),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 l={vendorName:i.name,code:n,lng:i.language||"en"};if(s==="email")await Eo(t,{to:e,subject:$e("code_email_subject",l),html:`Click here to validate your email: ${kt(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:$e("welcome_to_your_account",l),linkEmailClickToLogin:$e("link_email_click_to_login",l),linkEmailLogin:$e("link_email_login",l),linkEmailOrEnterCode:$e("link_email_or_enter_code",l),codeValid30Mins:$e("code_valid_30_minutes",l),supportInfo:$e("support_info",l),contactUs:$e("contact_us",l),copyright:$e("copyright",l)}});else if(s==="sms")await ey(t,{to:e,text:`${$e("link_sms_login",l)}: ${a.toString()}`,code:n,from:i.name});else throw new N(400,{message:"Only email and SMS connections are supported for magic links"});const u=Ue(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(i.id,u))}async function If(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new N(500,{message:"Tenant not found"});if(!e.email)throw new N(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await Eo(t,{to:e.email,subject:$e("welcome_to_your_account",r),html:`Click here to validate your email: ${kt(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${kt(t.env)}validate-email`,supportUrl:n.support_url||"https://support.sesamy.com",buttonColor:n.primary_color||"#7d68f4",welcomeToYourAccount:$e("welcome_to_your_account",r),verifyEmailVerify:$e("verify_email_verify",r),supportInfo:$e("support_info",r),contactUs:$e("contact_us",r),copyright:$e("copyright",r)}})}async function gE(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new N(500,{message:"Tenant not found"});const s={vendorName:i.name,lng:i.language||"en"},a=`${kt(t.env)}signup?state=${r}&code=${n}`;await Eo(t,{to:e,subject:$e("register_password_account",s),html:`Click here to register: ${a}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:a,setPassword:$e("set_password",s),registerPasswordAccount:$e("register_password_account",s),clickToSignUpDescription:$e("click_to_sign_up_description",s),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:$e("welcome_to_your_account",s),verifyEmailVerify:$e("verify_email_verify",s),supportInfo:$e("support_info",s),contactUs:$e("contact_us",s),copyright:$e("copyright",s)}})}const mE=new o.OpenAPIHono().openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.z.string().transform(t=>t.toLowerCase()),password:o.z.string()})}}}},responses:{200:{content:{"application/json":{schema:o.z.object({_id:o.z.string(),email:o.z.string().optional(),email_verified:o.z.boolean(),app_metadata:o.z.object({}),user_metadata:o.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 N(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!Nf(n))throw new N(400,{message:"Password does not meet the requirements"});if(await Os({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new N(400,{message:"Invalid sign up"});const a=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${kc()}`,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 l=await no.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:a.user_id,password:l,algorithm:"bcrypt"}),await If(t,a);const u=Ue(t,{type:Le.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,u),t.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.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 N(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await Wi({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 s={client_id:n,username:e},a=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:s,csrf_token:qe(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:wr(t.get("auth0_client"))});return await ty(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 vr(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const _E=new o.OpenAPIHono().openapi(o.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:o.z.union([o.z.object({connection:o.z.literal("email"),client_id:o.z.string(),email:o.z.string().transform(t=>t.toLowerCase()),send:o.z.enum(["link","code"]),authParams:Ts.omit({client_id:!0})}),o.z.object({client_id:o.z.string(),connection:o.z.literal("sms"),phone_number:o.z.string(),send:o.z.enum(["link","code"]),authParams:Ts.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:s,connection:a}=e,l=await t.env.data.clients.get(r);if(!l)throw new N(400,{message:"Client not found"});t.set("client_id",l.id),t.set("tenant_id",l.tenant.id);const u=a==="email"?e.email:e.phone_number,d=t.get("ip"),p=t.get("useragent"),h=t.get("auth0_client"),g=wr(h),A=await n.data.loginSessions.create(l.tenant.id,{authParams:{...s,client_id:r,username:u},expires_at:new Date(Date.now()+ta).toISOString(),csrf_token:qe(),ip:d,useragent:p,auth0Client:g}),$=await n.data.codes.create(l.tenant.id,{code_id:vr(),code_type:"otp",login_id:A.id,expires_at:new Date(Date.now()+ta).toISOString(),redirect_uri:s.redirect_uri});return i==="link"?await Tf(t,{to:u,code:$.code_id,authParams:{...s,client_id:r}}):await Cf(t,{to:u,code:$.code_id}),t.html("OK")}).openapi(o.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:o.z.object({scope:o.z.string(),response_type:o.z.nativeEnum(nn),redirect_uri:o.z.string(),state:o.z.string(),nonce:o.z.string().optional(),verification_code:o.z.string(),connection:o.z.string(),client_id:o.z.string(),email:o.z.string().transform(t=>t.toLowerCase()),audience:o.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:o.z.object({Location:o.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:o.z.object({error:o.z.string(),error_description:o.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:s,state:a,scope:l,audience:u,response_type:d,nonce:p}=t.req.valid("query"),h=await os(e,n);t.set("client_id",h.id),t.set("tenant_id",h.tenant.id),t.set("connection","email");const g={client_id:n,redirect_uri:s,state:a,nonce:p,scope:l,audience:u,response_type:d};let A="Something went wrong. Please try again later.";try{const M=await Ef(t,{client_id:n,username:r,otp:i,authParams:g,enforceIpCheck:!0});if(M instanceof Response)return M;if(M&&typeof M=="object"&&"access_token"in M)return t.json(M)}catch(M){const G=M;"message"in G&&typeof G.message=="string"&&(A=G.message)}const $=t.get("ip"),I=t.get("useragent"),R=t.get("auth0_client"),D=wr(R),x=await e.data.loginSessions.create(h.tenant.id,{authParams:{...g,username:r},expires_at:new Date(Date.now()+ta).toISOString(),csrf_token:qe(),ip:$,useragent:I,auth0Client:D});return t.redirect(`${kt(t.env)}invalid-session?state=${x.id}&error=${encodeURIComponent(A)}`,302)});class mi extends N{constructor(n,r){super(n,r);be(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function ny(t,e,n,r){var A;const{data:i}=t.env,{username:s}=n;if(t.set("username",s),!s)throw new N(400,{message:"Username is required"});const a=await Wi({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:s,provider:"auth2"});if(!a){const $=Ue(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Bt(t,i.logs.create(e.tenant.id,$)),new mi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const l=a.linked_to?await i.users.get(e.tenant.id,a.linked_to):a;if(!l)throw new mi(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",a.connection),t.set("user_id",l.user_id);const u=await i.passwords.get(e.tenant.id,a.user_id);if(!(u&&await no.compare(n.password,u.password))){const $=Ue(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Bt(t,i.logs.create(e.tenant.id,$)),new mi(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${l.user_id}`})).logs.filter($=>$.type===Le.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date($.date)>new Date(Date.now()-1e3*60*5)).length>=3){const $=Ue(t,{type:Le.FAILED_LOGIN,description:"Too many failed login attempts"});throw Bt(t,i.logs.create(e.tenant.id,$)),new mi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!a.email_verified&&e.email_validation==="enforced"){await If(t,a);const $=Ue(t,{type:Le.FAILED_LOGIN,description:"Email not verified"});throw await i.logs.create(e.tenant.id,$),new mi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}((A=l.app_metadata)==null?void 0:A.strategy)!=="Username-Password-Authentication"&&Bt(t,i.users.update(e.tenant.id,l.user_id,{app_metadata:{...l.app_metadata||{},strategy:"Username-Password-Authentication"}}));const g=Ue(t,{type:Le.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Bt(t,i.logs.create(e.tenant.id,g)),{client:e,authParams:n,user:l,loginSession:r}}async function ry(t,e,n,r,i){const s=await ny(t,e,n,r);return Er(t,{...s,ticketAuth:i})}async function yE(t,e,n,r){await Ic(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=vr(),s=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;s;)i=vr(),s=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client"),d=wr(u),p=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Dv).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:qe(),ip:a,useragent:l,auth0Client:d}),h=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:p.id,expires_at:new Date(Date.now()+zv).toISOString()});await ty(t,n,h.code_id,r)}const wE=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.union([o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:o.z.string(),client_id:o.z.string(),username:o.z.string().transform(t=>t.toLowerCase()),realm:o.z.enum(["email"]),scope:o.z.string().optional()}),o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:o.z.string(),username:o.z.string().transform(t=>t.toLowerCase()),password:o.z.string(),realm:o.z.enum(["Username-Password-Authentication"]),scope:o.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 N(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const s=r.toLocaleLowerCase(),a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client");let d;if("otp"in e)d=await Ef(t,{client_id:n,username:s,otp:e.otp});else if("password"in e){const p=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:{client_id:n,username:s},csrf_token:qe(),ip:a,useragent:l,auth0Client:wr(u)});d=await ry(t,i,{username:s,password:e.password,client_id:n},p,!0)}else throw new N(400,{message:"Code or password required"});if(!(d instanceof Response))throw new N(500,{message:"Unexpected response from loginWithPassword"});return d});function vE(t,e){var r,i,s;if(!t||e.length===0)return!1;const n=((r=ru(t))==null?void 0:r.host)??null;if(!n)return!1;for(const a of e){let l;if(a.startsWith("http://")||a.startsWith("https://")?l=((i=ru(a))==null?void 0:i.host)??null:l=((s=ru("https://"+a))==null?void 0:s.host)??null,n===l)return!0}return!1}function ru(t){try{return new URL(t)}catch{return null}}async function bE({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:s}){const a=new URL(t.req.url);t.var.custom_domain&&(a.hostname=t.var.custom_domain);const{ip:l,auth0_client:u,useragent:d}=t.var,p=wr(u),h=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+Ci*1e3).toISOString(),authParams:r,csrf_token:qe(),authorization_url:a.toString(),ip:l,useragent:d,auth0Client:p});if(e&&s){const g=await t.env.data.users.get(n.tenant.id,e.user_id);if((g==null?void 0:g.email)===s)return Er(t,{client:n,loginSession:h,authParams:r,user:g,sessionId:e.id})}if(i==="email"&&s){const g=vr();return await t.env.data.codes.create(n.tenant.id,{code_id:g,code_type:"otp",login_id:h.id,expires_at:new Date(Date.now()+Ci*1e3).toISOString(),redirect_uri:r.redirect_uri}),await Tf(t,{code:g,to:s,authParams:r}),t.redirect(`/u/enter-code?state=${h.id}`)}return e?t.redirect(`/u/check-account?state=${h.id}`):t.redirect(`/u/login/identifier?state=${h.id}`)}function xE(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new N(403,{message:"Invalid realm"})}async function $E(t,e,n,r,i){var g;const{env:s}=t;t.set("connection",i);const a=await s.data.codes.get(e,n,"ticket");if(!a||a.used_at)throw new N(403,{message:"Ticket not found"});const l=await s.data.loginSessions.get(e,a.login_id);if(!l||!l.authParams.username)throw new N(403,{message:"Session not found"});const u=await s.data.clients.get(l.authParams.client_id);if(!u)throw new N(403,{message:"Client not found"});t.set("client_id",l.authParams.client_id),await s.data.codes.used(e,n);const d=xE(i);let p=await Ic(t,{username:l.authParams.username,provider:d,client:u,connection:d==="auth2"?"Username-Password-Authentication":"email",isSocial:!1,ip:t.req.header("x-real-ip")});t.set("username",p.email||p.phone_number),t.set("user_id",p.user_id);const h=await T_(t,{user:p,client:u,loginSession:l});return Er(t,{authParams:{scope:(g=l.authParams)==null?void 0:g.scope,...r},loginSession:l,sessionId:h.id,user:p,client:u})}async function AE({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:s,code_challenge_method:a,code_challenge:l,audience:u,scope:d,response_type:p}){const{env:h}=t,g=new URL(r),A=`${g.protocol}//${g.host}`;async function $(H="Login required"){const W=Ue(t,{type:Le.FAILED_SILENT_AUTH,description:H});return await t.env.data.logs.create(e.tenant.id,W),t.html(Su(A,JSON.stringify({error:"login_required",error_description:H,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 $();t.set("user_id",n.user_id);const R=await h.data.users.get(e.tenant.id,n.user_id);if(!R)return console.error("User not found",n.user_id),$("User not found");t.set("username",R.email),t.set("connection",R.connection);const D={client:e,authParams:{client_id:e.id,audience:u,code_challenge_method:a,code_challenge:l,scope:d,state:i,nonce:s,response_type:p,redirect_uri:r},user:R,session_id:n.id},x=p===nn.CODE?await N_(t,{user:R,client:e,authParams:D.authParams,login_id:n.login_session_id}):await Tc(t,D);await h.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()+Nc*1e3).toISOString():void 0});const M=Ue(t,{type:Le.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,M);const G=new Headers;G.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const F=Na(e.tenant.id,n.id,t.req.header("host"));return G.set("set-cookie",F),t.html(Su(A,JSON.stringify({...x,state:i})),{headers:G})}const EE=["email","sms","Username-Password-Authentication"],SE=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),vendor_id:o.z.string().optional(),redirect_uri:o.z.string(),scope:o.z.string().optional(),state:o.z.string(),prompt:o.z.string().optional(),response_mode:o.z.nativeEnum(En).optional(),response_type:o.z.nativeEnum(nn).optional(),audience:o.z.string().optional(),connection:o.z.string().optional(),nonce:o.z.string().optional(),max_age:o.z.string().optional(),login_ticket:o.z.string().optional(),code_challenge_method:o.z.nativeEnum($c).optional(),code_challenge:o.z.string().optional(),realm:o.z.string().optional(),auth0Client:o.z.string().optional(),organization:o.z.string().optional(),login_hint:o.z.string().optional(),screen_hint:o.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:o.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:o.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:gp}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:o.z.object({Location:o.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:o.z.object({message:o.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:s,state:a,audience:l,nonce:u,connection:d,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,prompt:$,login_ticket:I,realm:R,auth0Client:D,login_hint:x,ui_locales:M,organization:G}=t.req.valid("query");t.set("log","authorize");const F=await os(e,n);t.set("client_id",F.id),t.set("tenant_id",F.tenant.id);const H={redirect_uri:i.split("#")[0],scope:s,state:a,client_id:n,vendor_id:r,audience:l,nonce:u,prompt:$,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,username:x,ui_locales:M,organization:G},W=t.req.header("origin");if(W&&!vE(W,F.web_origins||[]))throw new N(403,{message:`Origin ${W} not allowed`});if(H.redirect_uri){const j=F.callbacks||[];if(t.var.host&&(j.push(`${_f(t.env)}/*`),j.push(`${kt(t.env)}/*`)),!M1(H.redirect_uri,j,{allowPathWildcards:!0}))throw new N(400,{message:`Invalid redirect URI - ${H.redirect_uri}`})}const Y=Is(F.tenant.id,t.req.header("cookie")),ue=Y?await e.data.sessions.get(F.tenant.id,Y):void 0,Ce=ue&&!ue.revoked_at?ue:void 0;if($=="none"){if(!p)throw new N(400,{message:"Missing response_type"});return AE({ctx:t,session:Ce||void 0,redirect_uri:i,state:a,response_type:p,client:F,nonce:u,code_challenge_method:A,code_challenge:g,audience:l,scope:s})}if(F.connections.length===1&&F.connections[0]&&!EE.includes(F.connections[0].strategy||""))return sg(t,F,F.connections[0].name,H);if(d&&d!=="email")return sg(t,F,d,H);if(I){const j=await $E(t,F.tenant.id,I,H,R);return j instanceof Response?j:t.json(j)}const P=await bE({ctx:t,client:F,auth0Client:D,authParams:H,session:Ce||void 0,connection:d,login_hint:x});return P instanceof Response?P:t.json(P)});function kE(t){const e=new o.OpenAPIHono;e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=t.dataAdapter.cache||Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(s,{defaultTtl:l,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}),e.use("/oauth/token",wm({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(El).use(Al).use(mf(e));const n=e.route("/v2/logout",W$).route("/userinfo",X$).route("/.well-known",J$).route("/oauth/token",fE).route("/dbconnections",mE).route("/passwordless",_E).route("/co/authenticate",wE).route("/authorize",SE).route("/callback",K$);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),gf(n),n}var iy=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const s=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let a=0,l=s.length;a<l;a++){const u=s[a];if(typeof u=="string")hr(u,n);else if(typeof u=="number")n[0]+=u;else{if(typeof u=="boolean"||u===null||u===void 0)continue;if(typeof u=="object"&&u.isEscaped)if(u.callbacks)n.unshift("",u);else{const d=u.toString();d instanceof Promise?n.unshift("",d):n[0]+=d}else u instanceof Promise?n.unshift("",u):hr(u.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?cn(O1(cn(n[0],n.callbacks))):cn(n[0]):I1(n,n.callbacks)},Of=Symbol("RENDERER"),ep=Symbol("ERROR_HANDLER"),Ke=Symbol("STASH"),sy=Symbol("INTERNAL"),NE=Symbol("MEMO"),fc=Symbol("PERMALINK"),Rg=t=>(t[sy]=!0,t),oy=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:Rg(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:Rg(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[ep]=s=>{throw t.pop(),s},i},ay=t=>{const e=[t],n=oy(e);return n.values=e,n.Provider=n,Ui.push(n),n},Ui=[],cy=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new py("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(s=>cn(s,s.callbacks)):cn(i)};return n.values=e,n.Provider=n,n[Of]=oy(e),Ui.push(n),n},cs=t=>t.values.at(-1),la={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},tp={},ua="data-precedence",So=t=>Array.isArray(t)?t:[t],Pg=new WeakMap,Bg=(t,e,n,r)=>({buffer:i,context:s})=>{if(!i)return;const a=Pg.get(s)||{};Pg.set(s,a);const l=a[t]||(a[t]=[]);let u=!1;const d=la[t];if(d.length>0){e:for(const[,p]of l)for(const h of d)if(((p==null?void 0:p[h])??null)===(n==null?void 0:n[h])){u=!0;break e}}if(u?i[0]=i[0].replaceAll(e,""):d.length>0?l.push([e,n,r]):l.unshift([e,n,r]),i[0].indexOf("</head>")!==-1){let p;if(r===void 0)p=l.map(([h])=>h);else{const h=[];p=l.map(([g,,A])=>{let $=h.indexOf(A);return $===-1&&(h.push(A),$=h.length-1),[g,$]}).sort((g,A)=>g[1]-A[1]).map(([g])=>g)}p.forEach(h=>{i[0]=i[0].replaceAll(h,"")}),i[0]=i[0].replace(/(?=<\/head>)/,p.join(""))}},ko=(t,e,n)=>cn(new ln(t,n,So(e??[])).toString()),No=(t,e,n,r)=>{if("itemProp"in n)return ko(t,e,n);let{precedence:i,blocking:s,...a}=n;i=r?i??"":void 0,r&&(a[ua]=i);const l=new ln(t,a,So(e||[])).toString();return l instanceof Promise?l.then(u=>cn(l,[...u.callbacks||[],Bg(t,u,a,i)])):cn(l,[Bg(t,l,a,i)])},CE=({children:t,...e})=>{const n=zf();if(n){const r=cs(n);if(r==="svg"||r==="head")return new ln("title",e,So(t??[]))}return No("title",t,e,!1)},TE=({children:t,...e})=>{const n=zf();return["src","async"].some(r=>!e[r])||n&&cs(n)==="head"?ko("script",t,e):No("script",t,e,!1)},IE=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,No("style",t,e,!0)):ko("style",t,e),OE=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?ko("link",t,e):No("link",t,e,"precedence"in e),zE=({children:t,...e})=>{const n=zf();return n&&cs(n)==="head"?ko("meta",t,e):No("meta",t,e,!1)},ly=(t,{children:e,...n})=>new ln(t,n,So(e??[])),DE=t=>(typeof t.action=="function"&&(t.action=fc in t.action?t.action[fc]:void 0),ly("form",t)),uy=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=fc in e.formAction?e.formAction[fc]:void 0),ly(t,e)),RE=t=>uy("input",t),PE=t=>uy("button",t);const iu=Object.freeze(Object.defineProperty({__proto__:null,button:PE,form:DE,input:RE,link:OE,meta:zE,script:TE,style:IE,title:CE},Symbol.toStringTag,{value:"Module"}));var BE=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),hc=t=>BE.get(t)||t,dy=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,s=>`-${s.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)}},Xs=void 0,zf=()=>Xs,jE=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,LE=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],FE=["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"],Df=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")hr(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof ln?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):Df(i,e)}}},ln=class{constructor(t,e,n){be(this,"tag");be(this,"props");be(this,"key");be(this,"children");be(this,"isEscaped",!0);be(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?O1(cn(t[0],t.callbacks)).toString():t[0]:I1(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=Xs&&cs(Xs)==="svg"?s=>jE(hc(s)):s=>hc(s);for(let[s,a]of Object.entries(n))if(s=i(s),s!=="children"){if(s==="style"&&typeof a=="object"){let l="";dy(a,(u,d)=>{d!=null&&(l+=`${l?";":""}${u}:${d}`)}),t[0]+=' style="',hr(l,t),t[0]+='"'}else if(typeof a=="string")t[0]+=` ${s}="`,hr(a,t),t[0]+='"';else if(a!=null)if(typeof a=="number"||a.isEscaped)t[0]+=` ${s}="${a}"`;else if(typeof a=="boolean"&&FE.includes(s))a&&(t[0]+=` ${s}=""`);else if(s==="dangerouslySetInnerHTML"){if(r.length>0)throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");r=[cn(a.__html)]}else if(a instanceof Promise)t[0]+=` ${s}="`,t.unshift('"',a);else if(typeof a=="function"){if(!s.startsWith("on")&&s!=="ref")throw new Error(`Invalid prop '${s}' of type 'function' supplied to '${e}'.`)}else t[0]+=` ${s}="`,hr(a.toString(),t),t[0]+='"'}if(LE.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",Df(r,t),t[0]+=`</${e}>`}},su=class extends ln{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(Ui.length===0)t.unshift("",n);else{const r=Ui.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof ln&&(i.localContexts=r),i)))}else n instanceof ln?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):hr(n,t)}},py=class extends ln{toStringToBuffer(t){Df(this.children,t)}},UE=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=da(t,e,n);return i.key=r,i},jg=!1,da=(t,e,n)=>{if(!jg){for(const r in tp)iu[r][Of]=tp[r];jg=!0}return typeof t=="function"?new su(t,e,n):iu[t]?new su(iu[t],e,n):t==="svg"||t==="head"?(Xs||(Xs=cy("")),new ln(t,e,[new su(Xs,{value:t},n)])):new ln(t,e,n)},Rf=({children:t})=>new py("",{children:t},Array.isArray(t)?t:t?[t]:[]),ME=(t,e,...n)=>{let r;if(n.length>0)r=n;else{const i=t.props.children;r=Array.isArray(i)?i:[i]}return UE(t.tag,{...t.props,...e},...r)};function w(t,e,n){let r;if(!e||!("children"in e))r=da(t,e,[]);else{const i=e.children;r=Array.isArray(i)?da(t,e,i):da(t,e,[i])}return r.key=n,r}async function Ge(t,e,n=!1){var p;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new N(400,{message:"Login session not found"});t.set("loginSession",i);const s=await os(r,i.authParams.client_id);t.set("client_id",s.id),t.set("tenant_id",s.tenant.id);const a=await r.data.tenants.get(s.tenant.id);if(a){if(i.session_id&&!n){if(!i.authParams.redirect_uri)throw new N(400,{message:"Login session closed and no redirect URI available"});const h=new URL(i.authParams.redirect_uri);throw h.searchParams.set("error","access_denied"),h.searchParams.set("error_description","Login session closed"),i.authParams.state&&h.searchParams.set("state",i.authParams.state),new as(h.toString(),302)}}else throw new N(400,{message:"Tenant not found"});const l=await r.data.themes.get(a.id,"default"),u=await r.data.branding.get(a.id),d=(p=i.authParams.ui_locales)==null?void 0:p.split(" ").map(h=>h.split("-")[0]).find(h=>{if(Array.isArray(L.options.supportedLngs))return L.options.supportedLngs.includes(h)});return await L.changeLanguage(d||a.language||"sv"),{theme:l,branding:u,client:s,tenant:a,loginSession:i}}async function Js(t,e){const{env:n}=t,r=await os(n,e);t.set("client_id",r.id),t.set("tenant_id",r.tenant.id);const i=Is(r.tenant.id,t.req.header("cookie"));if(!i){const d=new URL(st(t.env));throw d.pathname="/authorize",d.searchParams.set("client_id",r.id),d.searchParams.set("redirect_uri",t.req.url),d.searchParams.set("state",qe()),new as(d.toString())}const s=await n.data.sessions.get(t.var.tenant_id||"",i);if(!s)throw new N(400,{message:"Session not found"});const[a,l,u]=await Promise.all([n.data.themes.get(r.tenant.id,"default"),n.data.branding.get(r.tenant.id),n.data.users.get(r.tenant.id,s.user_id)]);if(!u)throw new N(400,{message:"User not found"});return{theme:a,branding:l,client:r,user:u}}async function qE(t,e,n,r){if(r!==void 0)return r==="password";const i=await Ep({userAdapter:t.env.data.users,tenant_id:e.tenant.id,email:n});return i!=null&&i.app_metadata.strategy?i.app_metadata.strategy==="Username-Password-Authentication":(await t.env.data.promptSettings.get(e.tenant.id)).password_first}const fy=({theme:t,branding:e})=>{var r;const n=((r=t==null?void 0:t.widget)==null?void 0:r.logo_url)||(e==null?void 0:e.logo_url);return n?w("div",{className:"flex h-9 items-center",children:w("img",{src:n,className:"max-h-full",alt:"Logo"})}):w(Rf,{})},hy=t=>{var e,n;return w("div",{className:"mt-8",children:((n=(e=t.client)==null?void 0:e.client_metadata)==null?void 0:n.termsAndConditionsUrl)&&w("div",{className:"text-xs text-gray-300",children:[L.t("agree_to")," ",w("a",{href:t.client.client_metadata.termsAndConditionsUrl,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:L.t("terms")})]})})};var gy={exports:{}};/*!
198
198
  Copyright (c) 2018 Jed Watson.
199
199
  Licensed under the MIT License (MIT), see
200
200
  http://jedwatson.github.io/classnames
@@ -227,7 +227,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
227
227
  <\/script>
228
228
  `])))]})},er=({children:t})=>w("div",{className:"mb-2 text-sm text-red",children:t}),YE=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",my=({size:t})=>{const e=YE(t);return w("div",{className:"relative inline-block leading-[0]",children:[w(et,{className:Gn("text-gray-200 dark:text-[#201a41]",{[e]:e}),name:"spinner-circle"}),w(et,{className:Gn("absolute inset-0 animate-spin text-primary",{[e]:e}),name:"spinner-inner"})]})},tt=({children:t,className:e,Component:n="button",variant:r="primary",href:i,disabled:s,isLoading:a,id:l})=>{const u=n==="a"?{href:i}:{};return w(n,{class:Gn("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":s,"is-loading":a},"focus:outline-none focus:ring",e),type:"submit",disabled:s,id:l,...u,children:[w("span",{className:"btn-label flex items-center justify-center space-x-2",children:t}),w("div",{className:"btn-spinner absolute left-0 top-0 flex h-full w-full items-center justify-center",children:w(my,{size:"medium"})})]})},ys=({connection:t,text:e,icon:n=null,canResize:r=!1,loginSession:i})=>{const s=new URLSearchParams({client_id:i.authParams.client_id,connection:t});i.authParams.response_type&&s.set("response_type",i.authParams.response_type),i.authParams.redirect_uri&&s.set("redirect_uri",i.authParams.redirect_uri),i.authParams.scope&&s.set("scope",i.authParams.scope),i.authParams.nonce&&s.set("nonce",i.authParams.nonce),i.authParams.response_type&&s.set("response_type",i.authParams.response_type),i.authParams.state&&s.set("state",i.id);const a=`/authorize?${s.toString()}`;return w(tt,{className:Gn("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||"",w("div",{className:Gn("text-left text-black dark:text-white sm:text-base",{"hidden sm:inline short:hidden":r}),children:e})]})},_y=({...t})=>w("svg",{width:"45",height:"45",viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",...t,children:[w("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"}),w("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"}),w("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"}),w("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"})]}),zn=({children:t,className:e})=>w("form",{id:"form",method:"post",className:e,children:t}),yy=({...t})=>w("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:[w("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"}),w("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
229
229
  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
230
- 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`})]}),pa=({error:t,theme:e,branding:n,loginSession:r,email:i,client:s})=>{const a=s.connections.map(({strategy:G})=>G),l=a.includes("email")||a.includes("Username-Password-Authentication"),u=a.includes("sms"),d=a.includes("facebook"),p=a.includes("google-oauth2"),h=a.includes("apple"),g=a.includes("vipps"),A=d||p||h||g,$=l||u;let I="text",R="username";const D=l&&u?"email_or_phone_placeholder":l?"email_placeholder":"phone_placeholder";let x=L.t(D,l&&u?"Email or Phone Number":l?"Email Address":"Phone Number");return w(nt,{title:L.t("welcome"),theme:e,branding:n,client:s,children:[w("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:L.t("welcome")}),w("div",{className:"mb-8 text-gray-300",children:L.t("login_description_template",{authMethod:L.t(D,{defaultValue:l&&u?"email or phone number":l?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),w("div",{className:"flex flex-1 flex-col justify-center",children:[$&&w(zn,{className:"mb-7",children:[w("input",{type:I,name:R,placeholder:x,className:Gn("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:i||""}),t&&w(er,{children:t}),w(tt,{className:"sm:mt-4 !text-base",children:[w("span",{children:L.t("continue")}),w(et,{className:"text-xs",name:"arrow-right"})]})]}),$&&A&&w("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[w("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),w("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:L.t("continue_social_login")})]}),w("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&&w(ys,{connection:"facebook",text:L.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:w(et,{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:r}),p&&w(ys,{connection:"google-oauth2",text:L.t("continue_with",{provider:"Google"}),canResize:!0,icon:w(_y,{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:r}),h&&w(ys,{connection:"apple",text:L.t("continue_with",{provider:"Apple"}),canResize:!0,icon:w(et,{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:r}),g&&w(ys,{connection:"vipps",text:L.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:w(yy,{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:r})]})]})]})},ZE=new o.OpenAPIHono().openapi(o.createRoute({tags:["login"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:o.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,loginSession:i,client:s}=await Ge(t,e);return t.html(w(pa,{theme:n,branding:r,loginSession:i,client:s,email:i.authParams.username}))}).openapi(o.createRoute({tags:["login"],method:"post",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({username:o.z.string().transform(t=>t.toLowerCase()),login_selection:o.z.enum(["code","password"]).optional()})}}}},responses:{400:{description:"Error response"},302:{description:"Redirect to enter code or password"}}}),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:s,theme:a,branding:l}=await Ge(t,n);t.set("client_id",i.id);const u=t.get("countryCode"),{normalized:d,connectionType:p}=Tl(r.username,u);if(!i.connections.find(R=>R.strategy===p)||!d)return t.html(w(pa,{theme:a,branding:l,loginSession:s,error:L.t("invalid_identifier"),email:r.username,client:i}),400);const h=await Os({userAdapter:e.data.users,tenant_id:i.tenant.id,username:d,provider:p});if(h&&t.set("user_id",h.user_id),!h)try{await d3(t,i,t.env.data,d)}catch{const R=Ue(t,{type:Le.FAILED_SIGNUP,description:"Public signup is disabled"});return Bt(t,t.env.data.logs.create(i.tenant.id,R)),t.html(w(pa,{theme:a,branding:l,loginSession:s,error:L.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(s.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,s.id,s),await qE(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let g=vr(),A=await e.data.codes.get(i.tenant.id,g,"otp");for(;A;)g=vr(),A=await e.data.codes.get(i.tenant.id,g,"otp");const $=await t.env.data.codes.create(i.tenant.id,{code_id:g,code_type:"otp",login_id:s.id,expires_at:new Date(Date.now()+ta).toISOString(),redirect_uri:s.authParams.redirect_uri}),I=i.connections.find(R=>R.strategy===p);if(!I)throw new N(400,{message:L.t("connection_not_found",{connection:p})});return p==="email"&&I.options.authentication_method==="magic_link"?await Tf(t,{to:d,code:$.code_id,authParams:s.authParams}):await Cf(t,{to:d,code:$.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),hn=t=>w("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:L.t("go_back")});var Ys="_hp",QE={Change:"Input",DoubleClick:"DblClick"},e8={svg:"2000/svg",math:"1998/Math/MathML"},Zs=[],np=new WeakMap,Mi=void 0,t8=()=>Mi,Bn=t=>"t"in t,ou={onClick:["click",!1]},Ug=t=>{if(!t.startsWith("on"))return;if(ou[t])return ou[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return ou[t]=[(QE[n]||n).toLowerCase(),!!r]}},Mg=(t,e)=>Mi&&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,n8=(t,e,n)=>{var r;e||(e={});for(let i in e){const s=e[i];if(i!=="children"&&(!n||n[i]!==s)){i=hc(i);const a=Ug(i);if(a){if((n==null?void 0:n[i])!==s&&(n&&t.removeEventListener(a[0],n[i],a[1]),s!=null)){if(typeof s!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(a[0],s,a[1])}}else if(i==="dangerouslySetInnerHTML"&&s)t.innerHTML=s.__html;else if(i==="ref"){let l;typeof s=="function"?l=s(t)||(()=>s(null)):s&&"current"in s&&(s.current=t,l=()=>s.current=null),np.set(t,l)}else if(i==="style"){const l=t.style;typeof s=="string"?l.cssText=s:(l.cssText="",s!=null&&dy(s,l.setProperty.bind(l)))}else{if(i==="value"){const u=t.nodeName;if(u==="INPUT"||u==="TEXTAREA"||u==="SELECT"){if(t.value=s==null||s===!1?null:s,u==="TEXTAREA"){t.textContent=s;continue}else if(u==="SELECT"){t.selectedIndex===-1&&(t.selectedIndex=0);continue}}}else(i==="checked"&&t.nodeName==="INPUT"||i==="selected"&&t.nodeName==="OPTION")&&(t[i]=s);const l=Mg(t,i);s==null||s===!1?t.removeAttribute(l):s===!0?t.setAttribute(l,""):typeof s=="string"||typeof s=="number"?t.setAttribute(l,s):t.setAttribute(l,s.toString())}}}if(n)for(let i in n){const s=n[i];if(i!=="children"&&!(i in e)){i=hc(i);const a=Ug(i);a?t.removeEventListener(a[0],s,a[1]):i==="ref"?(r=np.get(t))==null||r():t.removeAttribute(Mg(t,i))}}},r8=(t,e)=>{e[Ke][0]=0,Zs.push([t,e]);const n=e.tag[Of]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{Zs.pop()}},wy=(t,e,n,r,i)=>{var s,a;(s=t.vR)!=null&&s.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((a=t[Ke][1][$y])==null||a.forEach(l=>i.push(l))),t.vC.forEach(l=>{var u;if(Bn(l))n.push(l);else if(typeof l.tag=="function"||l.tag===""){l.c=e;const d=n.length;if(wy(l,e,n,r,i),l.s){for(let p=d;p<n.length;p++)n[p].s=!0;l.s=!1}}else n.push(l),(u=l.vR)!=null&&u.length&&(r.push(...l.vR),delete l.vR)})},i8=t=>{for(;;t=t.tag===Ys||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==Ys&&t.e)return t.e}},vy=t=>{var e,n,r,i,s,a;Bn(t)||((n=(e=t[Ke])==null?void 0:e[1][$y])==null||n.forEach(l=>{var u;return(u=l[2])==null?void 0:u.call(l)}),(r=np.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(l=>l.p=2)),(s=t.vC)==null||s.forEach(vy)),t.p||((a=t.e)==null||a.remove(),delete t.e),typeof t.tag=="function"&&(ws.delete(t),fa.delete(t),delete t[Ke][3],t.a=!0)},by=(t,e,n)=>{t.c=e,xy(t,e,n)},qg=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},Vg=Symbol(),xy=(t,e,n)=>{var d;const r=[],i=[],s=[];wy(t,e,r,i,s),i.forEach(vy);const a=n?void 0:e.childNodes;let l,u=null;if(n)l=-1;else if(!a.length)l=0;else{const p=qg(a,i8(t.nN));p!==void 0?(u=a[p],l=p):l=qg(a,(d=r.find(h=>h.tag!==Ys&&h.e))==null?void 0:d.e)??-1,l===-1&&(n=!0)}for(let p=0,h=r.length;p<h;p++,l++){const g=r[p];let A;if(g.s&&g.e)A=g.e,g.s=!1;else{const $=n||!g.e;Bn(g)?(g.e&&g.d&&(g.e.textContent=g.t),g.d=!1,A=g.e||(g.e=document.createTextNode(g.t))):(A=g.e||(g.e=g.n?document.createElementNS(g.n,g.tag):document.createElement(g.tag)),n8(A,g.props,g.pP),xy(g,A,$))}g.tag===Ys?l--:n?A.parentNode||e.appendChild(A):a[l]!==A&&a[l-1]!==A&&(a[l+1]===A?e.appendChild(a[l]):e.insertBefore(A,u||a[l]||null))}if(t.pP&&delete t.pP,s.length){const p=[],h=[];s.forEach(([,g,,A,$])=>{g&&p.push(g),A&&h.push(A),$==null||$()}),p.forEach(g=>g()),h.length&&requestAnimationFrame(()=>{h.forEach(g=>g())})}},s8=(t,e)=>!!(t&&t.length===e.length&&t.every((n,r)=>n[1]===e[r][1])),fa=new WeakMap,rp=(t,e,n)=>{var s,a,l,u,d,p;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?r8(t,e):So(e.props.children)),((s=n[0])==null?void 0:s.tag)===""&&n[0][ep]&&(i=n[0][ep],t[5].push([t,i,e]));const h=r?[...e.pC]:e.vC?[...e.vC]:void 0,g=[];let A;for(let $=0;$<n.length;$++){Array.isArray(n[$])&&n.splice($,1,...n[$].flat());let I=o8(n[$]);if(I){typeof I.tag=="function"&&!I.tag[sy]&&(Ui.length>0&&(I[Ke][2]=Ui.map(D=>[D,D.values.at(-1)])),(a=t[5])!=null&&a.length&&(I[Ke][3]=t[5].at(-1)));let R;if(h&&h.length){const D=h.findIndex(Bn(I)?x=>Bn(x):I.key!==void 0?x=>x.key===I.key&&x.tag===I.tag:x=>x.tag===I.tag);D!==-1&&(R=h[D],h.splice(D,1))}if(R)if(Bn(I))R.t!==I.t&&(R.t=I.t,R.d=!0),I=R;else{const D=R.pP=R.props;if(R.props=I.props,R.f||(R.f=I.f||e.f),typeof I.tag=="function"){const x=R[Ke][2];R[Ke][2]=I[Ke][2]||[],R[Ke][3]=I[Ke][3],!R.f&&((R.o||R)===I.o||(u=(l=R.tag)[NE])!=null&&u.call(l,D,R.props))&&s8(x,R[Ke][2])&&(R.s=!0)}I=R}else if(!Bn(I)&&Mi){const D=cs(Mi);D&&(I.n=D)}if(!Bn(I)&&!I.s&&(rp(t,I),delete I.f),g.push(I),A&&!A.s&&!I.s)for(let D=A;D&&!Bn(D);D=(d=D.vC)==null?void 0:d.at(-1))D.nN=I;A=I}}e.vR=r?[...e.vC,...h||[]]:h||[],e.vC=g,r&&delete e.pC}catch(h){if(e.f=!0,h===Vg){if(i)return;throw h}const[g,A,$]=((p=e[Ke])==null?void 0:p[3])||[];if(A){const I=()=>ha([0,!1,t[2]],$),R=fa.get($)||[];R.push(I),fa.set($,R);const D=A(h,()=>{const x=fa.get($);if(x){const M=x.indexOf(I);if(M!==-1)return x.splice(M,1),I()}});if(D){if(t[0]===1)t[1]=!0;else if(rp(t,$,[D]),(A.length===1||t!==g)&&$.c){by($,$.c,!1);return}throw Vg}}throw h}finally{i&&t[5].pop()}},o8=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[Ke]=[0,[]];else{const e=e8[t.tag];e&&(Mi||(Mi=ay("")),t.props.children=[{tag:Mi,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},Hg=(t,e)=>{var n,r;(n=e[Ke][2])==null||n.forEach(([i,s])=>{i.values.push(s)});try{rp(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Ke][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&by(e,e.c,!1)},ws=new WeakMap,Kg=[],ha=async(t,e)=>{t[5]||(t[5]=[]);const n=ws.get(e);n&&n[0](void 0);let r;const i=new Promise(s=>r=s);if(ws.set(e,[r,()=>{t[2]?t[2](t,e,s=>{Hg(s,e)}).then(()=>r(e)):(Hg(t,e),r(e))}]),Kg.length)Kg.at(-1).add(e);else{await Promise.resolve();const s=ws.get(e);s&&(ws.delete(e),s[1]())}return i},a8=(t,e,n)=>({tag:Ys,props:{children:t},key:n,e,p:1}),au=0,$y=1,cu=2,lu=3,uu=new WeakMap,Ay=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),c8=void 0,Gg=[],l8=t=>{var a;const e=()=>typeof t=="function"?t():t,n=Zs.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(a=r[Ke][1])[au]||(a[au]=[]),s=r[Ke][0]++;return i[s]||(i[s]=[e(),l=>{const u=c8,d=i[s];if(typeof l=="function"&&(l=l(d[0])),!Object.is(l,d[0]))if(d[0]=l,Gg.length){const[p,h]=Gg.at(-1);Promise.all([p===3?r:ha([p,!1,u],r),h]).then(([g])=>{if(!g||!(p===2||p===3))return;const A=g.vC;requestAnimationFrame(()=>{setTimeout(()=>{A===g.vC&&ha([p===3?1:0,!1,u],g)})})})}else ha([0,!1,u],r)}])},Pf=(t,e)=>{var l;const n=Zs.at(-1);if(!n)return t;const[,r]=n,i=(l=r[Ke][1])[cu]||(l[cu]=[]),s=r[Ke][0]++,a=i[s];return Ay(a==null?void 0:a[1],e)?i[s]=[t,e]:t=i[s][0],t},u8=t=>{const e=uu.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>uu.set(t,[n]),n=>uu.set(t,[void 0,n])),t},d8=(t,e)=>{var l;const n=Zs.at(-1);if(!n)return t();const[,r]=n,i=(l=r[Ke][1])[lu]||(l[lu]=[]),s=r[Ke][0]++,a=i[s];return Ay(a==null?void 0:a[1],e)&&(i[s]=[t(),e]),i[s][0]},p8=ay({pending:!1,data:null,method:null,action:null}),Wg=new Set,f8=t=>{Wg.add(t),t.finally(()=>Wg.delete(t))},Bf=(t,e)=>d8(()=>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]),di=Object.create(null),Ho=Object.create(null),Co=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const s=document.head;let{onLoad:a,onError:l,precedence:u,blocking:d,...p}=e,h=null,g=!1;const A=la[t];let $;if(A.length>0){const x=s.querySelectorAll(t);e:for(const M of x)for(const G of la[t])if(M.getAttribute(G)===e[G]){h=M;break e}if(!h){const M=A.reduce((G,F)=>e[F]===void 0?G:`${G}-${F}-${e[F]}`,t);g=!Ho[M],h=Ho[M]||(Ho[M]=(()=>{const G=document.createElement(t);for(const F of A)e[F]!==void 0&&G.setAttribute(F,e[F]),e.rel&&G.setAttribute("rel",e.rel);return G})())}}else $=s.querySelectorAll(t);u=r?u??"":void 0,r&&(p[ua]=u);const I=Pf(x=>{if(A.length>0){let M=!1;for(const G of s.querySelectorAll(t)){if(M&&G.getAttribute(ua)!==u){s.insertBefore(x,G);return}G.getAttribute(ua)===u&&(M=!0)}s.appendChild(x)}else if($){let M=!1;for(const G of $)if(G===x){M=!0;break}M||s.insertBefore(x,s.contains($[0])?$[0]:s.querySelector(t)),$=void 0}},[u]),R=Bf(e.ref,x=>{var F;const M=A[0];if(n===2&&(x.innerHTML=""),(g||$)&&I(x),!l&&!a)return;let G=di[F=x.getAttribute(M)]||(di[F]=new Promise((H,X)=>{x.addEventListener("load",H),x.addEventListener("error",X)}));a&&(G=G.then(a)),l&&(G=G.catch(l)),G.catch(()=>{})});if(i&&d==="render"){const x=la[t][0];if(e[x]){const M=e[x],G=di[M]||(di[M]=new Promise((F,H)=>{I(h),h.addEventListener("load",F),h.addEventListener("error",H)}));u8(G)}}const D={tag:t,type:t,props:{...p,ref:R},ref:R};return D.p=n,h&&(D.e=h),a8(D,s)},h8=t=>{const e=t8(),n=e&&cs(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:Co("title",t,void 0,!1,!1)},g8=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:Co("script",t,1,!1,!0),m8=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,Co("style",t,2,!0,!0)),_8=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}:Co("link",t,1,"precedence"in t,!0),y8=t=>Co("meta",t,void 0,!1,!1),Ey=Symbol(),w8=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=l8([null,!1]),s=Pf(async d=>{const p=d.isTrusted?e:d.detail[Ey];if(typeof p!="function")return;d.preventDefault();const h=new FormData(d.target);i([h,!0]);const g=p(h);g instanceof Promise&&(f8(g),await g),i([null,!0])},[]),a=Bf(t.ref,d=>(d.addEventListener("submit",s),()=>{d.removeEventListener("submit",s)})),[l,u]=r;return r[1]=!1,{tag:p8,props:{value:{pending:l!==null,data:l,method:l?"post":null,action:l?e:null},children:{tag:"form",props:{...n,ref:a},type:"form",ref:a}},f:u}},Sy=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=Pf(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[Ey]:e}}))},[]);n.ref=Bf(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},v8=t=>Sy("input",t),b8=t=>Sy("button",t);Object.assign(tp,{title:h8,script:g8,style:m8,link:_8,meta:y8,form:w8,input:v8,button:b8});cy(null);new TextEncoder;const qi=t=>{const{i18nKey:e,values:n,components:r}=t,i=L.t(e,n),s=/<(\d+)>(.*?)<\/\d+>/g,a=[];let l=0,u;for(;(u=s.exec(i))!==null;){const[,d,p]=u,h=i.substring(l,u.index);h&&a.push(h);const g=parseInt(d,10);a.push(ME(r[g],{},p)),l=s.lastIndex}return l<i.length&&a.push(i.substring(l)),w(Rf,{children:a})},Xg=6,ip=({error:t,theme:e,branding:n,email:r,state:i,client:s,hasPasswordLogin:a})=>{const l=new URLSearchParams({state:i}),d=s.connections.map(({name:p})=>p).includes("auth2");return w(nt,{title:L.t("verify_your_email"),theme:e,branding:n,client:s,children:[w("div",{className:"mb-4 text-2xl font-medium",children:L.t("verify_your_email")}),w("div",{className:"mb-8 text-gray-300",children:w(qi,{i18nKey:"code_sent_template",components:[w("span",{className:"text-black dark:text-white"},"span")],values:{username:r}})}),w("div",{className:"flex flex-1 flex-col justify-center",children:[w(zn,{className:"pt-2",children:[w("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Xg,inputMode:"numeric",name:"code",placeholder:"******",className:Gn("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:Xg,required:!0,id:"code-input"}),t&&w(er,{children:t}),w(tt,{className:"sm:mt-4 !text-base",children:[w("span",{children:L.t("login")}),w(et,{className:"text-xs",name:"arrow-right"})]}),w("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[w(et,{className:"text-base",name:"info-bubble"}),w("div",{className:"text-sm text-gray-300 md:text-sm",children:L.t("sent_code_spam")})]}),d&&w("div",{className:"text-center mb-12",children:[w("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[w("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),w("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:L.t("or")})]}),w(tt,{Component:"a",href:`/u/${a?"enter-password":"pre-signup"}?${l.toString()}`,variant:"secondary",className:"block",children:L.t("enter_your_password_btn")})]})]}),w(hn,{state:i})]})]})},br=t=>{const{message:e,theme:n,branding:r,client:i,pageTitle:s,state:a}=t;return w(nt,{title:"Login",theme:n,branding:r,client:i,children:[s?w("div",{className:"mb-6 text-gray-300",children:s}):"",w("div",{className:"flex flex-1 flex-col justify-center",children:e}),a?w(hn,{state:a}):""]})},x8=new o.OpenAPIHono().openapi(o.createRoute({tags:["login"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:o.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:o.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:o.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i,s;try{if({theme:n,branding:r,loginSession:i,client:s}=await Ge(t,e),!i.authParams.username)return t.html(w(br,{theme:n,branding:r,client:s,state:e,pageTitle:L.t("error_page_title")||"Error",message:L.t("username_not_found_error")||"Username not found in session."}),400);const a=await Os({userAdapter:t.env.data.users,tenant_id:s.tenant.id,username:i.authParams.username,provider:"auth2"});return t.html(w(ip,{theme:n,branding:r,email:i.authParams.username,state:e,client:s,hasPasswordLogin:!!a}))}catch(a){return console.error("Error in GET /u/enter-code:",a),r||(r=null),n||(n=null),s||(s=null),t.html(w(br,{theme:n,branding:r,client:s,state:e,pageTitle:L.t("error_page_title")||"Error",message:L.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(o.createRoute({tags:["login"],method:"post",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({code:o.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:o.z.object({Location:o.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:o.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:o.z.string()}}}}}),async t=>{var l;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{theme:r,branding:i,client:s,loginSession:a}=await Ge(t,e);if(!a.authParams.username)throw new N(400,{message:L.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",s.id);const u=await Ef(t,{client_id:s.id,authParams:a.authParams,username:a.authParams.username,otp:n});if(u instanceof Response)return u;throw new N(500,{message:L.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(u){let d;try{d=await Os({userAdapter:t.env.data.users,tenant_id:s.tenant.id,username:a.authParams.username,provider:"auth2"})}catch{d=null}return t.html(w(ip,{theme:r,branding:i,email:(l=a.authParams)==null?void 0:l.username,state:e,client:s,error:u.message,hasPasswordLogin:!!d}),400)}}),ky=t=>{const{theme:e,branding:n,client:r,state:i}=t;return w(nt,{title:L.t("unverified_email"),theme:e,branding:n,client:r,children:[w("div",{className:"flex flex-1 flex-col justify-center",children:[w("p",{className:"mb-8 text-gray-300 text-lg",children:L.t("unverified_email")}),w("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[w(et,{className:"text-base",name:"info-bubble"}),w("div",{className:"text-sm text-gray-300 md:text-sm",children:L.t("sent_code_spam")})]}),w(hn,{state:i})]}),w(hn,{state:i})]})},$8=({width:t=22,height:e=17})=>w("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:w("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"})}),A8=({width:t=23,height:e=18})=>w("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:w("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"})}),sp=({name:t,placeholder:e=L.t("password")})=>w("div",{className:"password-input relative mb-2",children:[w("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}),w("button",{type:"button","aria-label":L.t("show_password"),title:L.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:w($8,{})}),w("button",{type:"button","aria-label":L.t("hide_password"),title:L.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:w(A8,{})})]});var Jg=Object.freeze,E8=Object.defineProperty,S8=(t,e)=>Jg(E8(t,"raw",{value:Jg(t.slice())})),Yg;const ga=t=>{const{error:e,theme:n,branding:r,email:i,state:s,client:a}=t,l=new URLSearchParams({state:s});return w(nt,{title:L.t("enter_password"),theme:n,branding:r,client:a,children:[w("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:L.t("enter_password")}),w("div",{className:"mb-6 text-gray-300",children:L.t("enter_password_description")}),w("div",{className:"flex flex-1 flex-col justify-center",children:[w(zn,{className:"mb-7",children:[w("input",{type:"text",name:"username",placeholder:L.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:i}),w(sp,{name:"password"}),e&&w(er,{children:e}),w(tt,{className:"sm:mt-4 !text-base",children:[w("span",{children:L.t("login")}),w(et,{className:"text-xs",name:"arrow-right"})]})]}),w("a",{href:`/u/forgot-password?${l.toString()}`,className:"text-primary hover:underline mb-4",children:L.t("forgot_password_link")}),w("div",{className:"text-center mb-12",children:[w("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[w("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),w("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:L.t("or")})]}),w("form",{method:"post",action:`/u/login/identifier?${l.toString()}`,children:[w("input",{type:"hidden",name:"login_selection",value:"code"}),w("input",{type:"hidden",name:"username",value:i}),w(tt,{variant:"secondary",className:"block",children:L.t("enter_a_code_btn")})]})]}),w(hn,{state:s})]}),iy(Yg||(Yg=S8([`
230
+ 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`})]}),pa=({error:t,theme:e,branding:n,loginSession:r,email:i,client:s})=>{const a=s.connections.map(({strategy:G})=>G),l=a.includes("email")||a.includes("Username-Password-Authentication"),u=a.includes("sms"),d=a.includes("facebook"),p=a.includes("google-oauth2"),h=a.includes("apple"),g=a.includes("vipps"),A=d||p||h||g,$=l||u;let I="text",R="username";const D=l&&u?"email_or_phone_placeholder":l?"email_placeholder":"phone_placeholder";let x=L.t(D,l&&u?"Email or Phone Number":l?"Email Address":"Phone Number");return w(nt,{title:L.t("welcome"),theme:e,branding:n,client:s,children:[w("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:L.t("welcome")}),w("div",{className:"mb-8 text-gray-300",children:L.t("login_description_template",{authMethod:L.t(D,{defaultValue:l&&u?"email or phone number":l?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),w("div",{className:"flex flex-1 flex-col justify-center",children:[$&&w(zn,{className:"mb-7",children:[w("input",{type:I,name:R,placeholder:x,className:Gn("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:i||""}),t&&w(er,{children:t}),w(tt,{className:"sm:mt-4 !text-base",children:[w("span",{children:L.t("continue")}),w(et,{className:"text-xs",name:"arrow-right"})]})]}),$&&A&&w("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[w("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),w("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:L.t("continue_social_login")})]}),w("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&&w(ys,{connection:"facebook",text:L.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:w(et,{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:r}),p&&w(ys,{connection:"google-oauth2",text:L.t("continue_with",{provider:"Google"}),canResize:!0,icon:w(_y,{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:r}),h&&w(ys,{connection:"apple",text:L.t("continue_with",{provider:"Apple"}),canResize:!0,icon:w(et,{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:r}),g&&w(ys,{connection:"vipps",text:L.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:w(yy,{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:r})]})]})]})},ZE=new o.OpenAPIHono().openapi(o.createRoute({tags:["login"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:o.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,loginSession:i,client:s}=await Ge(t,e);return t.html(w(pa,{theme:n,branding:r,loginSession:i,client:s,email:i.authParams.username}))}).openapi(o.createRoute({tags:["login"],method:"post",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({username:o.z.string().transform(t=>t.toLowerCase()),login_selection:o.z.enum(["code","password"]).optional()})}}}},responses:{400:{description:"Error response"},302:{description:"Redirect to enter code or password"}}}),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:s,theme:a,branding:l}=await Ge(t,n);t.set("client_id",i.id);const u=t.get("countryCode"),{normalized:d,connectionType:p}=Tl(r.username,u);if(!i.connections.find(R=>R.strategy===p)||!d)return t.html(w(pa,{theme:a,branding:l,loginSession:s,error:L.t("invalid_identifier"),email:r.username,client:i}),400);const h=await Os({userAdapter:e.data.users,tenant_id:i.tenant.id,username:d,provider:p});if(h&&t.set("user_id",h.user_id),!h)try{await d3(t,i,t.env.data,d)}catch{const R=Ue(t,{type:Le.FAILED_SIGNUP,description:"Public signup is disabled"});return Bt(t,t.env.data.logs.create(i.tenant.id,R)),t.html(w(pa,{theme:a,branding:l,loginSession:s,error:L.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(s.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,s.id,s),await qE(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let g=vr(),A=await e.data.codes.get(i.tenant.id,g,"otp");for(;A;)g=vr(),A=await e.data.codes.get(i.tenant.id,g,"otp");const $=await t.env.data.codes.create(i.tenant.id,{code_id:g,code_type:"otp",login_id:s.id,expires_at:new Date(Date.now()+ta).toISOString(),redirect_uri:s.authParams.redirect_uri}),I=i.connections.find(R=>R.strategy===p);if(!I)throw new N(400,{message:L.t("connection_not_found",{connection:p})});return p==="email"&&I.options.authentication_method==="magic_link"?await Tf(t,{to:d,code:$.code_id,authParams:s.authParams}):await Cf(t,{to:d,code:$.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),hn=t=>w("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:L.t("go_back")});var Ys="_hp",QE={Change:"Input",DoubleClick:"DblClick"},e8={svg:"2000/svg",math:"1998/Math/MathML"},Zs=[],np=new WeakMap,Mi=void 0,t8=()=>Mi,Bn=t=>"t"in t,ou={onClick:["click",!1]},Ug=t=>{if(!t.startsWith("on"))return;if(ou[t])return ou[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return ou[t]=[(QE[n]||n).toLowerCase(),!!r]}},Mg=(t,e)=>Mi&&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,n8=(t,e,n)=>{var r;e||(e={});for(let i in e){const s=e[i];if(i!=="children"&&(!n||n[i]!==s)){i=hc(i);const a=Ug(i);if(a){if((n==null?void 0:n[i])!==s&&(n&&t.removeEventListener(a[0],n[i],a[1]),s!=null)){if(typeof s!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(a[0],s,a[1])}}else if(i==="dangerouslySetInnerHTML"&&s)t.innerHTML=s.__html;else if(i==="ref"){let l;typeof s=="function"?l=s(t)||(()=>s(null)):s&&"current"in s&&(s.current=t,l=()=>s.current=null),np.set(t,l)}else if(i==="style"){const l=t.style;typeof s=="string"?l.cssText=s:(l.cssText="",s!=null&&dy(s,l.setProperty.bind(l)))}else{if(i==="value"){const u=t.nodeName;if(u==="INPUT"||u==="TEXTAREA"||u==="SELECT"){if(t.value=s==null||s===!1?null:s,u==="TEXTAREA"){t.textContent=s;continue}else if(u==="SELECT"){t.selectedIndex===-1&&(t.selectedIndex=0);continue}}}else(i==="checked"&&t.nodeName==="INPUT"||i==="selected"&&t.nodeName==="OPTION")&&(t[i]=s);const l=Mg(t,i);s==null||s===!1?t.removeAttribute(l):s===!0?t.setAttribute(l,""):typeof s=="string"||typeof s=="number"?t.setAttribute(l,s):t.setAttribute(l,s.toString())}}}if(n)for(let i in n){const s=n[i];if(i!=="children"&&!(i in e)){i=hc(i);const a=Ug(i);a?t.removeEventListener(a[0],s,a[1]):i==="ref"?(r=np.get(t))==null||r():t.removeAttribute(Mg(t,i))}}},r8=(t,e)=>{e[Ke][0]=0,Zs.push([t,e]);const n=e.tag[Of]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{Zs.pop()}},wy=(t,e,n,r,i)=>{var s,a;(s=t.vR)!=null&&s.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((a=t[Ke][1][$y])==null||a.forEach(l=>i.push(l))),t.vC.forEach(l=>{var u;if(Bn(l))n.push(l);else if(typeof l.tag=="function"||l.tag===""){l.c=e;const d=n.length;if(wy(l,e,n,r,i),l.s){for(let p=d;p<n.length;p++)n[p].s=!0;l.s=!1}}else n.push(l),(u=l.vR)!=null&&u.length&&(r.push(...l.vR),delete l.vR)})},i8=t=>{for(;;t=t.tag===Ys||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==Ys&&t.e)return t.e}},vy=t=>{var e,n,r,i,s,a;Bn(t)||((n=(e=t[Ke])==null?void 0:e[1][$y])==null||n.forEach(l=>{var u;return(u=l[2])==null?void 0:u.call(l)}),(r=np.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(l=>l.p=2)),(s=t.vC)==null||s.forEach(vy)),t.p||((a=t.e)==null||a.remove(),delete t.e),typeof t.tag=="function"&&(ws.delete(t),fa.delete(t),delete t[Ke][3],t.a=!0)},by=(t,e,n)=>{t.c=e,xy(t,e,n)},qg=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},Vg=Symbol(),xy=(t,e,n)=>{var d;const r=[],i=[],s=[];wy(t,e,r,i,s),i.forEach(vy);const a=n?void 0:e.childNodes;let l,u=null;if(n)l=-1;else if(!a.length)l=0;else{const p=qg(a,i8(t.nN));p!==void 0?(u=a[p],l=p):l=qg(a,(d=r.find(h=>h.tag!==Ys&&h.e))==null?void 0:d.e)??-1,l===-1&&(n=!0)}for(let p=0,h=r.length;p<h;p++,l++){const g=r[p];let A;if(g.s&&g.e)A=g.e,g.s=!1;else{const $=n||!g.e;Bn(g)?(g.e&&g.d&&(g.e.textContent=g.t),g.d=!1,A=g.e||(g.e=document.createTextNode(g.t))):(A=g.e||(g.e=g.n?document.createElementNS(g.n,g.tag):document.createElement(g.tag)),n8(A,g.props,g.pP),xy(g,A,$))}g.tag===Ys?l--:n?A.parentNode||e.appendChild(A):a[l]!==A&&a[l-1]!==A&&(a[l+1]===A?e.appendChild(a[l]):e.insertBefore(A,u||a[l]||null))}if(t.pP&&delete t.pP,s.length){const p=[],h=[];s.forEach(([,g,,A,$])=>{g&&p.push(g),A&&h.push(A),$==null||$()}),p.forEach(g=>g()),h.length&&requestAnimationFrame(()=>{h.forEach(g=>g())})}},s8=(t,e)=>!!(t&&t.length===e.length&&t.every((n,r)=>n[1]===e[r][1])),fa=new WeakMap,rp=(t,e,n)=>{var s,a,l,u,d,p;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?r8(t,e):So(e.props.children)),((s=n[0])==null?void 0:s.tag)===""&&n[0][ep]&&(i=n[0][ep],t[5].push([t,i,e]));const h=r?[...e.pC]:e.vC?[...e.vC]:void 0,g=[];let A;for(let $=0;$<n.length;$++){Array.isArray(n[$])&&n.splice($,1,...n[$].flat());let I=o8(n[$]);if(I){typeof I.tag=="function"&&!I.tag[sy]&&(Ui.length>0&&(I[Ke][2]=Ui.map(D=>[D,D.values.at(-1)])),(a=t[5])!=null&&a.length&&(I[Ke][3]=t[5].at(-1)));let R;if(h&&h.length){const D=h.findIndex(Bn(I)?x=>Bn(x):I.key!==void 0?x=>x.key===I.key&&x.tag===I.tag:x=>x.tag===I.tag);D!==-1&&(R=h[D],h.splice(D,1))}if(R)if(Bn(I))R.t!==I.t&&(R.t=I.t,R.d=!0),I=R;else{const D=R.pP=R.props;if(R.props=I.props,R.f||(R.f=I.f||e.f),typeof I.tag=="function"){const x=R[Ke][2];R[Ke][2]=I[Ke][2]||[],R[Ke][3]=I[Ke][3],!R.f&&((R.o||R)===I.o||(u=(l=R.tag)[NE])!=null&&u.call(l,D,R.props))&&s8(x,R[Ke][2])&&(R.s=!0)}I=R}else if(!Bn(I)&&Mi){const D=cs(Mi);D&&(I.n=D)}if(!Bn(I)&&!I.s&&(rp(t,I),delete I.f),g.push(I),A&&!A.s&&!I.s)for(let D=A;D&&!Bn(D);D=(d=D.vC)==null?void 0:d.at(-1))D.nN=I;A=I}}e.vR=r?[...e.vC,...h||[]]:h||[],e.vC=g,r&&delete e.pC}catch(h){if(e.f=!0,h===Vg){if(i)return;throw h}const[g,A,$]=((p=e[Ke])==null?void 0:p[3])||[];if(A){const I=()=>ha([0,!1,t[2]],$),R=fa.get($)||[];R.push(I),fa.set($,R);const D=A(h,()=>{const x=fa.get($);if(x){const M=x.indexOf(I);if(M!==-1)return x.splice(M,1),I()}});if(D){if(t[0]===1)t[1]=!0;else if(rp(t,$,[D]),(A.length===1||t!==g)&&$.c){by($,$.c,!1);return}throw Vg}}throw h}finally{i&&t[5].pop()}},o8=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[Ke]=[0,[]];else{const e=e8[t.tag];e&&(Mi||(Mi=ay("")),t.props.children=[{tag:Mi,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},Hg=(t,e)=>{var n,r;(n=e[Ke][2])==null||n.forEach(([i,s])=>{i.values.push(s)});try{rp(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Ke][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&by(e,e.c,!1)},ws=new WeakMap,Kg=[],ha=async(t,e)=>{t[5]||(t[5]=[]);const n=ws.get(e);n&&n[0](void 0);let r;const i=new Promise(s=>r=s);if(ws.set(e,[r,()=>{t[2]?t[2](t,e,s=>{Hg(s,e)}).then(()=>r(e)):(Hg(t,e),r(e))}]),Kg.length)Kg.at(-1).add(e);else{await Promise.resolve();const s=ws.get(e);s&&(ws.delete(e),s[1]())}return i},a8=(t,e,n)=>({tag:Ys,props:{children:t},key:n,e,p:1}),au=0,$y=1,cu=2,lu=3,uu=new WeakMap,Ay=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),c8=void 0,Gg=[],l8=t=>{var a;const e=()=>typeof t=="function"?t():t,n=Zs.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(a=r[Ke][1])[au]||(a[au]=[]),s=r[Ke][0]++;return i[s]||(i[s]=[e(),l=>{const u=c8,d=i[s];if(typeof l=="function"&&(l=l(d[0])),!Object.is(l,d[0]))if(d[0]=l,Gg.length){const[p,h]=Gg.at(-1);Promise.all([p===3?r:ha([p,!1,u],r),h]).then(([g])=>{if(!g||!(p===2||p===3))return;const A=g.vC;requestAnimationFrame(()=>{setTimeout(()=>{A===g.vC&&ha([p===3?1:0,!1,u],g)})})})}else ha([0,!1,u],r)}])},Pf=(t,e)=>{var l;const n=Zs.at(-1);if(!n)return t;const[,r]=n,i=(l=r[Ke][1])[cu]||(l[cu]=[]),s=r[Ke][0]++,a=i[s];return Ay(a==null?void 0:a[1],e)?i[s]=[t,e]:t=i[s][0],t},u8=t=>{const e=uu.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>uu.set(t,[n]),n=>uu.set(t,[void 0,n])),t},d8=(t,e)=>{var l;const n=Zs.at(-1);if(!n)return t();const[,r]=n,i=(l=r[Ke][1])[lu]||(l[lu]=[]),s=r[Ke][0]++,a=i[s];return Ay(a==null?void 0:a[1],e)&&(i[s]=[t(),e]),i[s][0]},p8=ay({pending:!1,data:null,method:null,action:null}),Wg=new Set,f8=t=>{Wg.add(t),t.finally(()=>Wg.delete(t))},Bf=(t,e)=>d8(()=>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]),di=Object.create(null),Ho=Object.create(null),Co=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const s=document.head;let{onLoad:a,onError:l,precedence:u,blocking:d,...p}=e,h=null,g=!1;const A=la[t];let $;if(A.length>0){const x=s.querySelectorAll(t);e:for(const M of x)for(const G of la[t])if(M.getAttribute(G)===e[G]){h=M;break e}if(!h){const M=A.reduce((G,F)=>e[F]===void 0?G:`${G}-${F}-${e[F]}`,t);g=!Ho[M],h=Ho[M]||(Ho[M]=(()=>{const G=document.createElement(t);for(const F of A)e[F]!==void 0&&G.setAttribute(F,e[F]),e.rel&&G.setAttribute("rel",e.rel);return G})())}}else $=s.querySelectorAll(t);u=r?u??"":void 0,r&&(p[ua]=u);const I=Pf(x=>{if(A.length>0){let M=!1;for(const G of s.querySelectorAll(t)){if(M&&G.getAttribute(ua)!==u){s.insertBefore(x,G);return}G.getAttribute(ua)===u&&(M=!0)}s.appendChild(x)}else if($){let M=!1;for(const G of $)if(G===x){M=!0;break}M||s.insertBefore(x,s.contains($[0])?$[0]:s.querySelector(t)),$=void 0}},[u]),R=Bf(e.ref,x=>{var F;const M=A[0];if(n===2&&(x.innerHTML=""),(g||$)&&I(x),!l&&!a)return;let G=di[F=x.getAttribute(M)]||(di[F]=new Promise((H,W)=>{x.addEventListener("load",H),x.addEventListener("error",W)}));a&&(G=G.then(a)),l&&(G=G.catch(l)),G.catch(()=>{})});if(i&&d==="render"){const x=la[t][0];if(e[x]){const M=e[x],G=di[M]||(di[M]=new Promise((F,H)=>{I(h),h.addEventListener("load",F),h.addEventListener("error",H)}));u8(G)}}const D={tag:t,type:t,props:{...p,ref:R},ref:R};return D.p=n,h&&(D.e=h),a8(D,s)},h8=t=>{const e=t8(),n=e&&cs(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:Co("title",t,void 0,!1,!1)},g8=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:Co("script",t,1,!1,!0),m8=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,Co("style",t,2,!0,!0)),_8=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}:Co("link",t,1,"precedence"in t,!0),y8=t=>Co("meta",t,void 0,!1,!1),Ey=Symbol(),w8=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=l8([null,!1]),s=Pf(async d=>{const p=d.isTrusted?e:d.detail[Ey];if(typeof p!="function")return;d.preventDefault();const h=new FormData(d.target);i([h,!0]);const g=p(h);g instanceof Promise&&(f8(g),await g),i([null,!0])},[]),a=Bf(t.ref,d=>(d.addEventListener("submit",s),()=>{d.removeEventListener("submit",s)})),[l,u]=r;return r[1]=!1,{tag:p8,props:{value:{pending:l!==null,data:l,method:l?"post":null,action:l?e:null},children:{tag:"form",props:{...n,ref:a},type:"form",ref:a}},f:u}},Sy=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=Pf(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[Ey]:e}}))},[]);n.ref=Bf(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},v8=t=>Sy("input",t),b8=t=>Sy("button",t);Object.assign(tp,{title:h8,script:g8,style:m8,link:_8,meta:y8,form:w8,input:v8,button:b8});cy(null);new TextEncoder;const qi=t=>{const{i18nKey:e,values:n,components:r}=t,i=L.t(e,n),s=/<(\d+)>(.*?)<\/\d+>/g,a=[];let l=0,u;for(;(u=s.exec(i))!==null;){const[,d,p]=u,h=i.substring(l,u.index);h&&a.push(h);const g=parseInt(d,10);a.push(ME(r[g],{},p)),l=s.lastIndex}return l<i.length&&a.push(i.substring(l)),w(Rf,{children:a})},Xg=6,ip=({error:t,theme:e,branding:n,email:r,state:i,client:s,hasPasswordLogin:a})=>{const l=new URLSearchParams({state:i}),d=s.connections.map(({name:p})=>p).includes("auth2");return w(nt,{title:L.t("verify_your_email"),theme:e,branding:n,client:s,children:[w("div",{className:"mb-4 text-2xl font-medium",children:L.t("verify_your_email")}),w("div",{className:"mb-8 text-gray-300",children:w(qi,{i18nKey:"code_sent_template",components:[w("span",{className:"text-black dark:text-white"},"span")],values:{username:r}})}),w("div",{className:"flex flex-1 flex-col justify-center",children:[w(zn,{className:"pt-2",children:[w("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Xg,inputMode:"numeric",name:"code",placeholder:"******",className:Gn("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:Xg,required:!0,id:"code-input"}),t&&w(er,{children:t}),w(tt,{className:"sm:mt-4 !text-base",children:[w("span",{children:L.t("login")}),w(et,{className:"text-xs",name:"arrow-right"})]}),w("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[w(et,{className:"text-base",name:"info-bubble"}),w("div",{className:"text-sm text-gray-300 md:text-sm",children:L.t("sent_code_spam")})]}),d&&w("div",{className:"text-center mb-12",children:[w("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[w("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),w("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:L.t("or")})]}),w(tt,{Component:"a",href:`/u/${a?"enter-password":"pre-signup"}?${l.toString()}`,variant:"secondary",className:"block",children:L.t("enter_your_password_btn")})]})]}),w(hn,{state:i})]})]})},br=t=>{const{message:e,theme:n,branding:r,client:i,pageTitle:s,state:a}=t;return w(nt,{title:"Login",theme:n,branding:r,client:i,children:[s?w("div",{className:"mb-6 text-gray-300",children:s}):"",w("div",{className:"flex flex-1 flex-col justify-center",children:e}),a?w(hn,{state:a}):""]})},x8=new o.OpenAPIHono().openapi(o.createRoute({tags:["login"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:o.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:o.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:o.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i,s;try{if({theme:n,branding:r,loginSession:i,client:s}=await Ge(t,e),!i.authParams.username)return t.html(w(br,{theme:n,branding:r,client:s,state:e,pageTitle:L.t("error_page_title")||"Error",message:L.t("username_not_found_error")||"Username not found in session."}),400);const a=await Os({userAdapter:t.env.data.users,tenant_id:s.tenant.id,username:i.authParams.username,provider:"auth2"});return t.html(w(ip,{theme:n,branding:r,email:i.authParams.username,state:e,client:s,hasPasswordLogin:!!a}))}catch(a){return console.error("Error in GET /u/enter-code:",a),r||(r=null),n||(n=null),s||(s=null),t.html(w(br,{theme:n,branding:r,client:s,state:e,pageTitle:L.t("error_page_title")||"Error",message:L.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(o.createRoute({tags:["login"],method:"post",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({code:o.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:o.z.object({Location:o.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:o.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:o.z.string()}}}}}),async t=>{var l;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{theme:r,branding:i,client:s,loginSession:a}=await Ge(t,e);if(!a.authParams.username)throw new N(400,{message:L.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",s.id);const u=await Ef(t,{client_id:s.id,authParams:a.authParams,username:a.authParams.username,otp:n});if(u instanceof Response)return u;throw new N(500,{message:L.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(u){let d;try{d=await Os({userAdapter:t.env.data.users,tenant_id:s.tenant.id,username:a.authParams.username,provider:"auth2"})}catch{d=null}return t.html(w(ip,{theme:r,branding:i,email:(l=a.authParams)==null?void 0:l.username,state:e,client:s,error:u.message,hasPasswordLogin:!!d}),400)}}),ky=t=>{const{theme:e,branding:n,client:r,state:i}=t;return w(nt,{title:L.t("unverified_email"),theme:e,branding:n,client:r,children:[w("div",{className:"flex flex-1 flex-col justify-center",children:[w("p",{className:"mb-8 text-gray-300 text-lg",children:L.t("unverified_email")}),w("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[w(et,{className:"text-base",name:"info-bubble"}),w("div",{className:"text-sm text-gray-300 md:text-sm",children:L.t("sent_code_spam")})]}),w(hn,{state:i})]}),w(hn,{state:i})]})},$8=({width:t=22,height:e=17})=>w("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:w("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"})}),A8=({width:t=23,height:e=18})=>w("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:w("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"})}),sp=({name:t,placeholder:e=L.t("password")})=>w("div",{className:"password-input relative mb-2",children:[w("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}),w("button",{type:"button","aria-label":L.t("show_password"),title:L.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:w($8,{})}),w("button",{type:"button","aria-label":L.t("hide_password"),title:L.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:w(A8,{})})]});var Jg=Object.freeze,E8=Object.defineProperty,S8=(t,e)=>Jg(E8(t,"raw",{value:Jg(t.slice())})),Yg;const ga=t=>{const{error:e,theme:n,branding:r,email:i,state:s,client:a}=t,l=new URLSearchParams({state:s});return w(nt,{title:L.t("enter_password"),theme:n,branding:r,client:a,children:[w("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:L.t("enter_password")}),w("div",{className:"mb-6 text-gray-300",children:L.t("enter_password_description")}),w("div",{className:"flex flex-1 flex-col justify-center",children:[w(zn,{className:"mb-7",children:[w("input",{type:"text",name:"username",placeholder:L.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:i}),w(sp,{name:"password"}),e&&w(er,{children:e}),w(tt,{className:"sm:mt-4 !text-base",children:[w("span",{children:L.t("login")}),w(et,{className:"text-xs",name:"arrow-right"})]})]}),w("a",{href:`/u/forgot-password?${l.toString()}`,className:"text-primary hover:underline mb-4",children:L.t("forgot_password_link")}),w("div",{className:"text-center mb-12",children:[w("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[w("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),w("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:L.t("or")})]}),w("form",{method:"post",action:`/u/login/identifier?${l.toString()}`,children:[w("input",{type:"hidden",name:"login_selection",value:"code"}),w("input",{type:"hidden",name:"username",value:i}),w(tt,{variant:"secondary",className:"block",children:L.t("enter_a_code_btn")})]})]}),w(hn,{state:s})]}),iy(Yg||(Yg=S8([`
231
231
  <script>
232
232
  // Show password toggle
233
233
  var passwordInputs = document.querySelectorAll(".password-input");
@@ -267,21 +267,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
267
267
  #_legalWrapper:not(:has(#${l}:checked)) #continueBtnDisabled {
268
268
  display: block;
269
269
  }
270
- `}}),w("div",{id:"_legalWrapper",children:[s&&s.map(d=>{if(d.type==="NEXT_BUTTON")return null;const p=H8(d);return p?w("div",{className:d.type==="RICH_TEXT"?"mb-6":"mb-4",children:p},d.id):null}),u&&w("div",{className:"mb-4",children:l?w(Rf,{children:[w(tt,{id:"continueBtn",className:"sm:mt-4 !text-base w-full",children:[w("span",{children:u.config.text||"Continue"}),w(et,{className:"text-xs",name:"arrow-right"})]}),w(tt,{id:"continueBtnDisabled",className:"sm:mt-4 !text-base w-full opacity-50 cursor-not-allowed",disabled:!0,children:[w("span",{children:u.config.text||"Continue"}),w(et,{className:"text-xs",name:"arrow-right"})]})]}):w(tt,{className:"sm:mt-4 !text-base w-full",children:[w("span",{children:u.config.text||"Continue"}),w(et,{className:"text-xs",name:"arrow-right"})]})})]})]})})]})},K8=new o.OpenAPIHono().openapi(o.createRoute({tags:["forms"],method:"get",path:"/:formId/nodes/:nodeId",request:{params:o.z.object({formId:o.z.string(),nodeId:o.z.string()}),query:o.z.object({state:o.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,theme:s,branding:a}=await Ge(t,r,!0),l=await t.env.data.forms.get(i.tenant.id,e);if(!l)throw new N(404,{message:"Form not found"});const u=(l.nodes||[]).find(d=>d.id===n&&d.type==="STEP");if(!u)throw new N(404,{message:"Node not found or not a STEP node"});return t.html(w(du,{theme:s,branding:a,client:i,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:"components"in u.config?u.config.components:[]}))}).openapi(o.createRoute({tags:["forms"],method:"post",path:"/:formId/nodes/:nodeId",request:{params:o.z.object({formId:o.z.string(),nodeId:o.z.string()}),query:o.z.object({state:o.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.record(o.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"),{theme:i,branding:s,client:a}=await Ge(t,r,!0);let l,u,d=[];try{if(l=await t.env.data.forms.get(a.tenant.id,e),!l)throw new N(404,{message:"Form not found"});if(u=(l.nodes||[]).find(D=>D.id===n&&D.type==="STEP"),!u)throw new N(404,{message:"Node not found or not a STEP node"});d="components"in u.config?u.config.components:[];const p=await t.req.parseBody(),h=[],g={};for(const D of d)if(D.type==="LEGAL"){const x=D.id,M=!!D.required,G=p[x];M&&(!G||G==="")?h.push(x):typeof G=="string"&&(g[x]=G)}if(h.length>0)return t.html(w(du,{theme:i,branding:s,client:a,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:d,error:`Missing required fields: ${h.join(", ")}`}));const A=await t.env.data.loginSessions.get(a.tenant.id,r);if(!A||!A.session_id||!A.authParams)throw new Error("Session expired");const $=await t.env.data.sessions.get(a.tenant.id,A.session_id);if(!$||!$.user_id)throw new Error("Session expired");const I=await t.env.data.users.get(t.var.tenant_id,$.user_id);if(!I)throw new Error("Session expired");const R=await Er(t,{authParams:A.authParams,client:a,user:I,loginSession:A});return R instanceof Response?R:t.json(R)}catch{return t.html(w(du,{theme:i,branding:s,client:a,state:r,formName:(l==null?void 0:l.name)||"",nodeAlias:(u==null?void 0:u.alias)||n||"",components:d||[],error:"Your session has expired. Please try again."}))}});function G8(t){const e=new o.OpenAPIHono;e.onError((r,i)=>r instanceof as?i.redirect(r.location,r.status):r instanceof N?i.text(r.message||"Error",r.status):i.text("Unexpected error",500)),e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=t.dataAdapter.cache||Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(s,{defaultTtl:l,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}).use(El).use(Al),e.get("/css/tailwind.css",async r=>{const i=jf;return r.text(i,200,{"content-type":"text/css; charset=utf-8"})});const n=e.route("/info",j8).route("/check-account",I8).route("/account",z8).route("/change-email",D8).route("/change-email-confirmation",R8).route("/login/identifier",ZE).route("/enter-code",x8).route("/enter-password",k8).route("/invalid-session",B8).route("/pre-signup",P8).route("/pre-signup-sent",F8).route("/reset-password",C8).route("/forgot-password",T8).route("/validate-email",L8).route("/signup",N8).route("/forms",K8);return n.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),n}const Gt=o.z.object({"#text":o.z.string()}),W8=o.z.object({"#text":o.z.string(),"@_xmlns:saml":o.z.string().optional()}),X8=o.z.object({"samlp:AuthnRequest":o.z.object({"saml:Issuer":W8,"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string().optional(),"@_ForceAuthn":o.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string().datetime(),"@_Destination":o.z.string().url(),"@_AssertionConsumerServiceURL":o.z.string().url().optional(),"@_ProtocolBinding":o.z.string().optional(),"@_Version":o.z.string()})});o.z.array(o.z.object({":@":o.z.object({"@_xmlns":o.z.string(),"@_entityID":o.z.string()}),EntityDescriptor:o.z.array(o.z.object({":@":o.z.object({"@_protocolSupportEnumeration":o.z.string()}),IDPSSODescriptor:o.z.array(o.z.union([o.z.object({KeyDescriptor:o.z.array(o.z.object({KeyInfo:o.z.array(o.z.object({X509Data:o.z.array(o.z.object({X509Certificate:o.z.array(Gt)}))})),":@":o.z.object({"@_xmlns":o.z.string()})})),":@":o.z.object({"@_use":o.z.string()})}),o.z.object({SingleLogoutService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({NameIDFormat:o.z.array(Gt)}),o.z.object({SingleSignOnService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({Attribute:o.z.array(o.z.object({})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string(),"@_xmlns":o.z.string()})})]))}))}));const J8=o.z.object({"saml:AttributeValue":o.z.array(o.z.object({"#text":o.z.string()})),":@":o.z.object({"@_xmlns:xs":o.z.string().optional(),"@_xmlns:xsi":o.z.string(),"@_xsi:type":o.z.string(),"@_Name":o.z.string().optional(),"@_NameFormat":o.z.string().optional()})}),Y8=o.z.object({"ds:Transform":o.z.array(o.z.any()),":@":o.z.object({"@_Algorithm":o.z.string()})}),em=o.z.object({"ds:Signature":o.z.array(o.z.union([o.z.object({"ds:SignedInfo":o.z.array(o.z.union([o.z.object({"ds:CanonicalizationMethod":o.z.array(o.z.string()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o.z.object({"ds:SignatureMethod":o.z.array(o.z.string()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o.z.object({"ds:Reference":o.z.array(o.z.union([o.z.object({"ds:Transforms":o.z.array(Y8)}),o.z.object({"ds:DigestMethod":o.z.array(o.z.string()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o.z.object({"ds:DigestValue":o.z.array(Gt)})]))})]))}),o.z.object({"ds:SignatureValue":o.z.array(Gt)}),o.z.object({"ds:KeyInfo":o.z.array(o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(Gt)}),o.z.object({"ds:Exponent":o.z.array(Gt)})]))}))}))})])),":@":o.z.object({"@_xmlns:ds":o.z.string()})});o.z.array(o.z.object({"samlp:Response":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(Gt)}),em,o.z.object({"samlp:Status":o.z.array(o.z.object({"samlp:StatusCode":o.z.array(Gt),":@":o.z.object({"@_Value":o.z.string()})}))}),o.z.object({"saml:Assertion":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(Gt)}),em,o.z.object({"saml:Subject":o.z.array(o.z.union([o.z.object({"saml:NameID":o.z.array(Gt),":@":o.z.object({"@_Format":o.z.string()})}),o.z.object({"saml:SubjectConfirmation":o.z.array(o.z.object({"saml:SubjectConfirmationData":o.z.array(o.z.any()),":@":o.z.object({"@_InResponseTo":o.z.string(),"@_NotOnOrAfter":o.z.string(),"@_Recipient":o.z.string()})})),":@":o.z.object({"@_Method":o.z.string()})})]))}),o.z.object({"saml:Conditions":o.z.array(o.z.object({"saml:AudienceRestriction":o.z.array(o.z.object({"saml:Audience":o.z.array(Gt)}))})),":@":o.z.object({"@_NotBefore":o.z.string(),"@_NotOnOrAfter":o.z.string()})}),o.z.object({"saml:AuthnStatement":o.z.array(o.z.object({"saml:AuthnContext":o.z.array(o.z.object({"saml:AuthnContextClassRef":o.z.array(Gt)}))})),":@":o.z.object({"@_AuthnInstant":o.z.string(),"@_SessionIndex":o.z.string(),"@_SessionNotOnOrAfter":o.z.string()})}),o.z.object({"saml:AttributeStatement":o.z.array(o.z.object({"saml:Attribute":o.z.array(J8),":@":o.z.object({"@_FriendlyName":o.z.string().optional(),"@_Name":o.z.string(),"@_NameFormat":o.z.string()})}))})])),":@":o.z.object({"@_xmlns":o.z.string(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})})])),":@":o.z.object({"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string(),"@_Destination":o.z.string(),"@_ID":o.z.string(),"@_InResponseTo":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})}));var Z8={},ti={},To={},Il={};(function(t){var e=t;(function(n){function r(c){var f=Array.prototype.slice,_=c.length,b=function(E,K){return function(){return K.apply(this,E.concat(f.call(arguments)))}},v=function(){var E=f.call(arguments);return E.length<_?b(E,v):c.apply(this,f.apply(arguments,[0,_]))};return v}var i=function(c,f){for(var _=0;_<f.length;_+=1)c(f[_],_,f)},s=function(c,f,_){var b=f;return i(function(v,E){b=c(b,v,E)},_),b},a=function(c,f){var _=new Array(f.length);return i(function(b,v){_[v]=c(b)},f),_},l=function(c,f){var _=[];return i(function(b,v){c(b,v)&&_.push(b)},f),_},u=function(c,f){for(var _=0;_<c.length;_+=1)if(c[_]===f)return!0;return!1};function d(c){return function(){return c}}function p(c){return c.toString()}var h=function(c,f){return f.join(c)},g=function(c,f,_){return c+_+f},A=Array.prototype.concat,$=32767;function I(c){for(var f=[],_=0;_<c.length;_+=$){var b=c.slice(_,_+$);f=A.apply(f,b)}return f}function R(c,f){for(var _=Object(c),b=1;b<arguments.length;b++){var v=arguments[b];if(v!=null)for(var E in v)Object.prototype.hasOwnProperty.call(v,E)&&(_[E]=v[E])}return _}var D={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};x.prototype=new Object,x.prototype.constructor=x,x.superclass=Object.prototype;function x(){this.init()}x.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(c){return new fe(c[0],c[2])},this.reduceActions[5]=function(c){return new Ce(c[0],c[2])},this.reduceActions[7]=function(c){return new P(c[0],c[2])},this.reduceActions[8]=function(c){return new j(c[0],c[2])},this.reduceActions[10]=function(c){return new z(c[0],c[2])},this.reduceActions[11]=function(c){return new k(c[0],c[2])},this.reduceActions[12]=function(c){return new S(c[0],c[2])},this.reduceActions[13]=function(c){return new B(c[0],c[2])},this.reduceActions[15]=function(c){return new V(c[0],c[2])},this.reduceActions[16]=function(c){return new ue(c[0],c[2])},this.reduceActions[18]=function(c){return new re(c[0],c[2])},this.reduceActions[19]=function(c){return new ve(c[0],c[2])},this.reduceActions[20]=function(c){return new Se(c[0],c[2])},this.reduceActions[22]=function(c){return new X(c[1])},this.reduceActions[24]=function(c){return new Z(c[0],c[2])},this.reduceActions[25]=function(c){return new ye(void 0,void 0,c[0])},this.reduceActions[27]=function(c){return c[0].locationPath=c[2],c[0]},this.reduceActions[28]=function(c){return c[0].locationPath=c[2],c[0].locationPath.steps.unshift(new Q(Q.DESCENDANTORSELF,se.nodeTest,[])),c[0]},this.reduceActions[29]=function(c){return new ye(c[0],[],void 0)},this.reduceActions[30]=function(c){return ae.instance_of(c[0],ye)?(c[0].filterPredicates==null&&(c[0].filterPredicates=[]),c[0].filterPredicates.push(c[1]),c[0]):new ye(c[0],[c[1]],void 0)},this.reduceActions[32]=function(c){return c[1]},this.reduceActions[33]=function(c){return new he(c[0])},this.reduceActions[34]=function(c){return new ge(c[0])},this.reduceActions[36]=function(c){return new Ot(c[0],[])},this.reduceActions[37]=function(c){return new Ot(c[0],c[2])},this.reduceActions[38]=function(c){return[c[0]]},this.reduceActions[39]=function(c){return c[2].unshift(c[0]),c[2]},this.reduceActions[43]=function(c){return new Zt(!0,[])},this.reduceActions[44]=function(c){return c[1].absolute=!0,c[1]},this.reduceActions[46]=function(c){return new Zt(!1,[c[0]])},this.reduceActions[47]=function(c){return c[0].steps.push(c[2]),c[0]},this.reduceActions[49]=function(c){return new Q(c[0],c[1],[])},this.reduceActions[50]=function(c){return new Q(Q.CHILD,c[0],[])},this.reduceActions[51]=function(c){return new Q(c[0],c[1],c[2])},this.reduceActions[52]=function(c){return new Q(Q.CHILD,c[0],c[1])},this.reduceActions[54]=function(c){return[c[0]]},this.reduceActions[55]=function(c){return c[1].unshift(c[0]),c[1]},this.reduceActions[56]=function(c){return c[0]=="ancestor"?Q.ANCESTOR:c[0]=="ancestor-or-self"?Q.ANCESTORORSELF:c[0]=="attribute"?Q.ATTRIBUTE:c[0]=="child"?Q.CHILD:c[0]=="descendant"?Q.DESCENDANT:c[0]=="descendant-or-self"?Q.DESCENDANTORSELF:c[0]=="following"?Q.FOLLOWING:c[0]=="following-sibling"?Q.FOLLOWINGSIBLING:c[0]=="namespace"?Q.NAMESPACE:c[0]=="parent"?Q.PARENT:c[0]=="preceding"?Q.PRECEDING:c[0]=="preceding-sibling"?Q.PRECEDINGSIBLING:c[0]=="self"?Q.SELF:-1},this.reduceActions[57]=function(c){return Q.ATTRIBUTE},this.reduceActions[59]=function(c){return c[0]=="comment"?se.commentTest:c[0]=="text"?se.textTest:c[0]=="processing-instruction"?se.anyPiTest:c[0]=="node"?se.nodeTest:new se(-1,void 0)},this.reduceActions[60]=function(c){return new se.PITest(c[2])},this.reduceActions[61]=function(c){return c[1]},this.reduceActions[63]=function(c){return c[1].absolute=!0,c[1].steps.unshift(new Q(Q.DESCENDANTORSELF,se.nodeTest,[])),c[1]},this.reduceActions[64]=function(c){return c[0].steps.push(new Q(Q.DESCENDANTORSELF,se.nodeTest,[])),c[0].steps.push(c[2]),c[0]},this.reduceActions[65]=function(c){return new Q(Q.SELF,se.nodeTest,[])},this.reduceActions[66]=function(c){return new Q(Q.PARENT,se.nodeTest,[])},this.reduceActions[67]=function(c){return new Ze(c[1])},this.reduceActions[68]=function(c){return se.nameTestAny},this.reduceActions[69]=function(c){return new se.NameTestPrefixAny(c[0].split(":")[0])},this.reduceActions[70]=function(c){return new se.NameTestQName(c[0])}},x.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],x.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],x.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],x.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],x.DOUBLEDOT=2,x.DOUBLECOLON=3,x.DOUBLESLASH=4,x.NOTEQUAL=5,x.LESSTHANOREQUAL=6,x.GREATERTHANOREQUAL=7,x.AND=8,x.OR=9,x.MOD=10,x.DIV=11,x.MULTIPLYOPERATOR=12,x.FUNCTIONNAME=13,x.AXISNAME=14,x.LITERAL=15,x.NUMBER=16,x.ASTERISKNAMETEST=17,x.QNAME=18,x.NCNAMECOLONASTERISK=19,x.NODETYPE=20,x.PROCESSINGINSTRUCTIONWITHLITERAL=21,x.EQUALS=22,x.LESSTHAN=23,x.GREATERTHAN=24,x.PLUS=25,x.MINUS=26,x.BAR=27,x.SLASH=28,x.LEFTPARENTHESIS=29,x.RIGHTPARENTHESIS=30,x.COMMA=31,x.AT=32,x.LEFTBRACKET=33,x.RIGHTBRACKET=34,x.DOT=35,x.DOLLAR=36,x.prototype.tokenize=function(c){for(var f=[],_=[],b=c+"\0",v=0,E=b.charAt(v++);;){for(;E==" "||E==" "||E=="\r"||E==`
271
- `;)E=b.charAt(v++);if(E=="\0"||v>=b.length)break;if(E=="("){f.push(x.LEFTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E==")"){f.push(x.RIGHTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E=="["){f.push(x.LEFTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="]"){f.push(x.RIGHTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="@"){f.push(x.AT),_.push(E),E=b.charAt(v++);continue}if(E==","){f.push(x.COMMA),_.push(E),E=b.charAt(v++);continue}if(E=="|"){f.push(x.BAR),_.push(E),E=b.charAt(v++);continue}if(E=="+"){f.push(x.PLUS),_.push(E),E=b.charAt(v++);continue}if(E=="-"){f.push(x.MINUS),_.push(E),E=b.charAt(v++);continue}if(E=="="){f.push(x.EQUALS),_.push(E),E=b.charAt(v++);continue}if(E=="$"){f.push(x.DOLLAR),_.push(E),E=b.charAt(v++);continue}if(E=="."){if(E=b.charAt(v++),E=="."){f.push(x.DOUBLEDOT),_.push(".."),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K="."+E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}f.push(x.DOT),_.push(".");continue}if(E=="'"||E=='"'){for(var _e=E,Ne="";v<b.length&&(E=b.charAt(v))!==_e;)Ne+=E,v+=1;if(E!==_e)throw Ht.fromMessage("Unterminated string literal: "+_e+Ne);v+=1,f.push(x.LITERAL),_.push(Ne),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K=E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);if(E=="."&&b.charAt(v)>="0"&&b.charAt(v)<="9")for(K+=E,K+=b.charAt(v++),E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}if(E=="*"){if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){f.push(x.MULTIPLYOPERATOR),_.push(E),E=b.charAt(v++);continue}}f.push(x.ASTERISKNAMETEST),_.push(E),E=b.charAt(v++);continue}if(E==":"&&b.charAt(v)==":"){f.push(x.DOUBLECOLON),_.push("::"),v++,E=b.charAt(v++);continue}if(E=="/"){if(E=b.charAt(v++),E=="/"){f.push(x.DOUBLESLASH),_.push("//"),E=b.charAt(v++);continue}f.push(x.SLASH),_.push("/");continue}if(E=="!"&&b.charAt(v)=="="){f.push(x.NOTEQUAL),_.push("!="),v++,E=b.charAt(v++);continue}if(E=="<"){if(b.charAt(v)=="="){f.push(x.LESSTHANOREQUAL),_.push("<="),v++,E=b.charAt(v++);continue}f.push(x.LESSTHAN),_.push("<"),E=b.charAt(v++);continue}if(E==">"){if(b.charAt(v)=="="){f.push(x.GREATERTHANOREQUAL),_.push(">="),v++,E=b.charAt(v++);continue}f.push(x.GREATERTHAN),_.push(">"),E=b.charAt(v++);continue}if(E=="_"||ae.isLetter(E.charCodeAt(0))){var Ae=E;for(E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){if(Ae=="and"){f.push(x.AND),_.push(Ae);continue}if(Ae=="or"){f.push(x.OR),_.push(Ae);continue}if(Ae=="mod"){f.push(x.MOD),_.push(Ae);continue}if(Ae=="div"){f.push(x.DIV),_.push(Ae);continue}}}if(E==":"){if(b.charAt(v)=="*"){f.push(x.NCNAMECOLONASTERISK),_.push(Ae+":*"),v++,E=b.charAt(v++);continue}if(b.charAt(v)=="_"||ae.isLetter(b.charCodeAt(v))){for(Ae+=":",E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(E=="("){f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}if(b.charAt(v)==":"){f.push(x.AXISNAME),_.push(Ae);continue}}if(E=="("){if(Ae=="comment"||Ae=="text"||Ae=="node"){f.push(x.NODETYPE),_.push(Ae);continue}if(Ae=="processing-instruction"){b.charAt(v)==")"?f.push(x.NODETYPE):f.push(x.PROCESSINGINSTRUCTIONWITHLITERAL),_.push(Ae);continue}f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}throw new Error("Unexpected character "+E)}return f.push(1),_.push("[EOF]"),[f,_]},x.SHIFT="s",x.REDUCE="r",x.ACCEPT="a",x.prototype.parse=function(Ne){var f,_,b=this.tokenize(Ne);if(b!=null){f=b[0],_=b[1];var v=0,E=[],K=[],_e=[],Ne,ie,Ae;for(E.push(0),K.push(1),_e.push("_S"),ie=f[v],Ae=_[v++];;)switch(Ne=E[E.length-1],x.actionTable[Ne].charAt(ie-1)){case x.SHIFT:K.push(-ie),_e.push(Ae),E.push(x.actionTableNumber[Ne].charCodeAt(ie-1)-32),ie=f[v],Ae=_[v++];break;case x.REDUCE:for(var bt=x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][1],je=[],ir=0;ir<bt;ir++)K.pop(),je.unshift(_e.pop()),E.pop();var sr=E[E.length-1];K.push(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]),this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32]==null?_e.push(je[0]):_e.push(this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32](je)),E.push(x.gotoTable[sr].charCodeAt(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]-2)-33);break;case x.ACCEPT:return new M(_e.pop());default:throw new Error("XPath parse error")}}},M.prototype=new Object,M.prototype.constructor=M,M.superclass=Object.prototype;function M(c){this.expression=c}M.prototype.toString=function(){return this.expression.toString()};function G(c,f,_){f in c||(c[f]=_)}M.prototype.evaluate=function(c){return c.contextNode=c.expressionContextNode,c.contextSize=1,c.contextPosition=1,c.isHtml&&(G(c,"caseInsensitive",!0),G(c,"allowAnyNamespaceForNoPrefix",!0)),G(c,"caseInsensitive",!1),this.expression.evaluate(c)},M.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",M.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",F.prototype=new Object,F.prototype.constructor=F,F.superclass=Object.prototype;function F(){}F.prototype.init=function(){},F.prototype.toString=function(){return"<Expression>"},F.prototype.evaluate=function(c){throw new Error("Could not evaluate expression.")},H.prototype=new F,H.prototype.constructor=H,H.superclass=F.prototype;function H(c){arguments.length>0&&this.init(c)}H.prototype.init=function(c){this.rhs=c},X.prototype=new H,X.prototype.constructor=X,X.superclass=H.prototype;function X(c){arguments.length>0&&this.init(c)}X.prototype.init=function(c){X.superclass.init.call(this,c)},X.prototype.evaluate=function(c){return this.rhs.evaluate(c).number().negate()},X.prototype.toString=function(){return"-"+this.rhs.toString()},Y.prototype=new F,Y.prototype.constructor=Y,Y.superclass=F.prototype;function Y(c,f){arguments.length>0&&this.init(c,f)}Y.prototype.init=function(c,f){this.lhs=c,this.rhs=f},fe.prototype=new Y,fe.prototype.constructor=fe,fe.superclass=Y.prototype;function fe(c,f){arguments.length>0&&this.init(c,f)}fe.prototype.init=function(c,f){fe.superclass.init.call(this,c,f)},fe.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},fe.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?f:this.rhs.evaluate(c).bool()},Ce.prototype=new Y,Ce.prototype.constructor=Ce,Ce.superclass=Y.prototype;function Ce(c,f){arguments.length>0&&this.init(c,f)}Ce.prototype.init=function(c,f){Ce.superclass.init.call(this,c,f)},Ce.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ce.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?this.rhs.evaluate(c).bool():f},P.prototype=new Y,P.prototype.constructor=P,P.superclass=Y.prototype;function P(c,f){arguments.length>0&&this.init(c,f)}P.prototype.init=function(c,f){P.superclass.init.call(this,c,f)},P.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},P.prototype.evaluate=function(c){return this.lhs.evaluate(c).equals(this.rhs.evaluate(c))},j.prototype=new Y,j.prototype.constructor=j,j.superclass=Y.prototype;function j(c,f){arguments.length>0&&this.init(c,f)}j.prototype.init=function(c,f){j.superclass.init.call(this,c,f)},j.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},j.prototype.evaluate=function(c){return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c))},z.prototype=new Y,z.prototype.constructor=z,z.superclass=Y.prototype;function z(c,f){arguments.length>0&&this.init(c,f)}z.prototype.init=function(c,f){z.superclass.init.call(this,c,f)},z.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c))},z.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},k.prototype=new Y,k.prototype.constructor=k,k.superclass=Y.prototype;function k(c,f){arguments.length>0&&this.init(c,f)}k.prototype.init=function(c,f){k.superclass.init.call(this,c,f)},k.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c))},k.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},S.prototype=new Y,S.prototype.constructor=S,S.superclass=Y.prototype;function S(c,f){arguments.length>0&&this.init(c,f)}S.prototype.init=function(c,f){S.superclass.init.call(this,c,f)},S.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c))},S.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},B.prototype=new Y,B.prototype.constructor=B,B.superclass=Y.prototype;function B(c,f){arguments.length>0&&this.init(c,f)}B.prototype.init=function(c,f){B.superclass.init.call(this,c,f)},B.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c))},B.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},V.prototype=new Y,V.prototype.constructor=V,V.superclass=Y.prototype;function V(c,f){arguments.length>0&&this.init(c,f)}V.prototype.init=function(c,f){V.superclass.init.call(this,c,f)},V.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number())},V.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},ue.prototype=new Y,ue.prototype.constructor=ue,ue.superclass=Y.prototype;function ue(c,f){arguments.length>0&&this.init(c,f)}ue.prototype.init=function(c,f){ue.superclass.init.call(this,c,f)},ue.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number())},ue.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},re.prototype=new Y,re.prototype.constructor=re,re.superclass=Y.prototype;function re(c,f){arguments.length>0&&this.init(c,f)}re.prototype.init=function(c,f){re.superclass.init.call(this,c,f)},re.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number())},re.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},ve.prototype=new Y,ve.prototype.constructor=ve,ve.superclass=Y.prototype;function ve(c,f){arguments.length>0&&this.init(c,f)}ve.prototype.init=function(c,f){ve.superclass.init.call(this,c,f)},ve.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Se.prototype=new Y,Se.prototype.constructor=Se,Se.superclass=Y.prototype;function Se(c,f){arguments.length>0&&this.init(c,f)}Se.prototype.init=function(c,f){Se.superclass.init.call(this,c,f)},Se.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number())},Se.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},Z.prototype=new Y,Z.prototype.constructor=Z,Z.superclass=Y.prototype;function Z(c,f){arguments.length>0&&this.init(c,f)}Z.prototype.init=function(c,f){Z.superclass.init.call(this,c,f)},Z.prototype.evaluate=function(c){return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset())},Z.prototype.toString=function(){return a(p,[this.lhs,this.rhs]).join(" | ")},ye.prototype=new F,ye.prototype.constructor=ye,ye.superclass=F.prototype;function ye(c,f,_){arguments.length>0&&this.init(c,f,_)}ye.prototype.init=function(c,f,_){ye.superclass.init.call(this),this.filter=c,this.filterPredicates=f,this.locationPath=_};function Rn(c){for(;c&&c.parentNode;)c=c.parentNode;return c}ye.applyPredicates=function(c,f,_){if(c.length===0)return _;var b=f.extend({});return s(function(v,E){return b.contextSize=v.length,l(function(K,_e){return b.contextNode=K,b.contextPosition=_e+1,ye.predicateMatches(E,b)},v)},_,c)},ye.getRoot=function(c,f){var _=f[0];if(_.nodeType===D.DOCUMENT_NODE)return _;if(c.virtualRoot)return c.virtualRoot;var b=_.ownerDocument;if(b)return b;for(var v=_;v.parentNode!=null;)v=v.parentNode;return v},ye.applyStep=function(c,f,_){var b=[];switch(f.contextNode=_,c.axis){case Q.ANCESTOR:if(f.contextNode===f.virtualRoot)break;var v;for(f.contextNode.nodeType==D.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);)v=v.parentNode;break;case Q.ANCESTORORSELF:for(var v=f.contextNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);v=v.nodeType==D.ATTRIBUTE_NODE?ye.getOwnerElement(v):v.parentNode);break;case Q.ATTRIBUTE:var E=f.contextNode.attributes;if(E!=null)for(var K=0;K<E.length;K++){var v=E.item(K);c.nodeTest.matches(v,f)&&b.push(v)}break;case Q.CHILD:for(var v=f.contextNode.firstChild;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.DESCENDANT:for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.DESCENDANTORSELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.FOLLOWING:if(f.contextNode===f.virtualRoot)break;var je=[];f.contextNode.firstChild!=null?je.unshift(f.contextNode.firstChild):je.unshift(f.contextNode.nextSibling);for(var v=f.contextNode.parentNode;v!=null&&v.nodeType!=D.DOCUMENT_NODE&&v!==f.virtualRoot;v=v.parentNode)je.unshift(v.nextSibling);do for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;while(je.length>0);break;case Q.FOLLOWINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.nextSibling;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.NAMESPACE:var _e={};if(f.contextNode.nodeType==D.ELEMENT_NODE){_e.xml=M.XML_NAMESPACE_URI,_e.xmlns=M.XMLNS_NAMESPACE_URI;for(var v=f.contextNode;v!=null&&v.nodeType==D.ELEMENT_NODE;v=v.parentNode)for(var K=0;K<v.attributes.length;K++){var Ne=v.attributes.item(K),ie=String(Ne.name);if(ie=="xmlns")_e[""]==null&&(_e[""]=Ne.value);else if(ie.length>6&&ie.substring(0,6)=="xmlns:"){var Ae=ie.substring(6,ie.length);_e[Ae]==null&&(_e[Ae]=Ne.value)}}for(var Ae in _e){var bt=new zt(Ae,_e[Ae],f.contextNode);c.nodeTest.matches(bt,f)&&b.push(bt)}}break;case Q.PARENT:v=null,f.contextNode!==f.virtualRoot&&(f.contextNode.nodeType==D.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode),v!=null&&c.nodeTest.matches(v,f)&&b.push(v);break;case Q.PRECEDING:var je;f.virtualRoot!=null?je=[f.virtualRoot]:je=[Rn(f.contextNode)];e:for(;je.length>0;)for(var v=je.pop();v!=null;){if(v==f.contextNode)break e;c.nodeTest.matches(v,f)&&b.unshift(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling}break;case Q.PRECEDINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.previousSibling;v!=null;v=v.previousSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.SELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);break}return b};function Be(c,f,_){return ye.applyPredicates(c.predicates,f,ye.applyStep(c,f,_))}function He(c,f,_){return I(a(Be.bind(null,_,c),f))}ye.applySteps=function(c,f,_){return s(He.bind(null,f),_,c)},ye.prototype.applyFilter=function(c,f){if(!this.filter)return{nodes:[c.contextNode]};var _=this.filter.evaluate(c);if(!ae.instance_of(_,oe)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:_}}return{nodes:ye.applyPredicates(this.filterPredicates||[],f,_.toUnsortedArray())}},ye.applyLocationPath=function(c,f,_){if(!c)return _;var b=c.absolute?[ye.getRoot(f,_)]:_;return ye.applySteps(c.steps,f,b)},ye.prototype.evaluate=function(c){var f=R(new Vt,c),_=this.applyFilter(c,f);if("nonNodes"in _)return _.nonNodes;var b=new oe;return b.addArray(ye.applyLocationPath(this.locationPath,f,_.nodes)),b},ye.predicateMatches=function(c,f){var _=c.evaluate(f);return ae.instance_of(_,ge)?f.contextPosition===_.numberValue():_.booleanValue()},ye.predicateString=function(c){return g("[","]",c.toString())},ye.predicatesString=function(c){return h("",a(ye.predicateString,c))},ye.prototype.toString=function(){if(this.filter!=null){var c=p(this.filter);return ae.instance_of(this.filter,he)?g("'","'",c):this.filterPredicates!=null&&this.filterPredicates.length?g("(",")",c)+ye.predicatesString(this.filterPredicates):this.locationPath!=null?c+(this.locationPath.absolute?"":"/")+p(this.locationPath):c}return p(this.locationPath)},ye.getOwnerElement=function(c){if(c.ownerElement)return c.ownerElement;try{if(c.selectSingleNode)return c.selectSingleNode("..")}catch{}for(var f=c.nodeType==D.DOCUMENT_NODE?c:c.ownerDocument,_=f.getElementsByTagName("*"),b=0;b<_.length;b++)for(var v=_.item(b),E=v.attributes,K=0;K<E.length;K++){var _e=E.item(K);if(_e===c)return v}return null},Zt.prototype=new Object,Zt.prototype.constructor=Zt,Zt.superclass=Object.prototype;function Zt(c,f){arguments.length>0&&this.init(c,f)}Zt.prototype.init=function(c,f){this.absolute=c,this.steps=f},Zt.prototype.toString=function(){return(this.absolute?"/":"")+a(p,this.steps).join("/")},Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(c,f,_){arguments.length>0&&this.init(c,f,_)}Q.prototype.init=function(c,f,_){this.axis=c,this.nodeTest=f,this.predicates=_},Q.prototype.toString=function(){return Q.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+ye.predicatesString(this.predicates)},Q.ANCESTOR=0,Q.ANCESTORORSELF=1,Q.ATTRIBUTE=2,Q.CHILD=3,Q.DESCENDANT=4,Q.DESCENDANTORSELF=5,Q.FOLLOWING=6,Q.FOLLOWINGSIBLING=7,Q.NAMESPACE=8,Q.PARENT=9,Q.PRECEDING=10,Q.PRECEDINGSIBLING=11,Q.SELF=12,Q.STEPNAMES=s(function(c,f){return c[f[0]]=f[1],c},{},[[Q.ANCESTOR,"ancestor"],[Q.ANCESTORORSELF,"ancestor-or-self"],[Q.ATTRIBUTE,"attribute"],[Q.CHILD,"child"],[Q.DESCENDANT,"descendant"],[Q.DESCENDANTORSELF,"descendant-or-self"],[Q.FOLLOWING,"following"],[Q.FOLLOWINGSIBLING,"following-sibling"],[Q.NAMESPACE,"namespace"],[Q.PARENT,"parent"],[Q.PRECEDING,"preceding"],[Q.PRECEDINGSIBLING,"preceding-sibling"],[Q.SELF,"self"]]),se.prototype=new Object,se.prototype.constructor=se,se.superclass=Object.prototype;function se(c,f){arguments.length>0&&this.init(c,f)}se.prototype.init=function(c,f){this.type=c,this.value=f},se.prototype.toString=function(){return"<unknown nodetest type>"},se.prototype.matches=function(c,f){console.warn("unknown node test type")},se.NAMETESTANY=0,se.NAMETESTPREFIXANY=1,se.NAMETESTQNAME=2,se.COMMENT=3,se.TEXT=4,se.PI=5,se.NODE=6,se.isNodeType=function(c){return function(f){return u(c,f.nodeType)}},se.makeNodeTestType=function(c,f,_){var b=_||function(){};return b.prototype=new se(c),b.prototype.constructor=b,R(b.prototype,f),b},se.makeNodeTypeTest=function(c,f,_){return new(se.makeNodeTestType(c,{matches:se.isNodeType(f),toString:d(_)}))},se.hasPrefix=function(c){return c.prefix||(c.nodeName||c.tagName).indexOf(":")!==-1},se.isElementOrAttribute=se.isNodeType([1,2]),se.nameSpaceMatches=function(c,f,_){var b=_.namespaceURI||"";if(!c)return!b||f.allowAnyNamespaceForNoPrefix&&!se.hasPrefix(_);var v=f.namespaceResolver.getNamespace(c,f.expressionContextNode);if(v==null)throw new Error("Cannot resolve QName "+c);return v===b},se.localNameMatches=function(c,f,_){var b=_.localName||_.nodeName;return f.caseInsensitive?c.toLowerCase()===b.toLowerCase():c===b},se.NameTestPrefixAny=se.makeNodeTestType(se.NAMETESTPREFIXANY,{matches:function(c,f){return se.isElementOrAttribute(c)&&se.nameSpaceMatches(this.prefix,f,c)},toString:function(){return this.prefix+":*"}},function(f){this.prefix=f}),se.NameTestQName=se.makeNodeTestType(se.NAMETESTQNAME,{matches:function(c,f){return se.isNodeType([D.ELEMENT_NODE,D.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE])(c)&&se.nameSpaceMatches(this.prefix,f,c)&&se.localNameMatches(this.localName,f,c)},toString:function(){return this.name}},function(f){var _=f.split(":");this.name=f,this.prefix=_.length>1?_[0]:null,this.localName=_[_.length>1?1:0]}),se.PITest=se.makeNodeTestType(se.PI,{matches:function(c,f){return se.isNodeType([D.PROCESSING_INSTRUCTION_NODE])(c)&&(c.target||c.nodeName)===this.name},toString:function(){return g('processing-instruction("','")',this.name)}},function(c){this.name=c}),se.nameTestAny=se.makeNodeTypeTest(se.NAMETESTANY,[D.ELEMENT_NODE,D.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE],"*"),se.textTest=se.makeNodeTypeTest(se.TEXT,[D.TEXT_NODE,D.CDATA_SECTION_NODE],"text()"),se.commentTest=se.makeNodeTypeTest(se.COMMENT,[D.COMMENT_NODE],"comment()"),se.nodeTest=se.makeNodeTypeTest(se.NODE,[D.ELEMENT_NODE,D.ATTRIBUTE_NODE,D.TEXT_NODE,D.CDATA_SECTION_NODE,D.PROCESSING_INSTRUCTION_NODE,D.COMMENT_NODE,D.DOCUMENT_NODE],"node()"),se.anyPiTest=se.makeNodeTypeTest(se.PI,[D.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ze.prototype=new F,Ze.prototype.constructor=Ze,Ze.superclass=F.prototype;function Ze(c){arguments.length>0&&this.init(c)}Ze.prototype.init=function(c){this.variable=c},Ze.prototype.toString=function(){return"$"+this.variable},Ze.prototype.evaluate=function(c){var f=ae.resolveQName(this.variable,c.namespaceResolver,c.contextNode,!1);if(f[0]==null)throw new Error("Cannot resolve QName "+fn);var _=c.variableResolver.getVariable(f[1],f[0]);if(!_)throw Ht.fromMessage("Undeclared variable: "+this.toString());return _},Ot.prototype=new F,Ot.prototype.constructor=Ot,Ot.superclass=F.prototype;function Ot(c,f){arguments.length>0&&this.init(c,f)}Ot.prototype.init=function(c,f){this.functionName=c,this.arguments=f},Ot.prototype.toString=function(){for(var c=this.functionName+"(",f=0;f<this.arguments.length;f++)f>0&&(c+=", "),c+=this.arguments[f].toString();return c+")"},Ot.prototype.evaluate=function(c){var f=vt.getFunctionFromContext(this.functionName,c);if(!f)throw new Error("Unknown function "+this.functionName);var _=[c].concat(this.arguments);return f.apply(c.functionResolver.thisArg,_)};var Fe=new Object;Fe.equals=function(c,f){return c.equals(f)},Fe.notequal=function(c,f){return c.notequal(f)},Fe.lessthan=function(c,f){return c.lessthan(f)},Fe.greaterthan=function(c,f){return c.greaterthan(f)},Fe.lessthanorequal=function(c,f){return c.lessthanorequal(f)},Fe.greaterthanorequal=function(c,f){return c.greaterthanorequal(f)},he.prototype=new F,he.prototype.constructor=he,he.superclass=F.prototype;function he(c){arguments.length>0&&this.init(c)}he.prototype.init=function(c){this.str=String(c)},he.prototype.toString=function(){return this.str},he.prototype.evaluate=function(c){return this},he.prototype.string=function(){return this},he.prototype.number=function(){return new ge(this.str)},he.prototype.bool=function(){return new de(this.str)},he.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},he.prototype.stringValue=function(){return this.str},he.prototype.numberValue=function(){return this.number().numberValue()},he.prototype.booleanValue=function(){return this.bool().booleanValue()},he.prototype.equals=function(c){return ae.instance_of(c,de)?this.bool().equals(c):ae.instance_of(c,ge)?this.number().equals(c):ae.instance_of(c,oe)?c.compareWithString(this,Fe.equals):new de(this.str==c.str)},he.prototype.notequal=function(c){return ae.instance_of(c,de)?this.bool().notequal(c):ae.instance_of(c,ge)?this.number().notequal(c):ae.instance_of(c,oe)?c.compareWithString(this,Fe.notequal):new de(this.str!=c.str)},he.prototype.lessthan=function(c){return this.number().lessthan(c)},he.prototype.greaterthan=function(c){return this.number().greaterthan(c)},he.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},he.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},ge.prototype=new F,ge.prototype.constructor=ge,ge.superclass=F.prototype;function ge(c){arguments.length>0&&this.init(c)}ge.prototype.init=function(c){this.num=typeof c=="string"?this.parse(c):Number(c)},ge.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,ge.prototype.parse=function(c){return this.numberFormat.test(c)?parseFloat(c):Number.NaN};function ls(c){for(var f=c.split("e-"),_=f[0].replace(".",""),b=Number(f[1]),v=0;v<b-1;v+=1)_="0"+_;return"0."+_}function Po(c){for(var f=c.split("e"),_=f[0].replace(".",""),b=Number(f[1]),v=b+1-_.length,E=0;E<v;E+=1)_+="0";return _}ge.prototype.toString=function(){var c=this.num.toString();return c.indexOf("e-")!==-1?ls(c):c.indexOf("e")!==-1?Po(c):c},ge.prototype.evaluate=function(c){return this},ge.prototype.string=function(){return new he(this.toString())},ge.prototype.number=function(){return this},ge.prototype.bool=function(){return new de(this.num)},ge.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},ge.prototype.stringValue=function(){return this.string().stringValue()},ge.prototype.numberValue=function(){return this.num},ge.prototype.booleanValue=function(){return this.bool().booleanValue()},ge.prototype.negate=function(){return new ge(-this.num)},ge.prototype.equals=function(c){return ae.instance_of(c,de)?this.bool().equals(c):ae.instance_of(c,he)?this.equals(c.number()):ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.equals):new de(this.num==c.num)},ge.prototype.notequal=function(c){return ae.instance_of(c,de)?this.bool().notequal(c):ae.instance_of(c,he)?this.notequal(c.number()):ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.notequal):new de(this.num!=c.num)},ge.prototype.lessthan=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.greaterthan):ae.instance_of(c,de)||ae.instance_of(c,he)?this.lessthan(c.number()):new de(this.num<c.num)},ge.prototype.greaterthan=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.lessthan):ae.instance_of(c,de)||ae.instance_of(c,he)?this.greaterthan(c.number()):new de(this.num>c.num)},ge.prototype.lessthanorequal=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.greaterthanorequal):ae.instance_of(c,de)||ae.instance_of(c,he)?this.lessthanorequal(c.number()):new de(this.num<=c.num)},ge.prototype.greaterthanorequal=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.lessthanorequal):ae.instance_of(c,de)||ae.instance_of(c,he)?this.greaterthanorequal(c.number()):new de(this.num>=c.num)},ge.prototype.plus=function(c){return new ge(this.num+c.num)},ge.prototype.minus=function(c){return new ge(this.num-c.num)},ge.prototype.multiply=function(c){return new ge(this.num*c.num)},ge.prototype.div=function(c){return new ge(this.num/c.num)},ge.prototype.mod=function(c){return new ge(this.num%c.num)},de.prototype=new F,de.prototype.constructor=de,de.superclass=F.prototype;function de(c){arguments.length>0&&this.init(c)}de.prototype.init=function(c){this.b=!!c},de.prototype.toString=function(){return this.b.toString()},de.prototype.evaluate=function(c){return this},de.prototype.string=function(){return new he(this.b)},de.prototype.number=function(){return new ge(this.b)},de.prototype.bool=function(){return this},de.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},de.prototype.stringValue=function(){return this.string().stringValue()},de.prototype.numberValue=function(){return this.number().numberValue()},de.prototype.booleanValue=function(){return this.b},de.prototype.not=function(){return new de(!this.b)},de.prototype.equals=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.equals(c.bool()):ae.instance_of(c,oe)?c.compareWithBoolean(this,Fe.equals):new de(this.b==c.b)},de.prototype.notequal=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.notequal(c.bool()):ae.instance_of(c,oe)?c.compareWithBoolean(this,Fe.notequal):new de(this.b!=c.b)},de.prototype.lessthan=function(c){return this.number().lessthan(c)},de.prototype.greaterthan=function(c){return this.number().greaterthan(c)},de.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},de.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},de.true_=new de(!0),de.false_=new de(!1),at.prototype=new Object,at.prototype.constructor=at,at.superclass=Object.prototype;function at(c){this.init(c)}at.prototype.init=function(c){this.left=null,this.right=null,this.node=c,this.depth=1},at.prototype.balance=function(){var c=this.left==null?0:this.left.depth,f=this.right==null?0:this.right.depth;if(c>f+1){var _=this.left.left==null?0:this.left.left.depth,b=this.left.right==null?0:this.left.right.depth;_<b&&this.left.rotateRR(),this.rotateLL()}else if(c+1<f){var v=this.right.right==null?0:this.right.right.depth,E=this.right.left==null?0:this.right.left.depth;E>v&&this.right.rotateLL(),this.rotateRR()}},at.prototype.rotateLL=function(){var c=this.node,f=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=f,this.right.node=c,this.right.updateInNewLocation(),this.updateInNewLocation()},at.prototype.rotateRR=function(){var c=this.node,f=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=f,this.left.node=c,this.left.updateInNewLocation(),this.updateInNewLocation()},at.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},at.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function Bo(c,f){if(c===f)return 0;if(c.compareDocumentPosition){var _=c.compareDocumentPosition(f);return _&1||_&10?1:_&20?-1:0}for(var b=0,v=0,E=c;E!=null;E=E.parentNode||E.ownerElement)b++;for(var K=f;K!=null;K=K.parentNode||K.ownerElement)v++;if(b>v){for(;b>v;)c=c.parentNode||c.ownerElement,b--;if(c===f)return 1}else if(v>b){for(;v>b;)f=f.parentNode||f.ownerElement,v--;if(c===f)return-1}for(var _e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;_e!==Ne;)c=_e,f=Ne,_e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;var ie=ae.isAttribute(c),Ae=ae.isAttribute(f);if(ie&&!Ae)return-1;if(!ie&&Ae)return 1;if(_e)for(var bt=ie?_e.attributes:_e.childNodes,je=bt.length,ir=0;ir<je;ir+=1){var sr=bt[ir];if(sr===c)return-1;if(sr===f)return 1}throw new Error("Unexpected: could not determine node order")}at.prototype.add=function(c){if(c===this.node)return!1;var f=Bo(c,this.node),_=!1;return f==-1?this.left==null?(this.left=new at(c),_=!0):(_=this.left.add(c),_&&this.balance()):f==1&&(this.right==null?(this.right=new at(c),_=!0):(_=this.right.add(c),_&&this.balance())),_&&this.getDepthFromChildren(),_},oe.prototype=new F,oe.prototype.constructor=oe,oe.superclass=F.prototype;function oe(){this.init()}oe.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},oe.prototype.toString=function(){var c=this.first();return c==null?"":this.stringForNode(c)},oe.prototype.evaluate=function(c){return this},oe.prototype.string=function(){return new he(this.toString())},oe.prototype.stringValue=function(){return this.toString()},oe.prototype.number=function(){return new ge(this.string())},oe.prototype.numberValue=function(){return Number(this.string())},oe.prototype.bool=function(){return new de(this.booleanValue())},oe.prototype.booleanValue=function(){return!!this.size},oe.prototype.nodeset=function(){return this},oe.prototype.stringForNode=function(c){return c.nodeType==D.DOCUMENT_NODE||c.nodeType==D.ELEMENT_NODE||c.nodeType===D.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(c):c.nodeType===D.ATTRIBUTE_NODE?c.value||c.nodeValue:c.isNamespaceNode?c.namespace:c.nodeValue},oe.prototype.stringForContainerNode=function(c){for(var f="",_=c.firstChild;_!=null;_=_.nextSibling){var b=_.nodeType;(b===1||b===3||b===4||b===9||b===11)&&(f+=this.stringForNode(_))}return f},oe.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new at(this.nodes[0]);for(var c=1;c<this.nodes.length;c+=1)this.tree.add(this.nodes[c])}return this.tree},oe.prototype.first=function(){var c=this.buildTree();if(c==null)return null;for(;c.left!=null;)c=c.left;return c.node},oe.prototype.add=function(c){for(var f=0;f<this.nodes.length;f+=1)if(c===this.nodes[f])return;this.tree=null,this.nodes.push(c),this.size+=1},oe.prototype.addArray=function(c){var f=this;i(function(_){f.add(_)},c)},oe.prototype.toArray=function(){var c=[];return this.toArrayRec(this.buildTree(),c),c},oe.prototype.toArrayRec=function(c,f){c!=null&&(this.toArrayRec(c.left,f),f.push(c.node),this.toArrayRec(c.right,f))},oe.prototype.toUnsortedArray=function(){return this.nodes.slice()},oe.prototype.compareWithString=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new he(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new de(!1)},oe.prototype.compareWithNumber=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new ge(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new de(!1)},oe.prototype.compareWithBoolean=function(c,f){return f(this.bool(),c)},oe.prototype.compareWithNodeSet=function(c,f){for(var _=this.toUnsortedArray(),b=function(_e,Ne){return f(Ne,_e)},v=0;v<_.length;v++){var E=new he(this.stringForNode(_[v])),K=c.compareWithString(E,b);if(K.booleanValue())return K}return new de(!1)},oe.compareWith=r(function(c,f){return ae.instance_of(f,he)?this.compareWithString(f,c):ae.instance_of(f,ge)?this.compareWithNumber(f,c):ae.instance_of(f,de)?this.compareWithBoolean(f,c):this.compareWithNodeSet(f,c)}),oe.prototype.equals=oe.compareWith(Fe.equals),oe.prototype.notequal=oe.compareWith(Fe.notequal),oe.prototype.lessthan=oe.compareWith(Fe.lessthan),oe.prototype.greaterthan=oe.compareWith(Fe.greaterthan),oe.prototype.lessthanorequal=oe.compareWith(Fe.lessthanorequal),oe.prototype.greaterthanorequal=oe.compareWith(Fe.greaterthanorequal),oe.prototype.union=function(c){var f=new oe;return f.addArray(this.toUnsortedArray()),f.addArray(c.toUnsortedArray()),f},zt.prototype=new Object,zt.prototype.constructor=zt,zt.superclass=Object.prototype;function zt(c,f,_){this.isXPathNamespace=!0,this.ownerDocument=_.ownerDocument,this.nodeName="#namespace",this.prefix=c,this.localName=c,this.namespaceURI=f,this.nodeValue=f,this.ownerElement=_,this.nodeType=zt.XPATH_NAMESPACE_NODE}zt.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Vt.prototype=new Object,Vt.prototype.constructor=Vt,Vt.superclass=Object.prototype;function Vt(c,f,_){this.variableResolver=c??new yn,this.namespaceResolver=f??new Qt,this.functionResolver=_??new vt}Vt.prototype.extend=function(c){return R(new Vt,this,c)},yn.prototype=new Object,yn.prototype.constructor=yn,yn.superclass=Object.prototype;function yn(){}yn.prototype.getVariable=function(c,f){return null},vt.prototype=new Object,vt.prototype.constructor=vt,vt.superclass=Object.prototype;function vt(c){this.thisArg=c??me,this.functions=new Object,this.addStandardFunctions()}vt.prototype.addStandardFunctions=function(){this.functions["{}last"]=me.last,this.functions["{}position"]=me.position,this.functions["{}count"]=me.count,this.functions["{}id"]=me.id,this.functions["{}local-name"]=me.localName,this.functions["{}namespace-uri"]=me.namespaceURI,this.functions["{}name"]=me.name,this.functions["{}string"]=me.string,this.functions["{}concat"]=me.concat,this.functions["{}starts-with"]=me.startsWith,this.functions["{}contains"]=me.contains,this.functions["{}substring-before"]=me.substringBefore,this.functions["{}substring-after"]=me.substringAfter,this.functions["{}substring"]=me.substring,this.functions["{}string-length"]=me.stringLength,this.functions["{}normalize-space"]=me.normalizeSpace,this.functions["{}translate"]=me.translate,this.functions["{}boolean"]=me.boolean_,this.functions["{}not"]=me.not,this.functions["{}true"]=me.true_,this.functions["{}false"]=me.false_,this.functions["{}lang"]=me.lang,this.functions["{}number"]=me.number,this.functions["{}sum"]=me.sum,this.functions["{}floor"]=me.floor,this.functions["{}ceiling"]=me.ceiling,this.functions["{}round"]=me.round},vt.prototype.addFunction=function(c,f,_){this.functions["{"+c+"}"+f]=_},vt.getFunctionFromContext=function(c,f){var _=ae.resolveQName(c,f.namespaceResolver,f.contextNode,!1);if(_[0]===null)throw new Error("Cannot resolve QName "+name);return f.functionResolver.getFunction(_[1],_[0])},vt.prototype.getFunction=function(c,f){return this.functions["{"+f+"}"+c]},Qt.prototype=new Object,Qt.prototype.constructor=Qt,Qt.superclass=Object.prototype;function Qt(){}Qt.prototype.getNamespace=function(c,f){if(c=="xml")return M.XML_NAMESPACE_URI;if(c=="xmlns")return M.XMLNS_NAMESPACE_URI;for(f.nodeType==D.DOCUMENT_NODE?f=f.documentElement:f.nodeType==D.ATTRIBUTE_NODE?f=ye.getOwnerElement(f):f.nodeType!=D.ELEMENT_NODE&&(f=f.parentNode);f!=null&&f.nodeType==D.ELEMENT_NODE;){for(var _=f.attributes,b=0;b<_.length;b++){var v=_.item(b),E=v.name||v.nodeName;if(E==="xmlns"&&c===""||E==="xmlns:"+c)return String(v.value||v.nodeValue)}f=f.parentNode}return null};var me=new Object;me.last=function(c){if(arguments.length!=1)throw new Error("Function last expects ()");return new ge(c.contextSize)},me.position=function(c){if(arguments.length!=1)throw new Error("Function position expects ()");return new ge(c.contextPosition)},me.count=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),oe))throw new Error("Function count expects (node-set)");return new ge(f.size)},me.id=function(){var c=arguments[0],f;if(arguments.length!=2)throw new Error("Function id expects (object)");f=arguments[1].evaluate(c),ae.instance_of(f,oe)?f=f.toArray().join(" "):f=f.stringValue();for(var _=f.split(/[\x0d\x0a\x09\x20]+/),b=new oe,v=c.contextNode.nodeType==D.DOCUMENT_NODE?c.contextNode:c.contextNode.ownerDocument,E=0;E<_.length;E++){var K;v.getElementById?K=v.getElementById(_[E]):K=ae.getElementById(v,_[E]),K!=null&&b.add(K)}return b},me.localName=function(c,f){var _;if(arguments.length==1)_=c.contextNode;else if(arguments.length==2)_=f.evaluate(c).first();else throw new Error("Function local-name expects (node-set?)");return _==null?new he(""):new he(_.localName||_.baseName||_.target||_.nodeName||"")},me.namespaceURI=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function namespace-uri expects (node-set?)");return f==null?new he(""):new he(f.namespaceURI)},me.name=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function name expects (node-set?)");return f==null?new he(""):f.nodeType==D.ELEMENT_NODE?new he(f.nodeName):f.nodeType==D.ATTRIBUTE_NODE?new he(f.name||f.nodeName):f.nodeType===D.PROCESSING_INSTRUCTION_NODE?new he(f.target||f.nodeName):f.localName==null?new he(""):new he(f.localName)},me.string=function(){var c=arguments[0];if(arguments.length==1)return new he(oe.prototype.stringForNode(c.contextNode));if(arguments.length==2)return arguments[1].evaluate(c).string();throw new Error("Function string expects (object?)")},me.concat=function(c){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var f="",_=1;_<arguments.length;_++)f+=arguments[_].evaluate(c).stringValue();return new he(f)},me.startsWith=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new de(f.substring(0,_.length)==_)},me.contains=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new de(f.indexOf(_)!==-1)},me.substringBefore=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new he(f.substring(0,f.indexOf(_)))},me.substringAfter=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();if(_.length==0)return new he(f);var b=f.indexOf(_);return b==-1?new he(""):new he(f.substring(b+_.length))},me.substring=function(){var c=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var f=arguments[1].evaluate(c).stringValue(),_=Math.round(arguments[2].evaluate(c).numberValue())-1,b=arguments.length==4?_+Math.round(arguments[3].evaluate(c).numberValue()):void 0;return new he(f.substring(_,b))},me.stringLength=function(){var c=arguments[0],f;if(arguments.length==1)f=oe.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function string-length expects (string?)");return new ge(f.length)},me.normalizeSpace=function(){var c=arguments[0],f;if(arguments.length==1)f=oe.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var _=0,b=f.length-1;ae.isSpace(f.charCodeAt(b));)b--;for(var v="";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;for(;_<=b;)if(ae.isSpace(f.charCodeAt(_)))for(v+=" ";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;else v+=f.charAt(_),_++;return new he(v)},me.translate=function(c,f,_,b){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var v=f.evaluate(c).stringValue(),E=_.evaluate(c).stringValue(),K=b.evaluate(c).stringValue(),_e=s(function(ie,Ae,bt){return Ae in ie||(ie[Ae]=bt>K.length?"":K[bt]),ie},{},E),Ne=h("",a(function(ie){return ie in _e?_e[ie]:ie},v));return new he(Ne)},me.boolean_=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(c).bool()},me.not=function(c,f){if(arguments.length!=2)throw new Error("Function not expects (object)");return f.evaluate(c).bool().not()},me.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return de.true_},me.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return de.false_},me.lang=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var f,_=c.contextNode;_!=null&&_.nodeType!=D.DOCUMENT_NODE;_=_.parentNode){var b=_.getAttributeNS(M.XML_NAMESPACE_URI,"lang");if(b!=null){f=String(b);break}}if(f==null)return de.false_;var v=arguments[1].evaluate(c).stringValue();return new de(f.substring(0,v.length)==v&&(f.length==v.length||f.charAt(v.length)=="-"))},me.number=function(){var c=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new ge(oe.prototype.stringForNode(c.contextNode)):arguments[1].evaluate(c).number()},me.sum=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),oe))throw new Error("Function sum expects (node-set)");f=f.toUnsortedArray();for(var _=0,b=0;b<f.length;b++)_+=new ge(oe.prototype.stringForNode(f[b])).numberValue();return new ge(_)},me.floor=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new ge(Math.floor(arguments[1].evaluate(c).numberValue()))},me.ceiling=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new ge(Math.ceil(arguments[1].evaluate(c).numberValue()))},me.round=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new ge(Math.round(arguments[1].evaluate(c).numberValue()))};var ae=new Object;ae.isAttribute=function(c){return c&&(c.nodeType===D.ATTRIBUTE_NODE||c.ownerElement)},ae.splitQName=function(c){var f=c.indexOf(":");return f==-1?[null,c]:[c.substring(0,f),c.substring(f+1)]},ae.resolveQName=function(c,f,_,b){var v=ae.splitQName(c);return v[0]!=null?v[0]=f.getNamespace(v[0],_):b?(v[0]=f.getNamespace("",_),v[0]==null&&(v[0]="")):v[0]="",v},ae.isSpace=function(c){return c==9||c==13||c==10||c==32},ae.isLetter=function(c){return c>=65&&c<=90||c>=97&&c<=122||c>=192&&c<=214||c>=216&&c<=246||c>=248&&c<=255||c>=256&&c<=305||c>=308&&c<=318||c>=321&&c<=328||c>=330&&c<=382||c>=384&&c<=451||c>=461&&c<=496||c>=500&&c<=501||c>=506&&c<=535||c>=592&&c<=680||c>=699&&c<=705||c==902||c>=904&&c<=906||c==908||c>=910&&c<=929||c>=931&&c<=974||c>=976&&c<=982||c==986||c==988||c==990||c==992||c>=994&&c<=1011||c>=1025&&c<=1036||c>=1038&&c<=1103||c>=1105&&c<=1116||c>=1118&&c<=1153||c>=1168&&c<=1220||c>=1223&&c<=1224||c>=1227&&c<=1228||c>=1232&&c<=1259||c>=1262&&c<=1269||c>=1272&&c<=1273||c>=1329&&c<=1366||c==1369||c>=1377&&c<=1414||c>=1488&&c<=1514||c>=1520&&c<=1522||c>=1569&&c<=1594||c>=1601&&c<=1610||c>=1649&&c<=1719||c>=1722&&c<=1726||c>=1728&&c<=1742||c>=1744&&c<=1747||c==1749||c>=1765&&c<=1766||c>=2309&&c<=2361||c==2365||c>=2392&&c<=2401||c>=2437&&c<=2444||c>=2447&&c<=2448||c>=2451&&c<=2472||c>=2474&&c<=2480||c==2482||c>=2486&&c<=2489||c>=2524&&c<=2525||c>=2527&&c<=2529||c>=2544&&c<=2545||c>=2565&&c<=2570||c>=2575&&c<=2576||c>=2579&&c<=2600||c>=2602&&c<=2608||c>=2610&&c<=2611||c>=2613&&c<=2614||c>=2616&&c<=2617||c>=2649&&c<=2652||c==2654||c>=2674&&c<=2676||c>=2693&&c<=2699||c==2701||c>=2703&&c<=2705||c>=2707&&c<=2728||c>=2730&&c<=2736||c>=2738&&c<=2739||c>=2741&&c<=2745||c==2749||c==2784||c>=2821&&c<=2828||c>=2831&&c<=2832||c>=2835&&c<=2856||c>=2858&&c<=2864||c>=2866&&c<=2867||c>=2870&&c<=2873||c==2877||c>=2908&&c<=2909||c>=2911&&c<=2913||c>=2949&&c<=2954||c>=2958&&c<=2960||c>=2962&&c<=2965||c>=2969&&c<=2970||c==2972||c>=2974&&c<=2975||c>=2979&&c<=2980||c>=2984&&c<=2986||c>=2990&&c<=2997||c>=2999&&c<=3001||c>=3077&&c<=3084||c>=3086&&c<=3088||c>=3090&&c<=3112||c>=3114&&c<=3123||c>=3125&&c<=3129||c>=3168&&c<=3169||c>=3205&&c<=3212||c>=3214&&c<=3216||c>=3218&&c<=3240||c>=3242&&c<=3251||c>=3253&&c<=3257||c==3294||c>=3296&&c<=3297||c>=3333&&c<=3340||c>=3342&&c<=3344||c>=3346&&c<=3368||c>=3370&&c<=3385||c>=3424&&c<=3425||c>=3585&&c<=3630||c==3632||c>=3634&&c<=3635||c>=3648&&c<=3653||c>=3713&&c<=3714||c==3716||c>=3719&&c<=3720||c==3722||c==3725||c>=3732&&c<=3735||c>=3737&&c<=3743||c>=3745&&c<=3747||c==3749||c==3751||c>=3754&&c<=3755||c>=3757&&c<=3758||c==3760||c>=3762&&c<=3763||c==3773||c>=3776&&c<=3780||c>=3904&&c<=3911||c>=3913&&c<=3945||c>=4256&&c<=4293||c>=4304&&c<=4342||c==4352||c>=4354&&c<=4355||c>=4357&&c<=4359||c==4361||c>=4363&&c<=4364||c>=4366&&c<=4370||c==4412||c==4414||c==4416||c==4428||c==4430||c==4432||c>=4436&&c<=4437||c==4441||c>=4447&&c<=4449||c==4451||c==4453||c==4455||c==4457||c>=4461&&c<=4462||c>=4466&&c<=4467||c==4469||c==4510||c==4520||c==4523||c>=4526&&c<=4527||c>=4535&&c<=4536||c==4538||c>=4540&&c<=4546||c==4587||c==4592||c==4601||c>=7680&&c<=7835||c>=7840&&c<=7929||c>=7936&&c<=7957||c>=7960&&c<=7965||c>=7968&&c<=8005||c>=8008&&c<=8013||c>=8016&&c<=8023||c==8025||c==8027||c==8029||c>=8031&&c<=8061||c>=8064&&c<=8116||c>=8118&&c<=8124||c==8126||c>=8130&&c<=8132||c>=8134&&c<=8140||c>=8144&&c<=8147||c>=8150&&c<=8155||c>=8160&&c<=8172||c>=8178&&c<=8180||c>=8182&&c<=8188||c==8486||c>=8490&&c<=8491||c==8494||c>=8576&&c<=8578||c>=12353&&c<=12436||c>=12449&&c<=12538||c>=12549&&c<=12588||c>=44032&&c<=55203||c>=19968&&c<=40869||c==12295||c>=12321&&c<=12329},ae.isNCNameChar=function(c){return c>=48&&c<=57||c>=1632&&c<=1641||c>=1776&&c<=1785||c>=2406&&c<=2415||c>=2534&&c<=2543||c>=2662&&c<=2671||c>=2790&&c<=2799||c>=2918&&c<=2927||c>=3047&&c<=3055||c>=3174&&c<=3183||c>=3302&&c<=3311||c>=3430&&c<=3439||c>=3664&&c<=3673||c>=3792&&c<=3801||c>=3872&&c<=3881||c==46||c==45||c==95||ae.isLetter(c)||c>=768&&c<=837||c>=864&&c<=865||c>=1155&&c<=1158||c>=1425&&c<=1441||c>=1443&&c<=1465||c>=1467&&c<=1469||c==1471||c>=1473&&c<=1474||c==1476||c>=1611&&c<=1618||c==1648||c>=1750&&c<=1756||c>=1757&&c<=1759||c>=1760&&c<=1764||c>=1767&&c<=1768||c>=1770&&c<=1773||c>=2305&&c<=2307||c==2364||c>=2366&&c<=2380||c==2381||c>=2385&&c<=2388||c>=2402&&c<=2403||c>=2433&&c<=2435||c==2492||c==2494||c==2495||c>=2496&&c<=2500||c>=2503&&c<=2504||c>=2507&&c<=2509||c==2519||c>=2530&&c<=2531||c==2562||c==2620||c==2622||c==2623||c>=2624&&c<=2626||c>=2631&&c<=2632||c>=2635&&c<=2637||c>=2672&&c<=2673||c>=2689&&c<=2691||c==2748||c>=2750&&c<=2757||c>=2759&&c<=2761||c>=2763&&c<=2765||c>=2817&&c<=2819||c==2876||c>=2878&&c<=2883||c>=2887&&c<=2888||c>=2891&&c<=2893||c>=2902&&c<=2903||c>=2946&&c<=2947||c>=3006&&c<=3010||c>=3014&&c<=3016||c>=3018&&c<=3021||c==3031||c>=3073&&c<=3075||c>=3134&&c<=3140||c>=3142&&c<=3144||c>=3146&&c<=3149||c>=3157&&c<=3158||c>=3202&&c<=3203||c>=3262&&c<=3268||c>=3270&&c<=3272||c>=3274&&c<=3277||c>=3285&&c<=3286||c>=3330&&c<=3331||c>=3390&&c<=3395||c>=3398&&c<=3400||c>=3402&&c<=3405||c==3415||c==3633||c>=3636&&c<=3642||c>=3655&&c<=3662||c==3761||c>=3764&&c<=3769||c>=3771&&c<=3772||c>=3784&&c<=3789||c>=3864&&c<=3865||c==3893||c==3895||c==3897||c==3902||c==3903||c>=3953&&c<=3972||c>=3974&&c<=3979||c>=3984&&c<=3989||c==3991||c>=3993&&c<=4013||c>=4017&&c<=4023||c==4025||c>=8400&&c<=8412||c==8417||c>=12330&&c<=12335||c==12441||c==12442||c==183||c==720||c==721||c==903||c==1600||c==3654||c==3782||c==12293||c>=12337&&c<=12341||c>=12445&&c<=12446||c>=12540&&c<=12542},ae.coalesceText=function(c){for(var f=c.firstChild;f!=null;f=f.nextSibling)if(f.nodeType==D.TEXT_NODE||f.nodeType==D.CDATA_SECTION_NODE){var _=f.nodeValue,b=f;for(f=f.nextSibling;f!=null&&(f.nodeType==D.TEXT_NODE||f.nodeType==D.CDATA_SECTION_NODE);){_+=f.nodeValue;var v=f;f=f.nextSibling,v.parentNode.removeChild(v)}if(b.nodeType==D.CDATA_SECTION_NODE){var E=b.parentNode;if(b.nextSibling==null)E.removeChild(b),E.appendChild(E.ownerDocument.createTextNode(_));else{var K=b.nextSibling;E.removeChild(b),E.insertBefore(E.ownerDocument.createTextNode(_),K)}}else b.nodeValue=_;if(f==null)break}else f.nodeType==D.ELEMENT_NODE&&ae.coalesceText(f)},ae.instance_of=function(c,f){for(;c!=null;){if(c.constructor===f)return!0;if(c===Object)return!1;c=c.constructor.superclass}return!1},ae.getElementById=function(c,f){if(c.nodeType==D.ELEMENT_NODE&&(c.getAttribute("id")==f||c.getAttributeNS(null,"id")==f))return c;for(var _=c.firstChild;_!=null;_=_.nextSibling){var b=ae.getElementById(_,f);if(b!=null)return b}return null};var Ht=function(){function c(_,b){var v=b?": "+b.toString():"";switch(_){case f.INVALID_EXPRESSION_ERR:return"Invalid expression"+v;case f.TYPE_ERR:return"Type error"+v}return null}function f(_,b,v){var E=Error.call(this,c(_,b)||v);return E.code=_,E.exception=b,E}return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.superclass=Error,f.prototype.toString=function(){return this.message},f.fromMessage=function(_,b){return new f(null,b,_)},f.INVALID_EXPRESSION_ERR=51,f.TYPE_ERR=52,f}();Dt.prototype={},Dt.prototype.constructor=Dt,Dt.superclass=Object.prototype;function Dt(c,f,_){this.xpath=_.parse(c),this.context=new Vt,this.context.namespaceResolver=new wn(f)}Dt.getOwnerDocument=function(c){return c.nodeType===D.DOCUMENT_NODE?c:c.ownerDocument},Dt.detectHtmlDom=function(c){if(!c)return!1;var f=Dt.getOwnerDocument(c);try{return f.implementation.hasFeature("HTML","2.0")}catch{return!0}},Dt.prototype.evaluate=function(c,f,_){this.context.expressionContextNode=c,this.context.caseInsensitive=Dt.detectHtmlDom(c);var b=this.xpath.evaluate(this.context);return new T(b,f)},wn.prototype={},wn.prototype.constructor=wn,wn.superclass=Object.prototype;function wn(c){this.xpathNSResolver=c}wn.prototype.getNamespace=function(c,f){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(c)},O.prototype={},O.prototype.constructor=O,O.superclass=Object.prototype;function O(c){this.node=c,this.namespaceResolver=new Qt}O.prototype.lookupNamespaceURI=function(c){return this.namespaceResolver.getNamespace(c,this.node)},T.prototype={},T.prototype.constructor=T,T.superclass=Object.prototype;function T(c,f){switch(f==T.ANY_TYPE&&(c.constructor===he?f=T.STRING_TYPE:c.constructor===ge?f=T.NUMBER_TYPE:c.constructor===de?f=T.BOOLEAN_TYPE:c.constructor===oe&&(f=T.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=f,f){case T.NUMBER_TYPE:this.numberValue=c.numberValue();return;case T.STRING_TYPE:this.stringValue=c.stringValue();return;case T.BOOLEAN_TYPE:this.booleanValue=c.booleanValue();return;case T.ANY_UNORDERED_NODE_TYPE:case T.FIRST_ORDERED_NODE_TYPE:if(c.constructor===oe){this.singleNodeValue=c.first();return}break;case T.UNORDERED_NODE_ITERATOR_TYPE:case T.ORDERED_NODE_ITERATOR_TYPE:if(c.constructor===oe){this.invalidIteratorState=!1,this.nodes=c.toArray(),this.iteratorIndex=0;return}break;case T.UNORDERED_NODE_SNAPSHOT_TYPE:case T.ORDERED_NODE_SNAPSHOT_TYPE:if(c.constructor===oe){this.nodes=c.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Ht(Ht.TYPE_ERR)}T.prototype.iterateNext=function(){if(this.resultType!=T.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=T.ORDERED_NODE_ITERATOR_TYPE)throw new Ht(Ht.TYPE_ERR);return this.nodes[this.iteratorIndex++]},T.prototype.snapshotItem=function(c){if(this.resultType!=T.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=T.ORDERED_NODE_SNAPSHOT_TYPE)throw new Ht(Ht.TYPE_ERR);return this.nodes[c]},T.ANY_TYPE=0,T.NUMBER_TYPE=1,T.STRING_TYPE=2,T.BOOLEAN_TYPE=3,T.UNORDERED_NODE_ITERATOR_TYPE=4,T.ORDERED_NODE_ITERATOR_TYPE=5,T.UNORDERED_NODE_SNAPSHOT_TYPE=6,T.ORDERED_NODE_SNAPSHOT_TYPE=7,T.ANY_UNORDERED_NODE_TYPE=8,T.FIRST_ORDERED_NODE_TYPE=9;function U(c,f){c.createExpression=function(_,b){try{return new Dt(_,b,f)}catch(v){throw new Ht(Ht.INVALID_EXPRESSION_ERR,v)}},c.createNSResolver=function(_){return new O(_)},c.evaluate=function(_,b,v,E,K){if(E<0||E>9)throw{code:0,toString:function(){return"Request type not supported"}};return c.createExpression(_,v,f).evaluate(b,E,K)}}try{var ee=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(ee=!1)}catch{}ee&&U(document,new x)}catch{}U(n,new x),function(){var c=new x,f=new Qt,_=new vt,b=new yn;function v(J){return{getNamespace:function(Te,xt){var or=J(Te,xt);return or||f.getNamespace(Te,xt)}}}function E(J){return v(J.getNamespace.bind(J))}function K(J){return v(function(Te){return J[Te]})}function _e(J){return J&&typeof J.getNamespace=="function"?E(J):typeof J=="function"?v(J):typeof J=="object"?K(J):f}function Ne(J){if(J===null||typeof J>"u"||J instanceof he||J instanceof de||J instanceof ge||J instanceof oe)return J;switch(typeof J){case"string":return new he(J);case"boolean":return new de(J);case"number":return new ge(J)}var Te=new oe;return Te.addArray([].concat(J)),Te}function ie(J){return function(Te){var xt=Array.prototype.slice.call(arguments,1).map(function(ww){return ww.evaluate(Te)}),or=J.apply(this,[].concat(Te,xt));return Ne(or)}}function Ae(J){return{getFunction:function(Te,xt){var or=J(Te,xt);return or?ie(or):_.getFunction(Te,xt)}}}function bt(J){return Ae(J.getFunction.bind(J))}function je(J){return Ae(function(Te){return J[Te]})}function ir(J){return J&&typeof J.getFunction=="function"?bt(J):typeof J=="function"?Ae(J):typeof J=="object"?je(J):_}function sr(J){return{getVariable:function(Te,xt){var or=J(Te,xt);return Ne(or)}}}function hw(J){if(J){if(typeof J.getVariable=="function")return sr(J.getVariable.bind(J));if(typeof J=="function")return sr(J);if(typeof J=="object")return sr(function(Te){return J[Te]})}return b}function Jf(J,Te,xt){J in xt&&(Te[J]=xt[J])}function gw(J){var Te=new Vt;return J?(Te.namespaceResolver=_e(J.namespaces),Te.functionResolver=ir(J.functions),Te.variableResolver=hw(J.variables),Te.expressionContextNode=J.node,Jf("allowAnyNamespaceForNoPrefix",Te,J),Jf("isHtml",Te,J)):Te.namespaceResolver=f,Te}function mw(J,Te){var xt=gw(Te);return J.evaluate(xt)}var _w={evaluate:function(J){return mw(this.expression,J)},evaluateNumber:function(J){return this.evaluate(J).numberValue()},evaluateString:function(J){return this.evaluate(J).stringValue()},evaluateBoolean:function(J){return this.evaluate(J).booleanValue()},evaluateNodeSet:function(J){return this.evaluate(J).nodeset()},select:function(J){return this.evaluateNodeSet(J).toArray()},select1:function(J){return this.select(J)[0]}};function yw(J){var Te=c.parse(J);return Object.create(_w,{expression:{value:Te}})}n.parse=yw}(),R(n,{XPath:M,XPathParser:x,XPathResult:T,Step:Q,PathExpr:ye,NodeTest:se,LocationPath:Zt,OrOperation:fe,AndOperation:Ce,BarOperation:Z,EqualsOperation:P,NotEqualOperation:j,LessThanOperation:z,GreaterThanOperation:k,LessThanOrEqualOperation:S,GreaterThanOrEqualOperation:B,PlusOperation:V,MinusOperation:ue,MultiplyOperation:re,DivOperation:ve,ModOperation:Se,UnaryMinusOperation:X,FunctionCall:Ot,VariableReference:Ze,XPathContext:Vt,XNodeSet:oe,XBoolean:de,XString:he,XNumber:ge,NamespaceResolver:Qt,FunctionResolver:vt,VariableResolver:yn,Utilities:ae}),n.select=function(c,f,_){return n.selectWithResolver(c,f,null,_)},n.useNamespaces=function(c){var f={mappings:c||{},lookupNamespaceURI:function(_){return this.mappings[_]}};return function(_,b,v){return n.selectWithResolver(_,b,f,v)}},n.selectWithResolver=function(c,f,_,b){var v=new Dt(c,_,new x),E=T.ANY_TYPE,K=v.evaluate(f,E,null);return K.resultType==T.STRING_TYPE?K=K.stringValue:K.resultType==T.NUMBER_TYPE?K=K.numberValue:K.resultType==T.BOOLEAN_TYPE?K=K.booleanValue:(K=K.nodes,b&&(K=K[0])),K},n.select1=function(c,f){return n.select(c,f,!0)};var we=function(c){return c&&typeof c.nodeType=="number"&&Number.isInteger(c.nodeType)&&c.nodeType>=1&&c.nodeType<=11&&typeof c.nodeName=="string"},Qe=function(c){return Array.isArray(c)&&c.every(we)},Re=function(c){return function(f){return we(f)&&f.nodeType===c}};R(n,{isNodeLike:we,isArrayOfNodes:Qe,isElement:Re(D.ELEMENT_NODE),isAttribute:Re(D.ATTRIBUTE_NODE),isTextNode:Re(D.TEXT_NODE),isCDATASection:Re(D.CDATA_SECTION_NODE),isProcessingInstruction:Re(D.PROCESSING_INSTRUCTION_NODE),isComment:Re(D.COMMENT_NODE),isDocumentNode:Re(D.DOCUMENT_NODE),isDocumentTypeNode:Re(D.DOCUMENT_TYPE_NODE),isDocumentFragment:Re(D.DOCUMENT_FRAGMENT_NODE)})})(e)})(Il);var xe={};Object.defineProperty(xe,"__esModule",{value:!0});xe.assertIsDocumentFragmentNode=xe.assertIsDocumentTypeNode=xe.assertIsDocumentNode=xe.assertIsCommentNode=xe.assertIsProcessingInstructionNode=xe.assertIsCDATASectionNode=xe.assertIsTextNode=xe.assertIsAttributeNode=xe.assertIsElementNode=xe.isDocumentFragmentNode=xe.isDocumentTypeNode=xe.isDocumentNode=xe.isCommentNode=xe.isProcessingInstructionNode=xe.isCDATASectionNode=xe.isTextNode=xe.isAttributeNode=xe.isElementNode=xe.assertIsArrayOfNodes=xe.isArrayOfNodes=xe.assertIsNodeLike=xe.isNodeLike=xe.NodeTypes=void 0;var We;(function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(We||(xe.NodeTypes=We={}));function Ol(t){return t&&typeof t=="object"&&Number.isInteger(t.nodeType)&&t.nodeType>=1&&t.nodeType<=11&&typeof t.nodeName=="string"&&typeof t.appendChild=="function"&&typeof t.removeChild=="function"}xe.isNodeLike=Ol;function Q8(t){if(!Ol(t))throw new Error(`Value is not a Node-like object. Received: ${t}`)}xe.assertIsNodeLike=Q8;function Ry(t){return Array.isArray(t)&&t.every(Ol)}xe.isArrayOfNodes=Ry;function e6(t){if(!Ry(t))throw new Error("Value is not an array of Nodes")}xe.assertIsArrayOfNodes=e6;function Dn(t,e){return Ol(e)&&e.nodeType===t}function tr(t,e){const n=Object.keys(We).find(r=>We[r]===t);if(!Dn(t,e))throw new Error(`Value is not of type ${n}`)}const t6=t=>Dn(We.ELEMENT_NODE,t);xe.isElementNode=t6;const n6=t=>Dn(We.ATTRIBUTE_NODE,t);xe.isAttributeNode=n6;const r6=t=>Dn(We.TEXT_NODE,t);xe.isTextNode=r6;const i6=t=>Dn(We.CDATA_SECTION_NODE,t);xe.isCDATASectionNode=i6;const s6=t=>Dn(We.PROCESSING_INSTRUCTION_NODE,t);xe.isProcessingInstructionNode=s6;const o6=t=>Dn(We.COMMENT_NODE,t);xe.isCommentNode=o6;const a6=t=>Dn(We.DOCUMENT_NODE,t);xe.isDocumentNode=a6;const c6=t=>Dn(We.DOCUMENT_TYPE_NODE,t);xe.isDocumentTypeNode=c6;const l6=t=>Dn(We.DOCUMENT_FRAGMENT_NODE,t);xe.isDocumentFragmentNode=l6;const u6=t=>{tr(We.ELEMENT_NODE,t)};xe.assertIsElementNode=u6;const d6=t=>tr(We.ATTRIBUTE_NODE,t);xe.assertIsAttributeNode=d6;const p6=t=>tr(We.TEXT_NODE,t);xe.assertIsTextNode=p6;const f6=t=>tr(We.CDATA_SECTION_NODE,t);xe.assertIsCDATASectionNode=f6;const h6=t=>tr(We.PROCESSING_INSTRUCTION_NODE,t);xe.assertIsProcessingInstructionNode=h6;const g6=t=>tr(We.COMMENT_NODE,t);xe.assertIsCommentNode=g6;const m6=t=>tr(We.DOCUMENT_NODE,t);xe.assertIsDocumentNode=m6;const _6=t=>tr(We.DOCUMENT_TYPE_NODE,t);xe.assertIsDocumentTypeNode=_6;const y6=t=>tr(We.DOCUMENT_FRAGMENT_NODE,t);xe.assertIsDocumentFragmentNode=y6;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateDigestValue=t.findAncestorNs=t.derToPem=t.pemToDer=t.normalizePem=t.BASE64_REGEX=t.EXTRACT_X509_CERTS=t.PEM_FORMAT_REGEX=t.encodeSpecialCharactersInText=t.encodeSpecialCharactersInAttribute=t.findChilds=t.findChildren=t.findAttr=t.isArrayHasLength=void 0;const e=Il,n=xe;function r(F){return Array.isArray(F)&&F.length>0}t.isArrayHasLength=r;function i(F,H,X){return F.localName===H&&(F.namespaceURI===X||X==null)}function s(F,H,X,Y){return F.localName===H&&(!F.namespaceURI&&(Y==null?void 0:Y.namespaceURI)===X||X==null)}function a(F,H,X){for(let Y=0;Y<F.attributes.length;Y++){const fe=F.attributes[Y];if(i(fe,H,X)||s(fe,H,X,F))return fe}return null}t.findAttr=a;function l(F,H,X){const Y=F.documentElement??F,fe=[];for(let Ce=0;Ce<Y.childNodes.length;Ce++){const P=Y.childNodes[Ce];n.isElementNode(P)&&P.localName===H&&(P.namespaceURI===X||X==null)&&fe.push(P)}return fe}t.findChildren=l;function u(F,H,X){return l(F,H,X)}t.findChilds=u;const d={"&":"&amp;","<":"&lt;",'"':"&quot;","\r":"&#xD;","\n":"&#xA;"," ":"&#x9;"},p={"&":"&amp;","<":"&lt;",">":"&gt;","\r":"&#xD;"};function h(F){return F.replace(/([&<"\r\n\t])/g,function(H,X){return d[X]})}t.encodeSpecialCharactersInAttribute=h;function g(F){return F.replace(/([&<>\r])/g,function(H,X){return p[X]})}t.encodeSpecialCharactersInText=g,t.PEM_FORMAT_REGEX=new RegExp("^-----BEGIN [A-Z ]{1,48}-----([^-]*)-----END [A-Z ]{1,48}-----$","s"),t.EXTRACT_X509_CERTS=new RegExp("-----BEGIN CERTIFICATE-----[^-]*-----END CERTIFICATE-----","g"),t.BASE64_REGEX=new RegExp("^(?:[A-Za-z0-9\\+\\/]{4}\\n{0,1})*(?:[A-Za-z0-9\\+\\/]{2}==|[A-Za-z0-9\\+\\/]{3}=)?$","s");function A(F){return`${(F.trim().replace(/(\r\n|\r)/g,`
270
+ `}}),w("div",{id:"_legalWrapper",children:[s&&s.map(d=>{if(d.type==="NEXT_BUTTON")return null;const p=H8(d);return p?w("div",{className:d.type==="RICH_TEXT"?"mb-6":"mb-4",children:p},d.id):null}),u&&w("div",{className:"mb-4",children:l?w(Rf,{children:[w(tt,{id:"continueBtn",className:"sm:mt-4 !text-base w-full",children:[w("span",{children:u.config.text||"Continue"}),w(et,{className:"text-xs",name:"arrow-right"})]}),w(tt,{id:"continueBtnDisabled",className:"sm:mt-4 !text-base w-full opacity-50 cursor-not-allowed",disabled:!0,children:[w("span",{children:u.config.text||"Continue"}),w(et,{className:"text-xs",name:"arrow-right"})]})]}):w(tt,{className:"sm:mt-4 !text-base w-full",children:[w("span",{children:u.config.text||"Continue"}),w(et,{className:"text-xs",name:"arrow-right"})]})})]})]})})]})},K8=new o.OpenAPIHono().openapi(o.createRoute({tags:["forms"],method:"get",path:"/:formId/nodes/:nodeId",request:{params:o.z.object({formId:o.z.string(),nodeId:o.z.string()}),query:o.z.object({state:o.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,theme:s,branding:a}=await Ge(t,r,!0),l=await t.env.data.forms.get(i.tenant.id,e);if(!l)throw new N(404,{message:"Form not found"});const u=(l.nodes||[]).find(d=>d.id===n&&d.type==="STEP");if(!u)throw new N(404,{message:"Node not found or not a STEP node"});return t.html(w(du,{theme:s,branding:a,client:i,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:"components"in u.config?u.config.components:[]}))}).openapi(o.createRoute({tags:["forms"],method:"post",path:"/:formId/nodes/:nodeId",request:{params:o.z.object({formId:o.z.string(),nodeId:o.z.string()}),query:o.z.object({state:o.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.record(o.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"),{theme:i,branding:s,client:a}=await Ge(t,r,!0);let l,u,d=[];try{if(l=await t.env.data.forms.get(a.tenant.id,e),!l)throw new N(404,{message:"Form not found"});if(u=(l.nodes||[]).find(D=>D.id===n&&D.type==="STEP"),!u)throw new N(404,{message:"Node not found or not a STEP node"});d="components"in u.config?u.config.components:[];const p=await t.req.parseBody(),h=[],g={};for(const D of d)if(D.type==="LEGAL"){const x=D.id,M=!!D.required,G=p[x];M&&(!G||G==="")?h.push(x):typeof G=="string"&&(g[x]=G)}if(h.length>0)return t.html(w(du,{theme:i,branding:s,client:a,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:d,error:`Missing required fields: ${h.join(", ")}`}));const A=await t.env.data.loginSessions.get(a.tenant.id,r);if(!A||!A.session_id||!A.authParams)throw new Error("Session expired");const $=await t.env.data.sessions.get(a.tenant.id,A.session_id);if(!$||!$.user_id)throw new Error("Session expired");const I=await t.env.data.users.get(t.var.tenant_id,$.user_id);if(!I)throw new Error("Session expired");const R=await Er(t,{authParams:A.authParams,client:a,user:I,loginSession:A});return R instanceof Response?R:t.json(R)}catch{return t.html(w(du,{theme:i,branding:s,client:a,state:r,formName:(l==null?void 0:l.name)||"",nodeAlias:(u==null?void 0:u.alias)||n||"",components:d||[],error:"Your session has expired. Please try again."}))}});function G8(t){const e=new o.OpenAPIHono,n=t.dataAdapter.cache||Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),r=t.dataAdapter.cache?300:0;e.onError((s,a)=>s instanceof as?a.redirect(s.location,s.status):s instanceof N?a.text(s.message||"Error",s.status):a.text("Unexpected error",500)),e.get("/css/tailwind.css",async s=>{const a=jf;return s.text(a,200,{"content-type":"text/css; charset=utf-8"})}),e.use(async(s,a)=>{const l=ro(s,t.dataAdapter),u=Sl(l,{defaultTtl:r,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:n});return s.env.data=$l(s,u),a()}).use(El).use(Al);const i=e.route("/info",j8).route("/check-account",I8).route("/account",z8).route("/change-email",D8).route("/change-email-confirmation",R8).route("/login/identifier",ZE).route("/enter-code",x8).route("/enter-password",k8).route("/invalid-session",B8).route("/pre-signup",P8).route("/pre-signup-sent",F8).route("/reset-password",C8).route("/forgot-password",T8).route("/validate-email",L8).route("/signup",N8).route("/forms",K8);return i.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),i}const Gt=o.z.object({"#text":o.z.string()}),W8=o.z.object({"#text":o.z.string(),"@_xmlns:saml":o.z.string().optional()}),X8=o.z.object({"samlp:AuthnRequest":o.z.object({"saml:Issuer":W8,"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string().optional(),"@_ForceAuthn":o.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string().datetime(),"@_Destination":o.z.string().url(),"@_AssertionConsumerServiceURL":o.z.string().url().optional(),"@_ProtocolBinding":o.z.string().optional(),"@_Version":o.z.string()})});o.z.array(o.z.object({":@":o.z.object({"@_xmlns":o.z.string(),"@_entityID":o.z.string()}),EntityDescriptor:o.z.array(o.z.object({":@":o.z.object({"@_protocolSupportEnumeration":o.z.string()}),IDPSSODescriptor:o.z.array(o.z.union([o.z.object({KeyDescriptor:o.z.array(o.z.object({KeyInfo:o.z.array(o.z.object({X509Data:o.z.array(o.z.object({X509Certificate:o.z.array(Gt)}))})),":@":o.z.object({"@_xmlns":o.z.string()})})),":@":o.z.object({"@_use":o.z.string()})}),o.z.object({SingleLogoutService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({NameIDFormat:o.z.array(Gt)}),o.z.object({SingleSignOnService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({Attribute:o.z.array(o.z.object({})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string(),"@_xmlns":o.z.string()})})]))}))}));const J8=o.z.object({"saml:AttributeValue":o.z.array(o.z.object({"#text":o.z.string()})),":@":o.z.object({"@_xmlns:xs":o.z.string().optional(),"@_xmlns:xsi":o.z.string(),"@_xsi:type":o.z.string(),"@_Name":o.z.string().optional(),"@_NameFormat":o.z.string().optional()})}),Y8=o.z.object({"ds:Transform":o.z.array(o.z.any()),":@":o.z.object({"@_Algorithm":o.z.string()})}),em=o.z.object({"ds:Signature":o.z.array(o.z.union([o.z.object({"ds:SignedInfo":o.z.array(o.z.union([o.z.object({"ds:CanonicalizationMethod":o.z.array(o.z.string()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o.z.object({"ds:SignatureMethod":o.z.array(o.z.string()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o.z.object({"ds:Reference":o.z.array(o.z.union([o.z.object({"ds:Transforms":o.z.array(Y8)}),o.z.object({"ds:DigestMethod":o.z.array(o.z.string()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o.z.object({"ds:DigestValue":o.z.array(Gt)})]))})]))}),o.z.object({"ds:SignatureValue":o.z.array(Gt)}),o.z.object({"ds:KeyInfo":o.z.array(o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(Gt)}),o.z.object({"ds:Exponent":o.z.array(Gt)})]))}))}))})])),":@":o.z.object({"@_xmlns:ds":o.z.string()})});o.z.array(o.z.object({"samlp:Response":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(Gt)}),em,o.z.object({"samlp:Status":o.z.array(o.z.object({"samlp:StatusCode":o.z.array(Gt),":@":o.z.object({"@_Value":o.z.string()})}))}),o.z.object({"saml:Assertion":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(Gt)}),em,o.z.object({"saml:Subject":o.z.array(o.z.union([o.z.object({"saml:NameID":o.z.array(Gt),":@":o.z.object({"@_Format":o.z.string()})}),o.z.object({"saml:SubjectConfirmation":o.z.array(o.z.object({"saml:SubjectConfirmationData":o.z.array(o.z.any()),":@":o.z.object({"@_InResponseTo":o.z.string(),"@_NotOnOrAfter":o.z.string(),"@_Recipient":o.z.string()})})),":@":o.z.object({"@_Method":o.z.string()})})]))}),o.z.object({"saml:Conditions":o.z.array(o.z.object({"saml:AudienceRestriction":o.z.array(o.z.object({"saml:Audience":o.z.array(Gt)}))})),":@":o.z.object({"@_NotBefore":o.z.string(),"@_NotOnOrAfter":o.z.string()})}),o.z.object({"saml:AuthnStatement":o.z.array(o.z.object({"saml:AuthnContext":o.z.array(o.z.object({"saml:AuthnContextClassRef":o.z.array(Gt)}))})),":@":o.z.object({"@_AuthnInstant":o.z.string(),"@_SessionIndex":o.z.string(),"@_SessionNotOnOrAfter":o.z.string()})}),o.z.object({"saml:AttributeStatement":o.z.array(o.z.object({"saml:Attribute":o.z.array(J8),":@":o.z.object({"@_FriendlyName":o.z.string().optional(),"@_Name":o.z.string(),"@_NameFormat":o.z.string()})}))})])),":@":o.z.object({"@_xmlns":o.z.string(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})})])),":@":o.z.object({"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string(),"@_Destination":o.z.string(),"@_ID":o.z.string(),"@_InResponseTo":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})}));var Z8={},ti={},To={},Il={};(function(t){var e=t;(function(n){function r(c){var f=Array.prototype.slice,_=c.length,b=function(E,K){return function(){return K.apply(this,E.concat(f.call(arguments)))}},v=function(){var E=f.call(arguments);return E.length<_?b(E,v):c.apply(this,f.apply(arguments,[0,_]))};return v}var i=function(c,f){for(var _=0;_<f.length;_+=1)c(f[_],_,f)},s=function(c,f,_){var b=f;return i(function(v,E){b=c(b,v,E)},_),b},a=function(c,f){var _=new Array(f.length);return i(function(b,v){_[v]=c(b)},f),_},l=function(c,f){var _=[];return i(function(b,v){c(b,v)&&_.push(b)},f),_},u=function(c,f){for(var _=0;_<c.length;_+=1)if(c[_]===f)return!0;return!1};function d(c){return function(){return c}}function p(c){return c.toString()}var h=function(c,f){return f.join(c)},g=function(c,f,_){return c+_+f},A=Array.prototype.concat,$=32767;function I(c){for(var f=[],_=0;_<c.length;_+=$){var b=c.slice(_,_+$);f=A.apply(f,b)}return f}function R(c,f){for(var _=Object(c),b=1;b<arguments.length;b++){var v=arguments[b];if(v!=null)for(var E in v)Object.prototype.hasOwnProperty.call(v,E)&&(_[E]=v[E])}return _}var D={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};x.prototype=new Object,x.prototype.constructor=x,x.superclass=Object.prototype;function x(){this.init()}x.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(c){return new ue(c[0],c[2])},this.reduceActions[5]=function(c){return new Ce(c[0],c[2])},this.reduceActions[7]=function(c){return new P(c[0],c[2])},this.reduceActions[8]=function(c){return new j(c[0],c[2])},this.reduceActions[10]=function(c){return new z(c[0],c[2])},this.reduceActions[11]=function(c){return new k(c[0],c[2])},this.reduceActions[12]=function(c){return new S(c[0],c[2])},this.reduceActions[13]=function(c){return new B(c[0],c[2])},this.reduceActions[15]=function(c){return new V(c[0],c[2])},this.reduceActions[16]=function(c){return new de(c[0],c[2])},this.reduceActions[18]=function(c){return new re(c[0],c[2])},this.reduceActions[19]=function(c){return new ve(c[0],c[2])},this.reduceActions[20]=function(c){return new Se(c[0],c[2])},this.reduceActions[22]=function(c){return new W(c[1])},this.reduceActions[24]=function(c){return new Z(c[0],c[2])},this.reduceActions[25]=function(c){return new ye(void 0,void 0,c[0])},this.reduceActions[27]=function(c){return c[0].locationPath=c[2],c[0]},this.reduceActions[28]=function(c){return c[0].locationPath=c[2],c[0].locationPath.steps.unshift(new Q(Q.DESCENDANTORSELF,se.nodeTest,[])),c[0]},this.reduceActions[29]=function(c){return new ye(c[0],[],void 0)},this.reduceActions[30]=function(c){return ae.instance_of(c[0],ye)?(c[0].filterPredicates==null&&(c[0].filterPredicates=[]),c[0].filterPredicates.push(c[1]),c[0]):new ye(c[0],[c[1]],void 0)},this.reduceActions[32]=function(c){return c[1]},this.reduceActions[33]=function(c){return new he(c[0])},this.reduceActions[34]=function(c){return new ge(c[0])},this.reduceActions[36]=function(c){return new Ot(c[0],[])},this.reduceActions[37]=function(c){return new Ot(c[0],c[2])},this.reduceActions[38]=function(c){return[c[0]]},this.reduceActions[39]=function(c){return c[2].unshift(c[0]),c[2]},this.reduceActions[43]=function(c){return new Zt(!0,[])},this.reduceActions[44]=function(c){return c[1].absolute=!0,c[1]},this.reduceActions[46]=function(c){return new Zt(!1,[c[0]])},this.reduceActions[47]=function(c){return c[0].steps.push(c[2]),c[0]},this.reduceActions[49]=function(c){return new Q(c[0],c[1],[])},this.reduceActions[50]=function(c){return new Q(Q.CHILD,c[0],[])},this.reduceActions[51]=function(c){return new Q(c[0],c[1],c[2])},this.reduceActions[52]=function(c){return new Q(Q.CHILD,c[0],c[1])},this.reduceActions[54]=function(c){return[c[0]]},this.reduceActions[55]=function(c){return c[1].unshift(c[0]),c[1]},this.reduceActions[56]=function(c){return c[0]=="ancestor"?Q.ANCESTOR:c[0]=="ancestor-or-self"?Q.ANCESTORORSELF:c[0]=="attribute"?Q.ATTRIBUTE:c[0]=="child"?Q.CHILD:c[0]=="descendant"?Q.DESCENDANT:c[0]=="descendant-or-self"?Q.DESCENDANTORSELF:c[0]=="following"?Q.FOLLOWING:c[0]=="following-sibling"?Q.FOLLOWINGSIBLING:c[0]=="namespace"?Q.NAMESPACE:c[0]=="parent"?Q.PARENT:c[0]=="preceding"?Q.PRECEDING:c[0]=="preceding-sibling"?Q.PRECEDINGSIBLING:c[0]=="self"?Q.SELF:-1},this.reduceActions[57]=function(c){return Q.ATTRIBUTE},this.reduceActions[59]=function(c){return c[0]=="comment"?se.commentTest:c[0]=="text"?se.textTest:c[0]=="processing-instruction"?se.anyPiTest:c[0]=="node"?se.nodeTest:new se(-1,void 0)},this.reduceActions[60]=function(c){return new se.PITest(c[2])},this.reduceActions[61]=function(c){return c[1]},this.reduceActions[63]=function(c){return c[1].absolute=!0,c[1].steps.unshift(new Q(Q.DESCENDANTORSELF,se.nodeTest,[])),c[1]},this.reduceActions[64]=function(c){return c[0].steps.push(new Q(Q.DESCENDANTORSELF,se.nodeTest,[])),c[0].steps.push(c[2]),c[0]},this.reduceActions[65]=function(c){return new Q(Q.SELF,se.nodeTest,[])},this.reduceActions[66]=function(c){return new Q(Q.PARENT,se.nodeTest,[])},this.reduceActions[67]=function(c){return new Ze(c[1])},this.reduceActions[68]=function(c){return se.nameTestAny},this.reduceActions[69]=function(c){return new se.NameTestPrefixAny(c[0].split(":")[0])},this.reduceActions[70]=function(c){return new se.NameTestQName(c[0])}},x.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],x.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],x.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],x.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],x.DOUBLEDOT=2,x.DOUBLECOLON=3,x.DOUBLESLASH=4,x.NOTEQUAL=5,x.LESSTHANOREQUAL=6,x.GREATERTHANOREQUAL=7,x.AND=8,x.OR=9,x.MOD=10,x.DIV=11,x.MULTIPLYOPERATOR=12,x.FUNCTIONNAME=13,x.AXISNAME=14,x.LITERAL=15,x.NUMBER=16,x.ASTERISKNAMETEST=17,x.QNAME=18,x.NCNAMECOLONASTERISK=19,x.NODETYPE=20,x.PROCESSINGINSTRUCTIONWITHLITERAL=21,x.EQUALS=22,x.LESSTHAN=23,x.GREATERTHAN=24,x.PLUS=25,x.MINUS=26,x.BAR=27,x.SLASH=28,x.LEFTPARENTHESIS=29,x.RIGHTPARENTHESIS=30,x.COMMA=31,x.AT=32,x.LEFTBRACKET=33,x.RIGHTBRACKET=34,x.DOT=35,x.DOLLAR=36,x.prototype.tokenize=function(c){for(var f=[],_=[],b=c+"\0",v=0,E=b.charAt(v++);;){for(;E==" "||E==" "||E=="\r"||E==`
271
+ `;)E=b.charAt(v++);if(E=="\0"||v>=b.length)break;if(E=="("){f.push(x.LEFTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E==")"){f.push(x.RIGHTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E=="["){f.push(x.LEFTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="]"){f.push(x.RIGHTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="@"){f.push(x.AT),_.push(E),E=b.charAt(v++);continue}if(E==","){f.push(x.COMMA),_.push(E),E=b.charAt(v++);continue}if(E=="|"){f.push(x.BAR),_.push(E),E=b.charAt(v++);continue}if(E=="+"){f.push(x.PLUS),_.push(E),E=b.charAt(v++);continue}if(E=="-"){f.push(x.MINUS),_.push(E),E=b.charAt(v++);continue}if(E=="="){f.push(x.EQUALS),_.push(E),E=b.charAt(v++);continue}if(E=="$"){f.push(x.DOLLAR),_.push(E),E=b.charAt(v++);continue}if(E=="."){if(E=b.charAt(v++),E=="."){f.push(x.DOUBLEDOT),_.push(".."),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K="."+E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}f.push(x.DOT),_.push(".");continue}if(E=="'"||E=='"'){for(var _e=E,Ne="";v<b.length&&(E=b.charAt(v))!==_e;)Ne+=E,v+=1;if(E!==_e)throw Ht.fromMessage("Unterminated string literal: "+_e+Ne);v+=1,f.push(x.LITERAL),_.push(Ne),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K=E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);if(E=="."&&b.charAt(v)>="0"&&b.charAt(v)<="9")for(K+=E,K+=b.charAt(v++),E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}if(E=="*"){if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){f.push(x.MULTIPLYOPERATOR),_.push(E),E=b.charAt(v++);continue}}f.push(x.ASTERISKNAMETEST),_.push(E),E=b.charAt(v++);continue}if(E==":"&&b.charAt(v)==":"){f.push(x.DOUBLECOLON),_.push("::"),v++,E=b.charAt(v++);continue}if(E=="/"){if(E=b.charAt(v++),E=="/"){f.push(x.DOUBLESLASH),_.push("//"),E=b.charAt(v++);continue}f.push(x.SLASH),_.push("/");continue}if(E=="!"&&b.charAt(v)=="="){f.push(x.NOTEQUAL),_.push("!="),v++,E=b.charAt(v++);continue}if(E=="<"){if(b.charAt(v)=="="){f.push(x.LESSTHANOREQUAL),_.push("<="),v++,E=b.charAt(v++);continue}f.push(x.LESSTHAN),_.push("<"),E=b.charAt(v++);continue}if(E==">"){if(b.charAt(v)=="="){f.push(x.GREATERTHANOREQUAL),_.push(">="),v++,E=b.charAt(v++);continue}f.push(x.GREATERTHAN),_.push(">"),E=b.charAt(v++);continue}if(E=="_"||ae.isLetter(E.charCodeAt(0))){var Ae=E;for(E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){if(Ae=="and"){f.push(x.AND),_.push(Ae);continue}if(Ae=="or"){f.push(x.OR),_.push(Ae);continue}if(Ae=="mod"){f.push(x.MOD),_.push(Ae);continue}if(Ae=="div"){f.push(x.DIV),_.push(Ae);continue}}}if(E==":"){if(b.charAt(v)=="*"){f.push(x.NCNAMECOLONASTERISK),_.push(Ae+":*"),v++,E=b.charAt(v++);continue}if(b.charAt(v)=="_"||ae.isLetter(b.charCodeAt(v))){for(Ae+=":",E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(E=="("){f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}if(b.charAt(v)==":"){f.push(x.AXISNAME),_.push(Ae);continue}}if(E=="("){if(Ae=="comment"||Ae=="text"||Ae=="node"){f.push(x.NODETYPE),_.push(Ae);continue}if(Ae=="processing-instruction"){b.charAt(v)==")"?f.push(x.NODETYPE):f.push(x.PROCESSINGINSTRUCTIONWITHLITERAL),_.push(Ae);continue}f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}throw new Error("Unexpected character "+E)}return f.push(1),_.push("[EOF]"),[f,_]},x.SHIFT="s",x.REDUCE="r",x.ACCEPT="a",x.prototype.parse=function(Ne){var f,_,b=this.tokenize(Ne);if(b!=null){f=b[0],_=b[1];var v=0,E=[],K=[],_e=[],Ne,ie,Ae;for(E.push(0),K.push(1),_e.push("_S"),ie=f[v],Ae=_[v++];;)switch(Ne=E[E.length-1],x.actionTable[Ne].charAt(ie-1)){case x.SHIFT:K.push(-ie),_e.push(Ae),E.push(x.actionTableNumber[Ne].charCodeAt(ie-1)-32),ie=f[v],Ae=_[v++];break;case x.REDUCE:for(var bt=x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][1],je=[],ir=0;ir<bt;ir++)K.pop(),je.unshift(_e.pop()),E.pop();var sr=E[E.length-1];K.push(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]),this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32]==null?_e.push(je[0]):_e.push(this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32](je)),E.push(x.gotoTable[sr].charCodeAt(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]-2)-33);break;case x.ACCEPT:return new M(_e.pop());default:throw new Error("XPath parse error")}}},M.prototype=new Object,M.prototype.constructor=M,M.superclass=Object.prototype;function M(c){this.expression=c}M.prototype.toString=function(){return this.expression.toString()};function G(c,f,_){f in c||(c[f]=_)}M.prototype.evaluate=function(c){return c.contextNode=c.expressionContextNode,c.contextSize=1,c.contextPosition=1,c.isHtml&&(G(c,"caseInsensitive",!0),G(c,"allowAnyNamespaceForNoPrefix",!0)),G(c,"caseInsensitive",!1),this.expression.evaluate(c)},M.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",M.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",F.prototype=new Object,F.prototype.constructor=F,F.superclass=Object.prototype;function F(){}F.prototype.init=function(){},F.prototype.toString=function(){return"<Expression>"},F.prototype.evaluate=function(c){throw new Error("Could not evaluate expression.")},H.prototype=new F,H.prototype.constructor=H,H.superclass=F.prototype;function H(c){arguments.length>0&&this.init(c)}H.prototype.init=function(c){this.rhs=c},W.prototype=new H,W.prototype.constructor=W,W.superclass=H.prototype;function W(c){arguments.length>0&&this.init(c)}W.prototype.init=function(c){W.superclass.init.call(this,c)},W.prototype.evaluate=function(c){return this.rhs.evaluate(c).number().negate()},W.prototype.toString=function(){return"-"+this.rhs.toString()},Y.prototype=new F,Y.prototype.constructor=Y,Y.superclass=F.prototype;function Y(c,f){arguments.length>0&&this.init(c,f)}Y.prototype.init=function(c,f){this.lhs=c,this.rhs=f},ue.prototype=new Y,ue.prototype.constructor=ue,ue.superclass=Y.prototype;function ue(c,f){arguments.length>0&&this.init(c,f)}ue.prototype.init=function(c,f){ue.superclass.init.call(this,c,f)},ue.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},ue.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?f:this.rhs.evaluate(c).bool()},Ce.prototype=new Y,Ce.prototype.constructor=Ce,Ce.superclass=Y.prototype;function Ce(c,f){arguments.length>0&&this.init(c,f)}Ce.prototype.init=function(c,f){Ce.superclass.init.call(this,c,f)},Ce.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ce.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?this.rhs.evaluate(c).bool():f},P.prototype=new Y,P.prototype.constructor=P,P.superclass=Y.prototype;function P(c,f){arguments.length>0&&this.init(c,f)}P.prototype.init=function(c,f){P.superclass.init.call(this,c,f)},P.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},P.prototype.evaluate=function(c){return this.lhs.evaluate(c).equals(this.rhs.evaluate(c))},j.prototype=new Y,j.prototype.constructor=j,j.superclass=Y.prototype;function j(c,f){arguments.length>0&&this.init(c,f)}j.prototype.init=function(c,f){j.superclass.init.call(this,c,f)},j.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},j.prototype.evaluate=function(c){return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c))},z.prototype=new Y,z.prototype.constructor=z,z.superclass=Y.prototype;function z(c,f){arguments.length>0&&this.init(c,f)}z.prototype.init=function(c,f){z.superclass.init.call(this,c,f)},z.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c))},z.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},k.prototype=new Y,k.prototype.constructor=k,k.superclass=Y.prototype;function k(c,f){arguments.length>0&&this.init(c,f)}k.prototype.init=function(c,f){k.superclass.init.call(this,c,f)},k.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c))},k.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},S.prototype=new Y,S.prototype.constructor=S,S.superclass=Y.prototype;function S(c,f){arguments.length>0&&this.init(c,f)}S.prototype.init=function(c,f){S.superclass.init.call(this,c,f)},S.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c))},S.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},B.prototype=new Y,B.prototype.constructor=B,B.superclass=Y.prototype;function B(c,f){arguments.length>0&&this.init(c,f)}B.prototype.init=function(c,f){B.superclass.init.call(this,c,f)},B.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c))},B.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},V.prototype=new Y,V.prototype.constructor=V,V.superclass=Y.prototype;function V(c,f){arguments.length>0&&this.init(c,f)}V.prototype.init=function(c,f){V.superclass.init.call(this,c,f)},V.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number())},V.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},de.prototype=new Y,de.prototype.constructor=de,de.superclass=Y.prototype;function de(c,f){arguments.length>0&&this.init(c,f)}de.prototype.init=function(c,f){de.superclass.init.call(this,c,f)},de.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},re.prototype=new Y,re.prototype.constructor=re,re.superclass=Y.prototype;function re(c,f){arguments.length>0&&this.init(c,f)}re.prototype.init=function(c,f){re.superclass.init.call(this,c,f)},re.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number())},re.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},ve.prototype=new Y,ve.prototype.constructor=ve,ve.superclass=Y.prototype;function ve(c,f){arguments.length>0&&this.init(c,f)}ve.prototype.init=function(c,f){ve.superclass.init.call(this,c,f)},ve.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Se.prototype=new Y,Se.prototype.constructor=Se,Se.superclass=Y.prototype;function Se(c,f){arguments.length>0&&this.init(c,f)}Se.prototype.init=function(c,f){Se.superclass.init.call(this,c,f)},Se.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number())},Se.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},Z.prototype=new Y,Z.prototype.constructor=Z,Z.superclass=Y.prototype;function Z(c,f){arguments.length>0&&this.init(c,f)}Z.prototype.init=function(c,f){Z.superclass.init.call(this,c,f)},Z.prototype.evaluate=function(c){return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset())},Z.prototype.toString=function(){return a(p,[this.lhs,this.rhs]).join(" | ")},ye.prototype=new F,ye.prototype.constructor=ye,ye.superclass=F.prototype;function ye(c,f,_){arguments.length>0&&this.init(c,f,_)}ye.prototype.init=function(c,f,_){ye.superclass.init.call(this),this.filter=c,this.filterPredicates=f,this.locationPath=_};function Rn(c){for(;c&&c.parentNode;)c=c.parentNode;return c}ye.applyPredicates=function(c,f,_){if(c.length===0)return _;var b=f.extend({});return s(function(v,E){return b.contextSize=v.length,l(function(K,_e){return b.contextNode=K,b.contextPosition=_e+1,ye.predicateMatches(E,b)},v)},_,c)},ye.getRoot=function(c,f){var _=f[0];if(_.nodeType===D.DOCUMENT_NODE)return _;if(c.virtualRoot)return c.virtualRoot;var b=_.ownerDocument;if(b)return b;for(var v=_;v.parentNode!=null;)v=v.parentNode;return v},ye.applyStep=function(c,f,_){var b=[];switch(f.contextNode=_,c.axis){case Q.ANCESTOR:if(f.contextNode===f.virtualRoot)break;var v;for(f.contextNode.nodeType==D.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);)v=v.parentNode;break;case Q.ANCESTORORSELF:for(var v=f.contextNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);v=v.nodeType==D.ATTRIBUTE_NODE?ye.getOwnerElement(v):v.parentNode);break;case Q.ATTRIBUTE:var E=f.contextNode.attributes;if(E!=null)for(var K=0;K<E.length;K++){var v=E.item(K);c.nodeTest.matches(v,f)&&b.push(v)}break;case Q.CHILD:for(var v=f.contextNode.firstChild;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.DESCENDANT:for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.DESCENDANTORSELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.FOLLOWING:if(f.contextNode===f.virtualRoot)break;var je=[];f.contextNode.firstChild!=null?je.unshift(f.contextNode.firstChild):je.unshift(f.contextNode.nextSibling);for(var v=f.contextNode.parentNode;v!=null&&v.nodeType!=D.DOCUMENT_NODE&&v!==f.virtualRoot;v=v.parentNode)je.unshift(v.nextSibling);do for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;while(je.length>0);break;case Q.FOLLOWINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.nextSibling;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.NAMESPACE:var _e={};if(f.contextNode.nodeType==D.ELEMENT_NODE){_e.xml=M.XML_NAMESPACE_URI,_e.xmlns=M.XMLNS_NAMESPACE_URI;for(var v=f.contextNode;v!=null&&v.nodeType==D.ELEMENT_NODE;v=v.parentNode)for(var K=0;K<v.attributes.length;K++){var Ne=v.attributes.item(K),ie=String(Ne.name);if(ie=="xmlns")_e[""]==null&&(_e[""]=Ne.value);else if(ie.length>6&&ie.substring(0,6)=="xmlns:"){var Ae=ie.substring(6,ie.length);_e[Ae]==null&&(_e[Ae]=Ne.value)}}for(var Ae in _e){var bt=new zt(Ae,_e[Ae],f.contextNode);c.nodeTest.matches(bt,f)&&b.push(bt)}}break;case Q.PARENT:v=null,f.contextNode!==f.virtualRoot&&(f.contextNode.nodeType==D.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode),v!=null&&c.nodeTest.matches(v,f)&&b.push(v);break;case Q.PRECEDING:var je;f.virtualRoot!=null?je=[f.virtualRoot]:je=[Rn(f.contextNode)];e:for(;je.length>0;)for(var v=je.pop();v!=null;){if(v==f.contextNode)break e;c.nodeTest.matches(v,f)&&b.unshift(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling}break;case Q.PRECEDINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.previousSibling;v!=null;v=v.previousSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.SELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);break}return b};function Be(c,f,_){return ye.applyPredicates(c.predicates,f,ye.applyStep(c,f,_))}function He(c,f,_){return I(a(Be.bind(null,_,c),f))}ye.applySteps=function(c,f,_){return s(He.bind(null,f),_,c)},ye.prototype.applyFilter=function(c,f){if(!this.filter)return{nodes:[c.contextNode]};var _=this.filter.evaluate(c);if(!ae.instance_of(_,oe)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:_}}return{nodes:ye.applyPredicates(this.filterPredicates||[],f,_.toUnsortedArray())}},ye.applyLocationPath=function(c,f,_){if(!c)return _;var b=c.absolute?[ye.getRoot(f,_)]:_;return ye.applySteps(c.steps,f,b)},ye.prototype.evaluate=function(c){var f=R(new Vt,c),_=this.applyFilter(c,f);if("nonNodes"in _)return _.nonNodes;var b=new oe;return b.addArray(ye.applyLocationPath(this.locationPath,f,_.nodes)),b},ye.predicateMatches=function(c,f){var _=c.evaluate(f);return ae.instance_of(_,ge)?f.contextPosition===_.numberValue():_.booleanValue()},ye.predicateString=function(c){return g("[","]",c.toString())},ye.predicatesString=function(c){return h("",a(ye.predicateString,c))},ye.prototype.toString=function(){if(this.filter!=null){var c=p(this.filter);return ae.instance_of(this.filter,he)?g("'","'",c):this.filterPredicates!=null&&this.filterPredicates.length?g("(",")",c)+ye.predicatesString(this.filterPredicates):this.locationPath!=null?c+(this.locationPath.absolute?"":"/")+p(this.locationPath):c}return p(this.locationPath)},ye.getOwnerElement=function(c){if(c.ownerElement)return c.ownerElement;try{if(c.selectSingleNode)return c.selectSingleNode("..")}catch{}for(var f=c.nodeType==D.DOCUMENT_NODE?c:c.ownerDocument,_=f.getElementsByTagName("*"),b=0;b<_.length;b++)for(var v=_.item(b),E=v.attributes,K=0;K<E.length;K++){var _e=E.item(K);if(_e===c)return v}return null},Zt.prototype=new Object,Zt.prototype.constructor=Zt,Zt.superclass=Object.prototype;function Zt(c,f){arguments.length>0&&this.init(c,f)}Zt.prototype.init=function(c,f){this.absolute=c,this.steps=f},Zt.prototype.toString=function(){return(this.absolute?"/":"")+a(p,this.steps).join("/")},Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(c,f,_){arguments.length>0&&this.init(c,f,_)}Q.prototype.init=function(c,f,_){this.axis=c,this.nodeTest=f,this.predicates=_},Q.prototype.toString=function(){return Q.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+ye.predicatesString(this.predicates)},Q.ANCESTOR=0,Q.ANCESTORORSELF=1,Q.ATTRIBUTE=2,Q.CHILD=3,Q.DESCENDANT=4,Q.DESCENDANTORSELF=5,Q.FOLLOWING=6,Q.FOLLOWINGSIBLING=7,Q.NAMESPACE=8,Q.PARENT=9,Q.PRECEDING=10,Q.PRECEDINGSIBLING=11,Q.SELF=12,Q.STEPNAMES=s(function(c,f){return c[f[0]]=f[1],c},{},[[Q.ANCESTOR,"ancestor"],[Q.ANCESTORORSELF,"ancestor-or-self"],[Q.ATTRIBUTE,"attribute"],[Q.CHILD,"child"],[Q.DESCENDANT,"descendant"],[Q.DESCENDANTORSELF,"descendant-or-self"],[Q.FOLLOWING,"following"],[Q.FOLLOWINGSIBLING,"following-sibling"],[Q.NAMESPACE,"namespace"],[Q.PARENT,"parent"],[Q.PRECEDING,"preceding"],[Q.PRECEDINGSIBLING,"preceding-sibling"],[Q.SELF,"self"]]),se.prototype=new Object,se.prototype.constructor=se,se.superclass=Object.prototype;function se(c,f){arguments.length>0&&this.init(c,f)}se.prototype.init=function(c,f){this.type=c,this.value=f},se.prototype.toString=function(){return"<unknown nodetest type>"},se.prototype.matches=function(c,f){console.warn("unknown node test type")},se.NAMETESTANY=0,se.NAMETESTPREFIXANY=1,se.NAMETESTQNAME=2,se.COMMENT=3,se.TEXT=4,se.PI=5,se.NODE=6,se.isNodeType=function(c){return function(f){return u(c,f.nodeType)}},se.makeNodeTestType=function(c,f,_){var b=_||function(){};return b.prototype=new se(c),b.prototype.constructor=b,R(b.prototype,f),b},se.makeNodeTypeTest=function(c,f,_){return new(se.makeNodeTestType(c,{matches:se.isNodeType(f),toString:d(_)}))},se.hasPrefix=function(c){return c.prefix||(c.nodeName||c.tagName).indexOf(":")!==-1},se.isElementOrAttribute=se.isNodeType([1,2]),se.nameSpaceMatches=function(c,f,_){var b=_.namespaceURI||"";if(!c)return!b||f.allowAnyNamespaceForNoPrefix&&!se.hasPrefix(_);var v=f.namespaceResolver.getNamespace(c,f.expressionContextNode);if(v==null)throw new Error("Cannot resolve QName "+c);return v===b},se.localNameMatches=function(c,f,_){var b=_.localName||_.nodeName;return f.caseInsensitive?c.toLowerCase()===b.toLowerCase():c===b},se.NameTestPrefixAny=se.makeNodeTestType(se.NAMETESTPREFIXANY,{matches:function(c,f){return se.isElementOrAttribute(c)&&se.nameSpaceMatches(this.prefix,f,c)},toString:function(){return this.prefix+":*"}},function(f){this.prefix=f}),se.NameTestQName=se.makeNodeTestType(se.NAMETESTQNAME,{matches:function(c,f){return se.isNodeType([D.ELEMENT_NODE,D.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE])(c)&&se.nameSpaceMatches(this.prefix,f,c)&&se.localNameMatches(this.localName,f,c)},toString:function(){return this.name}},function(f){var _=f.split(":");this.name=f,this.prefix=_.length>1?_[0]:null,this.localName=_[_.length>1?1:0]}),se.PITest=se.makeNodeTestType(se.PI,{matches:function(c,f){return se.isNodeType([D.PROCESSING_INSTRUCTION_NODE])(c)&&(c.target||c.nodeName)===this.name},toString:function(){return g('processing-instruction("','")',this.name)}},function(c){this.name=c}),se.nameTestAny=se.makeNodeTypeTest(se.NAMETESTANY,[D.ELEMENT_NODE,D.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE],"*"),se.textTest=se.makeNodeTypeTest(se.TEXT,[D.TEXT_NODE,D.CDATA_SECTION_NODE],"text()"),se.commentTest=se.makeNodeTypeTest(se.COMMENT,[D.COMMENT_NODE],"comment()"),se.nodeTest=se.makeNodeTypeTest(se.NODE,[D.ELEMENT_NODE,D.ATTRIBUTE_NODE,D.TEXT_NODE,D.CDATA_SECTION_NODE,D.PROCESSING_INSTRUCTION_NODE,D.COMMENT_NODE,D.DOCUMENT_NODE],"node()"),se.anyPiTest=se.makeNodeTypeTest(se.PI,[D.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ze.prototype=new F,Ze.prototype.constructor=Ze,Ze.superclass=F.prototype;function Ze(c){arguments.length>0&&this.init(c)}Ze.prototype.init=function(c){this.variable=c},Ze.prototype.toString=function(){return"$"+this.variable},Ze.prototype.evaluate=function(c){var f=ae.resolveQName(this.variable,c.namespaceResolver,c.contextNode,!1);if(f[0]==null)throw new Error("Cannot resolve QName "+fn);var _=c.variableResolver.getVariable(f[1],f[0]);if(!_)throw Ht.fromMessage("Undeclared variable: "+this.toString());return _},Ot.prototype=new F,Ot.prototype.constructor=Ot,Ot.superclass=F.prototype;function Ot(c,f){arguments.length>0&&this.init(c,f)}Ot.prototype.init=function(c,f){this.functionName=c,this.arguments=f},Ot.prototype.toString=function(){for(var c=this.functionName+"(",f=0;f<this.arguments.length;f++)f>0&&(c+=", "),c+=this.arguments[f].toString();return c+")"},Ot.prototype.evaluate=function(c){var f=vt.getFunctionFromContext(this.functionName,c);if(!f)throw new Error("Unknown function "+this.functionName);var _=[c].concat(this.arguments);return f.apply(c.functionResolver.thisArg,_)};var Fe=new Object;Fe.equals=function(c,f){return c.equals(f)},Fe.notequal=function(c,f){return c.notequal(f)},Fe.lessthan=function(c,f){return c.lessthan(f)},Fe.greaterthan=function(c,f){return c.greaterthan(f)},Fe.lessthanorequal=function(c,f){return c.lessthanorequal(f)},Fe.greaterthanorequal=function(c,f){return c.greaterthanorequal(f)},he.prototype=new F,he.prototype.constructor=he,he.superclass=F.prototype;function he(c){arguments.length>0&&this.init(c)}he.prototype.init=function(c){this.str=String(c)},he.prototype.toString=function(){return this.str},he.prototype.evaluate=function(c){return this},he.prototype.string=function(){return this},he.prototype.number=function(){return new ge(this.str)},he.prototype.bool=function(){return new pe(this.str)},he.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},he.prototype.stringValue=function(){return this.str},he.prototype.numberValue=function(){return this.number().numberValue()},he.prototype.booleanValue=function(){return this.bool().booleanValue()},he.prototype.equals=function(c){return ae.instance_of(c,pe)?this.bool().equals(c):ae.instance_of(c,ge)?this.number().equals(c):ae.instance_of(c,oe)?c.compareWithString(this,Fe.equals):new pe(this.str==c.str)},he.prototype.notequal=function(c){return ae.instance_of(c,pe)?this.bool().notequal(c):ae.instance_of(c,ge)?this.number().notequal(c):ae.instance_of(c,oe)?c.compareWithString(this,Fe.notequal):new pe(this.str!=c.str)},he.prototype.lessthan=function(c){return this.number().lessthan(c)},he.prototype.greaterthan=function(c){return this.number().greaterthan(c)},he.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},he.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},ge.prototype=new F,ge.prototype.constructor=ge,ge.superclass=F.prototype;function ge(c){arguments.length>0&&this.init(c)}ge.prototype.init=function(c){this.num=typeof c=="string"?this.parse(c):Number(c)},ge.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,ge.prototype.parse=function(c){return this.numberFormat.test(c)?parseFloat(c):Number.NaN};function ls(c){for(var f=c.split("e-"),_=f[0].replace(".",""),b=Number(f[1]),v=0;v<b-1;v+=1)_="0"+_;return"0."+_}function Po(c){for(var f=c.split("e"),_=f[0].replace(".",""),b=Number(f[1]),v=b+1-_.length,E=0;E<v;E+=1)_+="0";return _}ge.prototype.toString=function(){var c=this.num.toString();return c.indexOf("e-")!==-1?ls(c):c.indexOf("e")!==-1?Po(c):c},ge.prototype.evaluate=function(c){return this},ge.prototype.string=function(){return new he(this.toString())},ge.prototype.number=function(){return this},ge.prototype.bool=function(){return new pe(this.num)},ge.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},ge.prototype.stringValue=function(){return this.string().stringValue()},ge.prototype.numberValue=function(){return this.num},ge.prototype.booleanValue=function(){return this.bool().booleanValue()},ge.prototype.negate=function(){return new ge(-this.num)},ge.prototype.equals=function(c){return ae.instance_of(c,pe)?this.bool().equals(c):ae.instance_of(c,he)?this.equals(c.number()):ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.equals):new pe(this.num==c.num)},ge.prototype.notequal=function(c){return ae.instance_of(c,pe)?this.bool().notequal(c):ae.instance_of(c,he)?this.notequal(c.number()):ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.notequal):new pe(this.num!=c.num)},ge.prototype.lessthan=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.greaterthan):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.lessthan(c.number()):new pe(this.num<c.num)},ge.prototype.greaterthan=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.lessthan):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.greaterthan(c.number()):new pe(this.num>c.num)},ge.prototype.lessthanorequal=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.greaterthanorequal):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.lessthanorequal(c.number()):new pe(this.num<=c.num)},ge.prototype.greaterthanorequal=function(c){return ae.instance_of(c,oe)?c.compareWithNumber(this,Fe.lessthanorequal):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.greaterthanorequal(c.number()):new pe(this.num>=c.num)},ge.prototype.plus=function(c){return new ge(this.num+c.num)},ge.prototype.minus=function(c){return new ge(this.num-c.num)},ge.prototype.multiply=function(c){return new ge(this.num*c.num)},ge.prototype.div=function(c){return new ge(this.num/c.num)},ge.prototype.mod=function(c){return new ge(this.num%c.num)},pe.prototype=new F,pe.prototype.constructor=pe,pe.superclass=F.prototype;function pe(c){arguments.length>0&&this.init(c)}pe.prototype.init=function(c){this.b=!!c},pe.prototype.toString=function(){return this.b.toString()},pe.prototype.evaluate=function(c){return this},pe.prototype.string=function(){return new he(this.b)},pe.prototype.number=function(){return new ge(this.b)},pe.prototype.bool=function(){return this},pe.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},pe.prototype.stringValue=function(){return this.string().stringValue()},pe.prototype.numberValue=function(){return this.number().numberValue()},pe.prototype.booleanValue=function(){return this.b},pe.prototype.not=function(){return new pe(!this.b)},pe.prototype.equals=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.equals(c.bool()):ae.instance_of(c,oe)?c.compareWithBoolean(this,Fe.equals):new pe(this.b==c.b)},pe.prototype.notequal=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.notequal(c.bool()):ae.instance_of(c,oe)?c.compareWithBoolean(this,Fe.notequal):new pe(this.b!=c.b)},pe.prototype.lessthan=function(c){return this.number().lessthan(c)},pe.prototype.greaterthan=function(c){return this.number().greaterthan(c)},pe.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},pe.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},pe.true_=new pe(!0),pe.false_=new pe(!1),at.prototype=new Object,at.prototype.constructor=at,at.superclass=Object.prototype;function at(c){this.init(c)}at.prototype.init=function(c){this.left=null,this.right=null,this.node=c,this.depth=1},at.prototype.balance=function(){var c=this.left==null?0:this.left.depth,f=this.right==null?0:this.right.depth;if(c>f+1){var _=this.left.left==null?0:this.left.left.depth,b=this.left.right==null?0:this.left.right.depth;_<b&&this.left.rotateRR(),this.rotateLL()}else if(c+1<f){var v=this.right.right==null?0:this.right.right.depth,E=this.right.left==null?0:this.right.left.depth;E>v&&this.right.rotateLL(),this.rotateRR()}},at.prototype.rotateLL=function(){var c=this.node,f=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=f,this.right.node=c,this.right.updateInNewLocation(),this.updateInNewLocation()},at.prototype.rotateRR=function(){var c=this.node,f=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=f,this.left.node=c,this.left.updateInNewLocation(),this.updateInNewLocation()},at.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},at.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function Bo(c,f){if(c===f)return 0;if(c.compareDocumentPosition){var _=c.compareDocumentPosition(f);return _&1||_&10?1:_&20?-1:0}for(var b=0,v=0,E=c;E!=null;E=E.parentNode||E.ownerElement)b++;for(var K=f;K!=null;K=K.parentNode||K.ownerElement)v++;if(b>v){for(;b>v;)c=c.parentNode||c.ownerElement,b--;if(c===f)return 1}else if(v>b){for(;v>b;)f=f.parentNode||f.ownerElement,v--;if(c===f)return-1}for(var _e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;_e!==Ne;)c=_e,f=Ne,_e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;var ie=ae.isAttribute(c),Ae=ae.isAttribute(f);if(ie&&!Ae)return-1;if(!ie&&Ae)return 1;if(_e)for(var bt=ie?_e.attributes:_e.childNodes,je=bt.length,ir=0;ir<je;ir+=1){var sr=bt[ir];if(sr===c)return-1;if(sr===f)return 1}throw new Error("Unexpected: could not determine node order")}at.prototype.add=function(c){if(c===this.node)return!1;var f=Bo(c,this.node),_=!1;return f==-1?this.left==null?(this.left=new at(c),_=!0):(_=this.left.add(c),_&&this.balance()):f==1&&(this.right==null?(this.right=new at(c),_=!0):(_=this.right.add(c),_&&this.balance())),_&&this.getDepthFromChildren(),_},oe.prototype=new F,oe.prototype.constructor=oe,oe.superclass=F.prototype;function oe(){this.init()}oe.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},oe.prototype.toString=function(){var c=this.first();return c==null?"":this.stringForNode(c)},oe.prototype.evaluate=function(c){return this},oe.prototype.string=function(){return new he(this.toString())},oe.prototype.stringValue=function(){return this.toString()},oe.prototype.number=function(){return new ge(this.string())},oe.prototype.numberValue=function(){return Number(this.string())},oe.prototype.bool=function(){return new pe(this.booleanValue())},oe.prototype.booleanValue=function(){return!!this.size},oe.prototype.nodeset=function(){return this},oe.prototype.stringForNode=function(c){return c.nodeType==D.DOCUMENT_NODE||c.nodeType==D.ELEMENT_NODE||c.nodeType===D.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(c):c.nodeType===D.ATTRIBUTE_NODE?c.value||c.nodeValue:c.isNamespaceNode?c.namespace:c.nodeValue},oe.prototype.stringForContainerNode=function(c){for(var f="",_=c.firstChild;_!=null;_=_.nextSibling){var b=_.nodeType;(b===1||b===3||b===4||b===9||b===11)&&(f+=this.stringForNode(_))}return f},oe.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new at(this.nodes[0]);for(var c=1;c<this.nodes.length;c+=1)this.tree.add(this.nodes[c])}return this.tree},oe.prototype.first=function(){var c=this.buildTree();if(c==null)return null;for(;c.left!=null;)c=c.left;return c.node},oe.prototype.add=function(c){for(var f=0;f<this.nodes.length;f+=1)if(c===this.nodes[f])return;this.tree=null,this.nodes.push(c),this.size+=1},oe.prototype.addArray=function(c){var f=this;i(function(_){f.add(_)},c)},oe.prototype.toArray=function(){var c=[];return this.toArrayRec(this.buildTree(),c),c},oe.prototype.toArrayRec=function(c,f){c!=null&&(this.toArrayRec(c.left,f),f.push(c.node),this.toArrayRec(c.right,f))},oe.prototype.toUnsortedArray=function(){return this.nodes.slice()},oe.prototype.compareWithString=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new he(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new pe(!1)},oe.prototype.compareWithNumber=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new ge(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new pe(!1)},oe.prototype.compareWithBoolean=function(c,f){return f(this.bool(),c)},oe.prototype.compareWithNodeSet=function(c,f){for(var _=this.toUnsortedArray(),b=function(_e,Ne){return f(Ne,_e)},v=0;v<_.length;v++){var E=new he(this.stringForNode(_[v])),K=c.compareWithString(E,b);if(K.booleanValue())return K}return new pe(!1)},oe.compareWith=r(function(c,f){return ae.instance_of(f,he)?this.compareWithString(f,c):ae.instance_of(f,ge)?this.compareWithNumber(f,c):ae.instance_of(f,pe)?this.compareWithBoolean(f,c):this.compareWithNodeSet(f,c)}),oe.prototype.equals=oe.compareWith(Fe.equals),oe.prototype.notequal=oe.compareWith(Fe.notequal),oe.prototype.lessthan=oe.compareWith(Fe.lessthan),oe.prototype.greaterthan=oe.compareWith(Fe.greaterthan),oe.prototype.lessthanorequal=oe.compareWith(Fe.lessthanorequal),oe.prototype.greaterthanorequal=oe.compareWith(Fe.greaterthanorequal),oe.prototype.union=function(c){var f=new oe;return f.addArray(this.toUnsortedArray()),f.addArray(c.toUnsortedArray()),f},zt.prototype=new Object,zt.prototype.constructor=zt,zt.superclass=Object.prototype;function zt(c,f,_){this.isXPathNamespace=!0,this.ownerDocument=_.ownerDocument,this.nodeName="#namespace",this.prefix=c,this.localName=c,this.namespaceURI=f,this.nodeValue=f,this.ownerElement=_,this.nodeType=zt.XPATH_NAMESPACE_NODE}zt.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Vt.prototype=new Object,Vt.prototype.constructor=Vt,Vt.superclass=Object.prototype;function Vt(c,f,_){this.variableResolver=c??new yn,this.namespaceResolver=f??new Qt,this.functionResolver=_??new vt}Vt.prototype.extend=function(c){return R(new Vt,this,c)},yn.prototype=new Object,yn.prototype.constructor=yn,yn.superclass=Object.prototype;function yn(){}yn.prototype.getVariable=function(c,f){return null},vt.prototype=new Object,vt.prototype.constructor=vt,vt.superclass=Object.prototype;function vt(c){this.thisArg=c??me,this.functions=new Object,this.addStandardFunctions()}vt.prototype.addStandardFunctions=function(){this.functions["{}last"]=me.last,this.functions["{}position"]=me.position,this.functions["{}count"]=me.count,this.functions["{}id"]=me.id,this.functions["{}local-name"]=me.localName,this.functions["{}namespace-uri"]=me.namespaceURI,this.functions["{}name"]=me.name,this.functions["{}string"]=me.string,this.functions["{}concat"]=me.concat,this.functions["{}starts-with"]=me.startsWith,this.functions["{}contains"]=me.contains,this.functions["{}substring-before"]=me.substringBefore,this.functions["{}substring-after"]=me.substringAfter,this.functions["{}substring"]=me.substring,this.functions["{}string-length"]=me.stringLength,this.functions["{}normalize-space"]=me.normalizeSpace,this.functions["{}translate"]=me.translate,this.functions["{}boolean"]=me.boolean_,this.functions["{}not"]=me.not,this.functions["{}true"]=me.true_,this.functions["{}false"]=me.false_,this.functions["{}lang"]=me.lang,this.functions["{}number"]=me.number,this.functions["{}sum"]=me.sum,this.functions["{}floor"]=me.floor,this.functions["{}ceiling"]=me.ceiling,this.functions["{}round"]=me.round},vt.prototype.addFunction=function(c,f,_){this.functions["{"+c+"}"+f]=_},vt.getFunctionFromContext=function(c,f){var _=ae.resolveQName(c,f.namespaceResolver,f.contextNode,!1);if(_[0]===null)throw new Error("Cannot resolve QName "+name);return f.functionResolver.getFunction(_[1],_[0])},vt.prototype.getFunction=function(c,f){return this.functions["{"+f+"}"+c]},Qt.prototype=new Object,Qt.prototype.constructor=Qt,Qt.superclass=Object.prototype;function Qt(){}Qt.prototype.getNamespace=function(c,f){if(c=="xml")return M.XML_NAMESPACE_URI;if(c=="xmlns")return M.XMLNS_NAMESPACE_URI;for(f.nodeType==D.DOCUMENT_NODE?f=f.documentElement:f.nodeType==D.ATTRIBUTE_NODE?f=ye.getOwnerElement(f):f.nodeType!=D.ELEMENT_NODE&&(f=f.parentNode);f!=null&&f.nodeType==D.ELEMENT_NODE;){for(var _=f.attributes,b=0;b<_.length;b++){var v=_.item(b),E=v.name||v.nodeName;if(E==="xmlns"&&c===""||E==="xmlns:"+c)return String(v.value||v.nodeValue)}f=f.parentNode}return null};var me=new Object;me.last=function(c){if(arguments.length!=1)throw new Error("Function last expects ()");return new ge(c.contextSize)},me.position=function(c){if(arguments.length!=1)throw new Error("Function position expects ()");return new ge(c.contextPosition)},me.count=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),oe))throw new Error("Function count expects (node-set)");return new ge(f.size)},me.id=function(){var c=arguments[0],f;if(arguments.length!=2)throw new Error("Function id expects (object)");f=arguments[1].evaluate(c),ae.instance_of(f,oe)?f=f.toArray().join(" "):f=f.stringValue();for(var _=f.split(/[\x0d\x0a\x09\x20]+/),b=new oe,v=c.contextNode.nodeType==D.DOCUMENT_NODE?c.contextNode:c.contextNode.ownerDocument,E=0;E<_.length;E++){var K;v.getElementById?K=v.getElementById(_[E]):K=ae.getElementById(v,_[E]),K!=null&&b.add(K)}return b},me.localName=function(c,f){var _;if(arguments.length==1)_=c.contextNode;else if(arguments.length==2)_=f.evaluate(c).first();else throw new Error("Function local-name expects (node-set?)");return _==null?new he(""):new he(_.localName||_.baseName||_.target||_.nodeName||"")},me.namespaceURI=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function namespace-uri expects (node-set?)");return f==null?new he(""):new he(f.namespaceURI)},me.name=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function name expects (node-set?)");return f==null?new he(""):f.nodeType==D.ELEMENT_NODE?new he(f.nodeName):f.nodeType==D.ATTRIBUTE_NODE?new he(f.name||f.nodeName):f.nodeType===D.PROCESSING_INSTRUCTION_NODE?new he(f.target||f.nodeName):f.localName==null?new he(""):new he(f.localName)},me.string=function(){var c=arguments[0];if(arguments.length==1)return new he(oe.prototype.stringForNode(c.contextNode));if(arguments.length==2)return arguments[1].evaluate(c).string();throw new Error("Function string expects (object?)")},me.concat=function(c){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var f="",_=1;_<arguments.length;_++)f+=arguments[_].evaluate(c).stringValue();return new he(f)},me.startsWith=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new pe(f.substring(0,_.length)==_)},me.contains=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new pe(f.indexOf(_)!==-1)},me.substringBefore=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new he(f.substring(0,f.indexOf(_)))},me.substringAfter=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();if(_.length==0)return new he(f);var b=f.indexOf(_);return b==-1?new he(""):new he(f.substring(b+_.length))},me.substring=function(){var c=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var f=arguments[1].evaluate(c).stringValue(),_=Math.round(arguments[2].evaluate(c).numberValue())-1,b=arguments.length==4?_+Math.round(arguments[3].evaluate(c).numberValue()):void 0;return new he(f.substring(_,b))},me.stringLength=function(){var c=arguments[0],f;if(arguments.length==1)f=oe.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function string-length expects (string?)");return new ge(f.length)},me.normalizeSpace=function(){var c=arguments[0],f;if(arguments.length==1)f=oe.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var _=0,b=f.length-1;ae.isSpace(f.charCodeAt(b));)b--;for(var v="";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;for(;_<=b;)if(ae.isSpace(f.charCodeAt(_)))for(v+=" ";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;else v+=f.charAt(_),_++;return new he(v)},me.translate=function(c,f,_,b){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var v=f.evaluate(c).stringValue(),E=_.evaluate(c).stringValue(),K=b.evaluate(c).stringValue(),_e=s(function(ie,Ae,bt){return Ae in ie||(ie[Ae]=bt>K.length?"":K[bt]),ie},{},E),Ne=h("",a(function(ie){return ie in _e?_e[ie]:ie},v));return new he(Ne)},me.boolean_=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(c).bool()},me.not=function(c,f){if(arguments.length!=2)throw new Error("Function not expects (object)");return f.evaluate(c).bool().not()},me.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return pe.true_},me.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return pe.false_},me.lang=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var f,_=c.contextNode;_!=null&&_.nodeType!=D.DOCUMENT_NODE;_=_.parentNode){var b=_.getAttributeNS(M.XML_NAMESPACE_URI,"lang");if(b!=null){f=String(b);break}}if(f==null)return pe.false_;var v=arguments[1].evaluate(c).stringValue();return new pe(f.substring(0,v.length)==v&&(f.length==v.length||f.charAt(v.length)=="-"))},me.number=function(){var c=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new ge(oe.prototype.stringForNode(c.contextNode)):arguments[1].evaluate(c).number()},me.sum=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),oe))throw new Error("Function sum expects (node-set)");f=f.toUnsortedArray();for(var _=0,b=0;b<f.length;b++)_+=new ge(oe.prototype.stringForNode(f[b])).numberValue();return new ge(_)},me.floor=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new ge(Math.floor(arguments[1].evaluate(c).numberValue()))},me.ceiling=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new ge(Math.ceil(arguments[1].evaluate(c).numberValue()))},me.round=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new ge(Math.round(arguments[1].evaluate(c).numberValue()))};var ae=new Object;ae.isAttribute=function(c){return c&&(c.nodeType===D.ATTRIBUTE_NODE||c.ownerElement)},ae.splitQName=function(c){var f=c.indexOf(":");return f==-1?[null,c]:[c.substring(0,f),c.substring(f+1)]},ae.resolveQName=function(c,f,_,b){var v=ae.splitQName(c);return v[0]!=null?v[0]=f.getNamespace(v[0],_):b?(v[0]=f.getNamespace("",_),v[0]==null&&(v[0]="")):v[0]="",v},ae.isSpace=function(c){return c==9||c==13||c==10||c==32},ae.isLetter=function(c){return c>=65&&c<=90||c>=97&&c<=122||c>=192&&c<=214||c>=216&&c<=246||c>=248&&c<=255||c>=256&&c<=305||c>=308&&c<=318||c>=321&&c<=328||c>=330&&c<=382||c>=384&&c<=451||c>=461&&c<=496||c>=500&&c<=501||c>=506&&c<=535||c>=592&&c<=680||c>=699&&c<=705||c==902||c>=904&&c<=906||c==908||c>=910&&c<=929||c>=931&&c<=974||c>=976&&c<=982||c==986||c==988||c==990||c==992||c>=994&&c<=1011||c>=1025&&c<=1036||c>=1038&&c<=1103||c>=1105&&c<=1116||c>=1118&&c<=1153||c>=1168&&c<=1220||c>=1223&&c<=1224||c>=1227&&c<=1228||c>=1232&&c<=1259||c>=1262&&c<=1269||c>=1272&&c<=1273||c>=1329&&c<=1366||c==1369||c>=1377&&c<=1414||c>=1488&&c<=1514||c>=1520&&c<=1522||c>=1569&&c<=1594||c>=1601&&c<=1610||c>=1649&&c<=1719||c>=1722&&c<=1726||c>=1728&&c<=1742||c>=1744&&c<=1747||c==1749||c>=1765&&c<=1766||c>=2309&&c<=2361||c==2365||c>=2392&&c<=2401||c>=2437&&c<=2444||c>=2447&&c<=2448||c>=2451&&c<=2472||c>=2474&&c<=2480||c==2482||c>=2486&&c<=2489||c>=2524&&c<=2525||c>=2527&&c<=2529||c>=2544&&c<=2545||c>=2565&&c<=2570||c>=2575&&c<=2576||c>=2579&&c<=2600||c>=2602&&c<=2608||c>=2610&&c<=2611||c>=2613&&c<=2614||c>=2616&&c<=2617||c>=2649&&c<=2652||c==2654||c>=2674&&c<=2676||c>=2693&&c<=2699||c==2701||c>=2703&&c<=2705||c>=2707&&c<=2728||c>=2730&&c<=2736||c>=2738&&c<=2739||c>=2741&&c<=2745||c==2749||c==2784||c>=2821&&c<=2828||c>=2831&&c<=2832||c>=2835&&c<=2856||c>=2858&&c<=2864||c>=2866&&c<=2867||c>=2870&&c<=2873||c==2877||c>=2908&&c<=2909||c>=2911&&c<=2913||c>=2949&&c<=2954||c>=2958&&c<=2960||c>=2962&&c<=2965||c>=2969&&c<=2970||c==2972||c>=2974&&c<=2975||c>=2979&&c<=2980||c>=2984&&c<=2986||c>=2990&&c<=2997||c>=2999&&c<=3001||c>=3077&&c<=3084||c>=3086&&c<=3088||c>=3090&&c<=3112||c>=3114&&c<=3123||c>=3125&&c<=3129||c>=3168&&c<=3169||c>=3205&&c<=3212||c>=3214&&c<=3216||c>=3218&&c<=3240||c>=3242&&c<=3251||c>=3253&&c<=3257||c==3294||c>=3296&&c<=3297||c>=3333&&c<=3340||c>=3342&&c<=3344||c>=3346&&c<=3368||c>=3370&&c<=3385||c>=3424&&c<=3425||c>=3585&&c<=3630||c==3632||c>=3634&&c<=3635||c>=3648&&c<=3653||c>=3713&&c<=3714||c==3716||c>=3719&&c<=3720||c==3722||c==3725||c>=3732&&c<=3735||c>=3737&&c<=3743||c>=3745&&c<=3747||c==3749||c==3751||c>=3754&&c<=3755||c>=3757&&c<=3758||c==3760||c>=3762&&c<=3763||c==3773||c>=3776&&c<=3780||c>=3904&&c<=3911||c>=3913&&c<=3945||c>=4256&&c<=4293||c>=4304&&c<=4342||c==4352||c>=4354&&c<=4355||c>=4357&&c<=4359||c==4361||c>=4363&&c<=4364||c>=4366&&c<=4370||c==4412||c==4414||c==4416||c==4428||c==4430||c==4432||c>=4436&&c<=4437||c==4441||c>=4447&&c<=4449||c==4451||c==4453||c==4455||c==4457||c>=4461&&c<=4462||c>=4466&&c<=4467||c==4469||c==4510||c==4520||c==4523||c>=4526&&c<=4527||c>=4535&&c<=4536||c==4538||c>=4540&&c<=4546||c==4587||c==4592||c==4601||c>=7680&&c<=7835||c>=7840&&c<=7929||c>=7936&&c<=7957||c>=7960&&c<=7965||c>=7968&&c<=8005||c>=8008&&c<=8013||c>=8016&&c<=8023||c==8025||c==8027||c==8029||c>=8031&&c<=8061||c>=8064&&c<=8116||c>=8118&&c<=8124||c==8126||c>=8130&&c<=8132||c>=8134&&c<=8140||c>=8144&&c<=8147||c>=8150&&c<=8155||c>=8160&&c<=8172||c>=8178&&c<=8180||c>=8182&&c<=8188||c==8486||c>=8490&&c<=8491||c==8494||c>=8576&&c<=8578||c>=12353&&c<=12436||c>=12449&&c<=12538||c>=12549&&c<=12588||c>=44032&&c<=55203||c>=19968&&c<=40869||c==12295||c>=12321&&c<=12329},ae.isNCNameChar=function(c){return c>=48&&c<=57||c>=1632&&c<=1641||c>=1776&&c<=1785||c>=2406&&c<=2415||c>=2534&&c<=2543||c>=2662&&c<=2671||c>=2790&&c<=2799||c>=2918&&c<=2927||c>=3047&&c<=3055||c>=3174&&c<=3183||c>=3302&&c<=3311||c>=3430&&c<=3439||c>=3664&&c<=3673||c>=3792&&c<=3801||c>=3872&&c<=3881||c==46||c==45||c==95||ae.isLetter(c)||c>=768&&c<=837||c>=864&&c<=865||c>=1155&&c<=1158||c>=1425&&c<=1441||c>=1443&&c<=1465||c>=1467&&c<=1469||c==1471||c>=1473&&c<=1474||c==1476||c>=1611&&c<=1618||c==1648||c>=1750&&c<=1756||c>=1757&&c<=1759||c>=1760&&c<=1764||c>=1767&&c<=1768||c>=1770&&c<=1773||c>=2305&&c<=2307||c==2364||c>=2366&&c<=2380||c==2381||c>=2385&&c<=2388||c>=2402&&c<=2403||c>=2433&&c<=2435||c==2492||c==2494||c==2495||c>=2496&&c<=2500||c>=2503&&c<=2504||c>=2507&&c<=2509||c==2519||c>=2530&&c<=2531||c==2562||c==2620||c==2622||c==2623||c>=2624&&c<=2626||c>=2631&&c<=2632||c>=2635&&c<=2637||c>=2672&&c<=2673||c>=2689&&c<=2691||c==2748||c>=2750&&c<=2757||c>=2759&&c<=2761||c>=2763&&c<=2765||c>=2817&&c<=2819||c==2876||c>=2878&&c<=2883||c>=2887&&c<=2888||c>=2891&&c<=2893||c>=2902&&c<=2903||c>=2946&&c<=2947||c>=3006&&c<=3010||c>=3014&&c<=3016||c>=3018&&c<=3021||c==3031||c>=3073&&c<=3075||c>=3134&&c<=3140||c>=3142&&c<=3144||c>=3146&&c<=3149||c>=3157&&c<=3158||c>=3202&&c<=3203||c>=3262&&c<=3268||c>=3270&&c<=3272||c>=3274&&c<=3277||c>=3285&&c<=3286||c>=3330&&c<=3331||c>=3390&&c<=3395||c>=3398&&c<=3400||c>=3402&&c<=3405||c==3415||c==3633||c>=3636&&c<=3642||c>=3655&&c<=3662||c==3761||c>=3764&&c<=3769||c>=3771&&c<=3772||c>=3784&&c<=3789||c>=3864&&c<=3865||c==3893||c==3895||c==3897||c==3902||c==3903||c>=3953&&c<=3972||c>=3974&&c<=3979||c>=3984&&c<=3989||c==3991||c>=3993&&c<=4013||c>=4017&&c<=4023||c==4025||c>=8400&&c<=8412||c==8417||c>=12330&&c<=12335||c==12441||c==12442||c==183||c==720||c==721||c==903||c==1600||c==3654||c==3782||c==12293||c>=12337&&c<=12341||c>=12445&&c<=12446||c>=12540&&c<=12542},ae.coalesceText=function(c){for(var f=c.firstChild;f!=null;f=f.nextSibling)if(f.nodeType==D.TEXT_NODE||f.nodeType==D.CDATA_SECTION_NODE){var _=f.nodeValue,b=f;for(f=f.nextSibling;f!=null&&(f.nodeType==D.TEXT_NODE||f.nodeType==D.CDATA_SECTION_NODE);){_+=f.nodeValue;var v=f;f=f.nextSibling,v.parentNode.removeChild(v)}if(b.nodeType==D.CDATA_SECTION_NODE){var E=b.parentNode;if(b.nextSibling==null)E.removeChild(b),E.appendChild(E.ownerDocument.createTextNode(_));else{var K=b.nextSibling;E.removeChild(b),E.insertBefore(E.ownerDocument.createTextNode(_),K)}}else b.nodeValue=_;if(f==null)break}else f.nodeType==D.ELEMENT_NODE&&ae.coalesceText(f)},ae.instance_of=function(c,f){for(;c!=null;){if(c.constructor===f)return!0;if(c===Object)return!1;c=c.constructor.superclass}return!1},ae.getElementById=function(c,f){if(c.nodeType==D.ELEMENT_NODE&&(c.getAttribute("id")==f||c.getAttributeNS(null,"id")==f))return c;for(var _=c.firstChild;_!=null;_=_.nextSibling){var b=ae.getElementById(_,f);if(b!=null)return b}return null};var Ht=function(){function c(_,b){var v=b?": "+b.toString():"";switch(_){case f.INVALID_EXPRESSION_ERR:return"Invalid expression"+v;case f.TYPE_ERR:return"Type error"+v}return null}function f(_,b,v){var E=Error.call(this,c(_,b)||v);return E.code=_,E.exception=b,E}return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.superclass=Error,f.prototype.toString=function(){return this.message},f.fromMessage=function(_,b){return new f(null,b,_)},f.INVALID_EXPRESSION_ERR=51,f.TYPE_ERR=52,f}();Dt.prototype={},Dt.prototype.constructor=Dt,Dt.superclass=Object.prototype;function Dt(c,f,_){this.xpath=_.parse(c),this.context=new Vt,this.context.namespaceResolver=new wn(f)}Dt.getOwnerDocument=function(c){return c.nodeType===D.DOCUMENT_NODE?c:c.ownerDocument},Dt.detectHtmlDom=function(c){if(!c)return!1;var f=Dt.getOwnerDocument(c);try{return f.implementation.hasFeature("HTML","2.0")}catch{return!0}},Dt.prototype.evaluate=function(c,f,_){this.context.expressionContextNode=c,this.context.caseInsensitive=Dt.detectHtmlDom(c);var b=this.xpath.evaluate(this.context);return new T(b,f)},wn.prototype={},wn.prototype.constructor=wn,wn.superclass=Object.prototype;function wn(c){this.xpathNSResolver=c}wn.prototype.getNamespace=function(c,f){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(c)},O.prototype={},O.prototype.constructor=O,O.superclass=Object.prototype;function O(c){this.node=c,this.namespaceResolver=new Qt}O.prototype.lookupNamespaceURI=function(c){return this.namespaceResolver.getNamespace(c,this.node)},T.prototype={},T.prototype.constructor=T,T.superclass=Object.prototype;function T(c,f){switch(f==T.ANY_TYPE&&(c.constructor===he?f=T.STRING_TYPE:c.constructor===ge?f=T.NUMBER_TYPE:c.constructor===pe?f=T.BOOLEAN_TYPE:c.constructor===oe&&(f=T.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=f,f){case T.NUMBER_TYPE:this.numberValue=c.numberValue();return;case T.STRING_TYPE:this.stringValue=c.stringValue();return;case T.BOOLEAN_TYPE:this.booleanValue=c.booleanValue();return;case T.ANY_UNORDERED_NODE_TYPE:case T.FIRST_ORDERED_NODE_TYPE:if(c.constructor===oe){this.singleNodeValue=c.first();return}break;case T.UNORDERED_NODE_ITERATOR_TYPE:case T.ORDERED_NODE_ITERATOR_TYPE:if(c.constructor===oe){this.invalidIteratorState=!1,this.nodes=c.toArray(),this.iteratorIndex=0;return}break;case T.UNORDERED_NODE_SNAPSHOT_TYPE:case T.ORDERED_NODE_SNAPSHOT_TYPE:if(c.constructor===oe){this.nodes=c.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Ht(Ht.TYPE_ERR)}T.prototype.iterateNext=function(){if(this.resultType!=T.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=T.ORDERED_NODE_ITERATOR_TYPE)throw new Ht(Ht.TYPE_ERR);return this.nodes[this.iteratorIndex++]},T.prototype.snapshotItem=function(c){if(this.resultType!=T.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=T.ORDERED_NODE_SNAPSHOT_TYPE)throw new Ht(Ht.TYPE_ERR);return this.nodes[c]},T.ANY_TYPE=0,T.NUMBER_TYPE=1,T.STRING_TYPE=2,T.BOOLEAN_TYPE=3,T.UNORDERED_NODE_ITERATOR_TYPE=4,T.ORDERED_NODE_ITERATOR_TYPE=5,T.UNORDERED_NODE_SNAPSHOT_TYPE=6,T.ORDERED_NODE_SNAPSHOT_TYPE=7,T.ANY_UNORDERED_NODE_TYPE=8,T.FIRST_ORDERED_NODE_TYPE=9;function U(c,f){c.createExpression=function(_,b){try{return new Dt(_,b,f)}catch(v){throw new Ht(Ht.INVALID_EXPRESSION_ERR,v)}},c.createNSResolver=function(_){return new O(_)},c.evaluate=function(_,b,v,E,K){if(E<0||E>9)throw{code:0,toString:function(){return"Request type not supported"}};return c.createExpression(_,v,f).evaluate(b,E,K)}}try{var ee=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(ee=!1)}catch{}ee&&U(document,new x)}catch{}U(n,new x),function(){var c=new x,f=new Qt,_=new vt,b=new yn;function v(J){return{getNamespace:function(Te,xt){var or=J(Te,xt);return or||f.getNamespace(Te,xt)}}}function E(J){return v(J.getNamespace.bind(J))}function K(J){return v(function(Te){return J[Te]})}function _e(J){return J&&typeof J.getNamespace=="function"?E(J):typeof J=="function"?v(J):typeof J=="object"?K(J):f}function Ne(J){if(J===null||typeof J>"u"||J instanceof he||J instanceof pe||J instanceof ge||J instanceof oe)return J;switch(typeof J){case"string":return new he(J);case"boolean":return new pe(J);case"number":return new ge(J)}var Te=new oe;return Te.addArray([].concat(J)),Te}function ie(J){return function(Te){var xt=Array.prototype.slice.call(arguments,1).map(function(ww){return ww.evaluate(Te)}),or=J.apply(this,[].concat(Te,xt));return Ne(or)}}function Ae(J){return{getFunction:function(Te,xt){var or=J(Te,xt);return or?ie(or):_.getFunction(Te,xt)}}}function bt(J){return Ae(J.getFunction.bind(J))}function je(J){return Ae(function(Te){return J[Te]})}function ir(J){return J&&typeof J.getFunction=="function"?bt(J):typeof J=="function"?Ae(J):typeof J=="object"?je(J):_}function sr(J){return{getVariable:function(Te,xt){var or=J(Te,xt);return Ne(or)}}}function hw(J){if(J){if(typeof J.getVariable=="function")return sr(J.getVariable.bind(J));if(typeof J=="function")return sr(J);if(typeof J=="object")return sr(function(Te){return J[Te]})}return b}function Jf(J,Te,xt){J in xt&&(Te[J]=xt[J])}function gw(J){var Te=new Vt;return J?(Te.namespaceResolver=_e(J.namespaces),Te.functionResolver=ir(J.functions),Te.variableResolver=hw(J.variables),Te.expressionContextNode=J.node,Jf("allowAnyNamespaceForNoPrefix",Te,J),Jf("isHtml",Te,J)):Te.namespaceResolver=f,Te}function mw(J,Te){var xt=gw(Te);return J.evaluate(xt)}var _w={evaluate:function(J){return mw(this.expression,J)},evaluateNumber:function(J){return this.evaluate(J).numberValue()},evaluateString:function(J){return this.evaluate(J).stringValue()},evaluateBoolean:function(J){return this.evaluate(J).booleanValue()},evaluateNodeSet:function(J){return this.evaluate(J).nodeset()},select:function(J){return this.evaluateNodeSet(J).toArray()},select1:function(J){return this.select(J)[0]}};function yw(J){var Te=c.parse(J);return Object.create(_w,{expression:{value:Te}})}n.parse=yw}(),R(n,{XPath:M,XPathParser:x,XPathResult:T,Step:Q,PathExpr:ye,NodeTest:se,LocationPath:Zt,OrOperation:ue,AndOperation:Ce,BarOperation:Z,EqualsOperation:P,NotEqualOperation:j,LessThanOperation:z,GreaterThanOperation:k,LessThanOrEqualOperation:S,GreaterThanOrEqualOperation:B,PlusOperation:V,MinusOperation:de,MultiplyOperation:re,DivOperation:ve,ModOperation:Se,UnaryMinusOperation:W,FunctionCall:Ot,VariableReference:Ze,XPathContext:Vt,XNodeSet:oe,XBoolean:pe,XString:he,XNumber:ge,NamespaceResolver:Qt,FunctionResolver:vt,VariableResolver:yn,Utilities:ae}),n.select=function(c,f,_){return n.selectWithResolver(c,f,null,_)},n.useNamespaces=function(c){var f={mappings:c||{},lookupNamespaceURI:function(_){return this.mappings[_]}};return function(_,b,v){return n.selectWithResolver(_,b,f,v)}},n.selectWithResolver=function(c,f,_,b){var v=new Dt(c,_,new x),E=T.ANY_TYPE,K=v.evaluate(f,E,null);return K.resultType==T.STRING_TYPE?K=K.stringValue:K.resultType==T.NUMBER_TYPE?K=K.numberValue:K.resultType==T.BOOLEAN_TYPE?K=K.booleanValue:(K=K.nodes,b&&(K=K[0])),K},n.select1=function(c,f){return n.select(c,f,!0)};var we=function(c){return c&&typeof c.nodeType=="number"&&Number.isInteger(c.nodeType)&&c.nodeType>=1&&c.nodeType<=11&&typeof c.nodeName=="string"},Qe=function(c){return Array.isArray(c)&&c.every(we)},Re=function(c){return function(f){return we(f)&&f.nodeType===c}};R(n,{isNodeLike:we,isArrayOfNodes:Qe,isElement:Re(D.ELEMENT_NODE),isAttribute:Re(D.ATTRIBUTE_NODE),isTextNode:Re(D.TEXT_NODE),isCDATASection:Re(D.CDATA_SECTION_NODE),isProcessingInstruction:Re(D.PROCESSING_INSTRUCTION_NODE),isComment:Re(D.COMMENT_NODE),isDocumentNode:Re(D.DOCUMENT_NODE),isDocumentTypeNode:Re(D.DOCUMENT_TYPE_NODE),isDocumentFragment:Re(D.DOCUMENT_FRAGMENT_NODE)})})(e)})(Il);var xe={};Object.defineProperty(xe,"__esModule",{value:!0});xe.assertIsDocumentFragmentNode=xe.assertIsDocumentTypeNode=xe.assertIsDocumentNode=xe.assertIsCommentNode=xe.assertIsProcessingInstructionNode=xe.assertIsCDATASectionNode=xe.assertIsTextNode=xe.assertIsAttributeNode=xe.assertIsElementNode=xe.isDocumentFragmentNode=xe.isDocumentTypeNode=xe.isDocumentNode=xe.isCommentNode=xe.isProcessingInstructionNode=xe.isCDATASectionNode=xe.isTextNode=xe.isAttributeNode=xe.isElementNode=xe.assertIsArrayOfNodes=xe.isArrayOfNodes=xe.assertIsNodeLike=xe.isNodeLike=xe.NodeTypes=void 0;var We;(function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(We||(xe.NodeTypes=We={}));function Ol(t){return t&&typeof t=="object"&&Number.isInteger(t.nodeType)&&t.nodeType>=1&&t.nodeType<=11&&typeof t.nodeName=="string"&&typeof t.appendChild=="function"&&typeof t.removeChild=="function"}xe.isNodeLike=Ol;function Q8(t){if(!Ol(t))throw new Error(`Value is not a Node-like object. Received: ${t}`)}xe.assertIsNodeLike=Q8;function Ry(t){return Array.isArray(t)&&t.every(Ol)}xe.isArrayOfNodes=Ry;function e6(t){if(!Ry(t))throw new Error("Value is not an array of Nodes")}xe.assertIsArrayOfNodes=e6;function Dn(t,e){return Ol(e)&&e.nodeType===t}function tr(t,e){const n=Object.keys(We).find(r=>We[r]===t);if(!Dn(t,e))throw new Error(`Value is not of type ${n}`)}const t6=t=>Dn(We.ELEMENT_NODE,t);xe.isElementNode=t6;const n6=t=>Dn(We.ATTRIBUTE_NODE,t);xe.isAttributeNode=n6;const r6=t=>Dn(We.TEXT_NODE,t);xe.isTextNode=r6;const i6=t=>Dn(We.CDATA_SECTION_NODE,t);xe.isCDATASectionNode=i6;const s6=t=>Dn(We.PROCESSING_INSTRUCTION_NODE,t);xe.isProcessingInstructionNode=s6;const o6=t=>Dn(We.COMMENT_NODE,t);xe.isCommentNode=o6;const a6=t=>Dn(We.DOCUMENT_NODE,t);xe.isDocumentNode=a6;const c6=t=>Dn(We.DOCUMENT_TYPE_NODE,t);xe.isDocumentTypeNode=c6;const l6=t=>Dn(We.DOCUMENT_FRAGMENT_NODE,t);xe.isDocumentFragmentNode=l6;const u6=t=>{tr(We.ELEMENT_NODE,t)};xe.assertIsElementNode=u6;const d6=t=>tr(We.ATTRIBUTE_NODE,t);xe.assertIsAttributeNode=d6;const p6=t=>tr(We.TEXT_NODE,t);xe.assertIsTextNode=p6;const f6=t=>tr(We.CDATA_SECTION_NODE,t);xe.assertIsCDATASectionNode=f6;const h6=t=>tr(We.PROCESSING_INSTRUCTION_NODE,t);xe.assertIsProcessingInstructionNode=h6;const g6=t=>tr(We.COMMENT_NODE,t);xe.assertIsCommentNode=g6;const m6=t=>tr(We.DOCUMENT_NODE,t);xe.assertIsDocumentNode=m6;const _6=t=>tr(We.DOCUMENT_TYPE_NODE,t);xe.assertIsDocumentTypeNode=_6;const y6=t=>tr(We.DOCUMENT_FRAGMENT_NODE,t);xe.assertIsDocumentFragmentNode=y6;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateDigestValue=t.findAncestorNs=t.derToPem=t.pemToDer=t.normalizePem=t.BASE64_REGEX=t.EXTRACT_X509_CERTS=t.PEM_FORMAT_REGEX=t.encodeSpecialCharactersInText=t.encodeSpecialCharactersInAttribute=t.findChilds=t.findChildren=t.findAttr=t.isArrayHasLength=void 0;const e=Il,n=xe;function r(F){return Array.isArray(F)&&F.length>0}t.isArrayHasLength=r;function i(F,H,W){return F.localName===H&&(F.namespaceURI===W||W==null)}function s(F,H,W,Y){return F.localName===H&&(!F.namespaceURI&&(Y==null?void 0:Y.namespaceURI)===W||W==null)}function a(F,H,W){for(let Y=0;Y<F.attributes.length;Y++){const ue=F.attributes[Y];if(i(ue,H,W)||s(ue,H,W,F))return ue}return null}t.findAttr=a;function l(F,H,W){const Y=F.documentElement??F,ue=[];for(let Ce=0;Ce<Y.childNodes.length;Ce++){const P=Y.childNodes[Ce];n.isElementNode(P)&&P.localName===H&&(P.namespaceURI===W||W==null)&&ue.push(P)}return ue}t.findChildren=l;function u(F,H,W){return l(F,H,W)}t.findChilds=u;const d={"&":"&amp;","<":"&lt;",'"':"&quot;","\r":"&#xD;","\n":"&#xA;"," ":"&#x9;"},p={"&":"&amp;","<":"&lt;",">":"&gt;","\r":"&#xD;"};function h(F){return F.replace(/([&<"\r\n\t])/g,function(H,W){return d[W]})}t.encodeSpecialCharactersInAttribute=h;function g(F){return F.replace(/([&<>\r])/g,function(H,W){return p[W]})}t.encodeSpecialCharactersInText=g,t.PEM_FORMAT_REGEX=new RegExp("^-----BEGIN [A-Z ]{1,48}-----([^-]*)-----END [A-Z ]{1,48}-----$","s"),t.EXTRACT_X509_CERTS=new RegExp("-----BEGIN CERTIFICATE-----[^-]*-----END CERTIFICATE-----","g"),t.BASE64_REGEX=new RegExp("^(?:[A-Za-z0-9\\+\\/]{4}\\n{0,1})*(?:[A-Za-z0-9\\+\\/]{2}==|[A-Za-z0-9\\+\\/]{3}=)?$","s");function A(F){return`${(F.trim().replace(/(\r\n|\r)/g,`
272
272
  `).match(/.{1,64}/g)??[]).join(`
273
273
  `)}
274
- `}t.normalizePem=A;function $(F){if(!t.PEM_FORMAT_REGEX.test(F.trim()))throw new Error("Invalid PEM format.");return Buffer.from(F.replace(/(\r\n|\r)/g,"").replace(/-----BEGIN [A-Z\x20]{1,48}-----\n?/,"").replace(/-----END [A-Z\x20]{1,48}-----\n?/,""),"base64")}t.pemToDer=$;function I(F,H){const X=Buffer.isBuffer(F)?F.toString("base64").trim():F.replace(/(\r\n|\r)/g,"").trim();if(t.PEM_FORMAT_REGEX.test(X))return A(X);if(t.BASE64_REGEX.test(X.replace(/ /g,""))){if(H==null)throw new Error("PEM label is required when DER is given.");const Y=`-----BEGIN ${H}-----
275
- ${X.replace(/ /g,"")}
276
- -----END ${H}-----`;return A(Y)}throw new Error("Unknown DER format.")}t.derToPem=I;function R(F,H=[]){if(!n.isElementNode(F.parentNode))return H;const X=F.parentNode;if(!X)return H;if(X.attributes&&X.attributes.length>0)for(let Y=0;Y<X.attributes.length;Y++){const fe=X.attributes[Y];fe&&fe.nodeName&&fe.nodeName.search(/^xmlns:?/)!==-1&&H.push({prefix:fe.nodeName.replace(/^xmlns:?/,""),namespaceURI:fe.nodeValue||""})}return R(X,H)}function D(F){const H=F.attributes;for(let X=0;X<H.length;X++){const Y=H[X].nodeName;if(Y.search(/^xmlns:?/)!==-1)return Y.replace(/^xmlns:?/,"")}return F.prefix||""}function x(F){return F.every(H=>n.isElementNode(H))}function M(F,H,X){if(H==null)return[];const Y=e.selectWithResolver(H,F,X);if(!r(Y))return[];if(!x(Y))throw new Error("Document subset must be list of elements");const fe=R(Y[0]),Ce=[];for(let z=0;z<fe.length;z++){let k=!0;for(const S in Ce)if(Ce[S].prefix===fe[z].prefix){k=!1;break}k&&Ce.push(fe[z])}const P=[],j=D(Y[0]);for(const z of Ce)z.prefix!==j&&P.push(z);return P}t.findAncestorNs=M;function G(F,H){const X=Buffer.from(F,"base64"),Y=Buffer.from(H,"base64");if(typeof X.equals=="function")return X.equals(Y);if(X.length!==Y.length)return!1;for(let fe=0;fe<X.length;fe++)if(X[fe]!==Y[fe])return!1;return!0}t.validateDigestValue=G})(To);Object.defineProperty(ti,"__esModule",{value:!0});ti.C14nCanonicalizationWithComments=ti.C14nCanonicalization=void 0;const Ko=To,pu=xe;class Py{constructor(){this.includeComments=!1,this.includeComments=!1}attrCompare(e,n){if(!e.namespaceURI&&n.namespaceURI)return-1;if(!n.namespaceURI&&e.namespaceURI)return 1;const r=e.namespaceURI+e.localName,i=n.namespaceURI+n.localName;return r===i?0:r<i?-1:1}nsCompare(e,n){const r=e.prefix,i=n.prefix;return r===i?0:r.localeCompare(i)}renderAttrs(e){let n,r;const i=[];if(pu.isCommentNode(e))return this.renderComment(e);if(e.attributes)for(n=0;n<e.attributes.length;++n)r=e.attributes[n],r.name.indexOf("xmlns")!==0&&i.push(r);return i.sort(this.attrCompare),i.map(a=>` ${a.name}="${Ko.encodeSpecialCharactersInAttribute(a.value)}"`).join("")}renderNs(e,n,r,i,s){let a,l;const u=[];let d=r;const p=[],h=e.namespaceURI||"";if(e.prefix?n.indexOf(e.prefix)===-1&&(p.push({prefix:e.prefix,namespaceURI:e.namespaceURI||i[e.prefix]}),n.push(e.prefix)):r!==h&&(d=e.namespaceURI||"",u.push(' xmlns="',d,'"')),e.attributes)for(a=0;a<e.attributes.length;++a)l=e.attributes[a],l.prefix==="xmlns"&&n.indexOf(l.localName)===-1&&(p.push({prefix:l.localName,namespaceURI:l.value}),n.push(l.localName)),l.prefix&&n.indexOf(l.prefix)===-1&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(p.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push(l.prefix));if(Ko.isArrayHasLength(s))for(const g of s){let A=!1;for(const $ of p)$.prefix===g.prefix&&$.namespaceURI===g.namespaceURI&&(A=!0);A||p.push(g)}return p.sort(this.nsCompare),u.push(...p.map(g=>g.prefix?` xmlns:${g.prefix}="${g.namespaceURI}"`:` xmlns="${g.namespaceURI}"`)),{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,s){if(pu.isCommentNode(e))return this.renderComment(e);if(e.data)return Ko.encodeSpecialCharactersInText(e.data);if(pu.isElementNode(e)){let a,l;const u=this.renderNs(e,n,r,i,s),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(a=0;a<e.childNodes.length;++a)l=n.slice(0),d.push(this.processInner(e.childNodes[a],l,u.newDefaultNs,i,[]));return d.push("</",e.tagName,">"),d.join("")}throw new Error(`Unable to canonicalize node type: ${e.nodeType}`)}renderComment(e){if(!this.includeComments)return"";const n=e.ownerDocument===e.parentNode;let r=!1,i=!1;if(n){let u=e,d=e;for(;u!==null;){if(u===e.ownerDocument.documentElement){r=!0;break}u=u.nextSibling}for(;d!==null;){if(d===e.ownerDocument.documentElement){i=!0;break}d=d.previousSibling}}const s=i?`
274
+ `}t.normalizePem=A;function $(F){if(!t.PEM_FORMAT_REGEX.test(F.trim()))throw new Error("Invalid PEM format.");return Buffer.from(F.replace(/(\r\n|\r)/g,"").replace(/-----BEGIN [A-Z\x20]{1,48}-----\n?/,"").replace(/-----END [A-Z\x20]{1,48}-----\n?/,""),"base64")}t.pemToDer=$;function I(F,H){const W=Buffer.isBuffer(F)?F.toString("base64").trim():F.replace(/(\r\n|\r)/g,"").trim();if(t.PEM_FORMAT_REGEX.test(W))return A(W);if(t.BASE64_REGEX.test(W.replace(/ /g,""))){if(H==null)throw new Error("PEM label is required when DER is given.");const Y=`-----BEGIN ${H}-----
275
+ ${W.replace(/ /g,"")}
276
+ -----END ${H}-----`;return A(Y)}throw new Error("Unknown DER format.")}t.derToPem=I;function R(F,H=[]){if(!n.isElementNode(F.parentNode))return H;const W=F.parentNode;if(!W)return H;if(W.attributes&&W.attributes.length>0)for(let Y=0;Y<W.attributes.length;Y++){const ue=W.attributes[Y];ue&&ue.nodeName&&ue.nodeName.search(/^xmlns:?/)!==-1&&H.push({prefix:ue.nodeName.replace(/^xmlns:?/,""),namespaceURI:ue.nodeValue||""})}return R(W,H)}function D(F){const H=F.attributes;for(let W=0;W<H.length;W++){const Y=H[W].nodeName;if(Y.search(/^xmlns:?/)!==-1)return Y.replace(/^xmlns:?/,"")}return F.prefix||""}function x(F){return F.every(H=>n.isElementNode(H))}function M(F,H,W){if(H==null)return[];const Y=e.selectWithResolver(H,F,W);if(!r(Y))return[];if(!x(Y))throw new Error("Document subset must be list of elements");const ue=R(Y[0]),Ce=[];for(let z=0;z<ue.length;z++){let k=!0;for(const S in Ce)if(Ce[S].prefix===ue[z].prefix){k=!1;break}k&&Ce.push(ue[z])}const P=[],j=D(Y[0]);for(const z of Ce)z.prefix!==j&&P.push(z);return P}t.findAncestorNs=M;function G(F,H){const W=Buffer.from(F,"base64"),Y=Buffer.from(H,"base64");if(typeof W.equals=="function")return W.equals(Y);if(W.length!==Y.length)return!1;for(let ue=0;ue<W.length;ue++)if(W[ue]!==Y[ue])return!1;return!0}t.validateDigestValue=G})(To);Object.defineProperty(ti,"__esModule",{value:!0});ti.C14nCanonicalizationWithComments=ti.C14nCanonicalization=void 0;const Ko=To,pu=xe;class Py{constructor(){this.includeComments=!1,this.includeComments=!1}attrCompare(e,n){if(!e.namespaceURI&&n.namespaceURI)return-1;if(!n.namespaceURI&&e.namespaceURI)return 1;const r=e.namespaceURI+e.localName,i=n.namespaceURI+n.localName;return r===i?0:r<i?-1:1}nsCompare(e,n){const r=e.prefix,i=n.prefix;return r===i?0:r.localeCompare(i)}renderAttrs(e){let n,r;const i=[];if(pu.isCommentNode(e))return this.renderComment(e);if(e.attributes)for(n=0;n<e.attributes.length;++n)r=e.attributes[n],r.name.indexOf("xmlns")!==0&&i.push(r);return i.sort(this.attrCompare),i.map(a=>` ${a.name}="${Ko.encodeSpecialCharactersInAttribute(a.value)}"`).join("")}renderNs(e,n,r,i,s){let a,l;const u=[];let d=r;const p=[],h=e.namespaceURI||"";if(e.prefix?n.indexOf(e.prefix)===-1&&(p.push({prefix:e.prefix,namespaceURI:e.namespaceURI||i[e.prefix]}),n.push(e.prefix)):r!==h&&(d=e.namespaceURI||"",u.push(' xmlns="',d,'"')),e.attributes)for(a=0;a<e.attributes.length;++a)l=e.attributes[a],l.prefix==="xmlns"&&n.indexOf(l.localName)===-1&&(p.push({prefix:l.localName,namespaceURI:l.value}),n.push(l.localName)),l.prefix&&n.indexOf(l.prefix)===-1&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(p.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push(l.prefix));if(Ko.isArrayHasLength(s))for(const g of s){let A=!1;for(const $ of p)$.prefix===g.prefix&&$.namespaceURI===g.namespaceURI&&(A=!0);A||p.push(g)}return p.sort(this.nsCompare),u.push(...p.map(g=>g.prefix?` xmlns:${g.prefix}="${g.namespaceURI}"`:` xmlns="${g.namespaceURI}"`)),{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,s){if(pu.isCommentNode(e))return this.renderComment(e);if(e.data)return Ko.encodeSpecialCharactersInText(e.data);if(pu.isElementNode(e)){let a,l;const u=this.renderNs(e,n,r,i,s),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(a=0;a<e.childNodes.length;++a)l=n.slice(0),d.push(this.processInner(e.childNodes[a],l,u.newDefaultNs,i,[]));return d.push("</",e.tagName,">"),d.join("")}throw new Error(`Unable to canonicalize node type: ${e.nodeType}`)}renderComment(e){if(!this.includeComments)return"";const n=e.ownerDocument===e.parentNode;let r=!1,i=!1;if(n){let u=e,d=e;for(;u!==null;){if(u===e.ownerDocument.documentElement){r=!0;break}u=u.nextSibling}for(;d!==null;){if(d===e.ownerDocument.documentElement){i=!0;break}d=d.previousSibling}}const s=i?`
277
277
  `:"",a=r?`
278
278
  `:"",l=Ko.encodeSpecialCharactersInText(e.data);return`${s}<!--${l}-->${a}`}process(e,n){n=n||{};const r=n.defaultNs||"",i=n.defaultNsForPrefix||{},s=n.ancestorNamespaces||[],a=[];for(let u=0;u<s.length;u++)a.push(s[u].prefix);return this.processInner(e,a,r,i,s)}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}ti.C14nCanonicalization=Py;class w6 extends Py{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"}}ti.C14nCanonicalizationWithComments=w6;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});ni.ExclusiveCanonicalizationWithComments=ni.ExclusiveCanonicalization=void 0;const Nr=To,fu=xe;function hu(t,e,n){let r=!1;return t.forEach(function(i){i.prefix===e&&i.namespaceURI===n&&(r=!0)}),r}class By{constructor(){this.includeComments=!1,this.includeComments=!1}attrCompare(e,n){if(!e.namespaceURI&&n.namespaceURI)return-1;if(!n.namespaceURI&&e.namespaceURI)return 1;const r=e.namespaceURI+e.localName,i=n.namespaceURI+n.localName;return r===i?0:r<i?-1:1}nsCompare(e,n){const r=e.prefix,i=n.prefix;return r===i?0:r.localeCompare(i)}renderAttrs(e){let n,r;const i=[],s=[];if(fu.isCommentNode(e))return this.renderComment(e);if(e.attributes)for(n=0;n<e.attributes.length;++n)r=e.attributes[n],r.name.indexOf("xmlns")!==0&&s.push(r);s.sort(this.attrCompare);for(r of s)i.push(" ",r.name,'="',Nr.encodeSpecialCharactersInAttribute(r.value),'"');return i.join("")}renderNs(e,n,r,i,s){let a,l;const u=[];let d=r;const p=[],h=e.namespaceURI||"";if(e.prefix?hu(n,e.prefix,e.namespaceURI||i[e.prefix])||(p.push({prefix:e.prefix,namespaceURI:e.namespaceURI||i[e.prefix]}),n.push({prefix:e.prefix,namespaceURI:e.namespaceURI||i[e.prefix]})):r!==h&&(d=e.namespaceURI,u.push(' xmlns="',d,'"')),e.attributes)for(a=0;a<e.attributes.length;++a)l=e.attributes[a],l.prefix&&!hu(n,l.localName,l.value)&&s.indexOf(l.localName)>=0&&(p.push({prefix:l.localName,namespaceURI:l.value}),n.push({prefix:l.localName,namespaceURI:l.value})),l.prefix&&!hu(n,l.prefix,l.namespaceURI)&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(p.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push({prefix:l.prefix,namespaceURI:l.namespaceURI}));p.sort(this.nsCompare);for(const g of p)u.push(" xmlns:",g.prefix,'="',g.namespaceURI,'"');return{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,s){if(fu.isCommentNode(e))return this.renderComment(e);if(e.data)return Nr.encodeSpecialCharactersInText(e.data);if(fu.isElementNode(e)){let a,l;const u=this.renderNs(e,n,r,i,s),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(a=0;a<e.childNodes.length;++a)l=n.slice(0),d.push(this.processInner(e.childNodes[a],l,u.newDefaultNs,i,s));return d.push("</",e.tagName,">"),d.join("")}throw new Error(`Unable to exclusive canonicalize node type: ${e.nodeType}`)}renderComment(e){if(!this.includeComments)return"";const n=e.ownerDocument===e.parentNode;let r=!1,i=!1;if(n){let u=e,d=e;for(;u!=null;){if(u===e.ownerDocument.documentElement){r=!0;break}u=u.nextSibling}for(;d!=null;){if(d===e.ownerDocument.documentElement){i=!0;break}d=d.previousSibling}}const s=i?`
279
279
  `:"",a=r?`
280
280
  `:"",l=Nr.encodeSpecialCharactersInText(e.data);return`${s}<!--${l}-->${a}`}process(e,n){n=n||{};let r=n.inclusiveNamespacesPrefixList||[];const i=n.defaultNs||"",s=n.defaultNsForPrefix||{},a=n.ancestorNamespaces||[];if(!Nr.isArrayHasLength(r)){const u=Nr.findChildren(e,"CanonicalizationMethod");if(u.length!==0){const d=Nr.findChildren(u[0],"InclusiveNamespaces");d.length!==0&&(r=(d[0].getAttribute("PrefixList")||"").split(" "))}}return Nr.isArrayHasLength(r)&&r.forEach(function(u){a&&a.forEach(function(d){u===d.prefix&&e.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${u}`,d.namespaceURI)})}),this.processInner(e,[],i,s,r)}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#"}}ni.ExclusiveCanonicalization=By;class v6 extends By{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"}}ni.ExclusiveCanonicalizationWithComments=v6;var zl={},Dl={},nr={},rr={};function b6(t,e,n){if(n===void 0&&(n=Array.prototype),t&&typeof n.find=="function")return n.find.call(t,e);for(var r=0;r<t.length;r++)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];if(e.call(void 0,i,r,t))return i}}function Lf(t,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(t):t}function x6(t,e){if(t===null||typeof t!="object")throw new TypeError("target is not an object");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}var jy=Lf({HTML:"text/html",isHTML:function(t){return t===jy.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Ly=Lf({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===Ly.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});rr.assign=x6;rr.find=b6;rr.freeze=Lf;rr.MIME_TYPE=jy;rr.NAMESPACE=Ly;var Fy=rr,kn=Fy.find,Qs=Fy.NAMESPACE;function $6(t){return t!==""}function A6(t){return t?t.split(/[\t\n\f\r ]+/).filter($6):[]}function E6(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function tm(t){if(!t)return[];var e=A6(t);return Object.keys(e.reduce(E6,{}))}function S6(t){return function(e){return t&&t.indexOf(e)!==-1}}function Io(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Tt(t,e){var n=t.prototype;if(!(n instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Io(n,r),t.prototype=n=r}n.constructor!=t&&(typeof t!="function"&&console.error("unknown Class:"+t),n.constructor=t)}var It={},un=It.ELEMENT_NODE=1,Vi=It.ATTRIBUTE_NODE=2,gc=It.TEXT_NODE=3,Uy=It.CDATA_SECTION_NODE=4,My=It.ENTITY_REFERENCE_NODE=5,k6=It.ENTITY_NODE=6,qy=It.PROCESSING_INSTRUCTION_NODE=7,Vy=It.COMMENT_NODE=8,Hy=It.DOCUMENT_NODE=9,Ky=It.DOCUMENT_TYPE_NODE=10,Wn=It.DOCUMENT_FRAGMENT_NODE=11,N6=It.NOTATION_NODE=12,gt={},ot={};gt.INDEX_SIZE_ERR=(ot[1]="Index size error",1);gt.DOMSTRING_SIZE_ERR=(ot[2]="DOMString size error",2);var Et=gt.HIERARCHY_REQUEST_ERR=(ot[3]="Hierarchy request error",3);gt.WRONG_DOCUMENT_ERR=(ot[4]="Wrong document",4);gt.INVALID_CHARACTER_ERR=(ot[5]="Invalid character",5);gt.NO_DATA_ALLOWED_ERR=(ot[6]="No data allowed",6);gt.NO_MODIFICATION_ALLOWED_ERR=(ot[7]="No modification allowed",7);var Gy=gt.NOT_FOUND_ERR=(ot[8]="Not found",8);gt.NOT_SUPPORTED_ERR=(ot[9]="Not supported",9);var nm=gt.INUSE_ATTRIBUTE_ERR=(ot[10]="Attribute in use",10);gt.INVALID_STATE_ERR=(ot[11]="Invalid state",11);gt.SYNTAX_ERR=(ot[12]="Syntax error",12);gt.INVALID_MODIFICATION_ERR=(ot[13]="Invalid modification",13);gt.NAMESPACE_ERR=(ot[14]="Invalid namespace",14);gt.INVALID_ACCESS_ERR=(ot[15]="Invalid access",15);function Je(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,ot[t]),this.message=ot[t],Error.captureStackTrace&&Error.captureStackTrace(this,Je);return n.code=t,e&&(this.message=this.message+": "+e),n}Je.prototype=Error.prototype;Io(gt,Je);function Fn(){}Fn.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var n=[],r=0;r<this.length;r++)xi(this[r],n,t,e);return n.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}};function Hi(t,e){this._node=t,this._refresh=e,Ff(this)}function Ff(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(sw(t,"length",n.length),!t.$$length||n.length<t.$$length)for(var r=n.length;r in t;r++)Object.prototype.hasOwnProperty.call(t,r)&&delete t[r];Io(n,t),t._inc=e}}Hi.prototype.item=function(t){return Ff(this),this[t]||null};Tt(Hi,Fn);function mc(){}function Wy(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function rm(t,e,n,r){if(r?e[Wy(e,r)]=n:e[e.length++]=n,t){n.ownerElement=t;var i=t.ownerDocument;i&&(r&&Yy(i,t,r),C6(i,t,n))}}function im(t,e,n){var r=Wy(e,n);if(r>=0){for(var i=e.length-1;r<i;)e[r]=e[++r];if(e.length=i,t){var s=t.ownerDocument;s&&(Yy(s,t,n),n.ownerElement=null)}}else throw new Je(Gy,new Error(t.tagName+"@"+n))}mc.prototype={length:0,item:Fn.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var n=this[e];if(n.nodeName==t)return n}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new Je(nm);var n=this.getNamedItem(t.nodeName);return rm(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e=t.ownerElement,n;if(e&&e!=this._ownerElement)throw new Je(nm);return n=this.getNamedItemNS(t.namespaceURI,t.localName),rm(this._ownerElement,this,t,n),n},removeNamedItem:function(t){var e=this.getNamedItem(t);return im(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return im(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){for(var n=this.length;n--;){var r=this[n];if(r.localName==e&&r.namespaceURI==t)return r}return null}};function Xy(){}Xy.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var r=new Oo;if(r.implementation=this,r.childNodes=new Fn,r.doctype=n||null,n&&r.appendChild(n),e){var i=r.createElementNS(t,e);r.appendChild(i)}return r},createDocumentType:function(t,e,n){var r=new Rl;return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=n||"",r}};function Pe(){}Pe.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return _c(this,t,e)},replaceChild:function(t,e){_c(this,t,e,Qy),e&&this.removeChild(e)},removeChild:function(t){return Zy(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return ap(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==gc&&t.nodeType==gc?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===t)return r}e=e.nodeType==Vi?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,t))return n[t];e=e.nodeType==Vi?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function Jy(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}Io(It,Pe);Io(It,Pe.prototype);function eo(t,e){if(e(t))return!0;if(t=t.firstChild)do if(eo(t,e))return!0;while(t=t.nextSibling)}function Oo(){this.ownerDocument=this}function C6(t,e,n){t&&t._inc++;var r=n.namespaceURI;r===Qs.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}function Yy(t,e,n,r){t&&t._inc++;var i=n.namespaceURI;i===Qs.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function Uf(t,e,n){if(t&&t._inc){t._inc++;var r=e.childNodes;if(n)r[r.length++]=n;else{for(var i=e.firstChild,s=0;i;)r[s++]=i,i=i.nextSibling;r.length=s,delete r[r.length]}}}function Zy(t,e){var n=e.previousSibling,r=e.nextSibling;return n?n.nextSibling=r:t.firstChild=r,r?r.previousSibling=n:t.lastChild=n,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Uf(t.ownerDocument,t),e}function T6(t){return t&&(t.nodeType===Pe.DOCUMENT_NODE||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.ELEMENT_NODE)}function I6(t){return t&&(Nn(t)||Mf(t)||Xn(t)||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.COMMENT_NODE||t.nodeType===Pe.PROCESSING_INSTRUCTION_NODE)}function Xn(t){return t&&t.nodeType===Pe.DOCUMENT_TYPE_NODE}function Nn(t){return t&&t.nodeType===Pe.ELEMENT_NODE}function Mf(t){return t&&t.nodeType===Pe.TEXT_NODE}function sm(t,e){var n=t.childNodes||[];if(kn(n,Nn)||Xn(e))return!1;var r=kn(n,Xn);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function om(t,e){var n=t.childNodes||[];function r(s){return Nn(s)&&s!==e}if(kn(n,r))return!1;var i=kn(n,Xn);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function O6(t,e,n){if(!T6(t))throw new Je(Et,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new Je(Gy,"child not in parent");if(!I6(e)||Xn(e)&&t.nodeType!==Pe.DOCUMENT_NODE)throw new Je(Et,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function z6(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var s=i.filter(Nn);if(s.length>1||kn(i,Mf))throw new Je(Et,"More than one element or text in fragment");if(s.length===1&&!sm(t,n))throw new Je(Et,"Element in fragment can not be inserted before doctype")}if(Nn(e)&&!sm(t,n))throw new Je(Et,"Only one element can be added and only after doctype");if(Xn(e)){if(kn(r,Xn))throw new Je(Et,"Only one doctype is allowed");var a=kn(r,Nn);if(n&&r.indexOf(a)<r.indexOf(n))throw new Je(Et,"Doctype can only be inserted before an element");if(!n&&a)throw new Je(Et,"Doctype can not be appended since element is present")}}function Qy(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var s=i.filter(Nn);if(s.length>1||kn(i,Mf))throw new Je(Et,"More than one element or text in fragment");if(s.length===1&&!om(t,n))throw new Je(Et,"Element in fragment can not be inserted before doctype")}if(Nn(e)&&!om(t,n))throw new Je(Et,"Only one element can be added and only after doctype");if(Xn(e)){if(kn(r,function(u){return Xn(u)&&u!==n}))throw new Je(Et,"Only one doctype is allowed");var a=kn(r,Nn);if(n&&r.indexOf(a)<r.indexOf(n))throw new Je(Et,"Doctype can only be inserted before an element")}}function _c(t,e,n,r){O6(t,e,n),t.nodeType===Pe.DOCUMENT_NODE&&(r||z6)(t,e,n);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===Wn){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var l=n?n.previousSibling:t.lastChild;s.previousSibling=l,a.nextSibling=n,l?l.nextSibling=s:t.firstChild=s,n==null?t.lastChild=a:n.previousSibling=a;do s.parentNode=t;while(s!==a&&(s=s.nextSibling));return Uf(t.ownerDocument||t,t),e.nodeType==Wn&&(e.firstChild=e.lastChild=null),e}function D6(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,Uf(t.ownerDocument,t,e),e}Oo.prototype={nodeName:"#document",nodeType:Hy,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==Wn){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return _c(this,t,e),t.ownerDocument=this,this.documentElement===null&&t.nodeType===un&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),Zy(this,t)},replaceChild:function(t,e){_c(this,t,e,Qy),t.ownerDocument=this,e&&this.removeChild(e),Nn(t)&&(this.documentElement=t)},importNode:function(t,e){return iw(this,t,e)},getElementById:function(t){var e=null;return eo(this.documentElement,function(n){if(n.nodeType==un&&n.getAttribute("id")==t)return e=n,!0}),e},getElementsByClassName:function(t){var e=tm(t);return new Hi(this,function(n){var r=[];return e.length>0&&eo(n.documentElement,function(i){if(i!==n&&i.nodeType===un){var s=i.getAttribute("class");if(s){var a=t===s;if(!a){var l=tm(s);a=e.every(S6(l))}a&&r.push(i)}}}),r})},createElement:function(t){var e=new ri;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Fn;var n=e.attributes=new mc;return n._ownerElement=e,e},createDocumentFragment:function(){var t=new Pl;return t.ownerDocument=this,t.childNodes=new Fn,t},createTextNode:function(t){var e=new qf;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Vf;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Hf;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Gf;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new yc;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Kf;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new ri,r=e.split(":"),i=n.attributes=new mc;return n.childNodes=new Fn,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,i._ownerElement=n,n},createAttributeNS:function(t,e){var n=new yc,r=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,n}};Tt(Oo,Pe);function ri(){this._nsMap={}}ri.prototype={nodeType:un,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===Wn?this.insertBefore(t,null):D6(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var r=this.ownerDocument.createAttributeNS(t,e);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new Hi(this,function(e){var n=[];return eo(e,function(r){r!==e&&r.nodeType==un&&(t==="*"||r.tagName==t)&&n.push(r)}),n})},getElementsByTagNameNS:function(t,e){return new Hi(this,function(n){var r=[];return eo(n,function(i){i!==n&&i.nodeType===un&&(t==="*"||i.namespaceURI===t)&&(e==="*"||i.localName==e)&&r.push(i)}),r})}};Oo.prototype.getElementsByTagName=ri.prototype.getElementsByTagName;Oo.prototype.getElementsByTagNameNS=ri.prototype.getElementsByTagNameNS;Tt(ri,Pe);function yc(){}yc.prototype.nodeType=Vi;Tt(yc,Pe);function zo(){}zo.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(ot[Et])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){var r=this.data.substring(0,t),i=this.data.substring(t+e);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}};Tt(zo,Pe);function qf(){}qf.prototype={nodeName:"#text",nodeType:gc,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Tt(qf,zo);function Vf(){}Vf.prototype={nodeName:"#comment",nodeType:Vy};Tt(Vf,zo);function Hf(){}Hf.prototype={nodeName:"#cdata-section",nodeType:Uy};Tt(Hf,zo);function Rl(){}Rl.prototype.nodeType=Ky;Tt(Rl,Pe);function ew(){}ew.prototype.nodeType=N6;Tt(ew,Pe);function tw(){}tw.prototype.nodeType=k6;Tt(tw,Pe);function Kf(){}Kf.prototype.nodeType=My;Tt(Kf,Pe);function Pl(){}Pl.prototype.nodeName="#document-fragment";Pl.prototype.nodeType=Wn;Tt(Pl,Pe);function Gf(){}Gf.prototype.nodeType=qy;Tt(Gf,Pe);function nw(){}nw.prototype.serializeToString=function(t,e,n){return rw.call(t,e,n)};Pe.prototype.toString=rw;function rw(t,e){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,s=r.namespaceURI;if(s&&i==null){var i=r.lookupPrefix(s);if(i==null)var a=[{namespace:s,prefix:null}]}return xi(this,n,t,e,a),n.join("")}function am(t,e,n){var r=t.prefix||"",i=t.namespaceURI;if(!i||r==="xml"&&i===Qs.XML||i===Qs.XMLNS)return!1;for(var s=n.length;s--;){var a=n[s];if(a.prefix===r)return a.namespace!==i}return!0}function gu(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,Jy),'"')}function xi(t,e,n,r,i){if(i||(i=[]),r)if(t=r(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case un:var s=t.attributes,a=s.length,D=t.firstChild,l=t.tagName;n=Qs.isHTML(t.namespaceURI)||n;var u=l;if(!n&&!t.prefix&&t.namespaceURI){for(var d,p=0;p<s.length;p++)if(s.item(p).name==="xmlns"){d=s.item(p).value;break}if(!d)for(var h=i.length-1;h>=0;h--){var g=i[h];if(g.prefix===""&&g.namespace===t.namespaceURI){d=g.namespace;break}}if(d!==t.namespaceURI)for(var h=i.length-1;h>=0;h--){var g=i[h];if(g.namespace===t.namespaceURI){g.prefix&&(u=g.prefix+":"+l);break}}}e.push("<",u);for(var A=0;A<a;A++){var $=s.item(A);$.prefix=="xmlns"?i.push({prefix:$.localName,namespace:$.value}):$.nodeName=="xmlns"&&i.push({prefix:"",namespace:$.value})}for(var A=0;A<a;A++){var $=s.item(A);if(am($,n,i)){var I=$.prefix||"",R=$.namespaceURI;gu(e,I?"xmlns:"+I:"xmlns",R),i.push({prefix:I,namespace:R})}xi($,e,n,r,i)}if(l===u&&am(t,n,i)){var I=t.prefix||"",R=t.namespaceURI;gu(e,I?"xmlns:"+I:"xmlns",R),i.push({prefix:I,namespace:R})}if(D||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),n&&/^script$/i.test(l))for(;D;)D.data?e.push(D.data):xi(D,e,n,r,i.slice()),D=D.nextSibling;else for(;D;)xi(D,e,n,r,i.slice()),D=D.nextSibling;e.push("</",u,">")}else e.push("/>");return;case Hy:case Wn:for(var D=t.firstChild;D;)xi(D,e,n,r,i.slice()),D=D.nextSibling;return;case Vi:return gu(e,t.name,t.value);case gc:return e.push(t.data.replace(/[<&>]/g,Jy));case Uy:return e.push("<![CDATA[",t.data,"]]>");case Vy:return e.push("<!--",t.data,"-->");case Ky:var x=t.publicId,M=t.systemId;if(e.push("<!DOCTYPE ",t.name),x)e.push(" PUBLIC ",x),M&&M!="."&&e.push(" ",M),e.push(">");else if(M&&M!=".")e.push(" SYSTEM ",M,">");else{var G=t.internalSubset;G&&e.push(" [",G,"]"),e.push(">")}return;case qy:return e.push("<?",t.target," ",t.data,"?>");case My:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function iw(t,e,n){var r;switch(e.nodeType){case un:r=e.cloneNode(!1),r.ownerDocument=t;case Wn:break;case Vi:n=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(iw(t,i,n)),i=i.nextSibling;return r}function ap(t,e,n){var r=new e.constructor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var s=e[i];typeof s!="object"&&s!=r[i]&&(r[i]=s)}switch(e.childNodes&&(r.childNodes=new Fn),r.ownerDocument=t,r.nodeType){case un:var a=e.attributes,l=r.attributes=new mc,u=a.length;l._ownerElement=r;for(var d=0;d<u;d++)r.setAttributeNode(ap(t,a.item(d),!0));break;case Vi:n=!0}if(n)for(var p=e.firstChild;p;)r.appendChild(ap(t,p,n)),p=p.nextSibling;return r}function sw(t,e,n){t[e]=n}try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case un:case Wn:var n=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&n.push(t(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}};Object.defineProperty(Hi.prototype,"length",{get:function(){return Ff(this),this.$$length}}),Object.defineProperty(Pe.prototype,"textContent",{get:function(){return t(this)},set:function(e){switch(this.nodeType){case un:case Wn:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),sw=function(e,n,r){e["$$"+n]=r}}}catch{}nr.DocumentType=Rl;nr.DOMException=Je;nr.DOMImplementation=Xy;nr.Element=ri;nr.Node=Pe;nr.NodeList=Fn;nr.XMLSerializer=nw;var Bl={},ow={};(function(t){var e=rr.freeze;t.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
281
- `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(ow);var Wf={},to=rr.NAMESPACE,cp=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,cm=new RegExp("[\\-\\.0-9"+cp.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),lm=new RegExp("^"+cp.source+cm.source+"*(?::"+cp.source+cm.source+"*)?$"),gs=0,ar=1,pi=2,ms=3,fi=4,hi=5,_s=6,Go=7;function Ki(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Ki)}Ki.prototype=new Error;Ki.prototype.name=Ki.name;function aw(){}aw.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),cw(e,e={}),R6(t,e,n,r,this.errorHandler),r.endDocument()}};function R6(t,e,n,r,i){function s(B){if(B>65535){B-=65536;var V=55296+(B>>10),ue=56320+(B&1023);return String.fromCharCode(V,ue)}else return String.fromCharCode(B)}function a(B){var V=B.slice(1,-1);return Object.hasOwnProperty.call(n,V)?n[V]:V.charAt(0)==="#"?s(parseInt(V.substr(1).replace("x","0x"))):(i.error("entity not found:"+B),B)}function l(B){if(B>I){var V=t.substring(I,B).replace(/&#?\w+;/g,a);g&&u(I),r.characters(V,0,B-I),I=B}}function u(B,V){for(;B>=p&&(V=h.exec(t));)d=V.index,p=d+V[0].length,g.lineNumber++;g.columnNumber=B-d+1}for(var d=0,p=0,h=/.*(?:\r\n?|\n)|.*$/g,g=r.locator,A=[{currentNSMap:e}],$={},I=0;;){try{var R=t.indexOf("<",I);if(R<0){if(!t.substr(I).match(/^\s*$/)){var D=r.doc,x=D.createTextNode(t.substr(I));D.appendChild(x),r.currentElement=x}return}switch(R>I&&l(R),t.charAt(R+1)){case"/":var P=t.indexOf(">",R+3),M=t.substring(R+2,P).replace(/[ \t\n\r]+$/g,""),G=A.pop();P<0?(M=t.substring(R+2).replace(/[\s<].*/,""),i.error("end tag name: "+M+" is not complete:"+G.tagName),P=R+1+M.length):M.match(/\s</)&&(M=M.replace(/[\s<].*/,""),i.error("end tag name: "+M+" maybe not complete"),P=R+1+M.length);var F=G.localNSMap,H=G.tagName==M,X=H||G.tagName&&G.tagName.toLowerCase()==M.toLowerCase();if(X){if(r.endElement(G.uri,G.localName,M),F)for(var Y in F)Object.prototype.hasOwnProperty.call(F,Y)&&r.endPrefixMapping(Y);H||i.fatalError("end tag name: "+M+" is not match the current start tagName:"+G.tagName)}else A.push(G);P++;break;case"?":g&&u(R),P=F6(t,R,r);break;case"!":g&&u(R),P=L6(t,R,r,i);break;default:g&&u(R);var fe=new lw,Ce=A[A.length-1].currentNSMap,P=P6(t,R,fe,Ce,a,i),j=fe.length;if(!fe.closed&&j6(t,P,fe.tagName,$)&&(fe.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),g&&j){for(var z=um(g,{}),k=0;k<j;k++){var S=fe[k];u(S.offset),S.locator=um(g,{})}r.locator=z,dm(fe,r,Ce)&&A.push(fe),r.locator=g}else dm(fe,r,Ce)&&A.push(fe);to.isHTML(fe.uri)&&!fe.closed?P=B6(t,P,fe.tagName,a,r):P++}}catch(B){if(B instanceof Ki)throw B;i.error("element parse error: "+B),P=-1}P>I?I=P:l(Math.max(R,I)+1)}}function um(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function P6(t,e,n,r,i,s){function a(g,A,$){n.attributeNames.hasOwnProperty(g)&&s.fatalError("Attribute "+g+" redefined"),n.addValue(g,A.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),$)}for(var l,u,d=++e,p=gs;;){var h=t.charAt(d);switch(h){case"=":if(p===ar)l=t.slice(e,d),p=ms;else if(p===pi)p=ms;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===ms||p===ar)if(p===ar&&(s.warning('attribute value must after "="'),l=t.slice(e,d)),e=d+1,d=t.indexOf(h,e),d>0)u=t.slice(e,d),a(l,u,e-1),p=hi;else throw new Error("attribute value no end '"+h+"' match");else if(p==fi)u=t.slice(e,d),a(l,u,e),s.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=d+1,p=hi;else throw new Error('attribute value must after "="');break;case"/":switch(p){case gs:n.setTagName(t.slice(e,d));case hi:case _s:case Go:p=Go,n.closed=!0;case fi:case ar:break;case pi:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),p==gs&&n.setTagName(t.slice(e,d)),d;case">":switch(p){case gs:n.setTagName(t.slice(e,d));case hi:case _s:case Go:break;case fi:case ar:u=t.slice(e,d),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case pi:p===pi&&(u=l),p==fi?(s.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!to.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case ms:throw new Error("attribute value missed!!")}return d;case"€":h=" ";default:if(h<=" ")switch(p){case gs:n.setTagName(t.slice(e,d)),p=_s;break;case ar:l=t.slice(e,d),p=pi;break;case fi:var u=t.slice(e,d);s.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case hi:p=_s;break}else switch(p){case pi:n.tagName,(!to.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=d,p=ar;break;case hi:s.warning('attribute space is required"'+l+'"!!');case _s:p=ar,e=d;break;case ms:p=fi,e=d;break;case Go:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function dm(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var s=t[h],a=s.qName,l=s.value,g=a.indexOf(":");if(g>0)var u=s.prefix=a.slice(0,g),d=a.slice(g+1),p=u==="xmlns"&&d;else d=a,u=null,p=a==="xmlns"&&"";s.localName=d,p!==!1&&(i==null&&(i={},cw(n,n={})),n[p]=i[p]=l,s.uri=to.XMLNS,e.startPrefixMapping(p,l))}for(var h=t.length;h--;){s=t[h];var u=s.prefix;u&&(u==="xml"&&(s.uri=to.XML),u!=="xmlns"&&(s.uri=n[u||""]))}var g=r.indexOf(":");g>0?(u=t.prefix=r.slice(0,g),d=t.localName=r.slice(g+1)):(u=null,d=t.localName=r);var A=t.uri=n[u||""];if(e.startElement(A,d,r,t),t.closed){if(e.endElement(A,d,r),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&e.endPrefixMapping(u)}else return t.currentNSMap=n,t.localNSMap=i,!0}function B6(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var s=t.indexOf("</"+n+">",e),a=t.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(n)?(i.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,r),i.characters(a,0,a.length),s)}return e+1}function j6(t,e,n,r){var i=r[n];return i==null&&(i=t.lastIndexOf("</"+n+">"),i<e&&(i=t.lastIndexOf("</"+n)),r[n]=i),i<e}function cw(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function L6(t,e,n,r){var i=t.charAt(e+2);switch(i){case"-":if(t.charAt(e+3)==="-"){var s=t.indexOf("-->",e+4);return s>e?(n.comment(t,e+4,s-e-4),s+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var s=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,s-e-9),n.endCDATA(),s+3}var a=U6(t,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],d=!1,p=!1;l>3&&(/^public$/i.test(a[2][0])?(d=a[3][0],p=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var h=a[l-1];return n.startDTD(u,d,p),n.endDTD(),h.index+h[0].length}}return-1}function F6(t,e,n){var r=t.indexOf("?>",e);if(r){var i=t.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function lw(){this.attributeNames={}}lw.prototype={setTagName:function(t){if(!lm.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!lm.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function U6(t,e){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);n=i.exec(t);)if(r.push(n),n[1])return r}Wf.XMLReader=aw;Wf.ParseError=Ki;var M6=rr,q6=nr,pm=ow,uw=Wf,V6=q6.DOMImplementation,fm=M6.NAMESPACE,H6=uw.ParseError,K6=uw.XMLReader;function dw(t){return t.replace(/\r[\n\u0085]/g,`
281
+ `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(ow);var Wf={},to=rr.NAMESPACE,cp=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,cm=new RegExp("[\\-\\.0-9"+cp.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),lm=new RegExp("^"+cp.source+cm.source+"*(?::"+cp.source+cm.source+"*)?$"),gs=0,ar=1,pi=2,ms=3,fi=4,hi=5,_s=6,Go=7;function Ki(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Ki)}Ki.prototype=new Error;Ki.prototype.name=Ki.name;function aw(){}aw.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),cw(e,e={}),R6(t,e,n,r,this.errorHandler),r.endDocument()}};function R6(t,e,n,r,i){function s(B){if(B>65535){B-=65536;var V=55296+(B>>10),de=56320+(B&1023);return String.fromCharCode(V,de)}else return String.fromCharCode(B)}function a(B){var V=B.slice(1,-1);return Object.hasOwnProperty.call(n,V)?n[V]:V.charAt(0)==="#"?s(parseInt(V.substr(1).replace("x","0x"))):(i.error("entity not found:"+B),B)}function l(B){if(B>I){var V=t.substring(I,B).replace(/&#?\w+;/g,a);g&&u(I),r.characters(V,0,B-I),I=B}}function u(B,V){for(;B>=p&&(V=h.exec(t));)d=V.index,p=d+V[0].length,g.lineNumber++;g.columnNumber=B-d+1}for(var d=0,p=0,h=/.*(?:\r\n?|\n)|.*$/g,g=r.locator,A=[{currentNSMap:e}],$={},I=0;;){try{var R=t.indexOf("<",I);if(R<0){if(!t.substr(I).match(/^\s*$/)){var D=r.doc,x=D.createTextNode(t.substr(I));D.appendChild(x),r.currentElement=x}return}switch(R>I&&l(R),t.charAt(R+1)){case"/":var P=t.indexOf(">",R+3),M=t.substring(R+2,P).replace(/[ \t\n\r]+$/g,""),G=A.pop();P<0?(M=t.substring(R+2).replace(/[\s<].*/,""),i.error("end tag name: "+M+" is not complete:"+G.tagName),P=R+1+M.length):M.match(/\s</)&&(M=M.replace(/[\s<].*/,""),i.error("end tag name: "+M+" maybe not complete"),P=R+1+M.length);var F=G.localNSMap,H=G.tagName==M,W=H||G.tagName&&G.tagName.toLowerCase()==M.toLowerCase();if(W){if(r.endElement(G.uri,G.localName,M),F)for(var Y in F)Object.prototype.hasOwnProperty.call(F,Y)&&r.endPrefixMapping(Y);H||i.fatalError("end tag name: "+M+" is not match the current start tagName:"+G.tagName)}else A.push(G);P++;break;case"?":g&&u(R),P=F6(t,R,r);break;case"!":g&&u(R),P=L6(t,R,r,i);break;default:g&&u(R);var ue=new lw,Ce=A[A.length-1].currentNSMap,P=P6(t,R,ue,Ce,a,i),j=ue.length;if(!ue.closed&&j6(t,P,ue.tagName,$)&&(ue.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),g&&j){for(var z=um(g,{}),k=0;k<j;k++){var S=ue[k];u(S.offset),S.locator=um(g,{})}r.locator=z,dm(ue,r,Ce)&&A.push(ue),r.locator=g}else dm(ue,r,Ce)&&A.push(ue);to.isHTML(ue.uri)&&!ue.closed?P=B6(t,P,ue.tagName,a,r):P++}}catch(B){if(B instanceof Ki)throw B;i.error("element parse error: "+B),P=-1}P>I?I=P:l(Math.max(R,I)+1)}}function um(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function P6(t,e,n,r,i,s){function a(g,A,$){n.attributeNames.hasOwnProperty(g)&&s.fatalError("Attribute "+g+" redefined"),n.addValue(g,A.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),$)}for(var l,u,d=++e,p=gs;;){var h=t.charAt(d);switch(h){case"=":if(p===ar)l=t.slice(e,d),p=ms;else if(p===pi)p=ms;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===ms||p===ar)if(p===ar&&(s.warning('attribute value must after "="'),l=t.slice(e,d)),e=d+1,d=t.indexOf(h,e),d>0)u=t.slice(e,d),a(l,u,e-1),p=hi;else throw new Error("attribute value no end '"+h+"' match");else if(p==fi)u=t.slice(e,d),a(l,u,e),s.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=d+1,p=hi;else throw new Error('attribute value must after "="');break;case"/":switch(p){case gs:n.setTagName(t.slice(e,d));case hi:case _s:case Go:p=Go,n.closed=!0;case fi:case ar:break;case pi:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),p==gs&&n.setTagName(t.slice(e,d)),d;case">":switch(p){case gs:n.setTagName(t.slice(e,d));case hi:case _s:case Go:break;case fi:case ar:u=t.slice(e,d),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case pi:p===pi&&(u=l),p==fi?(s.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!to.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case ms:throw new Error("attribute value missed!!")}return d;case"€":h=" ";default:if(h<=" ")switch(p){case gs:n.setTagName(t.slice(e,d)),p=_s;break;case ar:l=t.slice(e,d),p=pi;break;case fi:var u=t.slice(e,d);s.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case hi:p=_s;break}else switch(p){case pi:n.tagName,(!to.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=d,p=ar;break;case hi:s.warning('attribute space is required"'+l+'"!!');case _s:p=ar,e=d;break;case ms:p=fi,e=d;break;case Go:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function dm(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var s=t[h],a=s.qName,l=s.value,g=a.indexOf(":");if(g>0)var u=s.prefix=a.slice(0,g),d=a.slice(g+1),p=u==="xmlns"&&d;else d=a,u=null,p=a==="xmlns"&&"";s.localName=d,p!==!1&&(i==null&&(i={},cw(n,n={})),n[p]=i[p]=l,s.uri=to.XMLNS,e.startPrefixMapping(p,l))}for(var h=t.length;h--;){s=t[h];var u=s.prefix;u&&(u==="xml"&&(s.uri=to.XML),u!=="xmlns"&&(s.uri=n[u||""]))}var g=r.indexOf(":");g>0?(u=t.prefix=r.slice(0,g),d=t.localName=r.slice(g+1)):(u=null,d=t.localName=r);var A=t.uri=n[u||""];if(e.startElement(A,d,r,t),t.closed){if(e.endElement(A,d,r),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&e.endPrefixMapping(u)}else return t.currentNSMap=n,t.localNSMap=i,!0}function B6(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var s=t.indexOf("</"+n+">",e),a=t.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(n)?(i.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,r),i.characters(a,0,a.length),s)}return e+1}function j6(t,e,n,r){var i=r[n];return i==null&&(i=t.lastIndexOf("</"+n+">"),i<e&&(i=t.lastIndexOf("</"+n)),r[n]=i),i<e}function cw(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function L6(t,e,n,r){var i=t.charAt(e+2);switch(i){case"-":if(t.charAt(e+3)==="-"){var s=t.indexOf("-->",e+4);return s>e?(n.comment(t,e+4,s-e-4),s+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var s=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,s-e-9),n.endCDATA(),s+3}var a=U6(t,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],d=!1,p=!1;l>3&&(/^public$/i.test(a[2][0])?(d=a[3][0],p=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var h=a[l-1];return n.startDTD(u,d,p),n.endDTD(),h.index+h[0].length}}return-1}function F6(t,e,n){var r=t.indexOf("?>",e);if(r){var i=t.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function lw(){this.attributeNames={}}lw.prototype={setTagName:function(t){if(!lm.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!lm.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function U6(t,e){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);n=i.exec(t);)if(r.push(n),n[1])return r}Wf.XMLReader=aw;Wf.ParseError=Ki;var M6=rr,q6=nr,pm=ow,uw=Wf,V6=q6.DOMImplementation,fm=M6.NAMESPACE,H6=uw.ParseError,K6=uw.XMLReader;function dw(t){return t.replace(/\r[\n\u0085]/g,`
282
282
  `).replace(/[\r\u0085\u2028]/g,`
283
283
  `)}function pw(t){this.options=t||{locator:{}}}pw.prototype.parseFromString=function(t,e){var n=this.options,r=new K6,i=n.domBuilder||new Do,s=n.errorHandler,a=n.locator,l=n.xmlns||{},u=/\/x?html?$/.test(e),d=u?pm.HTML_ENTITIES:pm.XML_ENTITIES;a&&i.setDocumentLocator(a),r.errorHandler=G6(s,i,a),r.domBuilder=n.domBuilder||i,u&&(l[""]=fm.HTML),l.xml=l.xml||fm.XML;var p=n.normalizeLineEndings||dw;return t&&typeof t=="string"?r.parse(p(t),l,d):r.errorHandler.error("invalid doc source"),i.doc};function G6(t,e,n){if(!t){if(e instanceof Do)return e;t=e}var r={},i=t instanceof Function;n=n||{};function s(a){var l=t[a];!l&&i&&(l=t.length==2?function(u){t(a,u)}:t),r[a]=l&&function(u){l("[xmldom "+a+"] "+u+lp(n))}||function(){}}return s("warning"),s("error"),s("fatalError"),r}function Do(){this.cdata=!1}function gi(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}Do.prototype={startDocument:function(){this.doc=new V6().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,s=i.createElementNS(t,n||e),a=r.length;Wo(this,s),this.currentElement=s,this.locator&&gi(this.locator,s);for(var l=0;l<a;l++){var t=r.getURI(l),u=r.getValue(l),n=r.getQName(l),d=i.createAttributeNS(t,n);this.locator&&gi(r.getLocator(l),d),d.value=d.nodeValue=u,s.setAttributeNode(d)}},endElement:function(t,e,n){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&gi(this.locator,n),Wo(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=hm.apply(this,arguments),t){if(this.cdata)var r=this.doc.createCDATASection(t);else var r=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(t)&&this.doc.appendChild(r),this.locator&&gi(this.locator,r)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,n){t=hm.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&gi(this.locator,r),Wo(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(t,e,n);this.locator&&gi(this.locator,i),Wo(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning] "+t,lp(this.locator))},error:function(t){console.error("[xmldom error] "+t,lp(this.locator))},fatalError:function(t){throw new H6(t,this.locator)}};function lp(t){if(t)return`
284
- @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function hm(t,e,n){return typeof t=="string"?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Do.prototype[t]=function(){return null}});function Wo(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Bl.__DOMHandler=Do;Bl.normalizeLineEndings=dw;Bl.DOMParser=pw;var fw=nr;Dl.DOMImplementation=fw.DOMImplementation;Dl.XMLSerializer=fw.XMLSerializer;Dl.DOMParser=Bl.DOMParser;var jl={};Object.defineProperty(jl,"__esModule",{value:!0});jl.EnvelopedSignature=void 0;const Xo=Il,mu=xe;class W6{constructor(){this.includeComments=!1,this.includeComments=!1}process(e,n){if(n.signatureNode==null){const s=Xo.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return mu.isNodeLike(s)&&s.parentNode&&s.parentNode.removeChild(s),e}const r=n.signatureNode,i=Xo.select1(".//*[local-name(.)='SignatureValue']/text()",r);if(mu.isTextNode(i)){const s=i.data,a=Xo.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);for(const l of Array.isArray(a)?a:[]){const u=Xo.select1(".//*[local-name(.)='SignatureValue']/text()",l);if(mu.isTextNode(u)){const d=u.data;s===d&&l.parentNode&&l.parentNode.removeChild(l)}}}return e}getAlgorithmName(){return"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}}jl.EnvelopedSignature=W6;var gr={};Object.defineProperty(gr,"__esModule",{value:!0});gr.Sha512=gr.Sha256=gr.Sha1=void 0;const Xf=Sc;class X6{constructor(){this.getHash=function(e){const n=Xf.createHash("sha1");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2000/09/xmldsig#sha1"}}}gr.Sha1=X6;class J6{constructor(){this.getHash=function(e){const n=Xf.createHash("sha256");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha256"}}}gr.Sha256=J6;class Y6{constructor(){this.getHash=function(e){const n=Xf.createHash("sha512");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha512"}}}gr.Sha512=Y6;var An={},Ro={};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.createOptionalCallbackFunction=void 0;function Z6(t){return typeof t=="function"}function Q6(t){return(...e)=>{const n=e[e.length-1];if(Z6(n))try{const r=t(...e.slice(0,-1));n(null,r)}catch(r){n(r instanceof Error?r:new Error("Unknown error"))}else return t(...e)}}Ro.createOptionalCallbackFunction=Q6;Object.defineProperty(An,"__esModule",{value:!0});An.HmacSha1=An.RsaSha512=An.RsaSha256=An.RsaSha1=void 0;const xr=Sc,$r=Ro;class eS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createSign("RSA-SHA1");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createVerify("RSA-SHA1");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"}}An.RsaSha1=eS;class tS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createSign("RSA-SHA256");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createVerify("RSA-SHA256");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"}}An.RsaSha256=tS;class nS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createSign("RSA-SHA512");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createVerify("RSA-SHA512");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"}}An.RsaSha512=nS;class rS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createHmac("SHA1",n);return r.update(e),r.digest("base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createHmac("SHA1",n);return i.update(e),i.digest("base64")===r}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#hmac-sha1"}}An.HmacSha1=rS;Object.defineProperty(zl,"__esModule",{value:!0});zl.SignedXml=void 0;const Rt=xe,Cr=Dl,iS=Sc,Kt=Il,gm=ti,sS=jl,mm=ni,_u=gr,Jo=An,Oe=To;class jn{constructor(e={}){this.signatureAlgorithm=void 0,this.canonicalizationAlgorithm=void 0,this.inclusiveNamespacesPrefixList=[],this.namespaceResolver={lookupNamespaceURI:function(){throw new Error("Not implemented")}},this.implicitTransforms=[],this.keyInfoAttributes={},this.getKeyInfoContent=jn.getKeyInfoContent,this.getCertFromKeyInfo=jn.getCertFromKeyInfo,this.id=0,this.signedXml="",this.signatureXml="",this.signatureNode=null,this.signatureValue="",this.originalXmlWithIds="",this.keyInfo=null,this.references=[],this.signedReferences=[],this.CanonicalizationAlgorithms={"http://www.w3.org/TR/2001/REC-xml-c14n-20010315":gm.C14nCanonicalization,"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":gm.C14nCanonicalizationWithComments,"http://www.w3.org/2001/10/xml-exc-c14n#":mm.ExclusiveCanonicalization,"http://www.w3.org/2001/10/xml-exc-c14n#WithComments":mm.ExclusiveCanonicalizationWithComments,"http://www.w3.org/2000/09/xmldsig#enveloped-signature":sS.EnvelopedSignature},this.HashAlgorithms={"http://www.w3.org/2000/09/xmldsig#sha1":_u.Sha1,"http://www.w3.org/2001/04/xmlenc#sha256":_u.Sha256,"http://www.w3.org/2001/04/xmlenc#sha512":_u.Sha512},this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#rsa-sha1":Jo.RsaSha1,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":Jo.RsaSha256,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":Jo.RsaSha512};const{idMode:n,idAttribute:r,privateKey:i,publicCert:s,signatureAlgorithm:a,canonicalizationAlgorithm:l,inclusiveNamespacesPrefixList:u,implicitTransforms:d,keyInfoAttributes:p,getKeyInfoContent:h,getCertFromKeyInfo:g}=e;this.idMode=n,this.idAttributes=["Id","ID","id"],r&&this.idAttributes.unshift(r),this.privateKey=i,this.publicCert=s,this.signatureAlgorithm=a??this.signatureAlgorithm,this.canonicalizationAlgorithm=l,typeof u=="string"?this.inclusiveNamespacesPrefixList=u.split(" "):Oe.isArrayHasLength(u)&&(this.inclusiveNamespacesPrefixList=u),this.implicitTransforms=d??this.implicitTransforms,this.keyInfoAttributes=p??this.keyInfoAttributes,this.getKeyInfoContent=h??this.getKeyInfoContent,this.getCertFromKeyInfo=g??jn.noop,this.CanonicalizationAlgorithms,this.HashAlgorithms,this.SignatureAlgorithms}enableHMAC(){this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#hmac-sha1":Jo.HmacSha1},this.getKeyInfoContent=jn.noop}static getKeyInfoContent({publicCert:e,prefix:n}){if(e==null)return null;n=n?`${n}:`:"";let r="";Buffer.isBuffer(e)&&(e=e.toString("latin1"));let i=[];return typeof e=="string"&&(i=e.match(Oe.EXTRACT_X509_CERTS)||[]),i.length>0&&(r=i.map(s=>`<${n}X509Certificate>${Oe.pemToDer(s).toString("base64")}</${n}X509Certificate>`).join("")),`<${n}X509Data>${r}</${n}X509Data>`}static getCertFromKeyInfo(e){if(e!=null){const n=Kt.select1(".//*[local-name(.)='X509Certificate']",e);if(Rt.isNodeLike(n))return Oe.derToPem(n.textContent??"","CERTIFICATE")}return null}checkSignature(e,n){if(n!=null&&typeof n!="function")throw new Error("Last parameter must be a callback function");this.signedXml=e;const r=new Cr.DOMParser().parseFromString(e);this.references=[];const i=this.getCanonSignedInfoXml(r);if(!i){if(n){n(new Error("Canonical signed info cannot be empty"),!1);return}throw new Error("Canonical signed info cannot be empty")}const a=new Cr.DOMParser().parseFromString(i,"text/xml").documentElement;if(!a){if(n){n(new Error("Could not parse unverifiedSignedInfoCanon into a document"),!1);return}throw new Error("Could not parse unverifiedSignedInfoCanon into a document")}const l=Oe.findChildren(a,"Reference");if(!Oe.isArrayHasLength(l)){if(n){n(new Error("could not find any Reference elements"),!1);return}throw new Error("could not find any Reference elements")}for(const h of l)this.loadReference(h);if(!this.getReferences().every(h=>this.validateReference(h,r))){if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error("Could not validate all references"),!1);return}return!1}const u=this.findSignatureAlgorithm(this.signatureAlgorithm),d=this.getCertFromKeyInfo(this.keyInfo)||this.publicCert||this.privateKey;if(d==null)throw new Error("KeyInfo or publicCert or privateKey is required to validate signature");if(u.verifySignature(i,d,this.signatureValue)===!0)if(n)n(null,!0);else return!0;else if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`));return}else throw new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`)}getCanonSignedInfoXml(e){if(this.signatureNode==null)throw new Error("No signature found.");if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to get signed info for XML");const n=Oe.findChildren(this.signatureNode,"SignedInfo");if(n.length===0)throw new Error("could not find SignedInfo element in the message");if(n.length>1)throw new Error("could not get canonicalized signed info for a signature that contains multiple SignedInfo nodes");if((this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(!e||typeof e!="object"))throw new Error("When canonicalization method is non-exclusive, whole xml dom must be provided as an argument");const i={ancestorNamespaces:Oe.findAncestorNs(e,"//*[local-name()='SignedInfo']")};return this.getCanonXml([this.canonicalizationAlgorithm],n[0],i)}getCanonReferenceXml(e,n,r){Array.isArray(n.transforms)&&(n.ancestorNamespaces=Oe.findAncestorNs(e,n.xpath,this.namespaceResolver));const i={inclusiveNamespacesPrefixList:n.inclusiveNamespacesPrefixList,ancestorNamespaces:n.ancestorNamespaces};return this.getCanonXml(n.transforms,r,i)}calculateSignatureValue(e,n){const r=this.getCanonSignedInfoXml(e),i=this.findSignatureAlgorithm(this.signatureAlgorithm);if(this.privateKey==null)throw new Error("Private key is required to compute signature");typeof n=="function"?i.getSignature(r,this.privateKey,n):this.signatureValue=i.getSignature(r,this.privateKey)}findSignatureAlgorithm(e){if(e==null)throw new Error("signatureAlgorithm is required");const n=this.SignatureAlgorithms[e];if(n)return new n;throw new Error(`signature algorithm '${e}' is not supported`)}findCanonicalizationAlgorithm(e){if(e!=null){const n=this.CanonicalizationAlgorithms[e];if(n)return new n}throw new Error(`canonicalization algorithm '${e}' is not supported`)}findHashAlgorithm(e){const n=this.HashAlgorithms[e];if(n)return new n;throw new Error(`hash algorithm '${e}' is not supported`)}validateElementAgainstReferences(e,n){var i;let r;if(typeof e=="string"){const s=Kt.select1(e,n);Rt.assertIsElementNode(s),r=s}else r=e;for(const s of this.getReferences()){const a=((i=s.uri)==null?void 0:i[0])==="#"?s.uri.substring(1):s.uri;for(const p of this.idAttributes){const h=r.getAttribute(p);if(a===h){s.xpath=`//*[@*[local-name(.)='${p}']='${a}']`;break}}const l=this.getCanonReferenceXml(n,s,r),d=this.findHashAlgorithm(s.digestAlgorithm).getHash(l);if(Oe.validateDigestValue(d,s.digestValue))return s}throw new Error("No references passed validation")}validateReference(e,n){var u;const r=((u=e.uri)==null?void 0:u[0])==="#"?e.uri.substring(1):e.uri;let i=null;if(r==="")i=Kt.select1("//*",n);else{if((r==null?void 0:r.indexOf("'"))!==-1)throw new Error("Cannot validate a uri with quotes inside it");{let d=0;for(const p of this.idAttributes){const h=`//*[@*[local-name(.)='${p}']='${r}']`,g=Kt.select(h,n);if(Oe.isArrayHasLength(g)){if(d+=g.length,d>1)throw new Error("Cannot validate a document which contains multiple elements with the same value for the ID / Id / Id attributes, in order to prevent signature wrapping attack.");i=g[0],e.xpath=h}}}}if(e.getValidatedNode=(0,iS.deprecate)(d=>{if(d=d||e.xpath,typeof d!="string"||e.validationError!=null)return null;const p=Kt.select1(d,n);return Rt.isNodeLike(p)?p:null},"`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead."),!Rt.isNodeLike(i)){const d=new Error(`invalid signature: the signature references an element with uri ${e.uri} but could not find such element in the xml`);return e.validationError=d,!1}const s=this.getCanonReferenceXml(n,e,i),l=this.findHashAlgorithm(e.digestAlgorithm).getHash(s);if(!Oe.validateDigestValue(l,e.digestValue)){const d=new Error(`invalid signature: for uri ${e.uri} calculated digest is ${l} but the xml to validate supplies digest ${e.digestValue}`);return e.validationError=d,!1}return this.signedReferences.push(s),e.signedReference=s,!0}findSignatures(e){const n=Kt.select("//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return Rt.isArrayOfNodes(n)?n:[]}loadSignature(e){typeof e=="string"?this.signatureNode=e=new Cr.DOMParser().parseFromString(e):this.signatureNode=e,this.signatureXml=e.toString();const n=Kt.select1(".//*[local-name(.)='CanonicalizationMethod']/@Algorithm",e);if(!Rt.isNodeLike(n))throw new Error("could not find CanonicalizationMethod/@Algorithm element");Rt.isAttributeNode(n)&&(this.canonicalizationAlgorithm=n.value);const r=Kt.select1(".//*[local-name(.)='SignatureMethod']/@Algorithm",e);Rt.isAttributeNode(r)&&(this.signatureAlgorithm=r.value);const i=Oe.findChildren(this.signatureNode,"SignedInfo");if(!Oe.isArrayHasLength(i))throw new Error("no signed info node found");if(i.length>1)throw new Error("could not load signature that contains multiple SignedInfo nodes");let s=this.canonicalizationAlgorithm;(!s||s==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||s==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(s="http://www.w3.org/2001/10/xml-exc-c14n#");const a=this.getCanonXml([s],i[0]),u=new Cr.DOMParser().parseFromString(a,"text/xml").documentElement;this.references=[];const d=Oe.findChildren(u,"Reference");if(!Oe.isArrayHasLength(d))throw new Error("could not find any Reference elements");for(const g of d)this.loadReference(g);const p=Kt.select1(".//*[local-name(.)='SignatureValue']/text()",e);Rt.isTextNode(p)&&(this.signatureValue=p.data.replace(/\r?\n/g,""));const h=Kt.select1(".//*[local-name(.)='KeyInfo']",e);Rt.isNodeLike(h)&&(this.keyInfo=h)}loadReference(e){let n=Oe.findChildren(e,"DigestMethod");if(n.length===0)throw new Error(`could not find DigestMethod in reference ${e.toString()}`);const r=n[0],i=Oe.findAttr(r,"Algorithm");if(!i)throw new Error(`could not find Algorithm attribute in node ${r.toString()}`);const s=i.value;if(n=Oe.findChildren(e,"DigestValue"),n.length===0)throw new Error(`could not find DigestValue node in reference ${e.toString()}`);if(n.length>1)throw new Error(`could not load reference for a node that contains multiple DigestValue nodes: ${e.toString()}`);const a=n[0].textContent;if(!a)throw new Error(`could not find the value of DigestValue in ${e.toString()}`);const l=[];let u=[];if(n=Oe.findChildren(e,"Transforms"),n.length!==0){const p=n[0],h=Oe.findChildren(p,"Transform");for(const A of h){const $=Oe.findAttr(A,"Algorithm");$&&l.push($.value)}const g=Oe.findChildren(h[h.length-1],"InclusiveNamespaces");Oe.isArrayHasLength(g)&&(u=g.flatMap(A=>(A.getAttribute("PrefixList")??"").split(" ")).filter(A=>A.length>0))}Oe.isArrayHasLength(this.implicitTransforms)&&this.implicitTransforms.forEach(function(p){l.push(p)}),(l.length===0||l[l.length-1]==="http://www.w3.org/2000/09/xmldsig#enveloped-signature")&&l.push("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");const d=Rt.isElementNode(e)&&e.getAttribute("URI")||void 0;this.addReference({transforms:l,digestAlgorithm:s,uri:d,digestValue:a,inclusiveNamespacesPrefixList:u,isEmptyUri:!1})}addReference({xpath:e,transforms:n,digestAlgorithm:r,uri:i="",digestValue:s,inclusiveNamespacesPrefixList:a=[],isEmptyUri:l=!1}){if(r==null)throw new Error("digestAlgorithm is required");if(!Oe.isArrayHasLength(n))throw new Error("transforms must contain at least one transform algorithm");this.references.push({xpath:e,transforms:n,digestAlgorithm:r,uri:i,digestValue:s,inclusiveNamespacesPrefixList:a,isEmptyUri:l,getValidatedNode:()=>{throw new Error("Reference has not been validated yet; Did you call `sig.checkSignature()`?")}})}getReferences(){return this.references}getSignedReferences(){return[...this.signedReferences]}computeSignature(e,n,r){let i;typeof n=="function"&&r==null?(i=n,n={}):(i=r,n=n??{});const s=new Cr.DOMParser().parseFromString(e);let a="xmlns";const l=[];let u;const d=["append","prepend","before","after"],p=n.prefix,h=n.attrs||{},g=n.location||{},A=n.existingPrefixes||{};if(this.namespaceResolver={lookupNamespaceURI:function(H){return H?A[H]:null}},g.reference=g.reference||"/*",g.action=g.action||"append",d.indexOf(g.action)===-1){const H=new Error(`location.action option has an invalid action: ${g.action}, must be any of the following values: ${d.join(", ")}`);if(i){i(H);return}else throw H}p?(a+=`:${p}`,u=`${p}:`):u="",Object.keys(h).forEach(function(H){H!=="xmlns"&&H!==a&&l.push(`${H}="${h[H]}"`)}),l.push(`${a}="http://www.w3.org/2000/09/xmldsig#"`);let $=`<${u}Signature ${l.join(" ")}>`;$+=this.createSignedInfo(s,p),$+=this.getKeyInfo(p),$+=`</${u}Signature>`,this.originalXmlWithIds=s.toString();let I="";Object.keys(A).forEach(function(H){I+=`xmlns:${H}="${A[H]}" `});const R=`<Dummy ${I}>${$}</Dummy>`,x=new Cr.DOMParser().parseFromString(R).documentElement.firstChild,M=Kt.select1(g.reference,s);if(!Rt.isNodeLike(M)){const H=new Error(`the following xpath cannot be used because it was not found: ${g.reference}`);if(i){i(H);return}else throw H}if(g.action==="append")M.appendChild(x);else if(g.action==="prepend")M.insertBefore(x,M.firstChild);else if(g.action==="before"){if(M.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");M.parentNode.insertBefore(x,M)}else if(g.action==="after"){if(M.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");M.parentNode.insertBefore(x,M.nextSibling)}this.signatureNode=x;const G=Oe.findChildren(this.signatureNode,"SignedInfo");if(G.length===0){const H=new Error("could not find SignedInfo element in the message");if(i){i(H);return}else throw H}const F=G[0];typeof i=="function"?this.calculateSignatureValue(s,(H,X)=>{H?i(H):(this.signatureValue=X||"",x.insertBefore(this.createSignature(p),F.nextSibling),this.signatureXml=x.toString(),this.signedXml=s.toString(),i(null,this))}):(this.calculateSignatureValue(s),x.insertBefore(this.createSignature(p),F.nextSibling),this.signatureXml=x.toString(),this.signedXml=s.toString())}getKeyInfo(e){const n=e?`${e}:`:"";let r="";this.keyInfoAttributes&&Object.keys(this.keyInfoAttributes).forEach(s=>{r+=` ${s}="${this.keyInfoAttributes[s]}"`});const i=this.getKeyInfoContent({publicCert:this.publicCert,prefix:e});return r||i?`<${n}KeyInfo${r}>${i}</${n}KeyInfo>`:""}createReferences(e,n){let r="";n=n||"",n=n&&`${n}:`;for(const i of this.getReferences()){const s=Kt.selectWithResolver(i.xpath??"",e,this.namespaceResolver);if(!Oe.isArrayHasLength(s))throw new Error(`the following xpath cannot be signed because it was not found: ${i.xpath}`);for(const a of s){if(i.isEmptyUri)r+=`<${n}Reference URI="">`;else{const d=this.ensureHasId(a);i.uri=d,r+=`<${n}Reference URI="#${d}">`}r+=`<${n}Transforms>`;for(const d of i.transforms||[]){const p=this.findCanonicalizationAlgorithm(d);r+=`<${n}Transform Algorithm="${p.getAlgorithmName()}"`,Oe.isArrayHasLength(i.inclusiveNamespacesPrefixList)?(r+=">",r+=`<InclusiveNamespaces PrefixList="${i.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${p.getAlgorithmName()}"/>`,r+=`</${n}Transform>`):r+=" />"}const l=this.getCanonReferenceXml(e,i,a),u=this.findHashAlgorithm(i.digestAlgorithm);r+=`</${n}Transforms><${n}DigestMethod Algorithm="${u.getAlgorithmName()}" /><${n}DigestValue>${u.getHash(l)}</${n}DigestValue></${n}Reference>`}}return r}getCanonXml(e,n,r={}){r.defaultNsForPrefix=r.defaultNsForPrefix??jn.defaultNsForPrefix,r.signatureNode=this.signatureNode;let s=n.cloneNode(!0);return e.forEach(a=>{Rt.isNodeLike(s)&&(s=this.findCanonicalizationAlgorithm(a).process(s,r))}),s.toString()}ensureHasId(e){let n;if(this.idMode==="wssecurity"?n=Oe.findAttr(e,"Id","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"):this.idAttributes.some(i=>(n=Oe.findAttr(e,i),!!n)),n)return n.value;const r=`_${this.id++}`;return this.idMode==="wssecurity"?(e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:wsu","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"),e.setAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd","wsu:Id",r)):e.setAttribute("Id",r),r}createSignedInfo(e,n){if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to create signed info for XML");const r=this.findCanonicalizationAlgorithm(this.canonicalizationAlgorithm),i=this.findSignatureAlgorithm(this.signatureAlgorithm);let s;s=n||"",s=s&&`${s}:`;let a=`<${s}SignedInfo>`;return a+=`<${s}CanonicalizationMethod Algorithm="${r.getAlgorithmName()}"`,Oe.isArrayHasLength(this.inclusiveNamespacesPrefixList)?(a+=">",a+=`<InclusiveNamespaces PrefixList="${this.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${r.getAlgorithmName()}"/>`,a+=`</${s}CanonicalizationMethod>`):a+=" />",a+=`<${s}SignatureMethod Algorithm="${i.getAlgorithmName()}" />`,a+=this.createReferences(e,n),a+=`</${s}SignedInfo>`,a}createSignature(e){let n="xmlns";e?(n+=`:${e}`,e+=":"):e="";const r=`<${e}SignatureValue>${this.signatureValue}</${e}SignatureValue>`,i=`<${e}Signature ${n}="http://www.w3.org/2000/09/xmldsig#">${r}</${e}Signature>`;return new Cr.DOMParser().parseFromString(i).documentElement.firstChild}getSignatureXml(){return this.signatureXml}getOriginalXmlWithIds(){return this.originalXmlWithIds}getSignedXml(){return this.signedXml}}zl.SignedXml=jn;jn.defaultNsForPrefix={ds:"http://www.w3.org/2000/09/xmldsig#"};jn.noop=()=>null;(function(t){var e=Pr&&Pr.__createBinding||(Object.create?function(a,l,u,d){d===void 0&&(d=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(a,d,p)}:function(a,l,u,d){d===void 0&&(d=u),a[d]=l[u]}),n=Pr&&Pr.__exportStar||function(a,l){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.SignedXml=t.ExclusiveCanonicalizationWithComments=t.ExclusiveCanonicalization=t.C14nCanonicalizationWithComments=t.C14nCanonicalization=void 0;var r=ti;Object.defineProperty(t,"C14nCanonicalization",{enumerable:!0,get:function(){return r.C14nCanonicalization}}),Object.defineProperty(t,"C14nCanonicalizationWithComments",{enumerable:!0,get:function(){return r.C14nCanonicalizationWithComments}});var i=ni;Object.defineProperty(t,"ExclusiveCanonicalization",{enumerable:!0,get:function(){return i.ExclusiveCanonicalization}}),Object.defineProperty(t,"ExclusiveCanonicalizationWithComments",{enumerable:!0,get:function(){return i.ExclusiveCanonicalizationWithComments}});var s=zl;Object.defineProperty(t,"SignedXml",{enumerable:!0,get:function(){return s.SignedXml}}),n(Ro,t),n(To,t)})(Z8);async function oS(t){const e=new DecompressionStream("deflate-raw"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}async function aS(t){const e=await __.decode(t.replace(/ /g,"+"));try{const n=await oS(e);return new TextDecoder().decode(n)}catch(n){return console.warn("Decompression failed, assuming data is not compressed:",n),new TextDecoder().decode(e)}}async function cS(t){const e=await aS(t),r=new $p.XMLParser({attributeNamePrefix:"@_",alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(e);return X8.parse(r)}function lS(t){const e=t.certificates.map(i=>({":@":{"@_use":"signing"},KeyDescriptor:[{":@":{"@_xmlns":"http://www.w3.org/2000/09/xmldsig#"},KeyInfo:[{X509Data:[{X509Certificate:[{"#text":i}]}]}]}]})),n=[{":@":{"@_entityID":t.entityId,"@_xmlns":"urn:oasis:names:tc:SAML:2.0:metadata"},EntityDescriptor:[{":@":{"@_protocolSupportEnumeration":"urn:oasis:names:tc:SAML:2.0:protocol"},IDPSSODescriptor:[...e,{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"}]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"E-Mail Address","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Given Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Surname","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name ID","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]}]}]}];return new $p.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0,format:!0}).build(n)}const uS=new o.OpenAPIHono().openapi(o.createRoute({tags:["saml"],method:"get",path:"/metadata/{client_id}",request:{params:o.z.object({client_id:o.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:o.z.string()}}},400:{description:"Bad Request"}}}),async t=>{var l,u;const{client_id:e}=t.req.valid("param"),n=await t.env.data.clients.get(e);if(!n)throw new N(404,{message:"Client not found"});const{signingKeys:r}=await t.env.data.keys.list({q:"type:saml_encryption"});if(r.length===0)throw new N(500,{message:"No signing key found"});const i=r.map(d=>new bl(d.cert).toString("base64")),s=t.env.ISSUER,a=lS({entityId:((u=(l=n.addons)==null?void 0:l.samlp)==null?void 0:u.audience)||n.id,certificates:i,assertionConsumerServiceUrl:`${s}samlp/${e}`,singleLogoutServiceUrl:`${s}samlp/${e}/logout`});return new Response(a,{headers:{"Content-Type":"text/xml"}})}).openapi(o.createRoute({tags:["saml"],method:"get",path:"/{client_id}",request:{query:o.z.object({SAMLRequest:o.z.string(),RelayState:o.z.string().optional(),SigAlg:o.z.string().optional(),Signature:o.z.string().optional()}),params:o.z.object({client_id:o.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:o.z.string()}}},400:{description:"Bad Request"}}}),async t=>{const{client_id:e}=t.req.valid("param"),{SAMLRequest:n,RelayState:r}=t.req.valid("query"),i=await t.env.data.clients.get(e);if(!i)throw new N(404,{message:"Client not found"});t.set("client_id",i.id),t.set("tenant_id",i.tenant.id);const s=await cS(n),a=s["samlp:AuthnRequest"]["saml:Issuer"]["#text"],l=await t.env.data.loginSessions.create(t.var.tenant_id,{csrf_token:qe(),authParams:{client_id:e,state:JSON.stringify({requestId:s["samlp:AuthnRequest"]["@_ID"],relayState:r}),response_mode:En.SAML_POST,redirect_uri:s["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"],audience:a},expires_at:new Date(Date.now()+Ci*1e3).toISOString(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:wr(t.get("auth0_client"))});return t.redirect(`/u/login/identifier?state=${l.id}`)});function dS(t){const e=new o.OpenAPIHono;e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=t.dataAdapter.cache||Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(s,{defaultTtl:l,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}),e.use(El).use(Al).use(mf(e));const n=e.route("/",uS);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"SAML API"},security:[{oauth2:["openid","email","profile"]}]}),gf(n),n}const pS="Account detected",fS="Account",hS="We have detected that you have already created an account through",gS="By signing in, you agree to our",mS="and",_S="email address",yS="email or phone number",wS="phone number",vS="Callback URL mismatch",bS="The provided redirect_uri is not in the list of allowed callback URLs.",xS="continue with user",$S="Please click the button to create a new password account.",AS="Enter the code at {{vendorName}} to complete the login",ES="Welcome to {{vendorName}}! {{code}} is the login code",SS="Welcome to {{vendorName}}! {{code}} is the login code",kS="Code expired",NS="Invalid code",CS="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",TS="The code is already used",IS="The code is valid for 30 minutes",OS="Confirm password",zS="Need Help?",DS="Contact us",RS="or continue with social account",PS="Continue with {{provider}}",BS="Would you like to continue with your existing account?",jS="Copyright © 2023 SESAMY. All rights reserved.",LS="©2023 Sesamy",FS="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",US="Please enter a valid email address.",MS="The passwords didn't match. Try again.",qS="Choose password",VS="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",HS="Create new account",KS="Sign up with password",GS="You are currently logged in as <0>{{email}}</0>",WS="Email",XS="Email changed to <0>{{email}}</0> ",JS="Email or Phone Number",YS="Email address",ZS="Your email address has been validated",QS="Now enter your password to login again",e9="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.",t9="Email verification sent",n9="Enter a code",r9="We'll send you a verification link to ensure you own this email address.",i9="Enter new email",s9="Enter new password",o9="Enter password",a9="Enter your email address and password to login.",c9="Enter your password",l9="The magic link has expired. Please click on the button below to receive a new link in your inbox.",u9="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",d9="Send password reset email",p9="Click the button below and we’ll send instructions on how to reset your password.",f9="Password reset email sent",h9="Forgot password?",g9="Forgot password?",m9="Go back",_9="Hide password",y9="Invalid identifier",w9="Invalid password",v9=`The link is no longer valid.
284
+ @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function hm(t,e,n){return typeof t=="string"?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Do.prototype[t]=function(){return null}});function Wo(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Bl.__DOMHandler=Do;Bl.normalizeLineEndings=dw;Bl.DOMParser=pw;var fw=nr;Dl.DOMImplementation=fw.DOMImplementation;Dl.XMLSerializer=fw.XMLSerializer;Dl.DOMParser=Bl.DOMParser;var jl={};Object.defineProperty(jl,"__esModule",{value:!0});jl.EnvelopedSignature=void 0;const Xo=Il,mu=xe;class W6{constructor(){this.includeComments=!1,this.includeComments=!1}process(e,n){if(n.signatureNode==null){const s=Xo.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return mu.isNodeLike(s)&&s.parentNode&&s.parentNode.removeChild(s),e}const r=n.signatureNode,i=Xo.select1(".//*[local-name(.)='SignatureValue']/text()",r);if(mu.isTextNode(i)){const s=i.data,a=Xo.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);for(const l of Array.isArray(a)?a:[]){const u=Xo.select1(".//*[local-name(.)='SignatureValue']/text()",l);if(mu.isTextNode(u)){const d=u.data;s===d&&l.parentNode&&l.parentNode.removeChild(l)}}}return e}getAlgorithmName(){return"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}}jl.EnvelopedSignature=W6;var gr={};Object.defineProperty(gr,"__esModule",{value:!0});gr.Sha512=gr.Sha256=gr.Sha1=void 0;const Xf=Sc;class X6{constructor(){this.getHash=function(e){const n=Xf.createHash("sha1");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2000/09/xmldsig#sha1"}}}gr.Sha1=X6;class J6{constructor(){this.getHash=function(e){const n=Xf.createHash("sha256");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha256"}}}gr.Sha256=J6;class Y6{constructor(){this.getHash=function(e){const n=Xf.createHash("sha512");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha512"}}}gr.Sha512=Y6;var An={},Ro={};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.createOptionalCallbackFunction=void 0;function Z6(t){return typeof t=="function"}function Q6(t){return(...e)=>{const n=e[e.length-1];if(Z6(n))try{const r=t(...e.slice(0,-1));n(null,r)}catch(r){n(r instanceof Error?r:new Error("Unknown error"))}else return t(...e)}}Ro.createOptionalCallbackFunction=Q6;Object.defineProperty(An,"__esModule",{value:!0});An.HmacSha1=An.RsaSha512=An.RsaSha256=An.RsaSha1=void 0;const xr=Sc,$r=Ro;class eS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createSign("RSA-SHA1");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createVerify("RSA-SHA1");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"}}An.RsaSha1=eS;class tS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createSign("RSA-SHA256");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createVerify("RSA-SHA256");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"}}An.RsaSha256=tS;class nS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createSign("RSA-SHA512");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createVerify("RSA-SHA512");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"}}An.RsaSha512=nS;class rS{constructor(){this.getSignature=(0,$r.createOptionalCallbackFunction)((e,n)=>{const r=xr.createHmac("SHA1",n);return r.update(e),r.digest("base64")}),this.verifySignature=(0,$r.createOptionalCallbackFunction)((e,n,r)=>{const i=xr.createHmac("SHA1",n);return i.update(e),i.digest("base64")===r}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#hmac-sha1"}}An.HmacSha1=rS;Object.defineProperty(zl,"__esModule",{value:!0});zl.SignedXml=void 0;const Rt=xe,Cr=Dl,iS=Sc,Kt=Il,gm=ti,sS=jl,mm=ni,_u=gr,Jo=An,Oe=To;class jn{constructor(e={}){this.signatureAlgorithm=void 0,this.canonicalizationAlgorithm=void 0,this.inclusiveNamespacesPrefixList=[],this.namespaceResolver={lookupNamespaceURI:function(){throw new Error("Not implemented")}},this.implicitTransforms=[],this.keyInfoAttributes={},this.getKeyInfoContent=jn.getKeyInfoContent,this.getCertFromKeyInfo=jn.getCertFromKeyInfo,this.id=0,this.signedXml="",this.signatureXml="",this.signatureNode=null,this.signatureValue="",this.originalXmlWithIds="",this.keyInfo=null,this.references=[],this.signedReferences=[],this.CanonicalizationAlgorithms={"http://www.w3.org/TR/2001/REC-xml-c14n-20010315":gm.C14nCanonicalization,"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":gm.C14nCanonicalizationWithComments,"http://www.w3.org/2001/10/xml-exc-c14n#":mm.ExclusiveCanonicalization,"http://www.w3.org/2001/10/xml-exc-c14n#WithComments":mm.ExclusiveCanonicalizationWithComments,"http://www.w3.org/2000/09/xmldsig#enveloped-signature":sS.EnvelopedSignature},this.HashAlgorithms={"http://www.w3.org/2000/09/xmldsig#sha1":_u.Sha1,"http://www.w3.org/2001/04/xmlenc#sha256":_u.Sha256,"http://www.w3.org/2001/04/xmlenc#sha512":_u.Sha512},this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#rsa-sha1":Jo.RsaSha1,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":Jo.RsaSha256,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":Jo.RsaSha512};const{idMode:n,idAttribute:r,privateKey:i,publicCert:s,signatureAlgorithm:a,canonicalizationAlgorithm:l,inclusiveNamespacesPrefixList:u,implicitTransforms:d,keyInfoAttributes:p,getKeyInfoContent:h,getCertFromKeyInfo:g}=e;this.idMode=n,this.idAttributes=["Id","ID","id"],r&&this.idAttributes.unshift(r),this.privateKey=i,this.publicCert=s,this.signatureAlgorithm=a??this.signatureAlgorithm,this.canonicalizationAlgorithm=l,typeof u=="string"?this.inclusiveNamespacesPrefixList=u.split(" "):Oe.isArrayHasLength(u)&&(this.inclusiveNamespacesPrefixList=u),this.implicitTransforms=d??this.implicitTransforms,this.keyInfoAttributes=p??this.keyInfoAttributes,this.getKeyInfoContent=h??this.getKeyInfoContent,this.getCertFromKeyInfo=g??jn.noop,this.CanonicalizationAlgorithms,this.HashAlgorithms,this.SignatureAlgorithms}enableHMAC(){this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#hmac-sha1":Jo.HmacSha1},this.getKeyInfoContent=jn.noop}static getKeyInfoContent({publicCert:e,prefix:n}){if(e==null)return null;n=n?`${n}:`:"";let r="";Buffer.isBuffer(e)&&(e=e.toString("latin1"));let i=[];return typeof e=="string"&&(i=e.match(Oe.EXTRACT_X509_CERTS)||[]),i.length>0&&(r=i.map(s=>`<${n}X509Certificate>${Oe.pemToDer(s).toString("base64")}</${n}X509Certificate>`).join("")),`<${n}X509Data>${r}</${n}X509Data>`}static getCertFromKeyInfo(e){if(e!=null){const n=Kt.select1(".//*[local-name(.)='X509Certificate']",e);if(Rt.isNodeLike(n))return Oe.derToPem(n.textContent??"","CERTIFICATE")}return null}checkSignature(e,n){if(n!=null&&typeof n!="function")throw new Error("Last parameter must be a callback function");this.signedXml=e;const r=new Cr.DOMParser().parseFromString(e);this.references=[];const i=this.getCanonSignedInfoXml(r);if(!i){if(n){n(new Error("Canonical signed info cannot be empty"),!1);return}throw new Error("Canonical signed info cannot be empty")}const a=new Cr.DOMParser().parseFromString(i,"text/xml").documentElement;if(!a){if(n){n(new Error("Could not parse unverifiedSignedInfoCanon into a document"),!1);return}throw new Error("Could not parse unverifiedSignedInfoCanon into a document")}const l=Oe.findChildren(a,"Reference");if(!Oe.isArrayHasLength(l)){if(n){n(new Error("could not find any Reference elements"),!1);return}throw new Error("could not find any Reference elements")}for(const h of l)this.loadReference(h);if(!this.getReferences().every(h=>this.validateReference(h,r))){if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error("Could not validate all references"),!1);return}return!1}const u=this.findSignatureAlgorithm(this.signatureAlgorithm),d=this.getCertFromKeyInfo(this.keyInfo)||this.publicCert||this.privateKey;if(d==null)throw new Error("KeyInfo or publicCert or privateKey is required to validate signature");if(u.verifySignature(i,d,this.signatureValue)===!0)if(n)n(null,!0);else return!0;else if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`));return}else throw new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`)}getCanonSignedInfoXml(e){if(this.signatureNode==null)throw new Error("No signature found.");if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to get signed info for XML");const n=Oe.findChildren(this.signatureNode,"SignedInfo");if(n.length===0)throw new Error("could not find SignedInfo element in the message");if(n.length>1)throw new Error("could not get canonicalized signed info for a signature that contains multiple SignedInfo nodes");if((this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(!e||typeof e!="object"))throw new Error("When canonicalization method is non-exclusive, whole xml dom must be provided as an argument");const i={ancestorNamespaces:Oe.findAncestorNs(e,"//*[local-name()='SignedInfo']")};return this.getCanonXml([this.canonicalizationAlgorithm],n[0],i)}getCanonReferenceXml(e,n,r){Array.isArray(n.transforms)&&(n.ancestorNamespaces=Oe.findAncestorNs(e,n.xpath,this.namespaceResolver));const i={inclusiveNamespacesPrefixList:n.inclusiveNamespacesPrefixList,ancestorNamespaces:n.ancestorNamespaces};return this.getCanonXml(n.transforms,r,i)}calculateSignatureValue(e,n){const r=this.getCanonSignedInfoXml(e),i=this.findSignatureAlgorithm(this.signatureAlgorithm);if(this.privateKey==null)throw new Error("Private key is required to compute signature");typeof n=="function"?i.getSignature(r,this.privateKey,n):this.signatureValue=i.getSignature(r,this.privateKey)}findSignatureAlgorithm(e){if(e==null)throw new Error("signatureAlgorithm is required");const n=this.SignatureAlgorithms[e];if(n)return new n;throw new Error(`signature algorithm '${e}' is not supported`)}findCanonicalizationAlgorithm(e){if(e!=null){const n=this.CanonicalizationAlgorithms[e];if(n)return new n}throw new Error(`canonicalization algorithm '${e}' is not supported`)}findHashAlgorithm(e){const n=this.HashAlgorithms[e];if(n)return new n;throw new Error(`hash algorithm '${e}' is not supported`)}validateElementAgainstReferences(e,n){var i;let r;if(typeof e=="string"){const s=Kt.select1(e,n);Rt.assertIsElementNode(s),r=s}else r=e;for(const s of this.getReferences()){const a=((i=s.uri)==null?void 0:i[0])==="#"?s.uri.substring(1):s.uri;for(const p of this.idAttributes){const h=r.getAttribute(p);if(a===h){s.xpath=`//*[@*[local-name(.)='${p}']='${a}']`;break}}const l=this.getCanonReferenceXml(n,s,r),d=this.findHashAlgorithm(s.digestAlgorithm).getHash(l);if(Oe.validateDigestValue(d,s.digestValue))return s}throw new Error("No references passed validation")}validateReference(e,n){var u;const r=((u=e.uri)==null?void 0:u[0])==="#"?e.uri.substring(1):e.uri;let i=null;if(r==="")i=Kt.select1("//*",n);else{if((r==null?void 0:r.indexOf("'"))!==-1)throw new Error("Cannot validate a uri with quotes inside it");{let d=0;for(const p of this.idAttributes){const h=`//*[@*[local-name(.)='${p}']='${r}']`,g=Kt.select(h,n);if(Oe.isArrayHasLength(g)){if(d+=g.length,d>1)throw new Error("Cannot validate a document which contains multiple elements with the same value for the ID / Id / Id attributes, in order to prevent signature wrapping attack.");i=g[0],e.xpath=h}}}}if(e.getValidatedNode=(0,iS.deprecate)(d=>{if(d=d||e.xpath,typeof d!="string"||e.validationError!=null)return null;const p=Kt.select1(d,n);return Rt.isNodeLike(p)?p:null},"`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead."),!Rt.isNodeLike(i)){const d=new Error(`invalid signature: the signature references an element with uri ${e.uri} but could not find such element in the xml`);return e.validationError=d,!1}const s=this.getCanonReferenceXml(n,e,i),l=this.findHashAlgorithm(e.digestAlgorithm).getHash(s);if(!Oe.validateDigestValue(l,e.digestValue)){const d=new Error(`invalid signature: for uri ${e.uri} calculated digest is ${l} but the xml to validate supplies digest ${e.digestValue}`);return e.validationError=d,!1}return this.signedReferences.push(s),e.signedReference=s,!0}findSignatures(e){const n=Kt.select("//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return Rt.isArrayOfNodes(n)?n:[]}loadSignature(e){typeof e=="string"?this.signatureNode=e=new Cr.DOMParser().parseFromString(e):this.signatureNode=e,this.signatureXml=e.toString();const n=Kt.select1(".//*[local-name(.)='CanonicalizationMethod']/@Algorithm",e);if(!Rt.isNodeLike(n))throw new Error("could not find CanonicalizationMethod/@Algorithm element");Rt.isAttributeNode(n)&&(this.canonicalizationAlgorithm=n.value);const r=Kt.select1(".//*[local-name(.)='SignatureMethod']/@Algorithm",e);Rt.isAttributeNode(r)&&(this.signatureAlgorithm=r.value);const i=Oe.findChildren(this.signatureNode,"SignedInfo");if(!Oe.isArrayHasLength(i))throw new Error("no signed info node found");if(i.length>1)throw new Error("could not load signature that contains multiple SignedInfo nodes");let s=this.canonicalizationAlgorithm;(!s||s==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||s==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(s="http://www.w3.org/2001/10/xml-exc-c14n#");const a=this.getCanonXml([s],i[0]),u=new Cr.DOMParser().parseFromString(a,"text/xml").documentElement;this.references=[];const d=Oe.findChildren(u,"Reference");if(!Oe.isArrayHasLength(d))throw new Error("could not find any Reference elements");for(const g of d)this.loadReference(g);const p=Kt.select1(".//*[local-name(.)='SignatureValue']/text()",e);Rt.isTextNode(p)&&(this.signatureValue=p.data.replace(/\r?\n/g,""));const h=Kt.select1(".//*[local-name(.)='KeyInfo']",e);Rt.isNodeLike(h)&&(this.keyInfo=h)}loadReference(e){let n=Oe.findChildren(e,"DigestMethod");if(n.length===0)throw new Error(`could not find DigestMethod in reference ${e.toString()}`);const r=n[0],i=Oe.findAttr(r,"Algorithm");if(!i)throw new Error(`could not find Algorithm attribute in node ${r.toString()}`);const s=i.value;if(n=Oe.findChildren(e,"DigestValue"),n.length===0)throw new Error(`could not find DigestValue node in reference ${e.toString()}`);if(n.length>1)throw new Error(`could not load reference for a node that contains multiple DigestValue nodes: ${e.toString()}`);const a=n[0].textContent;if(!a)throw new Error(`could not find the value of DigestValue in ${e.toString()}`);const l=[];let u=[];if(n=Oe.findChildren(e,"Transforms"),n.length!==0){const p=n[0],h=Oe.findChildren(p,"Transform");for(const A of h){const $=Oe.findAttr(A,"Algorithm");$&&l.push($.value)}const g=Oe.findChildren(h[h.length-1],"InclusiveNamespaces");Oe.isArrayHasLength(g)&&(u=g.flatMap(A=>(A.getAttribute("PrefixList")??"").split(" ")).filter(A=>A.length>0))}Oe.isArrayHasLength(this.implicitTransforms)&&this.implicitTransforms.forEach(function(p){l.push(p)}),(l.length===0||l[l.length-1]==="http://www.w3.org/2000/09/xmldsig#enveloped-signature")&&l.push("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");const d=Rt.isElementNode(e)&&e.getAttribute("URI")||void 0;this.addReference({transforms:l,digestAlgorithm:s,uri:d,digestValue:a,inclusiveNamespacesPrefixList:u,isEmptyUri:!1})}addReference({xpath:e,transforms:n,digestAlgorithm:r,uri:i="",digestValue:s,inclusiveNamespacesPrefixList:a=[],isEmptyUri:l=!1}){if(r==null)throw new Error("digestAlgorithm is required");if(!Oe.isArrayHasLength(n))throw new Error("transforms must contain at least one transform algorithm");this.references.push({xpath:e,transforms:n,digestAlgorithm:r,uri:i,digestValue:s,inclusiveNamespacesPrefixList:a,isEmptyUri:l,getValidatedNode:()=>{throw new Error("Reference has not been validated yet; Did you call `sig.checkSignature()`?")}})}getReferences(){return this.references}getSignedReferences(){return[...this.signedReferences]}computeSignature(e,n,r){let i;typeof n=="function"&&r==null?(i=n,n={}):(i=r,n=n??{});const s=new Cr.DOMParser().parseFromString(e);let a="xmlns";const l=[];let u;const d=["append","prepend","before","after"],p=n.prefix,h=n.attrs||{},g=n.location||{},A=n.existingPrefixes||{};if(this.namespaceResolver={lookupNamespaceURI:function(H){return H?A[H]:null}},g.reference=g.reference||"/*",g.action=g.action||"append",d.indexOf(g.action)===-1){const H=new Error(`location.action option has an invalid action: ${g.action}, must be any of the following values: ${d.join(", ")}`);if(i){i(H);return}else throw H}p?(a+=`:${p}`,u=`${p}:`):u="",Object.keys(h).forEach(function(H){H!=="xmlns"&&H!==a&&l.push(`${H}="${h[H]}"`)}),l.push(`${a}="http://www.w3.org/2000/09/xmldsig#"`);let $=`<${u}Signature ${l.join(" ")}>`;$+=this.createSignedInfo(s,p),$+=this.getKeyInfo(p),$+=`</${u}Signature>`,this.originalXmlWithIds=s.toString();let I="";Object.keys(A).forEach(function(H){I+=`xmlns:${H}="${A[H]}" `});const R=`<Dummy ${I}>${$}</Dummy>`,x=new Cr.DOMParser().parseFromString(R).documentElement.firstChild,M=Kt.select1(g.reference,s);if(!Rt.isNodeLike(M)){const H=new Error(`the following xpath cannot be used because it was not found: ${g.reference}`);if(i){i(H);return}else throw H}if(g.action==="append")M.appendChild(x);else if(g.action==="prepend")M.insertBefore(x,M.firstChild);else if(g.action==="before"){if(M.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");M.parentNode.insertBefore(x,M)}else if(g.action==="after"){if(M.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");M.parentNode.insertBefore(x,M.nextSibling)}this.signatureNode=x;const G=Oe.findChildren(this.signatureNode,"SignedInfo");if(G.length===0){const H=new Error("could not find SignedInfo element in the message");if(i){i(H);return}else throw H}const F=G[0];typeof i=="function"?this.calculateSignatureValue(s,(H,W)=>{H?i(H):(this.signatureValue=W||"",x.insertBefore(this.createSignature(p),F.nextSibling),this.signatureXml=x.toString(),this.signedXml=s.toString(),i(null,this))}):(this.calculateSignatureValue(s),x.insertBefore(this.createSignature(p),F.nextSibling),this.signatureXml=x.toString(),this.signedXml=s.toString())}getKeyInfo(e){const n=e?`${e}:`:"";let r="";this.keyInfoAttributes&&Object.keys(this.keyInfoAttributes).forEach(s=>{r+=` ${s}="${this.keyInfoAttributes[s]}"`});const i=this.getKeyInfoContent({publicCert:this.publicCert,prefix:e});return r||i?`<${n}KeyInfo${r}>${i}</${n}KeyInfo>`:""}createReferences(e,n){let r="";n=n||"",n=n&&`${n}:`;for(const i of this.getReferences()){const s=Kt.selectWithResolver(i.xpath??"",e,this.namespaceResolver);if(!Oe.isArrayHasLength(s))throw new Error(`the following xpath cannot be signed because it was not found: ${i.xpath}`);for(const a of s){if(i.isEmptyUri)r+=`<${n}Reference URI="">`;else{const d=this.ensureHasId(a);i.uri=d,r+=`<${n}Reference URI="#${d}">`}r+=`<${n}Transforms>`;for(const d of i.transforms||[]){const p=this.findCanonicalizationAlgorithm(d);r+=`<${n}Transform Algorithm="${p.getAlgorithmName()}"`,Oe.isArrayHasLength(i.inclusiveNamespacesPrefixList)?(r+=">",r+=`<InclusiveNamespaces PrefixList="${i.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${p.getAlgorithmName()}"/>`,r+=`</${n}Transform>`):r+=" />"}const l=this.getCanonReferenceXml(e,i,a),u=this.findHashAlgorithm(i.digestAlgorithm);r+=`</${n}Transforms><${n}DigestMethod Algorithm="${u.getAlgorithmName()}" /><${n}DigestValue>${u.getHash(l)}</${n}DigestValue></${n}Reference>`}}return r}getCanonXml(e,n,r={}){r.defaultNsForPrefix=r.defaultNsForPrefix??jn.defaultNsForPrefix,r.signatureNode=this.signatureNode;let s=n.cloneNode(!0);return e.forEach(a=>{Rt.isNodeLike(s)&&(s=this.findCanonicalizationAlgorithm(a).process(s,r))}),s.toString()}ensureHasId(e){let n;if(this.idMode==="wssecurity"?n=Oe.findAttr(e,"Id","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"):this.idAttributes.some(i=>(n=Oe.findAttr(e,i),!!n)),n)return n.value;const r=`_${this.id++}`;return this.idMode==="wssecurity"?(e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:wsu","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"),e.setAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd","wsu:Id",r)):e.setAttribute("Id",r),r}createSignedInfo(e,n){if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to create signed info for XML");const r=this.findCanonicalizationAlgorithm(this.canonicalizationAlgorithm),i=this.findSignatureAlgorithm(this.signatureAlgorithm);let s;s=n||"",s=s&&`${s}:`;let a=`<${s}SignedInfo>`;return a+=`<${s}CanonicalizationMethod Algorithm="${r.getAlgorithmName()}"`,Oe.isArrayHasLength(this.inclusiveNamespacesPrefixList)?(a+=">",a+=`<InclusiveNamespaces PrefixList="${this.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${r.getAlgorithmName()}"/>`,a+=`</${s}CanonicalizationMethod>`):a+=" />",a+=`<${s}SignatureMethod Algorithm="${i.getAlgorithmName()}" />`,a+=this.createReferences(e,n),a+=`</${s}SignedInfo>`,a}createSignature(e){let n="xmlns";e?(n+=`:${e}`,e+=":"):e="";const r=`<${e}SignatureValue>${this.signatureValue}</${e}SignatureValue>`,i=`<${e}Signature ${n}="http://www.w3.org/2000/09/xmldsig#">${r}</${e}Signature>`;return new Cr.DOMParser().parseFromString(i).documentElement.firstChild}getSignatureXml(){return this.signatureXml}getOriginalXmlWithIds(){return this.originalXmlWithIds}getSignedXml(){return this.signedXml}}zl.SignedXml=jn;jn.defaultNsForPrefix={ds:"http://www.w3.org/2000/09/xmldsig#"};jn.noop=()=>null;(function(t){var e=Pr&&Pr.__createBinding||(Object.create?function(a,l,u,d){d===void 0&&(d=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(a,d,p)}:function(a,l,u,d){d===void 0&&(d=u),a[d]=l[u]}),n=Pr&&Pr.__exportStar||function(a,l){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.SignedXml=t.ExclusiveCanonicalizationWithComments=t.ExclusiveCanonicalization=t.C14nCanonicalizationWithComments=t.C14nCanonicalization=void 0;var r=ti;Object.defineProperty(t,"C14nCanonicalization",{enumerable:!0,get:function(){return r.C14nCanonicalization}}),Object.defineProperty(t,"C14nCanonicalizationWithComments",{enumerable:!0,get:function(){return r.C14nCanonicalizationWithComments}});var i=ni;Object.defineProperty(t,"ExclusiveCanonicalization",{enumerable:!0,get:function(){return i.ExclusiveCanonicalization}}),Object.defineProperty(t,"ExclusiveCanonicalizationWithComments",{enumerable:!0,get:function(){return i.ExclusiveCanonicalizationWithComments}});var s=zl;Object.defineProperty(t,"SignedXml",{enumerable:!0,get:function(){return s.SignedXml}}),n(Ro,t),n(To,t)})(Z8);async function oS(t){const e=new DecompressionStream("deflate-raw"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}async function aS(t){const e=await __.decode(t.replace(/ /g,"+"));try{const n=await oS(e);return new TextDecoder().decode(n)}catch(n){return console.warn("Decompression failed, assuming data is not compressed:",n),new TextDecoder().decode(e)}}async function cS(t){const e=await aS(t),r=new $p.XMLParser({attributeNamePrefix:"@_",alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(e);return X8.parse(r)}function lS(t){const e=t.certificates.map(i=>({":@":{"@_use":"signing"},KeyDescriptor:[{":@":{"@_xmlns":"http://www.w3.org/2000/09/xmldsig#"},KeyInfo:[{X509Data:[{X509Certificate:[{"#text":i}]}]}]}]})),n=[{":@":{"@_entityID":t.entityId,"@_xmlns":"urn:oasis:names:tc:SAML:2.0:metadata"},EntityDescriptor:[{":@":{"@_protocolSupportEnumeration":"urn:oasis:names:tc:SAML:2.0:protocol"},IDPSSODescriptor:[...e,{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"}]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"E-Mail Address","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Given Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Surname","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name ID","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]}]}]}];return new $p.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0,format:!0}).build(n)}const uS=new o.OpenAPIHono().openapi(o.createRoute({tags:["saml"],method:"get",path:"/metadata/{client_id}",request:{params:o.z.object({client_id:o.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:o.z.string()}}},400:{description:"Bad Request"}}}),async t=>{var l,u;const{client_id:e}=t.req.valid("param"),n=await t.env.data.clients.get(e);if(!n)throw new N(404,{message:"Client not found"});const{signingKeys:r}=await t.env.data.keys.list({q:"type:saml_encryption"});if(r.length===0)throw new N(500,{message:"No signing key found"});const i=r.map(d=>new bl(d.cert).toString("base64")),s=t.env.ISSUER,a=lS({entityId:((u=(l=n.addons)==null?void 0:l.samlp)==null?void 0:u.audience)||n.id,certificates:i,assertionConsumerServiceUrl:`${s}samlp/${e}`,singleLogoutServiceUrl:`${s}samlp/${e}/logout`});return new Response(a,{headers:{"Content-Type":"text/xml"}})}).openapi(o.createRoute({tags:["saml"],method:"get",path:"/{client_id}",request:{query:o.z.object({SAMLRequest:o.z.string(),RelayState:o.z.string().optional(),SigAlg:o.z.string().optional(),Signature:o.z.string().optional()}),params:o.z.object({client_id:o.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:o.z.string()}}},400:{description:"Bad Request"}}}),async t=>{const{client_id:e}=t.req.valid("param"),{SAMLRequest:n,RelayState:r}=t.req.valid("query"),i=await t.env.data.clients.get(e);if(!i)throw new N(404,{message:"Client not found"});t.set("client_id",i.id),t.set("tenant_id",i.tenant.id);const s=await cS(n),a=s["samlp:AuthnRequest"]["saml:Issuer"]["#text"],l=await t.env.data.loginSessions.create(t.var.tenant_id,{csrf_token:qe(),authParams:{client_id:e,state:JSON.stringify({requestId:s["samlp:AuthnRequest"]["@_ID"],relayState:r}),response_mode:En.SAML_POST,redirect_uri:s["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"],audience:a},expires_at:new Date(Date.now()+Ci*1e3).toISOString(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:wr(t.get("auth0_client"))});return t.redirect(`/u/login/identifier?state=${l.id}`)});function dS(t){const e=new o.OpenAPIHono;e.use(async(r,i)=>{const s=ro(r,t.dataAdapter),a=t.dataAdapter.cache||Ao({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(s,{defaultTtl:l,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}),e.use(El).use(Al).use(mf(e));const n=e.route("/",uS);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"SAML API"},security:[{oauth2:["openid","email","profile"]}]}),gf(n),n}const pS="Account detected",fS="Account",hS="We have detected that you have already created an account through",gS="By signing in, you agree to our",mS="and",_S="email address",yS="email or phone number",wS="phone number",vS="Callback URL mismatch",bS="The provided redirect_uri is not in the list of allowed callback URLs.",xS="continue with user",$S="Please click the button to create a new password account.",AS="Enter the code at {{vendorName}} to complete the login",ES="Welcome to {{vendorName}}! {{code}} is the login code",SS="Welcome to {{vendorName}}! {{code}} is the login code",kS="Code expired",NS="Invalid code",CS="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",TS="The code is already used",IS="The code is valid for 30 minutes",OS="Confirm password",zS="Need Help?",DS="Contact us",RS="or continue with social account",PS="Continue with {{provider}}",BS="Would you like to continue with your existing account?",jS="Copyright © 2023 SESAMY. All rights reserved.",LS="©2023 Sesamy",FS="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",US="Please enter a valid email address.",MS="The passwords didn't match. Try again.",qS="Choose password",VS="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",HS="Create new account",KS="Sign up with password",GS="You are currently logged in as <0>{{email}}</0>",WS="Email",XS="Email changed to <0>{{email}}</0> ",JS="Email or Phone Number",YS="Email address",ZS="Your email address has been validated",QS="Now enter your password to login again",e9="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.",t9="Email verification sent",n9="Enter a code",r9="We'll send you a verification link to ensure you own this email address.",i9="Enter new email",s9="Enter new password",o9="Enter password",a9="Enter your email address and password to login.",c9="Enter your password",l9="The magic link has expired. Please click on the button below to receive a new link in your inbox.",u9="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",d9="Send password reset email",p9="Click the button below and we’ll send instructions on how to reset your password.",f9="Password reset email sent",h9="Forgot password?",g9="Forgot password?",m9="Go back",_9="Hide password",y9="Invalid identifier",w9="Invalid password",v9=`The link is no longer valid.
285
285
 
286
286
  Please make sure to open the login link in the same browser you started the login with.
287
287
 
@@ -309,4 +309,4 @@ Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,hj="Neplatn
309
309
 
310
310
  Varmista, että avaat kirjautumislinkin samalla selaimella, jolla aloitit kirjautumisen.
311
311
 
312
- Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,HF="Virheellinen linkki",KF="Kirjaudu sisään napsauttamalla painiketta",GF="Kirjaudu sisään",WF="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",XF="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",JF="Yhdistä tilisi {{service}}",YF="Olet kirjautunut sisään nimellä",ZF="Kirjaudu sisään",QF="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",eU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",tU="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",nU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",rU="Anna puhelinnumerosi kirjautuaksesi sisään",iU="Kirjoita {{authMethod}} kirjautuaksesi sisään.",sU="Kirjaudu ulos",oU="Ei, haluan käyttää toista tiliä",aU="tai",cU="Salasana",lU="Salasana on nollattu",uU="Menestys",dU="Vaihda salasana tilillesi {{vendorName}} ",pU="Vaihda salasana tilillesi {{vendorName}} ",fU="Puhelinnumero",hU="Tietosuojakäytäntö",gU="Uudelleenohjaus",mU="Vahvista salasana",_U="Rekisteröi uusi salasana",yU="Lähetä koodi uudelleen",wU="Vaihda salasana",vU="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",bU="Napsauta painiketta salasanasi palauttamiseksi",xU="Napsauta painiketta salasanasi palauttamiseksi",$U="Nollaa salasanasi",AU="Vaihda salasana tilillesi {{vendorName}} ",EU="Nollaa salasana",SU="Lähetä",kU="Lähetä minulle uusi maaginen linkki",NU="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",CU="Aseta salasana",TU="Näytä salasana",IU="Kirjaudu sisään",OU="Rekisteröityminen",zU="Rekisteröidy onnistuneesti",DU="{{code}} on kirjautumiskoodisi {{vendorName}}",RU="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.",PU="Siirry Spotifyn Content Access -sivulle",BU='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ä.',jU="Vaihe 1: Poista Spotify-tilisi linkitys",LU="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",FU="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",UU="Hups! Spotify-tilisi on jo linkitetty",MU="Valmis",qU="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",VU="Ehdot ja edellytykset",HU="Jokin meni pieleen. Yritä uudelleen.",KU="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",GU="Päivitä sähköposti",WU="Käyttäjätiliä ei ole olemassa",XU="Käyttäjätiliä ei ole olemassa",JU="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",YU="Yritä uudelleen.",ZU="Validoi koodi",QU="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",eM="Rekisteröitynyt",tM="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",nM="Vahvista sähköpostiosoitteesi",rM="Vahvista sähköpostiosoitteesi",iM="Vahvista tili",sM="Vahvista sähköpostiosoitteesi",oM="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",aM="Tervetuloa",cM="Tervetuloa tilillesi {{vendorName}}!",lM="Jatka tällä tilillä",uM="Kyllä, jatka {{text}}",dM="Kyllä, jatka olemassa olevalla tilillä",pM={"Server error: Invalid code":"Virheellinen koodi",account_detected:PL,account_title:BL,account_with_sso_provider:jL,agree_to:LL,and:FL,auth_method_email:UL,auth_method_email_or_phone:ML,auth_method_phone:qL,callback_url_mismatch:VL,callback_url_not_allowed:HL,check_email_title:KL,click_to_sign_up_description:GL,code_email_enter_code:WL,code_email_subject:XL,code_email_title:JL,code_expired:YL,code_invalid:ZL,code_sent_template:QL,code_used:eF,code_valid_30_minutes:tF,confirm_password:nF,contact_support:rF,contact_us:iF,continue:"Jatka",continue_social_login:sF,continue_with:oF,continue_with_sso_provider_headline:aF,copyright:cF,copyright_sesamy:lF,create_account_description:uF,create_account_email_invalid:dF,create_account_passwords_didnt_match:pF,create_account_title:fF,create_account_weak_password:hF,create_new_account_link:gF,create_password_account_title:mF,currently_logged_in_as:_F,email:yF,email_changed_to_template:wF,email_or_phone_placeholder:vF,email_placeholder:bF,email_validated:xF,email_validated_cta:$F,email_verification_for_signup_sent_description:AF,email_verification_for_signup_sent_title:EF,enter_a_code_btn:SF,enter_email_for_verification_description:kF,enter_new_email:NF,enter_new_password_placeholder:CF,enter_password:TF,enter_password_description:IF,enter_your_password_btn:OF,expired_code:zF,fokus_info_message:DF,forgot_password_cta:RF,forgot_password_description:PF,forgot_password_email_sent:BF,forgot_password_link:jF,forgot_password_title:LF,go_back:FF,hide_password:UF,"invalid-email":"Virheellinen sähköpostiosoite",invalid_identifier:MF,invalid_password:qF,invalid_session_body:VF,invalid_session_title:HF,link_email_click_to_login:KF,link_email_login:GF,link_email_or_enter_code:WF,link_page_body:XF,link_page_headline:JF,logged_in_as:YF,login:ZF,login_description:QF,login_description_code:eU,login_description_combined:tU,login_description_link:nU,login_description_phone:rU,login_description_template:iU,logout:sU,no_use_another:oU,or:aU,password:cU,password_has_been_reset:lU,password_has_been_reset_title:uU,password_reset_subject:dU,password_reset_title:pU,phone_placeholder:fU,privacy_policy:hU,redirecting:gU,reenter_new_password_placeholder:mU,register_password_account:_U,resend_code:yU,reset_password_cta:wU,reset_password_description:vU,reset_password_email_click_to_reset:bU,reset_password_email_cta:xU,reset_password_email_reset:$U,reset_password_subject:AU,reset_password_title:EU,send:SU,send_me_a_new_magic_link:kU,sent_code_spam:NU,set_password:CU,show_password:TU,sign_in:IU,signup:OU,signup_success:zU,sms_code_text:DU,spotify_already_linked_body:RU,spotify_already_linked_cta:PU,spotify_already_linked_step1_body:BU,spotify_already_linked_step1_title:jU,spotify_already_linked_step2_body:LU,spotify_already_linked_step2_title:FU,spotify_already_linked_title:UU,success:MU,support_info:qU,terms:VU,unexpected_error_try_again:HU,unverified_email:KU,update_email:GU,user_account_does_not_exist:WU,user_not_found:XU,user_not_found_body:JU,user_not_found_cta:YU,validate_code:ZU,validate_email_body:QU,validate_email_title:eM,verify_email_click_to_verify:tM,verify_email_subject:nM,verify_email_title:rM,verify_email_verify:iM,verify_your_email:sM,we_sent_a_code_to:oM,welcome:aM,welcome_to_your_account:cM,yes_continue:lM,yes_continue_with:uM,yes_continue_with_existing_account:dM},fM="Konto opdaget",hM="Konto",gM="Vi har opdaget, at du allerede har oprettet en konto gennem",mM="Når du logger ind, accepterer du vores",_M="og",yM="e-mail-adresse",wM="e-mail eller telefonnummer",vM="Telefonnummer",bM="Uoverensstemmelse mellem URL og tilbagekald",xM="Den angivne redirect_uri er ikke på listen over tilladte tilbagekalds-URL'er.",$M="Fortsæt med brugeren",AM="Klik på knappen for at oprette en ny adgangskodekonto.",EM="Indtast koden på {{vendorName}} for at gennemføre login.",SM="Velkommen til {{vendorName}}! {{code}} er login-koden",kM="Velkommen til {{vendorName}}! {{code}} er login-koden",NM="Koden er udløbet",CM="Ugyldig kode",TM="Tjek venligst <0>{{username}}</0> og indtast den sekscifrede kode, som vi har sendt til dig.",IM="Koden er allerede brugt",OM="Koden er gyldig i 30 minutter",zM="Bekræft adgangskode",DM="Har du brug for hjælp?",RM="Kontakt os",PM="eller fortsæt med social konto",BM="Fortsæt med {{provider}}",jM="Vil du gerne fortsætte med din eksisterende konto?",LM="Ophavsret © 2023 SESAMY. Alle rettigheder forbeholdes.",FM="©2023 Sesamy",UM="Vælg en adgangskode med en blanding af store og små bogstaver, tal og symboler.",MM="Indtast venligst en gyldig e-mailadresse.",qM="Adgangskoderne stemte ikke overens. Prøv igen.",VM="Vælg adgangskode",HM="Adgangskoden skal være mindst 8 tegn lang og indeholde mindst et lille bogstav, et stort bogstav, et tal og et symbol.",KM="Opret ny konto",GM="Tilmeld dig med adgangskode",WM="Du er i øjeblikket logget ind som <0>{{email}}</0>",XM="E-mail",JM="E-mail ændret til <0>{{email}}</0> ",YM="E-mail eller telefonnummer",ZM="E-mail-adresse",QM="Din e-mailadresse er blevet valideret",eq="Indtast nu din adgangskode for at logge ind igen",tq="Der er sendt en e-mail til <0>{{email}}</0> med et bekræftelseslink. Klik på linket for at bekræfte din e-mailadresse og angive en adgangskode.",nq="E-mail-bekræftelse sendt",rq="Indtast en kode",iq="Vi sender dig et bekræftelseslink for at sikre, at du ejer denne e-mailadresse.",sq="Indtast ny e-mail",oq="Indtast ny adgangskode",aq="Indtast adgangskode",cq="Indtast din e-mailadresse og adgangskode for at logge ind.",lq="Indtast din adgangskode",uq="Det magiske link er udløbet. Klik på knappen nedenfor for at modtage et nyt link i din indbakke.",dq="Hej! Vi har opdateret vores login-oplevelse. <0>Klik her for at lære mere om det.</0>",pq="Send e-mail til nulstilling af adgangskode",fq="Klik på knappen nedenfor, så sender vi instruktioner om, hvordan du nulstiller din adgangskode.",hq="E-mail til nulstilling af adgangskode sendt",gq="Har du glemt din adgangskode?",mq="Har du glemt din adgangskode?",_q="Gå tilbage",yq="Skjul adgangskode",wq="Ugyldig identifikator",vq="Ugyldig adgangskode",bq="Linket er ikke længere gyldigt. Sørg for at åbne login-linket i den samme browser, som du startede login med. Du kan klikke på linket nedenfor for at starte et nyt login.",xq="Ugyldigt link",$q="Klik på knappen for at logge ind",Aq="Login",Eq="Eller indtast koden på {{vendorName}} for at gennemføre login.",Sq="Indtast din e-mailadresse for at låse op for dette show på {{service}}",kq="Forbind din konto med {{service}}",Nq="Du er logget ind som",Cq="Login",Tq="Indtast din e-mailadresse for at logge ind.",Iq="Indtast din e-mailadresse, så sender vi dig en login-kode.",Oq="Indtast din e-mail eller dit telefonnummer for at logge ind",zq="Indtast din e-mailadresse, så sender vi dig et login-link.",Dq="Indtast dit telefonnummer for at logge ind",Rq="Indtast din {{authMethod}} for at logge ind.",Pq="Log ud",Bq="Nej, jeg vil bruge en anden konto",jq="eller",Lq="Adgangskode",Fq="Adgangskoden er blevet nulstillet",Uq="Succes",Mq="Skift adgangskode til din {{vendorName}} -konto",qq="Skift adgangskode til din {{vendorName}} -konto",Vq="Telefonnummer",Hq="Politik for beskyttelse af personlige oplysninger",Kq="Omdirigering",Gq="Bekræft adgangskode",Wq="Registrer en ny adgangskode",Xq="Send koden igen",Jq="Skift adgangskode",Yq="Indtast din nye adgangskode til e-mailkontoen nedenfor: ",Zq="Klik på knappen for at nulstille din adgangskode",Qq="Klik på knappen for at nulstille din adgangskode",eV="Nulstil din adgangskode",tV="Skift adgangskode til din {{vendorName}} -konto",nV="Nulstil adgangskode",rV="Send",iV="Send mig et nyt magisk link",sV="Husk at tjekke din spam-mappe, hvis e-mailen ikke er kommet frem.",oV="Indstil adgangskode",aV="Vis adgangskode",cV="Log ind",lV="Tilmelding",uV="Tilmeld dig med succes",dV="{{code}} er din login-kode til {{vendorName}}",pV="Det ser ud til, at din Spotify-konto i øjeblikket er knyttet til en anden Sesamy-konto. Men frygt ikke, vi er her for at guide dig gennem processen med at få det løst.",fV="Gå til Spotifys side for adgang til indhold",hV='Lad os starte med at fjerne forbindelsen til din Spotify-konto. Klik på knappen nedenfor for at gå til Spotifys Content Access-side. Når du har logget ind på din Spotify-konto, skal du finde Sesamy på listen over tilsluttede platforme. Klik på "Unlink" ved siden af Sesamy-logoet.',gV="Trin 1: Fjern forbindelsen til din Spotify-konto",mV="Når du har afkoblet din Spotify-konto, kan du koble den til Sesamy igen. Du skal blot gentage de trin, du tidligere har taget, og som førte dig til denne side.",_V="Trin 2: Relink din Spotify-konto til Sesamy",yV="Ups! Din Spotify-konto er allerede forbundet",wV="Færdig",vV="Hvis du har spørgsmål eller brug for hjælp, kan du kontakte vores supportteam",bV="Vilkår og betingelser",xV="Noget gik galt. Prøv venligst igen.",$V="Din e-mailadresse skal valideres. Vi har sendt en ny e-mail til din indbakke",AV="Opdatering af e-mail",EV="Brugerkontoen findes ikke",SV="Brugerkontoen findes ikke",kV="Vi kunne ikke finde en bruger med den angivne e-mailadresse. Prøv venligst igen.",NV="Prøv igen.",CV="Valider koden",TV="Tjek din indbakke for instruktioner om validering af e-mail.",IV="Tilmeldte sig",OV="Klik på knappen for at bekræfte din e-mailadresse",zV="Bekræft din e-mailadresse",DV="Bekræft din e-mailadresse",RV="Bekræft konto",PV="Bekræft din e-mail",BV="Tjek venligst din e-mail på <0>{{email}}</0> og indtast den sekscifrede kode, vi har sendt dig.",jV="Velkommen",LV="Velkommen til din {{vendorName}} konto!",FV="Fortsæt med denne konto",UV="Ja, fortsæt med {{text}}",MV="Ja, fortsæt med eksisterende konto",qV={"Server error: Invalid code":"Ugyldig kode",account_detected:fM,account_title:hM,account_with_sso_provider:gM,agree_to:mM,and:_M,auth_method_email:yM,auth_method_email_or_phone:wM,auth_method_phone:vM,callback_url_mismatch:bM,callback_url_not_allowed:xM,check_email_title:$M,click_to_sign_up_description:AM,code_email_enter_code:EM,code_email_subject:SM,code_email_title:kM,code_expired:NM,code_invalid:CM,code_sent_template:TM,code_used:IM,code_valid_30_minutes:OM,confirm_password:zM,contact_support:DM,contact_us:RM,continue:"Fortsæt",continue_social_login:PM,continue_with:BM,continue_with_sso_provider_headline:jM,copyright:LM,copyright_sesamy:FM,create_account_description:UM,create_account_email_invalid:MM,create_account_passwords_didnt_match:qM,create_account_title:VM,create_account_weak_password:HM,create_new_account_link:KM,create_password_account_title:GM,currently_logged_in_as:WM,email:XM,email_changed_to_template:JM,email_or_phone_placeholder:YM,email_placeholder:ZM,email_validated:QM,email_validated_cta:eq,email_verification_for_signup_sent_description:tq,email_verification_for_signup_sent_title:nq,enter_a_code_btn:rq,enter_email_for_verification_description:iq,enter_new_email:sq,enter_new_password_placeholder:oq,enter_password:aq,enter_password_description:cq,enter_your_password_btn:lq,expired_code:uq,fokus_info_message:dq,forgot_password_cta:pq,forgot_password_description:fq,forgot_password_email_sent:hq,forgot_password_link:gq,forgot_password_title:mq,go_back:_q,hide_password:yq,"invalid-email":"Ugyldig e-mail",invalid_identifier:wq,invalid_password:vq,invalid_session_body:bq,invalid_session_title:xq,link_email_click_to_login:$q,link_email_login:Aq,link_email_or_enter_code:Eq,link_page_body:Sq,link_page_headline:kq,logged_in_as:Nq,login:Cq,login_description:Tq,login_description_code:Iq,login_description_combined:Oq,login_description_link:zq,login_description_phone:Dq,login_description_template:Rq,logout:Pq,no_use_another:Bq,or:jq,password:Lq,password_has_been_reset:Fq,password_has_been_reset_title:Uq,password_reset_subject:Mq,password_reset_title:qq,phone_placeholder:Vq,privacy_policy:Hq,redirecting:Kq,reenter_new_password_placeholder:Gq,register_password_account:Wq,resend_code:Xq,reset_password_cta:Jq,reset_password_description:Yq,reset_password_email_click_to_reset:Zq,reset_password_email_cta:Qq,reset_password_email_reset:eV,reset_password_subject:tV,reset_password_title:nV,send:rV,send_me_a_new_magic_link:iV,sent_code_spam:sV,set_password:oV,show_password:aV,sign_in:cV,signup:lV,signup_success:uV,sms_code_text:dV,spotify_already_linked_body:pV,spotify_already_linked_cta:fV,spotify_already_linked_step1_body:hV,spotify_already_linked_step1_title:gV,spotify_already_linked_step2_body:mV,spotify_already_linked_step2_title:_V,spotify_already_linked_title:yV,success:wV,support_info:vV,terms:bV,unexpected_error_try_again:xV,unverified_email:$V,update_email:AV,user_account_does_not_exist:EV,user_not_found:SV,user_not_found_body:kV,user_not_found_cta:NV,validate_code:CV,validate_email_body:TV,validate_email_title:IV,verify_email_click_to_verify:OV,verify_email_subject:zV,verify_email_title:DV,verify_email_verify:RV,verify_your_email:PV,we_sent_a_code_to:BV,welcome:jV,welcome_to_your_account:LV,yes_continue:FV,yes_continue_with:UV,yes_continue_with_existing_account:MV},VV=t=>{const{theme:e,branding:n,client:r,authParams:i}=t,a=`/authorize?${new URLSearchParams({...i})}`;return w(nt,{theme:e,branding:n,client:r,title:L.t("user_not_found"),children:w("div",{className:"flex flex-1 flex-col justify-center",children:[w("p",{className:"mb-8 text-gray-300 text-lg",children:L.t("user_not_found_body")}),w(tt,{Component:"a",href:a,children:L.t("user_not_found_cta")})]})})};function HV(t,e){const{mainTenantId:n,mainClientId:r}=e;return{...t,clients:{get:async i=>{const s=await t.clients.get(i);if(!s)return null;const a=r?await t.clients.get(r):void 0,l=await t.connections.list(s.tenant.id),u=n?await t.connections.list(n):{connections:[]},d=l.connections.map(p=>{var A;const h=(A=u.connections)==null?void 0:A.find($=>$.name===p.name);if(!(h!=null&&h.options))return p;const g=rn.parse({...h||{},...p});return g.options=$i.passthrough().parse({...h.options||{},...p.options}),g}).filter(p=>p);return{...s,web_origins:[...(a==null?void 0:a.web_origins)||[],...s.web_origins||[]],allowed_logout_urls:[...(a==null?void 0:a.allowed_logout_urls)||[],...s.allowed_logout_urls||[]],callbacks:[...(a==null?void 0:a.callbacks)||[],...s.callbacks||[]],connections:d,tenant:{...(a==null?void 0:a.tenant)||{},...s.tenant}}}},connections:{...t.connections,get:async(i,s)=>{const a=await t.connections.get(i,s);if(!a||!n)return a;const l=await t.connections.get(n,s);if(!l)return a;const u=rn.parse({...l,...a});return u.options=$i.passthrough().parse({...l.options||{},...a.options}),u},list:async(i,s)=>{const a=await t.connections.list(i,s);if(!n||i===n)return a;const l=await t.connections.list(n),u=a.connections.map(d=>{var g;const p=(g=l.connections)==null?void 0:g.find(A=>A.name===d.name);if(!(p!=null&&p.options))return d;const h=rn.parse({...p,...d});return h.options=$i.passthrough().parse({...p.options||{},...d.options}),h});return{...a,connections:u}}},applications:t.applications,branding:t.branding,codes:t.codes,customDomains:t.customDomains,emailProviders:t.emailProviders,forms:t.forms,hooks:t.hooks,keys:t.keys,loginSessions:t.loginSessions,logs:t.logs,passwords:t.passwords,promptSettings:t.promptSettings,refreshTokens:t.refreshTokens,resourceServers:t.resourceServers,rolePermissions:t.rolePermissions,userPermissions:t.userPermissions,roles:t.roles,sessions:t.sessions,tenants:t.tenants,themes:t.themes,users:t.users}}function KV(t,e){return HV(t,e)}L.init({supportedLngs:["en","it","nb","sv","pl","cs","fi","da"],fallbackLng:"en",resources:{en:{translation:Mk},it:{translation:wC},nb:{translation:JI},sv:{translation:kD},pl:{translation:iB},cs:{translation:RL},fi:{translation:pM},da:{translation:qV}}});function GV(t){const e=new o.OpenAPIHono;e.get("/",a=>a.json({name:"authhero"}));const n=u$(t);e.route("/api/v2",n);const r=G8(t);e.route("/u",r);const i=dS(t);e.route("/samlp",i);const s=kE(t);return e.route("/",s),{app:e,managementApp:n,oauthApp:s,samlApp:i,universalApp:r,createX509Certificate:Vd}}exports.AppLogo=fy;exports.Auth0Client=Hm;exports.AuthorizationResponseMode=En;exports.AuthorizationResponseType=nn;exports.Button=tt;exports.CheckEmailPage=Ty;exports.CodeChallengeMethod=$c;exports.ComponentCategory=pp;exports.ComponentType=dp;exports.EmailValidatedPage=zy;exports.EnterCodePage=ip;exports.EnterPasswordPage=ga;exports.ErrorMessage=er;exports.Footer=hy;exports.ForgotPasswordPage=Ny;exports.ForgotPasswordSentPage=Cy;exports.FormComponent=zn;exports.GoBack=hn;exports.GoogleLogo=_y;exports.GrantType=vi;exports.Icon=et;exports.IdentifierPage=pa;exports.InvalidSession=Oy;exports.Layout=nt;exports.LogTypes=Le;exports.Message=br;exports.NodeType=Cm;exports.PreSignUpConfirmationPage=Dy;exports.PreSignUpPage=Iy;exports.ResetPasswordPage=_i;exports.SignUpPage=Ir;exports.SocialButton=ys;exports.Spinner=my;exports.Trans=qi;exports.UnverifiedEmailPage=ky;exports.UserNotFoundPage=VV;exports.VippsLogo=yy;exports.applicationInsertSchema=ba;exports.applicationSchema=zr;exports.auth0FlowInsertSchema=qw;exports.auth0FlowSchema=Pm;exports.auth0UserResponseSchema=xn;exports.authParamsSchema=Ts;exports.baseUserSchema=bc;exports.bordersSchema=Xm;exports.brandingSchema=wu;exports.buttonComponentSchema=Am;exports.codeInsertSchema=jm;exports.codeSchema=Vw;exports.codeTypeSchema=Bm;exports.colorsSchema=Jm;exports.componentSchema=Nm;exports.connectionInsertSchema=xa;exports.connectionOptionsSchema=$i;exports.connectionSchema=rn;exports.coordinatesSchema=Gi;exports.createInMemoryCache=Ao;exports.customDomainInsertSchema=fp;exports.customDomainSchema=cr;exports.customDomainWithTenantIdSchema=Hw;exports.emailProviderSchema=ea;exports.endingSchema=Rm;exports.fieldComponentSchema=Sm;exports.flowNodeSchema=Im;exports.fontDetailsSchema=Tr;exports.fontsSchema=Ym;exports.formControlSchema=Kw;exports.formInsertSchema=Aa;exports.formNodeComponentDefinition=Fm;exports.formSchema=yi;exports.genericComponentSchema=km;exports.genericNodeSchema=Om;exports.hookInsertSchema=Yo;exports.hookSchema=wi;exports.identitySchema=bm;exports.init=GV;exports.injectTailwindCSS=U8;exports.jwksKeySchema=qm;exports.jwksSchema=hp;exports.legalComponentSchema=Em;exports.logSchema=Ea;exports.loginSessionInsertSchema=Vm;exports.loginSessionSchema=Yw;exports.nodeSchema=zm;exports.openIDConfigurationSchema=vu;exports.pageBackgroundSchema=Zm;exports.parseUserId=ov;exports.passwordInsertSchema=Km;exports.passwordSchema=Qw;exports.profileDataSchema=vm;exports.promptSettingSchema=Qo;exports.refreshTokenInsertSchema=mp;exports.refreshTokenSchema=ev;exports.resourceServerInsertSchema=Sa;exports.resourceServerListSchema=rv;exports.resourceServerOptionsSchema=n_;exports.resourceServerSchema=Dr;exports.resourceServerScopeSchema=t_;exports.richTextComponentSchema=$m;exports.roleInsertSchema=ka;exports.roleListSchema=d_;exports.rolePermissionInsertSchema=r_;exports.rolePermissionListSchema=iv;exports.rolePermissionSchema=i_;exports.rolePermissionWithDetailsListSchema=o_;exports.rolePermissionWithDetailsSchema=s_;exports.roleSchema=Rr;exports.samlpAddon=xm;exports.sessionInsertSchema=Wm;exports.sessionSchema=Ec;exports.signingKeySchema=bu;exports.smsProviderSchema=nv;exports.smsSendParamsSchema=tv;exports.startSchema=Dm;exports.stepNodeSchema=Tm;exports.tailwindCss=jf;exports.tenantInsertSchema=$a;exports.tenantSchema=Ai;exports.themeInsertSchema=e_;exports.themeSchema=Zo;exports.tokenResponseSchema=gp;exports.totalsSchema=gn;exports.userInsertSchema=va;exports.userPermissionInsertSchema=a_;exports.userPermissionListSchema=sv;exports.userPermissionSchema=c_;exports.userPermissionWithDetailsListSchema=u_;exports.userPermissionWithDetailsSchema=l_;exports.userResponseSchema=Fw;exports.userSchema=up;exports.verificationMethodsSchema=Lm;exports.widgetSchema=Qm;exports.withMainTenantFallback=KV;
312
+ Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,HF="Virheellinen linkki",KF="Kirjaudu sisään napsauttamalla painiketta",GF="Kirjaudu sisään",WF="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",XF="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",JF="Yhdistä tilisi {{service}}",YF="Olet kirjautunut sisään nimellä",ZF="Kirjaudu sisään",QF="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",eU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",tU="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",nU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",rU="Anna puhelinnumerosi kirjautuaksesi sisään",iU="Kirjoita {{authMethod}} kirjautuaksesi sisään.",sU="Kirjaudu ulos",oU="Ei, haluan käyttää toista tiliä",aU="tai",cU="Salasana",lU="Salasana on nollattu",uU="Menestys",dU="Vaihda salasana tilillesi {{vendorName}} ",pU="Vaihda salasana tilillesi {{vendorName}} ",fU="Puhelinnumero",hU="Tietosuojakäytäntö",gU="Uudelleenohjaus",mU="Vahvista salasana",_U="Rekisteröi uusi salasana",yU="Lähetä koodi uudelleen",wU="Vaihda salasana",vU="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",bU="Napsauta painiketta salasanasi palauttamiseksi",xU="Napsauta painiketta salasanasi palauttamiseksi",$U="Nollaa salasanasi",AU="Vaihda salasana tilillesi {{vendorName}} ",EU="Nollaa salasana",SU="Lähetä",kU="Lähetä minulle uusi maaginen linkki",NU="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",CU="Aseta salasana",TU="Näytä salasana",IU="Kirjaudu sisään",OU="Rekisteröityminen",zU="Rekisteröidy onnistuneesti",DU="{{code}} on kirjautumiskoodisi {{vendorName}}",RU="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.",PU="Siirry Spotifyn Content Access -sivulle",BU='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ä.',jU="Vaihe 1: Poista Spotify-tilisi linkitys",LU="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",FU="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",UU="Hups! Spotify-tilisi on jo linkitetty",MU="Valmis",qU="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",VU="Ehdot ja edellytykset",HU="Jokin meni pieleen. Yritä uudelleen.",KU="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",GU="Päivitä sähköposti",WU="Käyttäjätiliä ei ole olemassa",XU="Käyttäjätiliä ei ole olemassa",JU="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",YU="Yritä uudelleen.",ZU="Validoi koodi",QU="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",eM="Rekisteröitynyt",tM="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",nM="Vahvista sähköpostiosoitteesi",rM="Vahvista sähköpostiosoitteesi",iM="Vahvista tili",sM="Vahvista sähköpostiosoitteesi",oM="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",aM="Tervetuloa",cM="Tervetuloa tilillesi {{vendorName}}!",lM="Jatka tällä tilillä",uM="Kyllä, jatka {{text}}",dM="Kyllä, jatka olemassa olevalla tilillä",pM={"Server error: Invalid code":"Virheellinen koodi",account_detected:PL,account_title:BL,account_with_sso_provider:jL,agree_to:LL,and:FL,auth_method_email:UL,auth_method_email_or_phone:ML,auth_method_phone:qL,callback_url_mismatch:VL,callback_url_not_allowed:HL,check_email_title:KL,click_to_sign_up_description:GL,code_email_enter_code:WL,code_email_subject:XL,code_email_title:JL,code_expired:YL,code_invalid:ZL,code_sent_template:QL,code_used:eF,code_valid_30_minutes:tF,confirm_password:nF,contact_support:rF,contact_us:iF,continue:"Jatka",continue_social_login:sF,continue_with:oF,continue_with_sso_provider_headline:aF,copyright:cF,copyright_sesamy:lF,create_account_description:uF,create_account_email_invalid:dF,create_account_passwords_didnt_match:pF,create_account_title:fF,create_account_weak_password:hF,create_new_account_link:gF,create_password_account_title:mF,currently_logged_in_as:_F,email:yF,email_changed_to_template:wF,email_or_phone_placeholder:vF,email_placeholder:bF,email_validated:xF,email_validated_cta:$F,email_verification_for_signup_sent_description:AF,email_verification_for_signup_sent_title:EF,enter_a_code_btn:SF,enter_email_for_verification_description:kF,enter_new_email:NF,enter_new_password_placeholder:CF,enter_password:TF,enter_password_description:IF,enter_your_password_btn:OF,expired_code:zF,fokus_info_message:DF,forgot_password_cta:RF,forgot_password_description:PF,forgot_password_email_sent:BF,forgot_password_link:jF,forgot_password_title:LF,go_back:FF,hide_password:UF,"invalid-email":"Virheellinen sähköpostiosoite",invalid_identifier:MF,invalid_password:qF,invalid_session_body:VF,invalid_session_title:HF,link_email_click_to_login:KF,link_email_login:GF,link_email_or_enter_code:WF,link_page_body:XF,link_page_headline:JF,logged_in_as:YF,login:ZF,login_description:QF,login_description_code:eU,login_description_combined:tU,login_description_link:nU,login_description_phone:rU,login_description_template:iU,logout:sU,no_use_another:oU,or:aU,password:cU,password_has_been_reset:lU,password_has_been_reset_title:uU,password_reset_subject:dU,password_reset_title:pU,phone_placeholder:fU,privacy_policy:hU,redirecting:gU,reenter_new_password_placeholder:mU,register_password_account:_U,resend_code:yU,reset_password_cta:wU,reset_password_description:vU,reset_password_email_click_to_reset:bU,reset_password_email_cta:xU,reset_password_email_reset:$U,reset_password_subject:AU,reset_password_title:EU,send:SU,send_me_a_new_magic_link:kU,sent_code_spam:NU,set_password:CU,show_password:TU,sign_in:IU,signup:OU,signup_success:zU,sms_code_text:DU,spotify_already_linked_body:RU,spotify_already_linked_cta:PU,spotify_already_linked_step1_body:BU,spotify_already_linked_step1_title:jU,spotify_already_linked_step2_body:LU,spotify_already_linked_step2_title:FU,spotify_already_linked_title:UU,success:MU,support_info:qU,terms:VU,unexpected_error_try_again:HU,unverified_email:KU,update_email:GU,user_account_does_not_exist:WU,user_not_found:XU,user_not_found_body:JU,user_not_found_cta:YU,validate_code:ZU,validate_email_body:QU,validate_email_title:eM,verify_email_click_to_verify:tM,verify_email_subject:nM,verify_email_title:rM,verify_email_verify:iM,verify_your_email:sM,we_sent_a_code_to:oM,welcome:aM,welcome_to_your_account:cM,yes_continue:lM,yes_continue_with:uM,yes_continue_with_existing_account:dM},fM="Konto opdaget",hM="Konto",gM="Vi har opdaget, at du allerede har oprettet en konto gennem",mM="Når du logger ind, accepterer du vores",_M="og",yM="e-mail-adresse",wM="e-mail eller telefonnummer",vM="Telefonnummer",bM="Uoverensstemmelse mellem URL og tilbagekald",xM="Den angivne redirect_uri er ikke på listen over tilladte tilbagekalds-URL'er.",$M="Fortsæt med brugeren",AM="Klik på knappen for at oprette en ny adgangskodekonto.",EM="Indtast koden på {{vendorName}} for at gennemføre login.",SM="Velkommen til {{vendorName}}! {{code}} er login-koden",kM="Velkommen til {{vendorName}}! {{code}} er login-koden",NM="Koden er udløbet",CM="Ugyldig kode",TM="Tjek venligst <0>{{username}}</0> og indtast den sekscifrede kode, som vi har sendt til dig.",IM="Koden er allerede brugt",OM="Koden er gyldig i 30 minutter",zM="Bekræft adgangskode",DM="Har du brug for hjælp?",RM="Kontakt os",PM="eller fortsæt med social konto",BM="Fortsæt med {{provider}}",jM="Vil du gerne fortsætte med din eksisterende konto?",LM="Ophavsret © 2023 SESAMY. Alle rettigheder forbeholdes.",FM="©2023 Sesamy",UM="Vælg en adgangskode med en blanding af store og små bogstaver, tal og symboler.",MM="Indtast venligst en gyldig e-mailadresse.",qM="Adgangskoderne stemte ikke overens. Prøv igen.",VM="Vælg adgangskode",HM="Adgangskoden skal være mindst 8 tegn lang og indeholde mindst et lille bogstav, et stort bogstav, et tal og et symbol.",KM="Opret ny konto",GM="Tilmeld dig med adgangskode",WM="Du er i øjeblikket logget ind som <0>{{email}}</0>",XM="E-mail",JM="E-mail ændret til <0>{{email}}</0> ",YM="E-mail eller telefonnummer",ZM="E-mail-adresse",QM="Din e-mailadresse er blevet valideret",eq="Indtast nu din adgangskode for at logge ind igen",tq="Der er sendt en e-mail til <0>{{email}}</0> med et bekræftelseslink. Klik på linket for at bekræfte din e-mailadresse og angive en adgangskode.",nq="E-mail-bekræftelse sendt",rq="Indtast en kode",iq="Vi sender dig et bekræftelseslink for at sikre, at du ejer denne e-mailadresse.",sq="Indtast ny e-mail",oq="Indtast ny adgangskode",aq="Indtast adgangskode",cq="Indtast din e-mailadresse og adgangskode for at logge ind.",lq="Indtast din adgangskode",uq="Det magiske link er udløbet. Klik på knappen nedenfor for at modtage et nyt link i din indbakke.",dq="Hej! Vi har opdateret vores login-oplevelse. <0>Klik her for at lære mere om det.</0>",pq="Send e-mail til nulstilling af adgangskode",fq="Klik på knappen nedenfor, så sender vi instruktioner om, hvordan du nulstiller din adgangskode.",hq="E-mail til nulstilling af adgangskode sendt",gq="Har du glemt din adgangskode?",mq="Har du glemt din adgangskode?",_q="Gå tilbage",yq="Skjul adgangskode",wq="Ugyldig identifikator",vq="Ugyldig adgangskode",bq="Linket er ikke længere gyldigt. Sørg for at åbne login-linket i den samme browser, som du startede login med. Du kan klikke på linket nedenfor for at starte et nyt login.",xq="Ugyldigt link",$q="Klik på knappen for at logge ind",Aq="Login",Eq="Eller indtast koden på {{vendorName}} for at gennemføre login.",Sq="Indtast din e-mailadresse for at låse op for dette show på {{service}}",kq="Forbind din konto med {{service}}",Nq="Du er logget ind som",Cq="Login",Tq="Indtast din e-mailadresse for at logge ind.",Iq="Indtast din e-mailadresse, så sender vi dig en login-kode.",Oq="Indtast din e-mail eller dit telefonnummer for at logge ind",zq="Indtast din e-mailadresse, så sender vi dig et login-link.",Dq="Indtast dit telefonnummer for at logge ind",Rq="Indtast din {{authMethod}} for at logge ind.",Pq="Log ud",Bq="Nej, jeg vil bruge en anden konto",jq="eller",Lq="Adgangskode",Fq="Adgangskoden er blevet nulstillet",Uq="Succes",Mq="Skift adgangskode til din {{vendorName}} -konto",qq="Skift adgangskode til din {{vendorName}} -konto",Vq="Telefonnummer",Hq="Politik for beskyttelse af personlige oplysninger",Kq="Omdirigering",Gq="Bekræft adgangskode",Wq="Registrer en ny adgangskode",Xq="Send koden igen",Jq="Skift adgangskode",Yq="Indtast din nye adgangskode til e-mailkontoen nedenfor: ",Zq="Klik på knappen for at nulstille din adgangskode",Qq="Klik på knappen for at nulstille din adgangskode",eV="Nulstil din adgangskode",tV="Skift adgangskode til din {{vendorName}} -konto",nV="Nulstil adgangskode",rV="Send",iV="Send mig et nyt magisk link",sV="Husk at tjekke din spam-mappe, hvis e-mailen ikke er kommet frem.",oV="Indstil adgangskode",aV="Vis adgangskode",cV="Log ind",lV="Tilmelding",uV="Tilmeld dig med succes",dV="{{code}} er din login-kode til {{vendorName}}",pV="Det ser ud til, at din Spotify-konto i øjeblikket er knyttet til en anden Sesamy-konto. Men frygt ikke, vi er her for at guide dig gennem processen med at få det løst.",fV="Gå til Spotifys side for adgang til indhold",hV='Lad os starte med at fjerne forbindelsen til din Spotify-konto. Klik på knappen nedenfor for at gå til Spotifys Content Access-side. Når du har logget ind på din Spotify-konto, skal du finde Sesamy på listen over tilsluttede platforme. Klik på "Unlink" ved siden af Sesamy-logoet.',gV="Trin 1: Fjern forbindelsen til din Spotify-konto",mV="Når du har afkoblet din Spotify-konto, kan du koble den til Sesamy igen. Du skal blot gentage de trin, du tidligere har taget, og som førte dig til denne side.",_V="Trin 2: Relink din Spotify-konto til Sesamy",yV="Ups! Din Spotify-konto er allerede forbundet",wV="Færdig",vV="Hvis du har spørgsmål eller brug for hjælp, kan du kontakte vores supportteam",bV="Vilkår og betingelser",xV="Noget gik galt. Prøv venligst igen.",$V="Din e-mailadresse skal valideres. Vi har sendt en ny e-mail til din indbakke",AV="Opdatering af e-mail",EV="Brugerkontoen findes ikke",SV="Brugerkontoen findes ikke",kV="Vi kunne ikke finde en bruger med den angivne e-mailadresse. Prøv venligst igen.",NV="Prøv igen.",CV="Valider koden",TV="Tjek din indbakke for instruktioner om validering af e-mail.",IV="Tilmeldte sig",OV="Klik på knappen for at bekræfte din e-mailadresse",zV="Bekræft din e-mailadresse",DV="Bekræft din e-mailadresse",RV="Bekræft konto",PV="Bekræft din e-mail",BV="Tjek venligst din e-mail på <0>{{email}}</0> og indtast den sekscifrede kode, vi har sendt dig.",jV="Velkommen",LV="Velkommen til din {{vendorName}} konto!",FV="Fortsæt med denne konto",UV="Ja, fortsæt med {{text}}",MV="Ja, fortsæt med eksisterende konto",qV={"Server error: Invalid code":"Ugyldig kode",account_detected:fM,account_title:hM,account_with_sso_provider:gM,agree_to:mM,and:_M,auth_method_email:yM,auth_method_email_or_phone:wM,auth_method_phone:vM,callback_url_mismatch:bM,callback_url_not_allowed:xM,check_email_title:$M,click_to_sign_up_description:AM,code_email_enter_code:EM,code_email_subject:SM,code_email_title:kM,code_expired:NM,code_invalid:CM,code_sent_template:TM,code_used:IM,code_valid_30_minutes:OM,confirm_password:zM,contact_support:DM,contact_us:RM,continue:"Fortsæt",continue_social_login:PM,continue_with:BM,continue_with_sso_provider_headline:jM,copyright:LM,copyright_sesamy:FM,create_account_description:UM,create_account_email_invalid:MM,create_account_passwords_didnt_match:qM,create_account_title:VM,create_account_weak_password:HM,create_new_account_link:KM,create_password_account_title:GM,currently_logged_in_as:WM,email:XM,email_changed_to_template:JM,email_or_phone_placeholder:YM,email_placeholder:ZM,email_validated:QM,email_validated_cta:eq,email_verification_for_signup_sent_description:tq,email_verification_for_signup_sent_title:nq,enter_a_code_btn:rq,enter_email_for_verification_description:iq,enter_new_email:sq,enter_new_password_placeholder:oq,enter_password:aq,enter_password_description:cq,enter_your_password_btn:lq,expired_code:uq,fokus_info_message:dq,forgot_password_cta:pq,forgot_password_description:fq,forgot_password_email_sent:hq,forgot_password_link:gq,forgot_password_title:mq,go_back:_q,hide_password:yq,"invalid-email":"Ugyldig e-mail",invalid_identifier:wq,invalid_password:vq,invalid_session_body:bq,invalid_session_title:xq,link_email_click_to_login:$q,link_email_login:Aq,link_email_or_enter_code:Eq,link_page_body:Sq,link_page_headline:kq,logged_in_as:Nq,login:Cq,login_description:Tq,login_description_code:Iq,login_description_combined:Oq,login_description_link:zq,login_description_phone:Dq,login_description_template:Rq,logout:Pq,no_use_another:Bq,or:jq,password:Lq,password_has_been_reset:Fq,password_has_been_reset_title:Uq,password_reset_subject:Mq,password_reset_title:qq,phone_placeholder:Vq,privacy_policy:Hq,redirecting:Kq,reenter_new_password_placeholder:Gq,register_password_account:Wq,resend_code:Xq,reset_password_cta:Jq,reset_password_description:Yq,reset_password_email_click_to_reset:Zq,reset_password_email_cta:Qq,reset_password_email_reset:eV,reset_password_subject:tV,reset_password_title:nV,send:rV,send_me_a_new_magic_link:iV,sent_code_spam:sV,set_password:oV,show_password:aV,sign_in:cV,signup:lV,signup_success:uV,sms_code_text:dV,spotify_already_linked_body:pV,spotify_already_linked_cta:fV,spotify_already_linked_step1_body:hV,spotify_already_linked_step1_title:gV,spotify_already_linked_step2_body:mV,spotify_already_linked_step2_title:_V,spotify_already_linked_title:yV,success:wV,support_info:vV,terms:bV,unexpected_error_try_again:xV,unverified_email:$V,update_email:AV,user_account_does_not_exist:EV,user_not_found:SV,user_not_found_body:kV,user_not_found_cta:NV,validate_code:CV,validate_email_body:TV,validate_email_title:IV,verify_email_click_to_verify:OV,verify_email_subject:zV,verify_email_title:DV,verify_email_verify:RV,verify_your_email:PV,we_sent_a_code_to:BV,welcome:jV,welcome_to_your_account:LV,yes_continue:FV,yes_continue_with:UV,yes_continue_with_existing_account:MV},VV=t=>{const{theme:e,branding:n,client:r,authParams:i}=t,a=`/authorize?${new URLSearchParams({...i})}`;return w(nt,{theme:e,branding:n,client:r,title:L.t("user_not_found"),children:w("div",{className:"flex flex-1 flex-col justify-center",children:[w("p",{className:"mb-8 text-gray-300 text-lg",children:L.t("user_not_found_body")}),w(tt,{Component:"a",href:a,children:L.t("user_not_found_cta")})]})})};function HV(t,e){const{mainTenantId:n,mainClientId:r}=e;return{...t,clients:{get:async i=>{const s=await t.clients.get(i);if(!s)return null;const a=r?await t.clients.get(r):void 0,l=await t.connections.list(s.tenant.id),u=n?await t.connections.list(n):{connections:[]},d=l.connections.map(p=>{var A;const h=(A=u.connections)==null?void 0:A.find($=>$.name===p.name);if(!(h!=null&&h.options))return p;const g=rn.parse({...h||{},...p});return g.options=$i.passthrough().parse({...h.options||{},...p.options}),g}).filter(p=>p);return{...s,web_origins:[...(a==null?void 0:a.web_origins)||[],...s.web_origins||[]],allowed_logout_urls:[...(a==null?void 0:a.allowed_logout_urls)||[],...s.allowed_logout_urls||[]],callbacks:[...(a==null?void 0:a.callbacks)||[],...s.callbacks||[]],connections:d,tenant:{...(a==null?void 0:a.tenant)||{},...s.tenant}}}},connections:{...t.connections,get:async(i,s)=>{const a=await t.connections.get(i,s);if(!a||!n)return a;const l=await t.connections.get(n,s);if(!l)return a;const u=rn.parse({...l,...a});return u.options=$i.passthrough().parse({...l.options||{},...a.options}),u},list:async(i,s)=>{const a=await t.connections.list(i,s);if(!n||i===n)return a;const l=await t.connections.list(n),u=a.connections.map(d=>{var g;const p=(g=l.connections)==null?void 0:g.find(A=>A.name===d.name);if(!(p!=null&&p.options))return d;const h=rn.parse({...p,...d});return h.options=$i.passthrough().parse({...p.options||{},...d.options}),h});return{...a,connections:u}}}}}function KV(t,e){return HV(t,e)}L.init({supportedLngs:["en","it","nb","sv","pl","cs","fi","da"],fallbackLng:"en",resources:{en:{translation:Mk},it:{translation:wC},nb:{translation:JI},sv:{translation:kD},pl:{translation:iB},cs:{translation:RL},fi:{translation:pM},da:{translation:qV}}});function GV(t){const e=new o.OpenAPIHono;e.get("/",a=>a.json({name:"authhero"}));const n=u$(t);e.route("/api/v2",n);const r=G8(t);e.route("/u",r);const i=dS(t);e.route("/samlp",i);const s=kE(t);return e.route("/",s),{app:e,managementApp:n,oauthApp:s,samlApp:i,universalApp:r,createX509Certificate:Vd}}exports.AppLogo=fy;exports.Auth0Client=Hm;exports.AuthorizationResponseMode=En;exports.AuthorizationResponseType=nn;exports.Button=tt;exports.CheckEmailPage=Ty;exports.CodeChallengeMethod=$c;exports.ComponentCategory=pp;exports.ComponentType=dp;exports.EmailValidatedPage=zy;exports.EnterCodePage=ip;exports.EnterPasswordPage=ga;exports.ErrorMessage=er;exports.Footer=hy;exports.ForgotPasswordPage=Ny;exports.ForgotPasswordSentPage=Cy;exports.FormComponent=zn;exports.GoBack=hn;exports.GoogleLogo=_y;exports.GrantType=vi;exports.Icon=et;exports.IdentifierPage=pa;exports.InvalidSession=Oy;exports.Layout=nt;exports.LogTypes=Le;exports.Message=br;exports.NodeType=Cm;exports.PreSignUpConfirmationPage=Dy;exports.PreSignUpPage=Iy;exports.ResetPasswordPage=_i;exports.SignUpPage=Ir;exports.SocialButton=ys;exports.Spinner=my;exports.Trans=qi;exports.UnverifiedEmailPage=ky;exports.UserNotFoundPage=VV;exports.VippsLogo=yy;exports.applicationInsertSchema=ba;exports.applicationSchema=zr;exports.auth0FlowInsertSchema=qw;exports.auth0FlowSchema=Pm;exports.auth0UserResponseSchema=xn;exports.authParamsSchema=Ts;exports.baseUserSchema=bc;exports.bordersSchema=Xm;exports.brandingSchema=wu;exports.buttonComponentSchema=Am;exports.codeInsertSchema=jm;exports.codeSchema=Vw;exports.codeTypeSchema=Bm;exports.colorsSchema=Jm;exports.componentSchema=Nm;exports.connectionInsertSchema=xa;exports.connectionOptionsSchema=$i;exports.connectionSchema=rn;exports.coordinatesSchema=Gi;exports.createInMemoryCache=Ao;exports.customDomainInsertSchema=fp;exports.customDomainSchema=cr;exports.customDomainWithTenantIdSchema=Hw;exports.emailProviderSchema=ea;exports.endingSchema=Rm;exports.fieldComponentSchema=Sm;exports.flowNodeSchema=Im;exports.fontDetailsSchema=Tr;exports.fontsSchema=Ym;exports.formControlSchema=Kw;exports.formInsertSchema=Aa;exports.formNodeComponentDefinition=Fm;exports.formSchema=yi;exports.genericComponentSchema=km;exports.genericNodeSchema=Om;exports.hookInsertSchema=Yo;exports.hookSchema=wi;exports.identitySchema=bm;exports.init=GV;exports.injectTailwindCSS=U8;exports.jwksKeySchema=qm;exports.jwksSchema=hp;exports.legalComponentSchema=Em;exports.logSchema=Ea;exports.loginSessionInsertSchema=Vm;exports.loginSessionSchema=Yw;exports.nodeSchema=zm;exports.openIDConfigurationSchema=vu;exports.pageBackgroundSchema=Zm;exports.parseUserId=ov;exports.passwordInsertSchema=Km;exports.passwordSchema=Qw;exports.profileDataSchema=vm;exports.promptSettingSchema=Qo;exports.refreshTokenInsertSchema=mp;exports.refreshTokenSchema=ev;exports.resourceServerInsertSchema=Sa;exports.resourceServerListSchema=rv;exports.resourceServerOptionsSchema=n_;exports.resourceServerSchema=Dr;exports.resourceServerScopeSchema=t_;exports.richTextComponentSchema=$m;exports.roleInsertSchema=ka;exports.roleListSchema=d_;exports.rolePermissionInsertSchema=r_;exports.rolePermissionListSchema=iv;exports.rolePermissionSchema=i_;exports.rolePermissionWithDetailsListSchema=o_;exports.rolePermissionWithDetailsSchema=s_;exports.roleSchema=Rr;exports.samlpAddon=xm;exports.sessionInsertSchema=Wm;exports.sessionSchema=Ec;exports.signingKeySchema=bu;exports.smsProviderSchema=nv;exports.smsSendParamsSchema=tv;exports.startSchema=Dm;exports.stepNodeSchema=Tm;exports.tailwindCss=jf;exports.tenantInsertSchema=$a;exports.tenantSchema=Ai;exports.themeInsertSchema=e_;exports.themeSchema=Zo;exports.tokenResponseSchema=gp;exports.totalsSchema=gn;exports.userInsertSchema=va;exports.userPermissionInsertSchema=a_;exports.userPermissionListSchema=sv;exports.userPermissionSchema=c_;exports.userPermissionWithDetailsListSchema=u_;exports.userPermissionWithDetailsSchema=l_;exports.userResponseSchema=Fw;exports.userSchema=up;exports.verificationMethodsSchema=Lm;exports.widgetSchema=Qm;exports.withMainTenantFallback=KV;