authhero 0.169.0 → 0.171.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,14 +1,14 @@
1
- "use strict";var Oy=Object.defineProperty;var zy=(t,e,n)=>e in t?Oy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xe=(t,e,n)=>zy(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@hono/zod-openapi"),ke=t=>typeof t=="string",io=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},Tf=t=>t==null?"":""+t,Dy=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},Ry=/###/g,Of=t=>t&&t.indexOf("###")>-1?t.replace(Ry,"."):t,zf=t=>!t||ke(t),go=(t,e,n)=>{const r=ke(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(zf(t))return{};const o=Of(r[i]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++i}return zf(t)?{}:{obj:t,k:Of(r[i])}},Df=(t,e,n)=>{const{obj:r,k:i}=go(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let o=e[e.length-1],c=e.slice(0,e.length-1),l=go(t,c,Object);for(;l.obj===void 0&&c.length;)o=`${c[c.length-1]}.${o}`,c=c.slice(0,c.length-1),l=go(t,c,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},Py=(t,e,n,r)=>{const{obj:i,k:o}=go(t,e,Object);i[o]=i[o]||[],i[o].push(n)},ra=(t,e)=>{const{obj:n,k:r}=go(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},By=(t,e,n)=>{const r=ra(t,n);return r!==void 0?r:ra(e,n)},Jg=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?ke(t[r])||t[r]instanceof String||ke(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):Jg(t[r],e[r],n):t[r]=e[r]);return t},si=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var jy={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Ly=t=>ke(t)?t.replace(/[&<>"'\/]/g,e=>jy[e]):t;class Fy{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 Uy=[" ",",","?","!",";"],My=new Fy(20),qy=(t,e,n)=>{e=e||"",n=n||"";const r=Uy.filter(c=>e.indexOf(c)<0&&n.indexOf(c)<0);if(r.length===0)return!0;const i=My.getRegExp(`(${r.map(c=>c==="?"?"\\?":c).join("|")})`);let o=!i.test(t);if(!o){const c=t.indexOf(n);c>0&&!i.test(t.substring(0,c))&&(o=!0)}return o},nu=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let i=t;for(let o=0;o<r.length;){if(!i||typeof i!="object")return;let c,l="";for(let u=o;u<r.length;++u)if(u!==o&&(l+=n),l+=r[u],c=i[l],c!==void 0){if(["string","number","boolean"].indexOf(typeof c)>-1&&u<r.length-1)continue;o+=u-o+1;break}i=c}return i},ia=t=>t==null?void 0:t.replace("_","-"),Vy={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 oa{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||Vy,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:(ke(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oa(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new oa(this.logger,e)}}var yn=new oa;class oc{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(c=>{let[l,u]=c;for(let d=0;d<u;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(c=>{let[l,u]=c;for(let d=0;d<u;d++)l.apply(l,[e,...r])})}}class Rf extends oc{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,f;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=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):ke(r)&&o?l.push(...r.split(o)):l.push(r)));const u=ra(this.data,l);return!u&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),u||!c||!ke(r)?u:nu((f=(d=this.data)==null?void 0:d[e])==null?void 0:f[n],r,o)}addResource(e,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let l=[e,n];r&&(l=l.concat(c?r.split(c):r)),e.indexOf(".")>-1&&(l=e.split("."),i=n,n=l[1]),this.addNamespaces(n),Df(this.data,l,i),o.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(ke(r[o])||Array.isArray(r[o]))&&this.addResource(e,n,o,r[o],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,o){let c=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=ra(this.data,l)||{};c.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?Jg(u,r,o):u={...u,...r},Df(this.data,l,u),c.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 Yg={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(o=>{var c;e=((c=this.processors[o])==null?void 0:c.process(e,n,r,i))??e}),e}};const Pf={};class sa extends oc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Dy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=yn.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return(r==null?void 0:r.res)!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const c=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!qy(e,r,i);if(c&&!l){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:ke(o)?[o]:o};const d=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(d[0])>-1)&&(o=d.shift()),e=d.join(i)}return{key:e,namespaces:ke(o)?[o]:o}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:c,namespaces:l}=this.extractFromKey(e[e.length-1],n),u=l[l.length-1],d=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(f){const q=n.nsSeparator||this.options.nsSeparator;return i?{res:`${u}${q}${c}`,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${q}${c}`}return i?{res:c,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:c}const h=this.resolve(e,n);let _=h==null?void 0:h.res;const $=(h==null?void 0:h.usedKey)||c,m=(h==null?void 0:h.exactUsedKey)||c,x=Object.prototype.toString.apply(_),S=["[object Number]","[object Function]","[object RegExp]"],k=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,O=!ke(_)&&typeof _!="boolean"&&typeof _!="number";if(v&&_&&O&&S.indexOf(x)<0&&!(ke(k)&&Array.isArray(_))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const q=this.options.returnedObjectHandler?this.options.returnedObjectHandler($,_,{...n,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(h.res=q,h.usedParams=this.getUsedParamsDetails(n),h):q}if(o){const q=Array.isArray(_),F=q?[]:{},H=q?m:$;for(const W in _)if(Object.prototype.hasOwnProperty.call(_,W)){const J=`${H}${o}${W}`;F[W]=this.translate(J,{...n,joinArrays:!1,ns:l}),F[W]===J&&(F[W]=_[W])}_=F}}else if(v&&ke(k)&&Array.isArray(_))_=_.join(k),_&&(_=this.extendTranslation(_,e,n,r));else{let q=!1,F=!1;const H=n.count!==void 0&&!ke(n.count),W=sa.hasDefaultValue(n),J=H?this.pluralResolver.getSuffix(d,n.count,n):"",ue=n.ordinal&&H?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",Ne=H&&!n.ordinal&&n.count===0,B=Ne&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${J}`]||n[`defaultValue${ue}`]||n.defaultValue;!this.isValidLookup(_)&&W&&(q=!0,_=B),this.isValidLookup(_)||(F=!0,_=c);const R=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&F?void 0:_,I=W&&B!==_&&this.options.updateMissing;if(F||q||I){if(this.logger.log(I?"updateKey":"missingKey",d,u,c,I?B:_),o){const de=this.resolve(c,{...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 C=[];const j=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&j&&j[0])for(let de=0;de<j.length;de++)C.push(j[de]);else this.options.saveMissingTo==="all"?C=this.languageUtils.toResolveHierarchy(n.lng||this.language):C.push(n.lng||this.language);const V=(de,ne,ve)=>{var Z;const Ee=W&&ve!==_?ve:R;this.options.missingKeyHandler?this.options.missingKeyHandler(de,u,ne,Ee,I,n):(Z=this.backendConnector)!=null&&Z.saveMissing&&this.backendConnector.saveMissing(de,u,ne,Ee,I,n),this.emit("missingKey",de,u,ne,_)};this.options.saveMissing&&(this.options.saveMissingPlurals&&H?C.forEach(de=>{const ne=this.pluralResolver.getSuffixes(de,n);Ne&&n[`defaultValue${this.options.pluralSeparator}zero`]&&ne.indexOf(`${this.options.pluralSeparator}zero`)<0&&ne.push(`${this.options.pluralSeparator}zero`),ne.forEach(ve=>{V([de],c+ve,n[`defaultValue${ve}`]||B)})}):V(C,c,B))}_=this.extendTranslation(_,e,n,h,r),F&&_===c&&this.options.appendNamespaceToMissingKey&&(_=`${u}:${c}`),(F||q)&&this.options.parseMissingKeyHandler&&(_=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${c}`:c,q?_:void 0))}return i?(h.res=_,h.usedParams=this.getUsedParamsDetails(n),h):_}extendTranslation(e,n,r,i,o){var d,f;var c=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=ke(e)&&(((f=r==null?void 0:r.interpolation)==null?void 0:f.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let _;if(h){const m=e.match(this.interpolator.nestingRegexp);_=m&&m.length}let $=r.replace&&!ke(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&($={...this.options.interpolation.defaultVariables,...$}),e=this.interpolator.interpolate(e,$,r.lng||this.language||i.usedLng,r),h){const m=e.match(this.interpolator.nestingRegexp),x=m&&m.length;_<x&&(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 m=arguments.length,x=new Array(m),S=0;S<m;S++)x[S]=arguments[S];return(o==null?void 0:o[0])===x[0]&&!r.context?(c.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${n[0]}`),null):c.translate(...x,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=ke(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=Yg.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,o,c,l;return ke(e)&&(e=[e]),e.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),f=d.key;i=f;let h=d.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const _=n.count!==void 0&&!ke(n.count),$=_&&!n.ordinal&&n.count===0,m=n.context!==void 0&&(ke(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(S=>{var k,v;this.isValidLookup(r)||(l=S,!Pf[`${x[0]}-${S}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((v=this.utils)!=null&&v.hasLoadedNamespace(l))&&(Pf[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${x.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!!!")),x.forEach(O=>{var H;if(this.isValidLookup(r))return;c=O;const q=[f];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(q,f,O,S,n);else{let W;_&&(W=this.pluralResolver.getSuffix(O,n.count,n));const J=`${this.options.pluralSeparator}zero`,ue=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(_&&(q.push(f+W),n.ordinal&&W.indexOf(ue)===0&&q.push(f+W.replace(ue,this.options.pluralSeparator)),$&&q.push(f+J)),m){const Ne=`${f}${this.options.contextSeparator}${n.context}`;q.push(Ne),_&&(q.push(Ne+W),n.ordinal&&W.indexOf(ue)===0&&q.push(Ne+W.replace(ue,this.options.pluralSeparator)),$&&q.push(Ne+J))}}let F;for(;F=q.pop();)this.isValidLookup(r)||(o=F,r=this.getResource(O,S,F,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:c,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){var o;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!ke(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const o of n)delete i[o]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class Bf{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=yn.create("languageUtils")}getScriptPartFromCode(e){if(e=ia(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=ia(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ke(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&(o.indexOf("-")>0&&i.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===i||o.indexOf(i)===0&&i.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ke(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return ke(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):ke(e)&&o(this.formatLanguageCode(e)),r.forEach(c=>{i.indexOf(c)<0&&o(this.formatLanguageCode(c))}),i}}const jf={zero:0,one:1,two:2,few:3,many:4,other:5},Lf={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Hy{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=yn.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=ia(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let c;try{c=new Intl.PluralRules(r,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Lf;if(!e.match(/-|_/))return Lf;const u=this.languageUtils.getLanguagePartFromCode(e);c=this.getRule(u,n)}return this.pluralRulesCache[o]=c,c}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((i,o)=>jf[i]-jf[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const Ff=function(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=By(t,e,n);return!o&&i&&ke(n)&&(o=nu(t,n,r),o===void 0&&(o=nu(e,n,r))),o},kl=t=>t.replace(/\$/g,"$$$$");class Ky{constructor(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=yn.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(r=>r),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:o,prefixEscaped:c,suffix:l,suffixEscaped:u,formatSeparator:d,unescapeSuffix:f,unescapePrefix:h,nestingPrefix:_,nestingPrefixEscaped:$,nestingSuffix:m,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:k,alwaysFormat:v}=e.interpolation;this.escape=n!==void 0?n:Ly,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?si(o):c||"{{",this.suffix=l?si(l):u||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=_?si(_):$||si("$t("),this.nestingSuffix=m?si(m):x||si(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=k||1e3,this.alwaysFormat=v!==void 0?v:!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 $;let o,c,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=m=>{if(m.indexOf(this.formatSeparator)<0){const v=Ff(n,u,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:m}):v}const x=m.split(this.formatSeparator),S=x.shift().trim(),k=x.join(this.formatSeparator).trim();return this.format(Ff(n,u,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...i,...n,interpolationkey:S})};this.resetRegExp();const f=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=(($=i==null?void 0:i.interpolation)==null?void 0:$.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>kl(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?kl(this.escape(m)):kl(m)}].forEach(m=>{for(l=0;o=m.regex.exec(e);){const x=o[1].trim();if(c=d(x),c===void 0)if(typeof f=="function"){const k=f(e,o,i);c=ke(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,x))c="";else if(h){c=o[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),c="";else!ke(c)&&!this.useRawValueToEscape&&(c=Tf(c));const S=m.safeValue(c);if(e=e.replace(o[0],S),h?(m.regex.lastIndex+=c.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,c;const l=(u,d)=>{const f=this.nestingOptionsSeparator;if(u.indexOf(f)<0)return u;const h=u.split(new RegExp(`${f}[ ]*{`));let _=`{${h[1]}`;u=h[0],_=this.interpolate(_,c);const $=_.match(/'/g),m=_.match(/"/g);((($==null?void 0:$.length)??0)%2===0&&!m||m.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),d&&(c={...d,...c})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,x),`${u}${f}${_}`}return c.defaultValue&&c.defaultValue.indexOf(this.prefix)>-1&&delete c.defaultValue,u};for(;i=this.nestingRegexp.exec(e);){let u=[];c={...r},c=c.replace&&!ke(c.replace)?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;let d=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const f=i[1].split(this.formatSeparator).map(h=>h.trim());i[1]=f.shift(),u=f,d=!0}if(o=n(l.call(this,i[1].trim(),c),c),o&&i[0]===e&&!ke(o))return o;ke(o)||(o=Tf(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),d&&(o=u.reduce((f,h)=>this.format(f,h,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const Gy=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(c=>{if(c){const[l,...u]=c.split(":"),d=u.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},ai=t=>{const e={};return(n,r,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const c=r+JSON.stringify(o);let l=e[c];return l||(l=t(ia(r),i),e[c]=l),l(n)}};class Wy{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=yn.create("formatter"),this.options=e,this.formats={number:ai((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:ai((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:ai((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:ai((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:ai((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(e)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=ai(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(l=>l.indexOf(")")>-1)){const l=o.findIndex(u=>u.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,l)].join(this.formatSeparator)}return o.reduce((l,u)=>{var h;const{formatName:d,formatOptions:f}=Gy(u);if(this.formats[d]){let _=l;try{const $=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},m=$.locale||$.lng||i.locale||i.lng||r;_=this.formats[d](l,m,{...f,...i,...$})}catch($){this.logger.warn($)}return _}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Xy=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Jy extends oc{constructor(e,n,r){var o,c;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=yn.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=[],(c=(o=this.backend)==null?void 0:o.init)==null||c.call(o,r,i.backend,i)}queueLoad(e,n,r,i){const o={},c={},l={},u={};return e.forEach(d=>{let f=!0;n.forEach(h=>{const _=`${d}|${h}`;!r.reload&&this.store.hasResourceBundle(d,h)?this.state[_]=2:this.state[_]<0||(this.state[_]===1?c[_]===void 0&&(c[_]=!0):(this.state[_]=1,f=!1,c[_]===void 0&&(c[_]=!0),o[_]===void 0&&(o[_]=!0),u[h]===void 0&&(u[h]=!0)))}),f||(l[d]=!0)}),(Object.keys(o).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(c),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(u)}}loaded(e,n,r){const i=e.split("|"),o=i[0],c=i[1];n&&this.emit("failedLoading",o,c,n),!n&&r&&this.store.addResourceBundle(o,c,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=>{Py(u.loaded,[o],c),Xy(u,e),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const f=u.loaded[d];f.length&&f.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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!e.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:o,callback:c});return}this.readingCalls++;const l=(d,f)=>{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&&f&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,o*2,c)},o);return}c(d,f)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(e,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).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();ke(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ke(n)&&(n=[n]);const o=this.queueLoad(e,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(c=>{this.loadOne(c)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(c,l)=>{c&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,c),!c&&l&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,l),this.loaded(e,c,l)})}saveMissing(e,n,r,i,o){var u,d,f,h,_;let c=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=(f=this.services)==null?void 0:f.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((_=this.backend)!=null&&_.create){const $={...c,isUpdate:o},m=this.backend.create.bind(this.backend);if(m.length<6)try{let x;m.length===5?x=m(e,n,r,i,$):x=m(e,n,r,i),x&&typeof x.then=="function"?x.then(S=>l(null,S)).catch(l):l(null,x)}catch(x){l(x)}else m(e,n,r,i,l,$)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const Uf=()=>({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]),ke(t[1])&&(e.defaultValue=t[1]),ke(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}}),Mf=t=>{var e,n;return ke(t.ns)&&(t.ns=[t.ns]),ke(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ke(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},Ns=()=>{},Yy=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class xo extends oc{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Mf(e),this.services={},this.logger=yn,this.modules={external:[]},Yy(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&&(ke(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Uf();this.options={...i,...this.options,...Mf(n)},this.options.interpolation={...i.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?yn.init(o(this.modules.logger),this.options):yn.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=Wy;const h=new Bf(this.options);this.store=new Rf(this.options.resources,this.options);const _=this.services;_.logger=yn,_.resourceStore=this.store,_.languageUtils=h,_.pluralResolver=new Hy(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(_.formatter=o(f),_.formatter.init(_,this.options),this.options.interpolation.format=_.formatter.format.bind(_.formatter)),_.interpolator=new Ky(this.options),_.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},_.backendConnector=new Jy(o(this.modules.backend),_.resourceStore,_,this.options),_.backendConnector.on("*",function($){for(var m=arguments.length,x=new Array(m>1?m-1:0),S=1;S<m;S++)x[S-1]=arguments[S];e.emit($,...x)}),this.modules.languageDetector&&(_.languageDetector=o(this.modules.languageDetector),_.languageDetector.init&&_.languageDetector.init(_,this.options.detection,this.options)),this.modules.i18nFormat&&(_.i18nFormat=o(this.modules.i18nFormat),_.i18nFormat.init&&_.i18nFormat.init(this)),this.translator=new sa(this.services,this.options),this.translator.on("*",function($){for(var m=arguments.length,x=new Array(m>1?m-1:0),S=1;S<m;S++)x[S-1]=arguments[S];e.emit($,...x)}),this.modules.external.forEach($=>{$.init&&$.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ns),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[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(f=>{this[f]=function(){return e.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return e.store[f](...arguments),e}});const u=io(),d=()=>{const f=(h,_)=>{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(_),r(h,_)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e){var o,c;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ns;const i=ke(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(f=>u(f)),(c=(o=this.options.preload)==null?void 0:o.forEach)==null||c.call(o,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=io();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=Ns),this.services.backendConnector.reload(e,n,o=>{i.resolve(),r(o)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Yg.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=io();this.emit("languageChanging",e);const o=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},c=(u,d)=>{d?(o(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 f,h;!e&&!u&&this.services.languageDetector&&(u=[]);const d=ke(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||o(d),this.translator.language||this.translator.changeLanguage(d),(h=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||h.call(f,d)),this.loadResources(d,_=>{c(_,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 o=function(c,l){let u;if(typeof l!="object"){for(var d=arguments.length,f=new Array(d>2?d-2:0),h=2;h<d;h++)f[h-2]=arguments[h];u=i.options.overloadTranslationOptionHandler([c,l].concat(f))}else u={...l};u.lng=u.lng||o.lng,u.lngs=u.lngs||o.lngs,u.ns=u.ns||o.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||o.keyPrefix);const _=i.options.keySeparator||".";let $;return u.keyPrefix&&Array.isArray(c)?$=c.map(m=>`${u.keyPrefix}${_}${m}`):$=u.keyPrefix?`${u.keyPrefix}${_}${c}`:c,i.t($,u)};return ke(e)?o.lng=e:o.lngs=e,o.ns=n,o.keyPrefix=r,o}t(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.translate(...n)}exists(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.exists(...n)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const c=(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,c);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(r,e)&&(!i||c(o,e)))}loadNamespaces(e,n){const r=io();return this.options.ns?(ke(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=io();ke(e)&&(e=[e]);const i=this.options.preload||[],o=e.filter(c=>i.indexOf(c)<0&&this.services.languageUtils.isSupportedCode(c));return o.length?(this.options.preload=i.concat(o),this.loadResources(c=>{r.resolve(),n&&n(c)}),r):(n&&n(),Promise.resolve())}dir(e){var i,o;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new Bf(Uf());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 xo(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ns;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new xo(i);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(l=>{o[l]=this[l]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const l=Object.keys(this.store.data).reduce((u,d)=>(u[d]={...this.store.data[d]},Object.keys(u[d]).reduce((f,h)=>(f[h]={...u[d][h]},f),{})),{});o.store=new Rf(l,i),o.services.resourceStore=o.store}return o.translator=new sa(o.services,i),o.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),f=1;f<u;f++)d[f-1]=arguments[f];o.emit(l,...d)}),o.init(i,n),o.translator.options=i,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const U=xo.createInstance();U.createInstance=xo.createInstance;U.createInstance;U.dir;U.init;U.loadResources;U.reloadResources;U.use;U.changeLanguage;U.getFixedT;const $e=U.t;U.exists;U.setDefaultNamespace;U.hasLoadedNamespace;U.loadNamespaces;U.loadLanguages;var Zg=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(n.origin);return async function(o,c){var d,f;function l(h,_){o.res.headers.set(h,_)}const u=r(o.req.header("origin")||"",o);if(u&&l("Access-Control-Allow-Origin",u),n.origin!=="*"){const h=o.req.header("Vary");h?l("Vary",h):l("Vary","Origin")}if(n.credentials&&l("Access-Control-Allow-Credentials","true"),(d=n.exposeHeaders)!=null&&d.length&&l("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.maxAge!=null&&l("Access-Control-Max-Age",n.maxAge.toString()),(f=n.allowMethods)!=null&&f.length&&l("Access-Control-Allow-Methods",n.allowMethods.join(","));let h=n.allowHeaders;if(!(h!=null&&h.length)){const _=o.req.header("Access-Control-Request-Headers");_&&(h=_.split(/\s*,\s*/))}return h!=null&&h.length&&(l("Access-Control-Allow-Headers",h.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await c()}};const Kn=s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()}),sc=s.z.object({created_at:s.z.string(),updated_at:s.z.string()}),Qg=s.z.object({email:s.z.string().optional(),email_verified:s.z.boolean().optional(),name:s.z.string().optional(),username:s.z.string().optional(),given_name:s.z.string().optional(),phone_number:s.z.string().optional(),phone_verified:s.z.boolean().optional(),family_name:s.z.string().optional()}).catchall(s.z.any()),em=s.z.object({connection:s.z.string(),user_id:s.z.string(),provider:s.z.string(),isSocial:s.z.boolean(),access_token:s.z.string().optional(),access_token_secret:s.z.string().optional(),refresh_token:s.z.string().optional(),profileData:Qg.optional()}),ac=s.z.object({email:s.z.string().optional().transform(t=>t&&t.toLowerCase()),username:s.z.string().optional(),phone_number:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),nickname:s.z.string().optional(),name:s.z.string().optional(),picture:s.z.string().optional(),locale:s.z.string().optional(),linked_to:s.z.string().optional(),profileData:s.z.string().optional(),user_id:s.z.string().optional(),app_metadata:s.z.any().default({}).optional(),user_metadata:s.z.any().default({}).optional()}),aa=ac.extend({email_verified:s.z.boolean().default(!1),verify_email:s.z.boolean().optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string().optional(),provider:s.z.string().default("email"),connection:s.z.string().default("email"),is_social:s.z.boolean().optional()}),Hd=s.z.object({...aa.shape,...sc.shape,user_id:s.z.string(),is_social:s.z.boolean(),email:s.z.string().optional(),login_count:s.z.number().default(0),identities:s.z.array(em).optional()}),_n=Hd,Zy=ac.extend({login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any()),Qy="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ew=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Qy[n[t]&63];return e};const tm=s.z.object({audience:s.z.string().optional(),recipient:s.z.string().optional(),createUpnClaim:s.z.boolean().optional(),mapUnknownClaimsAsIs:s.z.boolean().optional(),passthroughClaimsWithNoMapping:s.z.boolean().optional(),mapIdentities:s.z.boolean().optional(),signatureAlgorithm:s.z.string().optional(),digestAlgorithm:s.z.string().optional(),issuer:s.z.string().optional(),destination:s.z.string().optional(),lifetimeInSeconds:s.z.number().optional(),signResponse:s.z.boolean().optional(),nameIdentifierFormat:s.z.string().optional(),nameIdentifierProbes:s.z.array(s.z.string()).optional(),authnContextClassRef:s.z.string().optional(),mappings:s.z.record(s.z.string()).optional()}),ca=s.z.object({id:s.z.string(),name:s.z.string(),callbacks:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:s.z.array(s.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:s.z.object({samlp:tm.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:s.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:s.z.string().default(()=>ew()).optional(),disable_sign_ups:s.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),Or=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ca.shape}),Vi=s.z.object({x:s.z.number(),y:s.z.number()});var Kd=(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))(Kd||{}),Gd=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(Gd||{});const cc=s.z.object({id:s.z.string(),category:s.z.nativeEnum(Gd),type:s.z.nativeEnum(Kd)}),nm=cc.extend({category:s.z.literal("BLOCK"),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}).passthrough()}),rm=cc.extend({category:s.z.literal("BLOCK"),type:s.z.union([s.z.literal("NEXT_BUTTON"),s.z.literal("BACK_BUTTON"),s.z.literal("SUBMIT_BUTTON")]),config:s.z.object({text:s.z.string()}).passthrough()}),im=cc.extend({category:s.z.literal("FIELD"),type:s.z.literal("LEGAL"),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({text:s.z.string()}).passthrough()}),om=cc.extend({category:s.z.literal("FIELD"),type:s.z.union([s.z.literal("TEXT"),s.z.literal("EMAIL"),s.z.literal("PASSWORD"),s.z.literal("NUMBER"),s.z.literal("PHONE"),s.z.literal("DATE"),s.z.literal("CHECKBOX"),s.z.literal("RADIO"),s.z.literal("SELECT"),s.z.literal("HIDDEN")]),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({label:s.z.string().optional(),placeholder:s.z.string().optional()}).passthrough()}),sm=s.z.object({id:s.z.string(),category:s.z.string(),type:s.z.string()}).passthrough(),am=s.z.union([nm,rm,im,om,sm]);var cm=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(cm||{});const lm=s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:Vi,alias:s.z.string().optional(),config:s.z.object({components:s.z.array(am),next_node:s.z.string()}).passthrough()}),um=s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:Vi,alias:s.z.string().optional(),config:s.z.object({flow_id:s.z.string(),next_node:s.z.string()})}),dm=s.z.object({id:s.z.string(),type:s.z.string(),coordinates:Vi}).passthrough(),pm=s.z.union([lm,um,dm]),fm=s.z.object({next_node:s.z.string(),coordinates:Vi}).passthrough(),hm=s.z.object({resume_flow:s.z.boolean().optional(),coordinates:Vi}).passthrough(),gm=s.z.object({id:s.z.string(),name:s.z.string(),languages:s.z.object({primary:s.z.string()}).passthrough(),nodes:s.z.array(pm),start:fm,ending:hm,created_at:s.z.string(),updated_at:s.z.string(),links:s.z.object({sdkSrc:s.z.string().optional(),sdk_src:s.z.string().optional()}).passthrough()}).passthrough(),tw=gm.omit({id:!0,created_at:!0,updated_at:!0});var xt=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(xt||{}),Pn=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(Pn||{}),lc=(t=>(t.S256="S256",t.Plain="plain",t))(lc||{});const $o=s.z.object({client_id:s.z.string(),act_as:s.z.string().optional(),response_type:s.z.nativeEnum(xt).optional(),response_mode:s.z.nativeEnum(Pn).optional(),redirect_uri:s.z.string().optional(),audience:s.z.string().optional(),organization:s.z.string().optional(),state:s.z.string().optional(),nonce:s.z.string().optional(),scope:s.z.string().optional(),prompt:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(lc).optional(),code_challenge:s.z.string().optional(),username:s.z.string().optional(),ui_locales:s.z.string().optional(),vendor_id:s.z.string().optional()}),ru=s.z.object({colors:s.z.object({primary:s.z.string(),page_background:s.z.object({type:s.z.string().optional(),start:s.z.string().optional(),end:s.z.string().optional(),angle_deg:s.z.number().optional()}).optional()}).optional(),logo_url:s.z.string().optional(),favicon_url:s.z.string().optional(),font:s.z.object({url:s.z.string()}).optional()}),Wd=s.z.object({kid:s.z.string().optional(),team_id:s.z.string().optional(),realms:s.z.string().optional(),authentication_method:s.z.string().optional(),client_id:s.z.string().optional(),client_secret:s.z.string().optional(),app_secret:s.z.string().optional(),scope:s.z.string().optional(),authorization_endpoint:s.z.string().optional(),token_endpoint:s.z.string().optional(),userinfo_endpoint:s.z.string().optional(),jwks_uri:s.z.string().optional(),discovery_url:s.z.string().optional(),issuer:s.z.string().optional(),provider:s.z.string().optional(),from:s.z.string().optional(),twilio_sid:s.z.string().optional(),twilio_token:s.z.string().optional()}),la=s.z.object({id:s.z.string().optional(),name:s.z.string(),strategy:s.z.string(),options:Wd.default({}),enabled_clients:s.z.array(s.z.string()).default([]).optional(),response_type:s.z.custom().optional(),response_mode:s.z.custom().optional()}),or=s.z.object({id:s.z.string(),created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t)}).extend(la.shape),ua=s.z.object({name:s.z.string(),audience:s.z.string(),sender_email:s.z.string().email(),sender_name:s.z.string(),support_url:s.z.string().url().optional(),logo:s.z.string().url().optional(),primary_color:s.z.string().optional(),secondary_color:s.z.string().optional(),language:s.z.string().optional(),id:s.z.string().optional()}),xi=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ua.shape,id:s.z.string()}),mm=s.z.object({logoUrl:s.z.string(),loginBackgroundImage:s.z.string().nullish(),style:s.z.object({primaryColor:s.z.string(),buttonTextColor:s.z.string(),primaryHoverColor:s.z.string()}),supportEmail:s.z.string().nullable(),supportUrl:s.z.string().nullable(),name:s.z.string(),showGreyishBackground:s.z.boolean().optional(),termsAndConditionsUrl:s.z.string().nullable(),companyName:s.z.string().optional(),checkoutHideSocial:s.z.boolean().optional(),siteUrl:s.z.string().nullable(),manageSubscriptionsUrl:s.z.string().optional()});s.z.object({...Or.shape,tenant:xi,connections:s.z.array(or)});const _m=s.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),ym=s.z.object({code_id:s.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:s.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:s.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:_m,code_verifier:s.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:s.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:s.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:s.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:s.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:s.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:s.z.string(),used_at:s.z.string().optional(),user_id:s.z.string().optional()}),nw=s.z.object({...ym.shape,created_at:s.z.string()}),Xd=s.z.object({domain:s.z.string(),custom_domain_id:s.z.string().optional(),type:s.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:s.z.enum(["txt"]).optional(),tls_policy:s.z.enum(["recommended"]).optional(),custom_client_ip_header:s.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:s.z.record(s.z.string().max(255)).optional()}),wm=s.z.object({name:s.z.literal("txt"),record:s.z.string(),domain:s.z.string()}),ir=s.z.object({...Xd.shape,custom_domain_id:s.z.string(),primary:s.z.boolean(),status:s.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:s.z.string().optional(),verification:s.z.object({methods:s.z.array(wm)}).optional(),tls_policy:s.z.string().optional()}),rw=ir.extend({tenant_id:s.z.string()}),iw=s.z.object({id:s.z.string(),type:s.z.literal("submit"),label:s.z.string(),className:s.z.string().optional(),disabled:s.z.boolean().optional().default(!1),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0),customizations:s.z.record(s.z.string(),s.z.any()).optional()}),vm=s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("LEGAL"),config:s.z.object({text:s.z.string(),html:s.z.boolean().optional()}),required:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("TEXT"),config:s.z.object({placeholder:s.z.string().optional(),multiline:s.z.boolean().optional()}),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("NEXT_BUTTON"),config:s.z.object({text:s.z.string().optional()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)})]),da=s.z.object({name:s.z.string().openapi({description:"The name of the form"}),messages:s.z.object({errors:s.z.record(s.z.string(),s.z.any()).optional(),custom:s.z.record(s.z.string(),s.z.any()).optional()}).optional(),languages:s.z.object({primary:s.z.string().optional(),default:s.z.string().optional()}).optional(),translations:s.z.record(s.z.string(),s.z.any()).optional(),nodes:s.z.array(s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({flow_id:s.z.string().max(30),next_node:s.z.string()})}),s.z.object({id:s.z.string(),type:s.z.literal("ROUTER"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150),config:s.z.object({rules:s.z.array(s.z.object({id:s.z.string(),alias:s.z.string().min(1).max(150).optional(),condition:s.z.any(),next_node:s.z.string()})),fallback:s.z.array(s.z.string())})}),s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({components:s.z.array(vm),next_node:s.z.string()})})])).optional(),start:s.z.object({hidden_fields:s.z.array(s.z.object({key:s.z.string(),value:s.z.string()})).optional(),next_node:s.z.string().optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional()}).optional(),ending:s.z.object({redirection:s.z.object({delay:s.z.number().optional(),target:s.z.string().optional()}).optional(),after_submit:s.z.object({flow_id:s.z.string().optional()}).optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional(),resume_flow:s.z.boolean().optional()}).optional(),style:s.z.object({css:s.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches new JSON structure)"}),_i=s.z.object({...sc.shape,...da.shape,id:s.z.string()}),bm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),xm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),uc={enabled:s.z.boolean().default(!1),synchronous:s.z.boolean().default(!1),priority:s.z.number().optional(),hook_id:s.z.string().optional()},ow=s.z.object({...uc,trigger_id:bm,url:s.z.string()}),sw=s.z.object({...uc,trigger_id:xm,form_id:s.z.string()}),Fs=s.z.union([ow,sw]),aw=s.z.object({...uc,trigger_id:bm,...sc.shape,hook_id:s.z.string(),url:s.z.string()}),cw=s.z.object({...uc,trigger_id:xm,...sc.shape,hook_id:s.z.string(),form_id:s.z.string()}),yi=s.z.union([aw,cw]),Jd=s.z.object({alg:s.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:s.z.string(),kid:s.z.string(),kty:s.z.enum(["RSA","EC","oct"]),n:s.z.string(),x5t:s.z.string().optional(),x5c:s.z.array(s.z.string()).optional(),use:s.z.enum(["sig","enc"]).optional()}),$m=s.z.object({keys:s.z.array(Jd)}),iu=s.z.object({issuer:s.z.string(),authorization_endpoint:s.z.string(),token_endpoint:s.z.string(),device_authorization_endpoint:s.z.string(),userinfo_endpoint:s.z.string(),mfa_challenge_endpoint:s.z.string(),jwks_uri:s.z.string(),registration_endpoint:s.z.string(),revocation_endpoint:s.z.string(),scopes_supported:s.z.array(s.z.string()),response_types_supported:s.z.array(s.z.string()),code_challenge_methods_supported:s.z.array(s.z.string()),response_modes_supported:s.z.array(s.z.string()),subject_types_supported:s.z.array(s.z.string()),id_token_signing_alg_values_supported:s.z.array(s.z.string()),token_endpoint_auth_methods_supported:s.z.array(s.z.string()),claims_supported:s.z.array(s.z.string()),request_uri_parameter_supported:s.z.boolean(),request_parameter_supported:s.z.boolean(),token_endpoint_auth_signing_alg_values_supported:s.z.array(s.z.string())}),Am=s.z.object({csrf_token:s.z.string(),auth0Client:s.z.string().optional(),authParams:$o,expires_at:s.z.string(),deleted_at:s.z.string().optional(),ip:s.z.string().optional(),useragent:s.z.string().optional(),session_id:s.z.string().optional(),authorization_url:s.z.string().optional(),login_completed:s.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),lw=s.z.object({...Am.shape,id:s.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:s.z.string(),updated_at:s.z.string()});var Fe=(t=>(t.FAILED_SILENT_AUTH="fsa",t.FAILED_SIGNUP="fs",t.FAILED_LOGIN="f",t.FAILED_LOGIN_INCORRECT_PASSWORD="fp",t.FAILED_CHANGE_PASSWORD="fcp",t.FAILED_BY_CONNECTOR="fc",t.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",t.FAILED_HOOK="fh",t.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",t.SUCCESS_API_OPERATION="sapi",t.SUCCESS_CHANGE_PASSWORD="scp",t.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",t.SUCCESS_CHANGE_USERNAME="scu",t.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",t.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",t.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",t.SUCCESS_LOGIN="s",t.SUCCESS_LOGOUT="slo",t.SUCCESS_SIGNUP="ss",t.SUCCESS_SILENT_AUTH="ssa",t.SUCCESS_VERIFICATION_EMAIL="sv",t.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",t.CODE_LINK_SENT="cls",t.BLOCKED_ACCOUNT_EMAIL="limit_wc",t.BLOCKED_ACCOUNT_IP="limit_sul",t.BLOCKED_IP_ADDRESS="limit_mu",t))(Fe||{});const uw=s.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),km=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()}),pa=s.z.object({type:uw,date:s.z.string(),description:s.z.string().optional(),log_id:s.z.string().optional(),_id:s.z.string().optional(),ip:s.z.string(),user_agent:s.z.string(),details:s.z.any().optional(),isMobile:s.z.boolean(),user_id:s.z.string().optional(),user_name:s.z.string().optional(),connection:s.z.string().optional(),connection_id:s.z.string().optional(),client_id:s.z.string().optional(),client_name:s.z.string().optional(),audience:s.z.string().optional(),scope:s.z.array(s.z.string()).optional(),strategy:s.z.string().optional(),strategy_type:s.z.string().optional(),hostname:s.z.string().optional(),auth0_client:km.optional()}),Em=s.z.object({user_id:s.z.string(),password:s.z.string(),algorithm:s.z.enum(["bcrypt","argon2id"]).default("argon2id")}),dw=s.z.object({...Em.shape,created_at:s.z.string(),updated_at:s.z.string()}),Sm=s.z.object({initial_user_agent:s.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:s.z.string().describe("First IP address associated with this session"),initial_asn:s.z.string().describe("First autonomous system number associated with this session"),last_user_agent:s.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:s.z.string().describe("Last IP address from which this user logged in"),last_asn:s.z.string().describe("Last autonomous system number from which this user logged in")}),Nm=s.z.object({id:s.z.string(),revoked_at:s.z.string().optional(),used_at:s.z.string().optional(),user_id:s.z.string().describe("The user ID associated with the session"),expires_at:s.z.string().optional(),login_session_id:s.z.string(),idle_expires_at:s.z.string().optional(),device:Sm.describe("Metadata related to the device used in the session"),clients:s.z.array(s.z.string()).describe("List of client details for the session")}),dc=s.z.object({created_at:s.z.string(),updated_at:s.z.string(),authenticated_at:s.z.string(),last_interaction_at:s.z.string(),...Nm.shape}),ou=s.z.object({kid:s.z.string().openapi({description:"The key id of the signing key"}),cert:s.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:s.z.string().openapi({description:"The cert fingerprint"}),thumbprint:s.z.string().openapi({description:"The cert thumbprint"}),pkcs7:s.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:s.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:s.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:s.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:s.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:s.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:s.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:s.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var wi=(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))(wi||{});const Yd=s.z.object({access_token:s.z.string(),id_token:s.z.string().optional(),scope:s.z.string().optional(),state:s.z.string().optional(),refresh_token:s.z.string().optional(),token_type:s.z.string(),expires_in:s.z.number()});s.z.object({code:s.z.string(),state:s.z.string().optional()});const Cm=s.z.object({button_border_radius:s.z.number(),button_border_weight:s.z.number(),buttons_style:s.z.enum(["pill"]),input_border_radius:s.z.number(),input_border_weight:s.z.number(),inputs_style:s.z.enum(["pill"]),show_widget_shadow:s.z.boolean(),widget_border_weight:s.z.number(),widget_corner_radius:s.z.number()}),Im=s.z.object({base_focus_color:s.z.string(),base_hover_color:s.z.string(),body_text:s.z.string(),captcha_widget_theme:s.z.enum(["auto"]),error:s.z.string(),header:s.z.string(),icons:s.z.string(),input_background:s.z.string(),input_border:s.z.string(),input_filled_text:s.z.string(),input_labels_placeholders:s.z.string(),links_focused_components:s.z.string(),primary_button:s.z.string(),primary_button_label:s.z.string(),secondary_button_border:s.z.string(),secondary_button_label:s.z.string(),success:s.z.string(),widget_background:s.z.string(),widget_border:s.z.string()}),Nr=s.z.object({bold:s.z.boolean(),size:s.z.number()}),Tm=s.z.object({body_text:Nr,buttons_text:Nr,font_url:s.z.string(),input_labels:Nr,links:Nr,links_style:s.z.enum(["normal"]),reference_text_size:s.z.number(),subtitle:Nr,title:Nr}),Om=s.z.object({background_color:s.z.string(),background_image_url:s.z.string(),page_layout:s.z.enum(["center"])}),zm=s.z.object({header_text_alignment:s.z.enum(["center"]),logo_height:s.z.number(),logo_position:s.z.enum(["center"]),logo_url:s.z.string(),social_buttons_layout:s.z.enum(["bottom"])}),Dm=s.z.object({borders:Cm,colors:Im,displayName:s.z.string(),fonts:Tm,page_background:Om,widget:zm}),pw=Dm.extend({themeId:s.z.string()}),Us=s.z.object({universal_login_experience:s.z.enum(["new","classic"]).default("new"),identifier_first:s.z.boolean().default(!0),password_first:s.z.boolean().default(!1),webauthn_platform_first_factor:s.z.boolean()}),Ms=s.z.object({name:s.z.string(),enabled:s.z.boolean().optional().default(!0),default_from_address:s.z.string().optional(),credentials:s.z.union([s.z.object({accessKeyId:s.z.string(),secretAccessKey:s.z.string(),region:s.z.string()}),s.z.object({smtp_host:s.z.array(s.z.string()),smtp_port:s.z.number(),smtp_user:s.z.string(),smtp_pass:s.z.string()}),s.z.object({api_key:s.z.string(),domain:s.z.string().optional()}),s.z.object({connectionString:s.z.string()}),s.z.object({tenantId:s.z.string(),clientId:s.z.string(),clientSecret:s.z.string()})]),settings:s.z.object({}).optional()}),Zd=s.z.object({id:s.z.string(),session_id:s.z.string(),user_id:s.z.string(),client_id:s.z.string(),expires_at:s.z.string().optional(),idle_expires_at:s.z.string().optional(),last_exchanged_at:s.z.string().optional(),device:Sm,resource_servers:s.z.array(s.z.object({audience:s.z.string(),scopes:s.z.string()})),rotating:s.z.boolean()}),fw=s.z.object({created_at:s.z.string(),...Zd.shape}),hw=s.z.object({to:s.z.string(),message:s.z.string()}),gw=s.z.object({name:s.z.string(),options:s.z.object({})});function mw(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const _w=new s.OpenAPIHono().openapi(s.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ru}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.branding.get(e);return n?t.json(n):t.json({})}).openapi(s.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(ru.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.branding.set(e,n),t.text("OK")});var P=class extends Error{constructor(e=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});xe(this,"res");xe(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})}},sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function yw(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 ww(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 Pm={exports:{}};const vw={},bw=Object.freeze(Object.defineProperty({__proto__:null,default:vw},Symbol.toStringTag,{value:"Module"})),pc=yw(bw);(function(t){/**
1
+ "use strict";var zy=Object.defineProperty;var Dy=(t,e,n)=>e in t?zy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xe=(t,e,n)=>Dy(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@hono/zod-openapi"),ke=t=>typeof t=="string",io=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},Tf=t=>t==null?"":""+t,Ry=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},Py=/###/g,Of=t=>t&&t.indexOf("###")>-1?t.replace(Py,"."):t,zf=t=>!t||ke(t),go=(t,e,n)=>{const r=ke(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(zf(t))return{};const o=Of(r[i]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++i}return zf(t)?{}:{obj:t,k:Of(r[i])}},Df=(t,e,n)=>{const{obj:r,k:i}=go(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let o=e[e.length-1],c=e.slice(0,e.length-1),l=go(t,c,Object);for(;l.obj===void 0&&c.length;)o=`${c[c.length-1]}.${o}`,c=c.slice(0,c.length-1),l=go(t,c,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},By=(t,e,n,r)=>{const{obj:i,k:o}=go(t,e,Object);i[o]=i[o]||[],i[o].push(n)},ra=(t,e)=>{const{obj:n,k:r}=go(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},jy=(t,e,n)=>{const r=ra(t,n);return r!==void 0?r:ra(e,n)},Jg=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?ke(t[r])||t[r]instanceof String||ke(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):Jg(t[r],e[r],n):t[r]=e[r]);return t},si=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ly={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Fy=t=>ke(t)?t.replace(/[&<>"'\/]/g,e=>Ly[e]):t;class Uy{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 My=[" ",",","?","!",";"],qy=new Uy(20),Vy=(t,e,n)=>{e=e||"",n=n||"";const r=My.filter(c=>e.indexOf(c)<0&&n.indexOf(c)<0);if(r.length===0)return!0;const i=qy.getRegExp(`(${r.map(c=>c==="?"?"\\?":c).join("|")})`);let o=!i.test(t);if(!o){const c=t.indexOf(n);c>0&&!i.test(t.substring(0,c))&&(o=!0)}return o},nu=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let i=t;for(let o=0;o<r.length;){if(!i||typeof i!="object")return;let c,l="";for(let u=o;u<r.length;++u)if(u!==o&&(l+=n),l+=r[u],c=i[l],c!==void 0){if(["string","number","boolean"].indexOf(typeof c)>-1&&u<r.length-1)continue;o+=u-o+1;break}i=c}return i},ia=t=>t==null?void 0:t.replace("_","-"),Hy={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 oa{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||Hy,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:(ke(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oa(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new oa(this.logger,e)}}var yn=new oa;class oc{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(c=>{let[l,u]=c;for(let d=0;d<u;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(c=>{let[l,u]=c;for(let d=0;d<u;d++)l.apply(l,[e,...r])})}}class Rf extends oc{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,f;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=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):ke(r)&&o?l.push(...r.split(o)):l.push(r)));const u=ra(this.data,l);return!u&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),u||!c||!ke(r)?u:nu((f=(d=this.data)==null?void 0:d[e])==null?void 0:f[n],r,o)}addResource(e,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let l=[e,n];r&&(l=l.concat(c?r.split(c):r)),e.indexOf(".")>-1&&(l=e.split("."),i=n,n=l[1]),this.addNamespaces(n),Df(this.data,l,i),o.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(ke(r[o])||Array.isArray(r[o]))&&this.addResource(e,n,o,r[o],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,o){let c=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=ra(this.data,l)||{};c.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?Jg(u,r,o):u={...u,...r},Df(this.data,l,u),c.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 Yg={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(o=>{var c;e=((c=this.processors[o])==null?void 0:c.process(e,n,r,i))??e}),e}};const Pf={};class sa extends oc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ry(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=yn.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return(r==null?void 0:r.res)!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const c=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Vy(e,r,i);if(c&&!l){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:ke(o)?[o]:o};const d=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(d[0])>-1)&&(o=d.shift()),e=d.join(i)}return{key:e,namespaces:ke(o)?[o]:o}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:c,namespaces:l}=this.extractFromKey(e[e.length-1],n),u=l[l.length-1],d=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(f){const q=n.nsSeparator||this.options.nsSeparator;return i?{res:`${u}${q}${c}`,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${q}${c}`}return i?{res:c,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:c}const h=this.resolve(e,n);let _=h==null?void 0:h.res;const $=(h==null?void 0:h.usedKey)||c,m=(h==null?void 0:h.exactUsedKey)||c,x=Object.prototype.toString.apply(_),S=["[object Number]","[object Function]","[object RegExp]"],k=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,O=!ke(_)&&typeof _!="boolean"&&typeof _!="number";if(v&&_&&O&&S.indexOf(x)<0&&!(ke(k)&&Array.isArray(_))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const q=this.options.returnedObjectHandler?this.options.returnedObjectHandler($,_,{...n,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(h.res=q,h.usedParams=this.getUsedParamsDetails(n),h):q}if(o){const q=Array.isArray(_),F=q?[]:{},H=q?m:$;for(const W in _)if(Object.prototype.hasOwnProperty.call(_,W)){const J=`${H}${o}${W}`;F[W]=this.translate(J,{...n,joinArrays:!1,ns:l}),F[W]===J&&(F[W]=_[W])}_=F}}else if(v&&ke(k)&&Array.isArray(_))_=_.join(k),_&&(_=this.extendTranslation(_,e,n,r));else{let q=!1,F=!1;const H=n.count!==void 0&&!ke(n.count),W=sa.hasDefaultValue(n),J=H?this.pluralResolver.getSuffix(d,n.count,n):"",ue=n.ordinal&&H?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",Ne=H&&!n.ordinal&&n.count===0,B=Ne&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${J}`]||n[`defaultValue${ue}`]||n.defaultValue;!this.isValidLookup(_)&&W&&(q=!0,_=B),this.isValidLookup(_)||(F=!0,_=c);const R=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&F?void 0:_,I=W&&B!==_&&this.options.updateMissing;if(F||q||I){if(this.logger.log(I?"updateKey":"missingKey",d,u,c,I?B:_),o){const de=this.resolve(c,{...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 C=[];const j=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&j&&j[0])for(let de=0;de<j.length;de++)C.push(j[de]);else this.options.saveMissingTo==="all"?C=this.languageUtils.toResolveHierarchy(n.lng||this.language):C.push(n.lng||this.language);const V=(de,ne,ve)=>{var Z;const Ee=W&&ve!==_?ve:R;this.options.missingKeyHandler?this.options.missingKeyHandler(de,u,ne,Ee,I,n):(Z=this.backendConnector)!=null&&Z.saveMissing&&this.backendConnector.saveMissing(de,u,ne,Ee,I,n),this.emit("missingKey",de,u,ne,_)};this.options.saveMissing&&(this.options.saveMissingPlurals&&H?C.forEach(de=>{const ne=this.pluralResolver.getSuffixes(de,n);Ne&&n[`defaultValue${this.options.pluralSeparator}zero`]&&ne.indexOf(`${this.options.pluralSeparator}zero`)<0&&ne.push(`${this.options.pluralSeparator}zero`),ne.forEach(ve=>{V([de],c+ve,n[`defaultValue${ve}`]||B)})}):V(C,c,B))}_=this.extendTranslation(_,e,n,h,r),F&&_===c&&this.options.appendNamespaceToMissingKey&&(_=`${u}:${c}`),(F||q)&&this.options.parseMissingKeyHandler&&(_=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${c}`:c,q?_:void 0))}return i?(h.res=_,h.usedParams=this.getUsedParamsDetails(n),h):_}extendTranslation(e,n,r,i,o){var d,f;var c=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=ke(e)&&(((f=r==null?void 0:r.interpolation)==null?void 0:f.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let _;if(h){const m=e.match(this.interpolator.nestingRegexp);_=m&&m.length}let $=r.replace&&!ke(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&($={...this.options.interpolation.defaultVariables,...$}),e=this.interpolator.interpolate(e,$,r.lng||this.language||i.usedLng,r),h){const m=e.match(this.interpolator.nestingRegexp),x=m&&m.length;_<x&&(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 m=arguments.length,x=new Array(m),S=0;S<m;S++)x[S]=arguments[S];return(o==null?void 0:o[0])===x[0]&&!r.context?(c.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${n[0]}`),null):c.translate(...x,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=ke(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=Yg.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,o,c,l;return ke(e)&&(e=[e]),e.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),f=d.key;i=f;let h=d.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const _=n.count!==void 0&&!ke(n.count),$=_&&!n.ordinal&&n.count===0,m=n.context!==void 0&&(ke(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(S=>{var k,v;this.isValidLookup(r)||(l=S,!Pf[`${x[0]}-${S}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((v=this.utils)!=null&&v.hasLoadedNamespace(l))&&(Pf[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${x.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!!!")),x.forEach(O=>{var H;if(this.isValidLookup(r))return;c=O;const q=[f];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(q,f,O,S,n);else{let W;_&&(W=this.pluralResolver.getSuffix(O,n.count,n));const J=`${this.options.pluralSeparator}zero`,ue=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(_&&(q.push(f+W),n.ordinal&&W.indexOf(ue)===0&&q.push(f+W.replace(ue,this.options.pluralSeparator)),$&&q.push(f+J)),m){const Ne=`${f}${this.options.contextSeparator}${n.context}`;q.push(Ne),_&&(q.push(Ne+W),n.ordinal&&W.indexOf(ue)===0&&q.push(Ne+W.replace(ue,this.options.pluralSeparator)),$&&q.push(Ne+J))}}let F;for(;F=q.pop();)this.isValidLookup(r)||(o=F,r=this.getResource(O,S,F,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:c,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){var o;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!ke(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const o of n)delete i[o]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class Bf{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=yn.create("languageUtils")}getScriptPartFromCode(e){if(e=ia(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=ia(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ke(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&(o.indexOf("-")>0&&i.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===i||o.indexOf(i)===0&&i.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ke(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return ke(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):ke(e)&&o(this.formatLanguageCode(e)),r.forEach(c=>{i.indexOf(c)<0&&o(this.formatLanguageCode(c))}),i}}const jf={zero:0,one:1,two:2,few:3,many:4,other:5},Lf={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Ky{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=yn.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=ia(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let c;try{c=new Intl.PluralRules(r,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Lf;if(!e.match(/-|_/))return Lf;const u=this.languageUtils.getLanguagePartFromCode(e);c=this.getRule(u,n)}return this.pluralRulesCache[o]=c,c}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((i,o)=>jf[i]-jf[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const Ff=function(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=jy(t,e,n);return!o&&i&&ke(n)&&(o=nu(t,n,r),o===void 0&&(o=nu(e,n,r))),o},kl=t=>t.replace(/\$/g,"$$$$");class Gy{constructor(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=yn.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(r=>r),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:o,prefixEscaped:c,suffix:l,suffixEscaped:u,formatSeparator:d,unescapeSuffix:f,unescapePrefix:h,nestingPrefix:_,nestingPrefixEscaped:$,nestingSuffix:m,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:k,alwaysFormat:v}=e.interpolation;this.escape=n!==void 0?n:Fy,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?si(o):c||"{{",this.suffix=l?si(l):u||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=_?si(_):$||si("$t("),this.nestingSuffix=m?si(m):x||si(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=k||1e3,this.alwaysFormat=v!==void 0?v:!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 $;let o,c,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=m=>{if(m.indexOf(this.formatSeparator)<0){const v=Ff(n,u,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:m}):v}const x=m.split(this.formatSeparator),S=x.shift().trim(),k=x.join(this.formatSeparator).trim();return this.format(Ff(n,u,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...i,...n,interpolationkey:S})};this.resetRegExp();const f=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=(($=i==null?void 0:i.interpolation)==null?void 0:$.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>kl(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?kl(this.escape(m)):kl(m)}].forEach(m=>{for(l=0;o=m.regex.exec(e);){const x=o[1].trim();if(c=d(x),c===void 0)if(typeof f=="function"){const k=f(e,o,i);c=ke(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,x))c="";else if(h){c=o[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),c="";else!ke(c)&&!this.useRawValueToEscape&&(c=Tf(c));const S=m.safeValue(c);if(e=e.replace(o[0],S),h?(m.regex.lastIndex+=c.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,c;const l=(u,d)=>{const f=this.nestingOptionsSeparator;if(u.indexOf(f)<0)return u;const h=u.split(new RegExp(`${f}[ ]*{`));let _=`{${h[1]}`;u=h[0],_=this.interpolate(_,c);const $=_.match(/'/g),m=_.match(/"/g);((($==null?void 0:$.length)??0)%2===0&&!m||m.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),d&&(c={...d,...c})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,x),`${u}${f}${_}`}return c.defaultValue&&c.defaultValue.indexOf(this.prefix)>-1&&delete c.defaultValue,u};for(;i=this.nestingRegexp.exec(e);){let u=[];c={...r},c=c.replace&&!ke(c.replace)?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;let d=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const f=i[1].split(this.formatSeparator).map(h=>h.trim());i[1]=f.shift(),u=f,d=!0}if(o=n(l.call(this,i[1].trim(),c),c),o&&i[0]===e&&!ke(o))return o;ke(o)||(o=Tf(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),d&&(o=u.reduce((f,h)=>this.format(f,h,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const Wy=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(c=>{if(c){const[l,...u]=c.split(":"),d=u.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},ai=t=>{const e={};return(n,r,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const c=r+JSON.stringify(o);let l=e[c];return l||(l=t(ia(r),i),e[c]=l),l(n)}};class Xy{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=yn.create("formatter"),this.options=e,this.formats={number:ai((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:ai((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:ai((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:ai((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:ai((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(e)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=ai(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(l=>l.indexOf(")")>-1)){const l=o.findIndex(u=>u.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,l)].join(this.formatSeparator)}return o.reduce((l,u)=>{var h;const{formatName:d,formatOptions:f}=Wy(u);if(this.formats[d]){let _=l;try{const $=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},m=$.locale||$.lng||i.locale||i.lng||r;_=this.formats[d](l,m,{...f,...i,...$})}catch($){this.logger.warn($)}return _}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Jy=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Yy extends oc{constructor(e,n,r){var o,c;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=yn.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=[],(c=(o=this.backend)==null?void 0:o.init)==null||c.call(o,r,i.backend,i)}queueLoad(e,n,r,i){const o={},c={},l={},u={};return e.forEach(d=>{let f=!0;n.forEach(h=>{const _=`${d}|${h}`;!r.reload&&this.store.hasResourceBundle(d,h)?this.state[_]=2:this.state[_]<0||(this.state[_]===1?c[_]===void 0&&(c[_]=!0):(this.state[_]=1,f=!1,c[_]===void 0&&(c[_]=!0),o[_]===void 0&&(o[_]=!0),u[h]===void 0&&(u[h]=!0)))}),f||(l[d]=!0)}),(Object.keys(o).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(c),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(u)}}loaded(e,n,r){const i=e.split("|"),o=i[0],c=i[1];n&&this.emit("failedLoading",o,c,n),!n&&r&&this.store.addResourceBundle(o,c,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=>{By(u.loaded,[o],c),Jy(u,e),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const f=u.loaded[d];f.length&&f.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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!e.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:o,callback:c});return}this.readingCalls++;const l=(d,f)=>{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&&f&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,o*2,c)},o);return}c(d,f)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(e,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).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();ke(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ke(n)&&(n=[n]);const o=this.queueLoad(e,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(c=>{this.loadOne(c)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(c,l)=>{c&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,c),!c&&l&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,l),this.loaded(e,c,l)})}saveMissing(e,n,r,i,o){var u,d,f,h,_;let c=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=(f=this.services)==null?void 0:f.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((_=this.backend)!=null&&_.create){const $={...c,isUpdate:o},m=this.backend.create.bind(this.backend);if(m.length<6)try{let x;m.length===5?x=m(e,n,r,i,$):x=m(e,n,r,i),x&&typeof x.then=="function"?x.then(S=>l(null,S)).catch(l):l(null,x)}catch(x){l(x)}else m(e,n,r,i,l,$)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const Uf=()=>({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]),ke(t[1])&&(e.defaultValue=t[1]),ke(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}}),Mf=t=>{var e,n;return ke(t.ns)&&(t.ns=[t.ns]),ke(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ke(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},Ns=()=>{},Zy=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class xo extends oc{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Mf(e),this.services={},this.logger=yn,this.modules={external:[]},Zy(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&&(ke(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Uf();this.options={...i,...this.options,...Mf(n)},this.options.interpolation={...i.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?yn.init(o(this.modules.logger),this.options):yn.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=Xy;const h=new Bf(this.options);this.store=new Rf(this.options.resources,this.options);const _=this.services;_.logger=yn,_.resourceStore=this.store,_.languageUtils=h,_.pluralResolver=new Ky(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(_.formatter=o(f),_.formatter.init(_,this.options),this.options.interpolation.format=_.formatter.format.bind(_.formatter)),_.interpolator=new Gy(this.options),_.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},_.backendConnector=new Yy(o(this.modules.backend),_.resourceStore,_,this.options),_.backendConnector.on("*",function($){for(var m=arguments.length,x=new Array(m>1?m-1:0),S=1;S<m;S++)x[S-1]=arguments[S];e.emit($,...x)}),this.modules.languageDetector&&(_.languageDetector=o(this.modules.languageDetector),_.languageDetector.init&&_.languageDetector.init(_,this.options.detection,this.options)),this.modules.i18nFormat&&(_.i18nFormat=o(this.modules.i18nFormat),_.i18nFormat.init&&_.i18nFormat.init(this)),this.translator=new sa(this.services,this.options),this.translator.on("*",function($){for(var m=arguments.length,x=new Array(m>1?m-1:0),S=1;S<m;S++)x[S-1]=arguments[S];e.emit($,...x)}),this.modules.external.forEach($=>{$.init&&$.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ns),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[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(f=>{this[f]=function(){return e.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return e.store[f](...arguments),e}});const u=io(),d=()=>{const f=(h,_)=>{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(_),r(h,_)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e){var o,c;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ns;const i=ke(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(f=>u(f)),(c=(o=this.options.preload)==null?void 0:o.forEach)==null||c.call(o,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=io();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=Ns),this.services.backendConnector.reload(e,n,o=>{i.resolve(),r(o)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Yg.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=io();this.emit("languageChanging",e);const o=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},c=(u,d)=>{d?(o(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 f,h;!e&&!u&&this.services.languageDetector&&(u=[]);const d=ke(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||o(d),this.translator.language||this.translator.changeLanguage(d),(h=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||h.call(f,d)),this.loadResources(d,_=>{c(_,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 o=function(c,l){let u;if(typeof l!="object"){for(var d=arguments.length,f=new Array(d>2?d-2:0),h=2;h<d;h++)f[h-2]=arguments[h];u=i.options.overloadTranslationOptionHandler([c,l].concat(f))}else u={...l};u.lng=u.lng||o.lng,u.lngs=u.lngs||o.lngs,u.ns=u.ns||o.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||o.keyPrefix);const _=i.options.keySeparator||".";let $;return u.keyPrefix&&Array.isArray(c)?$=c.map(m=>`${u.keyPrefix}${_}${m}`):$=u.keyPrefix?`${u.keyPrefix}${_}${c}`:c,i.t($,u)};return ke(e)?o.lng=e:o.lngs=e,o.ns=n,o.keyPrefix=r,o}t(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.translate(...n)}exists(){var i;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(i=this.translator)==null?void 0:i.exists(...n)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const c=(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,c);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(r,e)&&(!i||c(o,e)))}loadNamespaces(e,n){const r=io();return this.options.ns?(ke(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=io();ke(e)&&(e=[e]);const i=this.options.preload||[],o=e.filter(c=>i.indexOf(c)<0&&this.services.languageUtils.isSupportedCode(c));return o.length?(this.options.preload=i.concat(o),this.loadResources(c=>{r.resolve(),n&&n(c)}),r):(n&&n(),Promise.resolve())}dir(e){var i,o;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new Bf(Uf());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 xo(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ns;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new xo(i);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(l=>{o[l]=this[l]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const l=Object.keys(this.store.data).reduce((u,d)=>(u[d]={...this.store.data[d]},Object.keys(u[d]).reduce((f,h)=>(f[h]={...u[d][h]},f),{})),{});o.store=new Rf(l,i),o.services.resourceStore=o.store}return o.translator=new sa(o.services,i),o.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),f=1;f<u;f++)d[f-1]=arguments[f];o.emit(l,...d)}),o.init(i,n),o.translator.options=i,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const U=xo.createInstance();U.createInstance=xo.createInstance;U.createInstance;U.dir;U.init;U.loadResources;U.reloadResources;U.use;U.changeLanguage;U.getFixedT;const $e=U.t;U.exists;U.setDefaultNamespace;U.hasLoadedNamespace;U.loadNamespaces;U.loadLanguages;var Zg=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(n.origin);return async function(o,c){var d,f;function l(h,_){o.res.headers.set(h,_)}const u=r(o.req.header("origin")||"",o);if(u&&l("Access-Control-Allow-Origin",u),n.origin!=="*"){const h=o.req.header("Vary");h?l("Vary",h):l("Vary","Origin")}if(n.credentials&&l("Access-Control-Allow-Credentials","true"),(d=n.exposeHeaders)!=null&&d.length&&l("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.maxAge!=null&&l("Access-Control-Max-Age",n.maxAge.toString()),(f=n.allowMethods)!=null&&f.length&&l("Access-Control-Allow-Methods",n.allowMethods.join(","));let h=n.allowHeaders;if(!(h!=null&&h.length)){const _=o.req.header("Access-Control-Request-Headers");_&&(h=_.split(/\s*,\s*/))}return h!=null&&h.length&&(l("Access-Control-Allow-Headers",h.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await c()}};const Kn=s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()}),sc=s.z.object({created_at:s.z.string(),updated_at:s.z.string()}),Qg=s.z.object({email:s.z.string().optional(),email_verified:s.z.boolean().optional(),name:s.z.string().optional(),username:s.z.string().optional(),given_name:s.z.string().optional(),phone_number:s.z.string().optional(),phone_verified:s.z.boolean().optional(),family_name:s.z.string().optional()}).catchall(s.z.any()),em=s.z.object({connection:s.z.string(),user_id:s.z.string(),provider:s.z.string(),isSocial:s.z.boolean(),access_token:s.z.string().optional(),access_token_secret:s.z.string().optional(),refresh_token:s.z.string().optional(),profileData:Qg.optional()}),ac=s.z.object({email:s.z.string().optional().transform(t=>t&&t.toLowerCase()),username:s.z.string().optional(),phone_number:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),nickname:s.z.string().optional(),name:s.z.string().optional(),picture:s.z.string().optional(),locale:s.z.string().optional(),linked_to:s.z.string().optional(),profileData:s.z.string().optional(),user_id:s.z.string().optional(),app_metadata:s.z.any().default({}).optional(),user_metadata:s.z.any().default({}).optional()}),aa=ac.extend({email_verified:s.z.boolean().default(!1),verify_email:s.z.boolean().optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string().optional(),provider:s.z.string().default("email"),connection:s.z.string().default("email"),is_social:s.z.boolean().optional()}),Hd=s.z.object({...aa.shape,...sc.shape,user_id:s.z.string(),is_social:s.z.boolean(),email:s.z.string().optional(),login_count:s.z.number().default(0),identities:s.z.array(em).optional()}),_n=Hd,Qy=ac.extend({login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any()),ew="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let tw=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ew[n[t]&63];return e};const tm=s.z.object({audience:s.z.string().optional(),recipient:s.z.string().optional(),createUpnClaim:s.z.boolean().optional(),mapUnknownClaimsAsIs:s.z.boolean().optional(),passthroughClaimsWithNoMapping:s.z.boolean().optional(),mapIdentities:s.z.boolean().optional(),signatureAlgorithm:s.z.string().optional(),digestAlgorithm:s.z.string().optional(),issuer:s.z.string().optional(),destination:s.z.string().optional(),lifetimeInSeconds:s.z.number().optional(),signResponse:s.z.boolean().optional(),nameIdentifierFormat:s.z.string().optional(),nameIdentifierProbes:s.z.array(s.z.string()).optional(),authnContextClassRef:s.z.string().optional(),mappings:s.z.record(s.z.string()).optional()}),ca=s.z.object({id:s.z.string(),name:s.z.string(),callbacks:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:s.z.array(s.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:s.z.array(s.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:s.z.object({samlp:tm.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:s.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:s.z.string().default(()=>tw()).optional(),disable_sign_ups:s.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),Or=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ca.shape}),Vi=s.z.object({x:s.z.number(),y:s.z.number()});var Kd=(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))(Kd||{}),Gd=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(Gd||{});const cc=s.z.object({id:s.z.string(),category:s.z.nativeEnum(Gd),type:s.z.nativeEnum(Kd)}),nm=cc.extend({category:s.z.literal("BLOCK"),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}).passthrough()}),rm=cc.extend({category:s.z.literal("BLOCK"),type:s.z.union([s.z.literal("NEXT_BUTTON"),s.z.literal("BACK_BUTTON"),s.z.literal("SUBMIT_BUTTON")]),config:s.z.object({text:s.z.string()}).passthrough()}),im=cc.extend({category:s.z.literal("FIELD"),type:s.z.literal("LEGAL"),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({text:s.z.string()}).passthrough()}),om=cc.extend({category:s.z.literal("FIELD"),type:s.z.union([s.z.literal("TEXT"),s.z.literal("EMAIL"),s.z.literal("PASSWORD"),s.z.literal("NUMBER"),s.z.literal("PHONE"),s.z.literal("DATE"),s.z.literal("CHECKBOX"),s.z.literal("RADIO"),s.z.literal("SELECT"),s.z.literal("HIDDEN")]),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),config:s.z.object({label:s.z.string().optional(),placeholder:s.z.string().optional()}).passthrough()}),sm=s.z.object({id:s.z.string(),category:s.z.string(),type:s.z.string()}).passthrough(),am=s.z.union([nm,rm,im,om,sm]);var cm=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(cm||{});const lm=s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:Vi,alias:s.z.string().optional(),config:s.z.object({components:s.z.array(am),next_node:s.z.string()}).passthrough()}),um=s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:Vi,alias:s.z.string().optional(),config:s.z.object({flow_id:s.z.string(),next_node:s.z.string()})}),dm=s.z.object({id:s.z.string(),type:s.z.string(),coordinates:Vi}).passthrough(),pm=s.z.union([lm,um,dm]),fm=s.z.object({next_node:s.z.string(),coordinates:Vi}).passthrough(),hm=s.z.object({resume_flow:s.z.boolean().optional(),coordinates:Vi}).passthrough(),gm=s.z.object({id:s.z.string(),name:s.z.string(),languages:s.z.object({primary:s.z.string()}).passthrough(),nodes:s.z.array(pm),start:fm,ending:hm,created_at:s.z.string(),updated_at:s.z.string(),links:s.z.object({sdkSrc:s.z.string().optional(),sdk_src:s.z.string().optional()}).passthrough()}).passthrough(),nw=gm.omit({id:!0,created_at:!0,updated_at:!0});var xt=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(xt||{}),Pn=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(Pn||{}),lc=(t=>(t.S256="S256",t.Plain="plain",t))(lc||{});const $o=s.z.object({client_id:s.z.string(),act_as:s.z.string().optional(),response_type:s.z.nativeEnum(xt).optional(),response_mode:s.z.nativeEnum(Pn).optional(),redirect_uri:s.z.string().optional(),audience:s.z.string().optional(),organization:s.z.string().optional(),state:s.z.string().optional(),nonce:s.z.string().optional(),scope:s.z.string().optional(),prompt:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(lc).optional(),code_challenge:s.z.string().optional(),username:s.z.string().optional(),ui_locales:s.z.string().optional(),vendor_id:s.z.string().optional()}),ru=s.z.object({colors:s.z.object({primary:s.z.string(),page_background:s.z.object({type:s.z.string().optional(),start:s.z.string().optional(),end:s.z.string().optional(),angle_deg:s.z.number().optional()}).optional()}).optional(),logo_url:s.z.string().optional(),favicon_url:s.z.string().optional(),font:s.z.object({url:s.z.string()}).optional()}),Wd=s.z.object({kid:s.z.string().optional(),team_id:s.z.string().optional(),realms:s.z.string().optional(),authentication_method:s.z.string().optional(),client_id:s.z.string().optional(),client_secret:s.z.string().optional(),app_secret:s.z.string().optional(),scope:s.z.string().optional(),authorization_endpoint:s.z.string().optional(),token_endpoint:s.z.string().optional(),userinfo_endpoint:s.z.string().optional(),jwks_uri:s.z.string().optional(),discovery_url:s.z.string().optional(),issuer:s.z.string().optional(),provider:s.z.string().optional(),from:s.z.string().optional(),twilio_sid:s.z.string().optional(),twilio_token:s.z.string().optional()}),la=s.z.object({id:s.z.string().optional(),name:s.z.string(),strategy:s.z.string(),options:Wd.default({}),enabled_clients:s.z.array(s.z.string()).default([]).optional(),response_type:s.z.custom().optional(),response_mode:s.z.custom().optional()}),or=s.z.object({id:s.z.string(),created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t)}).extend(la.shape),ua=s.z.object({name:s.z.string(),audience:s.z.string(),sender_email:s.z.string().email(),sender_name:s.z.string(),support_url:s.z.string().url().optional(),logo:s.z.string().url().optional(),primary_color:s.z.string().optional(),secondary_color:s.z.string().optional(),language:s.z.string().optional(),id:s.z.string().optional()}),xi=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ua.shape,id:s.z.string()}),mm=s.z.object({logoUrl:s.z.string(),loginBackgroundImage:s.z.string().nullish(),style:s.z.object({primaryColor:s.z.string(),buttonTextColor:s.z.string(),primaryHoverColor:s.z.string()}),country:s.z.string().optional(),supportEmail:s.z.string().nullable(),supportUrl:s.z.string().nullable(),name:s.z.string(),showGreyishBackground:s.z.boolean().optional(),termsAndConditionsUrl:s.z.string().nullable(),companyName:s.z.string().optional(),checkoutHideSocial:s.z.boolean().optional(),siteUrl:s.z.string().nullable(),manageSubscriptionsUrl:s.z.string().optional()});s.z.object({...Or.shape,tenant:xi,connections:s.z.array(or)});const _m=s.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),ym=s.z.object({code_id:s.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:s.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:s.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:_m,code_verifier:s.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:s.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:s.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:s.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:s.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:s.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:s.z.string(),used_at:s.z.string().optional(),user_id:s.z.string().optional()}),rw=s.z.object({...ym.shape,created_at:s.z.string()}),Xd=s.z.object({domain:s.z.string(),custom_domain_id:s.z.string().optional(),type:s.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:s.z.enum(["txt"]).optional(),tls_policy:s.z.enum(["recommended"]).optional(),custom_client_ip_header:s.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:s.z.record(s.z.string().max(255)).optional()}),wm=s.z.object({name:s.z.literal("txt"),record:s.z.string(),domain:s.z.string()}),ir=s.z.object({...Xd.shape,custom_domain_id:s.z.string(),primary:s.z.boolean(),status:s.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:s.z.string().optional(),verification:s.z.object({methods:s.z.array(wm)}).optional(),tls_policy:s.z.string().optional()}),iw=ir.extend({tenant_id:s.z.string()}),ow=s.z.object({id:s.z.string(),type:s.z.literal("submit"),label:s.z.string(),className:s.z.string().optional(),disabled:s.z.boolean().optional().default(!1),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0),customizations:s.z.record(s.z.string(),s.z.any()).optional()}),vm=s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("LEGAL"),config:s.z.object({text:s.z.string(),html:s.z.boolean().optional()}),required:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("TEXT"),config:s.z.object({placeholder:s.z.string().optional(),multiline:s.z.boolean().optional()}),required:s.z.boolean().optional(),sensitive:s.z.boolean().optional(),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)}),s.z.object({id:s.z.string(),type:s.z.literal("NEXT_BUTTON"),config:s.z.object({text:s.z.string().optional()}),order:s.z.number().optional(),visible:s.z.boolean().optional().default(!0)})]),da=s.z.object({name:s.z.string().openapi({description:"The name of the form"}),messages:s.z.object({errors:s.z.record(s.z.string(),s.z.any()).optional(),custom:s.z.record(s.z.string(),s.z.any()).optional()}).optional(),languages:s.z.object({primary:s.z.string().optional(),default:s.z.string().optional()}).optional(),translations:s.z.record(s.z.string(),s.z.any()).optional(),nodes:s.z.array(s.z.discriminatedUnion("type",[s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({flow_id:s.z.string().max(30),next_node:s.z.string()})}),s.z.object({id:s.z.string(),type:s.z.literal("ROUTER"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150),config:s.z.object({rules:s.z.array(s.z.object({id:s.z.string(),alias:s.z.string().min(1).max(150).optional(),condition:s.z.any(),next_node:s.z.string()})),fallback:s.z.array(s.z.string())})}),s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}),alias:s.z.string().min(1).max(150).optional(),config:s.z.object({components:s.z.array(vm),next_node:s.z.string()})})])).optional(),start:s.z.object({hidden_fields:s.z.array(s.z.object({key:s.z.string(),value:s.z.string()})).optional(),next_node:s.z.string().optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional()}).optional(),ending:s.z.object({redirection:s.z.object({delay:s.z.number().optional(),target:s.z.string().optional()}).optional(),after_submit:s.z.object({flow_id:s.z.string().optional()}).optional(),coordinates:s.z.object({x:s.z.number(),y:s.z.number()}).optional(),resume_flow:s.z.boolean().optional()}).optional(),style:s.z.object({css:s.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches new JSON structure)"}),_i=s.z.object({...sc.shape,...da.shape,id:s.z.string()}),bm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),xm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),uc={enabled:s.z.boolean().default(!1),synchronous:s.z.boolean().default(!1),priority:s.z.number().optional(),hook_id:s.z.string().optional()},sw=s.z.object({...uc,trigger_id:bm,url:s.z.string()}),aw=s.z.object({...uc,trigger_id:xm,form_id:s.z.string()}),Fs=s.z.union([sw,aw]),cw=s.z.object({...uc,trigger_id:bm,...sc.shape,hook_id:s.z.string(),url:s.z.string()}),lw=s.z.object({...uc,trigger_id:xm,...sc.shape,hook_id:s.z.string(),form_id:s.z.string()}),yi=s.z.union([cw,lw]),Jd=s.z.object({alg:s.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:s.z.string(),kid:s.z.string(),kty:s.z.enum(["RSA","EC","oct"]),n:s.z.string(),x5t:s.z.string().optional(),x5c:s.z.array(s.z.string()).optional(),use:s.z.enum(["sig","enc"]).optional()}),$m=s.z.object({keys:s.z.array(Jd)}),iu=s.z.object({issuer:s.z.string(),authorization_endpoint:s.z.string(),token_endpoint:s.z.string(),device_authorization_endpoint:s.z.string(),userinfo_endpoint:s.z.string(),mfa_challenge_endpoint:s.z.string(),jwks_uri:s.z.string(),registration_endpoint:s.z.string(),revocation_endpoint:s.z.string(),scopes_supported:s.z.array(s.z.string()),response_types_supported:s.z.array(s.z.string()),code_challenge_methods_supported:s.z.array(s.z.string()),response_modes_supported:s.z.array(s.z.string()),subject_types_supported:s.z.array(s.z.string()),id_token_signing_alg_values_supported:s.z.array(s.z.string()),token_endpoint_auth_methods_supported:s.z.array(s.z.string()),claims_supported:s.z.array(s.z.string()),request_uri_parameter_supported:s.z.boolean(),request_parameter_supported:s.z.boolean(),token_endpoint_auth_signing_alg_values_supported:s.z.array(s.z.string())}),Am=s.z.object({csrf_token:s.z.string(),auth0Client:s.z.string().optional(),authParams:$o,expires_at:s.z.string(),deleted_at:s.z.string().optional(),ip:s.z.string().optional(),useragent:s.z.string().optional(),session_id:s.z.string().optional(),authorization_url:s.z.string().optional(),login_completed:s.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),uw=s.z.object({...Am.shape,id:s.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:s.z.string(),updated_at:s.z.string()});var Fe=(t=>(t.FAILED_SILENT_AUTH="fsa",t.FAILED_SIGNUP="fs",t.FAILED_LOGIN="f",t.FAILED_LOGIN_INCORRECT_PASSWORD="fp",t.FAILED_CHANGE_PASSWORD="fcp",t.FAILED_BY_CONNECTOR="fc",t.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",t.FAILED_HOOK="fh",t.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",t.SUCCESS_API_OPERATION="sapi",t.SUCCESS_CHANGE_PASSWORD="scp",t.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",t.SUCCESS_CHANGE_USERNAME="scu",t.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",t.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",t.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",t.SUCCESS_LOGIN="s",t.SUCCESS_LOGOUT="slo",t.SUCCESS_SIGNUP="ss",t.SUCCESS_SILENT_AUTH="ssa",t.SUCCESS_VERIFICATION_EMAIL="sv",t.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",t.CODE_LINK_SENT="cls",t.BLOCKED_ACCOUNT_EMAIL="limit_wc",t.BLOCKED_ACCOUNT_IP="limit_sul",t.BLOCKED_IP_ADDRESS="limit_mu",t))(Fe||{});const dw=s.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),km=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()}),pa=s.z.object({type:dw,date:s.z.string(),description:s.z.string().optional(),log_id:s.z.string().optional(),_id:s.z.string().optional(),ip:s.z.string(),user_agent:s.z.string(),details:s.z.any().optional(),isMobile:s.z.boolean(),user_id:s.z.string().optional(),user_name:s.z.string().optional(),connection:s.z.string().optional(),connection_id:s.z.string().optional(),client_id:s.z.string().optional(),client_name:s.z.string().optional(),audience:s.z.string().optional(),scope:s.z.array(s.z.string()).optional(),strategy:s.z.string().optional(),strategy_type:s.z.string().optional(),hostname:s.z.string().optional(),auth0_client:km.optional()}),Em=s.z.object({user_id:s.z.string(),password:s.z.string(),algorithm:s.z.enum(["bcrypt","argon2id"]).default("argon2id")}),pw=s.z.object({...Em.shape,created_at:s.z.string(),updated_at:s.z.string()}),Sm=s.z.object({initial_user_agent:s.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:s.z.string().describe("First IP address associated with this session"),initial_asn:s.z.string().describe("First autonomous system number associated with this session"),last_user_agent:s.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:s.z.string().describe("Last IP address from which this user logged in"),last_asn:s.z.string().describe("Last autonomous system number from which this user logged in")}),Nm=s.z.object({id:s.z.string(),revoked_at:s.z.string().optional(),used_at:s.z.string().optional(),user_id:s.z.string().describe("The user ID associated with the session"),expires_at:s.z.string().optional(),login_session_id:s.z.string(),idle_expires_at:s.z.string().optional(),device:Sm.describe("Metadata related to the device used in the session"),clients:s.z.array(s.z.string()).describe("List of client details for the session")}),dc=s.z.object({created_at:s.z.string(),updated_at:s.z.string(),authenticated_at:s.z.string(),last_interaction_at:s.z.string(),...Nm.shape}),ou=s.z.object({kid:s.z.string().openapi({description:"The key id of the signing key"}),cert:s.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:s.z.string().openapi({description:"The cert fingerprint"}),thumbprint:s.z.string().openapi({description:"The cert thumbprint"}),pkcs7:s.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:s.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:s.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:s.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:s.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:s.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:s.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:s.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var wi=(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))(wi||{});const Yd=s.z.object({access_token:s.z.string(),id_token:s.z.string().optional(),scope:s.z.string().optional(),state:s.z.string().optional(),refresh_token:s.z.string().optional(),token_type:s.z.string(),expires_in:s.z.number()});s.z.object({code:s.z.string(),state:s.z.string().optional()});const Cm=s.z.object({button_border_radius:s.z.number(),button_border_weight:s.z.number(),buttons_style:s.z.enum(["pill"]),input_border_radius:s.z.number(),input_border_weight:s.z.number(),inputs_style:s.z.enum(["pill"]),show_widget_shadow:s.z.boolean(),widget_border_weight:s.z.number(),widget_corner_radius:s.z.number()}),Im=s.z.object({base_focus_color:s.z.string(),base_hover_color:s.z.string(),body_text:s.z.string(),captcha_widget_theme:s.z.enum(["auto"]),error:s.z.string(),header:s.z.string(),icons:s.z.string(),input_background:s.z.string(),input_border:s.z.string(),input_filled_text:s.z.string(),input_labels_placeholders:s.z.string(),links_focused_components:s.z.string(),primary_button:s.z.string(),primary_button_label:s.z.string(),secondary_button_border:s.z.string(),secondary_button_label:s.z.string(),success:s.z.string(),widget_background:s.z.string(),widget_border:s.z.string()}),Nr=s.z.object({bold:s.z.boolean(),size:s.z.number()}),Tm=s.z.object({body_text:Nr,buttons_text:Nr,font_url:s.z.string(),input_labels:Nr,links:Nr,links_style:s.z.enum(["normal"]),reference_text_size:s.z.number(),subtitle:Nr,title:Nr}),Om=s.z.object({background_color:s.z.string(),background_image_url:s.z.string(),page_layout:s.z.enum(["center"])}),zm=s.z.object({header_text_alignment:s.z.enum(["center"]),logo_height:s.z.number(),logo_position:s.z.enum(["center"]),logo_url:s.z.string(),social_buttons_layout:s.z.enum(["bottom"])}),Dm=s.z.object({borders:Cm,colors:Im,displayName:s.z.string(),fonts:Tm,page_background:Om,widget:zm}),fw=Dm.extend({themeId:s.z.string()}),Us=s.z.object({universal_login_experience:s.z.enum(["new","classic"]).default("new"),identifier_first:s.z.boolean().default(!0),password_first:s.z.boolean().default(!1),webauthn_platform_first_factor:s.z.boolean()}),Ms=s.z.object({name:s.z.string(),enabled:s.z.boolean().optional().default(!0),default_from_address:s.z.string().optional(),credentials:s.z.union([s.z.object({accessKeyId:s.z.string(),secretAccessKey:s.z.string(),region:s.z.string()}),s.z.object({smtp_host:s.z.array(s.z.string()),smtp_port:s.z.number(),smtp_user:s.z.string(),smtp_pass:s.z.string()}),s.z.object({api_key:s.z.string(),domain:s.z.string().optional()}),s.z.object({connectionString:s.z.string()}),s.z.object({tenantId:s.z.string(),clientId:s.z.string(),clientSecret:s.z.string()})]),settings:s.z.object({}).optional()}),Zd=s.z.object({id:s.z.string(),session_id:s.z.string(),user_id:s.z.string(),client_id:s.z.string(),expires_at:s.z.string().optional(),idle_expires_at:s.z.string().optional(),last_exchanged_at:s.z.string().optional(),device:Sm,resource_servers:s.z.array(s.z.object({audience:s.z.string(),scopes:s.z.string()})),rotating:s.z.boolean()}),hw=s.z.object({created_at:s.z.string(),...Zd.shape}),gw=s.z.object({to:s.z.string(),message:s.z.string()}),mw=s.z.object({name:s.z.string(),options:s.z.object({})});function _w(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const yw=new s.OpenAPIHono().openapi(s.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ru}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.branding.get(e);return n?t.json(n):t.json({})}).openapi(s.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(ru.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.branding.set(e,n),t.text("OK")});var P=class extends Error{constructor(e=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});xe(this,"res");xe(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})}},sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ww(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 vw(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 Pm={exports:{}};const bw={},xw=Object.freeze(Object.defineProperty({__proto__:null,default:bw},Symbol.toStringTag,{value:"Module"})),pc=ww(xw);(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 ww=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(sr,function(){var e={},n=null;function r(B){if(t&&t.exports)try{return pc.randomBytes(B)}catch{}try{var L;return(self.crypto||self.msCrypto).getRandomValues(L=new Uint32Array(B)),Array.prototype.slice.call(L)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(B)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(B){n=B},e.genSaltSync=function(B,L){if(B=B||x,typeof B!="number")throw Error("Illegal arguments: "+typeof B+", "+typeof L);B<4?B=4:B>31&&(B=31);var R=[];return R.push("$2a$"),B<10&&R.push("0"),R.push(B.toString()),R.push("$"),R.push(h(r(m),m)),R.join("")},e.genSalt=function(B,L,R){if(typeof L=="function"&&(R=L,L=void 0),typeof B=="function"&&(R=B,B=void 0),typeof B>"u")B=x;else if(typeof B!="number")throw Error("illegal arguments: "+typeof B);function I(C){c(function(){try{C(null,e.genSaltSync(B))}catch(j){C(j)}})}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);I(R)}else return new Promise(function(C,j){I(function(V,de){if(V){j(V);return}C(de)})})},e.hashSync=function(B,L){if(typeof L>"u"&&(L=x),typeof L=="number"&&(L=e.genSaltSync(L)),typeof B!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof B+", "+typeof L);return Ne(B,L)},e.hash=function(B,L,R,I){function C(j){typeof B=="string"&&typeof L=="number"?e.genSalt(L,function(V,de){Ne(B,de,j,I)}):typeof B=="string"&&typeof L=="string"?Ne(B,L,j,I):c(j.bind(this,Error("Illegal arguments: "+typeof B+", "+typeof L)))}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);C(R)}else return new Promise(function(j,V){C(function(de,ne){if(de){V(de);return}j(ne)})})};function o(B,L){for(var R=0,I=0,C=0,j=B.length;C<j;++C)B.charCodeAt(C)===L.charCodeAt(C)?++R:++I;return R<0?!1:I===0}e.compareSync=function(B,L){if(typeof B!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof B+", "+typeof L);return L.length!==60?!1:o(e.hashSync(B,L.substr(0,L.length-31)),L)},e.compare=function(B,L,R,I){function C(j){if(typeof B!="string"||typeof L!="string"){c(j.bind(this,Error("Illegal arguments: "+typeof B+", "+typeof L)));return}if(L.length!==60){c(j.bind(this,null,!1));return}e.hash(B,L.substr(0,29),function(V,de){V?j(V):j(null,o(de,L))},I)}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);C(R)}else return new Promise(function(j,V){C(function(de,ne){if(de){V(de);return}j(ne)})})},e.getRounds=function(B){if(typeof B!="string")throw Error("Illegal arguments: "+typeof B);return parseInt(B.split("$")[2],10)},e.getSalt=function(B){if(typeof B!="string")throw Error("Illegal arguments: "+typeof B);if(B.length!==60)throw Error("Illegal hash length: "+B.length+" != 60");return B.substring(0,29)};var c=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function l(B){var L=[],R=0;return $.encodeUTF16toUTF8(function(){return R>=B.length?null:B.charCodeAt(R++)},function(I){L.push(I)}),L}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],f=String.fromCharCode;function h(B,L){var R=0,I=[],C,j;if(L<=0||L>B.length)throw Error("Illegal len: "+L);for(;R<L;){if(C=B[R++]&255,I.push(u[C>>2&63]),C=(C&3)<<4,R>=L){I.push(u[C&63]);break}if(j=B[R++]&255,C|=j>>4&15,I.push(u[C&63]),C=(j&15)<<2,R>=L){I.push(u[C&63]);break}j=B[R++]&255,C|=j>>6&3,I.push(u[C&63]),I.push(u[j&63])}return I.join("")}function _(B,L){var R=0,I=B.length,C=0,j=[],V,de,ne,ve,Ee,Z;if(L<=0)throw Error("Illegal len: "+L);for(;R<I-1&&C<L&&(Z=B.charCodeAt(R++),V=Z<d.length?d[Z]:-1,Z=B.charCodeAt(R++),de=Z<d.length?d[Z]:-1,!(V==-1||de==-1||(Ee=V<<2>>>0,Ee|=(de&48)>>4,j.push(f(Ee)),++C>=L||R>=I)||(Z=B.charCodeAt(R++),ne=Z<d.length?d[Z]:-1,ne==-1)||(Ee=(de&15)<<4>>>0,Ee|=(ne&60)>>2,j.push(f(Ee)),++C>=L||R>=I)));)Z=B.charCodeAt(R++),ve=Z<d.length?d[Z]:-1,Ee=(ne&3)<<6>>>0,Ee|=ve,j.push(f(Ee)),++C;var ye=[];for(R=0;R<C;R++)ye.push(j[R].charCodeAt(0));return ye}var $=function(){var B={};return B.MAX_CODEPOINT=1114111,B.encodeUTF8=function(L,R){var I=null;for(typeof L=="number"&&(I=L,L=function(){return null});I!==null||(I=L())!==null;)I<128?R(I&127):I<2048?(R(I>>6&31|192),R(I&63|128)):I<65536?(R(I>>12&15|224),R(I>>6&63|128),R(I&63|128)):(R(I>>18&7|240),R(I>>12&63|128),R(I>>6&63|128),R(I&63|128)),I=null},B.decodeUTF8=function(L,R){for(var I,C,j,V,de=function(ne){ne=ne.slice(0,ne.indexOf(null));var ve=Error(ne.toString());throw ve.name="TruncatedError",ve.bytes=ne,ve};(I=L())!==null;)if(!(I&128))R(I);else if((I&224)===192)(C=L())===null&&de([I,C]),R((I&31)<<6|C&63);else if((I&240)===224)((C=L())===null||(j=L())===null)&&de([I,C,j]),R((I&15)<<12|(C&63)<<6|j&63);else if((I&248)===240)((C=L())===null||(j=L())===null||(V=L())===null)&&de([I,C,j,V]),R((I&7)<<18|(C&63)<<12|(j&63)<<6|V&63);else throw RangeError("Illegal starting byte: "+I)},B.UTF16toUTF8=function(L,R){for(var I,C=null;(I=C!==null?C:L())!==null;){if(I>=55296&&I<=57343&&(C=L())!==null&&C>=56320&&C<=57343){R((I-55296)*1024+C-56320+65536),C=null;continue}R(I)}C!==null&&R(C)},B.UTF8toUTF16=function(L,R){var I=null;for(typeof L=="number"&&(I=L,L=function(){return null});I!==null||(I=L())!==null;)I<=65535?R(I):(I-=65536,R((I>>10)+55296),R(I%1024+56320)),I=null},B.encodeUTF16toUTF8=function(L,R){B.UTF16toUTF8(L,function(I){B.encodeUTF8(I,R)})},B.decodeUTF8toUTF16=function(L,R){B.decodeUTF8(L,function(I){B.UTF8toUTF16(I,R)})},B.calculateCodePoint=function(L){return L<128?1:L<2048?2:L<65536?3:4},B.calculateUTF8=function(L){for(var R,I=0;(R=L())!==null;)I+=B.calculateCodePoint(R);return I},B.calculateUTF16asUTF8=function(L){var R=0,I=0;return B.UTF16toUTF8(L,function(C){++R,I+=B.calculateCodePoint(C)}),[R,I]},B}();Date.now=Date.now||function(){return+new Date};var m=16,x=10,S=16,k=100,v=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],O=[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],q=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function F(B,L,R,I){var C,j=B[L],V=B[L+1];return j^=R[0],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[1],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[2],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[3],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[4],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[5],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[6],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[7],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[8],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[9],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[10],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[11],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[12],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[13],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[14],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[15],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[16],B[L]=V^R[S+1],B[L+1]=j,B}function H(B,L){for(var R=0,I=0;R<4;++R)I=I<<8|B[L]&255,L=(L+1)%B.length;return{key:I,offp:L}}function W(B,L,R){for(var I=0,C=[0,0],j=L.length,V=R.length,de,ne=0;ne<j;ne++)de=H(B,I),I=de.offp,L[ne]=L[ne]^de.key;for(ne=0;ne<j;ne+=2)C=F(C,0,L,R),L[ne]=C[0],L[ne+1]=C[1];for(ne=0;ne<V;ne+=2)C=F(C,0,L,R),R[ne]=C[0],R[ne+1]=C[1]}function J(B,L,R,I){for(var C=0,j=[0,0],V=R.length,de=I.length,ne,ve=0;ve<V;ve++)ne=H(L,C),C=ne.offp,R[ve]=R[ve]^ne.key;for(C=0,ve=0;ve<V;ve+=2)ne=H(B,C),C=ne.offp,j[0]^=ne.key,ne=H(B,C),C=ne.offp,j[1]^=ne.key,j=F(j,0,R,I),R[ve]=j[0],R[ve+1]=j[1];for(ve=0;ve<de;ve+=2)ne=H(B,C),C=ne.offp,j[0]^=ne.key,ne=H(B,C),C=ne.offp,j[1]^=ne.key,j=F(j,0,R,I),I[ve]=j[0],I[ve+1]=j[1]}function ue(B,L,R,I,C){var j=q.slice(),V=j.length,de;if(R<4||R>31)if(de=Error("Illegal number of rounds (4-31): "+R),I){c(I.bind(this,de));return}else throw de;if(L.length!==m)if(de=Error("Illegal salt length: "+L.length+" != "+m),I){c(I.bind(this,de));return}else throw de;R=1<<R>>>0;var ne,ve,Ee=0,Z;Int32Array?(ne=new Int32Array(v),ve=new Int32Array(O)):(ne=v.slice(),ve=O.slice()),J(L,B,ne,ve);function ye(){if(C&&C(Ee/R),Ee<R)for(var Be=Date.now();Ee<R&&(Ee=Ee+1,W(B,ne,ve),W(L,ne,ve),!(Date.now()-Be>k)););else{for(Ee=0;Ee<64;Ee++)for(Z=0;Z<V>>1;Z++)F(j,Z<<1,ne,ve);var Ve=[];for(Ee=0;Ee<V;Ee++)Ve.push((j[Ee]>>24&255)>>>0),Ve.push((j[Ee]>>16&255)>>>0),Ve.push((j[Ee]>>8&255)>>>0),Ve.push((j[Ee]&255)>>>0);if(I){I(null,Ve);return}else return Ve}I&&c(ye)}if(typeof I<"u")ye();else for(var Nn;;)if(typeof(Nn=ye())<"u")return Nn||[]}function Ne(B,L,R,I){var C;if(typeof B!="string"||typeof L!="string")if(C=Error("Invalid string / salt: Not a string"),R){c(R.bind(this,C));return}else throw C;var j,V;if(L.charAt(0)!=="$"||L.charAt(1)!=="2")if(C=Error("Invalid salt version: "+L.substring(0,2)),R){c(R.bind(this,C));return}else throw C;if(L.charAt(2)==="$")j="\0",V=3;else{if(j=L.charAt(2),j!=="a"&&j!=="b"&&j!=="y"||L.charAt(3)!=="$")if(C=Error("Invalid salt revision: "+L.substring(2,4)),R){c(R.bind(this,C));return}else throw C;V=4}if(L.charAt(V+2)>"$")if(C=Error("Missing salt rounds"),R){c(R.bind(this,C));return}else throw C;var de=parseInt(L.substring(V,V+1),10)*10,ne=parseInt(L.substring(V+1,V+2),10),ve=de+ne,Ee=L.substring(V+3,V+25);B+=j>="a"?"\0":"";var Z=l(B),ye=_(Ee,m);function Nn(Be){var Ve=[];return Ve.push("$2"),j>="a"&&Ve.push(j),Ve.push("$"),ve<10&&Ve.push("0"),Ve.push(ve.toString()),Ve.push("$"),Ve.push(h(ye,ye.length)),Ve.push(h(Be,q.length*4-1)),Ve.join("")}if(typeof R>"u")return Nn(ue(Z,ye,ve));ue(Z,ye,ve,function(Be,Ve){Be?R(Be,null):R(null,Nn(Ve))},I)}return e.encodeBase64=h,e.decodeBase64=_,e})})(Pm);var xw=Pm.exports;const Go=Rm(xw),$w="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Aw=t=>crypto.getRandomValues(new Uint8Array(t)),kw=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(o=e)=>{let c="";for(;;){let l=n(i),u=i;for(;u--;)if(c+=t[l[u]&r]||"",c.length===o)return c}}},Ew=(t,e=21)=>kw(t,e,Aw),He=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=$w[n[t]&63];return e};const Sw=24;function fc(){return Ew("0123456789abcdef",Sw)()}function qf(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function Nw(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await ap({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 qe(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 Qd{constructor(e,n){xe(this,"value");xe(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Qd(Math.round(this.milliseconds()*e),"ms")}}class Cw{constructor(e){xe(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 Bm(t){return await crypto.subtle.digest("SHA-256",t)}const Vf="0123456789abcdef";function su(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=Vf[i];const o=e[r]&15;n+=Vf[o]}return n}class jm{constructor(e,n){xe(this,"alphabet");xe(this,"padding");xe(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=5;)o-=5,r+=this.alphabet[i>>o&31];if(o>0&&(r+=this.alphabet[i<<5-o&31]),(n==null?void 0:n.includePadding)??!0){const 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),o=[];for(let c=0;c<i;c++){let l=0;const u=[];for(let f=0;f<8;f++){const h=e[c*8+f];if(h==="="){if(c+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 _=this.decodeMap.get(h)??null;if(_===null)throw new Error(`Invalid character: ${h}`);u.push(_)}if(l===8||l===7||l===5||l===2)throw new Error("Invalid padding");const d=(u[0]<<3)+(u[1]>>2);if(o.push(d),l<6){const f=((u[1]&3)<<6)+(u[2]<<1)+(u[3]>>4);o.push(f)}if(l<4){const f=((u[3]&255)<<4)+(u[4]>>1);o.push(f)}if(l<3){const f=((u[4]&1)<<7)+(u[5]<<2)+(u[6]>>3);o.push(f)}if(l<1){const f=((u[6]&7)<<5)+u[7];o.push(f)}}return Uint8Array.from(o)}}new jm("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new jm("0123456789ABCDEFGHIJKLMNOPQRSTUV");class Lm{constructor(e,n){xe(this,"alphabet");xe(this,"padding");xe(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=6;)o+=-6,r+=this.alphabet[i>>o&63];if(o>0&&(r+=this.alphabet[i<<6-o&63]),(n==null?void 0:n.includePadding)??!0){const 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),o=[];for(let c=0;c<i;c++){let l=0,u=0;for(let d=0;d<4;d++){const f=e[c*4+d];if(f==="="){if(c+1!==i)throw new Error(`Invalid character: ${f}`);l+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const h=this.decodeMap.get(f)??null;if(h===null)throw new Error(`Invalid character: ${f}`);u+=h<<6*(3-d)}o.push(u>>16&255),l<2&&o.push(u>>8&255),l<1&&o.push(u&255)}return Uint8Array.from(o)}}const Fm=new Lm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Pr=new Lm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function Hf(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},o={...n};(r==null?void 0:r.audiences)!==void 0&&(o.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(o.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(o.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(o.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(o.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(o.nbf=Math.floor(r.notBefore.getTime()/1e3)),o.iat=Math.floor(Date.now()/1e3);const c=new TextEncoder,l=Pr.encode(c.encode(JSON.stringify(i)),{includePadding:!1}),u=Pr.encode(c.encode(JSON.stringify(o)),{includePadding:!1}),d=c.encode([l,u].join(".")),f=await Tw(t).sign(e,d),h=Pr.encode(new Uint8Array(f),{includePadding:!1});return[l,u,h].join(".")}function Iw(t){const e=t.split(".");return e.length!==3?null:e}function ep(t){const e=Iw(t);if(!e)return null;const n=new TextDecoder,r=Pr.decode(e[0],{strict:!1}),i=Pr.decode(e[1],{strict:!1}),o=JSON.parse(n.decode(r));if(typeof o!="object"||o===null||!("alg"in o)||!Ow(o.alg)||"typ"in o&&o.typ!=="JWT")return null;const c=JSON.parse(n.decode(i));if(typeof c!="object"||c===null)return null;const l={algorithm:o.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in c){if(typeof c.exp!="number")return null;l.expiresAt=new Date(c.exp*1e3)}if("iss"in c){if(typeof c.iss!="string")return null;l.issuer=c.iss}if("sub"in c){if(typeof c.sub!="string")return null;l.subject=c.sub}if("aud"in c)if(Array.isArray(c.aud)){for(const u of c.aud)if(typeof u!="string")return null;l.audiences=c.aud}else{if(typeof c.aud!="string")return null;l.audiences=[c.aud]}if("nbf"in c){if(typeof c.nbf!="number")return null;l.notBefore=new Date(c.nbf*1e3)}if("iat"in c){if(typeof c.iat!="number")return null;l.issuedAt=new Date(c.iat*1e3)}if("jti"in c){if(typeof c.jti!="string")return null;l.jwtId=c.jti}return{value:t,header:{...o,typ:"JWT",alg:o.alg},payload:{...c},parts:e,...l}}function Tw(t){return new Cw(zw[t])}function Ow(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const zw={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function Dw(){const t=new Uint8Array(32);return crypto.getRandomValues(t),Pr.encode(t,{includePadding:!1})}function Rw(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 Pw(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await Bm(n);return Pr.encode(new Uint8Array(r),{includePadding:!1})}const Cs=60*5,hc=30*24*60*60,Si=24*60*60,Bw="auth-token",qs=30*60*1e3,jw=7*24*60*60*1e3,Lw=5*60,Fw=5*60,Uw=30*60*1e3,Mw=30*60*1e3,qw=24*60*60*1e3;function Um(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 Vw(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),o=i[0],c=i[1]??"";o&&e.set(decodeURIComponent(o),decodeURIComponent(c))}return e}function tp(t){return`${t}-${Bw}`}function Mm(t){if(!t)return;if(t==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(t))return t;const e=t.split(".");return e.length>2?`.${e.slice(-2).join(".")}`:`.${t}`}function fa(t,e){return e?Vw(e).get(tp(t)):void 0}function Hw(t,e){return Um(tp(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?Mm(e):void 0})}function ha(t,e,n){return Um(tp(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:hc,sameSite:"none",domain:n?Mm(n):void 0})}var np={},gc={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),o=function(l,u){const d=[];let f=u.exec(l);for(;f;){const h=[];h.startIndex=u.lastIndex-f[0].length;const _=f.length;for(let $=0;$<_;$++)h.push(f[$]);d.push(h),f=u.exec(l)}return d},c=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 f=Object.keys(u),h=f.length;for(let _=0;_<h;_++)d==="strict"?l[f[_]]=[u[f[_]]]:l[f[_]]=u[f[_]]}},t.getValue=function(l){return t.isExist(l)?l:""},t.isName=c,t.getAllMatches=o,t.nameRegexp=r})(gc);const rp=gc,Kw={allowBooleanAttributes:!1,unpairedTags:[]};np.validate=function(t,e){e=Object.assign({},Kw,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=Gf(t,o),o.err)return o}else if(t[o]==="<"){let c=o;if(o++,t[o]==="!"){o=Wf(t,o);continue}else{let l=!1;t[o]==="/"&&(l=!0,o++);let u="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
6
- `&&t[o]!=="\r";o++)u+=t[o];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),o--),!ev(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Ge("InvalidTag",h,ht(t,o))}const d=Xw(t,o);if(d===!1)return Ge("InvalidAttr","Attributes for '"+u+"' have open quote.",ht(t,o));let f=d.value;if(o=d.index,f[f.length-1]==="/"){const h=o-f.length;f=f.substring(0,f.length-1);const _=Xf(f,e);if(_===!0)r=!0;else return Ge(_.err.code,_.err.msg,ht(t,h+_.err.line))}else if(l)if(d.tagClosed){if(f.trim().length>0)return Ge("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ht(t,c));if(n.length===0)return Ge("InvalidTag","Closing tag '"+u+"' has not been opened.",ht(t,c));{const h=n.pop();if(u!==h.tagName){let _=ht(t,h.tagStartPos);return Ge("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+_.line+", col "+_.col+") instead of closing tag '"+u+"'.",ht(t,c))}n.length==0&&(i=!0)}}else return Ge("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ht(t,o));else{const h=Xf(f,e);if(h!==!0)return Ge(h.err.code,h.err.msg,ht(t,o-f.length+h.err.line));if(i===!0)return Ge("InvalidXml","Multiple possible root nodes found.",ht(t,o));e.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:c}),r=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Wf(t,o);continue}else if(t[o+1]==="?"){if(o=Gf(t,++o),o.err)return o}else break;else if(t[o]==="&"){const h=Zw(t,o);if(h==-1)return Ge("InvalidChar","char '&' is not expected.",ht(t,o));o=h}else if(i===!0&&!Kf(t[o]))return Ge("InvalidXml","Extra text at the end",ht(t,o));t[o]==="<"&&o--}}else{if(Kf(t[o]))continue;return Ge("InvalidChar","char '"+t[o]+"' is not expected.",ht(t,o))}if(r){if(n.length==1)return Ge("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ht(t,n[0].tagStartPos));if(n.length>0)return Ge("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ge("InvalidXml","Start tag expected.",1);return!0};function Kf(t){return t===" "||t===" "||t===`
7
- `||t==="\r"}function Gf(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 Ge("InvalidXml","XML declaration allowed only at the start of the document.",ht(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Wf(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 Gw='"',Ww="'";function Xw(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===Gw||t[e]===Ww)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 Jw=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Xf(t,e){const n=rp.getAllMatches(t,Jw),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Ge("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",oo(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Ge("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",oo(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Ge("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",oo(n[i]));const o=n[i][2];if(!Qw(o))return Ge("InvalidAttr","Attribute '"+o+"' is an invalid name.",oo(n[i]));if(!r.hasOwnProperty(o))r[o]=1;else return Ge("InvalidAttr","Attribute '"+o+"' is repeated.",oo(n[i]))}return!0}function Yw(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 Zw(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Yw(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 Ge(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Qw(t){return rp.isName(t)}function ev(t){return rp.isName(t)}function ht(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function oo(t){return t.startIndex+t[1].length}var ip={};const qm={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}},tv=function(t){return Object.assign({},qm,t)};ip.buildOptions=tv;ip.defaultOptions=qm;class nv{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 rv=nv;const iv=gc;function ov(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,o=!1,c="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(i&&cv(t,e)){e+=7;let l,u;[l,u,e]=sv(t,e+1),u.indexOf("&")===-1&&(n[pv(l)]={regx:RegExp(`&${l};`,"g"),val:u})}else if(i&&lv(t,e))e+=8;else if(i&&uv(t,e))e+=8;else if(i&&dv(t,e))e+=9;else if(av)o=!0;else throw new Error("Invalid DOCTYPE");r++,c=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:c+=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 sv(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 av(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function cv(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 lv(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 uv(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 dv(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 pv(t){if(iv.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var fv=ov;const hv=/^[-+]?0x[a-fA-F0-9]+$/,gv=/^([\-\+])?(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 mv={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function _v(t,e={}){if(e=Object.assign({},mv,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&&hv.test(n))return Number.parseInt(n,16);{const r=gv.exec(n);if(r){const i=r[1],o=r[2];let c=yv(r[3]);const l=r[4]||r[6];if(!e.leadingZeros&&o.length>0&&i&&n[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!i&&n[1]!==".")return t;{const u=Number(n),d=""+u;return d.search(/[eE]/)!==-1||l?e.eNotation?u:t:n.indexOf(".")!==-1?d==="0"&&c===""||d===c||i&&d==="-"+c?u:t:o?c===d||i+c===d?u:t:n===d||n===i+d?u:t}}else return t}}function yv(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 wv=_v;function vv(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 Vm=vv;const Hm=gc,so=rv,bv=fv,xv=wv,$v=Vm;let Av=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=kv,this.parseXml=Iv,this.parseTextData=Ev,this.resolveNameSpace=Sv,this.buildAttributesMap=Cv,this.isItStopNode=Dv,this.replaceEntitiesValue=Ov,this.readStopNodeData=Pv,this.saveTextToParentTag=zv,this.addChild=Tv,this.ignoreAttributesFn=$v(this.options.ignoreAttributes)}};function kv(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 Ev(t,e,n,r,i,o,c){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){c||(t=this.replaceEntitiesValue(t));const l=this.options.tagValueProcessor(e,t,n,i,o);return l==null?t:typeof l!=typeof t||l!==t?l:this.options.trimValues?cu(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?cu(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Sv(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 Nv=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Cv(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=Hm.getAllMatches(t,Nv),i=r.length,o={};for(let c=0;c<i;c++){const l=this.resolveNameSpace(r[c][1]);if(this.ignoreAttributesFn(l,e))continue;let u=r[c][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 f=this.options.attributeValueProcessor(l,u,e);f==null?o[d]=u:typeof f!=typeof u||f!==u?o[d]=f:o[d]=cu(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[d]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const c={};return c[this.options.attributesGroupName]=o,c}return o}}const Iv=function(t){t=t.replace(/\r\n?/g,`
8
- `);const e=new so("!xml");let n=e,r="",i="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){const l=zr(t,">",o,"Closing Tag is not closed.");let u=t.substring(o+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 f=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),n=this.tagsNodeStack.pop(),r="",o=l}else if(t[o+1]==="?"){let l=au(t,o,!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 so(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)}o=l.closeIndex+1}else if(t.substr(o+1,3)==="!--"){const l=zr(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const u=t.substring(o+4,l-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}o=l}else if(t.substr(o+1,2)==="!D"){const l=bv(t,o);this.docTypeEntities=l.entities,o=l.i}else if(t.substr(o+1,2)==="!["){const l=zr(t,"]]>",o,"CDATA is not closed.")-2,u=t.substring(o+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),o=l+2}else{let l=au(t,o,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let f=l.tagExp,h=l.attrExpPresent,_=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const $=n;if($&&this.options.unpairedTags.indexOf($.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 m="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),f=u):f=f.substr(0,f.length-1),o=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)o=l.closeIndex;else{const S=this.readStopNodeData(t,d,_+1);if(!S)throw new Error(`Unexpected end of ${d}`);o=S.i,m=S.tagContent}const x=new so(u);u!==f&&h&&(x[":@"]=this.buildAttributesMap(f,i,u)),m&&(m=this.parseTextData(m,u,i,!0,h,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),x.add(this.options.textNodeName,m),this.addChild(n,x,i)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),f=u):f=f.substr(0,f.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const m=new so(u);u!==f&&h&&(m[":@"]=this.buildAttributesMap(f,i,u)),this.addChild(n,m,i),i=i.substr(0,i.lastIndexOf("."))}else{const m=new so(u);this.tagsNodeStack.push(n),u!==f&&h&&(m[":@"]=this.buildAttributesMap(f,i,u)),this.addChild(n,m,i),n=m}r="",o=_}}else r+=t[o];return e.child};function Tv(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const Ov=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 zv(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 Dv(t,e,n){const r="*."+n;for(const i in t){const o=t[i];if(r===o||e===o)return!0}return!1}function Rv(t,e,n=">"){let r,i="";for(let o=e;o<t.length;o++){let c=t[o];if(r)c===r&&(r="");else if(c==='"'||c==="'")r=c;else if(c===n[0])if(n[1]){if(t[o+1]===n[1])return{data:i,index:o}}else return{data:i,index:o};else c===" "&&(c=" ");i+=c}}function zr(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=Rv(t,e+1,r);if(!i)return;let o=i.data;const c=i.index,l=o.search(/\s/);let u=o,d=!0;l!==-1&&(u=o.substring(0,l),o=o.substring(l+1).trimStart());const f=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:o,closeIndex:c,attrExpPresent:d,rawTagName:f}}function Pv(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const o=zr(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:o};n=o}else if(t[n+1]==="?")n=zr(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=zr(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=zr(t,"]]>",n,"StopNode is not closed.")-2;else{const o=au(t,n,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&i++,n=o.closeIndex)}}function cu(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:xv(t,n)}else return Hm.isExist(t)?t:""}var Bv=Av,Km={};function jv(t,e){return Gm(t,e)}function Gm(t,e,n){let r;const i={};for(let o=0;o<t.length;o++){const c=t[o],l=Lv(c);let u="";if(n===void 0?u=l:u=n+"."+l,l===e.textNodeName)r===void 0?r=c[l]:r+=""+c[l];else{if(l===void 0)continue;if(c[l]){let d=Gm(c[l],e,u);const f=Uv(d,e);c[":@"]?Fv(d,c[":@"],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,f)?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 Lv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Fv(t,e,n,r){if(e){const i=Object.keys(e),o=i.length;for(let c=0;c<o;c++){const l=i[c];r.isArray(l,n+"."+l,!0,!0)?t[l]=[e[l]]:t[l]=e[l]}}}function Uv(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))}Km.prettify=jv;const{buildOptions:Mv}=ip,qv=Bv,{prettify:Vv}=Km,Hv=np;let Kv=class{constructor(e){this.externalEntities={},this.options=Mv(e)}parse(e,n){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=Hv.validate(e,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const r=new qv(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Vv(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 Gv=Kv;const Wv=`
9
- `;function Xv(t,e){let n="";return e.format&&e.indentBy.length>0&&(n=Wv),Wm(t,e,"",n)}function Wm(t,e,n,r){let i="",o=!1;for(let c=0;c<t.length;c++){const l=t[c],u=Jv(l);if(u===void 0)continue;let d="";if(n.length===0?d=u:d=`${n}.${u}`,u===e.textNodeName){let m=l[u];Yv(d,e)||(m=e.tagValueProcessor(u,m),m=Xm(m,e)),o&&(i+=r),i+=m,o=!1;continue}else if(u===e.cdataPropName){o&&(i+=r),i+=`<![CDATA[${l[u][0][e.textNodeName]}]]>`,o=!1;continue}else if(u===e.commentPropName){i+=r+`<!--${l[u][0][e.textNodeName]}-->`,o=!0;continue}else if(u[0]==="?"){const m=Jf(l[":@"],e),x=u==="?xml"?"":r;let S=l[u][0][e.textNodeName];S=S.length!==0?" "+S:"",i+=x+`<${u}${S}${m}?>`,o=!0;continue}let f=r;f!==""&&(f+=e.indentBy);const h=Jf(l[":@"],e),_=r+`<${u}${h}`,$=Wm(l[u],e,d,f);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?i+=_+">":i+=_+"/>":(!$||$.length===0)&&e.suppressEmptyNode?i+=_+"/>":$&&$.endsWith(">")?i+=_+`>${$}${r}</${u}>`:(i+=_+">",$&&r!==""&&($.includes("/>")||$.includes("</"))?i+=r+e.indentBy+$+r:i+=$,i+=`</${u}>`),o=!0}return i}function Jv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&r!==":@")return r}}function Jf(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=Xm(i,e),i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function Yv(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let n=t.substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function Xm(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}var Zv=Xv;const Qv=Zv,eb=Vm,tb={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function br(t){this.options=Object.assign({},tb,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=eb(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ib),this.processTextOrObjNode=nb,this.options.format?(this.indentate=rb,this.tagEndChar=`>
5
+ */(function(e,n){typeof vw=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(sr,function(){var e={},n=null;function r(B){if(t&&t.exports)try{return pc.randomBytes(B)}catch{}try{var L;return(self.crypto||self.msCrypto).getRandomValues(L=new Uint32Array(B)),Array.prototype.slice.call(L)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(B)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(B){n=B},e.genSaltSync=function(B,L){if(B=B||x,typeof B!="number")throw Error("Illegal arguments: "+typeof B+", "+typeof L);B<4?B=4:B>31&&(B=31);var R=[];return R.push("$2a$"),B<10&&R.push("0"),R.push(B.toString()),R.push("$"),R.push(h(r(m),m)),R.join("")},e.genSalt=function(B,L,R){if(typeof L=="function"&&(R=L,L=void 0),typeof B=="function"&&(R=B,B=void 0),typeof B>"u")B=x;else if(typeof B!="number")throw Error("illegal arguments: "+typeof B);function I(C){c(function(){try{C(null,e.genSaltSync(B))}catch(j){C(j)}})}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);I(R)}else return new Promise(function(C,j){I(function(V,de){if(V){j(V);return}C(de)})})},e.hashSync=function(B,L){if(typeof L>"u"&&(L=x),typeof L=="number"&&(L=e.genSaltSync(L)),typeof B!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof B+", "+typeof L);return Ne(B,L)},e.hash=function(B,L,R,I){function C(j){typeof B=="string"&&typeof L=="number"?e.genSalt(L,function(V,de){Ne(B,de,j,I)}):typeof B=="string"&&typeof L=="string"?Ne(B,L,j,I):c(j.bind(this,Error("Illegal arguments: "+typeof B+", "+typeof L)))}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);C(R)}else return new Promise(function(j,V){C(function(de,ne){if(de){V(de);return}j(ne)})})};function o(B,L){for(var R=0,I=0,C=0,j=B.length;C<j;++C)B.charCodeAt(C)===L.charCodeAt(C)?++R:++I;return R<0?!1:I===0}e.compareSync=function(B,L){if(typeof B!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof B+", "+typeof L);return L.length!==60?!1:o(e.hashSync(B,L.substr(0,L.length-31)),L)},e.compare=function(B,L,R,I){function C(j){if(typeof B!="string"||typeof L!="string"){c(j.bind(this,Error("Illegal arguments: "+typeof B+", "+typeof L)));return}if(L.length!==60){c(j.bind(this,null,!1));return}e.hash(B,L.substr(0,29),function(V,de){V?j(V):j(null,o(de,L))},I)}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);C(R)}else return new Promise(function(j,V){C(function(de,ne){if(de){V(de);return}j(ne)})})},e.getRounds=function(B){if(typeof B!="string")throw Error("Illegal arguments: "+typeof B);return parseInt(B.split("$")[2],10)},e.getSalt=function(B){if(typeof B!="string")throw Error("Illegal arguments: "+typeof B);if(B.length!==60)throw Error("Illegal hash length: "+B.length+" != 60");return B.substring(0,29)};var c=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function l(B){var L=[],R=0;return $.encodeUTF16toUTF8(function(){return R>=B.length?null:B.charCodeAt(R++)},function(I){L.push(I)}),L}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],f=String.fromCharCode;function h(B,L){var R=0,I=[],C,j;if(L<=0||L>B.length)throw Error("Illegal len: "+L);for(;R<L;){if(C=B[R++]&255,I.push(u[C>>2&63]),C=(C&3)<<4,R>=L){I.push(u[C&63]);break}if(j=B[R++]&255,C|=j>>4&15,I.push(u[C&63]),C=(j&15)<<2,R>=L){I.push(u[C&63]);break}j=B[R++]&255,C|=j>>6&3,I.push(u[C&63]),I.push(u[j&63])}return I.join("")}function _(B,L){var R=0,I=B.length,C=0,j=[],V,de,ne,ve,Ee,Z;if(L<=0)throw Error("Illegal len: "+L);for(;R<I-1&&C<L&&(Z=B.charCodeAt(R++),V=Z<d.length?d[Z]:-1,Z=B.charCodeAt(R++),de=Z<d.length?d[Z]:-1,!(V==-1||de==-1||(Ee=V<<2>>>0,Ee|=(de&48)>>4,j.push(f(Ee)),++C>=L||R>=I)||(Z=B.charCodeAt(R++),ne=Z<d.length?d[Z]:-1,ne==-1)||(Ee=(de&15)<<4>>>0,Ee|=(ne&60)>>2,j.push(f(Ee)),++C>=L||R>=I)));)Z=B.charCodeAt(R++),ve=Z<d.length?d[Z]:-1,Ee=(ne&3)<<6>>>0,Ee|=ve,j.push(f(Ee)),++C;var ye=[];for(R=0;R<C;R++)ye.push(j[R].charCodeAt(0));return ye}var $=function(){var B={};return B.MAX_CODEPOINT=1114111,B.encodeUTF8=function(L,R){var I=null;for(typeof L=="number"&&(I=L,L=function(){return null});I!==null||(I=L())!==null;)I<128?R(I&127):I<2048?(R(I>>6&31|192),R(I&63|128)):I<65536?(R(I>>12&15|224),R(I>>6&63|128),R(I&63|128)):(R(I>>18&7|240),R(I>>12&63|128),R(I>>6&63|128),R(I&63|128)),I=null},B.decodeUTF8=function(L,R){for(var I,C,j,V,de=function(ne){ne=ne.slice(0,ne.indexOf(null));var ve=Error(ne.toString());throw ve.name="TruncatedError",ve.bytes=ne,ve};(I=L())!==null;)if(!(I&128))R(I);else if((I&224)===192)(C=L())===null&&de([I,C]),R((I&31)<<6|C&63);else if((I&240)===224)((C=L())===null||(j=L())===null)&&de([I,C,j]),R((I&15)<<12|(C&63)<<6|j&63);else if((I&248)===240)((C=L())===null||(j=L())===null||(V=L())===null)&&de([I,C,j,V]),R((I&7)<<18|(C&63)<<12|(j&63)<<6|V&63);else throw RangeError("Illegal starting byte: "+I)},B.UTF16toUTF8=function(L,R){for(var I,C=null;(I=C!==null?C:L())!==null;){if(I>=55296&&I<=57343&&(C=L())!==null&&C>=56320&&C<=57343){R((I-55296)*1024+C-56320+65536),C=null;continue}R(I)}C!==null&&R(C)},B.UTF8toUTF16=function(L,R){var I=null;for(typeof L=="number"&&(I=L,L=function(){return null});I!==null||(I=L())!==null;)I<=65535?R(I):(I-=65536,R((I>>10)+55296),R(I%1024+56320)),I=null},B.encodeUTF16toUTF8=function(L,R){B.UTF16toUTF8(L,function(I){B.encodeUTF8(I,R)})},B.decodeUTF8toUTF16=function(L,R){B.decodeUTF8(L,function(I){B.UTF8toUTF16(I,R)})},B.calculateCodePoint=function(L){return L<128?1:L<2048?2:L<65536?3:4},B.calculateUTF8=function(L){for(var R,I=0;(R=L())!==null;)I+=B.calculateCodePoint(R);return I},B.calculateUTF16asUTF8=function(L){var R=0,I=0;return B.UTF16toUTF8(L,function(C){++R,I+=B.calculateCodePoint(C)}),[R,I]},B}();Date.now=Date.now||function(){return+new Date};var m=16,x=10,S=16,k=100,v=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],O=[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],q=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function F(B,L,R,I){var C,j=B[L],V=B[L+1];return j^=R[0],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[1],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[2],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[3],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[4],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[5],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[6],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[7],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[8],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[9],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[10],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[11],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[12],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[13],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[14],C=I[j>>>24],C+=I[256|j>>16&255],C^=I[512|j>>8&255],C+=I[768|j&255],V^=C^R[15],C=I[V>>>24],C+=I[256|V>>16&255],C^=I[512|V>>8&255],C+=I[768|V&255],j^=C^R[16],B[L]=V^R[S+1],B[L+1]=j,B}function H(B,L){for(var R=0,I=0;R<4;++R)I=I<<8|B[L]&255,L=(L+1)%B.length;return{key:I,offp:L}}function W(B,L,R){for(var I=0,C=[0,0],j=L.length,V=R.length,de,ne=0;ne<j;ne++)de=H(B,I),I=de.offp,L[ne]=L[ne]^de.key;for(ne=0;ne<j;ne+=2)C=F(C,0,L,R),L[ne]=C[0],L[ne+1]=C[1];for(ne=0;ne<V;ne+=2)C=F(C,0,L,R),R[ne]=C[0],R[ne+1]=C[1]}function J(B,L,R,I){for(var C=0,j=[0,0],V=R.length,de=I.length,ne,ve=0;ve<V;ve++)ne=H(L,C),C=ne.offp,R[ve]=R[ve]^ne.key;for(C=0,ve=0;ve<V;ve+=2)ne=H(B,C),C=ne.offp,j[0]^=ne.key,ne=H(B,C),C=ne.offp,j[1]^=ne.key,j=F(j,0,R,I),R[ve]=j[0],R[ve+1]=j[1];for(ve=0;ve<de;ve+=2)ne=H(B,C),C=ne.offp,j[0]^=ne.key,ne=H(B,C),C=ne.offp,j[1]^=ne.key,j=F(j,0,R,I),I[ve]=j[0],I[ve+1]=j[1]}function ue(B,L,R,I,C){var j=q.slice(),V=j.length,de;if(R<4||R>31)if(de=Error("Illegal number of rounds (4-31): "+R),I){c(I.bind(this,de));return}else throw de;if(L.length!==m)if(de=Error("Illegal salt length: "+L.length+" != "+m),I){c(I.bind(this,de));return}else throw de;R=1<<R>>>0;var ne,ve,Ee=0,Z;Int32Array?(ne=new Int32Array(v),ve=new Int32Array(O)):(ne=v.slice(),ve=O.slice()),J(L,B,ne,ve);function ye(){if(C&&C(Ee/R),Ee<R)for(var Be=Date.now();Ee<R&&(Ee=Ee+1,W(B,ne,ve),W(L,ne,ve),!(Date.now()-Be>k)););else{for(Ee=0;Ee<64;Ee++)for(Z=0;Z<V>>1;Z++)F(j,Z<<1,ne,ve);var Ve=[];for(Ee=0;Ee<V;Ee++)Ve.push((j[Ee]>>24&255)>>>0),Ve.push((j[Ee]>>16&255)>>>0),Ve.push((j[Ee]>>8&255)>>>0),Ve.push((j[Ee]&255)>>>0);if(I){I(null,Ve);return}else return Ve}I&&c(ye)}if(typeof I<"u")ye();else for(var Nn;;)if(typeof(Nn=ye())<"u")return Nn||[]}function Ne(B,L,R,I){var C;if(typeof B!="string"||typeof L!="string")if(C=Error("Invalid string / salt: Not a string"),R){c(R.bind(this,C));return}else throw C;var j,V;if(L.charAt(0)!=="$"||L.charAt(1)!=="2")if(C=Error("Invalid salt version: "+L.substring(0,2)),R){c(R.bind(this,C));return}else throw C;if(L.charAt(2)==="$")j="\0",V=3;else{if(j=L.charAt(2),j!=="a"&&j!=="b"&&j!=="y"||L.charAt(3)!=="$")if(C=Error("Invalid salt revision: "+L.substring(2,4)),R){c(R.bind(this,C));return}else throw C;V=4}if(L.charAt(V+2)>"$")if(C=Error("Missing salt rounds"),R){c(R.bind(this,C));return}else throw C;var de=parseInt(L.substring(V,V+1),10)*10,ne=parseInt(L.substring(V+1,V+2),10),ve=de+ne,Ee=L.substring(V+3,V+25);B+=j>="a"?"\0":"";var Z=l(B),ye=_(Ee,m);function Nn(Be){var Ve=[];return Ve.push("$2"),j>="a"&&Ve.push(j),Ve.push("$"),ve<10&&Ve.push("0"),Ve.push(ve.toString()),Ve.push("$"),Ve.push(h(ye,ye.length)),Ve.push(h(Be,q.length*4-1)),Ve.join("")}if(typeof R>"u")return Nn(ue(Z,ye,ve));ue(Z,ye,ve,function(Be,Ve){Be?R(Be,null):R(null,Nn(Ve))},I)}return e.encodeBase64=h,e.decodeBase64=_,e})})(Pm);var $w=Pm.exports;const Go=Rm($w),Aw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let kw=t=>crypto.getRandomValues(new Uint8Array(t)),Ew=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(o=e)=>{let c="";for(;;){let l=n(i),u=i;for(;u--;)if(c+=t[l[u]&r]||"",c.length===o)return c}}},Sw=(t,e=21)=>Ew(t,e,kw),He=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Aw[n[t]&63];return e};const Nw=24;function fc(){return Sw("0123456789abcdef",Nw)()}function qf(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function Cw(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await ap({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 qe(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 Qd{constructor(e,n){xe(this,"value");xe(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Qd(Math.round(this.milliseconds()*e),"ms")}}class Iw{constructor(e){xe(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 Bm(t){return await crypto.subtle.digest("SHA-256",t)}const Vf="0123456789abcdef";function su(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=Vf[i];const o=e[r]&15;n+=Vf[o]}return n}class jm{constructor(e,n){xe(this,"alphabet");xe(this,"padding");xe(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=5;)o-=5,r+=this.alphabet[i>>o&31];if(o>0&&(r+=this.alphabet[i<<5-o&31]),(n==null?void 0:n.includePadding)??!0){const 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),o=[];for(let c=0;c<i;c++){let l=0;const u=[];for(let f=0;f<8;f++){const h=e[c*8+f];if(h==="="){if(c+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 _=this.decodeMap.get(h)??null;if(_===null)throw new Error(`Invalid character: ${h}`);u.push(_)}if(l===8||l===7||l===5||l===2)throw new Error("Invalid padding");const d=(u[0]<<3)+(u[1]>>2);if(o.push(d),l<6){const f=((u[1]&3)<<6)+(u[2]<<1)+(u[3]>>4);o.push(f)}if(l<4){const f=((u[3]&255)<<4)+(u[4]>>1);o.push(f)}if(l<3){const f=((u[4]&1)<<7)+(u[5]<<2)+(u[6]>>3);o.push(f)}if(l<1){const f=((u[6]&7)<<5)+u[7];o.push(f)}}return Uint8Array.from(o)}}new jm("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new jm("0123456789ABCDEFGHIJKLMNOPQRSTUV");class Lm{constructor(e,n){xe(this,"alphabet");xe(this,"padding");xe(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=6;)o+=-6,r+=this.alphabet[i>>o&63];if(o>0&&(r+=this.alphabet[i<<6-o&63]),(n==null?void 0:n.includePadding)??!0){const 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),o=[];for(let c=0;c<i;c++){let l=0,u=0;for(let d=0;d<4;d++){const f=e[c*4+d];if(f==="="){if(c+1!==i)throw new Error(`Invalid character: ${f}`);l+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const h=this.decodeMap.get(f)??null;if(h===null)throw new Error(`Invalid character: ${f}`);u+=h<<6*(3-d)}o.push(u>>16&255),l<2&&o.push(u>>8&255),l<1&&o.push(u&255)}return Uint8Array.from(o)}}const Fm=new Lm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Pr=new Lm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function Hf(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},o={...n};(r==null?void 0:r.audiences)!==void 0&&(o.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(o.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(o.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(o.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(o.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(o.nbf=Math.floor(r.notBefore.getTime()/1e3)),o.iat=Math.floor(Date.now()/1e3);const c=new TextEncoder,l=Pr.encode(c.encode(JSON.stringify(i)),{includePadding:!1}),u=Pr.encode(c.encode(JSON.stringify(o)),{includePadding:!1}),d=c.encode([l,u].join(".")),f=await Ow(t).sign(e,d),h=Pr.encode(new Uint8Array(f),{includePadding:!1});return[l,u,h].join(".")}function Tw(t){const e=t.split(".");return e.length!==3?null:e}function ep(t){const e=Tw(t);if(!e)return null;const n=new TextDecoder,r=Pr.decode(e[0],{strict:!1}),i=Pr.decode(e[1],{strict:!1}),o=JSON.parse(n.decode(r));if(typeof o!="object"||o===null||!("alg"in o)||!zw(o.alg)||"typ"in o&&o.typ!=="JWT")return null;const c=JSON.parse(n.decode(i));if(typeof c!="object"||c===null)return null;const l={algorithm:o.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in c){if(typeof c.exp!="number")return null;l.expiresAt=new Date(c.exp*1e3)}if("iss"in c){if(typeof c.iss!="string")return null;l.issuer=c.iss}if("sub"in c){if(typeof c.sub!="string")return null;l.subject=c.sub}if("aud"in c)if(Array.isArray(c.aud)){for(const u of c.aud)if(typeof u!="string")return null;l.audiences=c.aud}else{if(typeof c.aud!="string")return null;l.audiences=[c.aud]}if("nbf"in c){if(typeof c.nbf!="number")return null;l.notBefore=new Date(c.nbf*1e3)}if("iat"in c){if(typeof c.iat!="number")return null;l.issuedAt=new Date(c.iat*1e3)}if("jti"in c){if(typeof c.jti!="string")return null;l.jwtId=c.jti}return{value:t,header:{...o,typ:"JWT",alg:o.alg},payload:{...c},parts:e,...l}}function Ow(t){return new Iw(Dw[t])}function zw(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const Dw={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function Rw(){const t=new Uint8Array(32);return crypto.getRandomValues(t),Pr.encode(t,{includePadding:!1})}function Pw(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 Bw(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await Bm(n);return Pr.encode(new Uint8Array(r),{includePadding:!1})}const Cs=60*5,hc=30*24*60*60,Si=24*60*60,jw="auth-token",qs=30*60*1e3,Lw=7*24*60*60*1e3,Fw=5*60,Uw=5*60,Mw=30*60*1e3,qw=30*60*1e3,Vw=24*60*60*1e3;function Um(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 Hw(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),o=i[0],c=i[1]??"";o&&e.set(decodeURIComponent(o),decodeURIComponent(c))}return e}function tp(t){return`${t}-${jw}`}function Mm(t){if(!t)return;if(t==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(t))return t;const e=t.split(".");return e.length>2?`.${e.slice(-2).join(".")}`:`.${t}`}function fa(t,e){return e?Hw(e).get(tp(t)):void 0}function Kw(t,e){return Um(tp(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?Mm(e):void 0})}function ha(t,e,n){return Um(tp(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:hc,sameSite:"none",domain:n?Mm(n):void 0})}var np={},gc={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),o=function(l,u){const d=[];let f=u.exec(l);for(;f;){const h=[];h.startIndex=u.lastIndex-f[0].length;const _=f.length;for(let $=0;$<_;$++)h.push(f[$]);d.push(h),f=u.exec(l)}return d},c=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 f=Object.keys(u),h=f.length;for(let _=0;_<h;_++)d==="strict"?l[f[_]]=[u[f[_]]]:l[f[_]]=u[f[_]]}},t.getValue=function(l){return t.isExist(l)?l:""},t.isName=c,t.getAllMatches=o,t.nameRegexp=r})(gc);const rp=gc,Gw={allowBooleanAttributes:!1,unpairedTags:[]};np.validate=function(t,e){e=Object.assign({},Gw,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=Gf(t,o),o.err)return o}else if(t[o]==="<"){let c=o;if(o++,t[o]==="!"){o=Wf(t,o);continue}else{let l=!1;t[o]==="/"&&(l=!0,o++);let u="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
6
+ `&&t[o]!=="\r";o++)u+=t[o];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),o--),!tv(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Ge("InvalidTag",h,ht(t,o))}const d=Jw(t,o);if(d===!1)return Ge("InvalidAttr","Attributes for '"+u+"' have open quote.",ht(t,o));let f=d.value;if(o=d.index,f[f.length-1]==="/"){const h=o-f.length;f=f.substring(0,f.length-1);const _=Xf(f,e);if(_===!0)r=!0;else return Ge(_.err.code,_.err.msg,ht(t,h+_.err.line))}else if(l)if(d.tagClosed){if(f.trim().length>0)return Ge("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ht(t,c));if(n.length===0)return Ge("InvalidTag","Closing tag '"+u+"' has not been opened.",ht(t,c));{const h=n.pop();if(u!==h.tagName){let _=ht(t,h.tagStartPos);return Ge("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+_.line+", col "+_.col+") instead of closing tag '"+u+"'.",ht(t,c))}n.length==0&&(i=!0)}}else return Ge("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ht(t,o));else{const h=Xf(f,e);if(h!==!0)return Ge(h.err.code,h.err.msg,ht(t,o-f.length+h.err.line));if(i===!0)return Ge("InvalidXml","Multiple possible root nodes found.",ht(t,o));e.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:c}),r=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Wf(t,o);continue}else if(t[o+1]==="?"){if(o=Gf(t,++o),o.err)return o}else break;else if(t[o]==="&"){const h=Qw(t,o);if(h==-1)return Ge("InvalidChar","char '&' is not expected.",ht(t,o));o=h}else if(i===!0&&!Kf(t[o]))return Ge("InvalidXml","Extra text at the end",ht(t,o));t[o]==="<"&&o--}}else{if(Kf(t[o]))continue;return Ge("InvalidChar","char '"+t[o]+"' is not expected.",ht(t,o))}if(r){if(n.length==1)return Ge("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ht(t,n[0].tagStartPos));if(n.length>0)return Ge("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ge("InvalidXml","Start tag expected.",1);return!0};function Kf(t){return t===" "||t===" "||t===`
7
+ `||t==="\r"}function Gf(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 Ge("InvalidXml","XML declaration allowed only at the start of the document.",ht(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Wf(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 Ww='"',Xw="'";function Jw(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===Ww||t[e]===Xw)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 Yw=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Xf(t,e){const n=rp.getAllMatches(t,Yw),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Ge("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",oo(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Ge("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",oo(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Ge("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",oo(n[i]));const o=n[i][2];if(!ev(o))return Ge("InvalidAttr","Attribute '"+o+"' is an invalid name.",oo(n[i]));if(!r.hasOwnProperty(o))r[o]=1;else return Ge("InvalidAttr","Attribute '"+o+"' is repeated.",oo(n[i]))}return!0}function Zw(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 Qw(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Zw(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 Ge(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function ev(t){return rp.isName(t)}function tv(t){return rp.isName(t)}function ht(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function oo(t){return t.startIndex+t[1].length}var ip={};const qm={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}},nv=function(t){return Object.assign({},qm,t)};ip.buildOptions=nv;ip.defaultOptions=qm;class rv{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 iv=rv;const ov=gc;function sv(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,o=!1,c="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(i&&lv(t,e)){e+=7;let l,u;[l,u,e]=av(t,e+1),u.indexOf("&")===-1&&(n[fv(l)]={regx:RegExp(`&${l};`,"g"),val:u})}else if(i&&uv(t,e))e+=8;else if(i&&dv(t,e))e+=8;else if(i&&pv(t,e))e+=9;else if(cv)o=!0;else throw new Error("Invalid DOCTYPE");r++,c=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:c+=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 av(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 cv(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function lv(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 uv(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 dv(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 pv(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 fv(t){if(ov.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var hv=sv;const gv=/^[-+]?0x[a-fA-F0-9]+$/,mv=/^([\-\+])?(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 _v={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function yv(t,e={}){if(e=Object.assign({},_v,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&&gv.test(n))return Number.parseInt(n,16);{const r=mv.exec(n);if(r){const i=r[1],o=r[2];let c=wv(r[3]);const l=r[4]||r[6];if(!e.leadingZeros&&o.length>0&&i&&n[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!i&&n[1]!==".")return t;{const u=Number(n),d=""+u;return d.search(/[eE]/)!==-1||l?e.eNotation?u:t:n.indexOf(".")!==-1?d==="0"&&c===""||d===c||i&&d==="-"+c?u:t:o?c===d||i+c===d?u:t:n===d||n===i+d?u:t}}else return t}}function wv(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 vv=yv;function bv(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 Vm=bv;const Hm=gc,so=iv,xv=hv,$v=vv,Av=Vm;let kv=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=Ev,this.parseXml=Tv,this.parseTextData=Sv,this.resolveNameSpace=Nv,this.buildAttributesMap=Iv,this.isItStopNode=Rv,this.replaceEntitiesValue=zv,this.readStopNodeData=Bv,this.saveTextToParentTag=Dv,this.addChild=Ov,this.ignoreAttributesFn=Av(this.options.ignoreAttributes)}};function Ev(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 Sv(t,e,n,r,i,o,c){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){c||(t=this.replaceEntitiesValue(t));const l=this.options.tagValueProcessor(e,t,n,i,o);return l==null?t:typeof l!=typeof t||l!==t?l:this.options.trimValues?cu(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?cu(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Nv(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 Cv=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Iv(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=Hm.getAllMatches(t,Cv),i=r.length,o={};for(let c=0;c<i;c++){const l=this.resolveNameSpace(r[c][1]);if(this.ignoreAttributesFn(l,e))continue;let u=r[c][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 f=this.options.attributeValueProcessor(l,u,e);f==null?o[d]=u:typeof f!=typeof u||f!==u?o[d]=f:o[d]=cu(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[d]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const c={};return c[this.options.attributesGroupName]=o,c}return o}}const Tv=function(t){t=t.replace(/\r\n?/g,`
8
+ `);const e=new so("!xml");let n=e,r="",i="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){const l=zr(t,">",o,"Closing Tag is not closed.");let u=t.substring(o+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 f=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),n=this.tagsNodeStack.pop(),r="",o=l}else if(t[o+1]==="?"){let l=au(t,o,!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 so(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)}o=l.closeIndex+1}else if(t.substr(o+1,3)==="!--"){const l=zr(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const u=t.substring(o+4,l-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}o=l}else if(t.substr(o+1,2)==="!D"){const l=xv(t,o);this.docTypeEntities=l.entities,o=l.i}else if(t.substr(o+1,2)==="!["){const l=zr(t,"]]>",o,"CDATA is not closed.")-2,u=t.substring(o+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),o=l+2}else{let l=au(t,o,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let f=l.tagExp,h=l.attrExpPresent,_=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const $=n;if($&&this.options.unpairedTags.indexOf($.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 m="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),f=u):f=f.substr(0,f.length-1),o=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)o=l.closeIndex;else{const S=this.readStopNodeData(t,d,_+1);if(!S)throw new Error(`Unexpected end of ${d}`);o=S.i,m=S.tagContent}const x=new so(u);u!==f&&h&&(x[":@"]=this.buildAttributesMap(f,i,u)),m&&(m=this.parseTextData(m,u,i,!0,h,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),x.add(this.options.textNodeName,m),this.addChild(n,x,i)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),f=u):f=f.substr(0,f.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const m=new so(u);u!==f&&h&&(m[":@"]=this.buildAttributesMap(f,i,u)),this.addChild(n,m,i),i=i.substr(0,i.lastIndexOf("."))}else{const m=new so(u);this.tagsNodeStack.push(n),u!==f&&h&&(m[":@"]=this.buildAttributesMap(f,i,u)),this.addChild(n,m,i),n=m}r="",o=_}}else r+=t[o];return e.child};function Ov(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const zv=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 Dv(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 Rv(t,e,n){const r="*."+n;for(const i in t){const o=t[i];if(r===o||e===o)return!0}return!1}function Pv(t,e,n=">"){let r,i="";for(let o=e;o<t.length;o++){let c=t[o];if(r)c===r&&(r="");else if(c==='"'||c==="'")r=c;else if(c===n[0])if(n[1]){if(t[o+1]===n[1])return{data:i,index:o}}else return{data:i,index:o};else c===" "&&(c=" ");i+=c}}function zr(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=Pv(t,e+1,r);if(!i)return;let o=i.data;const c=i.index,l=o.search(/\s/);let u=o,d=!0;l!==-1&&(u=o.substring(0,l),o=o.substring(l+1).trimStart());const f=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:o,closeIndex:c,attrExpPresent:d,rawTagName:f}}function Bv(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const o=zr(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:o};n=o}else if(t[n+1]==="?")n=zr(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=zr(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=zr(t,"]]>",n,"StopNode is not closed.")-2;else{const o=au(t,n,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&i++,n=o.closeIndex)}}function cu(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:$v(t,n)}else return Hm.isExist(t)?t:""}var jv=kv,Km={};function Lv(t,e){return Gm(t,e)}function Gm(t,e,n){let r;const i={};for(let o=0;o<t.length;o++){const c=t[o],l=Fv(c);let u="";if(n===void 0?u=l:u=n+"."+l,l===e.textNodeName)r===void 0?r=c[l]:r+=""+c[l];else{if(l===void 0)continue;if(c[l]){let d=Gm(c[l],e,u);const f=Mv(d,e);c[":@"]?Uv(d,c[":@"],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,f)?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 Fv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Uv(t,e,n,r){if(e){const i=Object.keys(e),o=i.length;for(let c=0;c<o;c++){const l=i[c];r.isArray(l,n+"."+l,!0,!0)?t[l]=[e[l]]:t[l]=e[l]}}}function Mv(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))}Km.prettify=Lv;const{buildOptions:qv}=ip,Vv=jv,{prettify:Hv}=Km,Kv=np;let Gv=class{constructor(e){this.externalEntities={},this.options=qv(e)}parse(e,n){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=Kv.validate(e,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const r=new Vv(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Hv(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 Wv=Gv;const Xv=`
9
+ `;function Jv(t,e){let n="";return e.format&&e.indentBy.length>0&&(n=Xv),Wm(t,e,"",n)}function Wm(t,e,n,r){let i="",o=!1;for(let c=0;c<t.length;c++){const l=t[c],u=Yv(l);if(u===void 0)continue;let d="";if(n.length===0?d=u:d=`${n}.${u}`,u===e.textNodeName){let m=l[u];Zv(d,e)||(m=e.tagValueProcessor(u,m),m=Xm(m,e)),o&&(i+=r),i+=m,o=!1;continue}else if(u===e.cdataPropName){o&&(i+=r),i+=`<![CDATA[${l[u][0][e.textNodeName]}]]>`,o=!1;continue}else if(u===e.commentPropName){i+=r+`<!--${l[u][0][e.textNodeName]}-->`,o=!0;continue}else if(u[0]==="?"){const m=Jf(l[":@"],e),x=u==="?xml"?"":r;let S=l[u][0][e.textNodeName];S=S.length!==0?" "+S:"",i+=x+`<${u}${S}${m}?>`,o=!0;continue}let f=r;f!==""&&(f+=e.indentBy);const h=Jf(l[":@"],e),_=r+`<${u}${h}`,$=Wm(l[u],e,d,f);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?i+=_+">":i+=_+"/>":(!$||$.length===0)&&e.suppressEmptyNode?i+=_+"/>":$&&$.endsWith(">")?i+=_+`>${$}${r}</${u}>`:(i+=_+">",$&&r!==""&&($.includes("/>")||$.includes("</"))?i+=r+e.indentBy+$+r:i+=$,i+=`</${u}>`),o=!0}return i}function Yv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&r!==":@")return r}}function Jf(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=Xm(i,e),i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function Zv(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let n=t.substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function Xm(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}var Qv=Jv;const eb=Qv,tb=Vm,nb={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function br(t){this.options=Object.assign({},nb,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=tb(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ob),this.processTextOrObjNode=rb,this.options.format?(this.indentate=ib,this.tagEndChar=`>
10
10
  `,this.newLine=`
11
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}br.prototype.build=function(t){return this.options.preserveOrder?Qv(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};br.prototype.j2x=function(t,e,n){let r="",i="";const o=n.join(".");for(let c in t)if(Object.prototype.hasOwnProperty.call(t,c))if(typeof t[c]>"u")this.isAttribute(c)&&(i+="");else if(t[c]===null)this.isAttribute(c)?i+="":c[0]==="?"?i+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(t[c]instanceof Date)i+=this.buildTextValNode(t[c],c,"",e);else if(typeof t[c]!="object"){const l=this.isAttribute(c);if(l&&!this.ignoreAttributesFn(l,o))r+=this.buildAttrPairStr(l,""+t[c]);else if(!l)if(c===this.options.textNodeName){let u=this.options.tagValueProcessor(c,""+t[c]);i+=this.replaceEntitiesValue(u)}else i+=this.buildTextValNode(t[c],c,"",e)}else if(Array.isArray(t[c])){const l=t[c].length;let u="",d="";for(let f=0;f<l;f++){const h=t[c][f];if(!(typeof h>"u"))if(h===null)c[0]==="?"?i+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){const _=this.j2x(h,e+1,n.concat(c));u+=_.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(d+=_.attrStr)}else u+=this.processTextOrObjNode(h,c,e,n);else if(this.options.oneListGroup){let _=this.options.tagValueProcessor(c,h);_=this.replaceEntitiesValue(_),u+=_}else u+=this.buildTextValNode(h,c,"",e)}this.options.oneListGroup&&(u=this.buildObjectNode(u,c,d,e)),i+=u}else if(this.options.attributesGroupName&&c===this.options.attributesGroupName){const l=Object.keys(t[c]),u=l.length;for(let d=0;d<u;d++)r+=this.buildAttrPairStr(l[d],""+t[c][l[d]])}else i+=this.processTextOrObjNode(t[c],c,e,n);return{attrStr:r,val:i}};br.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function nb(t,e,n,r){const i=this.j2x(t,n+1,r.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,n):this.buildObjectNode(i.val,e,i.attrStr,n)}br.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+o+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+o+this.tagEndChar+t+this.indentate(r)+i}};br.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};br.prototype.buildTextValNode=function(t,e,n,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}};br.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function rb(t){return this.options.indentBy.repeat(t)}function ib(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var ob=br;const sb=np,ab=Gv,cb=ob;var op={XMLParser:ab,XMLValidator:sb,XMLBuilder:cb};function lb(t,e,n){const r=n?`<input type="hidden" name="RelayState" value="${n}" />`:"",i=`
11
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}br.prototype.build=function(t){return this.options.preserveOrder?eb(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};br.prototype.j2x=function(t,e,n){let r="",i="";const o=n.join(".");for(let c in t)if(Object.prototype.hasOwnProperty.call(t,c))if(typeof t[c]>"u")this.isAttribute(c)&&(i+="");else if(t[c]===null)this.isAttribute(c)?i+="":c[0]==="?"?i+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(t[c]instanceof Date)i+=this.buildTextValNode(t[c],c,"",e);else if(typeof t[c]!="object"){const l=this.isAttribute(c);if(l&&!this.ignoreAttributesFn(l,o))r+=this.buildAttrPairStr(l,""+t[c]);else if(!l)if(c===this.options.textNodeName){let u=this.options.tagValueProcessor(c,""+t[c]);i+=this.replaceEntitiesValue(u)}else i+=this.buildTextValNode(t[c],c,"",e)}else if(Array.isArray(t[c])){const l=t[c].length;let u="",d="";for(let f=0;f<l;f++){const h=t[c][f];if(!(typeof h>"u"))if(h===null)c[0]==="?"?i+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){const _=this.j2x(h,e+1,n.concat(c));u+=_.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(d+=_.attrStr)}else u+=this.processTextOrObjNode(h,c,e,n);else if(this.options.oneListGroup){let _=this.options.tagValueProcessor(c,h);_=this.replaceEntitiesValue(_),u+=_}else u+=this.buildTextValNode(h,c,"",e)}this.options.oneListGroup&&(u=this.buildObjectNode(u,c,d,e)),i+=u}else if(this.options.attributesGroupName&&c===this.options.attributesGroupName){const l=Object.keys(t[c]),u=l.length;for(let d=0;d<u;d++)r+=this.buildAttrPairStr(l[d],""+t[c][l[d]])}else i+=this.processTextOrObjNode(t[c],c,e,n);return{attrStr:r,val:i}};br.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function rb(t,e,n,r){const i=this.j2x(t,n+1,r.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,n):this.buildObjectNode(i.val,e,i.attrStr,n)}br.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+o+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+o+this.tagEndChar+t+this.indentate(r)+i}};br.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};br.prototype.buildTextValNode=function(t,e,n,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}};br.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function ib(t){return this.options.indentBy.repeat(t)}function ob(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var sb=br;const ab=np,cb=Wv,lb=sb;var op={XMLParser:cb,XMLValidator:ab,XMLBuilder:lb};function ub(t,e,n){const r=n?`<input type="hidden" name="RelayState" value="${n}" />`:"",i=`
12
12
  <!DOCTYPE html>
13
13
  <html>
14
14
  <body onload="document.forms[0].submit()">
@@ -26,7 +26,7 @@
26
26
  }};
27
27
  <\/script>
28
28
  </body>
29
- </html>`;return new Response(i,{headers:{"Content-Type":"text/html"}})}async function ub(t,e,n,r,i){var _,$,m;if(!n.redirect_uri)throw new P(400,{message:"Missing redirect_uri in authParams"});if(!r.email)throw new P(400,{message:"Missing email in user"});const[o]=await t.env.data.keys.list();if(!o)throw new P(500,{message:"No signing key found"});if(!((_=e.addons)!=null&&_.samlp))throw new P(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:c,audience:l}=e.addons.samlp,u=n.state||"";if(!c||!u||!r||!n.state)throw new P(400,{message:"Missing recipient or inResponseTo"});const d=JSON.parse(n.state),f=new URL(n.redirect_uri),h=await db(t,{issuer:t.env.ISSUER,audience:l||n.client_id,destination:f.toString(),inResponseTo:d.requestId,userId:((m=($=r.app_metadata)==null?void 0:$.vimeo)==null?void 0:m.user_id)||r.user_id,email:r.email,sessionIndex:i,signature:{privateKeyPem:o.pkcs7,cert:o.cert,kid:o.kid}});return lb(f.toString(),h,d.relayState)}async function db(t,e){const n=e.notBefore||new Date().toISOString(),r=e.notAfter||new Date(new Date(n).getTime()+10*60*1e3).toISOString(),i=e.issueInstant||n,o=e.sessionNotOnOrAfter||r,c=e.responseId||`_${He()}`,l=e.assertionId||`_${He()}`,u=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":o}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":l,"@_IssueInstant":i,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":c,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":i,"@_Version":"2.0"}}];let f=new op.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(u);if(e.signature){const _=await fetch(t.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:f,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!_.ok)throw new Error(`Failed to sign SAML response: ${_.status}`);f=await _.text()}return e.encode===!1?f:btoa(f)}var pb={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},fb=()=>{var n,r;const t=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[i,o]of Object.entries(pb))if(hb(o))return i}return typeof(t==null?void 0:t.EdgeRuntime)=="string"?"edge-light":(t==null?void 0:t.fastly)!==void 0?"fastly":((r=(n=t==null?void 0:t.process)==null?void 0:n.release)==null?void 0:r.name)==="node"?"node":"other"},hb=t=>navigator.userAgent.startsWith(t);function Pt(t,e){fb()==="workerd"&&t.executionCtx.waitUntil(e)}function lu(t,e){return`<!DOCTYPE html>
29
+ </html>`;return new Response(i,{headers:{"Content-Type":"text/html"}})}async function db(t,e,n,r,i){var _,$,m;if(!n.redirect_uri)throw new P(400,{message:"Missing redirect_uri in authParams"});if(!r.email)throw new P(400,{message:"Missing email in user"});const[o]=await t.env.data.keys.list();if(!o)throw new P(500,{message:"No signing key found"});if(!((_=e.addons)!=null&&_.samlp))throw new P(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:c,audience:l}=e.addons.samlp,u=n.state||"";if(!c||!u||!r||!n.state)throw new P(400,{message:"Missing recipient or inResponseTo"});const d=JSON.parse(n.state),f=new URL(n.redirect_uri),h=await pb(t,{issuer:t.env.ISSUER,audience:l||n.client_id,destination:f.toString(),inResponseTo:d.requestId,userId:((m=($=r.app_metadata)==null?void 0:$.vimeo)==null?void 0:m.user_id)||r.user_id,email:r.email,sessionIndex:i,signature:{privateKeyPem:o.pkcs7,cert:o.cert,kid:o.kid}});return ub(f.toString(),h,d.relayState)}async function pb(t,e){const n=e.notBefore||new Date().toISOString(),r=e.notAfter||new Date(new Date(n).getTime()+10*60*1e3).toISOString(),i=e.issueInstant||n,o=e.sessionNotOnOrAfter||r,c=e.responseId||`_${He()}`,l=e.assertionId||`_${He()}`,u=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":o}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":l,"@_IssueInstant":i,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":c,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":i,"@_Version":"2.0"}}];let f=new op.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(u);if(e.signature){const _=await fetch(t.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:f,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!_.ok)throw new Error(`Failed to sign SAML response: ${_.status}`);f=await _.text()}return e.encode===!1?f:btoa(f)}var fb={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},hb=()=>{var n,r;const t=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[i,o]of Object.entries(fb))if(gb(o))return i}return typeof(t==null?void 0:t.EdgeRuntime)=="string"?"edge-light":(t==null?void 0:t.fastly)!==void 0?"fastly":((r=(n=t==null?void 0:t.process)==null?void 0:n.release)==null?void 0:r.name)==="node"?"node":"other"},gb=t=>navigator.userAgent.startsWith(t);function Pt(t,e){hb()==="workerd"&&t.executionCtx.waitUntil(e)}function lu(t,e){return`<!DOCTYPE html>
30
30
  <html>
31
31
 
32
32
  <head>
@@ -69,7 +69,7 @@
69
69
  <\/script>
70
70
  </body>
71
71
 
72
- </html>`}const Yf=["sub","iss","aud","exp","nbf","iat","jti"];async function mc(t,e){var S,k;const{authParams:n,user:r,client:i,session_id:o}=e,l=(await t.env.data.keys.list()).filter(v=>!v.revoked_at||new Date(v.revoked_at)>new Date),u=l[l.length-1];if(!(u!=null&&u.pkcs7))throw new P(500,{message:"No signing key available"});const d=Rw(u.pkcs7),f=t.var.custom_domain?`https://${t.var.custom_domain}/`:t.env.ISSUER,h={aud:n.audience||"default",scope:n.scope||"",sub:(r==null?void 0:r.user_id)||n.client_id,iss:f,tenant_id:t.var.tenant_id,sid:o},_=r&&((S=n.scope)!=null&&S.split(" ").includes("openid"))?{aud:n.client_id,sub:r.user_id,iss:f,sid:o,nonce:n.nonce,given_name:r.given_name,family_name:r.family_name,nickname:r.nickname,picture:r.picture,locale:r.locale,name:r.name,email:r.email,email_verified:r.email_verified}:void 0;(k=t.env.hooks)!=null&&k.onExecuteCredentialsExchange&&await t.env.hooks.onExecuteCredentialsExchange({ctx:t,client:i,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:n.scope||"",grant_type:""},{accessToken:{setCustomClaim:(v,O)=>{if(Yf.includes(v))throw new Error(`Cannot overwrite reserved claim '${v}'`);h[v]=O}},idToken:{setCustomClaim:(v,O)=>{if(Yf.includes(v))throw new Error(`Cannot overwrite reserved claim '${v}'`);_&&(_[v]=O)}},access:{deny:v=>{throw new P(400,{message:`Access denied: ${v}`})}}});const $={includeIssuedTimestamp:!0,expiresIn:new Qd(1,"d"),headers:{kid:u.kid}},m=await Hf("RS256",d,h,$),x=_?await Hf("RS256",d,_,$):void 0;return{access_token:m,refresh_token:e.refresh_token,id_token:x,token_type:"Bearer",expires_in:86400}}async function uu(t,e){return{code:(await t.env.data.codes.create(e.client.tenant.id,{code_id:He(),user_id:e.user.user_id,code_type:"authorization_code",login_id:e.login_id,expires_at:new Date(Date.now()+Lw*1e3).toISOString(),code_challenge:e.authParams.code_challenge,code_challenge_method:e.authParams.code_challenge_method,redirect_uri:e.authParams.redirect_uri,state:e.authParams.state,nonce:e.authParams.nonce})).code_id,state:e.authParams.state}}async function gb(t,e){const{client:n,scope:r,audience:i=n.tenant.audience,session_id:o}=e;return await t.env.data.refreshTokens.create(n.tenant.id,{id:He(),session_id:o,client_id:n.id,idle_expires_at:new Date(Date.now()+hc*1e3).toISOString(),user_id:e.user.user_id,device:{last_ip:t.var.ip,initial_ip:t.var.ip,last_user_agent:t.var.useragent||"",initial_user_agent:t.var.useragent||"",initial_asn:"",last_asn:""},resource_servers:[{audience:i,scopes:r}],rotating:!1})}async function Jm(t,{user:e,client:n,loginSession:r}){const i=await t.env.data.sessions.create(n.tenant.id,{id:He(),user_id:e.user_id,login_session_id:r.id,idle_expires_at:new Date(Date.now()+hc*1e3).toISOString(),device:{last_ip:t.req.header("x-real-ip")||"",initial_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||"",initial_user_agent:t.req.header("user-agent")||"",initial_asn:"",last_asn:""},clients:[n.id]});return await t.env.data.loginSessions.update(n.tenant.id,r.id,{session_id:i.id}),i}async function xr(t,e){var m,x,S;const{authParams:n,user:r,client:i,ticketAuth:o}=e,c=qe(t,{type:Fe.SUCCESS_LOGIN,description:`Successful login for ${r.user_id}`,userId:r.user_id});if(Pt(t,t.env.data.logs.create(i.tenant.id,c)),Pt(t,t.env.data.users.update(i.tenant.id,r.user_id,{last_login:new Date().toISOString(),last_ip:t.req.header("x-real-ip")||"",login_count:r.login_count+1})),o){if(!e.loginSession)throw new P(500,{message:"Login session not found for ticket auth."});const k=Dw(),v=He(12),O=await t.env.data.codes.create(i.tenant.id,{code_id:He(),code_type:"ticket",login_id:e.loginSession.id,expires_at:new Date(Date.now()+Uw).toISOString(),code_verifier:[v,k].join("|"),redirect_uri:n.redirect_uri,state:n.state,nonce:n.nonce});return t.json({login_ticket:O.code_id,co_verifier:k,co_id:v})}let l=e.refreshToken,u=e.sessionId,d=r;if(!u&&((m=e.loginSession)!=null&&m.session_id)){u=e.loginSession.session_id;const k=await t.env.data.sessions.get(i.tenant.id,u);k&&!k.clients.includes(i.id)&&await t.env.data.sessions.update(i.tenant.id,u,{clients:[...k.clients,i.id]})}else if(!u){if(!e.loginSession)throw new P(500,{message:"Login session not found for creating a new session."});u=(await Jm(t,{user:d,client:i,loginSession:e.loginSession})).id;const v=await xb(t,t.env.data,i.tenant.id,r,e.loginSession,{client:i,authParams:n});if(v instanceof Response)return v;d=v}if(!l&&((x=n.scope)!=null&&x.split(" ").includes("offline_access"))&&n.response_type&&![xt.TOKEN,xt.CODE].includes(n.response_type)&&(l=(await gb(t,{user:d,client:i,session_id:u,scope:n.scope,audience:n.audience})).id),e.authParams.response_mode===Pn.SAML_POST){if(!u)throw new P(500,{message:"Session ID not available for SAML response"});return ub(t,e.client,e.authParams,d,u)}const f=n.response_type===xt.CODE?await uu(t,{user:d,client:i,authParams:n,login_id:((S=e.loginSession)==null?void 0:S.id)||""}):await mc(t,{authParams:n,user:d,client:i,session_id:u,refresh_token:l});if(n.response_mode===Pn.WEB_MESSAGE){if(!n.redirect_uri)throw new P(400,{message:"Redirect URI not allowed for WEB_MESSAGE response mode."});const k=new Headers;if(u){const q=ha(i.tenant.id,u,t.var.custom_domain||t.req.header("host")||"");q&&k.set("set-cookie",q)}else console.warn("Session ID not available for WEB_MESSAGE, cookie will not be set.");const v=new URL(n.redirect_uri),O=`${v.protocol}//${v.host}`;return t.html(lu(O,JSON.stringify({...f,state:n.state})),{headers:k})}const h=new Headers;if(u){const k=ha(i.tenant.id,u,t.var.custom_domain||t.req.header("host")||"");k&&h.set("set-cookie",k)}const _=n.response_type||xt.CODE;if(_===xt.CODE){if(!e.loginSession)throw new P(500,{message:"Login session not found for code response type."});const k=await uu(t,{user:d,client:i,authParams:n,login_id:e.loginSession.id});if(!n.redirect_uri)throw new P(400,{message:"Redirect uri not found for code response type."});const v=new URL(n.redirect_uri);return v.searchParams.set("code",k.code),k.state&&v.searchParams.set("state",k.state),h.set("location",v.toString()),new Response("Redirecting",{status:302,headers:h})}if(!n.redirect_uri)throw new P(400,{message:"Redirect uri not found for this response mode."});const $=new URL(n.redirect_uri);if(_===xt.TOKEN||_===xt.TOKEN_ID_TOKEN)if("access_token"in f)$.hash=new URLSearchParams({access_token:f.access_token,...f.id_token&&{id_token:f.id_token},token_type:f.token_type,expires_in:f.expires_in.toString(),...n.state&&{state:n.state},...n.scope&&{scope:n.scope}}).toString();else throw new P(500,{message:"Invalid token response for implicit flow."});else throw new P(500,{message:`Unsupported response type ('${_}') for redirect with tokens.`});return h.set("location",$.toString()),new Response("Redirecting",{status:302,headers:h})}async function mb(t,e,n){const r=await t.env.data.tenants.get(e);if(!r)throw new Error(`Tenant not found: ${e}`);return mc(t,{client:{id:t.env.ISSUER,tenant:r,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),name:t.env.ISSUER,disable_sign_ups:!1,connections:[]},authParams:{client_id:t.env.ISSUER,response_type:xt.TOKEN,scope:n}})}async function Ym(t,e,n){const r=await mb(t,n.tenant_id,"webhook");for await(const i of e.filter(o=>"url"in o))if(!(await fetch(i.url,{method:"POST",headers:{Authorization:`Bearer ${r.access_token}`,"Content-Type":"application/json"},body:JSON.stringify(n)})).ok){const c=qe(t,{type:Fe.FAILED_HOOK,description:`Failed to invoke hook ${i.hook_id}`});await t.env.data.logs.create(n.tenant_id,c)}}function _b(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e);return await Ym(t,r,{tenant_id:e,user:n,trigger_id:"post-user-registration"}),n}}function yb(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await Ym(t,r,{tenant_id:e,email:n,trigger_id:"pre-user-signup"})}}function Zf(t){return typeof t.form_id=="string"}async function wb(t,e,n){var u;const r=t.env.data,i=t.var.tenant_id||t.req.header("tenant-id");if(!i)throw new P(400,{message:"Missing tenant_id in context"});const o=await r.forms.get(i,e);if(!o)throw new P(404,{message:"Form not found for post-user-login hook"});let c=(u=o.start)==null?void 0:u.next_node;if(!c&&o.nodes&&o.nodes.length>0){const d=o.nodes.find(f=>f.type==="STEP");c=d==null?void 0:d.id}if(!c)throw new P(400,{message:"No start node found in form"});let l=`/u/forms/${o.id}/nodes/${c}?state=${encodeURIComponent(n.id)}`;return new Response(null,{status:302,headers:{location:l}})}function Qf(t){return typeof t.url=="string"}function vb(t,e){return async(n,r)=>{var c,l,u;const i={method:t.req.method,ip:t.req.query("x-real-ip")||"",user_agent:t.req.query("user-agent"),url:((c=t.var.loginSession)==null?void 0:c.authorization_url)||t.req.url};if((l=t.env.hooks)!=null&&l.onExecutePreUserRegistration)try{await t.env.hooks.onExecutePreUserRegistration({ctx:t,user:r,request:i},{user:{setUserMetadata:async(d,f)=>{r[d]=f}}})}catch{const f=qe(t,{type:Fe.FAILED_SIGNUP,description:"Pre user registration hook failed"});await e.logs.create(n,f)}let o=await Nw(e)(n,r);if((u=t.env.hooks)!=null&&u.onExecutePostUserRegistration)try{await t.env.hooks.onExecutePostUserRegistration({ctx:t,user:r,request:i},{user:{}})}catch{const f=qe(t,{type:Fe.FAILED_SIGNUP,description:"Post user registration hook failed"});await t.env.data.logs.create(n,f)}return await _b(t)(n,o),o}}async function bb(t,e,n,r){var i;if(e.disable_sign_ups){const o=(i=t.var.loginSession)==null?void 0:i.authorization_url;if(!(o&&new URL(o).searchParams.get("screen_hint")==="signup")&&!await ap({userAdapter:n.users,tenant_id:e.tenant.id,email:r})){const u=qe(t,{type:Fe.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.logs.create(e.tenant.id,u),new P(400,{message:"Signups are disabled for this client"})}}await yb(t)(t.var.tenant_id||"",r)}function Wo(t,e){return{...e,users:{...e.users,create:vb(t,e)}}}async function xb(t,e,n,r,i,o){var u;(u=t.env.hooks)!=null&&u.onExecutePostLogin&&(o!=null&&o.client)&&(o!=null&&o.authParams)&&await t.env.hooks.onExecutePostLogin({ctx:t,client:o.client,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:o.authParams.scope||"",grant_type:""},{prompt:{render:d=>{}}});const{hooks:c}=await e.hooks.list(n,{q:"trigger_id:post-user-login",page:0,per_page:100,include_totals:!1});if(i){const d=c.find(f=>f.enabled&&Zf(f));if(d&&Zf(d))return wb(t,d.form_id,i)}const l=c.filter(d=>d.enabled&&Qf(d));for(const d of l)if(Qf(d))try{await fetch(d.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_id:n,user:r,trigger_id:"post-user-login"})})}catch{const h=qe(t,{type:Fe.FAILED_HOOK,description:`Failed to invoke post-user-login webhook: ${d.url}`});await e.logs.create(n,h)}return r}function $b(t){return Wo(t,t.env.data)}async function sp(t,e,n){return(await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`})).users}async function Hi({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=r==="sms"?`phone_number:${n}`:`email:${n}`,{users:o}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`${i} provider:${r}`});return o.length>1&&console.error("More than one user found for same email and provider"),o[0]||null}async function ap({userAdapter:t,tenant_id:e,email:n}){var l;const{users:r}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`}),i=r.filter(u=>!(u.provider==="auth2"&&!u.email_verified));if(i.length===0)return;const o=i.filter(u=>!u.linked_to);if(o.length>0)return o.length>1&&console.error("More than one primary user found for same email"),o[0];const c=await t.get(e,(l=i[0])==null?void 0:l.linked_to);if(!c)throw new Error("Primary account not found");return c}async function Ao({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=await Hi({userAdapter:t,tenant_id:e,username:n,provider:r});return i?i.linked_to?t.get(e,i.linked_to):i:null}async function _c(t,e){const{username:n,provider:r,connection:i,client:o,userId:c,isSocial:l,profileData:u={},ip:d=""}=e;let f=await Ao({userAdapter:t.env.data.users,tenant_id:e.client.tenant.id,username:n,provider:r});if(!f){const h={user_id:`${r}|${c||fc()}`,email:i!=="sms"?n:void 0,phone_number:i==="sms"?n:void 0,name:n,provider:r,connection:i,email_verified:!0,last_ip:d,is_social:l,last_login:new Date().toISOString(),profileData:JSON.stringify(u)};f=await $b(t).users.create(o.tenant.id,h),t.set("user_id",f.user_id)}return f}const Bn=s.z.object({page:s.z.string().min(0).optional().default("0").transform(t=>parseInt(t,10)).openapi({description:"The page number where 0 is the first page"}),per_page:s.z.string().min(1).optional().default("10").transform(t=>parseInt(t,10)).openapi({description:"The number of items per page"}),include_totals:s.z.string().optional().default("false").transform(t=>t==="true").openapi({description:"If the total number of items should be included in the response"}),sort:s.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:s.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function ti(t){if(!t)return;const[e,n]=t.split(":"),r=n==="1"?"asc":"desc";if(!(!e||!r))return{sort_by:e,sort_order:r}}const e0=Kn.extend({users:s.z.array(_n)}),Ab=Kn.extend({sessions:s.z.array(dc)}),kb=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(_n),e0])}},description:"List of users"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":c}=t.req.valid("header");if(o!=null&&o.includes("identities.profileData.email")){const f=o.split("=")[1],_=(await t.env.data.users.list(c,{page:e,per_page:n,include_totals:r,q:`email:${f}`})).users.filter(x=>x.linked_to),[$]=_;if(!$)return t.json([]);const m=await t.env.data.users.get(c,$.linked_to);if(!m)throw new P(500,{message:"Primary account not found"});return t.json([_n.parse(m)])}const l=["-_exists_:linked_to"];o&&l.push(o);const u=await t.env.data.users.list(c,{page:e,per_page:n,include_totals:r,sort:ti(i),q:l.join(" ")}),d=u.users.filter(f=>!f.linked_to);return r?t.json(e0.parse({users:d,length:u.length,start:u.start,limit:u.limit})):t.json(s.z.array(_n).parse(d))}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:_n}},description:"List of users"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.users.get(n,e);if(!r)throw new P(404);if(r.linked_to)throw new P(404,{message:"User is linked to another user"});return t.json(r)}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.users.remove(n,e))throw new P(404);return t.text("OK")}).openapi(s.createRoute({tags:["users"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...aa.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:_n}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");t.set("body",n);const{email:r,phone_number:i,name:o,linked_to:c,email_verified:l,provider:u,connection:d}=n,f=`${n.provider}|${n.user_id||fc()}`;try{const h=await t.env.data.users.create(e,{email:r,user_id:f,name:o||r||i,phone_number:i,provider:u,connection:d,linked_to:c??void 0,email_verified:l||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});t.set("user_id",h.user_id);const _=qe(t,{type:Fe.SUCCESS_API_OPERATION,description:"User created"});Pt(t,t.env.data.logs.create(e,_));const $={...h,identities:[{connection:h.connection,provider:h.provider,user_id:qf(h.user_id),isSocial:h.is_social}]};return t.json(_n.parse($),{status:201})}catch(h){throw h.message==="User already exists"?new P(409,{message:"User already exists"}):h}}).openapi(s.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...aa.shape,verify_email:s.z.boolean(),password:s.z.string()}).partial()}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{var f;const{data:e}=t.env,{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json"),{user_id:i}=t.req.valid("param"),{verify_email:o,password:c,...l}=r,u=await e.users.get(n,i);if(!u)throw new P(404);if(l.email&&l.email!==u.email){const h=await sp(t.env.data.users,n,l.email);if(h.length&&h.some(_=>_.user_id!==i))throw new P(409,{message:"Another user with the same email address already exists."})}if(u.linked_to)throw new P(404,{message:"User is linked to another user"});if(await t.env.data.users.update(n,i,l),c){const h=(f=u.identities)==null?void 0:f.find(m=>m.connection==="Username-Password-Authentication");if(!h)throw new P(400,{message:"User does not have a password identity"});const _={user_id:h.user_id,password:await Go.hash(c,10),algorithm:"bcrypt"};await e.passwords.get(n,h.user_id)?await e.passwords.update(n,_):await e.passwords.create(n,_)}const d=await t.env.data.users.get(n,i);if(!d)throw new P(500);return t.json(d)}).openapi(s.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.union([s.z.object({link_with:s.z.string()}),s.z.object({user_id:s.z.string(),provider:s.z.string(),connection:s.z.string().optional()})])}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.array(s.z.object({connection:s.z.string(),provider:s.z.string(),user_id:s.z.string(),isSocial:s.z.boolean()}))}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),{user_id:r}=t.req.valid("param"),i="link_with"in n?n.link_with:n.user_id,o=await t.env.data.users.get(e,r);if(!o)throw new P(400,{message:"Linking an inexistent identity is not allowed."});await t.env.data.users.update(e,i,{linked_to:r});const c=await t.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${r}`}),l=[o,...c.users].map(u=>({connection:u.connection,provider:u.provider,user_id:qf(u.user_id),isSocial:u.is_social}));return t.json(l,{status:201})}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string(),provider:s.z.string(),linked_user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:s.z.array(_n)}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{user_id:n,provider:r,linked_user_id:i}=t.req.valid("param");await t.env.data.users.unlink(e,n,r,i);const o=await t.env.data.users.get(e,n);if(!o)throw new P(404);return t.json([_n.parse(o)])}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(dc),Ab])}},description:"List of sessions"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{include_totals:n,page:r,per_page:i}=t.req.valid("query"),{"tenant-id":o}=t.req.valid("header"),c=await t.env.data.sessions.list(o,{page:r,per_page:i,include_totals:n,q:`user_id:${e}`});return n?t.json(c):t.json(c.sessions)});/*! *****************************************************************************
72
+ </html>`}const Yf=["sub","iss","aud","exp","nbf","iat","jti"];async function mc(t,e){var S,k;const{authParams:n,user:r,client:i,session_id:o}=e,l=(await t.env.data.keys.list()).filter(v=>!v.revoked_at||new Date(v.revoked_at)>new Date),u=l[l.length-1];if(!(u!=null&&u.pkcs7))throw new P(500,{message:"No signing key available"});const d=Pw(u.pkcs7),f=t.var.custom_domain?`https://${t.var.custom_domain}/`:t.env.ISSUER,h={aud:n.audience||"default",scope:n.scope||"",sub:(r==null?void 0:r.user_id)||n.client_id,iss:f,tenant_id:t.var.tenant_id,sid:o},_=r&&((S=n.scope)!=null&&S.split(" ").includes("openid"))?{aud:n.client_id,sub:r.user_id,iss:f,sid:o,nonce:n.nonce,given_name:r.given_name,family_name:r.family_name,nickname:r.nickname,picture:r.picture,locale:r.locale,name:r.name,email:r.email,email_verified:r.email_verified}:void 0;(k=t.env.hooks)!=null&&k.onExecuteCredentialsExchange&&await t.env.hooks.onExecuteCredentialsExchange({ctx:t,client:i,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:n.scope||"",grant_type:""},{accessToken:{setCustomClaim:(v,O)=>{if(Yf.includes(v))throw new Error(`Cannot overwrite reserved claim '${v}'`);h[v]=O}},idToken:{setCustomClaim:(v,O)=>{if(Yf.includes(v))throw new Error(`Cannot overwrite reserved claim '${v}'`);_&&(_[v]=O)}},access:{deny:v=>{throw new P(400,{message:`Access denied: ${v}`})}}});const $={includeIssuedTimestamp:!0,expiresIn:new Qd(1,"d"),headers:{kid:u.kid}},m=await Hf("RS256",d,h,$),x=_?await Hf("RS256",d,_,$):void 0;return{access_token:m,refresh_token:e.refresh_token,id_token:x,token_type:"Bearer",expires_in:86400}}async function uu(t,e){return{code:(await t.env.data.codes.create(e.client.tenant.id,{code_id:He(),user_id:e.user.user_id,code_type:"authorization_code",login_id:e.login_id,expires_at:new Date(Date.now()+Fw*1e3).toISOString(),code_challenge:e.authParams.code_challenge,code_challenge_method:e.authParams.code_challenge_method,redirect_uri:e.authParams.redirect_uri,state:e.authParams.state,nonce:e.authParams.nonce})).code_id,state:e.authParams.state}}async function Jm(t,e){const{client:n,scope:r,audience:i=n.tenant.audience,session_id:o}=e;return await t.env.data.refreshTokens.create(n.tenant.id,{id:He(),session_id:o,client_id:n.id,idle_expires_at:new Date(Date.now()+hc*1e3).toISOString(),user_id:e.user.user_id,device:{last_ip:t.var.ip,initial_ip:t.var.ip,last_user_agent:t.var.useragent||"",initial_user_agent:t.var.useragent||"",initial_asn:"",last_asn:""},resource_servers:[{audience:i,scopes:r}],rotating:!1})}async function Ym(t,{user:e,client:n,loginSession:r}){const i=await t.env.data.sessions.create(n.tenant.id,{id:He(),user_id:e.user_id,login_session_id:r.id,idle_expires_at:new Date(Date.now()+hc*1e3).toISOString(),device:{last_ip:t.req.header("x-real-ip")||"",initial_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||"",initial_user_agent:t.req.header("user-agent")||"",initial_asn:"",last_asn:""},clients:[n.id]});return await t.env.data.loginSessions.update(n.tenant.id,r.id,{session_id:i.id}),i}async function xr(t,e){var m,x,S;const{authParams:n,user:r,client:i,ticketAuth:o}=e,c=qe(t,{type:Fe.SUCCESS_LOGIN,description:`Successful login for ${r.user_id}`,userId:r.user_id});if(Pt(t,t.env.data.logs.create(i.tenant.id,c)),Pt(t,t.env.data.users.update(i.tenant.id,r.user_id,{last_login:new Date().toISOString(),last_ip:t.req.header("x-real-ip")||"",login_count:r.login_count+1})),o){if(!e.loginSession)throw new P(500,{message:"Login session not found for ticket auth."});const k=Rw(),v=He(12),O=await t.env.data.codes.create(i.tenant.id,{code_id:He(),code_type:"ticket",login_id:e.loginSession.id,expires_at:new Date(Date.now()+Mw).toISOString(),code_verifier:[v,k].join("|"),redirect_uri:n.redirect_uri,state:n.state,nonce:n.nonce});return t.json({login_ticket:O.code_id,co_verifier:k,co_id:v})}let l=e.refreshToken,u=e.sessionId,d=r;if(!u&&((m=e.loginSession)!=null&&m.session_id)){u=e.loginSession.session_id;const k=await t.env.data.sessions.get(i.tenant.id,u);k&&!k.clients.includes(i.id)&&await t.env.data.sessions.update(i.tenant.id,u,{clients:[...k.clients,i.id]})}else if(!u){if(!e.loginSession)throw new P(500,{message:"Login session not found for creating a new session."});u=(await Ym(t,{user:d,client:i,loginSession:e.loginSession})).id;const v=await xb(t,t.env.data,i.tenant.id,r,e.loginSession,{client:i,authParams:n});if(v instanceof Response)return v;d=v}if(!l&&((x=n.scope)!=null&&x.split(" ").includes("offline_access"))&&n.response_type&&![xt.TOKEN,xt.CODE].includes(n.response_type)&&(l=(await Jm(t,{user:d,client:i,session_id:u,scope:n.scope,audience:n.audience})).id),e.authParams.response_mode===Pn.SAML_POST){if(!u)throw new P(500,{message:"Session ID not available for SAML response"});return db(t,e.client,e.authParams,d,u)}const f=n.response_type===xt.CODE?await uu(t,{user:d,client:i,authParams:n,login_id:((S=e.loginSession)==null?void 0:S.id)||""}):await mc(t,{authParams:n,user:d,client:i,session_id:u,refresh_token:l});if(n.response_mode===Pn.WEB_MESSAGE){if(!n.redirect_uri)throw new P(400,{message:"Redirect URI not allowed for WEB_MESSAGE response mode."});const k=new Headers;if(u){const q=ha(i.tenant.id,u,t.var.custom_domain||t.req.header("host")||"");q&&k.set("set-cookie",q)}else console.warn("Session ID not available for WEB_MESSAGE, cookie will not be set.");const v=new URL(n.redirect_uri),O=`${v.protocol}//${v.host}`;return t.html(lu(O,JSON.stringify({...f,state:n.state})),{headers:k})}const h=new Headers;if(u){const k=ha(i.tenant.id,u,t.var.custom_domain||t.req.header("host")||"");k&&h.set("set-cookie",k)}const _=n.response_type||xt.CODE;if(_===xt.CODE){if(!e.loginSession)throw new P(500,{message:"Login session not found for code response type."});const k=await uu(t,{user:d,client:i,authParams:n,login_id:e.loginSession.id});if(!n.redirect_uri)throw new P(400,{message:"Redirect uri not found for code response type."});const v=new URL(n.redirect_uri);return v.searchParams.set("code",k.code),k.state&&v.searchParams.set("state",k.state),h.set("location",v.toString()),new Response("Redirecting",{status:302,headers:h})}if(!n.redirect_uri)throw new P(400,{message:"Redirect uri not found for this response mode."});const $=new URL(n.redirect_uri);if(_===xt.TOKEN||_===xt.TOKEN_ID_TOKEN)if("access_token"in f)$.hash=new URLSearchParams({access_token:f.access_token,...f.id_token&&{id_token:f.id_token},token_type:f.token_type,expires_in:f.expires_in.toString(),...n.state&&{state:n.state},...n.scope&&{scope:n.scope}}).toString();else throw new P(500,{message:"Invalid token response for implicit flow."});else throw new P(500,{message:`Unsupported response type ('${_}') for redirect with tokens.`});return h.set("location",$.toString()),new Response("Redirecting",{status:302,headers:h})}async function mb(t,e,n){const r=await t.env.data.tenants.get(e);if(!r)throw new Error(`Tenant not found: ${e}`);return mc(t,{client:{id:t.env.ISSUER,tenant:r,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),name:t.env.ISSUER,disable_sign_ups:!1,connections:[]},authParams:{client_id:t.env.ISSUER,response_type:xt.TOKEN,scope:n}})}async function Zm(t,e,n){const r=await mb(t,n.tenant_id,"webhook");for await(const i of e.filter(o=>"url"in o))if(!(await fetch(i.url,{method:"POST",headers:{Authorization:`Bearer ${r.access_token}`,"Content-Type":"application/json"},body:JSON.stringify(n)})).ok){const c=qe(t,{type:Fe.FAILED_HOOK,description:`Failed to invoke hook ${i.hook_id}`});await t.env.data.logs.create(n.tenant_id,c)}}function _b(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e);return await Zm(t,r,{tenant_id:e,user:n,trigger_id:"post-user-registration"}),n}}function yb(t){return async(e,n)=>{const{hooks:r}=await t.env.data.hooks.list(e,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await Zm(t,r,{tenant_id:e,email:n,trigger_id:"pre-user-signup"})}}function Zf(t){return typeof t.form_id=="string"}async function wb(t,e,n){var u;const r=t.env.data,i=t.var.tenant_id||t.req.header("tenant-id");if(!i)throw new P(400,{message:"Missing tenant_id in context"});const o=await r.forms.get(i,e);if(!o)throw new P(404,{message:"Form not found for post-user-login hook"});let c=(u=o.start)==null?void 0:u.next_node;if(!c&&o.nodes&&o.nodes.length>0){const d=o.nodes.find(f=>f.type==="STEP");c=d==null?void 0:d.id}if(!c)throw new P(400,{message:"No start node found in form"});let l=`/u/forms/${o.id}/nodes/${c}?state=${encodeURIComponent(n.id)}`;return new Response(null,{status:302,headers:{location:l}})}function Qf(t){return typeof t.url=="string"}function vb(t,e){return async(n,r)=>{var c,l,u;const i={method:t.req.method,ip:t.req.query("x-real-ip")||"",user_agent:t.req.query("user-agent"),url:((c=t.var.loginSession)==null?void 0:c.authorization_url)||t.req.url};if((l=t.env.hooks)!=null&&l.onExecutePreUserRegistration)try{await t.env.hooks.onExecutePreUserRegistration({ctx:t,user:r,request:i},{user:{setUserMetadata:async(d,f)=>{r[d]=f}}})}catch{const f=qe(t,{type:Fe.FAILED_SIGNUP,description:"Pre user registration hook failed"});await e.logs.create(n,f)}let o=await Cw(e)(n,r);if((u=t.env.hooks)!=null&&u.onExecutePostUserRegistration)try{await t.env.hooks.onExecutePostUserRegistration({ctx:t,user:r,request:i},{user:{}})}catch{const f=qe(t,{type:Fe.FAILED_SIGNUP,description:"Post user registration hook failed"});await t.env.data.logs.create(n,f)}return await _b(t)(n,o),o}}async function bb(t,e,n,r){var i;if(e.disable_sign_ups){const o=(i=t.var.loginSession)==null?void 0:i.authorization_url;if(!(o&&new URL(o).searchParams.get("screen_hint")==="signup")&&!await ap({userAdapter:n.users,tenant_id:e.tenant.id,email:r})){const u=qe(t,{type:Fe.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.logs.create(e.tenant.id,u),new P(400,{message:"Signups are disabled for this client"})}}await yb(t)(t.var.tenant_id||"",r)}function Wo(t,e){return{...e,users:{...e.users,create:vb(t,e)}}}async function xb(t,e,n,r,i,o){var u;(u=t.env.hooks)!=null&&u.onExecutePostLogin&&(o!=null&&o.client)&&(o!=null&&o.authParams)&&await t.env.hooks.onExecutePostLogin({ctx:t,client:o.client,user:r,request:{ip:t.req.header("x-real-ip")||"",user_agent:t.req.header("user-agent")||"",method:t.req.method,url:t.req.url},scope:o.authParams.scope||"",grant_type:""},{prompt:{render:d=>{}}});const{hooks:c}=await e.hooks.list(n,{q:"trigger_id:post-user-login",page:0,per_page:100,include_totals:!1});if(i){const d=c.find(f=>f.enabled&&Zf(f));if(d&&Zf(d))return wb(t,d.form_id,i)}const l=c.filter(d=>d.enabled&&Qf(d));for(const d of l)if(Qf(d))try{await fetch(d.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_id:n,user:r,trigger_id:"post-user-login"})})}catch{const h=qe(t,{type:Fe.FAILED_HOOK,description:`Failed to invoke post-user-login webhook: ${d.url}`});await e.logs.create(n,h)}return r}function $b(t){return Wo(t,t.env.data)}async function sp(t,e,n){return(await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`})).users}async function Hi({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=r==="sms"?`phone_number:${n}`:`email:${n}`,{users:o}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`${i} provider:${r}`});return o.length>1&&console.error("More than one user found for same email and provider"),o[0]||null}async function ap({userAdapter:t,tenant_id:e,email:n}){var l;const{users:r}=await t.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${n}`}),i=r.filter(u=>!(u.provider==="auth2"&&!u.email_verified));if(i.length===0)return;const o=i.filter(u=>!u.linked_to);if(o.length>0)return o.length>1&&console.error("More than one primary user found for same email"),o[0];const c=await t.get(e,(l=i[0])==null?void 0:l.linked_to);if(!c)throw new Error("Primary account not found");return c}async function Ao({userAdapter:t,tenant_id:e,username:n,provider:r}){const i=await Hi({userAdapter:t,tenant_id:e,username:n,provider:r});return i?i.linked_to?t.get(e,i.linked_to):i:null}async function _c(t,e){const{username:n,provider:r,connection:i,client:o,userId:c,isSocial:l,profileData:u={},ip:d=""}=e;let f=await Ao({userAdapter:t.env.data.users,tenant_id:e.client.tenant.id,username:n,provider:r});if(!f){const h={user_id:`${r}|${c||fc()}`,email:i!=="sms"?n:void 0,phone_number:i==="sms"?n:void 0,name:n,provider:r,connection:i,email_verified:!0,last_ip:d,is_social:l,last_login:new Date().toISOString(),profileData:JSON.stringify(u)};f=await $b(t).users.create(o.tenant.id,h),t.set("user_id",f.user_id)}return f}const Bn=s.z.object({page:s.z.string().min(0).optional().default("0").transform(t=>parseInt(t,10)).openapi({description:"The page number where 0 is the first page"}),per_page:s.z.string().min(1).optional().default("10").transform(t=>parseInt(t,10)).openapi({description:"The number of items per page"}),include_totals:s.z.string().optional().default("false").transform(t=>t==="true").openapi({description:"If the total number of items should be included in the response"}),sort:s.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:s.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function ti(t){if(!t)return;const[e,n]=t.split(":"),r=n==="1"?"asc":"desc";if(!(!e||!r))return{sort_by:e,sort_order:r}}const e0=Kn.extend({users:s.z.array(_n)}),Ab=Kn.extend({sessions:s.z.array(dc)}),kb=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(_n),e0])}},description:"List of users"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":c}=t.req.valid("header");if(o!=null&&o.includes("identities.profileData.email")){const f=o.split("=")[1],_=(await t.env.data.users.list(c,{page:e,per_page:n,include_totals:r,q:`email:${f}`})).users.filter(x=>x.linked_to),[$]=_;if(!$)return t.json([]);const m=await t.env.data.users.get(c,$.linked_to);if(!m)throw new P(500,{message:"Primary account not found"});return t.json([_n.parse(m)])}const l=["-_exists_:linked_to"];o&&l.push(o);const u=await t.env.data.users.list(c,{page:e,per_page:n,include_totals:r,sort:ti(i),q:l.join(" ")}),d=u.users.filter(f=>!f.linked_to);return r?t.json(e0.parse({users:d,length:u.length,start:u.start,limit:u.limit})):t.json(s.z.array(_n).parse(d))}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:_n}},description:"List of users"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.users.get(n,e);if(!r)throw new P(404);if(r.linked_to)throw new P(404,{message:"User is linked to another user"});return t.json(r)}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.users.remove(n,e))throw new P(404);return t.text("OK")}).openapi(s.createRoute({tags:["users"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...aa.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:_n}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");t.set("body",n);const{email:r,phone_number:i,name:o,linked_to:c,email_verified:l,provider:u,connection:d}=n,f=`${n.provider}|${n.user_id||fc()}`;try{const h=await t.env.data.users.create(e,{email:r,user_id:f,name:o||r||i,phone_number:i,provider:u,connection:d,linked_to:c??void 0,email_verified:l||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});t.set("user_id",h.user_id);const _=qe(t,{type:Fe.SUCCESS_API_OPERATION,description:"User created"});Pt(t,t.env.data.logs.create(e,_));const $={...h,identities:[{connection:h.connection,provider:h.provider,user_id:qf(h.user_id),isSocial:h.is_social}]};return t.json(_n.parse($),{status:201})}catch(h){throw h.message==="User already exists"?new P(409,{message:"User already exists"}):h}}).openapi(s.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({...aa.shape,verify_email:s.z.boolean(),password:s.z.string()}).partial()}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{var f;const{data:e}=t.env,{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json"),{user_id:i}=t.req.valid("param"),{verify_email:o,password:c,...l}=r,u=await e.users.get(n,i);if(!u)throw new P(404);if(l.email&&l.email!==u.email){const h=await sp(t.env.data.users,n,l.email);if(h.length&&h.some(_=>_.user_id!==i))throw new P(409,{message:"Another user with the same email address already exists."})}if(u.linked_to)throw new P(404,{message:"User is linked to another user"});if(await t.env.data.users.update(n,i,l),c){const h=(f=u.identities)==null?void 0:f.find(m=>m.connection==="Username-Password-Authentication");if(!h)throw new P(400,{message:"User does not have a password identity"});const _={user_id:h.user_id,password:await Go.hash(c,10),algorithm:"bcrypt"};await e.passwords.get(n,h.user_id)?await e.passwords.update(n,_):await e.passwords.create(n,_)}const d=await t.env.data.users.get(n,i);if(!d)throw new P(500);return t.json(d)}).openapi(s.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.union([s.z.object({link_with:s.z.string()}),s.z.object({user_id:s.z.string(),provider:s.z.string(),connection:s.z.string().optional()})])}}},params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.array(s.z.object({connection:s.z.string(),provider:s.z.string(),user_id:s.z.string(),isSocial:s.z.boolean()}))}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),{user_id:r}=t.req.valid("param"),i="link_with"in n?n.link_with:n.user_id,o=await t.env.data.users.get(e,r);if(!o)throw new P(400,{message:"Linking an inexistent identity is not allowed."});await t.env.data.users.update(e,i,{linked_to:r});const c=await t.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${r}`}),l=[o,...c.users].map(u=>({connection:u.connection,provider:u.provider,user_id:qf(u.user_id),isSocial:u.is_social}));return t.json(l,{status:201})}).openapi(s.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string(),provider:s.z.string(),linked_user_id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:s.z.array(_n)}},description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{user_id:n,provider:r,linked_user_id:i}=t.req.valid("param");await t.env.data.users.unlink(e,n,r,i);const o=await t.env.data.users.get(e,n);if(!o)throw new P(404);return t.json([_n.parse(o)])}).openapi(s.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({user_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(dc),Ab])}},description:"List of sessions"}}}),async t=>{const{user_id:e}=t.req.valid("param"),{include_totals:n,page:r,per_page:i}=t.req.valid("query"),{"tenant-id":o}=t.req.valid("header"),c=await t.env.data.sessions.list(o,{page:r,per_page:i,include_totals:n,q:`user_id:${e}`});return n?t.json(c):t.json(c.sessions)});/*! *****************************************************************************
73
73
  Copyright (C) Microsoft. All rights reserved.
74
74
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
75
75
  this file except in compliance with the License. You may obtain a copy of the
@@ -105,9 +105,9 @@ 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 Eb="[object ArrayBuffer]";class re{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Eb}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=re.toUint8Array(e),i=re.toUint8Array(n);if(r.length!==i.byteLength)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}static concat(...e){let n;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?n=e[0]:e[e.length-1]instanceof Function?n=e.slice(0,e.length-1):n=e;let r=0;for(const c of n)r+=c.byteLength;const i=new Uint8Array(r);let o=0;for(const c of n){const l=this.toUint8Array(c);i.set(l,o),o+=l.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const El="string",Sb=/^[0-9a-f]+$/i,Nb=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Cb=/^[a-zA-Z0-9-_]+$/;class n0{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=re.toUint8Array(e);let r="";for(let o=0;o<n.length;o++)r+=String.fromCharCode(n[o]);return decodeURIComponent(escape(r))}}class gn{static toString(e,n=!1){const r=re.toArrayBuffer(e),i=new DataView(r);let o="";for(let c=0;c<r.byteLength;c+=2){const l=i.getUint16(c,n);o+=String.fromCharCode(l)}return o}static fromString(e,n=!1){const r=new ArrayBuffer(e.length*2),i=new DataView(r);for(let o=0;o<e.length;o++)i.setUint16(o*2,e.charCodeAt(o),n);return r}}class fe{static isHex(e){return typeof e===El&&Sb.test(e)}static isBase64(e){return typeof e===El&&Nb.test(e)}static isBase64Url(e){return typeof e===El&&Cb.test(e)}static ToString(e,n="utf8"){const r=re.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 gn.toString(r,!0);case"utf16":case"utf16be":return gn.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 gn.fromString(e,!0);case"utf16":case"utf16be":return gn.fromString(e);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToBase64(e){const n=re.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 n0.fromString(e);case"utf16":case"utf16be":return gn.fromString(e);case"utf16le":case"usc2":return gn.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 n0.toString(e);case"utf16":case"utf16be":return gn.toString(e);case"utf16le":case"usc2":return gn.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=re.toUint8Array(e);let r="";for(let i=0;i<n.length;i++)r+=String.fromCharCode(n[i]);return r}static ToHex(e){const n=re.toUint8Array(e);let r="";const i=n.length;for(let o=0;o<i;o++){const c=n[o];c<16&&(r+="0"),r+=c.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 o=n.slice(i,i+2);r[i/2]=parseInt(o,16)}return r.buffer}static ToUtf16String(e,n=!1){return gn.toString(e,n)}static FromUtf16String(e,n=!1){return gn.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 Ib(...t){const e=t.map(i=>i.byteLength).reduce((i,o)=>i+o),n=new Uint8Array(e);let r=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(const o of i)n[r++]=o}),n.buffer}function Zm(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 Eb="[object ArrayBuffer]";class re{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Eb}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=re.toUint8Array(e),i=re.toUint8Array(n);if(r.length!==i.byteLength)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}static concat(...e){let n;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?n=e[0]:e[e.length-1]instanceof Function?n=e.slice(0,e.length-1):n=e;let r=0;for(const c of n)r+=c.byteLength;const i=new Uint8Array(r);let o=0;for(const c of n){const l=this.toUint8Array(c);i.set(l,o),o+=l.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const El="string",Sb=/^[0-9a-f]+$/i,Nb=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Cb=/^[a-zA-Z0-9-_]+$/;class n0{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=re.toUint8Array(e);let r="";for(let o=0;o<n.length;o++)r+=String.fromCharCode(n[o]);return decodeURIComponent(escape(r))}}class gn{static toString(e,n=!1){const r=re.toArrayBuffer(e),i=new DataView(r);let o="";for(let c=0;c<r.byteLength;c+=2){const l=i.getUint16(c,n);o+=String.fromCharCode(l)}return o}static fromString(e,n=!1){const r=new ArrayBuffer(e.length*2),i=new DataView(r);for(let o=0;o<e.length;o++)i.setUint16(o*2,e.charCodeAt(o),n);return r}}class fe{static isHex(e){return typeof e===El&&Sb.test(e)}static isBase64(e){return typeof e===El&&Nb.test(e)}static isBase64Url(e){return typeof e===El&&Cb.test(e)}static ToString(e,n="utf8"){const r=re.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 gn.toString(r,!0);case"utf16":case"utf16be":return gn.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 gn.fromString(e,!0);case"utf16":case"utf16be":return gn.fromString(e);default:throw new Error(`Unknown type of encoding '${n}'`)}}static ToBase64(e){const n=re.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 n0.fromString(e);case"utf16":case"utf16be":return gn.fromString(e);case"utf16le":case"usc2":return gn.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 n0.toString(e);case"utf16":case"utf16be":return gn.toString(e);case"utf16le":case"usc2":return gn.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=re.toUint8Array(e);let r="";for(let i=0;i<n.length;i++)r+=String.fromCharCode(n[i]);return r}static ToHex(e){const n=re.toUint8Array(e);let r="";const i=n.length;for(let o=0;o<i;o++){const c=n[o];c<16&&(r+="0"),r+=c.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 o=n.slice(i,i+2);r[i/2]=parseInt(o,16)}return r.buffer}static ToUtf16String(e,n=!1){return gn.toString(e,n)}static FromUtf16String(e,n=!1){return gn.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 Ib(...t){const e=t.map(i=>i.byteLength).reduce((i,o)=>i+o),n=new Uint8Array(e);let r=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(const o of i)n[r++]=o}),n.buffer}function Qm(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
- */function Ni(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 Lr(t,e,n=-1){const r=n;let i=t,o=0,c=Math.pow(2,e);for(let l=1;l<8;l++){if(t<c){let u;if(r<0)u=new ArrayBuffer(l),o=l;else{if(r<l)return new ArrayBuffer(0);u=new ArrayBuffer(r),o=r}const d=new Uint8Array(u);for(let f=l-1;f>=0;f--){const h=Math.pow(2,f*e);d[o-f-1]=Math.floor(i/h),i-=d[o-f-1]*h}return u}c*=Math.pow(2,e)}return new ArrayBuffer(0)}function du(...t){let e=0,n=0;for(const o of t)e+=o.length;const r=new ArrayBuffer(e),i=new Uint8Array(r);for(const o of t)i.set(o,n),n+=o.length;return i}function Qm(){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=Ni(n,8),i=new ArrayBuffer(this.valueHex.byteLength),o=new Uint8Array(i);for(let l=0;l<this.valueHex.byteLength;l++)o[l]=t[l];return o[0]&=127,Ni(o,8)-r}function Tb(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 c=n-e,l=Lr(c,8,r),u=new Uint8Array(l);return u[0]|=128,l}let i=Lr(e,8,r),o=new Uint8Array(i);if(o[0]&128){const c=i.slice(0),l=new Uint8Array(c);i=new ArrayBuffer(i.byteLength+1),o=new Uint8Array(i);for(let u=0;u<c.byteLength;u++)o[u+1]=l[u];o[0]=0}return i}n*=Math.pow(2,8)}return new ArrayBuffer(0)}function Ob(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 Rt(t,e){const n=t.toString(10);if(e<n.length)return"";const r=e-n.length,i=new Array(r);for(let c=0;c<r;c++)i[c]="0";return i.join("").concat(n)}/*!
110
+ */function Ni(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 Lr(t,e,n=-1){const r=n;let i=t,o=0,c=Math.pow(2,e);for(let l=1;l<8;l++){if(t<c){let u;if(r<0)u=new ArrayBuffer(l),o=l;else{if(r<l)return new ArrayBuffer(0);u=new ArrayBuffer(r),o=r}const d=new Uint8Array(u);for(let f=l-1;f>=0;f--){const h=Math.pow(2,f*e);d[o-f-1]=Math.floor(i/h),i-=d[o-f-1]*h}return u}c*=Math.pow(2,e)}return new ArrayBuffer(0)}function du(...t){let e=0,n=0;for(const o of t)e+=o.length;const r=new ArrayBuffer(e),i=new Uint8Array(r);for(const o of t)i.set(o,n),n+=o.length;return i}function e2(){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=Ni(n,8),i=new ArrayBuffer(this.valueHex.byteLength),o=new Uint8Array(i);for(let l=0;l<this.valueHex.byteLength;l++)o[l]=t[l];return o[0]&=127,Ni(o,8)-r}function Tb(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 c=n-e,l=Lr(c,8,r),u=new Uint8Array(l);return u[0]|=128,l}let i=Lr(e,8,r),o=new Uint8Array(i);if(o[0]&128){const c=i.slice(0),l=new Uint8Array(c);i=new ArrayBuffer(i.byteLength+1),o=new Uint8Array(i);for(let u=0;u<c.byteLength;u++)o[u+1]=l[u];o[0]=0}return i}n*=Math.pow(2,8)}return new ArrayBuffer(0)}function Ob(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 Rt(t,e){const n=t.toString(10);if(e<n.length)return"";const r=e-n.length,i=new Array(r);for(let c=0;c<r;c++)i[c]="0";return i.join("").concat(n)}/*!
111
111
  * Copyright (c) 2014, GMO GlobalSign
112
112
  * Copyright (c) 2015-2022, Peculiar Ventures
113
113
  * All rights reserved.
@@ -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 ga(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function cp(t){let e=0,n=0;for(let i=0;i<t.length;i++){const o=t[i];e+=o.byteLength}const r=new Uint8Array(e);for(let i=0;i<t.length;i++){const o=t[i];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function Gn(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 yc{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return cp(this.items)}}const ao=[new Uint8Array([1])],r0="0123456789",Sl="name",i0="valueHexView",zb="isHexOnly",Db="idBlock",Rb="tagClass",Pb="tagNumber",Bb="isConstructed",jb="fromBER",Lb="toBER",Fb="local",$t="",un=new ArrayBuffer(0),wc=new Uint8Array(0),ko="EndOfContent",e2="OCTET STRING",t2="BIT STRING";function An(t){var e;return e=class extends t{constructor(...r){var i;super(...r);const o=r[0]||{};this.isHexOnly=(i=o.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=o.valueHex?re.toUint8Array(o.valueHex):wc}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(r){this.valueHexView=new Uint8Array(r)}fromBER(r,i,o){const c=r instanceof ArrayBuffer?new Uint8Array(r):r;if(!Gn(this,c,i,o))return-1;const l=i+o;return this.valueHexView=c.subarray(i,l),this.valueHexView.length?(this.blockLength=o,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",un)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:fe.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class ni{constructor({blockLength:e=0,error:n=$t,warnings:r=[],valueBeforeDecode:i=wc}={}){this.blockLength=e,this.error=n,this.warnings=r,this.valueBeforeDecodeView=re.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:fe.ToHex(this.valueBeforeDecodeView)}}}ni.NAME="baseBlock";class mt extends ni{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'")}}mt.NAME="valueBlock";class n2 extends An(ni){constructor({idBlock:e={}}={}){var n,r,i,o;super(),e?(this.isHexOnly=(n=e.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=e.valueHex?re.toUint8Array(e.valueHex):wc,this.tagClass=(r=e.tagClass)!==null&&r!==void 0?r:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let n=0;switch(this.tagClass){case 1:n|=0;break;case 2:n|=64;break;case 3:n|=128;break;case 4:n|=192;break;default:return this.error="Unknown tag class",un}if(this.isConstructed&&(n|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,n|=o,i[0]=n}return i.buffer}if(!this.isHexOnly){const i=Lr(this.tagNumber,7),o=new Uint8Array(i),c=i.byteLength,l=new Uint8Array(c+1);if(l[0]=n|31,!e){for(let u=0;u<c-1;u++)l[u+1]=o[u]|128;l[c]=o[c-1]}return l.buffer}const r=new Uint8Array(this.valueHexView.byteLength+1);if(r[0]=n|31,!e){const i=this.valueHexView;for(let o=0;o<i.length-1;o++)r[o+1]=i[o]|128;r[this.valueHexView.byteLength]=i[i.length-1]}return r.buffer}fromBER(e,n,r){const i=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(o[0]&32)===32,this.isHexOnly=!1;const l=o[0]&31;if(l!==31)this.tagNumber=l,this.blockLength=1;else{let u=1,d=this.valueHexView=new Uint8Array(255),f=255;for(;o[u]&128;){if(d[u-1]=o[u]&127,u++,u>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(u===f){f+=255;const _=new Uint8Array(f);for(let $=0;$<d.length;$++)_[$]=d[$];d=this.valueHexView=new Uint8Array(f)}}this.blockLength=u+1,d[u-1]=o[u]&127;const h=new Uint8Array(u);for(let _=0;_<u;_++)h[_]=d[_];d=this.valueHexView=new Uint8Array(u),d.set(h),this.blockLength<=9?this.tagNumber=Ni(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}}}n2.NAME="identificationBlock";class r2 extends ni{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=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,n+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,n+this.blockLength;const c=o[0]&127;if(c>8)return this.error="Too big integer",-1;if(c+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const l=n+1,u=i.subarray(l,l+c);return u[c-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Ni(u,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=c+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=Lr(this.length,8);if(i.byteLength>127)return this.error="Too big length",un;if(n=new ArrayBuffer(i.byteLength+1),e)return n;const o=new Uint8Array(i);r=new Uint8Array(n),r[0]=i.byteLength|128;for(let c=0;c<i.byteLength;c++)r[c+1]=o[c];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}}}r2.NAME="lengthBlock";const le={};class ct extends ni{constructor({name:e=$t,optional:n=!1,primitiveSchema:r,...i}={},o){super(i),this.name=e,this.optional=n,r&&(this.primitiveSchema=r),this.idBlock=new n2(i),this.lenBlock=new r2(i),this.valueBlock=o?new o(i):new mt(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 yc;n||i2(this);const i=this.idBlock.toBER(e);if(r.write(i),this.lenBlock.isIndefiniteForm)r.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,r),r.write(new ArrayBuffer(2));else{const o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;const c=this.lenBlock.toBER(e);r.write(c),r.write(o)}return n?un: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(){return`${this.constructor.NAME} : ${fe.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const n=this.toBER(),r=e.toBER();return Ob(n,r)}}ct.NAME="BaseBlock";function i2(t){if(t instanceof le.Constructed)for(const e of t.valueBlock.value)i2(e)&&(t.lenBlock.isIndefiniteForm=!0);return!!t.lenBlock.isIndefiniteForm}class lp extends ct{constructor({value:e=$t,...n}={},r){super(n,r),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,n,r){const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}lp.NAME="BaseStringBlock";class o2 extends An(mt){constructor({isHexOnly:e=!0,...n}={}){super(n),this.isHexOnly=e}}o2.NAME="PrimitiveValueBlock";var s2;class Xo extends ct{constructor(e={}){super(e,o2),this.idBlock.isConstructed=!1}}s2=Xo;le.Primitive=s2;Xo.NAME="PRIMITIVE";function Ub(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 Ki(t,e=0,n=t.length){const r=e;let i=new ct({},mt);const o=new ni;if(!Gn(o,t,e,n))return i.error=o.error,{offset:-1,result:i};if(!t.subarray(e,e+n).length)return i.error="Zero buffer length",{offset:-1,result:i};let 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=ct;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=Ub(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 $i(t){if(!t.byteLength){const e=new ct({},mt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Ki(re.toUint8Array(t).slice(),0,t.byteLength)}function Mb(t,e){return t?1:e}class lr extends mt{constructor({value:e=[],isIndefiniteForm:n=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=n}fromBER(e,n,r){const i=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;if(this.valueBeforeDecodeView=i.subarray(n,n+r),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),n;let o=n;for(;Mb(this.isIndefiniteForm,r)>0;){const c=Ki(i,o,r);if(c.offset===-1)return this.error=c.result.error,this.warnings.concat(c.result.warnings),-1;if(o=c.offset,this.blockLength+=c.result.blockLength,r-=c.result.blockLength,this.value.push(c.result),this.isIndefiniteForm&&c.result.constructor.NAME===ko)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ko?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,n){const r=n||new yc;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,r);return n?un:r.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const n of this.value)e.value.push(n.toJSON());return e}}lr.NAME="ConstructedValueBlock";var a2;class kt extends ct{constructor(e={}){super(e,lr),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 ga(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function cp(t){let e=0,n=0;for(let i=0;i<t.length;i++){const o=t[i];e+=o.byteLength}const r=new Uint8Array(e);for(let i=0;i<t.length;i++){const o=t[i];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function Gn(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 yc{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return cp(this.items)}}const ao=[new Uint8Array([1])],r0="0123456789",Sl="name",i0="valueHexView",zb="isHexOnly",Db="idBlock",Rb="tagClass",Pb="tagNumber",Bb="isConstructed",jb="fromBER",Lb="toBER",Fb="local",$t="",un=new ArrayBuffer(0),wc=new Uint8Array(0),ko="EndOfContent",t2="OCTET STRING",n2="BIT STRING";function An(t){var e;return e=class extends t{constructor(...r){var i;super(...r);const o=r[0]||{};this.isHexOnly=(i=o.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=o.valueHex?re.toUint8Array(o.valueHex):wc}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(r){this.valueHexView=new Uint8Array(r)}fromBER(r,i,o){const c=r instanceof ArrayBuffer?new Uint8Array(r):r;if(!Gn(this,c,i,o))return-1;const l=i+o;return this.valueHexView=c.subarray(i,l),this.valueHexView.length?(this.blockLength=o,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",un)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:fe.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class ni{constructor({blockLength:e=0,error:n=$t,warnings:r=[],valueBeforeDecode:i=wc}={}){this.blockLength=e,this.error=n,this.warnings=r,this.valueBeforeDecodeView=re.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:fe.ToHex(this.valueBeforeDecodeView)}}}ni.NAME="baseBlock";class mt extends ni{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'")}}mt.NAME="valueBlock";class r2 extends An(ni){constructor({idBlock:e={}}={}){var n,r,i,o;super(),e?(this.isHexOnly=(n=e.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=e.valueHex?re.toUint8Array(e.valueHex):wc,this.tagClass=(r=e.tagClass)!==null&&r!==void 0?r:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let n=0;switch(this.tagClass){case 1:n|=0;break;case 2:n|=64;break;case 3:n|=128;break;case 4:n|=192;break;default:return this.error="Unknown tag class",un}if(this.isConstructed&&(n|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,n|=o,i[0]=n}return i.buffer}if(!this.isHexOnly){const i=Lr(this.tagNumber,7),o=new Uint8Array(i),c=i.byteLength,l=new Uint8Array(c+1);if(l[0]=n|31,!e){for(let u=0;u<c-1;u++)l[u+1]=o[u]|128;l[c]=o[c-1]}return l.buffer}const r=new Uint8Array(this.valueHexView.byteLength+1);if(r[0]=n|31,!e){const i=this.valueHexView;for(let o=0;o<i.length-1;o++)r[o+1]=i[o]|128;r[this.valueHexView.byteLength]=i[i.length-1]}return r.buffer}fromBER(e,n,r){const i=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(o[0]&32)===32,this.isHexOnly=!1;const l=o[0]&31;if(l!==31)this.tagNumber=l,this.blockLength=1;else{let u=1,d=this.valueHexView=new Uint8Array(255),f=255;for(;o[u]&128;){if(d[u-1]=o[u]&127,u++,u>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(u===f){f+=255;const _=new Uint8Array(f);for(let $=0;$<d.length;$++)_[$]=d[$];d=this.valueHexView=new Uint8Array(f)}}this.blockLength=u+1,d[u-1]=o[u]&127;const h=new Uint8Array(u);for(let _=0;_<u;_++)h[_]=d[_];d=this.valueHexView=new Uint8Array(u),d.set(h),this.blockLength<=9?this.tagNumber=Ni(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}}}r2.NAME="identificationBlock";class i2 extends ni{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=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,n+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,n+this.blockLength;const c=o[0]&127;if(c>8)return this.error="Too big integer",-1;if(c+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const l=n+1,u=i.subarray(l,l+c);return u[c-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Ni(u,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=c+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=Lr(this.length,8);if(i.byteLength>127)return this.error="Too big length",un;if(n=new ArrayBuffer(i.byteLength+1),e)return n;const o=new Uint8Array(i);r=new Uint8Array(n),r[0]=i.byteLength|128;for(let c=0;c<i.byteLength;c++)r[c+1]=o[c];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}}}i2.NAME="lengthBlock";const le={};class ct extends ni{constructor({name:e=$t,optional:n=!1,primitiveSchema:r,...i}={},o){super(i),this.name=e,this.optional=n,r&&(this.primitiveSchema=r),this.idBlock=new r2(i),this.lenBlock=new i2(i),this.valueBlock=o?new o(i):new mt(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 yc;n||o2(this);const i=this.idBlock.toBER(e);if(r.write(i),this.lenBlock.isIndefiniteForm)r.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,r),r.write(new ArrayBuffer(2));else{const o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;const c=this.lenBlock.toBER(e);r.write(c),r.write(o)}return n?un: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(){return`${this.constructor.NAME} : ${fe.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const n=this.toBER(),r=e.toBER();return Ob(n,r)}}ct.NAME="BaseBlock";function o2(t){if(t instanceof le.Constructed)for(const e of t.valueBlock.value)o2(e)&&(t.lenBlock.isIndefiniteForm=!0);return!!t.lenBlock.isIndefiniteForm}class lp extends ct{constructor({value:e=$t,...n}={},r){super(n,r),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,n,r){const i=this.valueBlock.fromBER(e,n,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}lp.NAME="BaseStringBlock";class s2 extends An(mt){constructor({isHexOnly:e=!0,...n}={}){super(n),this.isHexOnly=e}}s2.NAME="PrimitiveValueBlock";var a2;class Xo extends ct{constructor(e={}){super(e,s2),this.idBlock.isConstructed=!1}}a2=Xo;le.Primitive=a2;Xo.NAME="PRIMITIVE";function Ub(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 Ki(t,e=0,n=t.length){const r=e;let i=new ct({},mt);const o=new ni;if(!Gn(o,t,e,n))return i.error=o.error,{offset:-1,result:i};if(!t.subarray(e,e+n).length)return i.error="Zero buffer length",{offset:-1,result:i};let 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=ct;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=Ub(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 $i(t){if(!t.byteLength){const e=new ct({},mt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Ki(re.toUint8Array(t).slice(),0,t.byteLength)}function Mb(t,e){return t?1:e}class lr extends mt{constructor({value:e=[],isIndefiniteForm:n=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=n}fromBER(e,n,r){const i=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;if(this.valueBeforeDecodeView=i.subarray(n,n+r),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),n;let o=n;for(;Mb(this.isIndefiniteForm,r)>0;){const c=Ki(i,o,r);if(c.offset===-1)return this.error=c.result.error,this.warnings.concat(c.result.warnings),-1;if(o=c.offset,this.blockLength+=c.result.blockLength,r-=c.result.blockLength,this.value.push(c.result),this.isIndefiniteForm&&c.result.constructor.NAME===ko)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ko?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,n){const r=n||new yc;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,r);return n?un:r.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const n of this.value)e.value.push(n.toJSON());return e}}lr.NAME="ConstructedValueBlock";var c2;class kt extends ct{constructor(e={}){super(e,lr),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} :`}}a2=kt;le.Constructed=a2;kt.NAME="CONSTRUCTED";class c2 extends mt{fromBER(e,n,r){return n}toBER(e){return un}}c2.override="EndOfContentValueBlock";var l2;class up extends ct{constructor(e={}){super(e,c2),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}l2=up;le.EndOfContent=l2;up.NAME=ko;var u2;class Fr extends ct{constructor(e={}){super(e,mt),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}`}}u2=Fr;le.Null=u2;Fr.NAME="NULL";class d2 extends An(mt){constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=re.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,n,r){const i=re.toUint8Array(e);return Gn(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,Qm.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}d2.NAME="BooleanValueBlock";var p2;let vc=class extends ct{constructor(e={}){super(e,d2),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};p2=vc;le.Boolean=p2;vc.NAME="BOOLEAN";class f2 extends An(lr){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=lr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let o=0;o<this.value.length;o++){const c=this.value[o].constructor.NAME;if(c===ko){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==e2)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?lr.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}f2.NAME="OctetStringValueBlock";var h2;let Br=class g2 extends ct{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},f2),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,n,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,r===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),n;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(o.byteLength){const c=Ki(o,0,o.byteLength);c.offset!==-1&&c.offset===r&&(this.valueBlock.value=[c.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?kt.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${fe.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof g2&&e.push(n.valueBlock.valueHexView);return re.concat(e)}};h2=Br;le.OctetString=h2;Br.NAME=e2;class m2 extends An(lr){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=lr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const l of this.value){const u=l.constructor.NAME;if(u===ko){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==t2)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 o=re.toUint8Array(e);if(!Gn(this,o,n,r))return-1;const c=o.subarray(n,n+r);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const l=c.subarray(1);try{if(l.byteLength){const u=Ki(l,0,l.byteLength);u.offset!==-1&&u.offset===r-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,n+r}toBER(e,n){if(this.isConstructed)return lr.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return un;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}}}m2.NAME="BitStringValueBlock";var _2;let jr=class extends ct{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},m2),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 kt.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const i of n)e.push(i.toString(2).padStart(8,"0"));const r=e.join("");return`${this.constructor.NAME} : ${r.substring(0,r.length-this.valueBlock.unusedBits)}`}}};_2=jr;le.BitString=_2;jr.NAME=t2;var y2;function qb(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let o=r.slice(0);const c=o.length-1,l=i.slice(0),u=l.length-1;let d=0;const f=u<c?c:u;let h=0;for(let _=f;_>=0;_--,h++){switch(!0){case h<l.length:d=o[c-h]+l[u-h]+n[0];break;default:d=o[c-h]+n[0]}switch(n[0]=d/10,!0){case h>=o.length:o=du(new Uint8Array([d%10]),o);break;default:o[c-h]=d%10}}return n[0]>0&&(o=du(n,o)),o}function o0(t){if(t>=ao.length)for(let e=ao.length;e<=t;e++){const n=new Uint8Array([0]);let r=ao[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const o=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=o[0]/10,r[i]=o[0]%10}n[0]>0&&(r=du(n,r)),ao.push(r)}return ao[t]}function Vb(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),o=r.slice(0),c=o.length-1,l=i.slice(0),u=l.length-1;let d,f=0;for(let h=u;h>=0;h--,f++)switch(d=o[c-f]-l[u-f]-n,!0){case d<0:n=1,o[c-f]=d+10;break;default:n=0,o[c-f]=d}if(n>0)for(let h=c-u+1;h>=0;h--,f++)if(d=o[c-f]-n,d<0)n=1,o[c-f]=d+10;else{n=0,o[c-f]=d;break}return o.slice()}class dp extends An(mt){constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=Qm.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Tb(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const o=this.fromBER(e,n,r);if(o===-1)return o;const c=this.valueHexView;return c[0]===0&&c[1]&128?this.valueHexView=c.subarray(1):i!==0&&c.length<i&&(i-c.length>1&&(i=c.length+1),this.valueHexView=c.subarray(i-c.length)),o}toDER(e=!1){const n=this.valueHexView;switch(!0){case(n[0]&128)!==0:{const r=new Uint8Array(this.valueHexView.length+1);r[0]=0,r.set(n,1),this.valueHexView=r}break;case(n[0]===0&&(n[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,n,r){const i=super.fromBER(e,n,r);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let n=new Uint8Array(this.valueHexView.length*8/3),r=0,i;const o=this.valueHexView;let c="",l=!1;for(let u=o.byteLength-1;u>=0;u--){i=o[u];for(let d=0;d<8;d++){if((i&1)===1)switch(r){case e:n=Vb(o0(r),n),c="-";break;default:n=qb(n,o0(r))}r++,i>>=1}}for(let u=0;u<n.length;u++)n[u]&&(l=!0),l&&(c+=r0.charAt(n[u]));return l===!1&&(c+=r0.charAt(0)),c}}y2=dp;dp.NAME="IntegerValueBlock";Object.defineProperty(y2.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var w2;class vn extends ct{constructor(e={}){super(e,dp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return ga(),BigInt(this.valueBlock.toString())}static fromBigInt(e){ga();const n=BigInt(e),r=new yc,i=n.toString(16).replace(/^-/,""),o=new Uint8Array(fe.FromHex(i));if(n<0){const l=new Uint8Array(o.length+(o[0]&128?1:0));l[0]|=128;const d=BigInt(`0x${fe.ToHex(l)}`)+n,f=re.toUint8Array(fe.FromHex(d.toString(16)));f[0]|=128,r.write(f)}else o[0]&128&&r.write(new Uint8Array([0])),r.write(o);return new vn({valueHex:r.final()})}convertToDER(){const e=new vn({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new vn({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}w2=vn;le.Integer=w2;vn.NAME="INTEGER";var v2;class bc extends vn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}v2=bc;le.Enumerated=v2;bc.NAME="ENUMERATED";class pu extends An(mt){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=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const c=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)c[l]=this.valueHexView[l];return this.valueHexView=c,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ni(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){ga();let n=BigInt(e).toString(2);for(;n.length%7;)n="0"+n;const r=new Uint8Array(n.length/7);for(let i=0;i<r.length;i++)r[i]=parseInt(n.slice(i*7,i*7+7),2)+(i+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)o[c]=i[c]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Lr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",un;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let c=0;c<o;c++)r[c]=i[c]|128;r[o]=i[o]}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}}}pu.NAME="sidBlock";class b2 extends mt{constructor({value:e=$t,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new pu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e){const n=[];for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(i.byteLength===0)return this.error=this.value[r].error,un;n.push(i)}return cp(n)}fromString(e){this.value=[];let n=0,r=0,i="",o=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,o){const c=this.value[0];let l=0;switch(c.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;c.valueDec=u+l,o=!1}else{const c=new pu;if(i>Number.MAX_SAFE_INTEGER){ga();const l=BigInt(i);c.valueBigInt=l}else if(c.valueDec=parseInt(i,10),isNaN(c.valueDec))return;this.value.length||(c.isFirstSid=!0,o=!0),this.value.push(c)}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}}b2.NAME="ObjectIdentifierValueBlock";var x2;class xc extends ct{constructor(e={}){super(e,b2),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}x2=xc;le.ObjectIdentifier=x2;xc.NAME="OBJECT IDENTIFIER";class fu extends An(ni){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const c=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)c[l]=this.valueHexView[l];return this.valueHexView=c,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ni(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)o[c]=i[c]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Lr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",un;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let c=0;c<o;c++)r[c]=i[c]|128;r[o]=i[o]}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}}}fu.NAME="relativeSidBlock";class $2 extends mt{constructor({value:e=$t,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new fu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,un;r.push(o)}return cp(r)}fromString(e){this.value=[];let n=0,r=0,i="";do{r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1;const o=new fu;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(r!==-1);return!0}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n&&(i=`{${i}}`),e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}$2.NAME="RelativeObjectIdentifierValueBlock";var A2;class pp extends ct{constructor(e={}){super(e,$2),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}A2=pp;le.RelativeObjectIdentifier=A2;pp.NAME="RelativeObjectIdentifier";var k2;class zn extends kt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}k2=zn;le.Sequence=k2;zn.NAME="SEQUENCE";var E2;let Dn=class extends kt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};E2=Dn;le.Set=E2;Dn.NAME="SET";class S2 extends An(mt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=$t}toJSON(){return{...super.toJSON(),value:this.value}}}S2.NAME="StringValueBlock";class N2 extends S2{}N2.NAME="SimpleStringValueBlock";class Lt extends lp{constructor({...e}={}){super(e,N2)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,re.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}}Lt.NAME="SIMPLE STRING";class C2 extends Lt{fromBuffer(e){this.valueBlock.valueHexView=re.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}}C2.NAME="Utf8StringValueBlock";var I2;class Wn extends C2{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}I2=Wn;le.Utf8String=I2;Wn.NAME="UTF8String";class T2 extends Lt{fromBuffer(e){this.valueBlock.value=fe.ToUtf16String(e),this.valueBlock.valueHexView=re.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf16String(e))}}T2.NAME="BmpStringValueBlock";var O2;class $c extends T2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}O2=$c;le.BmpString=O2;$c.NAME="BMPString";class z2 extends Lt{fromBuffer(e){const n=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),r=new Uint8Array(n);for(let i=0;i<r.length;i+=4)r[i]=r[i+3],r[i+1]=r[i+2],r[i+2]=0,r[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(n))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n*4);for(let i=0;i<n;i++){const o=Lr(e.charCodeAt(i),8),c=new Uint8Array(o);if(c.length>4)continue;const l=4-c.length;for(let u=c.length-1;u>=0;u--)r[i*4+u+l]=c[u]}this.valueBlock.value=e}}z2.NAME="UniversalStringValueBlock";var D2;class Ac extends z2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}D2=Ac;le.UniversalString=D2;Ac.NAME="UniversalString";var R2;class kc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}R2=kc;le.NumericString=R2;kc.NAME="NumericString";var P2;class Ec extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}P2=Ec;le.PrintableString=P2;Ec.NAME="PrintableString";var B2;class Sc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}B2=Sc;le.TeletexString=B2;Sc.NAME="TeletexString";var j2;class Nc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}j2=Nc;le.VideotexString=j2;Nc.NAME="VideotexString";var L2;class Cc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}L2=Cc;le.IA5String=L2;Cc.NAME="IA5String";var F2;class Ic extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}F2=Ic;le.GraphicString=F2;Ic.NAME="GraphicString";var U2;class Jo extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}U2=Jo;le.VisibleString=U2;Jo.NAME="VisibleString";var M2;class Tc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}M2=Tc;le.GeneralString=M2;Tc.NAME="GeneralString";var q2;class Oc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}q2=Oc;le.CharacterString=q2;Oc.NAME="CharacterString";var V2;class Yo extends Jo{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,re.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]=Rt(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=Rt(this.month,2),n[2]=Rt(this.day,2),n[3]=Rt(this.hour,2),n[4]=Rt(this.minute,2),n[5]=Rt(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}}}V2=Yo;le.UTCTime=V2;Yo.NAME="UTCTime";var H2;class zc extends Yo{constructor(e={}){var n;super(e),(n=this.millisecond)!==null&&n!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let n=!1,r="",i="",o=0,c,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,_=r.indexOf("+"),$="";if(_===-1&&(_=r.indexOf("-"),h=-1),_!==-1){if($=r.substring(_+1),r=r.substring(0,_),$.length!==2&&$.length!==4)throw new Error("Wrong input string for conversion");let m=parseInt($.substring(0,2),10);if(isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");if(l=h*m,$.length===4){if(m=parseInt($.substring(2,4),10),isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");u=h*m}}}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");o=h.valueOf(),i=r.substring(0,d)}else i=r;switch(!0){case i.length===8:if(c=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;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(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===14:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const h=1e3*o;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}const f=c.exec(i);if(f===null)throw new Error("Wrong input string for conversion");for(let h=1;h<f.length;h++)switch(h){case 1:this.year=parseInt(f[h],10);break;case 2:this.month=parseInt(f[h],10);break;case 3:this.day=parseInt(f[h],10);break;case 4:this.hour=parseInt(f[h],10)+l;break;case 5:this.minute=parseInt(f[h],10)+u;break;case 6:this.second=parseInt(f[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(Rt(this.year,4)),n.push(Rt(this.month,2)),n.push(Rt(this.day,2)),n.push(Rt(this.hour,2)),n.push(Rt(this.minute,2)),n.push(Rt(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(Rt(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}H2=zc;le.GeneralizedTime=H2;zc.NAME="GeneralizedTime";var K2;class fp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}K2=fp;le.DATE=K2;fp.NAME="DATE";var G2;class hp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}G2=hp;le.TimeOfDay=G2;hp.NAME="TimeOfDay";var W2;class gp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}W2=gp;le.DateTime=W2;gp.NAME="DateTime";var X2;class mp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}X2=mp;le.Duration=X2;mp.NAME="Duration";var J2;class _p extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}J2=_p;le.TIME=J2;_p.NAME="TIME";class Ur{constructor({name:e=$t,optional:n=!1}={}){this.name=e,this.optional=n}}class yp extends Ur{constructor({value:e=[],...n}={}){super(n),this.value=e}}class ma extends Ur{constructor({value:e=new Ur,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class Hb{constructor({data:e=wc}={}){this.dataView=re.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=re.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=re.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function Dr(t,e,n){if(n instanceof yp){for(let o=0;o<n.value.length;o++)if(Dr(t,e,n.value[o]).verified)return{verified:!0,result:t};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Sl)&&(o.name=n.name),o}}if(n instanceof Ur)return n.hasOwnProperty(Sl)&&(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(!(Db in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(jb in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Lb 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(Rb)===!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(Pb)===!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(Bb)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(zb 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(!(i0 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=n.idBlock.valueHexView,c=e.idBlock.valueHexView;if(o.length!==c.length)return{verified:!1,result:t};for(let l=0;l<o.length;l++)if(o[l]!==c[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&(t[n.name]=e)),n instanceof le.Constructed){let o=0,c={verified:!1,result:{error:"Unknown error"}},l=n.valueBlock.value.length;if(l>0&&n.valueBlock.value[0]instanceof ma&&(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,$t),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let u=0;u<l;u++)if(u-o>=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,$t),n.name&&(delete t[n.name],d.name=n.name)),d}}else if(n.valueBlock.value[0]instanceof ma){if(c=Dr(t,e.valueBlock.value[u],n.valueBlock.value[0].value),c.verified===!1)if(n.valueBlock.value[0].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&delete t[n.name]),c;if(Sl in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let d={};Fb 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(c=Dr(t,e.valueBlock.value[u-o],n.valueBlock.value[u]),c.verified===!1)if(n.valueBlock.value[u].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&delete t[n.name]),c;if(c.verified===!1){const u={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&(delete t[n.name],u.name=n.name)),u}return{verified:!0,result:t}}if(n.primitiveSchema&&i0 in e.valueBlock){const o=Ki(e.valueBlock.valueHexView);if(o.offset===-1){const c={verified:!1,result:o.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&(delete t[n.name],c.name=n.name)),c}return Dr(t,o.result,n.primitiveSchema)}return{verified:!0,result:t}}function Kb(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Ki(re.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:Dr(n.result,n.result,e)}const Y2=Object.freeze(Object.defineProperty({__proto__:null,Any:Ur,BaseBlock:ct,BaseStringBlock:lp,BitString:jr,BmpString:$c,Boolean:vc,CharacterString:Oc,Choice:yp,Constructed:kt,DATE:fp,DateTime:gp,Duration:mp,EndOfContent:up,Enumerated:bc,GeneralString:Tc,GeneralizedTime:zc,GraphicString:Ic,HexBlock:An,IA5String:Cc,Integer:vn,Null:Fr,NumericString:kc,ObjectIdentifier:xc,OctetString:Br,Primitive:Xo,PrintableString:Ec,RawData:Hb,RelativeObjectIdentifier:pp,Repeated:ma,Sequence:zn,Set:Dn,TIME:_p,TeletexString:Sc,TimeOfDay:hp,UTCTime:Yo,UniversalString:Ac,Utf8String:Wn,ValueBlock:mt,VideotexString:Nc,ViewWriter:yc,VisibleString:Jo,compareSchema:Dr,fromBER:$i,verifySchema:Kb},Symbol.toStringTag,{value:"Module"}));var K;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(K||(K={}));var T;(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"})(T||(T={}));class Dc{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(re.isBufferSource(e))this.unusedBits=n,this.value=re.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof jr))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 jr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new jr({name:e})}toNumber(){let e="";const n=new Uint8Array(this.value);for(const r of n)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let n=e.toString(2);const r=n.length+7>>3;this.unusedBits=(r<<3)-n.length;const i=new Uint8Array(r);n=n.padStart(r<<3,"0").split("").reverse().join("");let o=0;for(;o<r;)i[o]=parseInt(n.slice(o<<3,(o<<3)+8),2),o++;this.value=i.buffer}}class Te{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):re.isBufferSource(e)?this.buffer=re.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Br))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Br({valueHex:this.buffer})}toSchema(e){return new Br({name:e})}}const Gb={fromASN:t=>t instanceof Fr?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new Fr;const e=$i(t);if(e.result.error)throw new Error(e.result.error);return e.result}},Wb={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new vn({value:+t})},Xb={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new bc({value:t})},Ue={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new vn({valueHex:t})},Jb={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new jr({valueHex:t})},Yb={fromASN:t=>t.valueBlock.toString(),toASN:t=>new xc({value:t})},Zb={fromASN:t=>t.valueBlock.value,toASN:t=>new vc({value:t})},_a={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Br({valueHex:t})},Qb={fromASN:t=>new Te(t.getValue()),toASN:t=>t.toASN()};function Xt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const Z2=Xt(Wn),e3=Xt($c),t3=Xt(Ac),n3=Xt(kc),r3=Xt(Ec),i3=Xt(Sc),o3=Xt(Nc),s3=Xt(Cc),a3=Xt(Ic),c3=Xt(Jo),l3=Xt(Tc),u3=Xt(Oc),d3={fromASN:t=>t.toDate(),toASN:t=>new Yo({valueDate:t})},p3={fromASN:t=>t.toDate(),toASN:t=>new zc({valueDate:t})},f3={fromASN:()=>null,toASN:()=>new Fr};function wp(t){switch(t){case T.Any:return Gb;case T.BitString:return Jb;case T.BmpString:return e3;case T.Boolean:return Zb;case T.CharacterString:return u3;case T.Enumerated:return Xb;case T.GeneralString:return l3;case T.GeneralizedTime:return p3;case T.GraphicString:return a3;case T.IA5String:return s3;case T.Integer:return Wb;case T.Null:return f3;case T.NumericString:return n3;case T.ObjectIdentifier:return Yb;case T.OctetString:return _a;case T.PrintableString:return r3;case T.TeletexString:return i3;case T.UTCTime:return d3;case T.UniversalString:return t3;case T.Utf8String:return Z2;case T.VideotexString:return o3;case T.VisibleString:return c3;default:return null}}function On(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:On(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function Q2(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:Q2(n)}return!1}function h3(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 g3{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:K.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(n,r),n.items=Object.assign({},n.items,r.items)),n}create(e,n){const r=this.items.get(e)||this.createDefault(e),i=[];for(const o in r.items){const c=r.items[o],l=n?o:"";let u;if(typeof c.type=="number"){const f=T[c.type],h=Y2[f];if(!h)throw new Error(`Cannot get ASN1 class by name '${f}'`);u=new h({name:l})}else On(c.type)?u=new c.type().toSchema(l):c.optional?this.get(c.type).type===K.Choice?u=new Ur({name:l}):(u=this.create(c.type,!1),u.name=l):u=new Ur({name:l});const d=!!c.optional||c.defaultValue!==void 0;if(c.repeated){u.name="";const f=c.repeated==="set"?Dn:zn;u=new f({name:"",value:[new ma({name:l,value:u})]})}if(c.context!==null&&c.context!==void 0)if(c.implicit)if(typeof c.type=="number"||On(c.type)){const f=c.repeated?kt:Xo;i.push(new f({name:l,optional:d,idBlock:{tagClass:3,tagNumber:c.context}}))}else{this.cache(c.type);const f=!!c.repeated;let h=f?u:this.get(c.type,!0).schema;h="valueBlock"in h?h.valueBlock.value:h.value,i.push(new kt({name:f?"":l,optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:h}))}else i.push(new kt({optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else u.optional=d,i.push(u)}switch(r.type){case K.Sequence:return new zn({value:i,name:""});case K.Set:return new Dn({value:i,name:""});case K.Choice:return new yp({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 Ht=new g3,X=t=>e=>{let n;Ht.has(e)?n=Ht.get(e):(n=Ht.createDefault(e),Ht.set(e,n)),Object.assign(n,t)},w=t=>(e,n)=>{let r;Ht.has(e.constructor)?r=Ht.get(e.constructor):(r=Ht.createDefault(e.constructor),Ht.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const o=wp(t.type);if(!o)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=o}r.items[n]=i};class s0 extends Error{constructor(){super(...arguments),this.schemas=[]}}class m3{static parse(e,n){const r=$i(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){var r;try{if(On(n))return new n().fromASN(e);const i=Ht.get(n);Ht.cache(n);let o=i.schema;if(e.constructor===kt&&i.type!==K.Choice){o=new kt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(const u in i.items)delete e[u]}const c=Dr({},e,o);if(!c.verified)throw new s0(`Data does not match to ${n.name} ASN1 schema. ${c.result.error}`);const l=new n;if(Q2(n)){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const u=i.itemType;if(typeof u=="number"){const d=wp(u);if(!d)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);return n.from(e.valueBlock.value,f=>d.fromASN(f))}else return n.from(e.valueBlock.value,d=>this.fromASN(d,u))}for(const u in i.items){const d=c.result[u];if(!d)continue;const f=i.items[u],h=f.type;if(typeof h=="number"||On(h)){const _=(r=f.converter)!==null&&r!==void 0?r:On(h)?new h:null;if(!_)throw new Error("Converter is empty");if(f.repeated)if(f.implicit){const $=f.repeated==="sequence"?zn:Dn,m=new $;m.valueBlock=d.valueBlock;const x=$i(m.toBER(!1));if(x.offset===-1)throw new Error(`Cannot parse the child item. ${x.result.error}`);if(!("value"in x.result.valueBlock&&Array.isArray(x.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const S=x.result.valueBlock.value;l[u]=Array.from(S,k=>_.fromASN(k))}else l[u]=Array.from(d,$=>_.fromASN($));else{let $=d;if(f.implicit){let m;if(On(h))m=new h().toSchema("");else{const x=T[h],S=Y2[x];if(!S)throw new Error(`Cannot get '${x}' class from asn1js module`);m=new S}m.valueBlock=$.valueBlock,$=$i(m.toBER(!1)).result}l[u]=_.fromASN($)}}else if(f.repeated){if(!Array.isArray(d))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");l[u]=Array.from(d,_=>this.fromASN(_,h))}else l[u]=this.fromASN(d,h)}return l}catch(i){throw i instanceof s0&&i.schemas.push(n.name),i}}}class vp{static serialize(e){return e instanceof ct?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&On(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=Ht.get(n);Ht.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 c=wp(r.itemType);if(!c)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(l=>c.toASN(l))}else i=e.map(c=>this.toAsnItem({type:r.itemType},"[]",n,c))}else for(const c in r.items){const l=r.items[c],u=e[c];if(u===void 0||l.defaultValue===u||typeof l.defaultValue=="object"&&typeof u=="object"&&h3(this.serialize(l.defaultValue),this.serialize(u)))continue;const d=vp.toAsnItem(l,c,n,u);if(typeof l.context=="number")if(l.implicit)if(!l.repeated&&(typeof l.type=="number"||On(l.type))){const f={};f.valueHex=d instanceof Fr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new Xo({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},...f}))}else i.push(new kt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:d.valueBlock.value}));else i.push(new kt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:[d]}));else l.repeated?i=i.concat(d):i.push(d)}let o;switch(r.type){case K.Sequence:o=new zn({value:i});break;case K.Set:o=new Dn({value:i});break;case K.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,n,r,i){let o;if(typeof e.type=="number"){const c=e.converter;if(!c)throw new Error(`Property '${n}' doesn't have converter for type ${T[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=>c.toASN(d)),u=e.repeated==="sequence"?zn:Dn;o=new u({value:l})}else o=c.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,u=>this.toASN(u)),l=e.repeated==="sequence"?zn:Dn;o=new l({value:c})}else o=this.toASN(i);return o}}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 vp.serialize(e)}static parse(e,n){return m3.parse(e,n)}static toString(e){const n=re.isBufferSource(e)?re.toArrayBuffer(e):te.serialize(e),r=$i(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function g(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(i<3?c(o):i>3?c(e,n,o):c(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}var e1={exports:{}};(function(t){(function(e){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",l="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${l})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${l})|(?:::)(?:${l})?)${n}\\.${n}\\.${n}\\.${n}(${c})?$`,"i")};function d(m,x){if(m.indexOf("::")!==m.lastIndexOf("::"))return null;let S=0,k=-1,v=(m.match(u.zoneIndex)||[])[0],O,q;for(v&&(v=v.substring(1),m=m.replace(/%.+$/,""));(k=m.indexOf(":",k+1))>=0;)S++;if(m.substr(0,2)==="::"&&S--,m.substr(-2,2)==="::"&&S--,S>x)return null;for(q=x-S,O=":";q--;)O+="0:";return m=m.replace("::",O),m[0]===":"&&(m=m.slice(1)),m[m.length-1]===":"&&(m=m.slice(0,-1)),x=function(){const F=m.split(":"),H=[];for(let W=0;W<F.length;W++)H.push(parseInt(F[W],16));return H}(),{parts:x,zoneId:v}}function f(m,x,S,k){if(m.length!==x.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let v=0,O;for(;k>0;){if(O=S-k,O<0&&(O=0),m[v]>>O!==x[v]>>O)return!1;k-=S,v+=1}return!0}function h(m){if(o.test(m))return parseInt(m,16);if(m[0]==="0"&&!isNaN(parseInt(m[1],10))){if(i.test(m))return parseInt(m,8);throw new Error(`ipaddr: cannot parse ${m} as octal`)}return parseInt(m,10)}function _(m,x){for(;m.length<x;)m=`0${m}`;return m}const $={};$.IPv4=function(){function m(x){if(x.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let S,k;for(S=0;S<x.length;S++)if(k=x[S],!(0<=k&&k<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=x}return m.prototype.SpecialRanges={unspecified:[[new m([0,0,0,0]),8]],broadcast:[[new m([255,255,255,255]),32]],multicast:[[new m([224,0,0,0]),4]],linkLocal:[[new m([169,254,0,0]),16]],loopback:[[new m([127,0,0,0]),8]],carrierGradeNat:[[new m([100,64,0,0]),10]],private:[[new m([10,0,0,0]),8],[new m([172,16,0,0]),12],[new m([192,168,0,0]),16]],reserved:[[new m([192,0,0,0]),24],[new m([192,0,2,0]),24],[new m([192,88,99,0]),24],[new m([198,18,0,0]),15],[new m([198,51,100,0]),24],[new m([203,0,113,0]),24],[new m([240,0,0,0]),4]],as112:[[new m([192,175,48,0]),24],[new m([192,31,196,0]),24]],amt:[[new m([192,52,193,0]),24]]},m.prototype.kind=function(){return"ipv4"},m.prototype.match=function(x,S){let k;if(S===void 0&&(k=x,x=k[0],S=k[1]),x.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,x.octets,8,S)},m.prototype.prefixLengthFromSubnetMask=function(){let x=0,S=!1;const k={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let v,O,q;for(v=3;v>=0;v-=1)if(O=this.octets[v],O in k){if(q=k[O],S&&q!==0)return null;q!==8&&(S=!0),x+=q}else return null;return 32-x},m.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},m.prototype.toByteArray=function(){return this.octets.slice(0)},m.prototype.toIPv4MappedAddress=function(){return $.IPv6.parse(`::ffff:${this.toString()}`)},m.prototype.toNormalizedString=function(){return this.toString()},m.prototype.toString=function(){return this.octets.join(".")},m}(),$.IPv4.broadcastAddressFromCIDR=function(m){try{const x=this.parseCIDR(m),S=x[0].toByteArray(),k=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[];let O=0;for(;O<4;)v.push(parseInt(S[O],10)|parseInt(k[O],10)^255),O++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.isIPv4=function(m){return this.parser(m)!==null},$.IPv4.isValid=function(m){try{return new this(this.parser(m)),!0}catch{return!1}},$.IPv4.isValidCIDR=function(m){try{return this.parseCIDR(m),!0}catch{return!1}},$.IPv4.isValidFourPartDecimal=function(m){return!!($.IPv4.isValid(m)&&m.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},$.IPv4.networkAddressFromCIDR=function(m){let x,S,k,v,O;try{for(x=this.parseCIDR(m),k=x[0].toByteArray(),O=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[],S=0;S<4;)v.push(parseInt(k[S],10)&parseInt(O[S],10)),S++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.parse=function(m){const x=this.parser(m);if(x===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(x)},$.IPv4.parseCIDR=function(m){let x;if(x=m.match(/^(.+)\/(\d+)$/)){const S=parseInt(x[2]);if(S>=0&&S<=32){const k=[this.parse(x[1]),S];return Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},$.IPv4.parser=function(m){let x,S,k;if(x=m.match(r.fourOctet))return function(){const v=x.slice(1,6),O=[];for(let q=0;q<v.length;q++)S=v[q],O.push(h(S));return O}();if(x=m.match(r.longValue)){if(k=h(x[1]),k>4294967295||k<0)throw new Error("ipaddr: address outside defined range");return function(){const v=[];let O;for(O=0;O<=24;O+=8)v.push(k>>O&255);return v}().reverse()}else return(x=m.match(r.twoOctet))?function(){const v=x.slice(1,4),O=[];if(k=h(v[1]),k>16777215||k<0)throw new Error("ipaddr: address outside defined range");return O.push(h(v[0])),O.push(k>>16&255),O.push(k>>8&255),O.push(k&255),O}():(x=m.match(r.threeOctet))?function(){const v=x.slice(1,5),O=[];if(k=h(v[2]),k>65535||k<0)throw new Error("ipaddr: address outside defined range");return O.push(h(v[0])),O.push(h(v[1])),O.push(k>>8&255),O.push(k&255),O}():null},$.IPv4.subnetMaskFromPrefixLength=function(m){if(m=parseInt(m),m<0||m>32)throw new Error("ipaddr: invalid IPv4 prefix length");const x=[0,0,0,0];let S=0;const k=Math.floor(m/8);for(;S<k;)x[S]=255,S++;return k<4&&(x[k]=Math.pow(2,m%8)-1<<8-m%8),new this(x)},$.IPv6=function(){function m(x,S){let k,v;if(x.length===16)for(this.parts=[],k=0;k<=14;k+=2)this.parts.push(x[k]<<8|x[k+1]);else if(x.length===8)this.parts=x;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(k=0;k<this.parts.length;k++)if(v=this.parts[k],!(0<=v&&v<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");S&&(this.zoneId=S)}return m.prototype.SpecialRanges={unspecified:[new m([0,0,0,0,0,0,0,0]),128],linkLocal:[new m([65152,0,0,0,0,0,0,0]),10],multicast:[new m([65280,0,0,0,0,0,0,0]),8],loopback:[new m([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new m([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new m([0,0,0,0,0,65535,0,0]),96],discard:[new m([256,0,0,0,0,0,0,0]),64],rfc6145:[new m([0,0,0,0,65535,0,0,0]),96],rfc6052:[new m([100,65435,0,0,0,0,0,0]),96],"6to4":[new m([8194,0,0,0,0,0,0,0]),16],teredo:[new m([8193,0,0,0,0,0,0,0]),32],benchmarking:[new m([8193,2,0,0,0,0,0,0]),48],amt:[new m([8193,3,0,0,0,0,0,0]),32],as112v6:[[new m([8193,4,274,0,0,0,0,0]),48],[new m([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new m([8193,16,0,0,0,0,0,0]),28],orchid2:[new m([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new m([8193,48,0,0,0,0,0,0]),28],reserved:[[new m([8193,0,0,0,0,0,0,0]),23],[new m([8193,3512,0,0,0,0,0,0]),32]]},m.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},m.prototype.kind=function(){return"ipv6"},m.prototype.match=function(x,S){let k;if(S===void 0&&(k=x,x=k[0],S=k[1]),x.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,x.parts,16,S)},m.prototype.prefixLengthFromSubnetMask=function(){let x=0,S=!1;const k={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let v,O;for(let q=7;q>=0;q-=1)if(v=this.parts[q],v in k){if(O=k[v],S&&O!==0)return null;O!==16&&(S=!0),x+=O}else return null;return 128-x},m.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},m.prototype.toByteArray=function(){let x;const S=[],k=this.parts;for(let v=0;v<k.length;v++)x=k[v],S.push(x>>8),S.push(x&255);return S},m.prototype.toFixedLengthString=function(){const x=(function(){const k=[];for(let v=0;v<this.parts.length;v++)k.push(_(this.parts[v].toString(16),4));return k}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),x+S},m.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const x=this.parts.slice(-2),S=x[0],k=x[1];return new $.IPv4([S>>8,S&255,k>>8,k&255])},m.prototype.toNormalizedString=function(){const x=(function(){const k=[];for(let v=0;v<this.parts.length;v++)k.push(this.parts[v].toString(16));return k}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),x+S},m.prototype.toRFC5952String=function(){const x=/((^|:)(0(:|$)){2,})/g,S=this.toNormalizedString();let k=0,v=-1,O;for(;O=x.exec(S);)O[0].length>v&&(k=O.index,v=O[0].length);return v<0?S:`${S.substring(0,k)}::${S.substring(k+v)}`},m.prototype.toString=function(){return this.toRFC5952String()},m}(),$.IPv6.broadcastAddressFromCIDR=function(m){try{const x=this.parseCIDR(m),S=x[0].toByteArray(),k=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[];let O=0;for(;O<16;)v.push(parseInt(S[O],10)|parseInt(k[O],10)^255),O++;return new this(v)}catch(x){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${x})`)}},$.IPv6.isIPv6=function(m){return this.parser(m)!==null},$.IPv6.isValid=function(m){if(typeof m=="string"&&m.indexOf(":")===-1)return!1;try{const x=this.parser(m);return new this(x.parts,x.zoneId),!0}catch{return!1}},$.IPv6.isValidCIDR=function(m){if(typeof m=="string"&&m.indexOf(":")===-1)return!1;try{return this.parseCIDR(m),!0}catch{return!1}},$.IPv6.networkAddressFromCIDR=function(m){let x,S,k,v,O;try{for(x=this.parseCIDR(m),k=x[0].toByteArray(),O=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[],S=0;S<16;)v.push(parseInt(k[S],10)&parseInt(O[S],10)),S++;return new this(v)}catch(q){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${q})`)}},$.IPv6.parse=function(m){const x=this.parser(m);if(x.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(x.parts,x.zoneId)},$.IPv6.parseCIDR=function(m){let x,S,k;if((S=m.match(/^(.+)\/(\d+)$/))&&(x=parseInt(S[2]),x>=0&&x<=128))return k=[this.parse(S[1]),x],Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},$.IPv6.parser=function(m){let x,S,k,v,O,q;if(k=m.match(u.deprecatedTransitional))return this.parser(`::ffff:${k[1]}`);if(u.native.test(m))return d(m,8);if((k=m.match(u.transitional))&&(q=k[6]||"",x=k[1],k[1].endsWith("::")||(x=x.slice(0,-1)),x=d(x+q,6),x.parts)){for(O=[parseInt(k[2]),parseInt(k[3]),parseInt(k[4]),parseInt(k[5])],S=0;S<O.length;S++)if(v=O[S],!(0<=v&&v<=255))return null;return x.parts.push(O[0]<<8|O[1]),x.parts.push(O[2]<<8|O[3]),{parts:x.parts,zoneId:x.zoneId}}return null},$.IPv6.subnetMaskFromPrefixLength=function(m){if(m=parseInt(m),m<0||m>128)throw new Error("ipaddr: invalid IPv6 prefix length");const x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let S=0;const k=Math.floor(m/8);for(;S<k;)x[S]=255,S++;return k<16&&(x[k]=Math.pow(2,m%8)-1<<8-m%8),new this(x)},$.fromByteArray=function(m){const x=m.length;if(x===4)return new $.IPv4(m);if(x===16)return new $.IPv6(m);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},$.isValid=function(m){return $.IPv6.isValid(m)||$.IPv4.isValid(m)},$.isValidCIDR=function(m){return $.IPv6.isValidCIDR(m)||$.IPv4.isValidCIDR(m)},$.parse=function(m){if($.IPv6.isValid(m))return $.IPv6.parse(m);if($.IPv4.isValid(m))return $.IPv4.parse(m);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},$.parseCIDR=function(m){try{return $.IPv6.parseCIDR(m)}catch{try{return $.IPv4.parseCIDR(m)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},$.process=function(m){const x=this.parse(m);return x.kind()==="ipv6"&&x.isIPv4MappedAddress()?x.toIPv4Address():x},$.subnetMatch=function(m,x,S){let k,v,O,q;S==null&&(S="unicast");for(v in x)if(Object.prototype.hasOwnProperty.call(x,v)){for(O=x[v],O[0]&&!(O[0]instanceof Array)&&(O=[O]),k=0;k<O.length;k++)if(q=O[k],m.kind()===q[0].kind()&&m.match.apply(m,q))return v}return S},t.exports?t.exports=$:e.ipaddr=$})(sr)})(e1);var a0=e1.exports;class c0{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const n=parseInt(e.slice(8),16).toString(2).split("").reduce((i,o)=>i+ +o,0);let r=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return r=r.slice(0,-1),`${r}/${n}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const n=new Uint8Array(e);return a0.fromByteArray(Array.from(n)).toString()}return this.decodeIP(fe.ToHex(e))}static fromString(e){const n=a0.parse(e);return new Uint8Array(n.toByteArray()).buffer}}var hu,gu,mu;let lt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};g([w({type:T.TeletexString})],lt.prototype,"teletexString",void 0);g([w({type:T.PrintableString})],lt.prototype,"printableString",void 0);g([w({type:T.UniversalString})],lt.prototype,"universalString",void 0);g([w({type:T.Utf8String})],lt.prototype,"utf8String",void 0);g([w({type:T.BmpString})],lt.prototype,"bmpString",void 0);lt=g([X({type:K.Choice})],lt);let Ci=class extends lt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?fe.ToHex(this.anyValue):super.toString())}};g([w({type:T.IA5String})],Ci.prototype,"ia5String",void 0);g([w({type:T.Any})],Ci.prototype,"anyValue",void 0);Ci=g([X({type:K.Choice})],Ci);class Rc{constructor(e={}){this.type="",this.value=new Ci,Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Rc.prototype,"type",void 0);g([w({type:Ci})],Rc.prototype,"value",void 0);let Ii=hu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,hu.prototype)}};Ii=hu=g([X({type:K.Set,itemType:Rc})],Ii);let _u=gu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,gu.prototype)}};_u=gu=g([X({type:K.Sequence,itemType:Ii})],_u);let Xe=mu=class extends _u{constructor(e){super(e),Object.setPrototypeOf(this,mu.prototype)}};Xe=mu=g([X({type:K.Sequence})],Xe);const _3={fromASN:t=>c0.toString(_a.fromASN(t)),toASN:t=>_a.toASN(c0.fromString(t))};class Eo{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Eo.prototype,"typeId",void 0);g([w({type:T.Any,context:0})],Eo.prototype,"value",void 0);class bp{constructor(e={}){this.partyName=new lt,Object.assign(this,e)}}g([w({type:lt,optional:!0,context:0,implicit:!0})],bp.prototype,"nameAssigner",void 0);g([w({type:lt,context:1,implicit:!0})],bp.prototype,"partyName",void 0);let Se=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Eo,context:0,implicit:!0})],Se.prototype,"otherName",void 0);g([w({type:T.IA5String,context:1,implicit:!0})],Se.prototype,"rfc822Name",void 0);g([w({type:T.IA5String,context:2,implicit:!0})],Se.prototype,"dNSName",void 0);g([w({type:T.Any,context:3,implicit:!0})],Se.prototype,"x400Address",void 0);g([w({type:Xe,context:4,implicit:!1})],Se.prototype,"directoryName",void 0);g([w({type:bp,context:5})],Se.prototype,"ediPartyName",void 0);g([w({type:T.IA5String,context:6,implicit:!0})],Se.prototype,"uniformResourceIdentifier",void 0);g([w({type:T.OctetString,context:7,implicit:!0,converter:_3})],Se.prototype,"iPAddress",void 0);g([w({type:T.ObjectIdentifier,context:8,implicit:!0})],Se.prototype,"registeredID",void 0);Se=g([X({type:K.Choice})],Se);const xp="1.3.6.1.5.5.7",y3=`${xp}.1`,Gi=`${xp}.3`,Pc=`${xp}.48`,l0=`${Pc}.1`,u0=`${Pc}.2`,d0=`${Pc}.3`,p0=`${Pc}.5`,$r="2.5.29";var yu;const wu=`${y3}.1`;class Zo{constructor(e={}){this.accessMethod="",this.accessLocation=new Se,Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Zo.prototype,"accessMethod",void 0);g([w({type:Se})],Zo.prototype,"accessLocation",void 0);let vi=yu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,yu.prototype)}};vi=yu=g([X({type:K.Sequence,itemType:Zo})],vi);const vu=`${$r}.35`;class $p extends Te{}class Rr{constructor(e={}){e&&Object.assign(this,e)}}g([w({type:$p,context:0,optional:!0,implicit:!0})],Rr.prototype,"keyIdentifier",void 0);g([w({type:Se,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Rr.prototype,"authorityCertIssuer",void 0);g([w({type:T.Integer,context:2,optional:!0,implicit:!0,converter:Ue})],Rr.prototype,"authorityCertSerialNumber",void 0);const t1=`${$r}.19`;class ya{constructor(e={}){this.cA=!1,Object.assign(this,e)}}g([w({type:T.Boolean,defaultValue:!1})],ya.prototype,"cA",void 0);g([w({type:T.Integer,optional:!0})],ya.prototype,"pathLenConstraint",void 0);var bu;let gt=bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}};gt=bu=g([X({type:K.Sequence,itemType:Se})],gt);var xu;let f0=xu=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,xu.prototype)}};f0=xu=g([X({type:K.Sequence})],f0);var $u;const n1=`${$r}.32`;let jn=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};g([w({type:T.IA5String})],jn.prototype,"ia5String",void 0);g([w({type:T.VisibleString})],jn.prototype,"visibleString",void 0);g([w({type:T.BmpString})],jn.prototype,"bmpString",void 0);g([w({type:T.Utf8String})],jn.prototype,"utf8String",void 0);jn=g([X({type:K.Choice})],jn);class Ap{constructor(e={}){this.organization=new jn,this.noticeNumbers=[],Object.assign(this,e)}}g([w({type:jn})],Ap.prototype,"organization",void 0);g([w({type:T.Integer,repeated:"sequence"})],Ap.prototype,"noticeNumbers",void 0);class kp{constructor(e={}){Object.assign(this,e)}}g([w({type:Ap,optional:!0})],kp.prototype,"noticeRef",void 0);g([w({type:jn,optional:!0})],kp.prototype,"explicitText",void 0);let wa=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.IA5String})],wa.prototype,"cPSuri",void 0);g([w({type:kp})],wa.prototype,"userNotice",void 0);wa=g([X({type:K.Choice})],wa);class Ep{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Ep.prototype,"policyQualifierId",void 0);g([w({type:T.Any})],Ep.prototype,"qualifier",void 0);class Bc{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Bc.prototype,"policyIdentifier",void 0);g([w({type:Ep,repeated:"sequence",optional:!0})],Bc.prototype,"policyQualifiers",void 0);let va=$u=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,$u.prototype)}};va=$u=g([X({type:K.Sequence,itemType:Bc})],va);let ba=class{constructor(e=0){this.value=e}};g([w({type:T.Integer})],ba.prototype,"value",void 0);ba=g([X({type:K.Choice})],ba);let h0=class extends ba{};h0=g([X({type:K.Choice})],h0);var Au;const ku=`${$r}.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 r1 extends Dc{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 Mr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Se,context:0,repeated:"sequence",implicit:!0})],Mr.prototype,"fullName",void 0);g([w({type:Ii,context:1,implicit:!0})],Mr.prototype,"nameRelativeToCRLIssuer",void 0);Mr=g([X({type:K.Choice})],Mr);class Wi{constructor(e={}){Object.assign(this,e)}}g([w({type:Mr,context:0,optional:!0})],Wi.prototype,"distributionPoint",void 0);g([w({type:r1,context:1,optional:!0,implicit:!0})],Wi.prototype,"reasons",void 0);g([w({type:Se,context:2,optional:!0,repeated:"sequence",implicit:!0})],Wi.prototype,"cRLIssuer",void 0);let Ai=Au=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Au.prototype)}};Ai=Au=g([X({type:K.Sequence,itemType:Wi})],Ai);var Eu;let g0=Eu=class extends Ai{constructor(e){super(e),Object.setPrototypeOf(this,Eu.prototype)}};g0=Eu=g([X({type:K.Sequence,itemType:Wi})],g0);class pt{constructor(e={}){this.onlyContainsUserCerts=pt.ONLY,this.onlyContainsCACerts=pt.ONLY,this.indirectCRL=pt.ONLY,this.onlyContainsAttributeCerts=pt.ONLY,Object.assign(this,e)}}pt.ONLY=!1;g([w({type:Mr,context:0,optional:!0})],pt.prototype,"distributionPoint",void 0);g([w({type:T.Boolean,context:1,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"onlyContainsUserCerts",void 0);g([w({type:T.Boolean,context:2,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"onlyContainsCACerts",void 0);g([w({type:r1,context:3,optional:!0,implicit:!0})],pt.prototype,"onlySomeReasons",void 0);g([w({type:T.Boolean,context:4,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"indirectCRL",void 0);g([w({type:T.Boolean,context:5,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"onlyContainsAttributeCerts",void 0);var mo;(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"})(mo||(mo={}));let Su=class{constructor(e=mo.unspecified){this.reason=mo.unspecified,this.reason=e}toJSON(){return mo[this.reason]}toString(){return this.toJSON()}};g([w({type:T.Enumerated})],Su.prototype,"reason",void 0);Su=g([X({type:K.Choice})],Su);var Nu;const i1=`${$r}.37`;let xa=Nu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Nu.prototype)}};xa=Nu=g([X({type:K.Sequence,itemType:T.ObjectIdentifier})],xa);const w3=`${Gi}.1`,v3=`${Gi}.2`,b3=`${Gi}.3`,x3=`${Gi}.4`,$3=`${Gi}.8`,A3=`${Gi}.9`;let Cu=class{constructor(e=new ArrayBuffer(0)){this.value=e}};g([w({type:T.Integer,converter:Ue})],Cu.prototype,"value",void 0);Cu=g([X({type:K.Choice})],Cu);let Iu=class{constructor(e){this.value=new Date,e&&(this.value=e)}};g([w({type:T.GeneralizedTime})],Iu.prototype,"value",void 0);Iu=g([X({type:K.Choice})],Iu);var Tu;let m0=Tu=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Tu.prototype)}};m0=Tu=g([X({type:K.Sequence})],m0);const o1=`${$r}.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 Nl extends Dc{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 Ou;class jc{constructor(e={}){this.base=new Se,this.minimum=0,Object.assign(this,e)}}g([w({type:Se})],jc.prototype,"base",void 0);g([w({type:T.Integer,context:0,defaultValue:0,implicit:!0})],jc.prototype,"minimum",void 0);g([w({type:T.Integer,context:1,optional:!0,implicit:!0})],jc.prototype,"maximum",void 0);let $a=Ou=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};$a=Ou=g([X({type:K.Sequence,itemType:jc})],$a);class s1{constructor(e={}){Object.assign(this,e)}}g([w({type:$a,context:0,optional:!0,implicit:!0})],s1.prototype,"permittedSubtrees",void 0);g([w({type:$a,context:1,optional:!0,implicit:!0})],s1.prototype,"excludedSubtrees",void 0);class a1{constructor(e={}){Object.assign(this,e)}}g([w({type:T.Integer,context:0,implicit:!0,optional:!0,converter:Ue})],a1.prototype,"requireExplicitPolicy",void 0);g([w({type:T.Integer,context:1,implicit:!0,optional:!0,converter:Ue})],a1.prototype,"inhibitPolicyMapping",void 0);var zu;class Sp{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Sp.prototype,"issuerDomainPolicy",void 0);g([w({type:T.ObjectIdentifier})],Sp.prototype,"subjectDomainPolicy",void 0);let _0=zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,zu.prototype)}};_0=zu=g([X({type:K.Sequence,itemType:Sp})],_0);var Du;const c1=`${$r}.17`;let Ru=Du=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Du.prototype)}};Ru=Du=g([X({type:K.Sequence})],Ru);let Ln=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],Ln.prototype,"type",void 0);g([w({type:T.Any,repeated:"set"})],Ln.prototype,"values",void 0);var Pu;let y0=Pu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Pu.prototype)}};y0=Pu=g([X({type:K.Sequence,itemType:Ln})],y0);const l1=`${$r}.14`;class ur extends $p{}class u1{constructor(e={}){Object.assign(this,e)}}g([w({type:T.GeneralizedTime,context:0,implicit:!0,optional:!0})],u1.prototype,"notBefore",void 0);g([w({type:T.GeneralizedTime,context:1,implicit:!0,optional:!0})],u1.prototype,"notAfter",void 0);var _o;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(_o||(_o={}));class d1 extends Dc{toJSON(){const e=[],n=this.toNumber();return n&_o.pKIXCertificate&&e.push("pKIXCertificate"),n&_o.newExtensions&&e.push("newExtensions"),n&_o.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class p1{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new d1,Object.assign(this,e)}}g([w({type:T.GeneralString})],p1.prototype,"entrustVers",void 0);g([w({type:d1})],p1.prototype,"entrustInfoFlags",void 0);var Bu;let w0=Bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};w0=Bu=g([X({type:K.Sequence,itemType:Zo})],w0);class ce{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ce&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Zm(e.parameters,this.parameters)||e.parameters===this.parameters)}}g([w({type:T.ObjectIdentifier})],ce.prototype,"algorithm",void 0);g([w({type:T.Any,optional:!0})],ce.prototype,"parameters",void 0);class nn{constructor(e={}){this.algorithm=new ce,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:ce})],nn.prototype,"algorithm",void 0);g([w({type:T.BitString})],nn.prototype,"subjectPublicKey",void 0);let ot=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}};g([w({type:T.UTCTime})],ot.prototype,"utcTime",void 0);g([w({type:T.GeneralizedTime})],ot.prototype,"generalTime",void 0);ot=g([X({type:K.Choice})],ot);class Qo{constructor(e){this.notBefore=new ot(new Date),this.notAfter=new ot(new Date),e&&(this.notBefore=new ot(e.notBefore),this.notAfter=new ot(e.notAfter))}}g([w({type:ot})],Qo.prototype,"notBefore",void 0);g([w({type:ot})],Qo.prototype,"notAfter",void 0);var ju;let Wt=class f1{constructor(e={}){this.extnID="",this.critical=f1.CRITICAL,this.extnValue=new Te,Object.assign(this,e)}};Wt.CRITICAL=!1;g([w({type:T.ObjectIdentifier})],Wt.prototype,"extnID",void 0);g([w({type:T.Boolean,defaultValue:Wt.CRITICAL})],Wt.prototype,"critical",void 0);g([w({type:Te})],Wt.prototype,"extnValue",void 0);let fr=ju=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};fr=ju=g([X({type:K.Sequence,itemType:Wt})],fr);var qr;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(qr||(qr={}));class Ft{constructor(e={}){this.version=qr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ce,this.issuer=new Xe,this.validity=new Qo,this.subject=new Xe,this.subjectPublicKeyInfo=new nn,Object.assign(this,e)}}g([w({type:T.Integer,context:0,defaultValue:qr.v1})],Ft.prototype,"version",void 0);g([w({type:T.Integer,converter:Ue})],Ft.prototype,"serialNumber",void 0);g([w({type:ce})],Ft.prototype,"signature",void 0);g([w({type:Xe})],Ft.prototype,"issuer",void 0);g([w({type:Qo})],Ft.prototype,"validity",void 0);g([w({type:Xe})],Ft.prototype,"subject",void 0);g([w({type:nn})],Ft.prototype,"subjectPublicKeyInfo",void 0);g([w({type:T.BitString,context:1,implicit:!0,optional:!0})],Ft.prototype,"issuerUniqueID",void 0);g([w({type:T.BitString,context:2,implicit:!0,optional:!0})],Ft.prototype,"subjectUniqueID",void 0);g([w({type:fr,context:3,optional:!0})],Ft.prototype,"extensions",void 0);class Vr{constructor(e={}){this.tbsCertificate=new Ft,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:Ft})],Vr.prototype,"tbsCertificate",void 0);g([w({type:ce})],Vr.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],Vr.prototype,"signatureValue",void 0);class Lc{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ot,Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],Lc.prototype,"userCertificate",void 0);g([w({type:ot})],Lc.prototype,"revocationDate",void 0);g([w({type:Wt,optional:!0,repeated:"sequence"})],Lc.prototype,"crlEntryExtensions",void 0);class Xn{constructor(e={}){this.signature=new ce,this.issuer=new Xe,this.thisUpdate=new ot,Object.assign(this,e)}}g([w({type:T.Integer,optional:!0})],Xn.prototype,"version",void 0);g([w({type:ce})],Xn.prototype,"signature",void 0);g([w({type:Xe})],Xn.prototype,"issuer",void 0);g([w({type:ot})],Xn.prototype,"thisUpdate",void 0);g([w({type:ot,optional:!0})],Xn.prototype,"nextUpdate",void 0);g([w({type:Lc,repeated:"sequence",optional:!0})],Xn.prototype,"revokedCertificates",void 0);g([w({type:Wt,optional:!0,context:0,repeated:"sequence"})],Xn.prototype,"crlExtensions",void 0);class Np{constructor(e={}){this.tbsCertList=new Xn,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:Xn})],Np.prototype,"tbsCertList",void 0);g([w({type:ce})],Np.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],Np.prototype,"signature",void 0);class Xi{constructor(e={}){this.issuer=new Xe,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:Xe})],Xi.prototype,"issuer",void 0);g([w({type:T.Integer,converter:Ue})],Xi.prototype,"serialNumber",void 0);let Ti=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ur,context:0,implicit:!0})],Ti.prototype,"subjectKeyIdentifier",void 0);g([w({type:Xi})],Ti.prototype,"issuerAndSerialNumber",void 0);Ti=g([X({type:K.Choice})],Ti);var Fn;(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"})(Fn||(Fn={}));let So=class extends ce{};So=g([X({type:K.Sequence})],So);let Aa=class extends ce{};Aa=g([X({type:K.Sequence})],Aa);let $n=class extends ce{};$n=g([X({type:K.Sequence})],$n);let ka=class extends ce{};ka=g([X({type:K.Sequence})],ka);let v0=class extends ce{};v0=g([X({type:K.Sequence})],v0);let Lu=class extends ce{};Lu=g([X({type:K.Sequence})],Lu);let Ji=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],Ji.prototype,"attrType",void 0);g([w({type:T.Any,repeated:"set"})],Ji.prototype,"attrValues",void 0);var Fu;class kn{constructor(e={}){this.version=Fn.v0,this.sid=new Ti,this.digestAlgorithm=new So,this.signatureAlgorithm=new Aa,this.signature=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],kn.prototype,"version",void 0);g([w({type:Ti})],kn.prototype,"sid",void 0);g([w({type:So})],kn.prototype,"digestAlgorithm",void 0);g([w({type:Ji,repeated:"set",context:0,implicit:!0,optional:!0})],kn.prototype,"signedAttrs",void 0);g([w({type:Aa})],kn.prototype,"signatureAlgorithm",void 0);g([w({type:Te})],kn.prototype,"signature",void 0);g([w({type:Ji,repeated:"set",context:1,implicit:!0,optional:!0})],kn.prototype,"unsignedAttrs",void 0);let Ea=Fu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fu.prototype)}};Ea=Fu=g([X({type:K.Set,itemType:kn})],Ea);let b0=class extends ot{};b0=g([X({type:K.Choice})],b0);let x0=class extends kn{};x0=g([X({type:K.Sequence})],x0);class Cp{constructor(e={}){this.acIssuer=new Se,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}g([w({type:Se})],Cp.prototype,"acIssuer",void 0);g([w({type:T.Integer})],Cp.prototype,"acSerial",void 0);g([w({type:Ln,repeated:"sequence"})],Cp.prototype,"attrs",void 0);var Uu;let Sa=Uu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Uu.prototype)}};Sa=Uu=g([X({type:K.Sequence,itemType:T.ObjectIdentifier})],Sa);class Fc{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}g([w({type:T.Integer,optional:!0})],Fc.prototype,"pathLenConstraint",void 0);g([w({type:Sa,implicit:!0,context:0,optional:!0})],Fc.prototype,"permittedAttrs",void 0);g([w({type:Sa,implicit:!0,context:1,optional:!0})],Fc.prototype,"excludedAttrs",void 0);g([w({type:T.Boolean,defaultValue:!0})],Fc.prototype,"permitUnSpecified",void 0);class ri{constructor(e={}){this.issuer=new gt,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:gt})],ri.prototype,"issuer",void 0);g([w({type:T.Integer,converter:Ue})],ri.prototype,"serial",void 0);g([w({type:T.BitString,optional:!0})],ri.prototype,"issuerUID",void 0);var Mu;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(Mu||(Mu={}));class ii{constructor(e={}){this.digestedObjectType=Mu.publicKey,this.digestAlgorithm=new ce,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Enumerated})],ii.prototype,"digestedObjectType",void 0);g([w({type:T.ObjectIdentifier,optional:!0})],ii.prototype,"otherObjectTypeID",void 0);g([w({type:ce})],ii.prototype,"digestAlgorithm",void 0);g([w({type:T.BitString})],ii.prototype,"objectDigest",void 0);class Uc{constructor(e={}){Object.assign(this,e)}}g([w({type:gt,optional:!0})],Uc.prototype,"issuerName",void 0);g([w({type:ri,context:0,implicit:!0,optional:!0})],Uc.prototype,"baseCertificateID",void 0);g([w({type:ii,context:1,implicit:!0,optional:!0})],Uc.prototype,"objectDigestInfo",void 0);let Oi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Se,repeated:"sequence"})],Oi.prototype,"v1Form",void 0);g([w({type:Uc,context:0,implicit:!0})],Oi.prototype,"v2Form",void 0);Oi=g([X({type:K.Choice})],Oi);class Mc{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}g([w({type:T.GeneralizedTime})],Mc.prototype,"notBeforeTime",void 0);g([w({type:T.GeneralizedTime})],Mc.prototype,"notAfterTime",void 0);class es{constructor(e={}){Object.assign(this,e)}}g([w({type:ri,implicit:!0,context:0,optional:!0})],es.prototype,"baseCertificateID",void 0);g([w({type:gt,implicit:!0,context:1,optional:!0})],es.prototype,"entityName",void 0);g([w({type:ii,implicit:!0,context:2,optional:!0})],es.prototype,"objectDigestInfo",void 0);var qu;(function(t){t[t.v2=1]="v2"})(qu||(qu={}));class dn{constructor(e={}){this.version=qu.v2,this.holder=new es,this.issuer=new Oi,this.signature=new ce,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Mc,this.attributes=[],Object.assign(this,e)}}g([w({type:T.Integer})],dn.prototype,"version",void 0);g([w({type:es})],dn.prototype,"holder",void 0);g([w({type:Oi})],dn.prototype,"issuer",void 0);g([w({type:ce})],dn.prototype,"signature",void 0);g([w({type:T.Integer,converter:Ue})],dn.prototype,"serialNumber",void 0);g([w({type:Mc})],dn.prototype,"attrCertValidityPeriod",void 0);g([w({type:Ln,repeated:"sequence"})],dn.prototype,"attributes",void 0);g([w({type:T.BitString,optional:!0})],dn.prototype,"issuerUniqueID",void 0);g([w({type:fr,optional:!0})],dn.prototype,"extensions",void 0);class qc{constructor(e={}){this.acinfo=new dn,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:dn})],qc.prototype,"acinfo",void 0);g([w({type:ce})],qc.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],qc.prototype,"signatureValue",void 0);var Na;(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"})(Na||(Na={}));class Vu extends Dc{}class Ip{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier,implicit:!0,context:0})],Ip.prototype,"type",void 0);g([w({type:T.Any,implicit:!0,context:1})],Ip.prototype,"value",void 0);class Tp{constructor(e={}){this.policyId="",this.classList=new Vu(Na.unclassified),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Tp.prototype,"policyId",void 0);g([w({type:Vu,defaultValue:new Vu(Na.unclassified)})],Tp.prototype,"classList",void 0);g([w({type:Ip,repeated:"set"})],Tp.prototype,"securityCategories",void 0);class Vc{constructor(e={}){Object.assign(this,e)}}g([w({type:Te})],Vc.prototype,"cotets",void 0);g([w({type:T.ObjectIdentifier})],Vc.prototype,"oid",void 0);g([w({type:T.Utf8String})],Vc.prototype,"string",void 0);class h1{constructor(e={}){this.values=[],Object.assign(this,e)}}g([w({type:gt,implicit:!0,context:0,optional:!0})],h1.prototype,"policyAuthority",void 0);g([w({type:Vc,repeated:"sequence"})],h1.prototype,"values",void 0);var Hu;class Hc{constructor(e={}){this.targetCertificate=new ri,Object.assign(this,e)}}g([w({type:ri})],Hc.prototype,"targetCertificate",void 0);g([w({type:Se,optional:!0})],Hc.prototype,"targetName",void 0);g([w({type:ii,optional:!0})],Hc.prototype,"certDigestInfo",void 0);let zi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Se,context:0,implicit:!0})],zi.prototype,"targetName",void 0);g([w({type:Se,context:1,implicit:!0})],zi.prototype,"targetGroup",void 0);g([w({type:Hc,context:2,implicit:!0})],zi.prototype,"targetCert",void 0);zi=g([X({type:K.Choice})],zi);let Ku=Hu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Hu.prototype)}};Ku=Hu=g([X({type:K.Sequence,itemType:zi})],Ku);var Gu;let $0=Gu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Gu.prototype)}};$0=Gu=g([X({type:K.Sequence,itemType:Ku})],$0);class g1{constructor(e={}){Object.assign(this,e)}}g([w({type:gt,implicit:!0,context:0,optional:!0})],g1.prototype,"roleAuthority",void 0);g([w({type:Se,implicit:!0,context:1})],g1.prototype,"roleName",void 0);class Op{constructor(e={}){this.service=new Se,this.ident=new Se,Object.assign(this,e)}}g([w({type:Se})],Op.prototype,"service",void 0);g([w({type:Se})],Op.prototype,"ident",void 0);g([w({type:Te,optional:!0})],Op.prototype,"authInfo",void 0);var Wu;class zp{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],zp.prototype,"otherCertFormat",void 0);g([w({type:T.Any})],zp.prototype,"otherCert",void 0);let Di=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Vr})],Di.prototype,"certificate",void 0);g([w({type:qc,context:2,implicit:!0})],Di.prototype,"v2AttrCert",void 0);g([w({type:zp,context:3,implicit:!0})],Di.prototype,"other",void 0);Di=g([X({type:K.Choice})],Di);let Ca=Wu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Wu.prototype)}};Ca=Wu=g([X({type:K.Set,itemType:Di})],Ca);class Yi{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Yi.prototype,"contentType",void 0);g([w({type:T.Any,context:0})],Yi.prototype,"content",void 0);let No=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Te})],No.prototype,"single",void 0);g([w({type:T.Any})],No.prototype,"any",void 0);No=g([X({type:K.Choice})],No);class Kc{constructor(e={}){this.eContentType="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Kc.prototype,"eContentType",void 0);g([w({type:No,context:0,optional:!0})],Kc.prototype,"eContent",void 0);let Co=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Te,context:0,implicit:!0,optional:!0})],Co.prototype,"value",void 0);g([w({type:Te,converter:Qb,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Co.prototype,"constructedValue",void 0);Co=g([X({type:K.Choice})],Co);class ts{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ka,Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],ts.prototype,"contentType",void 0);g([w({type:ka})],ts.prototype,"contentEncryptionAlgorithm",void 0);g([w({type:Co,optional:!0})],ts.prototype,"encryptedContent",void 0);class Gc{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Gc.prototype,"keyAttrId",void 0);g([w({type:T.Any,optional:!0})],Gc.prototype,"keyAttr",void 0);var Xu;class Wc{constructor(e={}){this.subjectKeyIdentifier=new ur,Object.assign(this,e)}}g([w({type:ur})],Wc.prototype,"subjectKeyIdentifier",void 0);g([w({type:T.GeneralizedTime,optional:!0})],Wc.prototype,"date",void 0);g([w({type:Gc,optional:!0})],Wc.prototype,"other",void 0);let Ri=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Wc,context:0,implicit:!0,optional:!0})],Ri.prototype,"rKeyId",void 0);g([w({type:Xi,optional:!0})],Ri.prototype,"issuerAndSerialNumber",void 0);Ri=g([X({type:K.Choice})],Ri);class Dp{constructor(e={}){this.rid=new Ri,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:Ri})],Dp.prototype,"rid",void 0);g([w({type:Te})],Dp.prototype,"encryptedKey",void 0);let Ia=Xu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Xu.prototype)}};Ia=Xu=g([X({type:K.Sequence,itemType:Dp})],Ia);class Rp{constructor(e={}){this.algorithm=new ce,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:ce})],Rp.prototype,"algorithm",void 0);g([w({type:T.BitString})],Rp.prototype,"publicKey",void 0);let Hr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ur,context:0,implicit:!0,optional:!0})],Hr.prototype,"subjectKeyIdentifier",void 0);g([w({type:Rp,context:1,implicit:!0,optional:!0})],Hr.prototype,"originatorKey",void 0);g([w({type:Xi,optional:!0})],Hr.prototype,"issuerAndSerialNumber",void 0);Hr=g([X({type:K.Choice})],Hr);class Zi{constructor(e={}){this.version=Fn.v3,this.originator=new Hr,this.keyEncryptionAlgorithm=new $n,this.recipientEncryptedKeys=new Ia,Object.assign(this,e)}}g([w({type:T.Integer})],Zi.prototype,"version",void 0);g([w({type:Hr,context:0})],Zi.prototype,"originator",void 0);g([w({type:Te,context:1,optional:!0})],Zi.prototype,"ukm",void 0);g([w({type:$n})],Zi.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Ia})],Zi.prototype,"recipientEncryptedKeys",void 0);let Pi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ur,context:0,implicit:!0})],Pi.prototype,"subjectKeyIdentifier",void 0);g([w({type:Xi})],Pi.prototype,"issuerAndSerialNumber",void 0);Pi=g([X({type:K.Choice})],Pi);class ns{constructor(e={}){this.version=Fn.v0,this.rid=new Pi,this.keyEncryptionAlgorithm=new $n,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],ns.prototype,"version",void 0);g([w({type:Pi})],ns.prototype,"rid",void 0);g([w({type:$n})],ns.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Te})],ns.prototype,"encryptedKey",void 0);class rs{constructor(e={}){this.keyIdentifier=new Te,Object.assign(this,e)}}g([w({type:Te})],rs.prototype,"keyIdentifier",void 0);g([w({type:T.GeneralizedTime,optional:!0})],rs.prototype,"date",void 0);g([w({type:Gc,optional:!0})],rs.prototype,"other",void 0);class is{constructor(e={}){this.version=Fn.v4,this.kekid=new rs,this.keyEncryptionAlgorithm=new $n,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],is.prototype,"version",void 0);g([w({type:rs})],is.prototype,"kekid",void 0);g([w({type:$n})],is.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Te})],is.prototype,"encryptedKey",void 0);class os{constructor(e={}){this.version=Fn.v0,this.keyEncryptionAlgorithm=new $n,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],os.prototype,"version",void 0);g([w({type:Lu,context:0,optional:!0})],os.prototype,"keyDerivationAlgorithm",void 0);g([w({type:$n})],os.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Te})],os.prototype,"encryptedKey",void 0);class Pp{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Pp.prototype,"oriType",void 0);g([w({type:T.Any})],Pp.prototype,"oriValue",void 0);let hr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ns,optional:!0})],hr.prototype,"ktri",void 0);g([w({type:Zi,context:1,implicit:!0,optional:!0})],hr.prototype,"kari",void 0);g([w({type:is,context:2,implicit:!0,optional:!0})],hr.prototype,"kekri",void 0);g([w({type:os,context:3,implicit:!0,optional:!0})],hr.prototype,"pwri",void 0);g([w({type:Pp,context:4,implicit:!0,optional:!0})],hr.prototype,"ori",void 0);hr=g([X({type:K.Choice})],hr);var Ju;let Ta=Ju=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ju.prototype)}};Ta=Ju=g([X({type:K.Set,itemType:hr})],Ta);var Yu;class Xc{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Xc.prototype,"otherRevInfoFormat",void 0);g([w({type:T.Any})],Xc.prototype,"otherRevInfo",void 0);let Oa=class{constructor(e={}){this.other=new Xc,Object.assign(this,e)}};g([w({type:Xc,context:1,implicit:!0})],Oa.prototype,"other",void 0);Oa=g([X({type:K.Choice})],Oa);let za=Yu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Yu.prototype)}};za=Yu=g([X({type:K.Set,itemType:Oa})],za);class Bp{constructor(e={}){Object.assign(this,e)}}g([w({type:Ca,context:0,implicit:!0,optional:!0})],Bp.prototype,"certs",void 0);g([w({type:za,context:1,implicit:!0,optional:!0})],Bp.prototype,"crls",void 0);var Zu;let Qu=Zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Zu.prototype)}};Qu=Zu=g([X({type:K.Set,itemType:Ji})],Qu);class ss{constructor(e={}){this.version=Fn.v0,this.recipientInfos=new Ta,this.encryptedContentInfo=new ts,Object.assign(this,e)}}g([w({type:T.Integer})],ss.prototype,"version",void 0);g([w({type:Bp,context:0,implicit:!0,optional:!0})],ss.prototype,"originatorInfo",void 0);g([w({type:Ta})],ss.prototype,"recipientInfos",void 0);g([w({type:ts})],ss.prototype,"encryptedContentInfo",void 0);g([w({type:Qu,context:1,implicit:!0,optional:!0})],ss.prototype,"unprotectedAttrs",void 0);const k3="1.2.840.113549.1.7.2";var ed;let Da=ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ed.prototype)}};Da=ed=g([X({type:K.Set,itemType:So})],Da);class Qi{constructor(e={}){this.version=Fn.v0,this.digestAlgorithms=new Da,this.encapContentInfo=new Kc,this.signerInfos=new Ea,Object.assign(this,e)}}g([w({type:T.Integer})],Qi.prototype,"version",void 0);g([w({type:Da})],Qi.prototype,"digestAlgorithms",void 0);g([w({type:Kc})],Qi.prototype,"encapContentInfo",void 0);g([w({type:Ca,context:0,implicit:!0,optional:!0})],Qi.prototype,"certificates",void 0);g([w({type:za,context:1,implicit:!0,optional:!0})],Qi.prototype,"crls",void 0);g([w({type:Ea})],Qi.prototype,"signerInfos",void 0);const Io="1.2.840.10045.2.1",jp="1.2.840.10045.4.1",m1="1.2.840.10045.4.3.1",Lp="1.2.840.10045.4.3.2",Fp="1.2.840.10045.4.3.3",Up="1.2.840.10045.4.3.4",A0="1.2.840.10045.3.1.7",k0="1.3.132.0.34",E0="1.3.132.0.35";function as(t){return new ce({algorithm:t})}const E3=as(jp);as(m1);const S3=as(Lp),N3=as(Fp),C3=as(Up);let To=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],To.prototype,"fieldType",void 0);g([w({type:T.Any})],To.prototype,"parameters",void 0);To=g([X({type:K.Sequence})],To);class I3 extends Te{}let Bi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.OctetString})],Bi.prototype,"a",void 0);g([w({type:T.OctetString})],Bi.prototype,"b",void 0);g([w({type:T.BitString,optional:!0})],Bi.prototype,"seed",void 0);Bi=g([X({type:K.Sequence})],Bi);var td;(function(t){t[t.ecpVer1=1]="ecpVer1"})(td||(td={}));let Un=class{constructor(e={}){this.version=td.ecpVer1,Object.assign(this,e)}};g([w({type:T.Integer})],Un.prototype,"version",void 0);g([w({type:To})],Un.prototype,"fieldID",void 0);g([w({type:Bi})],Un.prototype,"curve",void 0);g([w({type:I3})],Un.prototype,"base",void 0);g([w({type:T.Integer,converter:Ue})],Un.prototype,"order",void 0);g([w({type:T.Integer,optional:!0})],Un.prototype,"cofactor",void 0);Un=g([X({type:K.Sequence})],Un);let gr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],gr.prototype,"namedCurve",void 0);g([w({type:T.Null})],gr.prototype,"implicitCurve",void 0);g([w({type:Un})],gr.prototype,"specifiedCurve",void 0);gr=g([X({type:K.Choice})],gr);class Jc{constructor(e={}){this.version=1,this.privateKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],Jc.prototype,"version",void 0);g([w({type:Te})],Jc.prototype,"privateKey",void 0);g([w({type:gr,context:0,optional:!0})],Jc.prototype,"parameters",void 0);g([w({type:T.BitString,context:1,optional:!0})],Jc.prototype,"publicKey",void 0);class Ra{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],Ra.prototype,"r",void 0);g([w({type:T.Integer,converter:Ue})],Ra.prototype,"s",void 0);const St="1.2.840.113549.1.1",Kr=`${St}.1`,T3=`${St}.7`,O3=`${St}.9`,yo=`${St}.10`,z3=`${St}.2`,D3=`${St}.4`,Pa=`${St}.5`,R3=`${St}.14`,nd=`${St}.11`,Ba=`${St}.12`,ja=`${St}.13`,_1=`${St}.15`,y1=`${St}.16`,La="1.3.14.3.2.26",w1="2.16.840.1.101.3.4.2.4",Fa="2.16.840.1.101.3.4.2.1",Ua="2.16.840.1.101.3.4.2.2",Ma="2.16.840.1.101.3.4.2.3",P3="2.16.840.1.101.3.4.2.5",B3="2.16.840.1.101.3.4.2.6",j3="1.2.840.113549.2.2",L3="1.2.840.113549.2.5",Yc=`${St}.8`;function et(t){return new ce({algorithm:t,parameters:null})}et(j3);et(L3);const Gr=et(La);et(w1);et(Fa);et(Ua);et(Ma);et(P3);et(B3);const v1=new ce({algorithm:Yc,parameters:te.serialize(Gr)}),b1=new ce({algorithm:O3,parameters:te.serialize(_a.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});et(Kr);et(z3);et(D3);et(Pa);et(_1);et(y1);et(Ba);et(ja);et(_1);et(y1);class Zc{constructor(e={}){this.hashAlgorithm=new ce(Gr),this.maskGenAlgorithm=new ce({algorithm:Yc,parameters:te.serialize(Gr)}),this.pSourceAlgorithm=new ce(b1),Object.assign(this,e)}}g([w({type:ce,context:0,defaultValue:Gr})],Zc.prototype,"hashAlgorithm",void 0);g([w({type:ce,context:1,defaultValue:v1})],Zc.prototype,"maskGenAlgorithm",void 0);g([w({type:ce,context:2,defaultValue:b1})],Zc.prototype,"pSourceAlgorithm",void 0);new ce({algorithm:T3,parameters:te.serialize(new Zc)});class Wr{constructor(e={}){this.hashAlgorithm=new ce(Gr),this.maskGenAlgorithm=new ce({algorithm:Yc,parameters:te.serialize(Gr)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}g([w({type:ce,context:0,defaultValue:Gr})],Wr.prototype,"hashAlgorithm",void 0);g([w({type:ce,context:1,defaultValue:v1})],Wr.prototype,"maskGenAlgorithm",void 0);g([w({type:T.Integer,context:2,defaultValue:20})],Wr.prototype,"saltLength",void 0);g([w({type:T.Integer,context:3,defaultValue:1})],Wr.prototype,"trailerField",void 0);new ce({algorithm:yo,parameters:te.serialize(new Wr)});class Qc{constructor(e={}){this.digestAlgorithm=new ce,this.digest=new Te,Object.assign(this,e)}}g([w({type:ce})],Qc.prototype,"digestAlgorithm",void 0);g([w({type:Te})],Qc.prototype,"digest",void 0);var rd;class el{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],el.prototype,"prime",void 0);g([w({type:T.Integer,converter:Ue})],el.prototype,"exponent",void 0);g([w({type:T.Integer,converter:Ue})],el.prototype,"coefficient",void 0);let id=rd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};id=rd=g([X({type:K.Sequence,itemType:el})],id);class En{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)}}g([w({type:T.Integer})],En.prototype,"version",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"modulus",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"publicExponent",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"privateExponent",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"prime1",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"prime2",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"exponent1",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"exponent2",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"coefficient",void 0);g([w({type:id,optional:!0})],En.prototype,"otherPrimeInfos",void 0);class Mp{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],Mp.prototype,"modulus",void 0);g([w({type:T.Integer,converter:Ue})],Mp.prototype,"publicExponent",void 0);var od;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(od||(od={}));const bt=od;/*! *****************************************************************************
146
+ `)}`:`${n} :`}}c2=kt;le.Constructed=c2;kt.NAME="CONSTRUCTED";class l2 extends mt{fromBER(e,n,r){return n}toBER(e){return un}}l2.override="EndOfContentValueBlock";var u2;class up extends ct{constructor(e={}){super(e,l2),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}u2=up;le.EndOfContent=u2;up.NAME=ko;var d2;class Fr extends ct{constructor(e={}){super(e,mt),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}`}}d2=Fr;le.Null=d2;Fr.NAME="NULL";class p2 extends An(mt){constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=re.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,n,r){const i=re.toUint8Array(e);return Gn(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,e2.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}p2.NAME="BooleanValueBlock";var f2;let vc=class extends ct{constructor(e={}){super(e,p2),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};f2=vc;le.Boolean=f2;vc.NAME="BOOLEAN";class h2 extends An(lr){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=lr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let o=0;o<this.value.length;o++){const c=this.value[o].constructor.NAME;if(c===ko){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==t2)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?lr.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}h2.NAME="OctetStringValueBlock";var g2;let Br=class m2 extends ct{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},h2),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,n,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,r===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),n;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(o.byteLength){const c=Ki(o,0,o.byteLength);c.offset!==-1&&c.offset===r&&(this.valueBlock.value=[c.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?kt.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${fe.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof m2&&e.push(n.valueBlock.valueHexView);return re.concat(e)}};g2=Br;le.OctetString=g2;Br.NAME=t2;class _2 extends An(lr){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=lr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const l of this.value){const u=l.constructor.NAME;if(u===ko){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==n2)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 o=re.toUint8Array(e);if(!Gn(this,o,n,r))return-1;const c=o.subarray(n,n+r);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const l=c.subarray(1);try{if(l.byteLength){const u=Ki(l,0,l.byteLength);u.offset!==-1&&u.offset===r-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,n+r}toBER(e,n){if(this.isConstructed)return lr.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return un;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}}}_2.NAME="BitStringValueBlock";var y2;let jr=class extends ct{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},_2),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 kt.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const i of n)e.push(i.toString(2).padStart(8,"0"));const r=e.join("");return`${this.constructor.NAME} : ${r.substring(0,r.length-this.valueBlock.unusedBits)}`}}};y2=jr;le.BitString=y2;jr.NAME=n2;var w2;function qb(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let o=r.slice(0);const c=o.length-1,l=i.slice(0),u=l.length-1;let d=0;const f=u<c?c:u;let h=0;for(let _=f;_>=0;_--,h++){switch(!0){case h<l.length:d=o[c-h]+l[u-h]+n[0];break;default:d=o[c-h]+n[0]}switch(n[0]=d/10,!0){case h>=o.length:o=du(new Uint8Array([d%10]),o);break;default:o[c-h]=d%10}}return n[0]>0&&(o=du(n,o)),o}function o0(t){if(t>=ao.length)for(let e=ao.length;e<=t;e++){const n=new Uint8Array([0]);let r=ao[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const o=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=o[0]/10,r[i]=o[0]%10}n[0]>0&&(r=du(n,r)),ao.push(r)}return ao[t]}function Vb(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),o=r.slice(0),c=o.length-1,l=i.slice(0),u=l.length-1;let d,f=0;for(let h=u;h>=0;h--,f++)switch(d=o[c-f]-l[u-f]-n,!0){case d<0:n=1,o[c-f]=d+10;break;default:n=0,o[c-f]=d}if(n>0)for(let h=c-u+1;h>=0;h--,f++)if(d=o[c-f]-n,d<0)n=1,o[c-f]=d+10;else{n=0,o[c-f]=d;break}return o.slice()}class dp extends An(mt){constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=e2.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Tb(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const o=this.fromBER(e,n,r);if(o===-1)return o;const c=this.valueHexView;return c[0]===0&&c[1]&128?this.valueHexView=c.subarray(1):i!==0&&c.length<i&&(i-c.length>1&&(i=c.length+1),this.valueHexView=c.subarray(i-c.length)),o}toDER(e=!1){const n=this.valueHexView;switch(!0){case(n[0]&128)!==0:{const r=new Uint8Array(this.valueHexView.length+1);r[0]=0,r.set(n,1),this.valueHexView=r}break;case(n[0]===0&&(n[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,n,r){const i=super.fromBER(e,n,r);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let n=new Uint8Array(this.valueHexView.length*8/3),r=0,i;const o=this.valueHexView;let c="",l=!1;for(let u=o.byteLength-1;u>=0;u--){i=o[u];for(let d=0;d<8;d++){if((i&1)===1)switch(r){case e:n=Vb(o0(r),n),c="-";break;default:n=qb(n,o0(r))}r++,i>>=1}}for(let u=0;u<n.length;u++)n[u]&&(l=!0),l&&(c+=r0.charAt(n[u]));return l===!1&&(c+=r0.charAt(0)),c}}w2=dp;dp.NAME="IntegerValueBlock";Object.defineProperty(w2.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var v2;class vn extends ct{constructor(e={}){super(e,dp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return ga(),BigInt(this.valueBlock.toString())}static fromBigInt(e){ga();const n=BigInt(e),r=new yc,i=n.toString(16).replace(/^-/,""),o=new Uint8Array(fe.FromHex(i));if(n<0){const l=new Uint8Array(o.length+(o[0]&128?1:0));l[0]|=128;const d=BigInt(`0x${fe.ToHex(l)}`)+n,f=re.toUint8Array(fe.FromHex(d.toString(16)));f[0]|=128,r.write(f)}else o[0]&128&&r.write(new Uint8Array([0])),r.write(o);return new vn({valueHex:r.final()})}convertToDER(){const e=new vn({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new vn({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}v2=vn;le.Integer=v2;vn.NAME="INTEGER";var b2;class bc extends vn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}b2=bc;le.Enumerated=b2;bc.NAME="ENUMERATED";class pu extends An(mt){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=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const c=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)c[l]=this.valueHexView[l];return this.valueHexView=c,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ni(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){ga();let n=BigInt(e).toString(2);for(;n.length%7;)n="0"+n;const r=new Uint8Array(n.length/7);for(let i=0;i<r.length;i++)r[i]=parseInt(n.slice(i*7,i*7+7),2)+(i+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)o[c]=i[c]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Lr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",un;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let c=0;c<o;c++)r[c]=i[c]|128;r[o]=i[o]}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}}}pu.NAME="sidBlock";class x2 extends mt{constructor({value:e=$t,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new pu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e){const n=[];for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(i.byteLength===0)return this.error=this.value[r].error,un;n.push(i)}return cp(n)}fromString(e){this.value=[];let n=0,r=0,i="",o=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,o){const c=this.value[0];let l=0;switch(c.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;c.valueDec=u+l,o=!1}else{const c=new pu;if(i>Number.MAX_SAFE_INTEGER){ga();const l=BigInt(i);c.valueBigInt=l}else if(c.valueDec=parseInt(i,10),isNaN(c.valueDec))return;this.value.length||(c.isFirstSid=!0,o=!0),this.value.push(c)}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}}x2.NAME="ObjectIdentifierValueBlock";var $2;class xc extends ct{constructor(e={}){super(e,x2),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}$2=xc;le.ObjectIdentifier=$2;xc.NAME="OBJECT IDENTIFIER";class fu extends An(ni){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=re.toUint8Array(e);if(!Gn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const c=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)c[l]=this.valueHexView[l];return this.valueHexView=c,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ni(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)o[c]=i[c]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Lr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",un;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let c=0;c<o;c++)r[c]=i[c]|128;r[o]=i[o]}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}}}fu.NAME="relativeSidBlock";class A2 extends mt{constructor({value:e=$t,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new fu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,un;r.push(o)}return cp(r)}fromString(e){this.value=[];let n=0,r=0,i="";do{r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1;const o=new fu;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(r!==-1);return!0}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n&&(i=`{${i}}`),e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}A2.NAME="RelativeObjectIdentifierValueBlock";var k2;class pp extends ct{constructor(e={}){super(e,A2),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}k2=pp;le.RelativeObjectIdentifier=k2;pp.NAME="RelativeObjectIdentifier";var E2;class zn extends kt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}E2=zn;le.Sequence=E2;zn.NAME="SEQUENCE";var S2;let Dn=class extends kt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};S2=Dn;le.Set=S2;Dn.NAME="SET";class N2 extends An(mt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=$t}toJSON(){return{...super.toJSON(),value:this.value}}}N2.NAME="StringValueBlock";class C2 extends N2{}C2.NAME="SimpleStringValueBlock";class Lt extends lp{constructor({...e}={}){super(e,C2)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,re.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}}Lt.NAME="SIMPLE STRING";class I2 extends Lt{fromBuffer(e){this.valueBlock.valueHexView=re.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}}I2.NAME="Utf8StringValueBlock";var T2;class Wn extends I2{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}T2=Wn;le.Utf8String=T2;Wn.NAME="UTF8String";class O2 extends Lt{fromBuffer(e){this.valueBlock.value=fe.ToUtf16String(e),this.valueBlock.valueHexView=re.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf16String(e))}}O2.NAME="BmpStringValueBlock";var z2;class $c extends O2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}z2=$c;le.BmpString=z2;$c.NAME="BMPString";class D2 extends Lt{fromBuffer(e){const n=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),r=new Uint8Array(n);for(let i=0;i<r.length;i+=4)r[i]=r[i+3],r[i+1]=r[i+2],r[i+2]=0,r[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(n))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n*4);for(let i=0;i<n;i++){const o=Lr(e.charCodeAt(i),8),c=new Uint8Array(o);if(c.length>4)continue;const l=4-c.length;for(let u=c.length-1;u>=0;u--)r[i*4+u+l]=c[u]}this.valueBlock.value=e}}D2.NAME="UniversalStringValueBlock";var R2;class Ac extends D2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}R2=Ac;le.UniversalString=R2;Ac.NAME="UniversalString";var P2;class kc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}P2=kc;le.NumericString=P2;kc.NAME="NumericString";var B2;class Ec extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}B2=Ec;le.PrintableString=B2;Ec.NAME="PrintableString";var j2;class Sc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}j2=Sc;le.TeletexString=j2;Sc.NAME="TeletexString";var L2;class Nc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}L2=Nc;le.VideotexString=L2;Nc.NAME="VideotexString";var F2;class Cc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}F2=Cc;le.IA5String=F2;Cc.NAME="IA5String";var U2;class Ic extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}U2=Ic;le.GraphicString=U2;Ic.NAME="GraphicString";var M2;class Jo extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}M2=Jo;le.VisibleString=M2;Jo.NAME="VisibleString";var q2;class Tc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}q2=Tc;le.GeneralString=q2;Tc.NAME="GeneralString";var V2;class Oc extends Lt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}V2=Oc;le.CharacterString=V2;Oc.NAME="CharacterString";var H2;class Yo extends Jo{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,re.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]=Rt(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=Rt(this.month,2),n[2]=Rt(this.day,2),n[3]=Rt(this.hour,2),n[4]=Rt(this.minute,2),n[5]=Rt(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}}}H2=Yo;le.UTCTime=H2;Yo.NAME="UTCTime";var K2;class zc extends Yo{constructor(e={}){var n;super(e),(n=this.millisecond)!==null&&n!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let n=!1,r="",i="",o=0,c,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,_=r.indexOf("+"),$="";if(_===-1&&(_=r.indexOf("-"),h=-1),_!==-1){if($=r.substring(_+1),r=r.substring(0,_),$.length!==2&&$.length!==4)throw new Error("Wrong input string for conversion");let m=parseInt($.substring(0,2),10);if(isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");if(l=h*m,$.length===4){if(m=parseInt($.substring(2,4),10),isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");u=h*m}}}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");o=h.valueOf(),i=r.substring(0,d)}else i=r;switch(!0){case i.length===8:if(c=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;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(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===14:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const h=1e3*o;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}const f=c.exec(i);if(f===null)throw new Error("Wrong input string for conversion");for(let h=1;h<f.length;h++)switch(h){case 1:this.year=parseInt(f[h],10);break;case 2:this.month=parseInt(f[h],10);break;case 3:this.day=parseInt(f[h],10);break;case 4:this.hour=parseInt(f[h],10)+l;break;case 5:this.minute=parseInt(f[h],10)+u;break;case 6:this.second=parseInt(f[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(Rt(this.year,4)),n.push(Rt(this.month,2)),n.push(Rt(this.day,2)),n.push(Rt(this.hour,2)),n.push(Rt(this.minute,2)),n.push(Rt(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(Rt(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}K2=zc;le.GeneralizedTime=K2;zc.NAME="GeneralizedTime";var G2;class fp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}G2=fp;le.DATE=G2;fp.NAME="DATE";var W2;class hp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}W2=hp;le.TimeOfDay=W2;hp.NAME="TimeOfDay";var X2;class gp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}X2=gp;le.DateTime=X2;gp.NAME="DateTime";var J2;class mp extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}J2=mp;le.Duration=J2;mp.NAME="Duration";var Y2;class _p extends Wn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}Y2=_p;le.TIME=Y2;_p.NAME="TIME";class Ur{constructor({name:e=$t,optional:n=!1}={}){this.name=e,this.optional=n}}class yp extends Ur{constructor({value:e=[],...n}={}){super(n),this.value=e}}class ma extends Ur{constructor({value:e=new Ur,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class Hb{constructor({data:e=wc}={}){this.dataView=re.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=re.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=re.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function Dr(t,e,n){if(n instanceof yp){for(let o=0;o<n.value.length;o++)if(Dr(t,e,n.value[o]).verified)return{verified:!0,result:t};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Sl)&&(o.name=n.name),o}}if(n instanceof Ur)return n.hasOwnProperty(Sl)&&(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(!(Db in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(jb in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Lb 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(Rb)===!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(Pb)===!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(Bb)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(zb 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(!(i0 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=n.idBlock.valueHexView,c=e.idBlock.valueHexView;if(o.length!==c.length)return{verified:!1,result:t};for(let l=0;l<o.length;l++)if(o[l]!==c[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&(t[n.name]=e)),n instanceof le.Constructed){let o=0,c={verified:!1,result:{error:"Unknown error"}},l=n.valueBlock.value.length;if(l>0&&n.valueBlock.value[0]instanceof ma&&(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,$t),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let u=0;u<l;u++)if(u-o>=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,$t),n.name&&(delete t[n.name],d.name=n.name)),d}}else if(n.valueBlock.value[0]instanceof ma){if(c=Dr(t,e.valueBlock.value[u],n.valueBlock.value[0].value),c.verified===!1)if(n.valueBlock.value[0].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&delete t[n.name]),c;if(Sl in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let d={};Fb 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(c=Dr(t,e.valueBlock.value[u-o],n.valueBlock.value[u]),c.verified===!1)if(n.valueBlock.value[u].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&delete t[n.name]),c;if(c.verified===!1){const u={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&(delete t[n.name],u.name=n.name)),u}return{verified:!0,result:t}}if(n.primitiveSchema&&i0 in e.valueBlock){const o=Ki(e.valueBlock.valueHexView);if(o.offset===-1){const c={verified:!1,result:o.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,$t),n.name&&(delete t[n.name],c.name=n.name)),c}return Dr(t,o.result,n.primitiveSchema)}return{verified:!0,result:t}}function Kb(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Ki(re.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:Dr(n.result,n.result,e)}const Z2=Object.freeze(Object.defineProperty({__proto__:null,Any:Ur,BaseBlock:ct,BaseStringBlock:lp,BitString:jr,BmpString:$c,Boolean:vc,CharacterString:Oc,Choice:yp,Constructed:kt,DATE:fp,DateTime:gp,Duration:mp,EndOfContent:up,Enumerated:bc,GeneralString:Tc,GeneralizedTime:zc,GraphicString:Ic,HexBlock:An,IA5String:Cc,Integer:vn,Null:Fr,NumericString:kc,ObjectIdentifier:xc,OctetString:Br,Primitive:Xo,PrintableString:Ec,RawData:Hb,RelativeObjectIdentifier:pp,Repeated:ma,Sequence:zn,Set:Dn,TIME:_p,TeletexString:Sc,TimeOfDay:hp,UTCTime:Yo,UniversalString:Ac,Utf8String:Wn,ValueBlock:mt,VideotexString:Nc,ViewWriter:yc,VisibleString:Jo,compareSchema:Dr,fromBER:$i,verifySchema:Kb},Symbol.toStringTag,{value:"Module"}));var K;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(K||(K={}));var T;(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"})(T||(T={}));class Dc{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(re.isBufferSource(e))this.unusedBits=n,this.value=re.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof jr))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 jr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new jr({name:e})}toNumber(){let e="";const n=new Uint8Array(this.value);for(const r of n)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let n=e.toString(2);const r=n.length+7>>3;this.unusedBits=(r<<3)-n.length;const i=new Uint8Array(r);n=n.padStart(r<<3,"0").split("").reverse().join("");let o=0;for(;o<r;)i[o]=parseInt(n.slice(o<<3,(o<<3)+8),2),o++;this.value=i.buffer}}class Te{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):re.isBufferSource(e)?this.buffer=re.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Br))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Br({valueHex:this.buffer})}toSchema(e){return new Br({name:e})}}const Gb={fromASN:t=>t instanceof Fr?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new Fr;const e=$i(t);if(e.result.error)throw new Error(e.result.error);return e.result}},Wb={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new vn({value:+t})},Xb={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new bc({value:t})},Ue={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new vn({valueHex:t})},Jb={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new jr({valueHex:t})},Yb={fromASN:t=>t.valueBlock.toString(),toASN:t=>new xc({value:t})},Zb={fromASN:t=>t.valueBlock.value,toASN:t=>new vc({value:t})},_a={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Br({valueHex:t})},Qb={fromASN:t=>new Te(t.getValue()),toASN:t=>t.toASN()};function Xt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const Q2=Xt(Wn),e3=Xt($c),t3=Xt(Ac),n3=Xt(kc),r3=Xt(Ec),i3=Xt(Sc),o3=Xt(Nc),s3=Xt(Cc),a3=Xt(Ic),c3=Xt(Jo),l3=Xt(Tc),u3=Xt(Oc),d3={fromASN:t=>t.toDate(),toASN:t=>new Yo({valueDate:t})},p3={fromASN:t=>t.toDate(),toASN:t=>new zc({valueDate:t})},f3={fromASN:()=>null,toASN:()=>new Fr};function wp(t){switch(t){case T.Any:return Gb;case T.BitString:return Jb;case T.BmpString:return e3;case T.Boolean:return Zb;case T.CharacterString:return u3;case T.Enumerated:return Xb;case T.GeneralString:return l3;case T.GeneralizedTime:return p3;case T.GraphicString:return a3;case T.IA5String:return s3;case T.Integer:return Wb;case T.Null:return f3;case T.NumericString:return n3;case T.ObjectIdentifier:return Yb;case T.OctetString:return _a;case T.PrintableString:return r3;case T.TeletexString:return i3;case T.UTCTime:return d3;case T.UniversalString:return t3;case T.Utf8String:return Q2;case T.VideotexString:return o3;case T.VisibleString:return c3;default:return null}}function On(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:On(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function e1(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:e1(n)}return!1}function h3(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 g3{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:K.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(n,r),n.items=Object.assign({},n.items,r.items)),n}create(e,n){const r=this.items.get(e)||this.createDefault(e),i=[];for(const o in r.items){const c=r.items[o],l=n?o:"";let u;if(typeof c.type=="number"){const f=T[c.type],h=Z2[f];if(!h)throw new Error(`Cannot get ASN1 class by name '${f}'`);u=new h({name:l})}else On(c.type)?u=new c.type().toSchema(l):c.optional?this.get(c.type).type===K.Choice?u=new Ur({name:l}):(u=this.create(c.type,!1),u.name=l):u=new Ur({name:l});const d=!!c.optional||c.defaultValue!==void 0;if(c.repeated){u.name="";const f=c.repeated==="set"?Dn:zn;u=new f({name:"",value:[new ma({name:l,value:u})]})}if(c.context!==null&&c.context!==void 0)if(c.implicit)if(typeof c.type=="number"||On(c.type)){const f=c.repeated?kt:Xo;i.push(new f({name:l,optional:d,idBlock:{tagClass:3,tagNumber:c.context}}))}else{this.cache(c.type);const f=!!c.repeated;let h=f?u:this.get(c.type,!0).schema;h="valueBlock"in h?h.valueBlock.value:h.value,i.push(new kt({name:f?"":l,optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:h}))}else i.push(new kt({optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else u.optional=d,i.push(u)}switch(r.type){case K.Sequence:return new zn({value:i,name:""});case K.Set:return new Dn({value:i,name:""});case K.Choice:return new yp({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 Ht=new g3,X=t=>e=>{let n;Ht.has(e)?n=Ht.get(e):(n=Ht.createDefault(e),Ht.set(e,n)),Object.assign(n,t)},w=t=>(e,n)=>{let r;Ht.has(e.constructor)?r=Ht.get(e.constructor):(r=Ht.createDefault(e.constructor),Ht.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const o=wp(t.type);if(!o)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=o}r.items[n]=i};class s0 extends Error{constructor(){super(...arguments),this.schemas=[]}}class m3{static parse(e,n){const r=$i(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){var r;try{if(On(n))return new n().fromASN(e);const i=Ht.get(n);Ht.cache(n);let o=i.schema;if(e.constructor===kt&&i.type!==K.Choice){o=new kt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(const u in i.items)delete e[u]}const c=Dr({},e,o);if(!c.verified)throw new s0(`Data does not match to ${n.name} ASN1 schema. ${c.result.error}`);const l=new n;if(e1(n)){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const u=i.itemType;if(typeof u=="number"){const d=wp(u);if(!d)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);return n.from(e.valueBlock.value,f=>d.fromASN(f))}else return n.from(e.valueBlock.value,d=>this.fromASN(d,u))}for(const u in i.items){const d=c.result[u];if(!d)continue;const f=i.items[u],h=f.type;if(typeof h=="number"||On(h)){const _=(r=f.converter)!==null&&r!==void 0?r:On(h)?new h:null;if(!_)throw new Error("Converter is empty");if(f.repeated)if(f.implicit){const $=f.repeated==="sequence"?zn:Dn,m=new $;m.valueBlock=d.valueBlock;const x=$i(m.toBER(!1));if(x.offset===-1)throw new Error(`Cannot parse the child item. ${x.result.error}`);if(!("value"in x.result.valueBlock&&Array.isArray(x.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const S=x.result.valueBlock.value;l[u]=Array.from(S,k=>_.fromASN(k))}else l[u]=Array.from(d,$=>_.fromASN($));else{let $=d;if(f.implicit){let m;if(On(h))m=new h().toSchema("");else{const x=T[h],S=Z2[x];if(!S)throw new Error(`Cannot get '${x}' class from asn1js module`);m=new S}m.valueBlock=$.valueBlock,$=$i(m.toBER(!1)).result}l[u]=_.fromASN($)}}else if(f.repeated){if(!Array.isArray(d))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");l[u]=Array.from(d,_=>this.fromASN(_,h))}else l[u]=this.fromASN(d,h)}return l}catch(i){throw i instanceof s0&&i.schemas.push(n.name),i}}}class vp{static serialize(e){return e instanceof ct?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&On(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=Ht.get(n);Ht.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 c=wp(r.itemType);if(!c)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(l=>c.toASN(l))}else i=e.map(c=>this.toAsnItem({type:r.itemType},"[]",n,c))}else for(const c in r.items){const l=r.items[c],u=e[c];if(u===void 0||l.defaultValue===u||typeof l.defaultValue=="object"&&typeof u=="object"&&h3(this.serialize(l.defaultValue),this.serialize(u)))continue;const d=vp.toAsnItem(l,c,n,u);if(typeof l.context=="number")if(l.implicit)if(!l.repeated&&(typeof l.type=="number"||On(l.type))){const f={};f.valueHex=d instanceof Fr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new Xo({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},...f}))}else i.push(new kt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:d.valueBlock.value}));else i.push(new kt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:[d]}));else l.repeated?i=i.concat(d):i.push(d)}let o;switch(r.type){case K.Sequence:o=new zn({value:i});break;case K.Set:o=new Dn({value:i});break;case K.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,n,r,i){let o;if(typeof e.type=="number"){const c=e.converter;if(!c)throw new Error(`Property '${n}' doesn't have converter for type ${T[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=>c.toASN(d)),u=e.repeated==="sequence"?zn:Dn;o=new u({value:l})}else o=c.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,u=>this.toASN(u)),l=e.repeated==="sequence"?zn:Dn;o=new l({value:c})}else o=this.toASN(i);return o}}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 vp.serialize(e)}static parse(e,n){return m3.parse(e,n)}static toString(e){const n=re.isBufferSource(e)?re.toArrayBuffer(e):te.serialize(e),r=$i(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function g(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(i<3?c(o):i>3?c(e,n,o):c(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}var t1={exports:{}};(function(t){(function(e){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",l="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${l})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${l})|(?:::)(?:${l})?)${n}\\.${n}\\.${n}\\.${n}(${c})?$`,"i")};function d(m,x){if(m.indexOf("::")!==m.lastIndexOf("::"))return null;let S=0,k=-1,v=(m.match(u.zoneIndex)||[])[0],O,q;for(v&&(v=v.substring(1),m=m.replace(/%.+$/,""));(k=m.indexOf(":",k+1))>=0;)S++;if(m.substr(0,2)==="::"&&S--,m.substr(-2,2)==="::"&&S--,S>x)return null;for(q=x-S,O=":";q--;)O+="0:";return m=m.replace("::",O),m[0]===":"&&(m=m.slice(1)),m[m.length-1]===":"&&(m=m.slice(0,-1)),x=function(){const F=m.split(":"),H=[];for(let W=0;W<F.length;W++)H.push(parseInt(F[W],16));return H}(),{parts:x,zoneId:v}}function f(m,x,S,k){if(m.length!==x.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let v=0,O;for(;k>0;){if(O=S-k,O<0&&(O=0),m[v]>>O!==x[v]>>O)return!1;k-=S,v+=1}return!0}function h(m){if(o.test(m))return parseInt(m,16);if(m[0]==="0"&&!isNaN(parseInt(m[1],10))){if(i.test(m))return parseInt(m,8);throw new Error(`ipaddr: cannot parse ${m} as octal`)}return parseInt(m,10)}function _(m,x){for(;m.length<x;)m=`0${m}`;return m}const $={};$.IPv4=function(){function m(x){if(x.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let S,k;for(S=0;S<x.length;S++)if(k=x[S],!(0<=k&&k<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=x}return m.prototype.SpecialRanges={unspecified:[[new m([0,0,0,0]),8]],broadcast:[[new m([255,255,255,255]),32]],multicast:[[new m([224,0,0,0]),4]],linkLocal:[[new m([169,254,0,0]),16]],loopback:[[new m([127,0,0,0]),8]],carrierGradeNat:[[new m([100,64,0,0]),10]],private:[[new m([10,0,0,0]),8],[new m([172,16,0,0]),12],[new m([192,168,0,0]),16]],reserved:[[new m([192,0,0,0]),24],[new m([192,0,2,0]),24],[new m([192,88,99,0]),24],[new m([198,18,0,0]),15],[new m([198,51,100,0]),24],[new m([203,0,113,0]),24],[new m([240,0,0,0]),4]],as112:[[new m([192,175,48,0]),24],[new m([192,31,196,0]),24]],amt:[[new m([192,52,193,0]),24]]},m.prototype.kind=function(){return"ipv4"},m.prototype.match=function(x,S){let k;if(S===void 0&&(k=x,x=k[0],S=k[1]),x.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,x.octets,8,S)},m.prototype.prefixLengthFromSubnetMask=function(){let x=0,S=!1;const k={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let v,O,q;for(v=3;v>=0;v-=1)if(O=this.octets[v],O in k){if(q=k[O],S&&q!==0)return null;q!==8&&(S=!0),x+=q}else return null;return 32-x},m.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},m.prototype.toByteArray=function(){return this.octets.slice(0)},m.prototype.toIPv4MappedAddress=function(){return $.IPv6.parse(`::ffff:${this.toString()}`)},m.prototype.toNormalizedString=function(){return this.toString()},m.prototype.toString=function(){return this.octets.join(".")},m}(),$.IPv4.broadcastAddressFromCIDR=function(m){try{const x=this.parseCIDR(m),S=x[0].toByteArray(),k=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[];let O=0;for(;O<4;)v.push(parseInt(S[O],10)|parseInt(k[O],10)^255),O++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.isIPv4=function(m){return this.parser(m)!==null},$.IPv4.isValid=function(m){try{return new this(this.parser(m)),!0}catch{return!1}},$.IPv4.isValidCIDR=function(m){try{return this.parseCIDR(m),!0}catch{return!1}},$.IPv4.isValidFourPartDecimal=function(m){return!!($.IPv4.isValid(m)&&m.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},$.IPv4.networkAddressFromCIDR=function(m){let x,S,k,v,O;try{for(x=this.parseCIDR(m),k=x[0].toByteArray(),O=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[],S=0;S<4;)v.push(parseInt(k[S],10)&parseInt(O[S],10)),S++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.parse=function(m){const x=this.parser(m);if(x===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(x)},$.IPv4.parseCIDR=function(m){let x;if(x=m.match(/^(.+)\/(\d+)$/)){const S=parseInt(x[2]);if(S>=0&&S<=32){const k=[this.parse(x[1]),S];return Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},$.IPv4.parser=function(m){let x,S,k;if(x=m.match(r.fourOctet))return function(){const v=x.slice(1,6),O=[];for(let q=0;q<v.length;q++)S=v[q],O.push(h(S));return O}();if(x=m.match(r.longValue)){if(k=h(x[1]),k>4294967295||k<0)throw new Error("ipaddr: address outside defined range");return function(){const v=[];let O;for(O=0;O<=24;O+=8)v.push(k>>O&255);return v}().reverse()}else return(x=m.match(r.twoOctet))?function(){const v=x.slice(1,4),O=[];if(k=h(v[1]),k>16777215||k<0)throw new Error("ipaddr: address outside defined range");return O.push(h(v[0])),O.push(k>>16&255),O.push(k>>8&255),O.push(k&255),O}():(x=m.match(r.threeOctet))?function(){const v=x.slice(1,5),O=[];if(k=h(v[2]),k>65535||k<0)throw new Error("ipaddr: address outside defined range");return O.push(h(v[0])),O.push(h(v[1])),O.push(k>>8&255),O.push(k&255),O}():null},$.IPv4.subnetMaskFromPrefixLength=function(m){if(m=parseInt(m),m<0||m>32)throw new Error("ipaddr: invalid IPv4 prefix length");const x=[0,0,0,0];let S=0;const k=Math.floor(m/8);for(;S<k;)x[S]=255,S++;return k<4&&(x[k]=Math.pow(2,m%8)-1<<8-m%8),new this(x)},$.IPv6=function(){function m(x,S){let k,v;if(x.length===16)for(this.parts=[],k=0;k<=14;k+=2)this.parts.push(x[k]<<8|x[k+1]);else if(x.length===8)this.parts=x;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(k=0;k<this.parts.length;k++)if(v=this.parts[k],!(0<=v&&v<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");S&&(this.zoneId=S)}return m.prototype.SpecialRanges={unspecified:[new m([0,0,0,0,0,0,0,0]),128],linkLocal:[new m([65152,0,0,0,0,0,0,0]),10],multicast:[new m([65280,0,0,0,0,0,0,0]),8],loopback:[new m([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new m([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new m([0,0,0,0,0,65535,0,0]),96],discard:[new m([256,0,0,0,0,0,0,0]),64],rfc6145:[new m([0,0,0,0,65535,0,0,0]),96],rfc6052:[new m([100,65435,0,0,0,0,0,0]),96],"6to4":[new m([8194,0,0,0,0,0,0,0]),16],teredo:[new m([8193,0,0,0,0,0,0,0]),32],benchmarking:[new m([8193,2,0,0,0,0,0,0]),48],amt:[new m([8193,3,0,0,0,0,0,0]),32],as112v6:[[new m([8193,4,274,0,0,0,0,0]),48],[new m([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new m([8193,16,0,0,0,0,0,0]),28],orchid2:[new m([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new m([8193,48,0,0,0,0,0,0]),28],reserved:[[new m([8193,0,0,0,0,0,0,0]),23],[new m([8193,3512,0,0,0,0,0,0]),32]]},m.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},m.prototype.kind=function(){return"ipv6"},m.prototype.match=function(x,S){let k;if(S===void 0&&(k=x,x=k[0],S=k[1]),x.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,x.parts,16,S)},m.prototype.prefixLengthFromSubnetMask=function(){let x=0,S=!1;const k={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let v,O;for(let q=7;q>=0;q-=1)if(v=this.parts[q],v in k){if(O=k[v],S&&O!==0)return null;O!==16&&(S=!0),x+=O}else return null;return 128-x},m.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},m.prototype.toByteArray=function(){let x;const S=[],k=this.parts;for(let v=0;v<k.length;v++)x=k[v],S.push(x>>8),S.push(x&255);return S},m.prototype.toFixedLengthString=function(){const x=(function(){const k=[];for(let v=0;v<this.parts.length;v++)k.push(_(this.parts[v].toString(16),4));return k}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),x+S},m.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const x=this.parts.slice(-2),S=x[0],k=x[1];return new $.IPv4([S>>8,S&255,k>>8,k&255])},m.prototype.toNormalizedString=function(){const x=(function(){const k=[];for(let v=0;v<this.parts.length;v++)k.push(this.parts[v].toString(16));return k}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),x+S},m.prototype.toRFC5952String=function(){const x=/((^|:)(0(:|$)){2,})/g,S=this.toNormalizedString();let k=0,v=-1,O;for(;O=x.exec(S);)O[0].length>v&&(k=O.index,v=O[0].length);return v<0?S:`${S.substring(0,k)}::${S.substring(k+v)}`},m.prototype.toString=function(){return this.toRFC5952String()},m}(),$.IPv6.broadcastAddressFromCIDR=function(m){try{const x=this.parseCIDR(m),S=x[0].toByteArray(),k=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[];let O=0;for(;O<16;)v.push(parseInt(S[O],10)|parseInt(k[O],10)^255),O++;return new this(v)}catch(x){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${x})`)}},$.IPv6.isIPv6=function(m){return this.parser(m)!==null},$.IPv6.isValid=function(m){if(typeof m=="string"&&m.indexOf(":")===-1)return!1;try{const x=this.parser(m);return new this(x.parts,x.zoneId),!0}catch{return!1}},$.IPv6.isValidCIDR=function(m){if(typeof m=="string"&&m.indexOf(":")===-1)return!1;try{return this.parseCIDR(m),!0}catch{return!1}},$.IPv6.networkAddressFromCIDR=function(m){let x,S,k,v,O;try{for(x=this.parseCIDR(m),k=x[0].toByteArray(),O=this.subnetMaskFromPrefixLength(x[1]).toByteArray(),v=[],S=0;S<16;)v.push(parseInt(k[S],10)&parseInt(O[S],10)),S++;return new this(v)}catch(q){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${q})`)}},$.IPv6.parse=function(m){const x=this.parser(m);if(x.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(x.parts,x.zoneId)},$.IPv6.parseCIDR=function(m){let x,S,k;if((S=m.match(/^(.+)\/(\d+)$/))&&(x=parseInt(S[2]),x>=0&&x<=128))return k=[this.parse(S[1]),x],Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},$.IPv6.parser=function(m){let x,S,k,v,O,q;if(k=m.match(u.deprecatedTransitional))return this.parser(`::ffff:${k[1]}`);if(u.native.test(m))return d(m,8);if((k=m.match(u.transitional))&&(q=k[6]||"",x=k[1],k[1].endsWith("::")||(x=x.slice(0,-1)),x=d(x+q,6),x.parts)){for(O=[parseInt(k[2]),parseInt(k[3]),parseInt(k[4]),parseInt(k[5])],S=0;S<O.length;S++)if(v=O[S],!(0<=v&&v<=255))return null;return x.parts.push(O[0]<<8|O[1]),x.parts.push(O[2]<<8|O[3]),{parts:x.parts,zoneId:x.zoneId}}return null},$.IPv6.subnetMaskFromPrefixLength=function(m){if(m=parseInt(m),m<0||m>128)throw new Error("ipaddr: invalid IPv6 prefix length");const x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let S=0;const k=Math.floor(m/8);for(;S<k;)x[S]=255,S++;return k<16&&(x[k]=Math.pow(2,m%8)-1<<8-m%8),new this(x)},$.fromByteArray=function(m){const x=m.length;if(x===4)return new $.IPv4(m);if(x===16)return new $.IPv6(m);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},$.isValid=function(m){return $.IPv6.isValid(m)||$.IPv4.isValid(m)},$.isValidCIDR=function(m){return $.IPv6.isValidCIDR(m)||$.IPv4.isValidCIDR(m)},$.parse=function(m){if($.IPv6.isValid(m))return $.IPv6.parse(m);if($.IPv4.isValid(m))return $.IPv4.parse(m);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},$.parseCIDR=function(m){try{return $.IPv6.parseCIDR(m)}catch{try{return $.IPv4.parseCIDR(m)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},$.process=function(m){const x=this.parse(m);return x.kind()==="ipv6"&&x.isIPv4MappedAddress()?x.toIPv4Address():x},$.subnetMatch=function(m,x,S){let k,v,O,q;S==null&&(S="unicast");for(v in x)if(Object.prototype.hasOwnProperty.call(x,v)){for(O=x[v],O[0]&&!(O[0]instanceof Array)&&(O=[O]),k=0;k<O.length;k++)if(q=O[k],m.kind()===q[0].kind()&&m.match.apply(m,q))return v}return S},t.exports?t.exports=$:e.ipaddr=$})(sr)})(t1);var a0=t1.exports;class c0{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const n=parseInt(e.slice(8),16).toString(2).split("").reduce((i,o)=>i+ +o,0);let r=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return r=r.slice(0,-1),`${r}/${n}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const n=new Uint8Array(e);return a0.fromByteArray(Array.from(n)).toString()}return this.decodeIP(fe.ToHex(e))}static fromString(e){const n=a0.parse(e);return new Uint8Array(n.toByteArray()).buffer}}var hu,gu,mu;let lt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};g([w({type:T.TeletexString})],lt.prototype,"teletexString",void 0);g([w({type:T.PrintableString})],lt.prototype,"printableString",void 0);g([w({type:T.UniversalString})],lt.prototype,"universalString",void 0);g([w({type:T.Utf8String})],lt.prototype,"utf8String",void 0);g([w({type:T.BmpString})],lt.prototype,"bmpString",void 0);lt=g([X({type:K.Choice})],lt);let Ci=class extends lt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?fe.ToHex(this.anyValue):super.toString())}};g([w({type:T.IA5String})],Ci.prototype,"ia5String",void 0);g([w({type:T.Any})],Ci.prototype,"anyValue",void 0);Ci=g([X({type:K.Choice})],Ci);class Rc{constructor(e={}){this.type="",this.value=new Ci,Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Rc.prototype,"type",void 0);g([w({type:Ci})],Rc.prototype,"value",void 0);let Ii=hu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,hu.prototype)}};Ii=hu=g([X({type:K.Set,itemType:Rc})],Ii);let _u=gu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,gu.prototype)}};_u=gu=g([X({type:K.Sequence,itemType:Ii})],_u);let Xe=mu=class extends _u{constructor(e){super(e),Object.setPrototypeOf(this,mu.prototype)}};Xe=mu=g([X({type:K.Sequence})],Xe);const _3={fromASN:t=>c0.toString(_a.fromASN(t)),toASN:t=>_a.toASN(c0.fromString(t))};class Eo{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Eo.prototype,"typeId",void 0);g([w({type:T.Any,context:0})],Eo.prototype,"value",void 0);class bp{constructor(e={}){this.partyName=new lt,Object.assign(this,e)}}g([w({type:lt,optional:!0,context:0,implicit:!0})],bp.prototype,"nameAssigner",void 0);g([w({type:lt,context:1,implicit:!0})],bp.prototype,"partyName",void 0);let Se=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Eo,context:0,implicit:!0})],Se.prototype,"otherName",void 0);g([w({type:T.IA5String,context:1,implicit:!0})],Se.prototype,"rfc822Name",void 0);g([w({type:T.IA5String,context:2,implicit:!0})],Se.prototype,"dNSName",void 0);g([w({type:T.Any,context:3,implicit:!0})],Se.prototype,"x400Address",void 0);g([w({type:Xe,context:4,implicit:!1})],Se.prototype,"directoryName",void 0);g([w({type:bp,context:5})],Se.prototype,"ediPartyName",void 0);g([w({type:T.IA5String,context:6,implicit:!0})],Se.prototype,"uniformResourceIdentifier",void 0);g([w({type:T.OctetString,context:7,implicit:!0,converter:_3})],Se.prototype,"iPAddress",void 0);g([w({type:T.ObjectIdentifier,context:8,implicit:!0})],Se.prototype,"registeredID",void 0);Se=g([X({type:K.Choice})],Se);const xp="1.3.6.1.5.5.7",y3=`${xp}.1`,Gi=`${xp}.3`,Pc=`${xp}.48`,l0=`${Pc}.1`,u0=`${Pc}.2`,d0=`${Pc}.3`,p0=`${Pc}.5`,$r="2.5.29";var yu;const wu=`${y3}.1`;class Zo{constructor(e={}){this.accessMethod="",this.accessLocation=new Se,Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Zo.prototype,"accessMethod",void 0);g([w({type:Se})],Zo.prototype,"accessLocation",void 0);let vi=yu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,yu.prototype)}};vi=yu=g([X({type:K.Sequence,itemType:Zo})],vi);const vu=`${$r}.35`;class $p extends Te{}class Rr{constructor(e={}){e&&Object.assign(this,e)}}g([w({type:$p,context:0,optional:!0,implicit:!0})],Rr.prototype,"keyIdentifier",void 0);g([w({type:Se,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Rr.prototype,"authorityCertIssuer",void 0);g([w({type:T.Integer,context:2,optional:!0,implicit:!0,converter:Ue})],Rr.prototype,"authorityCertSerialNumber",void 0);const n1=`${$r}.19`;class ya{constructor(e={}){this.cA=!1,Object.assign(this,e)}}g([w({type:T.Boolean,defaultValue:!1})],ya.prototype,"cA",void 0);g([w({type:T.Integer,optional:!0})],ya.prototype,"pathLenConstraint",void 0);var bu;let gt=bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}};gt=bu=g([X({type:K.Sequence,itemType:Se})],gt);var xu;let f0=xu=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,xu.prototype)}};f0=xu=g([X({type:K.Sequence})],f0);var $u;const r1=`${$r}.32`;let jn=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};g([w({type:T.IA5String})],jn.prototype,"ia5String",void 0);g([w({type:T.VisibleString})],jn.prototype,"visibleString",void 0);g([w({type:T.BmpString})],jn.prototype,"bmpString",void 0);g([w({type:T.Utf8String})],jn.prototype,"utf8String",void 0);jn=g([X({type:K.Choice})],jn);class Ap{constructor(e={}){this.organization=new jn,this.noticeNumbers=[],Object.assign(this,e)}}g([w({type:jn})],Ap.prototype,"organization",void 0);g([w({type:T.Integer,repeated:"sequence"})],Ap.prototype,"noticeNumbers",void 0);class kp{constructor(e={}){Object.assign(this,e)}}g([w({type:Ap,optional:!0})],kp.prototype,"noticeRef",void 0);g([w({type:jn,optional:!0})],kp.prototype,"explicitText",void 0);let wa=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.IA5String})],wa.prototype,"cPSuri",void 0);g([w({type:kp})],wa.prototype,"userNotice",void 0);wa=g([X({type:K.Choice})],wa);class Ep{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Ep.prototype,"policyQualifierId",void 0);g([w({type:T.Any})],Ep.prototype,"qualifier",void 0);class Bc{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Bc.prototype,"policyIdentifier",void 0);g([w({type:Ep,repeated:"sequence",optional:!0})],Bc.prototype,"policyQualifiers",void 0);let va=$u=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,$u.prototype)}};va=$u=g([X({type:K.Sequence,itemType:Bc})],va);let ba=class{constructor(e=0){this.value=e}};g([w({type:T.Integer})],ba.prototype,"value",void 0);ba=g([X({type:K.Choice})],ba);let h0=class extends ba{};h0=g([X({type:K.Choice})],h0);var Au;const ku=`${$r}.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 i1 extends Dc{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 Mr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Se,context:0,repeated:"sequence",implicit:!0})],Mr.prototype,"fullName",void 0);g([w({type:Ii,context:1,implicit:!0})],Mr.prototype,"nameRelativeToCRLIssuer",void 0);Mr=g([X({type:K.Choice})],Mr);class Wi{constructor(e={}){Object.assign(this,e)}}g([w({type:Mr,context:0,optional:!0})],Wi.prototype,"distributionPoint",void 0);g([w({type:i1,context:1,optional:!0,implicit:!0})],Wi.prototype,"reasons",void 0);g([w({type:Se,context:2,optional:!0,repeated:"sequence",implicit:!0})],Wi.prototype,"cRLIssuer",void 0);let Ai=Au=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Au.prototype)}};Ai=Au=g([X({type:K.Sequence,itemType:Wi})],Ai);var Eu;let g0=Eu=class extends Ai{constructor(e){super(e),Object.setPrototypeOf(this,Eu.prototype)}};g0=Eu=g([X({type:K.Sequence,itemType:Wi})],g0);class pt{constructor(e={}){this.onlyContainsUserCerts=pt.ONLY,this.onlyContainsCACerts=pt.ONLY,this.indirectCRL=pt.ONLY,this.onlyContainsAttributeCerts=pt.ONLY,Object.assign(this,e)}}pt.ONLY=!1;g([w({type:Mr,context:0,optional:!0})],pt.prototype,"distributionPoint",void 0);g([w({type:T.Boolean,context:1,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"onlyContainsUserCerts",void 0);g([w({type:T.Boolean,context:2,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"onlyContainsCACerts",void 0);g([w({type:i1,context:3,optional:!0,implicit:!0})],pt.prototype,"onlySomeReasons",void 0);g([w({type:T.Boolean,context:4,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"indirectCRL",void 0);g([w({type:T.Boolean,context:5,defaultValue:pt.ONLY,implicit:!0})],pt.prototype,"onlyContainsAttributeCerts",void 0);var mo;(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"})(mo||(mo={}));let Su=class{constructor(e=mo.unspecified){this.reason=mo.unspecified,this.reason=e}toJSON(){return mo[this.reason]}toString(){return this.toJSON()}};g([w({type:T.Enumerated})],Su.prototype,"reason",void 0);Su=g([X({type:K.Choice})],Su);var Nu;const o1=`${$r}.37`;let xa=Nu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Nu.prototype)}};xa=Nu=g([X({type:K.Sequence,itemType:T.ObjectIdentifier})],xa);const w3=`${Gi}.1`,v3=`${Gi}.2`,b3=`${Gi}.3`,x3=`${Gi}.4`,$3=`${Gi}.8`,A3=`${Gi}.9`;let Cu=class{constructor(e=new ArrayBuffer(0)){this.value=e}};g([w({type:T.Integer,converter:Ue})],Cu.prototype,"value",void 0);Cu=g([X({type:K.Choice})],Cu);let Iu=class{constructor(e){this.value=new Date,e&&(this.value=e)}};g([w({type:T.GeneralizedTime})],Iu.prototype,"value",void 0);Iu=g([X({type:K.Choice})],Iu);var Tu;let m0=Tu=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Tu.prototype)}};m0=Tu=g([X({type:K.Sequence})],m0);const s1=`${$r}.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 Nl extends Dc{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 Ou;class jc{constructor(e={}){this.base=new Se,this.minimum=0,Object.assign(this,e)}}g([w({type:Se})],jc.prototype,"base",void 0);g([w({type:T.Integer,context:0,defaultValue:0,implicit:!0})],jc.prototype,"minimum",void 0);g([w({type:T.Integer,context:1,optional:!0,implicit:!0})],jc.prototype,"maximum",void 0);let $a=Ou=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};$a=Ou=g([X({type:K.Sequence,itemType:jc})],$a);class a1{constructor(e={}){Object.assign(this,e)}}g([w({type:$a,context:0,optional:!0,implicit:!0})],a1.prototype,"permittedSubtrees",void 0);g([w({type:$a,context:1,optional:!0,implicit:!0})],a1.prototype,"excludedSubtrees",void 0);class c1{constructor(e={}){Object.assign(this,e)}}g([w({type:T.Integer,context:0,implicit:!0,optional:!0,converter:Ue})],c1.prototype,"requireExplicitPolicy",void 0);g([w({type:T.Integer,context:1,implicit:!0,optional:!0,converter:Ue})],c1.prototype,"inhibitPolicyMapping",void 0);var zu;class Sp{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Sp.prototype,"issuerDomainPolicy",void 0);g([w({type:T.ObjectIdentifier})],Sp.prototype,"subjectDomainPolicy",void 0);let _0=zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,zu.prototype)}};_0=zu=g([X({type:K.Sequence,itemType:Sp})],_0);var Du;const l1=`${$r}.17`;let Ru=Du=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Du.prototype)}};Ru=Du=g([X({type:K.Sequence})],Ru);let Ln=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],Ln.prototype,"type",void 0);g([w({type:T.Any,repeated:"set"})],Ln.prototype,"values",void 0);var Pu;let y0=Pu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Pu.prototype)}};y0=Pu=g([X({type:K.Sequence,itemType:Ln})],y0);const u1=`${$r}.14`;class ur extends $p{}class d1{constructor(e={}){Object.assign(this,e)}}g([w({type:T.GeneralizedTime,context:0,implicit:!0,optional:!0})],d1.prototype,"notBefore",void 0);g([w({type:T.GeneralizedTime,context:1,implicit:!0,optional:!0})],d1.prototype,"notAfter",void 0);var _o;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(_o||(_o={}));class p1 extends Dc{toJSON(){const e=[],n=this.toNumber();return n&_o.pKIXCertificate&&e.push("pKIXCertificate"),n&_o.newExtensions&&e.push("newExtensions"),n&_o.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class f1{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new p1,Object.assign(this,e)}}g([w({type:T.GeneralString})],f1.prototype,"entrustVers",void 0);g([w({type:p1})],f1.prototype,"entrustInfoFlags",void 0);var Bu;let w0=Bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};w0=Bu=g([X({type:K.Sequence,itemType:Zo})],w0);class ce{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ce&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Qm(e.parameters,this.parameters)||e.parameters===this.parameters)}}g([w({type:T.ObjectIdentifier})],ce.prototype,"algorithm",void 0);g([w({type:T.Any,optional:!0})],ce.prototype,"parameters",void 0);class nn{constructor(e={}){this.algorithm=new ce,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:ce})],nn.prototype,"algorithm",void 0);g([w({type:T.BitString})],nn.prototype,"subjectPublicKey",void 0);let ot=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}};g([w({type:T.UTCTime})],ot.prototype,"utcTime",void 0);g([w({type:T.GeneralizedTime})],ot.prototype,"generalTime",void 0);ot=g([X({type:K.Choice})],ot);class Qo{constructor(e){this.notBefore=new ot(new Date),this.notAfter=new ot(new Date),e&&(this.notBefore=new ot(e.notBefore),this.notAfter=new ot(e.notAfter))}}g([w({type:ot})],Qo.prototype,"notBefore",void 0);g([w({type:ot})],Qo.prototype,"notAfter",void 0);var ju;let Wt=class h1{constructor(e={}){this.extnID="",this.critical=h1.CRITICAL,this.extnValue=new Te,Object.assign(this,e)}};Wt.CRITICAL=!1;g([w({type:T.ObjectIdentifier})],Wt.prototype,"extnID",void 0);g([w({type:T.Boolean,defaultValue:Wt.CRITICAL})],Wt.prototype,"critical",void 0);g([w({type:Te})],Wt.prototype,"extnValue",void 0);let fr=ju=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};fr=ju=g([X({type:K.Sequence,itemType:Wt})],fr);var qr;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(qr||(qr={}));class Ft{constructor(e={}){this.version=qr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ce,this.issuer=new Xe,this.validity=new Qo,this.subject=new Xe,this.subjectPublicKeyInfo=new nn,Object.assign(this,e)}}g([w({type:T.Integer,context:0,defaultValue:qr.v1})],Ft.prototype,"version",void 0);g([w({type:T.Integer,converter:Ue})],Ft.prototype,"serialNumber",void 0);g([w({type:ce})],Ft.prototype,"signature",void 0);g([w({type:Xe})],Ft.prototype,"issuer",void 0);g([w({type:Qo})],Ft.prototype,"validity",void 0);g([w({type:Xe})],Ft.prototype,"subject",void 0);g([w({type:nn})],Ft.prototype,"subjectPublicKeyInfo",void 0);g([w({type:T.BitString,context:1,implicit:!0,optional:!0})],Ft.prototype,"issuerUniqueID",void 0);g([w({type:T.BitString,context:2,implicit:!0,optional:!0})],Ft.prototype,"subjectUniqueID",void 0);g([w({type:fr,context:3,optional:!0})],Ft.prototype,"extensions",void 0);class Vr{constructor(e={}){this.tbsCertificate=new Ft,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:Ft})],Vr.prototype,"tbsCertificate",void 0);g([w({type:ce})],Vr.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],Vr.prototype,"signatureValue",void 0);class Lc{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ot,Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],Lc.prototype,"userCertificate",void 0);g([w({type:ot})],Lc.prototype,"revocationDate",void 0);g([w({type:Wt,optional:!0,repeated:"sequence"})],Lc.prototype,"crlEntryExtensions",void 0);class Xn{constructor(e={}){this.signature=new ce,this.issuer=new Xe,this.thisUpdate=new ot,Object.assign(this,e)}}g([w({type:T.Integer,optional:!0})],Xn.prototype,"version",void 0);g([w({type:ce})],Xn.prototype,"signature",void 0);g([w({type:Xe})],Xn.prototype,"issuer",void 0);g([w({type:ot})],Xn.prototype,"thisUpdate",void 0);g([w({type:ot,optional:!0})],Xn.prototype,"nextUpdate",void 0);g([w({type:Lc,repeated:"sequence",optional:!0})],Xn.prototype,"revokedCertificates",void 0);g([w({type:Wt,optional:!0,context:0,repeated:"sequence"})],Xn.prototype,"crlExtensions",void 0);class Np{constructor(e={}){this.tbsCertList=new Xn,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:Xn})],Np.prototype,"tbsCertList",void 0);g([w({type:ce})],Np.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],Np.prototype,"signature",void 0);class Xi{constructor(e={}){this.issuer=new Xe,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:Xe})],Xi.prototype,"issuer",void 0);g([w({type:T.Integer,converter:Ue})],Xi.prototype,"serialNumber",void 0);let Ti=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ur,context:0,implicit:!0})],Ti.prototype,"subjectKeyIdentifier",void 0);g([w({type:Xi})],Ti.prototype,"issuerAndSerialNumber",void 0);Ti=g([X({type:K.Choice})],Ti);var Fn;(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"})(Fn||(Fn={}));let So=class extends ce{};So=g([X({type:K.Sequence})],So);let Aa=class extends ce{};Aa=g([X({type:K.Sequence})],Aa);let $n=class extends ce{};$n=g([X({type:K.Sequence})],$n);let ka=class extends ce{};ka=g([X({type:K.Sequence})],ka);let v0=class extends ce{};v0=g([X({type:K.Sequence})],v0);let Lu=class extends ce{};Lu=g([X({type:K.Sequence})],Lu);let Ji=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],Ji.prototype,"attrType",void 0);g([w({type:T.Any,repeated:"set"})],Ji.prototype,"attrValues",void 0);var Fu;class kn{constructor(e={}){this.version=Fn.v0,this.sid=new Ti,this.digestAlgorithm=new So,this.signatureAlgorithm=new Aa,this.signature=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],kn.prototype,"version",void 0);g([w({type:Ti})],kn.prototype,"sid",void 0);g([w({type:So})],kn.prototype,"digestAlgorithm",void 0);g([w({type:Ji,repeated:"set",context:0,implicit:!0,optional:!0})],kn.prototype,"signedAttrs",void 0);g([w({type:Aa})],kn.prototype,"signatureAlgorithm",void 0);g([w({type:Te})],kn.prototype,"signature",void 0);g([w({type:Ji,repeated:"set",context:1,implicit:!0,optional:!0})],kn.prototype,"unsignedAttrs",void 0);let Ea=Fu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fu.prototype)}};Ea=Fu=g([X({type:K.Set,itemType:kn})],Ea);let b0=class extends ot{};b0=g([X({type:K.Choice})],b0);let x0=class extends kn{};x0=g([X({type:K.Sequence})],x0);class Cp{constructor(e={}){this.acIssuer=new Se,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}g([w({type:Se})],Cp.prototype,"acIssuer",void 0);g([w({type:T.Integer})],Cp.prototype,"acSerial",void 0);g([w({type:Ln,repeated:"sequence"})],Cp.prototype,"attrs",void 0);var Uu;let Sa=Uu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Uu.prototype)}};Sa=Uu=g([X({type:K.Sequence,itemType:T.ObjectIdentifier})],Sa);class Fc{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}g([w({type:T.Integer,optional:!0})],Fc.prototype,"pathLenConstraint",void 0);g([w({type:Sa,implicit:!0,context:0,optional:!0})],Fc.prototype,"permittedAttrs",void 0);g([w({type:Sa,implicit:!0,context:1,optional:!0})],Fc.prototype,"excludedAttrs",void 0);g([w({type:T.Boolean,defaultValue:!0})],Fc.prototype,"permitUnSpecified",void 0);class ri{constructor(e={}){this.issuer=new gt,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:gt})],ri.prototype,"issuer",void 0);g([w({type:T.Integer,converter:Ue})],ri.prototype,"serial",void 0);g([w({type:T.BitString,optional:!0})],ri.prototype,"issuerUID",void 0);var Mu;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(Mu||(Mu={}));class ii{constructor(e={}){this.digestedObjectType=Mu.publicKey,this.digestAlgorithm=new ce,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Enumerated})],ii.prototype,"digestedObjectType",void 0);g([w({type:T.ObjectIdentifier,optional:!0})],ii.prototype,"otherObjectTypeID",void 0);g([w({type:ce})],ii.prototype,"digestAlgorithm",void 0);g([w({type:T.BitString})],ii.prototype,"objectDigest",void 0);class Uc{constructor(e={}){Object.assign(this,e)}}g([w({type:gt,optional:!0})],Uc.prototype,"issuerName",void 0);g([w({type:ri,context:0,implicit:!0,optional:!0})],Uc.prototype,"baseCertificateID",void 0);g([w({type:ii,context:1,implicit:!0,optional:!0})],Uc.prototype,"objectDigestInfo",void 0);let Oi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Se,repeated:"sequence"})],Oi.prototype,"v1Form",void 0);g([w({type:Uc,context:0,implicit:!0})],Oi.prototype,"v2Form",void 0);Oi=g([X({type:K.Choice})],Oi);class Mc{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}g([w({type:T.GeneralizedTime})],Mc.prototype,"notBeforeTime",void 0);g([w({type:T.GeneralizedTime})],Mc.prototype,"notAfterTime",void 0);class es{constructor(e={}){Object.assign(this,e)}}g([w({type:ri,implicit:!0,context:0,optional:!0})],es.prototype,"baseCertificateID",void 0);g([w({type:gt,implicit:!0,context:1,optional:!0})],es.prototype,"entityName",void 0);g([w({type:ii,implicit:!0,context:2,optional:!0})],es.prototype,"objectDigestInfo",void 0);var qu;(function(t){t[t.v2=1]="v2"})(qu||(qu={}));class dn{constructor(e={}){this.version=qu.v2,this.holder=new es,this.issuer=new Oi,this.signature=new ce,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Mc,this.attributes=[],Object.assign(this,e)}}g([w({type:T.Integer})],dn.prototype,"version",void 0);g([w({type:es})],dn.prototype,"holder",void 0);g([w({type:Oi})],dn.prototype,"issuer",void 0);g([w({type:ce})],dn.prototype,"signature",void 0);g([w({type:T.Integer,converter:Ue})],dn.prototype,"serialNumber",void 0);g([w({type:Mc})],dn.prototype,"attrCertValidityPeriod",void 0);g([w({type:Ln,repeated:"sequence"})],dn.prototype,"attributes",void 0);g([w({type:T.BitString,optional:!0})],dn.prototype,"issuerUniqueID",void 0);g([w({type:fr,optional:!0})],dn.prototype,"extensions",void 0);class qc{constructor(e={}){this.acinfo=new dn,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:dn})],qc.prototype,"acinfo",void 0);g([w({type:ce})],qc.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],qc.prototype,"signatureValue",void 0);var Na;(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"})(Na||(Na={}));class Vu extends Dc{}class Ip{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier,implicit:!0,context:0})],Ip.prototype,"type",void 0);g([w({type:T.Any,implicit:!0,context:1})],Ip.prototype,"value",void 0);class Tp{constructor(e={}){this.policyId="",this.classList=new Vu(Na.unclassified),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Tp.prototype,"policyId",void 0);g([w({type:Vu,defaultValue:new Vu(Na.unclassified)})],Tp.prototype,"classList",void 0);g([w({type:Ip,repeated:"set"})],Tp.prototype,"securityCategories",void 0);class Vc{constructor(e={}){Object.assign(this,e)}}g([w({type:Te})],Vc.prototype,"cotets",void 0);g([w({type:T.ObjectIdentifier})],Vc.prototype,"oid",void 0);g([w({type:T.Utf8String})],Vc.prototype,"string",void 0);class g1{constructor(e={}){this.values=[],Object.assign(this,e)}}g([w({type:gt,implicit:!0,context:0,optional:!0})],g1.prototype,"policyAuthority",void 0);g([w({type:Vc,repeated:"sequence"})],g1.prototype,"values",void 0);var Hu;class Hc{constructor(e={}){this.targetCertificate=new ri,Object.assign(this,e)}}g([w({type:ri})],Hc.prototype,"targetCertificate",void 0);g([w({type:Se,optional:!0})],Hc.prototype,"targetName",void 0);g([w({type:ii,optional:!0})],Hc.prototype,"certDigestInfo",void 0);let zi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Se,context:0,implicit:!0})],zi.prototype,"targetName",void 0);g([w({type:Se,context:1,implicit:!0})],zi.prototype,"targetGroup",void 0);g([w({type:Hc,context:2,implicit:!0})],zi.prototype,"targetCert",void 0);zi=g([X({type:K.Choice})],zi);let Ku=Hu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Hu.prototype)}};Ku=Hu=g([X({type:K.Sequence,itemType:zi})],Ku);var Gu;let $0=Gu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Gu.prototype)}};$0=Gu=g([X({type:K.Sequence,itemType:Ku})],$0);class m1{constructor(e={}){Object.assign(this,e)}}g([w({type:gt,implicit:!0,context:0,optional:!0})],m1.prototype,"roleAuthority",void 0);g([w({type:Se,implicit:!0,context:1})],m1.prototype,"roleName",void 0);class Op{constructor(e={}){this.service=new Se,this.ident=new Se,Object.assign(this,e)}}g([w({type:Se})],Op.prototype,"service",void 0);g([w({type:Se})],Op.prototype,"ident",void 0);g([w({type:Te,optional:!0})],Op.prototype,"authInfo",void 0);var Wu;class zp{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],zp.prototype,"otherCertFormat",void 0);g([w({type:T.Any})],zp.prototype,"otherCert",void 0);let Di=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Vr})],Di.prototype,"certificate",void 0);g([w({type:qc,context:2,implicit:!0})],Di.prototype,"v2AttrCert",void 0);g([w({type:zp,context:3,implicit:!0})],Di.prototype,"other",void 0);Di=g([X({type:K.Choice})],Di);let Ca=Wu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Wu.prototype)}};Ca=Wu=g([X({type:K.Set,itemType:Di})],Ca);class Yi{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Yi.prototype,"contentType",void 0);g([w({type:T.Any,context:0})],Yi.prototype,"content",void 0);let No=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Te})],No.prototype,"single",void 0);g([w({type:T.Any})],No.prototype,"any",void 0);No=g([X({type:K.Choice})],No);class Kc{constructor(e={}){this.eContentType="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Kc.prototype,"eContentType",void 0);g([w({type:No,context:0,optional:!0})],Kc.prototype,"eContent",void 0);let Co=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Te,context:0,implicit:!0,optional:!0})],Co.prototype,"value",void 0);g([w({type:Te,converter:Qb,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Co.prototype,"constructedValue",void 0);Co=g([X({type:K.Choice})],Co);class ts{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ka,Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],ts.prototype,"contentType",void 0);g([w({type:ka})],ts.prototype,"contentEncryptionAlgorithm",void 0);g([w({type:Co,optional:!0})],ts.prototype,"encryptedContent",void 0);class Gc{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Gc.prototype,"keyAttrId",void 0);g([w({type:T.Any,optional:!0})],Gc.prototype,"keyAttr",void 0);var Xu;class Wc{constructor(e={}){this.subjectKeyIdentifier=new ur,Object.assign(this,e)}}g([w({type:ur})],Wc.prototype,"subjectKeyIdentifier",void 0);g([w({type:T.GeneralizedTime,optional:!0})],Wc.prototype,"date",void 0);g([w({type:Gc,optional:!0})],Wc.prototype,"other",void 0);let Ri=class{constructor(e={}){Object.assign(this,e)}};g([w({type:Wc,context:0,implicit:!0,optional:!0})],Ri.prototype,"rKeyId",void 0);g([w({type:Xi,optional:!0})],Ri.prototype,"issuerAndSerialNumber",void 0);Ri=g([X({type:K.Choice})],Ri);class Dp{constructor(e={}){this.rid=new Ri,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:Ri})],Dp.prototype,"rid",void 0);g([w({type:Te})],Dp.prototype,"encryptedKey",void 0);let Ia=Xu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Xu.prototype)}};Ia=Xu=g([X({type:K.Sequence,itemType:Dp})],Ia);class Rp{constructor(e={}){this.algorithm=new ce,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:ce})],Rp.prototype,"algorithm",void 0);g([w({type:T.BitString})],Rp.prototype,"publicKey",void 0);let Hr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ur,context:0,implicit:!0,optional:!0})],Hr.prototype,"subjectKeyIdentifier",void 0);g([w({type:Rp,context:1,implicit:!0,optional:!0})],Hr.prototype,"originatorKey",void 0);g([w({type:Xi,optional:!0})],Hr.prototype,"issuerAndSerialNumber",void 0);Hr=g([X({type:K.Choice})],Hr);class Zi{constructor(e={}){this.version=Fn.v3,this.originator=new Hr,this.keyEncryptionAlgorithm=new $n,this.recipientEncryptedKeys=new Ia,Object.assign(this,e)}}g([w({type:T.Integer})],Zi.prototype,"version",void 0);g([w({type:Hr,context:0})],Zi.prototype,"originator",void 0);g([w({type:Te,context:1,optional:!0})],Zi.prototype,"ukm",void 0);g([w({type:$n})],Zi.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Ia})],Zi.prototype,"recipientEncryptedKeys",void 0);let Pi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ur,context:0,implicit:!0})],Pi.prototype,"subjectKeyIdentifier",void 0);g([w({type:Xi})],Pi.prototype,"issuerAndSerialNumber",void 0);Pi=g([X({type:K.Choice})],Pi);class ns{constructor(e={}){this.version=Fn.v0,this.rid=new Pi,this.keyEncryptionAlgorithm=new $n,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],ns.prototype,"version",void 0);g([w({type:Pi})],ns.prototype,"rid",void 0);g([w({type:$n})],ns.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Te})],ns.prototype,"encryptedKey",void 0);class rs{constructor(e={}){this.keyIdentifier=new Te,Object.assign(this,e)}}g([w({type:Te})],rs.prototype,"keyIdentifier",void 0);g([w({type:T.GeneralizedTime,optional:!0})],rs.prototype,"date",void 0);g([w({type:Gc,optional:!0})],rs.prototype,"other",void 0);class is{constructor(e={}){this.version=Fn.v4,this.kekid=new rs,this.keyEncryptionAlgorithm=new $n,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],is.prototype,"version",void 0);g([w({type:rs})],is.prototype,"kekid",void 0);g([w({type:$n})],is.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Te})],is.prototype,"encryptedKey",void 0);class os{constructor(e={}){this.version=Fn.v0,this.keyEncryptionAlgorithm=new $n,this.encryptedKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],os.prototype,"version",void 0);g([w({type:Lu,context:0,optional:!0})],os.prototype,"keyDerivationAlgorithm",void 0);g([w({type:$n})],os.prototype,"keyEncryptionAlgorithm",void 0);g([w({type:Te})],os.prototype,"encryptedKey",void 0);class Pp{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Pp.prototype,"oriType",void 0);g([w({type:T.Any})],Pp.prototype,"oriValue",void 0);let hr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:ns,optional:!0})],hr.prototype,"ktri",void 0);g([w({type:Zi,context:1,implicit:!0,optional:!0})],hr.prototype,"kari",void 0);g([w({type:is,context:2,implicit:!0,optional:!0})],hr.prototype,"kekri",void 0);g([w({type:os,context:3,implicit:!0,optional:!0})],hr.prototype,"pwri",void 0);g([w({type:Pp,context:4,implicit:!0,optional:!0})],hr.prototype,"ori",void 0);hr=g([X({type:K.Choice})],hr);var Ju;let Ta=Ju=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ju.prototype)}};Ta=Ju=g([X({type:K.Set,itemType:hr})],Ta);var Yu;class Xc{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],Xc.prototype,"otherRevInfoFormat",void 0);g([w({type:T.Any})],Xc.prototype,"otherRevInfo",void 0);let Oa=class{constructor(e={}){this.other=new Xc,Object.assign(this,e)}};g([w({type:Xc,context:1,implicit:!0})],Oa.prototype,"other",void 0);Oa=g([X({type:K.Choice})],Oa);let za=Yu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Yu.prototype)}};za=Yu=g([X({type:K.Set,itemType:Oa})],za);class Bp{constructor(e={}){Object.assign(this,e)}}g([w({type:Ca,context:0,implicit:!0,optional:!0})],Bp.prototype,"certs",void 0);g([w({type:za,context:1,implicit:!0,optional:!0})],Bp.prototype,"crls",void 0);var Zu;let Qu=Zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Zu.prototype)}};Qu=Zu=g([X({type:K.Set,itemType:Ji})],Qu);class ss{constructor(e={}){this.version=Fn.v0,this.recipientInfos=new Ta,this.encryptedContentInfo=new ts,Object.assign(this,e)}}g([w({type:T.Integer})],ss.prototype,"version",void 0);g([w({type:Bp,context:0,implicit:!0,optional:!0})],ss.prototype,"originatorInfo",void 0);g([w({type:Ta})],ss.prototype,"recipientInfos",void 0);g([w({type:ts})],ss.prototype,"encryptedContentInfo",void 0);g([w({type:Qu,context:1,implicit:!0,optional:!0})],ss.prototype,"unprotectedAttrs",void 0);const k3="1.2.840.113549.1.7.2";var ed;let Da=ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ed.prototype)}};Da=ed=g([X({type:K.Set,itemType:So})],Da);class Qi{constructor(e={}){this.version=Fn.v0,this.digestAlgorithms=new Da,this.encapContentInfo=new Kc,this.signerInfos=new Ea,Object.assign(this,e)}}g([w({type:T.Integer})],Qi.prototype,"version",void 0);g([w({type:Da})],Qi.prototype,"digestAlgorithms",void 0);g([w({type:Kc})],Qi.prototype,"encapContentInfo",void 0);g([w({type:Ca,context:0,implicit:!0,optional:!0})],Qi.prototype,"certificates",void 0);g([w({type:za,context:1,implicit:!0,optional:!0})],Qi.prototype,"crls",void 0);g([w({type:Ea})],Qi.prototype,"signerInfos",void 0);const Io="1.2.840.10045.2.1",jp="1.2.840.10045.4.1",_1="1.2.840.10045.4.3.1",Lp="1.2.840.10045.4.3.2",Fp="1.2.840.10045.4.3.3",Up="1.2.840.10045.4.3.4",A0="1.2.840.10045.3.1.7",k0="1.3.132.0.34",E0="1.3.132.0.35";function as(t){return new ce({algorithm:t})}const E3=as(jp);as(_1);const S3=as(Lp),N3=as(Fp),C3=as(Up);let To=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],To.prototype,"fieldType",void 0);g([w({type:T.Any})],To.prototype,"parameters",void 0);To=g([X({type:K.Sequence})],To);class I3 extends Te{}let Bi=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.OctetString})],Bi.prototype,"a",void 0);g([w({type:T.OctetString})],Bi.prototype,"b",void 0);g([w({type:T.BitString,optional:!0})],Bi.prototype,"seed",void 0);Bi=g([X({type:K.Sequence})],Bi);var td;(function(t){t[t.ecpVer1=1]="ecpVer1"})(td||(td={}));let Un=class{constructor(e={}){this.version=td.ecpVer1,Object.assign(this,e)}};g([w({type:T.Integer})],Un.prototype,"version",void 0);g([w({type:To})],Un.prototype,"fieldID",void 0);g([w({type:Bi})],Un.prototype,"curve",void 0);g([w({type:I3})],Un.prototype,"base",void 0);g([w({type:T.Integer,converter:Ue})],Un.prototype,"order",void 0);g([w({type:T.Integer,optional:!0})],Un.prototype,"cofactor",void 0);Un=g([X({type:K.Sequence})],Un);let gr=class{constructor(e={}){Object.assign(this,e)}};g([w({type:T.ObjectIdentifier})],gr.prototype,"namedCurve",void 0);g([w({type:T.Null})],gr.prototype,"implicitCurve",void 0);g([w({type:Un})],gr.prototype,"specifiedCurve",void 0);gr=g([X({type:K.Choice})],gr);class Jc{constructor(e={}){this.version=1,this.privateKey=new Te,Object.assign(this,e)}}g([w({type:T.Integer})],Jc.prototype,"version",void 0);g([w({type:Te})],Jc.prototype,"privateKey",void 0);g([w({type:gr,context:0,optional:!0})],Jc.prototype,"parameters",void 0);g([w({type:T.BitString,context:1,optional:!0})],Jc.prototype,"publicKey",void 0);class Ra{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],Ra.prototype,"r",void 0);g([w({type:T.Integer,converter:Ue})],Ra.prototype,"s",void 0);const St="1.2.840.113549.1.1",Kr=`${St}.1`,T3=`${St}.7`,O3=`${St}.9`,yo=`${St}.10`,z3=`${St}.2`,D3=`${St}.4`,Pa=`${St}.5`,R3=`${St}.14`,nd=`${St}.11`,Ba=`${St}.12`,ja=`${St}.13`,y1=`${St}.15`,w1=`${St}.16`,La="1.3.14.3.2.26",v1="2.16.840.1.101.3.4.2.4",Fa="2.16.840.1.101.3.4.2.1",Ua="2.16.840.1.101.3.4.2.2",Ma="2.16.840.1.101.3.4.2.3",P3="2.16.840.1.101.3.4.2.5",B3="2.16.840.1.101.3.4.2.6",j3="1.2.840.113549.2.2",L3="1.2.840.113549.2.5",Yc=`${St}.8`;function et(t){return new ce({algorithm:t,parameters:null})}et(j3);et(L3);const Gr=et(La);et(v1);et(Fa);et(Ua);et(Ma);et(P3);et(B3);const b1=new ce({algorithm:Yc,parameters:te.serialize(Gr)}),x1=new ce({algorithm:O3,parameters:te.serialize(_a.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});et(Kr);et(z3);et(D3);et(Pa);et(y1);et(w1);et(Ba);et(ja);et(y1);et(w1);class Zc{constructor(e={}){this.hashAlgorithm=new ce(Gr),this.maskGenAlgorithm=new ce({algorithm:Yc,parameters:te.serialize(Gr)}),this.pSourceAlgorithm=new ce(x1),Object.assign(this,e)}}g([w({type:ce,context:0,defaultValue:Gr})],Zc.prototype,"hashAlgorithm",void 0);g([w({type:ce,context:1,defaultValue:b1})],Zc.prototype,"maskGenAlgorithm",void 0);g([w({type:ce,context:2,defaultValue:x1})],Zc.prototype,"pSourceAlgorithm",void 0);new ce({algorithm:T3,parameters:te.serialize(new Zc)});class Wr{constructor(e={}){this.hashAlgorithm=new ce(Gr),this.maskGenAlgorithm=new ce({algorithm:Yc,parameters:te.serialize(Gr)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}g([w({type:ce,context:0,defaultValue:Gr})],Wr.prototype,"hashAlgorithm",void 0);g([w({type:ce,context:1,defaultValue:b1})],Wr.prototype,"maskGenAlgorithm",void 0);g([w({type:T.Integer,context:2,defaultValue:20})],Wr.prototype,"saltLength",void 0);g([w({type:T.Integer,context:3,defaultValue:1})],Wr.prototype,"trailerField",void 0);new ce({algorithm:yo,parameters:te.serialize(new Wr)});class Qc{constructor(e={}){this.digestAlgorithm=new ce,this.digest=new Te,Object.assign(this,e)}}g([w({type:ce})],Qc.prototype,"digestAlgorithm",void 0);g([w({type:Te})],Qc.prototype,"digest",void 0);var rd;class el{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],el.prototype,"prime",void 0);g([w({type:T.Integer,converter:Ue})],el.prototype,"exponent",void 0);g([w({type:T.Integer,converter:Ue})],el.prototype,"coefficient",void 0);let id=rd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};id=rd=g([X({type:K.Sequence,itemType:el})],id);class En{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)}}g([w({type:T.Integer})],En.prototype,"version",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"modulus",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"publicExponent",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"privateExponent",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"prime1",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"prime2",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"exponent1",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"exponent2",void 0);g([w({type:T.Integer,converter:Ue})],En.prototype,"coefficient",void 0);g([w({type:id,optional:!0})],En.prototype,"otherPrimeInfos",void 0);class Mp{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.Integer,converter:Ue})],Mp.prototype,"modulus",void 0);g([w({type:T.Integer,converter:Ue})],Mp.prototype,"publicExponent",void 0);var od;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(od||(od={}));const bt=od;/*! *****************************************************************************
147
147
  Copyright (c) Microsoft Corporation.
148
148
 
149
149
  Permission to use, copy, modify, and/or distribute this software for any
@@ -156,9 +156,9 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
156
156
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
157
157
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
158
158
  PERFORMANCE OF THIS SOFTWARE.
159
- ***************************************************************************** */var sd=function(t,e){return sd=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])},sd(t,e)};function qp(t,e){sd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function F3(t,e,n,r){function i(o){return o instanceof n?o:new n(function(c){c(o)})}return new(n||(n=Promise))(function(o,c){function l(f){try{d(r.next(f))}catch(h){c(h)}}function u(f){try{d(r.throw(f))}catch(h){c(h)}}function d(f){f.done?o(f.value):i(f.value).then(l,u)}d((r=r.apply(t,[])).next())})}function U3(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(d){return function(f){return u([d,f])}}function u(d){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=d[0]&2?i.return:d[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,d[1])).done)return o;switch(i=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=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(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){n.label=d[1];break}if(d[0]===6&&n.label<o[1]){n.label=o[1],o=d;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(d);break}o[2]&&n.ops.pop(),n.trys.pop();continue}d=e.call(t,n)}catch(f){d=[6,f],i=0}finally{r=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Is(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 qa(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return o}function Ir(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(qa(arguments[e]));return t}var M3="injectionTokens";function q3(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],n=Reflect.getOwnMetadata(M3,t)||{};return Object.keys(n).forEach(function(r){e[+r]=n[r]}),e}function x1(t){return!!t.useClass}function ad(t){return!!t.useFactory}var $1=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var n=this,r={},i=!1,o,c=function(){return i||(o=e(n.wrap()),i=!0),o};return new Proxy(r,this.createHandler(c))},t.prototype.createHandler=function(e){var n={},r=function(i){n[i]=function(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];o[0]=e();var l=Reflect[i];return l.apply(void 0,Ir(o))}};return this.reflectMethods.forEach(r),n},t}();function ci(t){return typeof t=="string"||typeof t=="symbol"}function V3(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function S0(t){return typeof t=="object"&&"token"in t&&"transform"in t}function H3(t){return typeof t=="function"||t instanceof $1}function Vs(t){return!!t.useToken}function Hs(t){return t.useValue!=null}function K3(t){return x1(t)||Hs(t)||Vs(t)||ad(t)}var Vp=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}(),G3=function(t){qp(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Vp),N0=function(){function t(){this.scopedResolutions=new Map}return t}();function W3(t,e){if(t===null)return"at position #"+e;var n=t.split(",")[e].trim();return'"'+n+'" at position #'+e}function X3(t,e,n){return n===void 0&&(n=" "),Ir([t],e.message.split(`
159
+ ***************************************************************************** */var sd=function(t,e){return sd=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])},sd(t,e)};function qp(t,e){sd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function F3(t,e,n,r){function i(o){return o instanceof n?o:new n(function(c){c(o)})}return new(n||(n=Promise))(function(o,c){function l(f){try{d(r.next(f))}catch(h){c(h)}}function u(f){try{d(r.throw(f))}catch(h){c(h)}}function d(f){f.done?o(f.value):i(f.value).then(l,u)}d((r=r.apply(t,[])).next())})}function U3(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(d){return function(f){return u([d,f])}}function u(d){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=d[0]&2?i.return:d[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,d[1])).done)return o;switch(i=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=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(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){n.label=d[1];break}if(d[0]===6&&n.label<o[1]){n.label=o[1],o=d;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(d);break}o[2]&&n.ops.pop(),n.trys.pop();continue}d=e.call(t,n)}catch(f){d=[6,f],i=0}finally{r=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Is(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 qa(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return o}function Ir(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(qa(arguments[e]));return t}var M3="injectionTokens";function q3(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],n=Reflect.getOwnMetadata(M3,t)||{};return Object.keys(n).forEach(function(r){e[+r]=n[r]}),e}function $1(t){return!!t.useClass}function ad(t){return!!t.useFactory}var A1=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var n=this,r={},i=!1,o,c=function(){return i||(o=e(n.wrap()),i=!0),o};return new Proxy(r,this.createHandler(c))},t.prototype.createHandler=function(e){var n={},r=function(i){n[i]=function(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];o[0]=e();var l=Reflect[i];return l.apply(void 0,Ir(o))}};return this.reflectMethods.forEach(r),n},t}();function ci(t){return typeof t=="string"||typeof t=="symbol"}function V3(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function S0(t){return typeof t=="object"&&"token"in t&&"transform"in t}function H3(t){return typeof t=="function"||t instanceof A1}function Vs(t){return!!t.useToken}function Hs(t){return t.useValue!=null}function K3(t){return $1(t)||Hs(t)||Vs(t)||ad(t)}var Vp=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}(),G3=function(t){qp(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Vp),N0=function(){function t(){this.scopedResolutions=new Map}return t}();function W3(t,e){if(t===null)return"at position #"+e;var n=t.split(",")[e].trim();return'"'+n+'" at position #'+e}function X3(t,e,n){return n===void 0&&(n=" "),Ir([t],e.message.split(`
160
160
  `).map(function(r){return n+r})).join(`
161
- `)}function J3(t,e,n){var r=qa(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],o=i===void 0?null:i,c=W3(o,e);return X3("Cannot inject the dependency "+c+' of "'+t.name+'" constructor. Reason:',n)}function Y3(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Z3=function(t){qp(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Vp),Q3=function(t){qp(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Vp),e4=function(){function t(){this.preResolution=new Z3,this.postResolution=new Q3}return t}(),A1=new Map,t4=function(){function t(e){this.parent=e,this._registry=new G3,this.interceptors=new e4,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:bt.Transient}),this.ensureNotDisposed();var i;if(K3(n)?i=n:i={useClass:n},Vs(i))for(var o=[e],c=i;c!=null;){var l=c.useToken;if(o.includes(l))throw new Error("Token registration cycle detected! "+Ir(o,[l]).join(" -> "));o.push(l);var u=this._registry.get(l);u&&Vs(u.provider)?c=u.provider:c=null}if((r.lifecycle===bt.Singleton||r.lifecycle==bt.ContainerScoped||r.lifecycle==bt.ResolutionScoped)&&(Hs(i)||ad(i)))throw new Error('Cannot use lifecycle "'+bt[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(),ci(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(),ci(e)){if(ci(n))return this.register(e,{useToken:n},{lifecycle:bt.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:bt.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!ci(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:bt.Singleton})},t.prototype.resolve=function(e,n){n===void 0&&(n=new N0),this.ensureNotDisposed();var r=this.getRegistration(e);if(!r&&ci(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),r){var i=this.resolveRegistration(r,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(H3(e)){var i=this.construct(e,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,n){var r,i;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var c=Is(this.interceptors.preResolution.getAll(e)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,n)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,o;if(this.interceptors.postResolution.has(e)){var c=[];try{for(var l=Is(this.interceptors.postResolution.getAll(e)),u=l.next();!u.done;u=l.next()){var d=u.value;d.options.frequency!="Once"&&c.push(d),d.callback(e,n,r)}}catch(f){i={error:f}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,c)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===bt.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===bt.Singleton,i=e.options.lifecycle===bt.ContainerScoped,o=r||i,c;return Hs(e.provider)?c=e.provider.useValue:Vs(e.provider)?c=o?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):x1(e.provider)?c=o?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):ad(e.provider)?c=e.provider.useFactory(this):c=this.construct(e.provider,n),e.options.lifecycle===bt.ResolutionScoped&&n.scopedResolutions.set(e,c),c},t.prototype.resolveAll=function(e,n){var r=this;n===void 0&&(n=new N0),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ci(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var o=i.map(function(l){return r.resolveRegistration(l,n)});return this.executePostResolutionInterceptor(e,o,"All"),o}var c=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,c,"All"),c},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=Is(this._registry.entries()),i=r.next();!i.done;i=r.next()){var o=qa(i.value,2),c=o[0],l=o[1];this._registry.setAll(c,l.filter(function(u){return!Hs(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=Is(this._registry.entries()),o=i.next();!o.done;o=i.next()){var c=qa(o.value,2),l=c[0],u=c[1];u.some(function(d){var f=d.options;return f.lifecycle===bt.ContainerScoped})&&r._registry.setAll(l,u.map(function(d){return d.options.lifecycle===bt.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t.prototype.beforeResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:n,options:r})},t.prototype.afterResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:n,options:r})},t.prototype.dispose=function(){return F3(this,void 0,void 0,function(){var e;return U3(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 $1)return e.createProxy(function(o){return r.resolve(o,n)});var i=function(){var o=A1.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var c=o.map(r.resolveParams(n,e));return new(e.bind.apply(e,Ir([void 0],c)))}();return Y3(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,o){var c,l,u;try{return V3(i)?S0(i)?i.multiple?(c=r.resolve(i.transform)).transform.apply(c,Ir([r.resolveAll(i.token)],i.transformArgs)):(l=r.resolve(i.transform)).transform.apply(l,Ir([r.resolve(i.token,e)],i.transformArgs)):i.multiple?r.resolveAll(i.token):r.resolve(i.token,e):S0(i)?(u=r.resolve(i.transform,e)).transform.apply(u,Ir([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(d){throw new Error(J3(n,o,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),ut=new t4;function tl(){return function(t){A1.set(t,q3(t))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var cd;class nl{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}g([w({type:T.ObjectIdentifier})],nl.prototype,"attrId",void 0);g([w({type:T.Any,repeated:"set"})],nl.prototype,"attrValues",void 0);let C0=cd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,cd.prototype)}};C0=cd=g([X({type:K.Sequence,itemType:nl})],C0);var ld;let I0=ld=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};I0=ld=g([X({type:K.Sequence,itemType:Yi})],I0);class k1{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],k1.prototype,"certId",void 0);g([w({type:T.Any,context:0})],k1.prototype,"certValue",void 0);class E1{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],E1.prototype,"crlId",void 0);g([w({type:T.Any,context:0})],E1.prototype,"crltValue",void 0);class S1 extends Te{}let rl=class{constructor(e={}){this.encryptionAlgorithm=new ce,this.encryptedData=new S1,Object.assign(this,e)}};g([w({type:ce})],rl.prototype,"encryptionAlgorithm",void 0);g([w({type:S1})],rl.prototype,"encryptedData",void 0);var ud,dd;(function(t){t[t.v1=0]="v1"})(dd||(dd={}));class N1 extends Te{}let pd=ud=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};pd=ud=g([X({type:K.Sequence,itemType:Ln})],pd);class cs{constructor(e={}){this.version=dd.v1,this.privateKeyAlgorithm=new ce,this.privateKey=new N1,Object.assign(this,e)}}g([w({type:T.Integer})],cs.prototype,"version",void 0);g([w({type:ce})],cs.prototype,"privateKeyAlgorithm",void 0);g([w({type:N1})],cs.prototype,"privateKey",void 0);g([w({type:pd,implicit:!0,context:0,optional:!0})],cs.prototype,"attributes",void 0);let T0=class extends cs{};T0=g([X({type:K.Sequence})],T0);let O0=class extends rl{};O0=g([X({type:K.Sequence})],O0);class C1{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],C1.prototype,"secretTypeId",void 0);g([w({type:T.Any,context:0})],C1.prototype,"secretValue",void 0);class ls{constructor(e={}){this.mac=new Qc,this.macSalt=new Te,this.iterations=1,Object.assign(this,e)}}g([w({type:Qc})],ls.prototype,"mac",void 0);g([w({type:Te})],ls.prototype,"macSalt",void 0);g([w({type:T.Integer,defaultValue:1})],ls.prototype,"iterations",void 0);class il{constructor(e={}){this.version=3,this.authSafe=new Yi,this.macData=new ls,Object.assign(this,e)}}g([w({type:T.Integer})],il.prototype,"version",void 0);g([w({type:Yi})],il.prototype,"authSafe",void 0);g([w({type:ls,optional:!0})],il.prototype,"macData",void 0);var fd;class ol{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],ol.prototype,"bagId",void 0);g([w({type:T.Any,context:0})],ol.prototype,"bagValue",void 0);g([w({type:nl,repeated:"set",optional:!0})],ol.prototype,"bagAttributes",void 0);let z0=fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}};z0=fd=g([X({type:K.Sequence,itemType:ol})],z0);var hd,gd,md;const I1="1.2.840.113549.1.9",T1=`${I1}.7`,Hp=`${I1}.14`;let Va=class extends lt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};g([w({type:T.IA5String})],Va.prototype,"ia5String",void 0);Va=g([X({type:K.Choice})],Va);let D0=class extends Yi{};D0=g([X({type:K.Sequence})],D0);let R0=class extends il{};R0=g([X({type:K.Sequence})],R0);let P0=class extends rl{};P0=g([X({type:K.Sequence})],P0);let _d=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.IA5String})],_d.prototype,"value",void 0);_d=g([X({type:K.Choice})],_d);let B0=class extends Va{};B0=g([X({type:K.Choice})],B0);let j0=class extends lt{};j0=g([X({type:K.Choice})],j0);let yd=class{constructor(e=new Date){this.value=e}};g([w({type:T.GeneralizedTime})],yd.prototype,"value",void 0);yd=g([X({type:K.Choice})],yd);let L0=class extends lt{};L0=g([X({type:K.Choice})],L0);let wd=class{constructor(e="M"){this.value=e}toString(){return this.value}};g([w({type:T.PrintableString})],wd.prototype,"value",void 0);wd=g([X({type:K.Choice})],wd);let Ha=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.PrintableString})],Ha.prototype,"value",void 0);Ha=g([X({type:K.Choice})],Ha);let F0=class extends Ha{};F0=g([X({type:K.Choice})],F0);let U0=class extends lt{};U0=g([X({type:K.Choice})],U0);let vd=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.ObjectIdentifier})],vd.prototype,"value",void 0);vd=g([X({type:K.Choice})],vd);let M0=class extends ot{};M0=g([X({type:K.Choice})],M0);let bd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};g([w({type:T.Integer})],bd.prototype,"value",void 0);bd=g([X({type:K.Choice})],bd);let q0=class extends kn{};q0=g([X({type:K.Sequence})],q0);let Ka=class extends lt{};Ka=g([X({type:K.Choice})],Ka);let V0=hd=class extends fr{constructor(e){super(e),Object.setPrototypeOf(this,hd.prototype)}};V0=hd=g([X({type:K.Sequence})],V0);let H0=gd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,gd.prototype)}};H0=gd=g([X({type:K.Set,itemType:Ji})],H0);let xd=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.BmpString})],xd.prototype,"value",void 0);xd=g([X({type:K.Choice})],xd);let $d=class extends ce{};$d=g([X({type:K.Sequence})],$d);let K0=md=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,md.prototype)}};K0=md=g([X({type:K.Sequence,itemType:$d})],K0);var Ad;let Ga=Ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ad.prototype)}};Ga=Ad=g([X({type:K.Sequence,itemType:Ln})],Ga);class eo{constructor(e={}){this.version=0,this.subject=new Xe,this.subjectPKInfo=new nn,this.attributes=new Ga,Object.assign(this,e)}}g([w({type:T.Integer})],eo.prototype,"version",void 0);g([w({type:Xe})],eo.prototype,"subject",void 0);g([w({type:nn})],eo.prototype,"subjectPKInfo",void 0);g([w({type:Ga,implicit:!0,context:0})],eo.prototype,"attributes",void 0);class Oo{constructor(e={}){this.certificationRequestInfo=new eo,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:eo})],Oo.prototype,"certificationRequestInfo",void 0);g([w({type:ce})],Oo.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],Oo.prototype,"signature",void 0);/*!
161
+ `)}function J3(t,e,n){var r=qa(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],o=i===void 0?null:i,c=W3(o,e);return X3("Cannot inject the dependency "+c+' of "'+t.name+'" constructor. Reason:',n)}function Y3(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Z3=function(t){qp(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Vp),Q3=function(t){qp(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Vp),e4=function(){function t(){this.preResolution=new Z3,this.postResolution=new Q3}return t}(),k1=new Map,t4=function(){function t(e){this.parent=e,this._registry=new G3,this.interceptors=new e4,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:bt.Transient}),this.ensureNotDisposed();var i;if(K3(n)?i=n:i={useClass:n},Vs(i))for(var o=[e],c=i;c!=null;){var l=c.useToken;if(o.includes(l))throw new Error("Token registration cycle detected! "+Ir(o,[l]).join(" -> "));o.push(l);var u=this._registry.get(l);u&&Vs(u.provider)?c=u.provider:c=null}if((r.lifecycle===bt.Singleton||r.lifecycle==bt.ContainerScoped||r.lifecycle==bt.ResolutionScoped)&&(Hs(i)||ad(i)))throw new Error('Cannot use lifecycle "'+bt[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(),ci(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(),ci(e)){if(ci(n))return this.register(e,{useToken:n},{lifecycle:bt.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:bt.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!ci(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:bt.Singleton})},t.prototype.resolve=function(e,n){n===void 0&&(n=new N0),this.ensureNotDisposed();var r=this.getRegistration(e);if(!r&&ci(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),r){var i=this.resolveRegistration(r,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(H3(e)){var i=this.construct(e,n);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,n){var r,i;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var c=Is(this.interceptors.preResolution.getAll(e)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,n)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,o;if(this.interceptors.postResolution.has(e)){var c=[];try{for(var l=Is(this.interceptors.postResolution.getAll(e)),u=l.next();!u.done;u=l.next()){var d=u.value;d.options.frequency!="Once"&&c.push(d),d.callback(e,n,r)}}catch(f){i={error:f}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,c)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===bt.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===bt.Singleton,i=e.options.lifecycle===bt.ContainerScoped,o=r||i,c;return Hs(e.provider)?c=e.provider.useValue:Vs(e.provider)?c=o?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):$1(e.provider)?c=o?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):ad(e.provider)?c=e.provider.useFactory(this):c=this.construct(e.provider,n),e.options.lifecycle===bt.ResolutionScoped&&n.scopedResolutions.set(e,c),c},t.prototype.resolveAll=function(e,n){var r=this;n===void 0&&(n=new N0),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ci(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var o=i.map(function(l){return r.resolveRegistration(l,n)});return this.executePostResolutionInterceptor(e,o,"All"),o}var c=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,c,"All"),c},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=Is(this._registry.entries()),i=r.next();!i.done;i=r.next()){var o=qa(i.value,2),c=o[0],l=o[1];this._registry.setAll(c,l.filter(function(u){return!Hs(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=Is(this._registry.entries()),o=i.next();!o.done;o=i.next()){var c=qa(o.value,2),l=c[0],u=c[1];u.some(function(d){var f=d.options;return f.lifecycle===bt.ContainerScoped})&&r._registry.setAll(l,u.map(function(d){return d.options.lifecycle===bt.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t.prototype.beforeResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:n,options:r})},t.prototype.afterResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:n,options:r})},t.prototype.dispose=function(){return F3(this,void 0,void 0,function(){var e;return U3(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 A1)return e.createProxy(function(o){return r.resolve(o,n)});var i=function(){var o=k1.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var c=o.map(r.resolveParams(n,e));return new(e.bind.apply(e,Ir([void 0],c)))}();return Y3(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,o){var c,l,u;try{return V3(i)?S0(i)?i.multiple?(c=r.resolve(i.transform)).transform.apply(c,Ir([r.resolveAll(i.token)],i.transformArgs)):(l=r.resolve(i.transform)).transform.apply(l,Ir([r.resolve(i.token,e)],i.transformArgs)):i.multiple?r.resolveAll(i.token):r.resolve(i.token,e):S0(i)?(u=r.resolve(i.transform,e)).transform.apply(u,Ir([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(d){throw new Error(J3(n,o,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),ut=new t4;function tl(){return function(t){k1.set(t,q3(t))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var cd;class nl{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}g([w({type:T.ObjectIdentifier})],nl.prototype,"attrId",void 0);g([w({type:T.Any,repeated:"set"})],nl.prototype,"attrValues",void 0);let C0=cd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,cd.prototype)}};C0=cd=g([X({type:K.Sequence,itemType:nl})],C0);var ld;let I0=ld=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};I0=ld=g([X({type:K.Sequence,itemType:Yi})],I0);class E1{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],E1.prototype,"certId",void 0);g([w({type:T.Any,context:0})],E1.prototype,"certValue",void 0);class S1{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],S1.prototype,"crlId",void 0);g([w({type:T.Any,context:0})],S1.prototype,"crltValue",void 0);class N1 extends Te{}let rl=class{constructor(e={}){this.encryptionAlgorithm=new ce,this.encryptedData=new N1,Object.assign(this,e)}};g([w({type:ce})],rl.prototype,"encryptionAlgorithm",void 0);g([w({type:N1})],rl.prototype,"encryptedData",void 0);var ud,dd;(function(t){t[t.v1=0]="v1"})(dd||(dd={}));class C1 extends Te{}let pd=ud=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};pd=ud=g([X({type:K.Sequence,itemType:Ln})],pd);class cs{constructor(e={}){this.version=dd.v1,this.privateKeyAlgorithm=new ce,this.privateKey=new C1,Object.assign(this,e)}}g([w({type:T.Integer})],cs.prototype,"version",void 0);g([w({type:ce})],cs.prototype,"privateKeyAlgorithm",void 0);g([w({type:C1})],cs.prototype,"privateKey",void 0);g([w({type:pd,implicit:!0,context:0,optional:!0})],cs.prototype,"attributes",void 0);let T0=class extends cs{};T0=g([X({type:K.Sequence})],T0);let O0=class extends rl{};O0=g([X({type:K.Sequence})],O0);class I1{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],I1.prototype,"secretTypeId",void 0);g([w({type:T.Any,context:0})],I1.prototype,"secretValue",void 0);class ls{constructor(e={}){this.mac=new Qc,this.macSalt=new Te,this.iterations=1,Object.assign(this,e)}}g([w({type:Qc})],ls.prototype,"mac",void 0);g([w({type:Te})],ls.prototype,"macSalt",void 0);g([w({type:T.Integer,defaultValue:1})],ls.prototype,"iterations",void 0);class il{constructor(e={}){this.version=3,this.authSafe=new Yi,this.macData=new ls,Object.assign(this,e)}}g([w({type:T.Integer})],il.prototype,"version",void 0);g([w({type:Yi})],il.prototype,"authSafe",void 0);g([w({type:ls,optional:!0})],il.prototype,"macData",void 0);var fd;class ol{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:T.ObjectIdentifier})],ol.prototype,"bagId",void 0);g([w({type:T.Any,context:0})],ol.prototype,"bagValue",void 0);g([w({type:nl,repeated:"set",optional:!0})],ol.prototype,"bagAttributes",void 0);let z0=fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}};z0=fd=g([X({type:K.Sequence,itemType:ol})],z0);var hd,gd,md;const T1="1.2.840.113549.1.9",O1=`${T1}.7`,Hp=`${T1}.14`;let Va=class extends lt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};g([w({type:T.IA5String})],Va.prototype,"ia5String",void 0);Va=g([X({type:K.Choice})],Va);let D0=class extends Yi{};D0=g([X({type:K.Sequence})],D0);let R0=class extends il{};R0=g([X({type:K.Sequence})],R0);let P0=class extends rl{};P0=g([X({type:K.Sequence})],P0);let _d=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.IA5String})],_d.prototype,"value",void 0);_d=g([X({type:K.Choice})],_d);let B0=class extends Va{};B0=g([X({type:K.Choice})],B0);let j0=class extends lt{};j0=g([X({type:K.Choice})],j0);let yd=class{constructor(e=new Date){this.value=e}};g([w({type:T.GeneralizedTime})],yd.prototype,"value",void 0);yd=g([X({type:K.Choice})],yd);let L0=class extends lt{};L0=g([X({type:K.Choice})],L0);let wd=class{constructor(e="M"){this.value=e}toString(){return this.value}};g([w({type:T.PrintableString})],wd.prototype,"value",void 0);wd=g([X({type:K.Choice})],wd);let Ha=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.PrintableString})],Ha.prototype,"value",void 0);Ha=g([X({type:K.Choice})],Ha);let F0=class extends Ha{};F0=g([X({type:K.Choice})],F0);let U0=class extends lt{};U0=g([X({type:K.Choice})],U0);let vd=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.ObjectIdentifier})],vd.prototype,"value",void 0);vd=g([X({type:K.Choice})],vd);let M0=class extends ot{};M0=g([X({type:K.Choice})],M0);let bd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};g([w({type:T.Integer})],bd.prototype,"value",void 0);bd=g([X({type:K.Choice})],bd);let q0=class extends kn{};q0=g([X({type:K.Sequence})],q0);let Ka=class extends lt{};Ka=g([X({type:K.Choice})],Ka);let V0=hd=class extends fr{constructor(e){super(e),Object.setPrototypeOf(this,hd.prototype)}};V0=hd=g([X({type:K.Sequence})],V0);let H0=gd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,gd.prototype)}};H0=gd=g([X({type:K.Set,itemType:Ji})],H0);let xd=class{constructor(e=""){this.value=e}toString(){return this.value}};g([w({type:T.BmpString})],xd.prototype,"value",void 0);xd=g([X({type:K.Choice})],xd);let $d=class extends ce{};$d=g([X({type:K.Sequence})],$d);let K0=md=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,md.prototype)}};K0=md=g([X({type:K.Sequence,itemType:$d})],K0);var Ad;let Ga=Ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ad.prototype)}};Ga=Ad=g([X({type:K.Sequence,itemType:Ln})],Ga);class eo{constructor(e={}){this.version=0,this.subject=new Xe,this.subjectPKInfo=new nn,this.attributes=new Ga,Object.assign(this,e)}}g([w({type:T.Integer})],eo.prototype,"version",void 0);g([w({type:Xe})],eo.prototype,"subject",void 0);g([w({type:nn})],eo.prototype,"subjectPKInfo",void 0);g([w({type:Ga,implicit:!0,context:0})],eo.prototype,"attributes",void 0);class Oo{constructor(e={}){this.certificationRequestInfo=new eo,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}g([w({type:eo})],Oo.prototype,"certificationRequestInfo",void 0);g([w({type:ce})],Oo.prototype,"signatureAlgorithm",void 0);g([w({type:T.BitString})],Oo.prototype,"signature",void 0);/*!
162
162
  * MIT License
163
163
  *
164
164
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -181,30 +181,30 @@ PERFORMANCE OF THIS SOFTWARE.
181
181
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
182
182
  * SOFTWARE.
183
183
  *
184
- */const us="crypto.algorithm";class n4{getAlgorithms(){return ut.resolveAll(us)}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 Xr="crypto.algorithmProvider";ut.registerSingleton(Xr,n4);var Ks;const Nt="1.3.36.3.3.2.8.1.1",G0=`${Nt}.1`,W0=`${Nt}.2`,X0=`${Nt}.3`,J0=`${Nt}.4`,Y0=`${Nt}.5`,Z0=`${Nt}.6`,Q0=`${Nt}.7`,eh=`${Nt}.8`,th=`${Nt}.9`,nh=`${Nt}.10`,rh=`${Nt}.11`,ih=`${Nt}.12`,oh=`${Nt}.13`,sh=`${Nt}.14`,ah="brainpoolP160r1",ch="brainpoolP160t1",lh="brainpoolP192r1",uh="brainpoolP192t1",dh="brainpoolP224r1",ph="brainpoolP224t1",fh="brainpoolP256r1",hh="brainpoolP256t1",gh="brainpoolP320r1",mh="brainpoolP320t1",_h="brainpoolP384r1",yh="brainpoolP384t1",wh="brainpoolP512r1",vh="brainpoolP512t1",Me="ECDSA";let zo=Ks=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case Me.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return E3;case"sha-256":return S3;case"sha-384":return N3;case"sha-512":return C3}else if("namedCurve"in e){let n="";switch(e.namedCurve){case"P-256":n=A0;break;case"K-256":n=Ks.SECP256K1;break;case"P-384":n=k0;break;case"P-521":n=E0;break;case ah:n=G0;break;case ch:n=W0;break;case lh:n=X0;break;case uh:n=J0;break;case dh:n=Y0;break;case ph:n=Z0;break;case fh:n=Q0;break;case hh:n=eh;break;case gh:n=th;break;case mh:n=nh;break;case _h:n=rh;break;case yh:n=ih;break;case wh:n=oh;break;case vh:n=sh;break}if(n)return new ce({algorithm:Io,parameters:te.serialize(new gr({namedCurve:n}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case jp:return{name:Me,hash:{name:"SHA-1"}};case Lp:return{name:Me,hash:{name:"SHA-256"}};case Fp:return{name:Me,hash:{name:"SHA-384"}};case Up:return{name:Me,hash:{name:"SHA-512"}};case Io:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(te.parse(e.parameters,gr).namedCurve){case A0:return{name:Me,namedCurve:"P-256"};case Ks.SECP256K1:return{name:Me,namedCurve:"K-256"};case k0:return{name:Me,namedCurve:"P-384"};case E0:return{name:Me,namedCurve:"P-521"};case G0:return{name:Me,namedCurve:ah};case W0:return{name:Me,namedCurve:ch};case X0:return{name:Me,namedCurve:lh};case J0:return{name:Me,namedCurve:uh};case Y0:return{name:Me,namedCurve:dh};case Z0:return{name:Me,namedCurve:ph};case Q0:return{name:Me,namedCurve:fh};case eh:return{name:Me,namedCurve:hh};case th:return{name:Me,namedCurve:gh};case nh:return{name:Me,namedCurve:mh};case rh:return{name:Me,namedCurve:_h};case ih:return{name:Me,namedCurve:yh};case oh:return{name:Me,namedCurve:wh};case sh:return{name:Me,namedCurve:vh}}}}return null}};zo.SECP256K1="1.3.132.0.10";zo=Ks=g([tl()],zo);ut.registerSingleton(us,zo);const O1=Symbol("name"),z1=Symbol("value");class ze{constructor(e,n={},r=""){this[O1]=e,this[z1]=r;for(const i in n)this[i]=n[i]}}ze.NAME=O1;ze.VALUE=z1;class r4{static toTextObject(e){const n=new ze("Algorithm Identifier",{},Ar.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case Io:{const r=new zo().toWebAlgorithm(e);r&&"namedCurve"in r?n["Named Curve"]=r.namedCurve:n.Parameters=e.parameters;break}default:n.Parameters=e.parameters}return n}}class Ar{static toString(e){const n=this.items[e];return n||e}}Ar.items={[La]:"sha1",[w1]:"sha224",[Fa]:"sha256",[Ua]:"sha384",[Ma]:"sha512",[Kr]:"rsaEncryption",[Pa]:"sha1WithRSAEncryption",[R3]:"sha224WithRSAEncryption",[nd]:"sha256WithRSAEncryption",[Ba]:"sha384WithRSAEncryption",[ja]:"sha512WithRSAEncryption",[Io]:"ecPublicKey",[jp]:"ecdsaWithSHA1",[m1]:"ecdsaWithSHA224",[Lp]:"ecdsaWithSHA256",[Fp]:"ecdsaWithSHA384",[Up]:"ecdsaWithSHA512",[w3]:"TLS WWW server authentication",[v3]:"TLS WWW client authentication",[b3]:"Code Signing",[x3]:"E-mail Protection",[$3]:"Time Stamping",[A3]:"OCSP Signing",[k3]:"Signed Data"};class Jr{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++),o="";const c=e[ze.VALUE];c&&(o=` ${c}`),r.push(`${i}${e[ze.NAME]}:${o}`),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 f of u)f[ze.NAME]=l,r.push(...this.serializeObj(f,n));else if(u instanceof ze)u[ze.NAME]=l,r.push(...this.serializeObj(u,n));else if(re.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 f=u.toTextObject();f[ze.NAME]=l,r.push(...this.serializeObj(f,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=re.toUint8Array(e),o=[];for(let c=0;c<i.length;){const l=[];for(let u=0;u<16&&c<i.length;u++){u===8&&l.push("");const d=i[c++].toString(16).padStart(2,"0");l.push(d)}o.push(`${r}${l.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Jr.oidSerializer=Ar;Jr.algorithmSerializer=r4;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=re.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof kr?Zm(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return te.toString(this.rawData);case"text":return Jr.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 Jt extends kr{constructor(...e){let n;re.isBufferSource(e[0])?n=re.toArrayBuffer(e[0]):n=te.serialize(new Wt({extnID:e[0],critical:e[1],extnValue:new Te(re.toArrayBuffer(e[2]))})),super(n,Wt)}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]===Jt.NAME&&(e[ze.NAME]=Ar.toString(this.type)),e}}var D1;class ar{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(ar.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(ar.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=ar.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(ar.DEFAULT,e);return this}}D1=Symbol.toStringTag;ar.DEFAULT="default";const it=new ar,i4=/^[0-2](?:\.[1-9][0-9]*)+$/;function o4(t){return new RegExp(i4).test(t)}class R1{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return o4(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const Et=new R1;Et.register("CN","2.5.4.3");Et.register("L","2.5.4.7");Et.register("ST","2.5.4.8");Et.register("O","2.5.4.10");Et.register("OU","2.5.4.11");Et.register("C","2.5.4.6");Et.register("DC","0.9.2342.19200300.100.1.25");Et.register("E","1.2.840.113549.1.9.1");Et.register("G","2.5.4.42");Et.register("I","2.5.4.43");Et.register("SN","2.5.4.4");Et.register("T","2.5.4.12");function s4(t,e){return`\\${fe.ToHex(fe.FromUtf8String(e)).toUpperCase()}`}function a4(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,s4)}class Kt{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 R1,this.asn=new Xe;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 Xe?this.asn=e:re.isBufferSource(e)?this.asn=te.parse(e,Xe):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||Et.findId(e),r=[];for(const i of this.asn)for(const o of i)o.type===n&&r.push(o.value.toString());return r}getName(e){return this.extraNames.get(e)||Et.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)}`:a4(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const o of r){const c=this.getName(o.type)||o.type;(e=i[c])!==null&&e!==void 0||(i[c]=[]),i[c].push(o.value.anyValue?`#${fe.ToHex(o.value.anyValue)}`:o.value.toString())}n.push(i)}return n}fromString(e){const n=new Xe,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,o=",";for(;i=r.exec(`${e},`);){let[,c,l]=i;const u=l[l.length-1];(u===","||u==="+")&&(l=l.slice(0,l.length-1),i[3]=u);const d=i[3];c=this.getTypeOid(c);const f=this.createAttribute(c,l);o==="+"?n[n.length-1].push(f):n.push(new Ii([f])),o=d}return n}fromJSON(e){const n=new Xe;for(const r of e){const i=new Ii;for(const o in r){const c=this.getTypeOid(o),l=r[o];for(const u of l){const d=this.createAttribute(c,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 Rc({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:Kt.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]||it.get()):r=e[0]||it.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const P1="Cannot initialize GeneralName from ASN.1 data.",bh=`${P1} Unsupported string format in use.`,c4=`${P1} Value doesn't match to GUID regular expression.`,xh=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,$h="1.3.6.1.4.1.311.25.1",Ah="1.3.6.1.4.1.311.20.2.3",Cl="dns",Il="dn",Tl="email",Ol="ip",zl="url",Dl="guid",Rl="upn",Ts="id";class cr extends kr{constructor(...e){let n;if(e.length===2)switch(e[0]){case Il:{const r=new Kt(e[1]).toArrayBuffer(),i=te.parse(r,Xe);n=new Se({directoryName:i});break}case Cl:n=new Se({dNSName:e[1]});break;case Tl:n=new Se({rfc822Name:e[1]});break;case Dl:{const r=new RegExp(xh,"i").exec(e[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=r.slice(1).map((o,c)=>c<3?fe.ToHex(new Uint8Array(fe.FromHex(o)).reverse()):o).join("");n=new Se({otherName:new Eo({typeId:$h,value:te.serialize(new Te(fe.FromHex(i)))})});break}case Ol:n=new Se({iPAddress:e[1]});break;case Ts:n=new Se({registeredID:e[1]});break;case Rl:{n=new Se({otherName:new Eo({typeId:Ah,value:te.serialize(Z2.toASN(e[1]))})});break}case zl:n=new Se({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else re.isBufferSource(e[0])?n=te.parse(e[0],Se):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=Cl,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Tl,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Ol,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=zl,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Ts,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Il,this.value=new Kt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===$h){this.type=Dl;const n=te.parse(e.otherName.value,Te),r=new RegExp(xh,"i").exec(fe.ToHex(n));if(!r)throw new Error(c4);this.value=r.slice(1).map((i,o)=>o<3?fe.ToHex(new Uint8Array(fe.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===Ah)this.type=Rl,this.value=te.parse(e.otherName.value,lt).toString();else throw new Error(bh);else throw new Error(bh)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Il:case Cl:case Dl:case Ol:case Ts:case Rl:case zl:e=this.type.toUpperCase();break;case Tl:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Ts&&(n=Ar.toString(n)),new ze(e,void 0,n)}}class Do extends kr{constructor(e){let n;if(e instanceof gt)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof Se)r.push(i);else{const o=te.parse(new cr(i.type,i.value).rawData,Se);r.push(o)}n=new gt(r)}else if(re.isBufferSource(e))n=te.parse(e,gt);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 cr(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}}Do.NAME="GeneralNames";const wo="-{5}",Ro="\\n",l4=`[^${Ro}]+`,u4=`${wo}BEGIN (${l4}(?=${wo}))${wo}`,d4=`${wo}END \\1${wo}`,ji="\\n",p4=`[^:${Ro}]+`,f4=`(?:[^${Ro}]+${ji}(?: +[^${Ro}]+${ji})*)`,h4="[a-zA-Z0-9=+/]+",g4=`(?:${h4}${ji})+`,kh=`${u4}${ji}(?:((?:${p4}: ${f4})+))?${ji}?(${g4})${d4}`;class Bt{static isPem(e){return typeof e=="string"&&new RegExp(kh,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(kh,"g"),r=[];let i=null;for(;i=n.exec(e);){const o=i[3].replace(new RegExp(`[${Ro}]+`,"g"),""),c={type:i[1],headers:[],rawData:fe.FromBase64(o)},l=i[2];if(l){const u=l.split(new RegExp(ji,"g"));let d=null;for(const f of u){const[h,_]=f.split(/:(.*)/);if(_===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=h.trim()}else d&&c.headers.push(d),d={key:h,value:_.trim()}}d&&c.headers.push(d)}r.push(c)}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(!re.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:re.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(`
184
+ */const us="crypto.algorithm";class n4{getAlgorithms(){return ut.resolveAll(us)}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 Xr="crypto.algorithmProvider";ut.registerSingleton(Xr,n4);var Ks;const Nt="1.3.36.3.3.2.8.1.1",G0=`${Nt}.1`,W0=`${Nt}.2`,X0=`${Nt}.3`,J0=`${Nt}.4`,Y0=`${Nt}.5`,Z0=`${Nt}.6`,Q0=`${Nt}.7`,eh=`${Nt}.8`,th=`${Nt}.9`,nh=`${Nt}.10`,rh=`${Nt}.11`,ih=`${Nt}.12`,oh=`${Nt}.13`,sh=`${Nt}.14`,ah="brainpoolP160r1",ch="brainpoolP160t1",lh="brainpoolP192r1",uh="brainpoolP192t1",dh="brainpoolP224r1",ph="brainpoolP224t1",fh="brainpoolP256r1",hh="brainpoolP256t1",gh="brainpoolP320r1",mh="brainpoolP320t1",_h="brainpoolP384r1",yh="brainpoolP384t1",wh="brainpoolP512r1",vh="brainpoolP512t1",Me="ECDSA";let zo=Ks=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case Me.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return E3;case"sha-256":return S3;case"sha-384":return N3;case"sha-512":return C3}else if("namedCurve"in e){let n="";switch(e.namedCurve){case"P-256":n=A0;break;case"K-256":n=Ks.SECP256K1;break;case"P-384":n=k0;break;case"P-521":n=E0;break;case ah:n=G0;break;case ch:n=W0;break;case lh:n=X0;break;case uh:n=J0;break;case dh:n=Y0;break;case ph:n=Z0;break;case fh:n=Q0;break;case hh:n=eh;break;case gh:n=th;break;case mh:n=nh;break;case _h:n=rh;break;case yh:n=ih;break;case wh:n=oh;break;case vh:n=sh;break}if(n)return new ce({algorithm:Io,parameters:te.serialize(new gr({namedCurve:n}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case jp:return{name:Me,hash:{name:"SHA-1"}};case Lp:return{name:Me,hash:{name:"SHA-256"}};case Fp:return{name:Me,hash:{name:"SHA-384"}};case Up:return{name:Me,hash:{name:"SHA-512"}};case Io:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(te.parse(e.parameters,gr).namedCurve){case A0:return{name:Me,namedCurve:"P-256"};case Ks.SECP256K1:return{name:Me,namedCurve:"K-256"};case k0:return{name:Me,namedCurve:"P-384"};case E0:return{name:Me,namedCurve:"P-521"};case G0:return{name:Me,namedCurve:ah};case W0:return{name:Me,namedCurve:ch};case X0:return{name:Me,namedCurve:lh};case J0:return{name:Me,namedCurve:uh};case Y0:return{name:Me,namedCurve:dh};case Z0:return{name:Me,namedCurve:ph};case Q0:return{name:Me,namedCurve:fh};case eh:return{name:Me,namedCurve:hh};case th:return{name:Me,namedCurve:gh};case nh:return{name:Me,namedCurve:mh};case rh:return{name:Me,namedCurve:_h};case ih:return{name:Me,namedCurve:yh};case oh:return{name:Me,namedCurve:wh};case sh:return{name:Me,namedCurve:vh}}}}return null}};zo.SECP256K1="1.3.132.0.10";zo=Ks=g([tl()],zo);ut.registerSingleton(us,zo);const z1=Symbol("name"),D1=Symbol("value");class ze{constructor(e,n={},r=""){this[z1]=e,this[D1]=r;for(const i in n)this[i]=n[i]}}ze.NAME=z1;ze.VALUE=D1;class r4{static toTextObject(e){const n=new ze("Algorithm Identifier",{},Ar.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case Io:{const r=new zo().toWebAlgorithm(e);r&&"namedCurve"in r?n["Named Curve"]=r.namedCurve:n.Parameters=e.parameters;break}default:n.Parameters=e.parameters}return n}}class Ar{static toString(e){const n=this.items[e];return n||e}}Ar.items={[La]:"sha1",[v1]:"sha224",[Fa]:"sha256",[Ua]:"sha384",[Ma]:"sha512",[Kr]:"rsaEncryption",[Pa]:"sha1WithRSAEncryption",[R3]:"sha224WithRSAEncryption",[nd]:"sha256WithRSAEncryption",[Ba]:"sha384WithRSAEncryption",[ja]:"sha512WithRSAEncryption",[Io]:"ecPublicKey",[jp]:"ecdsaWithSHA1",[_1]:"ecdsaWithSHA224",[Lp]:"ecdsaWithSHA256",[Fp]:"ecdsaWithSHA384",[Up]:"ecdsaWithSHA512",[w3]:"TLS WWW server authentication",[v3]:"TLS WWW client authentication",[b3]:"Code Signing",[x3]:"E-mail Protection",[$3]:"Time Stamping",[A3]:"OCSP Signing",[k3]:"Signed Data"};class Jr{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++),o="";const c=e[ze.VALUE];c&&(o=` ${c}`),r.push(`${i}${e[ze.NAME]}:${o}`),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 f of u)f[ze.NAME]=l,r.push(...this.serializeObj(f,n));else if(u instanceof ze)u[ze.NAME]=l,r.push(...this.serializeObj(u,n));else if(re.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 f=u.toTextObject();f[ze.NAME]=l,r.push(...this.serializeObj(f,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=re.toUint8Array(e),o=[];for(let c=0;c<i.length;){const l=[];for(let u=0;u<16&&c<i.length;u++){u===8&&l.push("");const d=i[c++].toString(16).padStart(2,"0");l.push(d)}o.push(`${r}${l.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Jr.oidSerializer=Ar;Jr.algorithmSerializer=r4;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=re.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof kr?Qm(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return te.toString(this.rawData);case"text":return Jr.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 Jt extends kr{constructor(...e){let n;re.isBufferSource(e[0])?n=re.toArrayBuffer(e[0]):n=te.serialize(new Wt({extnID:e[0],critical:e[1],extnValue:new Te(re.toArrayBuffer(e[2]))})),super(n,Wt)}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]===Jt.NAME&&(e[ze.NAME]=Ar.toString(this.type)),e}}var R1;class ar{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[R1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(ar.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(ar.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=ar.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(ar.DEFAULT,e);return this}}R1=Symbol.toStringTag;ar.DEFAULT="default";const it=new ar,i4=/^[0-2](?:\.[1-9][0-9]*)+$/;function o4(t){return new RegExp(i4).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 o4(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const Et=new P1;Et.register("CN","2.5.4.3");Et.register("L","2.5.4.7");Et.register("ST","2.5.4.8");Et.register("O","2.5.4.10");Et.register("OU","2.5.4.11");Et.register("C","2.5.4.6");Et.register("DC","0.9.2342.19200300.100.1.25");Et.register("E","1.2.840.113549.1.9.1");Et.register("G","2.5.4.42");Et.register("I","2.5.4.43");Et.register("SN","2.5.4.4");Et.register("T","2.5.4.12");function s4(t,e){return`\\${fe.ToHex(fe.FromUtf8String(e)).toUpperCase()}`}function a4(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,s4)}class Kt{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 Xe;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 Xe?this.asn=e:re.isBufferSource(e)?this.asn=te.parse(e,Xe):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||Et.findId(e),r=[];for(const i of this.asn)for(const o of i)o.type===n&&r.push(o.value.toString());return r}getName(e){return this.extraNames.get(e)||Et.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)}`:a4(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const o of r){const c=this.getName(o.type)||o.type;(e=i[c])!==null&&e!==void 0||(i[c]=[]),i[c].push(o.value.anyValue?`#${fe.ToHex(o.value.anyValue)}`:o.value.toString())}n.push(i)}return n}fromString(e){const n=new Xe,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,o=",";for(;i=r.exec(`${e},`);){let[,c,l]=i;const u=l[l.length-1];(u===","||u==="+")&&(l=l.slice(0,l.length-1),i[3]=u);const d=i[3];c=this.getTypeOid(c);const f=this.createAttribute(c,l);o==="+"?n[n.length-1].push(f):n.push(new Ii([f])),o=d}return n}fromJSON(e){const n=new Xe;for(const r of e){const i=new Ii;for(const o in r){const c=this.getTypeOid(o),l=r[o];for(const u of l){const d=this.createAttribute(c,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 Rc({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:Kt.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]||it.get()):r=e[0]||it.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const B1="Cannot initialize GeneralName from ASN.1 data.",bh=`${B1} Unsupported string format in use.`,c4=`${B1} Value doesn't match to GUID regular expression.`,xh=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,$h="1.3.6.1.4.1.311.25.1",Ah="1.3.6.1.4.1.311.20.2.3",Cl="dns",Il="dn",Tl="email",Ol="ip",zl="url",Dl="guid",Rl="upn",Ts="id";class cr extends kr{constructor(...e){let n;if(e.length===2)switch(e[0]){case Il:{const r=new Kt(e[1]).toArrayBuffer(),i=te.parse(r,Xe);n=new Se({directoryName:i});break}case Cl:n=new Se({dNSName:e[1]});break;case Tl:n=new Se({rfc822Name:e[1]});break;case Dl:{const r=new RegExp(xh,"i").exec(e[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=r.slice(1).map((o,c)=>c<3?fe.ToHex(new Uint8Array(fe.FromHex(o)).reverse()):o).join("");n=new Se({otherName:new Eo({typeId:$h,value:te.serialize(new Te(fe.FromHex(i)))})});break}case Ol:n=new Se({iPAddress:e[1]});break;case Ts:n=new Se({registeredID:e[1]});break;case Rl:{n=new Se({otherName:new Eo({typeId:Ah,value:te.serialize(Q2.toASN(e[1]))})});break}case zl:n=new Se({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else re.isBufferSource(e[0])?n=te.parse(e[0],Se):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=Cl,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Tl,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Ol,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=zl,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Ts,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Il,this.value=new Kt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===$h){this.type=Dl;const n=te.parse(e.otherName.value,Te),r=new RegExp(xh,"i").exec(fe.ToHex(n));if(!r)throw new Error(c4);this.value=r.slice(1).map((i,o)=>o<3?fe.ToHex(new Uint8Array(fe.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===Ah)this.type=Rl,this.value=te.parse(e.otherName.value,lt).toString();else throw new Error(bh);else throw new Error(bh)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Il:case Cl:case Dl:case Ol:case Ts:case Rl:case zl:e=this.type.toUpperCase();break;case Tl:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Ts&&(n=Ar.toString(n)),new ze(e,void 0,n)}}class Do extends kr{constructor(e){let n;if(e instanceof gt)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof Se)r.push(i);else{const o=te.parse(new cr(i.type,i.value).rawData,Se);r.push(o)}n=new gt(r)}else if(re.isBufferSource(e))n=te.parse(e,gt);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 cr(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}}Do.NAME="GeneralNames";const wo="-{5}",Ro="\\n",l4=`[^${Ro}]+`,u4=`${wo}BEGIN (${l4}(?=${wo}))${wo}`,d4=`${wo}END \\1${wo}`,ji="\\n",p4=`[^:${Ro}]+`,f4=`(?:[^${Ro}]+${ji}(?: +[^${Ro}]+${ji})*)`,h4="[a-zA-Z0-9=+/]+",g4=`(?:${h4}${ji})+`,kh=`${u4}${ji}(?:((?:${p4}: ${f4})+))?${ji}?(${g4})${d4}`;class Bt{static isPem(e){return typeof e=="string"&&new RegExp(kh,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(kh,"g"),r=[];let i=null;for(;i=n.exec(e);){const o=i[3].replace(new RegExp(`[${Ro}]+`,"g"),""),c={type:i[1],headers:[],rawData:fe.FromBase64(o)},l=i[2];if(l){const u=l.split(new RegExp(ji,"g"));let d=null;for(const f of u){const[h,_]=f.split(/:(.*)/);if(_===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=h.trim()}else d&&c.headers.push(d),d={key:h,value:_.trim()}}d&&c.headers.push(d)}r.push(c)}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(!re.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:re.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
187
  `)}else{if(!n)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:n,rawData:re.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 o=fe.ToBase64(e.rawData);let c,l=0;const u=Array();for(;l<o.length&&(o.length-l<64?c=o.substring(l):(c=o.substring(l,l+64),l+=64),c.length!==0);)if(u.push(c),c.length<64)break;return i.push(...u),i.push(`-----END ${r}-----`),i.join(`
188
- `)}}Bt.CertificateTag="CERTIFICATE";Bt.CrlTag="CRL";Bt.CertificateRequestTag="CERTIFICATE REQUEST";Bt.PublicKeyTag="PUBLIC KEY";Bt.PrivateKeyTag="PRIVATE KEY";class Mn extends kr{static isAsnEncoded(e){return re.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(Bt.isPem(e))return Bt.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 Bt.isPem(n)?Bt.decode(n)[0]:fe.isHex(n)?fe.FromHex(n):fe.isBase64(n)?fe.FromBase64(n):fe.isBase64Url(n)?fe.FromBase64Url(n):re.toArrayBuffer(e)}}constructor(...e){Mn.isAsnEncoded(e[0])?super(Mn.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return Bt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class rn extends Mn{static async create(e,n=it.get()){if(e instanceof rn)return e;if(ar.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new rn(r)}else{if(e.publicKey)return e.publicKey;if(re.isBufferSource(e))return new rn(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Mn.isAsnEncoded(e)?super(e,nn):super(e),this.tag=Bt.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]||it.get()):n=e[0]||it.get();let o=this.rawData;const c=te.parse(this.rawData,nn);return c.algorithm.algorithm===yo&&(o=m4(c,o)),n.subtle.importKey("spki",o,i,!0,r)}onInit(e){const n=ut.resolve(Xr),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Kr:{const i=te.parse(e.subjectPublicKey,Mp),o=re.toUint8Array(i.modulus);r.publicExponent=re.toUint8Array(i.publicExponent),r.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||it.get()):r=e[0]||it.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=it.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=it.get();const i=te.parse(this.rawData,nn);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,nn);switch(e.Algorithm=Jr.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case Io:e["EC Point"]=n.subjectPublicKey;break;case Kr:default:e["Raw Data"]=n.subjectPublicKey}return e}}function m4(t,e){return t.algorithm=new ce({algorithm:Kr,parameters:null}),e=te.serialize(t),e}class Po extends Jt{static async create(e,n=!1,r=it.get()){if("name"in e&&"serialNumber"in e)return new Po(e,n);const o=await(await rn.create(e,r)).getKeyIdentifier(r);return new Po(fe.ToHex(o),n)}constructor(...e){if(re.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new Rr({keyIdentifier:new $p(fe.FromHex(e[0]))});super(vu,e[1],te.serialize(n))}else{const n=e[0],r=n.name instanceof Do?te.parse(n.name.rawData,gt):n.name,i=new Rr({authorityCertIssuer:r,authorityCertSerialNumber:fe.FromHex(n.serialNumber)});super(vu,e[1],te.serialize(i))}}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Rr);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,Rr);return n.authorityCertIssuer&&(e["Authority Issuer"]=new Do(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}Po.NAME="Authority Key Identifier";class Kp extends Jt{constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,ya);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new ya({cA:e[0],pathLenConstraint:e[1]});super(t1,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}}Kp.NAME="Basic Constraints";var Eh;(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"})(Eh||(Eh={}));class Gp extends Jt{constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,xa);this.usages=n.map(r=>r)}else{const n=new xa(e[0]);super(i1,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>Ar.toString(n)).join(", "),e}}Gp.NAME="Extended Key Usages";var Wa;(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"})(Wa||(Wa={}));class Wp extends Jt{constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Nl);this.usages=n.toNumber()}else{const n=new Nl(e[0]);super(o1,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Nl);return e[""]=n.toJSON().join(", "),e}}Wp.NAME="Key Usages";class ds extends Jt{static async create(e,n=!1,r=it.get()){const o=await(await rn.create(e,r)).getKeyIdentifier(r);return new ds(fe.ToHex(o),n)}constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,ur);this.keyId=fe.ToHex(n)}else{const n=typeof e[0]=="string"?fe.FromHex(e[0]):e[0],r=new ur(n);super(l1,e[1],te.serialize(r)),this.keyId=fe.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,ur);return e[""]=n,e}}ds.NAME="Subject Key Identifier";class B1 extends Jt{constructor(...e){re.isBufferSource(e[0])?super(e[0]):super(c1,e[1],new Do(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Ru);this.names=new Do(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}B1.NAME="Subject Alternative Name";class Yt{static register(e,n){this.items.set(e,n)}static create(e){const n=new Jt(e),r=this.items.get(n.type);return r?new r(e):n}}Yt.items=new Map;class j1 extends Jt{constructor(...e){var n;if(re.isBufferSource(e[0])){super(e[0]);const r=te.parse(this.value,va);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,o=new va(r.map(c=>new Bc({policyIdentifier:c})));super(n1,i,te.serialize(o)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new ze("",{},Ar.toString(n))),e}}j1.NAME="Certificate Policies";Yt.register(n1,j1);class L1 extends Jt{constructor(...e){var n;if(re.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(c=>new Wi({distributionPoint:new Mr({fullName:[new Se({uniformResourceIdentifier:c})]})})),o=new Ai(i);super(ku,e[1],te.serialize(o))}else{const r=new Ai(e[0]);super(ku,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,Ai);this.distributionPoints=n}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(n=>{var r;const i={};return n.distributionPoint&&(i[""]=(r=n.distributionPoint.fullName)===null||r===void 0?void 0:r.map(o=>new cr(o).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(o=>o.toString()).join(", ")),i}),e}}L1.NAME="CRL Distribution Points";class F1 extends Jt{constructor(...e){var n,r,i,o;if(re.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof vi){const c=new vi(e[0]);super(wu,e[1],te.serialize(c))}else{const c=e[0],l=new vi;zs(l,c,l0,"ocsp"),zs(l,c,u0,"caIssuers"),zs(l,c,d0,"timeStamping"),zs(l,c,p0,"caRepository"),super(wu,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=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],te.parse(e.extnValue,vi).forEach(r=>{switch(r.accessMethod){case l0:this.ocsp.push(new cr(r.accessLocation));break;case u0:this.caIssuers.push(new cr(r.accessLocation));break;case d0:this.timeStamping.push(new cr(r.accessLocation));break;case p0:this.caRepository.push(new cr(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Os(e,"OCSP",this.ocsp),this.caIssuers.length&&Os(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Os(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Os(e,"CA Repository",this.caRepository),e}}F1.NAME="Authority Info Access";function Os(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new ze("");n.forEach((i,o)=>{const c=i.toTextObject(),l=`${c[ze.NAME]} ${o+1}`;let u=r[l];Array.isArray(u)||(u=[],r[l]=u),u.push(c)}),t[e]=r}}function zs(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(c=>{typeof c=="string"&&(c=new cr("url",c)),t.push(new Zo({accessMethod:n,accessLocation:te.parse(c.rawData,Se)}))})}class to extends kr{constructor(...e){let n;if(re.isBufferSource(e[0]))n=re.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(o=>re.toArrayBuffer(o)):[];n=te.serialize(new Ln({type:r,values:i}))}super(n,Ln)}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]===to.NAME&&(e[ze.NAME]=Ar.toString(this.type)),e}}to.NAME="Attribute";class U1 extends to{constructor(...e){var n;if(re.isBufferSource(e[0]))super(e[0]);else{const r=new Ka({printableString:e[0]});super(T1,[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],Ka);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}U1.NAME="Challenge Password";class Xp extends to{constructor(...e){var n;if(re.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new fr;for(const o of r)i.push(te.parse(o.rawData,Wt));super(Hp,[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],fr);this.items=n.map(r=>Yt.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}}Xp.NAME="Extensions";class sl{static register(e,n){this.items.set(e,n)}static create(e){const n=new to(e),r=this.items.get(n.type);return r?new r(e):n}}sl.items=new Map;const ps="crypto.signatureFormatter";class _4{toAsnSignature(e,n){return re.toArrayBuffer(n)}toWebSignature(e,n){return re.toArrayBuffer(n)}}var Gs;let kd=Gs=class{static createPssParams(e,n){const r=Gs.getHashAlgorithm(e);return r?new Wr({hashAlgorithm:r,maskGenAlgorithm:new ce({algorithm:Yc,parameters:te.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=ut.resolve(Xr);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:Pa,parameters:null});case"sha-256":return new ce({algorithm:nd,parameters:null});case"sha-384":return new ce({algorithm:Ba,parameters:null});case"sha-512":return new ce({algorithm:ja,parameters:null})}}else return new ce({algorithm:Kr,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=Gs.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new ce({algorithm:yo,parameters:te.serialize(n)})}else return new ce({algorithm:yo,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Kr:return{name:"RSASSA-PKCS1-v1_5"};case Pa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case nd:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ba:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case ja:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case yo:if(e.parameters){const n=te.parse(e.parameters,Wr);return{name:"RSA-PSS",hash:ut.resolve(Xr).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};kd=Gs=g([tl()],kd);ut.registerSingleton(us,kd);let Ed=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ce({algorithm:La});case"sha-256":return new ce({algorithm:Fa});case"sha-384":return new ce({algorithm:Ua});case"sha-512":return new ce({algorithm:Ma})}return null}toWebAlgorithm(e){switch(e.algorithm){case La:return{name:"SHA-1"};case Fa:return{name:"SHA-256"};case Ua:return{name:"SHA-384"};case Ma:return{name:"SHA-512"}}return null}};Ed=g([tl()],Ed);ut.registerSingleton(us,Ed);class Gt{addPadding(e,n){const r=re.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=re.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=Gt.namedCurveSize.get(r)||Gt.defaultNamedCurveSize,o=new Ra,c=re.toUint8Array(n);return o.r=this.removePadding(c.slice(0,i),!0),o.s=this.removePadding(c.slice(i,i+i),!0),te.serialize(o)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=te.parse(n,Ra),i=e.namedCurve,o=Gt.namedCurveSize.get(i)||Gt.defaultNamedCurveSize,c=this.addPadding(o,this.removePadding(r.r)),l=this.addPadding(o,this.removePadding(r.s));return Ib(c,l)}return null}}Gt.namedCurveSize=new Map;Gt.defaultNamedCurveSize=32;const Pl="1.3.101.110",Sh="1.3.101.111",Bl="1.3.101.112",Nh="1.3.101.113";let Sd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Bl;break;case"x25519":n=Pl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Bl;break;case"ed448":n=Nh;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Pl;break;case"x448":n=Sh;break}}return n?new ce({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Bl:return{name:"Ed25519"};case Nh:return{name:"EdDSA",namedCurve:"Ed448"};case Pl:return{name:"X25519"};case Sh:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Sd=g([tl()],Sd);ut.registerSingleton(us,Sd);class y4 extends Mn{constructor(e){Mn.isAsnEncoded(e)?super(e,Oo):super(e),this.tag=Bt.CertificateRequestTag}onInit(e){this.tbs=te.serialize(e.certificationRequestInfo),this.publicKey=new rn(e.certificationRequestInfo.subjectPKInfo);const n=ut.resolve(Xr);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>sl.create(te.serialize(i)));const r=this.getAttribute(Hp);this.extensions=[],r instanceof Xp&&(this.extensions=r.items),this.subjectName=new Kt(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=it.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=ut.resolveAll(ps).reverse();let o=null;for(const l of i)if(o=l.toWebSignature(n,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Oo),r=n.certificationRequestInfo,i=new ze("",{Version:`${qr[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new ze("");for(const c of this.attributes){const l=c.toTextObject();o[l[ze.NAME]]=l}i.Attributes=o}return e.Data=i,e.Signature=new ze("",{Algorithm:Jr.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}y4.NAME="PKCS#10 Certificate Request";class al extends Mn{constructor(e){Mn.isAsnEncoded(e)?super(e,Vr):super(e),this.tag=Bt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=te.serialize(n),this.serialNumber=fe.ToHex(n.serialNumber),this.subjectName=new Kt(n.subject),this.subject=new Kt(n.subject).toString(),this.issuerName=new Kt(n.issuer),this.issuer=this.issuerName.toString();const r=ut.resolve(Xr);this.signatureAlgorithm=r.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const i=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const o=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!o)throw new Error("Cannot get 'notAfter' value");this.notAfter=o,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(c=>Yt.create(te.serialize(c)))),this.publicKey=new rn(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=it.get()){let r,i;const o=e.publicKey;try{if(!o)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in o)r={...o.publicKey.algorithm,...this.signatureAlgorithm},i=await o.publicKey.export(r,["verify"],n);else if(o instanceof rn)r={...o.algorithm,...this.signatureAlgorithm},i=await o.export(r,["verify"],n);else if(re.isBufferSource(o)){const d=new rn(o);r={...d.algorithm,...this.signatureAlgorithm},i=await d.export(r,["verify"],n)}else r={...o.algorithm,...this.signatureAlgorithm},i=o}catch{return!1}const c=ut.resolveAll(ps).reverse();let l=null;for(const d of c)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 f=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<f&&f<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=it.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=it.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Vr),r=n.tbsCertificate,i=new ze("",{Version:`${qr[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":Jr.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 o=new ze("");for(const c of this.extensions){const l=c.toTextObject();o[l[ze.NAME]]=l}i.Extensions=o}return e.Data=i,e.Signature=new ze("",{Algorithm:Jr.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}al.NAME="Certificate";class w4{static async createSelfSigned(e,n=it.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=it.get()){var r;let i;e.publicKey instanceof rn?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:re.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);const o=e.serialNumber?re.toUint8Array(fe.FromHex(e.serialNumber)):n.getRandomValues(new Uint8Array(16));o[0]>127&&(o[0]&=127),o.length>1&&o[0]===0&&(o[1]|=128);const c=e.notBefore||new Date,l=e.notAfter||new Date(c.getTime()+31536e6),u=new Vr({tbsCertificate:new Ft({version:qr.v3,serialNumber:o,validity:new Qo({notBefore:c,notAfter:l}),extensions:new fr(((r=e.extensions)===null||r===void 0?void 0:r.map(S=>te.parse(S.rawData,Wt)))||[]),subjectPublicKeyInfo:te.parse(i,nn)})});if(e.subject){const S=e.subject instanceof Kt?e.subject:new Kt(e.subject);u.tbsCertificate.subject=te.parse(S.toArrayBuffer(),Xe)}if(e.issuer){const S=e.issuer instanceof Kt?e.issuer:new Kt(e.issuer);u.tbsCertificate.issuer=te.parse(S.toArrayBuffer(),Xe)}const d={hash:"SHA-256"},f="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},h=ut.resolve(Xr);u.tbsCertificate.signature=u.signatureAlgorithm=h.toAsnAlgorithm(f);const _=te.serialize(u.tbsCertificate),$="signingKey"in e?await n.subtle.sign(f,e.signingKey,_):e.signature,m=ut.resolveAll(ps).reverse();let x=null;for(const S of m)if(x=S.toAsnSignature(f,$),x)break;if(!x)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=x,new al(te.serialize(u))}}var Ch;(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"})(Ch||(Ch={}));Yt.register(t1,Kp);Yt.register(i1,Gp);Yt.register(o1,Wp);Yt.register(l1,ds);Yt.register(vu,Po);Yt.register(c1,B1);Yt.register(ku,L1);Yt.register(wu,F1);sl.register(T1,U1);sl.register(Hp,Xp);ut.registerSingleton(ps,_4);ut.registerSingleton(ps,Gt);Gt.namedCurveSize.set("P-256",32);Gt.namedCurveSize.set("K-256",32);Gt.namedCurveSize.set("P-384",48);Gt.namedCurveSize.set("P-521",66);async function Nd(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=He(),i=su(new TextEncoder().encode(r)),o=await w4.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 Kp(!0,2,!0),new Gp(["1.3.6.1.5.5.7.3.1"],!0),new Wp(Wa.keyCertSign|Wa.cRLSign,!0),await ds.create(n.publicKey)]}),c=await crypto.subtle.exportKey("pkcs8",n.privateKey),l=o.toString("pem"),u=await b4(o),d=su(await o.getThumbprint()),f=v4("PRIVATE",c);return{kid:o.serialNumber,cert:l,thumbprint:d,fingerprint:u,pkcs7:f}}function v4(t,e){const n=Fm.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
188
+ `)}}Bt.CertificateTag="CERTIFICATE";Bt.CrlTag="CRL";Bt.CertificateRequestTag="CERTIFICATE REQUEST";Bt.PublicKeyTag="PUBLIC KEY";Bt.PrivateKeyTag="PRIVATE KEY";class Mn extends kr{static isAsnEncoded(e){return re.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(Bt.isPem(e))return Bt.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 Bt.isPem(n)?Bt.decode(n)[0]:fe.isHex(n)?fe.FromHex(n):fe.isBase64(n)?fe.FromBase64(n):fe.isBase64Url(n)?fe.FromBase64Url(n):re.toArrayBuffer(e)}}constructor(...e){Mn.isAsnEncoded(e[0])?super(Mn.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return Bt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class rn extends Mn{static async create(e,n=it.get()){if(e instanceof rn)return e;if(ar.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new rn(r)}else{if(e.publicKey)return e.publicKey;if(re.isBufferSource(e))return new rn(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Mn.isAsnEncoded(e)?super(e,nn):super(e),this.tag=Bt.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]||it.get()):n=e[0]||it.get();let o=this.rawData;const c=te.parse(this.rawData,nn);return c.algorithm.algorithm===yo&&(o=m4(c,o)),n.subtle.importKey("spki",o,i,!0,r)}onInit(e){const n=ut.resolve(Xr),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Kr:{const i=te.parse(e.subjectPublicKey,Mp),o=re.toUint8Array(i.modulus);r.publicExponent=re.toUint8Array(i.publicExponent),r.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||it.get()):r=e[0]||it.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=it.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=it.get();const i=te.parse(this.rawData,nn);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,nn);switch(e.Algorithm=Jr.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case Io:e["EC Point"]=n.subjectPublicKey;break;case Kr:default:e["Raw Data"]=n.subjectPublicKey}return e}}function m4(t,e){return t.algorithm=new ce({algorithm:Kr,parameters:null}),e=te.serialize(t),e}class Po extends Jt{static async create(e,n=!1,r=it.get()){if("name"in e&&"serialNumber"in e)return new Po(e,n);const o=await(await rn.create(e,r)).getKeyIdentifier(r);return new Po(fe.ToHex(o),n)}constructor(...e){if(re.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new Rr({keyIdentifier:new $p(fe.FromHex(e[0]))});super(vu,e[1],te.serialize(n))}else{const n=e[0],r=n.name instanceof Do?te.parse(n.name.rawData,gt):n.name,i=new Rr({authorityCertIssuer:r,authorityCertSerialNumber:fe.FromHex(n.serialNumber)});super(vu,e[1],te.serialize(i))}}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Rr);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,Rr);return n.authorityCertIssuer&&(e["Authority Issuer"]=new Do(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}Po.NAME="Authority Key Identifier";class Kp extends Jt{constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,ya);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new ya({cA:e[0],pathLenConstraint:e[1]});super(n1,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}}Kp.NAME="Basic Constraints";var Eh;(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"})(Eh||(Eh={}));class Gp extends Jt{constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,xa);this.usages=n.map(r=>r)}else{const n=new xa(e[0]);super(o1,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>Ar.toString(n)).join(", "),e}}Gp.NAME="Extended Key Usages";var Wa;(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"})(Wa||(Wa={}));class Wp extends Jt{constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Nl);this.usages=n.toNumber()}else{const n=new Nl(e[0]);super(s1,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Nl);return e[""]=n.toJSON().join(", "),e}}Wp.NAME="Key Usages";class ds extends Jt{static async create(e,n=!1,r=it.get()){const o=await(await rn.create(e,r)).getKeyIdentifier(r);return new ds(fe.ToHex(o),n)}constructor(...e){if(re.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,ur);this.keyId=fe.ToHex(n)}else{const n=typeof e[0]=="string"?fe.FromHex(e[0]):e[0],r=new ur(n);super(u1,e[1],te.serialize(r)),this.keyId=fe.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,ur);return e[""]=n,e}}ds.NAME="Subject Key Identifier";class j1 extends Jt{constructor(...e){re.isBufferSource(e[0])?super(e[0]):super(l1,e[1],new Do(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Ru);this.names=new Do(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}j1.NAME="Subject Alternative Name";class Yt{static register(e,n){this.items.set(e,n)}static create(e){const n=new Jt(e),r=this.items.get(n.type);return r?new r(e):n}}Yt.items=new Map;class L1 extends Jt{constructor(...e){var n;if(re.isBufferSource(e[0])){super(e[0]);const r=te.parse(this.value,va);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,o=new va(r.map(c=>new Bc({policyIdentifier:c})));super(r1,i,te.serialize(o)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new ze("",{},Ar.toString(n))),e}}L1.NAME="Certificate Policies";Yt.register(r1,L1);class F1 extends Jt{constructor(...e){var n;if(re.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(c=>new Wi({distributionPoint:new Mr({fullName:[new Se({uniformResourceIdentifier:c})]})})),o=new Ai(i);super(ku,e[1],te.serialize(o))}else{const r=new Ai(e[0]);super(ku,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,Ai);this.distributionPoints=n}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(n=>{var r;const i={};return n.distributionPoint&&(i[""]=(r=n.distributionPoint.fullName)===null||r===void 0?void 0:r.map(o=>new cr(o).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(o=>o.toString()).join(", ")),i}),e}}F1.NAME="CRL Distribution Points";class U1 extends Jt{constructor(...e){var n,r,i,o;if(re.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof vi){const c=new vi(e[0]);super(wu,e[1],te.serialize(c))}else{const c=e[0],l=new vi;zs(l,c,l0,"ocsp"),zs(l,c,u0,"caIssuers"),zs(l,c,d0,"timeStamping"),zs(l,c,p0,"caRepository"),super(wu,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=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],te.parse(e.extnValue,vi).forEach(r=>{switch(r.accessMethod){case l0:this.ocsp.push(new cr(r.accessLocation));break;case u0:this.caIssuers.push(new cr(r.accessLocation));break;case d0:this.timeStamping.push(new cr(r.accessLocation));break;case p0:this.caRepository.push(new cr(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Os(e,"OCSP",this.ocsp),this.caIssuers.length&&Os(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Os(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Os(e,"CA Repository",this.caRepository),e}}U1.NAME="Authority Info Access";function Os(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new ze("");n.forEach((i,o)=>{const c=i.toTextObject(),l=`${c[ze.NAME]} ${o+1}`;let u=r[l];Array.isArray(u)||(u=[],r[l]=u),u.push(c)}),t[e]=r}}function zs(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(c=>{typeof c=="string"&&(c=new cr("url",c)),t.push(new Zo({accessMethod:n,accessLocation:te.parse(c.rawData,Se)}))})}class to extends kr{constructor(...e){let n;if(re.isBufferSource(e[0]))n=re.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(o=>re.toArrayBuffer(o)):[];n=te.serialize(new Ln({type:r,values:i}))}super(n,Ln)}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]===to.NAME&&(e[ze.NAME]=Ar.toString(this.type)),e}}to.NAME="Attribute";class M1 extends to{constructor(...e){var n;if(re.isBufferSource(e[0]))super(e[0]);else{const r=new Ka({printableString:e[0]});super(O1,[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],Ka);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}M1.NAME="Challenge Password";class Xp extends to{constructor(...e){var n;if(re.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new fr;for(const o of r)i.push(te.parse(o.rawData,Wt));super(Hp,[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],fr);this.items=n.map(r=>Yt.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}}Xp.NAME="Extensions";class sl{static register(e,n){this.items.set(e,n)}static create(e){const n=new to(e),r=this.items.get(n.type);return r?new r(e):n}}sl.items=new Map;const ps="crypto.signatureFormatter";class _4{toAsnSignature(e,n){return re.toArrayBuffer(n)}toWebSignature(e,n){return re.toArrayBuffer(n)}}var Gs;let kd=Gs=class{static createPssParams(e,n){const r=Gs.getHashAlgorithm(e);return r?new Wr({hashAlgorithm:r,maskGenAlgorithm:new ce({algorithm:Yc,parameters:te.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=ut.resolve(Xr);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:Pa,parameters:null});case"sha-256":return new ce({algorithm:nd,parameters:null});case"sha-384":return new ce({algorithm:Ba,parameters:null});case"sha-512":return new ce({algorithm:ja,parameters:null})}}else return new ce({algorithm:Kr,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=Gs.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new ce({algorithm:yo,parameters:te.serialize(n)})}else return new ce({algorithm:yo,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Kr:return{name:"RSASSA-PKCS1-v1_5"};case Pa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case nd:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ba:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case ja:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case yo:if(e.parameters){const n=te.parse(e.parameters,Wr);return{name:"RSA-PSS",hash:ut.resolve(Xr).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};kd=Gs=g([tl()],kd);ut.registerSingleton(us,kd);let Ed=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ce({algorithm:La});case"sha-256":return new ce({algorithm:Fa});case"sha-384":return new ce({algorithm:Ua});case"sha-512":return new ce({algorithm:Ma})}return null}toWebAlgorithm(e){switch(e.algorithm){case La:return{name:"SHA-1"};case Fa:return{name:"SHA-256"};case Ua:return{name:"SHA-384"};case Ma:return{name:"SHA-512"}}return null}};Ed=g([tl()],Ed);ut.registerSingleton(us,Ed);class Gt{addPadding(e,n){const r=re.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=re.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=Gt.namedCurveSize.get(r)||Gt.defaultNamedCurveSize,o=new Ra,c=re.toUint8Array(n);return o.r=this.removePadding(c.slice(0,i),!0),o.s=this.removePadding(c.slice(i,i+i),!0),te.serialize(o)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=te.parse(n,Ra),i=e.namedCurve,o=Gt.namedCurveSize.get(i)||Gt.defaultNamedCurveSize,c=this.addPadding(o,this.removePadding(r.r)),l=this.addPadding(o,this.removePadding(r.s));return Ib(c,l)}return null}}Gt.namedCurveSize=new Map;Gt.defaultNamedCurveSize=32;const Pl="1.3.101.110",Sh="1.3.101.111",Bl="1.3.101.112",Nh="1.3.101.113";let Sd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Bl;break;case"x25519":n=Pl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Bl;break;case"ed448":n=Nh;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Pl;break;case"x448":n=Sh;break}}return n?new ce({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Bl:return{name:"Ed25519"};case Nh:return{name:"EdDSA",namedCurve:"Ed448"};case Pl:return{name:"X25519"};case Sh:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Sd=g([tl()],Sd);ut.registerSingleton(us,Sd);class y4 extends Mn{constructor(e){Mn.isAsnEncoded(e)?super(e,Oo):super(e),this.tag=Bt.CertificateRequestTag}onInit(e){this.tbs=te.serialize(e.certificationRequestInfo),this.publicKey=new rn(e.certificationRequestInfo.subjectPKInfo);const n=ut.resolve(Xr);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>sl.create(te.serialize(i)));const r=this.getAttribute(Hp);this.extensions=[],r instanceof Xp&&(this.extensions=r.items),this.subjectName=new Kt(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=it.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=ut.resolveAll(ps).reverse();let o=null;for(const l of i)if(o=l.toWebSignature(n,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Oo),r=n.certificationRequestInfo,i=new ze("",{Version:`${qr[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new ze("");for(const c of this.attributes){const l=c.toTextObject();o[l[ze.NAME]]=l}i.Attributes=o}return e.Data=i,e.Signature=new ze("",{Algorithm:Jr.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}y4.NAME="PKCS#10 Certificate Request";class al extends Mn{constructor(e){Mn.isAsnEncoded(e)?super(e,Vr):super(e),this.tag=Bt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=te.serialize(n),this.serialNumber=fe.ToHex(n.serialNumber),this.subjectName=new Kt(n.subject),this.subject=new Kt(n.subject).toString(),this.issuerName=new Kt(n.issuer),this.issuer=this.issuerName.toString();const r=ut.resolve(Xr);this.signatureAlgorithm=r.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const i=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const o=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!o)throw new Error("Cannot get 'notAfter' value");this.notAfter=o,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(c=>Yt.create(te.serialize(c)))),this.publicKey=new rn(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=it.get()){let r,i;const o=e.publicKey;try{if(!o)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in o)r={...o.publicKey.algorithm,...this.signatureAlgorithm},i=await o.publicKey.export(r,["verify"],n);else if(o instanceof rn)r={...o.algorithm,...this.signatureAlgorithm},i=await o.export(r,["verify"],n);else if(re.isBufferSource(o)){const d=new rn(o);r={...d.algorithm,...this.signatureAlgorithm},i=await d.export(r,["verify"],n)}else r={...o.algorithm,...this.signatureAlgorithm},i=o}catch{return!1}const c=ut.resolveAll(ps).reverse();let l=null;for(const d of c)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 f=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<f&&f<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=it.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=it.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Vr),r=n.tbsCertificate,i=new ze("",{Version:`${qr[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":Jr.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 o=new ze("");for(const c of this.extensions){const l=c.toTextObject();o[l[ze.NAME]]=l}i.Extensions=o}return e.Data=i,e.Signature=new ze("",{Algorithm:Jr.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}al.NAME="Certificate";class w4{static async createSelfSigned(e,n=it.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=it.get()){var r;let i;e.publicKey instanceof rn?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:re.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);const o=e.serialNumber?re.toUint8Array(fe.FromHex(e.serialNumber)):n.getRandomValues(new Uint8Array(16));o[0]>127&&(o[0]&=127),o.length>1&&o[0]===0&&(o[1]|=128);const c=e.notBefore||new Date,l=e.notAfter||new Date(c.getTime()+31536e6),u=new Vr({tbsCertificate:new Ft({version:qr.v3,serialNumber:o,validity:new Qo({notBefore:c,notAfter:l}),extensions:new fr(((r=e.extensions)===null||r===void 0?void 0:r.map(S=>te.parse(S.rawData,Wt)))||[]),subjectPublicKeyInfo:te.parse(i,nn)})});if(e.subject){const S=e.subject instanceof Kt?e.subject:new Kt(e.subject);u.tbsCertificate.subject=te.parse(S.toArrayBuffer(),Xe)}if(e.issuer){const S=e.issuer instanceof Kt?e.issuer:new Kt(e.issuer);u.tbsCertificate.issuer=te.parse(S.toArrayBuffer(),Xe)}const d={hash:"SHA-256"},f="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},h=ut.resolve(Xr);u.tbsCertificate.signature=u.signatureAlgorithm=h.toAsnAlgorithm(f);const _=te.serialize(u.tbsCertificate),$="signingKey"in e?await n.subtle.sign(f,e.signingKey,_):e.signature,m=ut.resolveAll(ps).reverse();let x=null;for(const S of m)if(x=S.toAsnSignature(f,$),x)break;if(!x)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=x,new al(te.serialize(u))}}var Ch;(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"})(Ch||(Ch={}));Yt.register(n1,Kp);Yt.register(o1,Gp);Yt.register(s1,Wp);Yt.register(u1,ds);Yt.register(vu,Po);Yt.register(l1,j1);Yt.register(ku,F1);Yt.register(wu,U1);sl.register(O1,M1);sl.register(Hp,Xp);ut.registerSingleton(ps,_4);ut.registerSingleton(ps,Gt);Gt.namedCurveSize.set("P-256",32);Gt.namedCurveSize.set("K-256",32);Gt.namedCurveSize.set("P-384",48);Gt.namedCurveSize.set("P-521",66);async function Nd(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=He(),i=su(new TextEncoder().encode(r)),o=await w4.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 Kp(!0,2,!0),new Gp(["1.3.6.1.5.5.7.3.1"],!0),new Wp(Wa.keyCertSign|Wa.cRLSign,!0),await ds.create(n.publicKey)]}),c=await crypto.subtle.exportKey("pkcs8",n.privateKey),l=o.toString("pem"),u=await b4(o),d=su(await o.getThumbprint()),f=v4("PRIVATE",c);return{kid:o.serialNumber,cert:l,thumbprint:d,fingerprint:u,pkcs7:f}}function v4(t,e){const n=Fm.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 b4(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),o=new TextEncoder().encode(r);return su(await Bm(o))}const x4=1e3*60*60*24,$4=new s.OpenAPIHono().openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(ou)}},description:"List of keys"}}}),async t=>{const n=(await t.env.data.keys.list()).filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ou}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),r=(await t.env.data.keys.list()).find(i=>i.kid===e);if(!r)throw new P(404,{message:"Key not found"});return t.json(r)}).openapi(s.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const e=await t.env.data.keys.list();for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+x4).toISOString()});const n=await Nd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{kid:e}=t.req.valid("param");if(!await t.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new P(404,{message:"Key not found"});const r=await Nd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(r),t.text("OK")}),A4=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:s.z.object({email:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.array(Hd)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await sp(t.env.data.users,e,n)).filter(o=>!o.linked_to);return t.json(i)}),k4=Kn.extend({clients:s.z.array(Or)}),E4=new s.OpenAPIHono().openapi(s.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([k4,s.z.array(Or)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:c}=t.req.valid("query"),u=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c})).applications;return i?t.json({clients:u,start:0,limit:10,length:u.length}):t.json(u)}).openapi(s.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Or}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=(await t.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(o=>o.id===n);if(!i)throw new P(404);return t.json(i)}).openapi(s.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.applications.remove(e,n))throw new P(404,{message:"Application not found"});return t.text("OK")}).openapi(s.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ca.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Or}},description:"The update application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=t.req.valid("json");await t.env.data.applications.update(e,n,i);const o=await t.env.data.applications.get(e,n);if(!o)throw new P(404,{message:"Application not found"});return t.json(o)}).openapi(s.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ca.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.object(Or.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||He(),client_secret:n.client_secret||He()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()});ac.extend({email:s.z.string(),login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any());const S4=Kn.extend({tenants:s.z.array(xi)}),N4=new s.OpenAPIHono().openapi(s.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Bn},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.union([s.z.array(xi),S4])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),c=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:ti(i),q:o});return r?t.json(c):t.json(c.tenants)}).openapi(s.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:xi}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new P(404);return t.json(n)}).openapi(s.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param");return await t.env.data.tenants.remove(e),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ua.shape).partial()}}},params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),n=t.req.valid("json");return await t.env.data.tenants.update(e,n),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ua.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:xi}},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})}),C4=Kn.extend({logs:s.z.array(pa)}),I4=new s.OpenAPIHono().openapi(s.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(pa),C4])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":c}=t.req.valid("header"),l=await t.env.data.logs.list(c,{page:e,per_page:n,include_totals:r,sort:ti(i),q:o});return r?t.json(l):t.json(l.logs)}).openapi(s.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:pa}},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 P(404);return t.json(r)}),T4=Kn.extend({hooks:s.z.array(yi)}),O4=new s.OpenAPIHono().openapi(s.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(yi),T4])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:c}=t.req.valid("query"),l=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c});return i?t.json(l):t.json(l.hooks)}).openapi(s.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Fs}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:yi}},description:"The created hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.hooks.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()}),body:{content:{"application/json":{schema:s.z.union([Fs.options[0].omit({hook_id:!0}).partial(),Fs.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:yi}},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 P(404,{message:"Hook not found"});return t.json(i)}).openapi(s.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yi}},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 P(404,{message:"Hook not found"});return t.json(r)}).openapi(s.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param");if(!await t.env.data.hooks.remove(e,n))throw new P(404,{message:"Hook not found"});return t.text("OK")}),z4=Kn.extend({connections:s.z.array(or)}),D4=new s.OpenAPIHono().openapi(s.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(or),z4])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:c}=t.req.valid("query"),l=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c});return i?t.json(l):t.json(l.connections)}).openapi(s.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:or}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.connections.remove(e,n))throw new P(404,{message:"Connection not found"});return t.text("OK")}).openapi(s.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(la.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:or}},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 P(404,{message:"Connection not found"});const o=await t.env.data.connections.get(e,n);if(!o)throw new P(404,{message:"Connection not found"});return t.json(o)}).openapi(s.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(la.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:or}},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})}),R4=new s.OpenAPIHono().openapi(s.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Us}},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(Us.parse({}))}).openapi(s.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Us.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 Ih=!1;function Jp(t){t.use(async(e,n)=>(Ih||(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"}}}}),Ih=!0),await n()))}s.z.object({alg:s.z.literal("RS256"),kty:s.z.literal("RSA"),use:s.z.literal("sig"),n:s.z.string(),e:s.z.string(),kid:s.z.string(),x5t:s.z.string(),x5c:s.z.array(s.z.string())});async function P4(t){try{const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new P(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function B4(t,e){const r=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),i=new Uint8Array(Array.from(e.signature).map(u=>u.charCodeAt(0))),c=(await P4(t.env)).find(u=>u.kid===e.header.kid);if(!c)return console.log("No matching kid found"),!1;const l=await crypto.subtle.importKey("jwk",c,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",l,i,r)}function j4(t){const[e,n,r]=t.split(".");if(!e||!n||!r)return null;const i=JSON.parse(atob(e)),o=JSON.parse(atob(n)),c=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return{header:i,payload:o,signature:c,raw:{header:e,payload:n,signature:r}}}function Yp(t){return async(e,n)=>{var i,o,c;const r=t.openAPIRegistry.definitions.find(l=>"route"in l&&l.route.path===e.req.path&&l.route.method.toUpperCase()===e.req.method);if(r&&"route"in r){const l=(o=(i=r.route.security)==null?void 0:i[0])==null?void 0:o.Bearer;if(!(l!=null&&l.length))return await n();const u=e.req.header("authorization")||"",[d,f]=u.split(" ");if((d==null?void 0:d.toLowerCase())!=="bearer"||!f)throw new P(401,{message:"Missing bearer token"});const h=j4(f);if(!h||!await B4(e,h))throw new P(403,{message:"Invalid JWT signature"});e.set("user_id",h.payload.sub),e.set("user",h.payload);const _=h.payload.permissions||[],$=((c=h.payload.scope)==null?void 0:c.split(" "))||[];if(l.length&&!(l.some(m=>_.includes(m))||l.some(m=>$.includes(m))))throw new P(403,{message:"Unauthorized"})}return await n()}}const L4=new s.OpenAPIHono().openapi(s.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ms}},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 P(404,{message:"Email provider not found"});return t.json(n)}).openapi(s.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Ms.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.create(e,n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Ms.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")}),F4=new s.OpenAPIHono().openapi(s.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:dc}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.remove(e,n))throw new P(404,{message:"Session not found"});return t.text("OK")}).openapi(s.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.update(e,n,{revoked_at:new Date().toDateString()}))throw new P(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),U4=new s.OpenAPIHono().openapi(s.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Zd}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.refreshTokens.remove(e,n))throw new P(404,{message:"Session not found"});return t.text("OK")}),M4=new s.OpenAPIHono().openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(ir)}},description:"List of custom domains"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.customDomains.list(e);return t.json(n)}).openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ir}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.customDomains.remove(e,n))throw new P(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(s.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ir.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ir}},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 P(404);const o=await t.env.data.customDomains.get(e,n);if(!o)throw new P(404);return t.json(o)}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(Xd.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:ir}},description:"The created custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.customDomains.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ir}},description:"The custom domain"}}}),async()=>{throw new P(501,{message:"Not implemented"})});function cl(t,e){const n={};for(const[r,i]of Object.entries(e)){const o={};for(const[c,l]of Object.entries(i))typeof l=="function"?o[c]=async(...u)=>{const d=performance.now();try{const f=await l(...u),_=performance.now()-d,$=t.res.headers.get("Server-Timing")||"",m=$?`${$}, ${r}-${c};dur=${_.toFixed(2)}`:`${r}-${c};dur=${_.toFixed(2)}`;return t.res.headers.set("Server-Timing",m),f}catch(f){const _=performance.now()-d,$=t.res.headers.get("Server-Timing")||"",m=$?`${$}, ${r}-${c}-error;dur=${_.toFixed(2)}`:`${r}-${c}-error;dur=${_.toFixed(2)}`;throw t.res.headers.set("Server-Timing",m),f}}:o[c]=l;n[r]=o}return n}async function ll(t,e){const n=t.req.header("x-forwarded-host");if(n){const i=await t.env.data.customDomains.getByDomain(n);if(i)return t.set("tenant_id",i.tenant_id),t.set("custom_domain",n),await e()}const r=t.req.header("host");if(r){const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const o=i[0];await t.env.data.tenants.get(o)&&t.set("tenant_id",o)}}return await e()}const q4=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()});function V4(t){if(t)try{let e=t;try{e=atob(t)}catch{}try{const n=JSON.parse(e);return q4.parse(n)}catch{}}catch{return}}const ul=async(t,e)=>{var l,u,d,f;const n=(l=t.req.query("auth0Client"))==null?void 0:l.slice(0,255),r=(u=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),o=(f=t.req.header("cf-ipcountry"))==null?void 0:f.slice(0,2),c=n?V4(n):void 0;c&&t.set("auth0_client",c),r&&t.set("ip",r),i&&t.set("useragent",i),o&&t.set("countryCode",o),await e()},Tr=class Tr{constructor(){xe(this,"cacheStore",new Map)}static getInstance(){return Tr.instance||(Tr.instance=new Tr),Tr.instance}set(e,n,r){if(r<=0)return;const i=Date.now()+r;this.cacheStore.set(e,{value:n,expiresAt:i})}get(e){const n=this.cacheStore.get(e);if(n){if(Date.now()>n.expiresAt){this.cacheStore.delete(e);return}return n.value}}delete(e){this.cacheStore.delete(e)}getKeysByPrefix(e){return Array.from(this.cacheStore.keys()).filter(n=>n.startsWith(e))}clear(){this.cacheStore.clear()}};xe(Tr,"instance");let Cd=Tr;function H4(t,e,n){try{return`${t}:${e}:${JSON.stringify(n)}`}catch{return`${t}:${e}:${Date.now()}-${Math.random()}`}}function dl(t,e){const n=e.cache||Cd.getInstance(),r=e.defaultTtl,i=e.customTtls||{},o=new Set(e.excludeMethods||[]),c=e.maxItems||0,l=e.cacheEntities||[],u=l.length===0,d=new Set(l),f={};for(const[h,_]of Object.entries(t)){const $=u||d.has(h),m={};for(const[x,S]of Object.entries(_))if(typeof S=="function"){if(!$){m[x]=S;continue}const k=`${h}:${x}`;if(o.has(k)){m[x]=S;continue}const v=i[k]||r,O=["create","update","remove","delete","set","used"].includes(x);m[x]=async(...q)=>{if(O){const J=await Promise.resolve(n.getKeysByPrefix(`${h}:`));for(const ue of J)await Promise.resolve(n.delete(ue));return await S.apply(_,q)}const F=H4(h,x,q),H=await Promise.resolve(n.get(F));if(H!==void 0)return H;const W=await S.apply(_,q);if(await n.set(F,W,v),c>0){const J=await Promise.resolve(n.getKeysByPrefix(""));if(J.length>c){const ue=J.slice(0,J.length-c);for(const Ne of ue)await Promise.resolve(n.delete(Ne))}}return W}}else m[x]=S;f[h]=m}return f}const K4=Kn.extend({forms:s.z.array(_i)}),G4=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(_i),K4])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:c}=t.req.valid("query"),l=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c});return i?t.json(l):t.json(l.forms)}).openapi(s.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:_i}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.forms.remove(e,n))throw new P(404,{message:"Form not found"});return t.text("OK")}).openapi(s.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(da.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:_i}},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 P(404,{message:"Form not found"});const o=await t.env.data.forms.get(e,n);if(!o)throw new P(404,{message:"Form not found"});return t.json(o)}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(da.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:_i}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.forms.create(e,n);return t.json(r,{status:201})});function W4(t){const e=new s.OpenAPIHono;e.use(Zg({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})),Jp(e),e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:0,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}),e.use(ul).use(ll).use(Yp(e));const n=e.route("/branding",_w).route("/custom-domains",M4).route("/email/providers",L4).route("/users",kb).route("/keys",$4).route("/users-by-email",A4).route("/clients",E4).route("/tenants",N4).route("/logs",I4).route("/hooks",O4).route("/connections",D4).route("/prompts",R4).route("/sessions",F4).route("/refresh_tokens",U4).route("/forms",G4);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 X4(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}function mr(t){var e;if(t)return`${t.name}/${t.version}${(e=t.env)!=null&&e.node?` (env: node/${t.env.node})`:""}`}var Th;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Th||(Th={}));var Oh;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Oh||(Oh={}));function J4(t){return q1(t,Y4,Bo.Include)}function M1(t){return q1(t,Z4,Bo.None)}function q1(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,c=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],c+=8;for(let l=0;l<4;l++)c>=6?(r+=e[o>>c-6&63],c-=6):c>0?(r+=e[o<<6-c&63],c=0):n===Bo.Include&&(r+="=")}return r}const Y4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Bo;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Bo||(Bo={}));var zh;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(zh||(zh={}));class Q4{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 Dh=new Q4;function mn(t,e){return(t<<32-e|t>>>e)>>>0}function ex(t){const e=new tx;return e.update(t),e.digest()}class tx{constructor(){xe(this,"blockSize",64);xe(this,"size",32);xe(this,"blocks",new Uint8Array(64));xe(this,"currentBlockSize",0);xe(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));xe(this,"l",0n);xe(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),Dh.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)Dh.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 f=(mn(this.w[d-2],17)^mn(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,h=(mn(this.w[d-15],7)^mn(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=f+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],o=this.H[4],c=this.H[5],l=this.H[6],u=this.H[7];for(let d=0;d<64;d++){const f=(mn(o,6)^mn(o,11)^mn(o,25))>>>0,h=(o&c^~o&l)>>>0,_=u+f+h+nx[d]+this.w[d]|0,$=(mn(e,2)^mn(e,13)^mn(e,22))>>>0,m=(e&n^e&r^n&r)>>>0,x=$+m|0;u=l,l=c,c=o,o=i+_|0,i=r,r=n,n=e,e=_+x|0}this.H[0]=e+this.H[0]|0,this.H[1]=n+this.H[1]|0,this.H[2]=r+this.H[2]|0,this.H[3]=i+this.H[3]|0,this.H[4]=o+this.H[4]|0,this.H[5]=c+this.H[5]|0,this.H[6]=l+this.H[6]|0,this.H[7]=u+this.H[7]|0}}const nx=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 rx{constructor(e){xe(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 ix(t){const e=ex(new TextEncoder().encode(t));return M1(e)}function ox(){const t=new Uint8Array(32);return crypto.getRandomValues(t),M1(t)}function vo(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 jl(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return J4(n)}async function Xa(t){let e;try{e=await fetch(t)}catch(n){throw new H1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new Ws(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);let r;try{r=V1(n)}catch{throw new ki(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new Ws(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);return new rx(n)}throw e.body!==null&&await e.body.cancel(),new Ws(e.status)}async function sx(t){let e;try{e=await fetch(t)}catch(n){throw new H1(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=V1(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 Ws(e.status)}function V1(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 ax(e,n,r,i)}class H1 extends Error{constructor(e){super("Failed to send request",{cause:e})}}class ax extends Error{constructor(n,r,i,o){super(`OAuth request error: ${n}`);xe(this,"code");xe(this,"description");xe(this,"uri");xe(this,"state");this.code=n,this.description=r,this.uri=i,this.state=o}}class Ws extends Error{constructor(n){super("Unexpected error response");xe(this,"status");this.status=n}}class ki extends Error{constructor(n,r){super("Unexpected error response body");xe(this,"status");xe(this,"data");this.status=n,this.data=r}}class Zp{constructor(e,n,r){xe(this,"clientId");xe(this,"clientPassword");xe(this,"redirectURI");this.clientId=e,this.clientPassword=n,this.redirectURI=r}createAuthorizationURL(e,n,r){const i=new URL(e);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&i.searchParams.set("redirect_uri",this.redirectURI),i.searchParams.set("state",n),r.length>0&&i.searchParams.set("scope",r.join(" ")),i}createAuthorizationURLWithPKCE(e,n,r,i,o){const c=new URL(e);if(c.searchParams.set("response_type","code"),c.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&c.searchParams.set("redirect_uri",this.redirectURI),c.searchParams.set("state",n),r===jo.S256){const l=ix(i);c.searchParams.set("code_challenge_method","S256"),c.searchParams.set("code_challenge",l)}else r===jo.Plain&&(c.searchParams.set("code_challenge_method","plain"),c.searchParams.set("code_challenge",i));return o.length>0&&c.searchParams.set("scope",o.join(" ")),c}async validateAuthorizationCode(e,n,r){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("code",n),this.redirectURI!==null&&i.set("redirect_uri",this.redirectURI),r!==null&&i.set("code_verifier",r),this.clientPassword===null&&i.set("client_id",this.clientId);const o=vo(e,i);if(this.clientPassword!==null){const l=jl(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await Xa(o)}async refreshAccessToken(e,n,r){const i=new URLSearchParams;i.set("grant_type","refresh_token"),i.set("refresh_token",n),this.clientPassword===null&&i.set("client_id",this.clientId),r.length>0&&i.set("scope",r.join(" "));const o=vo(e,i);if(this.clientPassword!==null){const l=jl(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await Xa(o)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=vo(e,r);if(this.clientPassword!==null){const o=jl(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${o}`)}await sx(i)}}var jo;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(jo||(jo={}));var Rh;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Rh||(Rh={}));var Ph;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Ph||(Ph={}));function bo(t){return cx(t,lx,Ja.None)}function cx(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,c=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],c+=8;for(let l=0;l<4;l++)c>=6?(r+=e[o>>c-6&63],c-=6):c>0?(r+=e[o<<6-c&63],c=0):n===Ja.Include&&(r+="=")}return r}const lx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Ja;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Ja||(Ja={}));var Bh;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Bh||(Bh={}));function ux(t,e,n){const r=bo(new TextEncoder().encode(t)),i=bo(new TextEncoder().encode(e)),o=bo(n);return r+"."+i+"."+o}function dx(t,e){const n=bo(new TextEncoder().encode(t)),r=bo(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const px="https://appleid.apple.com/auth/authorize",fx="https://appleid.apple.com/auth/token";class K1{constructor(e,n,r,i,o){xe(this,"clientId");xe(this,"teamId");xe(this,"keyId");xe(this,"pkcs8PrivateKey");xe(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=o}createAuthorizationURL(e,n){const r=new URL(px);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=vo(fx,n);return await Xa(i)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),n=Math.floor(Date.now()/1e3),r=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),i=JSON.stringify({iss:this.teamId,exp:n+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:n}),o=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,dx(r,i)));return ux(r,i,o)}}const hx="https://www.facebook.com/v16.0/dialog/oauth",gx="https://graph.facebook.com/v16.0/oauth/access_token";class G1{constructor(e,n,r){xe(this,"clientId");xe(this,"clientSecret");xe(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(hx);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=vo(gx,n);return await Xa(r)}}const mx="https://accounts.google.com/o/oauth2/v2/auth",jh="https://oauth2.googleapis.com/token",_x="https://oauth2.googleapis.com/revoke";let W1=class{constructor(e,n,r){xe(this,"client");this.client=new Zp(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(mx,e,jo.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(jh,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(jh,e,[])}async revokeToken(e){await this.client.revokeToken(_x,e)}};const pl=s.z.object({iss:s.z.string().url(),sub:s.z.string(),aud:s.z.string(),exp:s.z.number(),email:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),name:s.z.string().optional(),iat:s.z.number(),auth_time:s.z.number().optional(),nonce:s.z.string().optional(),acr:s.z.string().optional(),amr:s.z.array(s.z.string()).optional(),azp:s.z.string().optional(),at_hash:s.z.string().optional(),c_hash:s.z.string().optional()}).passthrough();pl.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function yx(t){return t.ISSUER}function jt(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function rt(t){return t.OAUTH_API_URL||t.ISSUER}function X1(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 wx(t,e){var u,d;const{options:n,keyArray:r}=X1(e),i=new K1(n.client_id,n.team_id,n.kid,r,`${rt(t.env)}callback`),o=He(),c=await i.createAuthorizationURL(o,((u=n.scope)==null?void 0:u.split(" "))||["name","email"]);return(((d=n.scope)==null?void 0:d.split(" "))||["name","email"]).some(f=>["email","name"].includes(f))&&c.searchParams.set("response_mode","form_post"),{redirectUrl:c.href,code:o}}async function vx(t,e,n){const{options:r,keyArray:i}=X1(e),c=await new K1(r.client_id,r.team_id,r.kid,i,`${rt(t.env)}callback`).validateAuthorizationCode(n),l=ep(c.idToken());if(!l)throw new Error("Invalid ID token");const u=pl.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 bx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:wx,validateAuthorizationCodeAndGetUser:vx},Symbol.toStringTag,{value:"Module"}));async function xx(t,e){var c;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new G1(n.client_id,n.client_secret,`${rt(t.env)}callback`),i=He();return{redirectUrl:r.createAuthorizationURL(i,((c=n.scope)==null?void 0:c.split(" "))||["email"]).href,code:i}}async function $x(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new G1(r.client_id,r.client_secret,`${rt(t.env)}callback`).validateAuthorizationCode(n),c=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${o.accessToken()}`}});if(!c.ok)throw new Error("Failed to fetch user info");const l=await c.json();return t.set("log",`Userinfo: ${JSON.stringify(l)}`),{sub:l.id,email:l.email,name:l.name}}const Ax=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:xx,validateAuthorizationCodeAndGetUser:$x},Symbol.toStringTag,{value:"Module"}));async function kx(t,e){var l;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=new W1(n.client_id,n.client_secret,`${rt(t.env)}callback`),i=He(),o=ox();return{redirectUrl:r.createAuthorizationURL(i,o,((l=n.scope)==null?void 0:l.split(" "))??["email","profile"]).href,code:i,codeVerifier:o}}async function Ex(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 c=await new W1(i.client_id,i.client_secret,`${rt(t.env)}callback`).validateAuthorizationCode(n,r),l=ep(c.idToken());if(!l)throw new Error("Invalid ID token");const u=pl.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 Sx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:kx,validateAuthorizationCodeAndGetUser:Ex},Symbol.toStringTag,{value:"Module"}));async function Nx(t,e){var c;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new Zp(n.client_id,n.client_secret,`${rt(t.env)}callback`),i=He(),o=r.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",i,((c=n.scope)==null?void 0:c.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return o.searchParams.set("response_type","code"),o.searchParams.set("response_mode","query"),{redirectUrl:o.href,code:i}}async function Cx(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new Zp(r.client_id,r.client_secret,`${rt(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),c=ep(o.idToken());if(!c)throw new Error("Invalid ID token");const l=pl.parse(c.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 ${o.accessToken()}`,"Merchant-Serial-Number":l.msn}});if(!u.ok)throw new P(400,{message:"Failed to get user from vipps"});return await u.json()}const Ix=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Nx,validateAuthorizationCodeAndGetUser:Cx},Symbol.toStringTag,{value:"Module"}));function J1(t,e){const n=t.env.STRATEGIES||{},i={apple:bx,facebook:Ax,"google-oauth2":Sx,vipps:Ix,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function fs(t,e){const n=await t.data.clients.get(e);if(!n)throw new P(403,{message:"Client not found"});const r=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,i=await t.data.connections.list(n.tenant.id),o=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},c=i.connections.map(l=>{var f;const u=(f=o.connections)==null?void 0:f.find(h=>h.name===l.name);if(!(u!=null&&u.options))return l;const d=or.parse({...u||{},...l});return d.options=Wd.passthrough().parse({...u.options||{},...l.options}),d}).filter(l=>l);return{...n,web_origins:[...(r==null?void 0:r.web_origins)||[],...n.web_origins||[],`${jt(t)}login`],allowed_logout_urls:[...(r==null?void 0:r.allowed_logout_urls)||[],...n.allowed_logout_urls||[],t.ISSUER],callbacks:[...(r==null?void 0:r.callbacks)||[],...n.callbacks||[],`${jt(t)}info`],connections:c,tenant:{...(r==null?void 0:r.tenant)||{},...n.tenant}}}async function Lh(t,e,n,r){if(!r.state)throw new P(400,{message:"State not found"});const i=e.connections.find(u=>u.name===n);if(!i){t.set("client_id",e.id);const u=qe(t,{type:Fe.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,u),new P(403,{message:"Connection Not Found"})}let o=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!o){const u=t.get("ip"),d=t.get("useragent"),f=t.get("auth0_client");o=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:r,csrf_token:He(),ip:u,useragent:d,auth0Client:mr(f)})}const l=await J1(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:o.id,code_id:l.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:l.codeVerifier,expires_at:new Date(Date.now()+Fw*1e3).toISOString()}),t.redirect(l.redirectUrl)}async function Fh(t,{code:e,state:n}){var m;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new P(403,{message:"State not found"});const o=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!o)throw new P(403,{message:"Session not found"});if(o.authorization_url){const x=new URL(o.authorization_url).hostname,S=t.var.custom_domain||t.req.header("host")||"";if(x!==S&&x){const k=new URL(`https://${x}/callback`);return k.searchParams.set("state",n),k.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:k.toString()}})}}const c=await fs(r,o.authParams.client_id);t.set("client_id",c.id),t.set("tenant_id",c.tenant.id);const l=c.connections.find(x=>x.id===i.connection_id);if(!l){const x=qe(t,{type:Fe.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(c.tenant.id,x),new P(403,{message:"Connection not found"})}if(t.set("connection",l.name),!o.authParams.redirect_uri){const x=qe(t,{type:Fe.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(c.tenant.id,x),new P(403,{message:"Redirect URI not defined"})}const d=await J1(t,l.strategy).validateAuthorizationCodeAndGetUser(t,l,e,i.code_verifier),{sub:f,...h}=d;t.set("user_id",f);const _=((m=d.email)==null?void 0:m.toLocaleLowerCase())||`${l.name}.${f}@${new URL(t.env.ISSUER).hostname}`;t.set("username",_);const $=await _c(t,{client:c,username:_,provider:l.strategy,connection:l.name,userId:f,profileData:h,isSocial:!0,ip:t.req.header("x-real-ip")});return xr(t,{client:c,authParams:o.authParams,loginSession:o,user:$})}async function Uh(t,e,n,r,i,o){const c=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!c)throw new P(400,{message:"State not found"});const l=await t.env.data.loginSessions.get(t.var.tenant_id,c.login_id);if(!l)throw new P(400,{message:"Login not found"});const{redirect_uri:u}=l.authParams;if(!u)throw new P(400,{message:"Redirect uri not found"});const d=qe(t,{type:Fe.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});Pt(t,t.env.data.logs.create(t.var.tenant_id,d));const f=new URL(u);return X4(f,{error:n,error_description:r,error_reason:o,error_code:i,state:l.authParams.state}),t.redirect(`${jt(t.env)}login/identifier?state=${l.id}&error=${n}`)}const Tx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:c}=t.req.valid("query");if(r)return Uh(t,e,r,i,o,c);if(!n)throw new P(400,{message:"Code is required"});const l=await Fh(t,{code:n,state:e});if(!(l instanceof Response))throw new P(500,{message:"Internal server error"});return l}).openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:c}=t.req.valid("form");if(r)return Uh(t,e,r,i,o,c);if(!n)throw new P(400,{message:"Code is required"});const l=await Fh(t,{code:n,state:e});if(!(l instanceof Response))throw new P(500,{message:"Internal server error"});return l});function Y1(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return Ox(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function Ox(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 zx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),returnTo:s.z.string().optional()}),header:s.z.object({cookie:s.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async t=>{const{client_id:e,returnTo:n}=t.req.valid("query"),r=await t.env.data.clients.get(e);if(!r)return t.text("OK");const i=await t.env.data.clients.get("DEFAULT_CLIENT");t.set("client_id",e),t.set("tenant_id",r.tenant.id);const o=n||t.req.header("referer");if(!o)return t.text("OK");if(!Y1(o,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new P(400,{message:"Invalid redirect uri"});const c=t.req.header("cookie");if(c){const u=fa(r.tenant.id,c);if(u){const d=await t.env.data.sessions.get(r.tenant.id,u);if(d){const f=await t.env.data.users.get(r.tenant.id,d.user_id);f&&(t.set("user_id",f.user_id),t.set("connection",f.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(_=>t.env.data.refreshTokens.remove(r.tenant.id,_.id))),await t.env.data.sessions.update(r.tenant.id,u,{revoked_at:new Date().toISOString()})}}}const l=qe(t,{type:Fe.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":Hw(r.tenant.id,t.req.header("host")),location:o}})}),Mh=s.z.object({sub:s.z.string(),email:s.z.string().optional(),family_name:s.z.string().optional(),given_name:s.z.string().optional(),email_verified:s.z.boolean()}),Dx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:Mh}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new P(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 P(404,{message:"User not found"});return t.json(Mh.parse({...e,sub:e.user_id}))}),Rx=new s.OpenAPIHono().openapi(s.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:$m}},description:"List of tenants"}}}),async t=>{const e=await t.env.data.keys.list(),n=await Promise.all(e.map(async r=>{const o=await new al(r.cert).publicKey.export(),c=await crypto.subtle.exportKey("jwk",o);return Jd.parse({...c,kid:r.kid})}));return t.json({keys:n},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Cs}, stale-while-revalidate=${Cs*2}, stale-if-error=86400`}})}).openapi(s.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:iu}},description:"List of tenants"}}}),async t=>{const e=iu.parse({issuer:yx(t.env),authorization_endpoint:`${rt(t.env)}authorize`,token_endpoint:`${rt(t.env)}oauth/token`,device_authorization_endpoint:`${rt(t.env)}oauth/device/code`,userinfo_endpoint:`${rt(t.env)}userinfo`,mfa_challenge_endpoint:`${rt(t.env)}mfa/challenge`,jwks_uri:`${rt(t.env)}.well-known/jwks.json`,registration_endpoint:`${rt(t.env)}oidc/register`,revocation_endpoint:`${rt(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=${Cs}, stale-while-revalidate=${Cs*2}, stale-if-error=86400`}})});function Xs(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 Z1=s.z.object({grant_type:s.z.literal("client_credentials"),scope:s.z.string().optional(),client_secret:s.z.string(),client_id:s.z.string(),audience:s.z.string().optional()});async function Px(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new P(403,{message:"Invalid client credentials"});if(n.client_secret&&!Xs(n.client_secret,e.client_secret))throw new P(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience};return{client:n,authParams:r}}const Bx=s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string().optional(),client_secret:s.z.string().optional(),code_verifier:s.z.string().optional()}).refine(t=>"client_secret"in t&&!("code_verifier"in t)||!("client_secret"in t)&&"code_verifier"in t,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function jx(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new P(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 P(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new P(403,{message:"Code expired"});if(r.used_at)throw new P(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new P(403,{message:"Invalid login"});if("client_secret"in e){const c=await t.env.data.clients.get("DEFAULT_CLIENT");if(!Xs(n.client_secret,e.client_secret)&&!Xs(c==null?void 0:c.client_secret,e.client_secret))throw new P(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const c=await Pw(e.code_verifier,r.code_challenge_method);if(!Xs(c,r.code_challenge))throw new P(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new P(403,{message:"Invalid redirect uri"});const o=await t.env.data.users.get(n.tenant.id,r.user_id);if(!o)throw new P(403,{message:"User not found"});return await t.env.data.codes.used(n.tenant.id,e.code),{user:o,client:n,loginSession:i,session_id:i.session_id,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:Pn.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}}}const Lx=s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),redirect_uri:s.z.string().optional(),refresh_token:s.z.string()});async function Fx(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new P(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 P(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new P(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 P(403,{message:"User not found"});const o=r.resource_servers[0];if(r.idle_expires_at){const c=new Date(Date.now()+2592e6);await t.env.data.refreshTokens.update(n.tenant.id,r.id,{idle_expires_at:c.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:o==null?void 0:o.audience,scope:o==null?void 0:o.scopes,response_mode:Pn.WEB_MESSAGE}}}const Ux={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 Mx(t,e){var n=Array.prototype.slice.call(e);return n.push(Ux),t.apply(this,n)}function qh(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var o=Number(n[i]),c=Number(r[i]);if(o>c)return 1;if(c>o)return-1;if(!isNaN(o)&&isNaN(c))return 1;if(isNaN(o)&&!isNaN(c))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 qx={}.constructor;function Ei(t){return t!=null&&t.constructor===qx}function Id(t){"@babel/helpers - typeof";return Id=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},Id(t)}function fl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vx(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 hl(t,e,n){return e&&Vx(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Hx="1.2.0",Kx="1.7.35",Vh=" ext. ",Gx=/^\d+$/,_t=function(){function t(e){fl(this,t),Q1(e),this.metadata=e,e_.call(this,e)}return hl(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&&Gx.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new Hh(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new Hh(this.getNumberingPlanMetadata(r),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var r=this.countryCallingCodes()[n];if(r)return r.length===1&&r[0].length===3?void 0:r}},{key:"getCountryCodeForCallingCode",value:function(n){var r=this.getCountryCodesForCallingCode(n);if(r)return r[0]}},{key:"getNumberingPlanMetadata",value:function(n){var r=this.getCountryCodeForCallingCode(n);if(r)return this.getCountryMetadata(r);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(n){return this.numberingPlan.type(n)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}]),t}(),Hh=function(){function t(e,n){fl(this,t),this.globalMetadataObject=n,this.metadata=e,e_.call(this,n.metadata)}return hl(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 Wx(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()&&Kh(this.types(),n))return new Jx(Kh(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?Vh:this.metadata[13]||Vh}}]),t}(),Wx=function(){function t(e,n){fl(this,t),this._format=e,this.metadata=n}return hl(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()&&!Xx.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),Xx=/^\(?\$1\)?$/,Jx=function(){function t(e,n){fl(this,t),this.type=e,this.metadata=n}return hl(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 Kh(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 Q1(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Ei(t)||!Ei(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(Ei(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+Yx(t)+": "+t,"."))}var Yx=function(e){return Id(e)};function Qp(t,e){if(e=new _t(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function Zx(t,e){return e.countries.hasOwnProperty(t)}function e_(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?qh(e,Hx)===-1?this.v2=!0:qh(e,Kx)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function ef(t,e){return Qx(t,void 0,e)}function Qx(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=t.length,c=i[0];return c===o?"IS_POSSIBLE":c>o?"TOO_SHORT":i[i.length-1]<o?"TOO_LONG":i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function e$(t,e,n){if(e===void 0&&(e={}),n=new _t(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 t_(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 t_(t,e){switch(ef(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function qn(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function t$(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=n$(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
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n$(t,e){if(t){if(typeof t=="string")return Gh(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 Gh(t,e)}}function Gh(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 r$=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function tf(t,e,n){if(e=e||{},!(!t.country&&!t.countryCallingCode)){n=new _t(n),n.selectNumberingPlan(t.country,t.countryCallingCode);var r=e.v2?t.nationalNumber:t.phone;if(qn(r,n.nationalNumberPattern())){if(Ll(r,"FIXED_LINE",n))return n.type("MOBILE")&&n.type("MOBILE").pattern()===""||!n.type("MOBILE")||Ll(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var i=t$(r$),o;!(o=i()).done;){var c=o.value;if(Ll(r,c,n))return c}}}}function Ll(t,e,n){return e=n.type(e),!e||!e.pattern()||e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0?!1:qn(t,e.pattern())}function i$(t,e,n){if(e=e||{},n=new _t(n),n.selectNumberingPlan(t.country,t.countryCallingCode),n.hasTypes())return tf(t,e,n.metadata)!==void 0;var r=e.v2?t.nationalNumber:t.phone;return qn(r,n.nationalNumberPattern())}function o$(t,e,n){var r=new _t(n),i=r.getCountryCodesForCallingCode(t);return i?i.filter(function(o){return s$(e,o,n)}):[]}function s$(t,e,n){var r=new _t(n);return r.selectNumberingPlan(e),r.numberingPlan.possibleLengths().indexOf(t.length)>=0}var nf=2,a$=17,c$=3,cn="0-90-9٠-٩۰-۹",l$="-‐-―−ー-",u$="//",d$="..",p$="  ­​⁠ ",f$="()()[]\\[\\]",h$="~⁓∼~",Ya="".concat(l$).concat(u$).concat(d$).concat(p$).concat(f$).concat(h$),rf="++",g$=new RegExp("(["+cn+"])");function m$(t,e,n,r){if(e){var i=new _t(r);i.selectNumberingPlan(e,n);var o=new RegExp(i.IDDPrefix());if(t.search(o)===0){t=t.slice(t.match(o)[0].length);var c=t.match(g$);if(!(c&&c[1]!=null&&c[1].length>0&&c[1]==="0"))return t}}}function _$(t,e){if(t&&e.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+e.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(t);if(r){var i,o,c=r.length-1,l=c>0&&r[c];if(e.nationalPrefixTransformRule()&&l)i=t.replace(n,e.nationalPrefixTransformRule()),c>1&&(o=r[1]);else{var u=r[0];i=t.slice(u.length),l&&(o=r[1])}var d;if(l){var f=t.indexOf(r[1]),h=t.slice(0,f);h===e.numberingPlan.nationalPrefix()&&(d=e.numberingPlan.nationalPrefix())}else d=r[0];return{nationalNumber:i,nationalPrefix:d,carrierCode:o}}}return{nationalNumber:t}}function Td(t,e){var n=_$(t,e),r=n.carrierCode,i=n.nationalNumber;if(i!==t){if(!y$(t,i,e))return{nationalNumber:t};if(e.possibleLengths()&&!w$(i,e))return{nationalNumber:t}}return{nationalNumber:i,carrierCode:r}}function y$(t,e,n){return!(qn(t,n.nationalNumberPattern())&&!qn(e,n.nationalNumberPattern()))}function w$(t,e){switch(ef(t,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function v$(t,e,n,r){var i=e?Qp(e,r):n;if(t.indexOf(i)===0){r=new _t(r),r.selectNumberingPlan(e,n);var o=t.slice(i.length),c=Td(o,r),l=c.nationalNumber,u=Td(t,r),d=u.nationalNumber;if(!qn(d,r.nationalNumberPattern())&&qn(l,r.nationalNumberPattern())||ef(d,r)==="TOO_LONG")return{countryCallingCode:i,number:o}}return{number:t}}function n_(t,e,n,r){if(!t)return{};var i;if(t[0]!=="+"){var o=m$(t,e,n,r);if(o&&o!==t)i=!0,t="+"+o;else{if(e||n){var c=v$(t,e,n,r),l=c.countryCallingCode,u=c.number;if(l)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:l,number:u}}return{number:t}}}if(t[1]==="0")return{};r=new _t(r);for(var d=2;d-1<=c$&&d<=t.length;){var f=t.slice(1,d);if(r.hasCallingCode(f))return r.selectNumberingPlan(f),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:f,number:t.slice(d)};d++}return{}}function b$(t){return t.replace(new RegExp("[".concat(Ya,"]+"),"g")," ").trim()}var x$=/(\$\d)/;function $$(t,e,n){var r=n.useInternationalFormat,i=n.withNationalPrefix,o=t.replace(new RegExp(e.pattern()),r?e.internationalFormat():i&&e.nationalPrefixFormattingRule()?e.format().replace(x$,e.nationalPrefixFormattingRule()):e.format());return r?b$(o):o}var A$=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function k$(t,e,n){var r=new _t(n);if(r.selectNumberingPlan(t,e),r.defaultIDDPrefix())return r.defaultIDDPrefix();if(A$.test(r.IDDPrefix()))return r.IDDPrefix()}var E$=";ext=",li=function(e){return"([".concat(cn,"]{1,").concat(e,"})")};function r_(t){var e="20",n="15",r="9",i="6",o="[  \\t,]*",c="[:\\..]?[  \\t,-]*",l="#?",u="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",d="(?:[xx##~~]|int|int)",f="[- ]+",h="[  \\t]*",_="(?:,{2}|;)",$=E$+li(e),m=o+u+c+li(e)+l,x=o+d+c+li(r)+l,S=f+li(i)+"#",k=h+_+c+li(n)+l,v=h+"(?:,)+"+c+li(r)+l;return $+"|"+m+"|"+x+"|"+S+"|"+k+"|"+v}var S$="["+cn+"]{"+nf+"}",N$="["+rf+"]{0,1}(?:["+Ya+"]*["+cn+"]){3,}["+Ya+cn+"]*",C$=new RegExp("^["+rf+"]{0,1}(?:["+Ya+"]*["+cn+"]){1,2}$","i"),I$=N$+"(?:"+r_()+")?",T$=new RegExp("^"+S$+"$|^"+I$+"$","i");function O$(t){return t.length>=nf&&T$.test(t)}function z$(t){return C$.test(t)}function D$(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 R$(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=P$(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
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P$(t,e){if(t){if(typeof t=="string")return Wh(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 Wh(t,e)}}function Wh(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 Xh(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 Jh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xh(Object(n),!0).forEach(function(r){B$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function B$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Yh={formatExtension:function(e,n,r){return"".concat(e).concat(r.ext()).concat(n)}};function j$(t,e,n,r){if(n?n=Jh(Jh({},Yh),n):n=Yh,r=new _t(r),t.country&&t.country!=="001"){if(!r.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));r.country(t.country)}else if(t.countryCallingCode)r.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var i=r.countryCallingCode(),o=n.v2?t.nationalNumber:t.phone,c;switch(e){case"NATIONAL":return o?(c=Za(o,t.carrierCode,"NATIONAL",r,n),Fl(c,t.ext,r,n.formatExtension)):"";case"INTERNATIONAL":return o?(c=Za(o,null,"INTERNATIONAL",r,n),c="+".concat(i," ").concat(c),Fl(c,t.ext,r,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(o);case"RFC3966":return D$({number:"+".concat(i).concat(o),ext:t.ext});case"IDD":if(!n.fromCountry)return;var l=F$(o,t.carrierCode,i,n.fromCountry,r);return Fl(l,t.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(e,'"'))}}function Za(t,e,n,r,i){var o=L$(r.formats(),t);return o?$$(t,o,{useInternationalFormat:n==="INTERNATIONAL",withNationalPrefix:!(o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&i&&i.nationalPrefix===!1),carrierCode:e,metadata:r}):t}function L$(t,e){for(var n=R$(t),r;!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var o=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(e.search(o)!==0)continue}if(qn(e,i.pattern()))return i}}function Fl(t,e,n,r){return e?r(t,e,n):t}function F$(t,e,n,r,i){var o=Qp(r,i.metadata);if(o===n){var c=Za(t,e,"NATIONAL",i);return n==="1"?n+" "+c:c}var l=k$(r,void 0,i.metadata);if(l)return"".concat(l," ").concat(n," ").concat(Za(t,null,"INTERNATIONAL",i))}function Zh(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 Qh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zh(Object(n),!0).forEach(function(r){U$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function M$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function q$(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 V$(t,e,n){return e&&q$(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var H$=function(){function t(e,n,r){if(M$(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(Ei(n)&&Ei(n.countries)){r=n;var i=e;if(!W$.test(i))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var o=n_(i,void 0,void 0,r),c=o.countryCallingCode,l=o.number;if(n=l,e=c,!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");Q1(r);var u=G$(e,r),d=u.country,f=u.countryCallingCode;this.country=d,this.countryCallingCode=f,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return V$(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:o$(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return e$(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return i$(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new _t(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 tf(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,r){return j$(this,n,r?Qh(Qh({},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}(),K$=function(e){return/^[A-Z]{2}$/.test(e)};function G$(t,e){var n,r,i=new _t(e);return K$(t)?(n=t,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=t,{country:n,countryCallingCode:r}}var W$=/^\+\d+$/;function Od(t){"@babel/helpers - typeof";return Od=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},Od(t)}function X$(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}function J$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y$(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&&Lo(t,e)}function Z$(t){var e=o_();return function(){var r=Fo(t),i;if(e){var o=Fo(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return Q$(this,i)}}function Q$(t,e){if(e&&(Od(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i_(t)}function i_(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zd(t){var e=typeof Map=="function"?new Map:void 0;return zd=function(r){if(r===null||!e5(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 Js(r,arguments,Fo(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Lo(i,r)},zd(t)}function Js(t,e,n){return o_()?Js=Reflect.construct:Js=function(i,o,c){var l=[null];l.push.apply(l,o);var u=Function.bind.apply(i,l),d=new u;return c&&Lo(d,c.prototype),d},Js.apply(null,arguments)}function o_(){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 e5(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Lo(t,e){return Lo=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Lo(t,e)}function Fo(t){return Fo=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Fo(t)}var Cn=function(t){Y$(n,t);var e=Z$(n);function n(r){var i;return J$(this,n),i=e.call(this,r),Object.setPrototypeOf(i_(i),n.prototype),i.name=i.constructor.name,i}return X$(n)}(zd(Error)),eg=new RegExp("(?:"+r_()+")$","i");function t5(t){var e=t.search(eg);if(e<0)return{};for(var n=t.slice(0,e),r=t.match(eg),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}var n5={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 r5(t){return n5[t]}function i5(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=o5(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 b4(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),o=new TextEncoder().encode(r);return su(await Bm(o))}const x4=1e3*60*60*24,$4=new s.OpenAPIHono().openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(ou)}},description:"List of keys"}}}),async t=>{const n=(await t.env.data.keys.list()).filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ou}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),r=(await t.env.data.keys.list()).find(i=>i.kid===e);if(!r)throw new P(404,{message:"Key not found"});return t.json(r)}).openapi(s.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const e=await t.env.data.keys.list();for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+x4).toISOString()});const n=await Nd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{kid:e}=t.req.valid("param");if(!await t.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new P(404,{message:"Key not found"});const r=await Nd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create(r),t.text("OK")}),A4=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:s.z.object({email:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.array(Hd)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await sp(t.env.data.users,e,n)).filter(o=>!o.linked_to);return t.json(i)}),k4=Kn.extend({clients:s.z.array(Or)}),E4=new s.OpenAPIHono().openapi(s.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([k4,s.z.array(Or)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:c}=t.req.valid("query"),u=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c})).applications;return i?t.json({clients:u,start:0,limit:10,length:u.length}):t.json(u)}).openapi(s.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Or}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=(await t.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(o=>o.id===n);if(!i)throw new P(404);return t.json(i)}).openapi(s.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.applications.remove(e,n))throw new P(404,{message:"Application not found"});return t.text("OK")}).openapi(s.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ca.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Or}},description:"The update application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=t.req.valid("json");await t.env.data.applications.update(e,n,i);const o=await t.env.data.applications.get(e,n);if(!o)throw new P(404,{message:"Application not found"});return t.json(o)}).openapi(s.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ca.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.object(Or.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||He(),client_secret:n.client_secret||He()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()});ac.extend({email:s.z.string(),login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any());const S4=Kn.extend({tenants:s.z.array(xi)}),N4=new s.OpenAPIHono().openapi(s.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Bn},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.union([s.z.array(xi),S4])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),c=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:ti(i),q:o});return r?t.json(c):t.json(c.tenants)}).openapi(s.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:xi}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new P(404);return t.json(n)}).openapi(s.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param");return await t.env.data.tenants.remove(e),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ua.shape).partial()}}},params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),n=t.req.valid("json");return await t.env.data.tenants.update(e,n),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ua.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:xi}},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})}),C4=Kn.extend({logs:s.z.array(pa)}),I4=new s.OpenAPIHono().openapi(s.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(pa),C4])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":c}=t.req.valid("header"),l=await t.env.data.logs.list(c,{page:e,per_page:n,include_totals:r,sort:ti(i),q:o});return r?t.json(l):t.json(l.logs)}).openapi(s.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:pa}},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 P(404);return t.json(r)}),T4=Kn.extend({hooks:s.z.array(yi)}),O4=new s.OpenAPIHono().openapi(s.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(yi),T4])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:c}=t.req.valid("query"),l=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c});return i?t.json(l):t.json(l.hooks)}).openapi(s.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Fs}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:yi}},description:"The created hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.hooks.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()}),body:{content:{"application/json":{schema:s.z.union([Fs.options[0].omit({hook_id:!0}).partial(),Fs.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:yi}},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 P(404,{message:"Hook not found"});return t.json(i)}).openapi(s.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yi}},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 P(404,{message:"Hook not found"});return t.json(r)}).openapi(s.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param");if(!await t.env.data.hooks.remove(e,n))throw new P(404,{message:"Hook not found"});return t.text("OK")}),z4=Kn.extend({connections:s.z.array(or)}),D4=new s.OpenAPIHono().openapi(s.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(or),z4])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:c}=t.req.valid("query"),l=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c});return i?t.json(l):t.json(l.connections)}).openapi(s.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:or}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.connections.remove(e,n))throw new P(404,{message:"Connection not found"});return t.text("OK")}).openapi(s.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(la.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:or}},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 P(404,{message:"Connection not found"});const o=await t.env.data.connections.get(e,n);if(!o)throw new P(404,{message:"Connection not found"});return t.json(o)}).openapi(s.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(la.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:or}},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})}),R4=new s.OpenAPIHono().openapi(s.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Us}},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(Us.parse({}))}).openapi(s.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Us.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 Ih=!1;function Jp(t){t.use(async(e,n)=>(Ih||(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"}}}}),Ih=!0),await n()))}s.z.object({alg:s.z.literal("RS256"),kty:s.z.literal("RSA"),use:s.z.literal("sig"),n:s.z.string(),e:s.z.string(),kid:s.z.string(),x5t:s.z.string(),x5c:s.z.array(s.z.string())});async function P4(t){try{const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new P(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function B4(t,e){const r=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),i=new Uint8Array(Array.from(e.signature).map(u=>u.charCodeAt(0))),c=(await P4(t.env)).find(u=>u.kid===e.header.kid);if(!c)return console.log("No matching kid found"),!1;const l=await crypto.subtle.importKey("jwk",c,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",l,i,r)}function j4(t){const[e,n,r]=t.split(".");if(!e||!n||!r)return null;const i=JSON.parse(atob(e)),o=JSON.parse(atob(n)),c=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return{header:i,payload:o,signature:c,raw:{header:e,payload:n,signature:r}}}function Yp(t){return async(e,n)=>{var i,o,c;const r=t.openAPIRegistry.definitions.find(l=>"route"in l&&l.route.path===e.req.path&&l.route.method.toUpperCase()===e.req.method);if(r&&"route"in r){const l=(o=(i=r.route.security)==null?void 0:i[0])==null?void 0:o.Bearer;if(!(l!=null&&l.length))return await n();const u=e.req.header("authorization")||"",[d,f]=u.split(" ");if((d==null?void 0:d.toLowerCase())!=="bearer"||!f)throw new P(401,{message:"Missing bearer token"});const h=j4(f);if(!h||!await B4(e,h))throw new P(403,{message:"Invalid JWT signature"});e.set("user_id",h.payload.sub),e.set("user",h.payload);const _=h.payload.permissions||[],$=((c=h.payload.scope)==null?void 0:c.split(" "))||[];if(l.length&&!(l.some(m=>_.includes(m))||l.some(m=>$.includes(m))))throw new P(403,{message:"Unauthorized"})}return await n()}}const L4=new s.OpenAPIHono().openapi(s.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ms}},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 P(404,{message:"Email provider not found"});return t.json(n)}).openapi(s.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Ms.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.create(e,n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Ms.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")}),F4=new s.OpenAPIHono().openapi(s.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:dc}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.remove(e,n))throw new P(404,{message:"Session not found"});return t.text("OK")}).openapi(s.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.update(e,n,{revoked_at:new Date().toDateString()}))throw new P(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),U4=new s.OpenAPIHono().openapi(s.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Zd}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.refreshTokens.remove(e,n))throw new P(404,{message:"Session not found"});return t.text("OK")}),M4=new s.OpenAPIHono().openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(ir)}},description:"List of custom domains"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.customDomains.list(e);return t.json(n)}).openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ir}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.customDomains.remove(e,n))throw new P(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(s.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ir.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ir}},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 P(404);const o=await t.env.data.customDomains.get(e,n);if(!o)throw new P(404);return t.json(o)}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(Xd.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:ir}},description:"The created custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.customDomains.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ir}},description:"The custom domain"}}}),async()=>{throw new P(501,{message:"Not implemented"})});function cl(t,e){const n={};for(const[r,i]of Object.entries(e)){const o={};for(const[c,l]of Object.entries(i))typeof l=="function"?o[c]=async(...u)=>{const d=performance.now();try{const f=await l(...u),_=performance.now()-d,$=t.res.headers.get("Server-Timing")||"",m=$?`${$}, ${r}-${c};dur=${_.toFixed(2)}`:`${r}-${c};dur=${_.toFixed(2)}`;return t.res.headers.set("Server-Timing",m),f}catch(f){const _=performance.now()-d,$=t.res.headers.get("Server-Timing")||"",m=$?`${$}, ${r}-${c}-error;dur=${_.toFixed(2)}`:`${r}-${c}-error;dur=${_.toFixed(2)}`;throw t.res.headers.set("Server-Timing",m),f}}:o[c]=l;n[r]=o}return n}async function ll(t,e){const n=t.req.header("x-forwarded-host");if(n){const i=await t.env.data.customDomains.getByDomain(n);if(i)return t.set("tenant_id",i.tenant_id),t.set("custom_domain",n),await e()}const r=t.req.header("host");if(r){const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const o=i[0];await t.env.data.tenants.get(o)&&t.set("tenant_id",o)}}return await e()}const q4=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()});function V4(t){if(t)try{let e=t;try{e=atob(t)}catch{}try{const n=JSON.parse(e);return q4.parse(n)}catch{}}catch{return}}const ul=async(t,e)=>{var l,u,d,f;const n=(l=t.req.query("auth0Client"))==null?void 0:l.slice(0,255),r=(u=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),o=(f=t.req.header("cf-ipcountry"))==null?void 0:f.slice(0,2),c=n?V4(n):void 0;c&&t.set("auth0_client",c),r&&t.set("ip",r),i&&t.set("useragent",i),o&&t.set("countryCode",o),await e()},Tr=class Tr{constructor(){xe(this,"cacheStore",new Map)}static getInstance(){return Tr.instance||(Tr.instance=new Tr),Tr.instance}set(e,n,r){if(r<=0)return;const i=Date.now()+r;this.cacheStore.set(e,{value:n,expiresAt:i})}get(e){const n=this.cacheStore.get(e);if(n){if(Date.now()>n.expiresAt){this.cacheStore.delete(e);return}return n.value}}delete(e){this.cacheStore.delete(e)}getKeysByPrefix(e){return Array.from(this.cacheStore.keys()).filter(n=>n.startsWith(e))}clear(){this.cacheStore.clear()}};xe(Tr,"instance");let Cd=Tr;function H4(t,e,n){try{return`${t}:${e}:${JSON.stringify(n)}`}catch{return`${t}:${e}:${Date.now()}-${Math.random()}`}}function dl(t,e){const n=e.cache||Cd.getInstance(),r=e.defaultTtl,i=e.customTtls||{},o=new Set(e.excludeMethods||[]),c=e.maxItems||0,l=e.cacheEntities||[],u=l.length===0,d=new Set(l),f={};for(const[h,_]of Object.entries(t)){const $=u||d.has(h),m={};for(const[x,S]of Object.entries(_))if(typeof S=="function"){if(!$){m[x]=S;continue}const k=`${h}:${x}`;if(o.has(k)){m[x]=S;continue}const v=i[k]||r,O=["create","update","remove","delete","set","used"].includes(x);m[x]=async(...q)=>{if(O){const J=await Promise.resolve(n.getKeysByPrefix(`${h}:`));for(const ue of J)await Promise.resolve(n.delete(ue));return await S.apply(_,q)}const F=H4(h,x,q),H=await Promise.resolve(n.get(F));if(H!==void 0)return H;const W=await S.apply(_,q);if(await n.set(F,W,v),c>0){const J=await Promise.resolve(n.getKeysByPrefix(""));if(J.length>c){const ue=J.slice(0,J.length-c);for(const Ne of ue)await Promise.resolve(n.delete(Ne))}}return W}}else m[x]=S;f[h]=m}return f}const K4=Kn.extend({forms:s.z.array(_i)}),G4=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Bn,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(_i),K4])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:c}=t.req.valid("query"),l=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:ti(o),q:c});return i?t.json(l):t.json(l.forms)}).openapi(s.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:_i}},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 P(404);return t.json(r)}).openapi(s.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.forms.remove(e,n))throw new P(404,{message:"Form not found"});return t.text("OK")}).openapi(s.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(da.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:_i}},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 P(404,{message:"Form not found"});const o=await t.env.data.forms.get(e,n);if(!o)throw new P(404,{message:"Form not found"});return t.json(o)}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(da.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:_i}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.forms.create(e,n);return t.json(r,{status:201})});function W4(t){const e=new s.OpenAPIHono;e.use(Zg({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})),Jp(e),e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:0,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}),e.use(ul).use(ll).use(Yp(e));const n=e.route("/branding",yw).route("/custom-domains",M4).route("/email/providers",L4).route("/users",kb).route("/keys",$4).route("/users-by-email",A4).route("/clients",E4).route("/tenants",N4).route("/logs",I4).route("/hooks",O4).route("/connections",D4).route("/prompts",R4).route("/sessions",F4).route("/refresh_tokens",U4).route("/forms",G4);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 X4(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}function mr(t){var e;if(t)return`${t.name}/${t.version}${(e=t.env)!=null&&e.node?` (env: node/${t.env.node})`:""}`}var Th;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Th||(Th={}));var Oh;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Oh||(Oh={}));function J4(t){return V1(t,Y4,Bo.Include)}function q1(t){return V1(t,Z4,Bo.None)}function V1(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,c=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],c+=8;for(let l=0;l<4;l++)c>=6?(r+=e[o>>c-6&63],c-=6):c>0?(r+=e[o<<6-c&63],c=0):n===Bo.Include&&(r+="=")}return r}const Y4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Bo;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Bo||(Bo={}));var zh;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(zh||(zh={}));class Q4{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 Dh=new Q4;function mn(t,e){return(t<<32-e|t>>>e)>>>0}function ex(t){const e=new tx;return e.update(t),e.digest()}class tx{constructor(){xe(this,"blockSize",64);xe(this,"size",32);xe(this,"blocks",new Uint8Array(64));xe(this,"currentBlockSize",0);xe(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));xe(this,"l",0n);xe(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),Dh.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)Dh.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 f=(mn(this.w[d-2],17)^mn(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,h=(mn(this.w[d-15],7)^mn(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=f+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],o=this.H[4],c=this.H[5],l=this.H[6],u=this.H[7];for(let d=0;d<64;d++){const f=(mn(o,6)^mn(o,11)^mn(o,25))>>>0,h=(o&c^~o&l)>>>0,_=u+f+h+nx[d]+this.w[d]|0,$=(mn(e,2)^mn(e,13)^mn(e,22))>>>0,m=(e&n^e&r^n&r)>>>0,x=$+m|0;u=l,l=c,c=o,o=i+_|0,i=r,r=n,n=e,e=_+x|0}this.H[0]=e+this.H[0]|0,this.H[1]=n+this.H[1]|0,this.H[2]=r+this.H[2]|0,this.H[3]=i+this.H[3]|0,this.H[4]=o+this.H[4]|0,this.H[5]=c+this.H[5]|0,this.H[6]=l+this.H[6]|0,this.H[7]=u+this.H[7]|0}}const nx=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 rx{constructor(e){xe(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 ix(t){const e=ex(new TextEncoder().encode(t));return q1(e)}function ox(){const t=new Uint8Array(32);return crypto.getRandomValues(t),q1(t)}function vo(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 jl(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return J4(n)}async function Xa(t){let e;try{e=await fetch(t)}catch(n){throw new K1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new Ws(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);let r;try{r=H1(n)}catch{throw new ki(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new Ws(e.status)}if(typeof n!="object"||n===null)throw new ki(e.status,n);return new rx(n)}throw e.body!==null&&await e.body.cancel(),new Ws(e.status)}async function sx(t){let e;try{e=await fetch(t)}catch(n){throw new K1(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=H1(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 Ws(e.status)}function H1(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 ax(e,n,r,i)}class K1 extends Error{constructor(e){super("Failed to send request",{cause:e})}}class ax extends Error{constructor(n,r,i,o){super(`OAuth request error: ${n}`);xe(this,"code");xe(this,"description");xe(this,"uri");xe(this,"state");this.code=n,this.description=r,this.uri=i,this.state=o}}class Ws extends Error{constructor(n){super("Unexpected error response");xe(this,"status");this.status=n}}class ki extends Error{constructor(n,r){super("Unexpected error response body");xe(this,"status");xe(this,"data");this.status=n,this.data=r}}class Zp{constructor(e,n,r){xe(this,"clientId");xe(this,"clientPassword");xe(this,"redirectURI");this.clientId=e,this.clientPassword=n,this.redirectURI=r}createAuthorizationURL(e,n,r){const i=new URL(e);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&i.searchParams.set("redirect_uri",this.redirectURI),i.searchParams.set("state",n),r.length>0&&i.searchParams.set("scope",r.join(" ")),i}createAuthorizationURLWithPKCE(e,n,r,i,o){const c=new URL(e);if(c.searchParams.set("response_type","code"),c.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&c.searchParams.set("redirect_uri",this.redirectURI),c.searchParams.set("state",n),r===jo.S256){const l=ix(i);c.searchParams.set("code_challenge_method","S256"),c.searchParams.set("code_challenge",l)}else r===jo.Plain&&(c.searchParams.set("code_challenge_method","plain"),c.searchParams.set("code_challenge",i));return o.length>0&&c.searchParams.set("scope",o.join(" ")),c}async validateAuthorizationCode(e,n,r){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("code",n),this.redirectURI!==null&&i.set("redirect_uri",this.redirectURI),r!==null&&i.set("code_verifier",r),this.clientPassword===null&&i.set("client_id",this.clientId);const o=vo(e,i);if(this.clientPassword!==null){const l=jl(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await Xa(o)}async refreshAccessToken(e,n,r){const i=new URLSearchParams;i.set("grant_type","refresh_token"),i.set("refresh_token",n),this.clientPassword===null&&i.set("client_id",this.clientId),r.length>0&&i.set("scope",r.join(" "));const o=vo(e,i);if(this.clientPassword!==null){const l=jl(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await Xa(o)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=vo(e,r);if(this.clientPassword!==null){const o=jl(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${o}`)}await sx(i)}}var jo;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(jo||(jo={}));var Rh;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Rh||(Rh={}));var Ph;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Ph||(Ph={}));function bo(t){return cx(t,lx,Ja.None)}function cx(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,c=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],c+=8;for(let l=0;l<4;l++)c>=6?(r+=e[o>>c-6&63],c-=6):c>0?(r+=e[o<<6-c&63],c=0):n===Ja.Include&&(r+="=")}return r}const lx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Ja;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Ja||(Ja={}));var Bh;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Bh||(Bh={}));function ux(t,e,n){const r=bo(new TextEncoder().encode(t)),i=bo(new TextEncoder().encode(e)),o=bo(n);return r+"."+i+"."+o}function dx(t,e){const n=bo(new TextEncoder().encode(t)),r=bo(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const px="https://appleid.apple.com/auth/authorize",fx="https://appleid.apple.com/auth/token";class G1{constructor(e,n,r,i,o){xe(this,"clientId");xe(this,"teamId");xe(this,"keyId");xe(this,"pkcs8PrivateKey");xe(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=o}createAuthorizationURL(e,n){const r=new URL(px);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=vo(fx,n);return await Xa(i)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),n=Math.floor(Date.now()/1e3),r=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),i=JSON.stringify({iss:this.teamId,exp:n+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:n}),o=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,dx(r,i)));return ux(r,i,o)}}const hx="https://www.facebook.com/v16.0/dialog/oauth",gx="https://graph.facebook.com/v16.0/oauth/access_token";class W1{constructor(e,n,r){xe(this,"clientId");xe(this,"clientSecret");xe(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(hx);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=vo(gx,n);return await Xa(r)}}const mx="https://accounts.google.com/o/oauth2/v2/auth",jh="https://oauth2.googleapis.com/token",_x="https://oauth2.googleapis.com/revoke";let X1=class{constructor(e,n,r){xe(this,"client");this.client=new Zp(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(mx,e,jo.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(jh,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(jh,e,[])}async revokeToken(e){await this.client.revokeToken(_x,e)}};const pl=s.z.object({iss:s.z.string().url(),sub:s.z.string(),aud:s.z.string(),exp:s.z.number(),email:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),name:s.z.string().optional(),iat:s.z.number(),auth_time:s.z.number().optional(),nonce:s.z.string().optional(),acr:s.z.string().optional(),amr:s.z.array(s.z.string()).optional(),azp:s.z.string().optional(),at_hash:s.z.string().optional(),c_hash:s.z.string().optional()}).passthrough();pl.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function yx(t){return t.ISSUER}function jt(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function rt(t){return t.OAUTH_API_URL||t.ISSUER}function J1(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 wx(t,e){var u,d;const{options:n,keyArray:r}=J1(e),i=new G1(n.client_id,n.team_id,n.kid,r,`${rt(t.env)}callback`),o=He(),c=await i.createAuthorizationURL(o,((u=n.scope)==null?void 0:u.split(" "))||["name","email"]);return(((d=n.scope)==null?void 0:d.split(" "))||["name","email"]).some(f=>["email","name"].includes(f))&&c.searchParams.set("response_mode","form_post"),{redirectUrl:c.href,code:o}}async function vx(t,e,n){const{options:r,keyArray:i}=J1(e),c=await new G1(r.client_id,r.team_id,r.kid,i,`${rt(t.env)}callback`).validateAuthorizationCode(n),l=ep(c.idToken());if(!l)throw new Error("Invalid ID token");const u=pl.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 bx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:wx,validateAuthorizationCodeAndGetUser:vx},Symbol.toStringTag,{value:"Module"}));async function xx(t,e){var c;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new W1(n.client_id,n.client_secret,`${rt(t.env)}callback`),i=He();return{redirectUrl:r.createAuthorizationURL(i,((c=n.scope)==null?void 0:c.split(" "))||["email"]).href,code:i}}async function $x(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new W1(r.client_id,r.client_secret,`${rt(t.env)}callback`).validateAuthorizationCode(n),c=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${o.accessToken()}`}});if(!c.ok)throw new Error("Failed to fetch user info");const l=await c.json();return t.set("log",`Userinfo: ${JSON.stringify(l)}`),{sub:l.id,email:l.email,name:l.name}}const Ax=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:xx,validateAuthorizationCodeAndGetUser:$x},Symbol.toStringTag,{value:"Module"}));async function kx(t,e){var l;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=new X1(n.client_id,n.client_secret,`${rt(t.env)}callback`),i=He(),o=ox();return{redirectUrl:r.createAuthorizationURL(i,o,((l=n.scope)==null?void 0:l.split(" "))??["email","profile"]).href,code:i,codeVerifier:o}}async function Ex(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 c=await new X1(i.client_id,i.client_secret,`${rt(t.env)}callback`).validateAuthorizationCode(n,r),l=ep(c.idToken());if(!l)throw new Error("Invalid ID token");const u=pl.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 Sx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:kx,validateAuthorizationCodeAndGetUser:Ex},Symbol.toStringTag,{value:"Module"}));async function Nx(t,e){var c;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new Zp(n.client_id,n.client_secret,`${rt(t.env)}callback`),i=He(),o=r.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",i,((c=n.scope)==null?void 0:c.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return o.searchParams.set("response_type","code"),o.searchParams.set("response_mode","query"),{redirectUrl:o.href,code:i}}async function Cx(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new Zp(r.client_id,r.client_secret,`${rt(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),c=ep(o.idToken());if(!c)throw new Error("Invalid ID token");const l=pl.parse(c.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 ${o.accessToken()}`,"Merchant-Serial-Number":l.msn}});if(!u.ok)throw new P(400,{message:"Failed to get user from vipps"});return await u.json()}const Ix=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Nx,validateAuthorizationCodeAndGetUser:Cx},Symbol.toStringTag,{value:"Module"}));function Y1(t,e){const n=t.env.STRATEGIES||{},i={apple:bx,facebook:Ax,"google-oauth2":Sx,vipps:Ix,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function fs(t,e){const n=await t.data.clients.get(e);if(!n)throw new P(403,{message:"Client not found"});const r=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,i=await t.data.connections.list(n.tenant.id),o=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},c=i.connections.map(l=>{var f;const u=(f=o.connections)==null?void 0:f.find(h=>h.name===l.name);if(!(u!=null&&u.options))return l;const d=or.parse({...u||{},...l});return d.options=Wd.passthrough().parse({...u.options||{},...l.options}),d}).filter(l=>l);return{...n,web_origins:[...(r==null?void 0:r.web_origins)||[],...n.web_origins||[],`${jt(t)}login`],allowed_logout_urls:[...(r==null?void 0:r.allowed_logout_urls)||[],...n.allowed_logout_urls||[],t.ISSUER],callbacks:[...(r==null?void 0:r.callbacks)||[],...n.callbacks||[],`${jt(t)}info`],connections:c,tenant:{...(r==null?void 0:r.tenant)||{},...n.tenant}}}async function Lh(t,e,n,r){if(!r.state)throw new P(400,{message:"State not found"});const i=e.connections.find(u=>u.name===n);if(!i){t.set("client_id",e.id);const u=qe(t,{type:Fe.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,u),new P(403,{message:"Connection Not Found"})}let o=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!o){const u=t.get("ip"),d=t.get("useragent"),f=t.get("auth0_client");o=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:r,csrf_token:He(),ip:u,useragent:d,auth0Client:mr(f)})}const l=await Y1(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:o.id,code_id:l.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:l.codeVerifier,expires_at:new Date(Date.now()+Uw*1e3).toISOString()}),t.redirect(l.redirectUrl)}async function Fh(t,{code:e,state:n}){var m;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new P(403,{message:"State not found"});const o=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!o)throw new P(403,{message:"Session not found"});if(o.authorization_url){const x=new URL(o.authorization_url).hostname,S=t.var.custom_domain||t.req.header("host")||"";if(x!==S&&x){const k=new URL(`https://${x}/callback`);return k.searchParams.set("state",n),k.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:k.toString()}})}}const c=await fs(r,o.authParams.client_id);t.set("client_id",c.id),t.set("tenant_id",c.tenant.id);const l=c.connections.find(x=>x.id===i.connection_id);if(!l){const x=qe(t,{type:Fe.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(c.tenant.id,x),new P(403,{message:"Connection not found"})}if(t.set("connection",l.name),!o.authParams.redirect_uri){const x=qe(t,{type:Fe.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(c.tenant.id,x),new P(403,{message:"Redirect URI not defined"})}const d=await Y1(t,l.strategy).validateAuthorizationCodeAndGetUser(t,l,e,i.code_verifier),{sub:f,...h}=d;t.set("user_id",f);const _=((m=d.email)==null?void 0:m.toLocaleLowerCase())||`${l.name}.${f}@${new URL(t.env.ISSUER).hostname}`;t.set("username",_);const $=await _c(t,{client:c,username:_,provider:l.strategy,connection:l.name,userId:f,profileData:h,isSocial:!0,ip:t.req.header("x-real-ip")});return xr(t,{client:c,authParams:o.authParams,loginSession:o,user:$})}async function Uh(t,e,n,r,i,o){const c=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!c)throw new P(400,{message:"State not found"});const l=await t.env.data.loginSessions.get(t.var.tenant_id,c.login_id);if(!l)throw new P(400,{message:"Login not found"});const{redirect_uri:u}=l.authParams;if(!u)throw new P(400,{message:"Redirect uri not found"});const d=qe(t,{type:Fe.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});Pt(t,t.env.data.logs.create(t.var.tenant_id,d));const f=new URL(u);return X4(f,{error:n,error_description:r,error_reason:o,error_code:i,state:l.authParams.state}),t.redirect(`${jt(t.env)}login/identifier?state=${l.id}&error=${n}`)}const Tx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:c}=t.req.valid("query");if(r)return Uh(t,e,r,i,o,c);if(!n)throw new P(400,{message:"Code is required"});const l=await Fh(t,{code:n,state:e});if(!(l instanceof Response))throw new P(500,{message:"Internal server error"});return l}).openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:c}=t.req.valid("form");if(r)return Uh(t,e,r,i,o,c);if(!n)throw new P(400,{message:"Code is required"});const l=await Fh(t,{code:n,state:e});if(!(l instanceof Response))throw new P(500,{message:"Internal server error"});return l});function Z1(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return Ox(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function Ox(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 zx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),returnTo:s.z.string().optional()}),header:s.z.object({cookie:s.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async t=>{const{client_id:e,returnTo:n}=t.req.valid("query"),r=await t.env.data.clients.get(e);if(!r)return t.text("OK");const i=await t.env.data.clients.get("DEFAULT_CLIENT");t.set("client_id",e),t.set("tenant_id",r.tenant.id);const o=n||t.req.header("referer");if(!o)return t.text("OK");if(!Z1(o,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new P(400,{message:"Invalid redirect uri"});const c=t.req.header("cookie");if(c){const u=fa(r.tenant.id,c);if(u){const d=await t.env.data.sessions.get(r.tenant.id,u);if(d){const f=await t.env.data.users.get(r.tenant.id,d.user_id);f&&(t.set("user_id",f.user_id),t.set("connection",f.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(_=>t.env.data.refreshTokens.remove(r.tenant.id,_.id))),await t.env.data.sessions.update(r.tenant.id,u,{revoked_at:new Date().toISOString()})}}}const l=qe(t,{type:Fe.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":Kw(r.tenant.id,t.req.header("host")),location:o}})}),Mh=s.z.object({sub:s.z.string(),email:s.z.string().optional(),family_name:s.z.string().optional(),given_name:s.z.string().optional(),email_verified:s.z.boolean()}),Dx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:Mh}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new P(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 P(404,{message:"User not found"});return t.json(Mh.parse({...e,sub:e.user_id}))}),Rx=new s.OpenAPIHono().openapi(s.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:$m}},description:"List of tenants"}}}),async t=>{const e=await t.env.data.keys.list(),n=await Promise.all(e.map(async r=>{const o=await new al(r.cert).publicKey.export(),c=await crypto.subtle.exportKey("jwk",o);return Jd.parse({...c,kid:r.kid})}));return t.json({keys:n},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Cs}, stale-while-revalidate=${Cs*2}, stale-if-error=86400`}})}).openapi(s.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:iu}},description:"List of tenants"}}}),async t=>{const e=iu.parse({issuer:yx(t.env),authorization_endpoint:`${rt(t.env)}authorize`,token_endpoint:`${rt(t.env)}oauth/token`,device_authorization_endpoint:`${rt(t.env)}oauth/device/code`,userinfo_endpoint:`${rt(t.env)}userinfo`,mfa_challenge_endpoint:`${rt(t.env)}mfa/challenge`,jwks_uri:`${rt(t.env)}.well-known/jwks.json`,registration_endpoint:`${rt(t.env)}oidc/register`,revocation_endpoint:`${rt(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=${Cs}, stale-while-revalidate=${Cs*2}, stale-if-error=86400`}})});function Xs(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=s.z.object({grant_type:s.z.literal("client_credentials"),scope:s.z.string().optional(),client_secret:s.z.string(),client_id:s.z.string(),audience:s.z.string().optional()});async function Px(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new P(403,{message:"Invalid client credentials"});if(n.client_secret&&!Xs(n.client_secret,e.client_secret))throw new P(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience};return{client:n,authParams:r}}const Bx=s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string().optional(),client_secret:s.z.string().optional(),code_verifier:s.z.string().optional()}).refine(t=>"client_secret"in t&&!("code_verifier"in t)||!("client_secret"in t)&&"code_verifier"in t,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function jx(t,e){var l;const n=await t.env.data.clients.get(e.client_id);if(!n)throw new P(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 P(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new P(403,{message:"Code expired"});if(r.used_at)throw new P(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new P(403,{message:"Invalid login"});if("client_secret"in e){const u=await t.env.data.clients.get("DEFAULT_CLIENT");if(!Xs(n.client_secret,e.client_secret)&&!Xs(u==null?void 0:u.client_secret,e.client_secret))throw new P(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const u=await Bw(e.code_verifier,r.code_challenge_method);if(!Xs(u,r.code_challenge))throw new P(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new P(403,{message:"Invalid redirect uri"});const o=await t.env.data.users.get(n.tenant.id,r.user_id);if(!o)throw new P(403,{message:"User not found"});await t.env.data.codes.used(n.tenant.id,e.code);let c;return i.session_id&&((l=i.authParams.scope)!=null&&l.split(" ").includes("offline_access"))&&(c=await Jm(t,{user:o,client:n,session_id:i.session_id,scope:i.authParams.scope,audience:i.authParams.audience})),{user:o,client:n,loginSession:i,session_id:i.session_id,refresh_token:c==null?void 0:c.id,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:Pn.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}}}const Lx=s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),redirect_uri:s.z.string().optional(),refresh_token:s.z.string()});async function Fx(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new P(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 P(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new P(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 P(403,{message:"User not found"});const o=r.resource_servers[0];if(r.idle_expires_at){const c=new Date(Date.now()+2592e6);await t.env.data.refreshTokens.update(n.tenant.id,r.id,{idle_expires_at:c.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:o==null?void 0:o.audience,scope:o==null?void 0:o.scopes,response_mode:Pn.WEB_MESSAGE}}}const Ux={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 Mx(t,e){var n=Array.prototype.slice.call(e);return n.push(Ux),t.apply(this,n)}function qh(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var o=Number(n[i]),c=Number(r[i]);if(o>c)return 1;if(c>o)return-1;if(!isNaN(o)&&isNaN(c))return 1;if(isNaN(o)&&!isNaN(c))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 qx={}.constructor;function Ei(t){return t!=null&&t.constructor===qx}function Id(t){"@babel/helpers - typeof";return Id=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},Id(t)}function fl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vx(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 hl(t,e,n){return e&&Vx(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Hx="1.2.0",Kx="1.7.35",Vh=" ext. ",Gx=/^\d+$/,_t=function(){function t(e){fl(this,t),e_(e),this.metadata=e,t_.call(this,e)}return hl(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&&Gx.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new Hh(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new Hh(this.getNumberingPlanMetadata(r),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var r=this.countryCallingCodes()[n];if(r)return r.length===1&&r[0].length===3?void 0:r}},{key:"getCountryCodeForCallingCode",value:function(n){var r=this.getCountryCodesForCallingCode(n);if(r)return r[0]}},{key:"getNumberingPlanMetadata",value:function(n){var r=this.getCountryCodeForCallingCode(n);if(r)return this.getCountryMetadata(r);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(n){return this.numberingPlan.type(n)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}]),t}(),Hh=function(){function t(e,n){fl(this,t),this.globalMetadataObject=n,this.metadata=e,t_.call(this,n.metadata)}return hl(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 Wx(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()&&Kh(this.types(),n))return new Jx(Kh(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?Vh:this.metadata[13]||Vh}}]),t}(),Wx=function(){function t(e,n){fl(this,t),this._format=e,this.metadata=n}return hl(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()&&!Xx.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),Xx=/^\(?\$1\)?$/,Jx=function(){function t(e,n){fl(this,t),this.type=e,this.metadata=n}return hl(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 Kh(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 e_(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Ei(t)||!Ei(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(Ei(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+Yx(t)+": "+t,"."))}var Yx=function(e){return Id(e)};function Qp(t,e){if(e=new _t(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function Zx(t,e){return e.countries.hasOwnProperty(t)}function t_(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?qh(e,Hx)===-1?this.v2=!0:qh(e,Kx)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function ef(t,e){return Qx(t,void 0,e)}function Qx(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=t.length,c=i[0];return c===o?"IS_POSSIBLE":c>o?"TOO_SHORT":i[i.length-1]<o?"TOO_LONG":i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function e$(t,e,n){if(e===void 0&&(e={}),n=new _t(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 n_(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 n_(t,e){switch(ef(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function qn(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function t$(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=n$(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
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n$(t,e){if(t){if(typeof t=="string")return Gh(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 Gh(t,e)}}function Gh(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 r$=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function tf(t,e,n){if(e=e||{},!(!t.country&&!t.countryCallingCode)){n=new _t(n),n.selectNumberingPlan(t.country,t.countryCallingCode);var r=e.v2?t.nationalNumber:t.phone;if(qn(r,n.nationalNumberPattern())){if(Ll(r,"FIXED_LINE",n))return n.type("MOBILE")&&n.type("MOBILE").pattern()===""||!n.type("MOBILE")||Ll(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var i=t$(r$),o;!(o=i()).done;){var c=o.value;if(Ll(r,c,n))return c}}}}function Ll(t,e,n){return e=n.type(e),!e||!e.pattern()||e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0?!1:qn(t,e.pattern())}function i$(t,e,n){if(e=e||{},n=new _t(n),n.selectNumberingPlan(t.country,t.countryCallingCode),n.hasTypes())return tf(t,e,n.metadata)!==void 0;var r=e.v2?t.nationalNumber:t.phone;return qn(r,n.nationalNumberPattern())}function o$(t,e,n){var r=new _t(n),i=r.getCountryCodesForCallingCode(t);return i?i.filter(function(o){return s$(e,o,n)}):[]}function s$(t,e,n){var r=new _t(n);return r.selectNumberingPlan(e),r.numberingPlan.possibleLengths().indexOf(t.length)>=0}var nf=2,a$=17,c$=3,cn="0-90-9٠-٩۰-۹",l$="-‐-―−ー-",u$="//",d$="..",p$="  ­​⁠ ",f$="()()[]\\[\\]",h$="~⁓∼~",Ya="".concat(l$).concat(u$).concat(d$).concat(p$).concat(f$).concat(h$),rf="++",g$=new RegExp("(["+cn+"])");function m$(t,e,n,r){if(e){var i=new _t(r);i.selectNumberingPlan(e,n);var o=new RegExp(i.IDDPrefix());if(t.search(o)===0){t=t.slice(t.match(o)[0].length);var c=t.match(g$);if(!(c&&c[1]!=null&&c[1].length>0&&c[1]==="0"))return t}}}function _$(t,e){if(t&&e.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+e.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(t);if(r){var i,o,c=r.length-1,l=c>0&&r[c];if(e.nationalPrefixTransformRule()&&l)i=t.replace(n,e.nationalPrefixTransformRule()),c>1&&(o=r[1]);else{var u=r[0];i=t.slice(u.length),l&&(o=r[1])}var d;if(l){var f=t.indexOf(r[1]),h=t.slice(0,f);h===e.numberingPlan.nationalPrefix()&&(d=e.numberingPlan.nationalPrefix())}else d=r[0];return{nationalNumber:i,nationalPrefix:d,carrierCode:o}}}return{nationalNumber:t}}function Td(t,e){var n=_$(t,e),r=n.carrierCode,i=n.nationalNumber;if(i!==t){if(!y$(t,i,e))return{nationalNumber:t};if(e.possibleLengths()&&!w$(i,e))return{nationalNumber:t}}return{nationalNumber:i,carrierCode:r}}function y$(t,e,n){return!(qn(t,n.nationalNumberPattern())&&!qn(e,n.nationalNumberPattern()))}function w$(t,e){switch(ef(t,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function v$(t,e,n,r){var i=e?Qp(e,r):n;if(t.indexOf(i)===0){r=new _t(r),r.selectNumberingPlan(e,n);var o=t.slice(i.length),c=Td(o,r),l=c.nationalNumber,u=Td(t,r),d=u.nationalNumber;if(!qn(d,r.nationalNumberPattern())&&qn(l,r.nationalNumberPattern())||ef(d,r)==="TOO_LONG")return{countryCallingCode:i,number:o}}return{number:t}}function r_(t,e,n,r){if(!t)return{};var i;if(t[0]!=="+"){var o=m$(t,e,n,r);if(o&&o!==t)i=!0,t="+"+o;else{if(e||n){var c=v$(t,e,n,r),l=c.countryCallingCode,u=c.number;if(l)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:l,number:u}}return{number:t}}}if(t[1]==="0")return{};r=new _t(r);for(var d=2;d-1<=c$&&d<=t.length;){var f=t.slice(1,d);if(r.hasCallingCode(f))return r.selectNumberingPlan(f),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:f,number:t.slice(d)};d++}return{}}function b$(t){return t.replace(new RegExp("[".concat(Ya,"]+"),"g")," ").trim()}var x$=/(\$\d)/;function $$(t,e,n){var r=n.useInternationalFormat,i=n.withNationalPrefix,o=t.replace(new RegExp(e.pattern()),r?e.internationalFormat():i&&e.nationalPrefixFormattingRule()?e.format().replace(x$,e.nationalPrefixFormattingRule()):e.format());return r?b$(o):o}var A$=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function k$(t,e,n){var r=new _t(n);if(r.selectNumberingPlan(t,e),r.defaultIDDPrefix())return r.defaultIDDPrefix();if(A$.test(r.IDDPrefix()))return r.IDDPrefix()}var E$=";ext=",li=function(e){return"([".concat(cn,"]{1,").concat(e,"})")};function i_(t){var e="20",n="15",r="9",i="6",o="[  \\t,]*",c="[:\\..]?[  \\t,-]*",l="#?",u="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",d="(?:[xx##~~]|int|int)",f="[- ]+",h="[  \\t]*",_="(?:,{2}|;)",$=E$+li(e),m=o+u+c+li(e)+l,x=o+d+c+li(r)+l,S=f+li(i)+"#",k=h+_+c+li(n)+l,v=h+"(?:,)+"+c+li(r)+l;return $+"|"+m+"|"+x+"|"+S+"|"+k+"|"+v}var S$="["+cn+"]{"+nf+"}",N$="["+rf+"]{0,1}(?:["+Ya+"]*["+cn+"]){3,}["+Ya+cn+"]*",C$=new RegExp("^["+rf+"]{0,1}(?:["+Ya+"]*["+cn+"]){1,2}$","i"),I$=N$+"(?:"+i_()+")?",T$=new RegExp("^"+S$+"$|^"+I$+"$","i");function O$(t){return t.length>=nf&&T$.test(t)}function z$(t){return C$.test(t)}function D$(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 R$(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=P$(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
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P$(t,e){if(t){if(typeof t=="string")return Wh(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 Wh(t,e)}}function Wh(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 Xh(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 Jh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xh(Object(n),!0).forEach(function(r){B$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function B$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Yh={formatExtension:function(e,n,r){return"".concat(e).concat(r.ext()).concat(n)}};function j$(t,e,n,r){if(n?n=Jh(Jh({},Yh),n):n=Yh,r=new _t(r),t.country&&t.country!=="001"){if(!r.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));r.country(t.country)}else if(t.countryCallingCode)r.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var i=r.countryCallingCode(),o=n.v2?t.nationalNumber:t.phone,c;switch(e){case"NATIONAL":return o?(c=Za(o,t.carrierCode,"NATIONAL",r,n),Fl(c,t.ext,r,n.formatExtension)):"";case"INTERNATIONAL":return o?(c=Za(o,null,"INTERNATIONAL",r,n),c="+".concat(i," ").concat(c),Fl(c,t.ext,r,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(o);case"RFC3966":return D$({number:"+".concat(i).concat(o),ext:t.ext});case"IDD":if(!n.fromCountry)return;var l=F$(o,t.carrierCode,i,n.fromCountry,r);return Fl(l,t.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(e,'"'))}}function Za(t,e,n,r,i){var o=L$(r.formats(),t);return o?$$(t,o,{useInternationalFormat:n==="INTERNATIONAL",withNationalPrefix:!(o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&i&&i.nationalPrefix===!1),carrierCode:e,metadata:r}):t}function L$(t,e){for(var n=R$(t),r;!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var o=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(e.search(o)!==0)continue}if(qn(e,i.pattern()))return i}}function Fl(t,e,n,r){return e?r(t,e,n):t}function F$(t,e,n,r,i){var o=Qp(r,i.metadata);if(o===n){var c=Za(t,e,"NATIONAL",i);return n==="1"?n+" "+c:c}var l=k$(r,void 0,i.metadata);if(l)return"".concat(l," ").concat(n," ").concat(Za(t,null,"INTERNATIONAL",i))}function Zh(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 Qh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zh(Object(n),!0).forEach(function(r){U$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function M$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function q$(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 V$(t,e,n){return e&&q$(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var H$=function(){function t(e,n,r){if(M$(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(Ei(n)&&Ei(n.countries)){r=n;var i=e;if(!W$.test(i))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var o=r_(i,void 0,void 0,r),c=o.countryCallingCode,l=o.number;if(n=l,e=c,!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");e_(r);var u=G$(e,r),d=u.country,f=u.countryCallingCode;this.country=d,this.countryCallingCode=f,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return V$(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:o$(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return e$(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return i$(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new _t(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 tf(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,r){return j$(this,n,r?Qh(Qh({},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}(),K$=function(e){return/^[A-Z]{2}$/.test(e)};function G$(t,e){var n,r,i=new _t(e);return K$(t)?(n=t,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=t,{country:n,countryCallingCode:r}}var W$=/^\+\d+$/;function Od(t){"@babel/helpers - typeof";return Od=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},Od(t)}function X$(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}function J$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y$(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&&Lo(t,e)}function Z$(t){var e=s_();return function(){var r=Fo(t),i;if(e){var o=Fo(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return Q$(this,i)}}function Q$(t,e){if(e&&(Od(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return o_(t)}function o_(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zd(t){var e=typeof Map=="function"?new Map:void 0;return zd=function(r){if(r===null||!e5(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 Js(r,arguments,Fo(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Lo(i,r)},zd(t)}function Js(t,e,n){return s_()?Js=Reflect.construct:Js=function(i,o,c){var l=[null];l.push.apply(l,o);var u=Function.bind.apply(i,l),d=new u;return c&&Lo(d,c.prototype),d},Js.apply(null,arguments)}function s_(){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 e5(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Lo(t,e){return Lo=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Lo(t,e)}function Fo(t){return Fo=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Fo(t)}var Cn=function(t){Y$(n,t);var e=Z$(n);function n(r){var i;return J$(this,n),i=e.call(this,r),Object.setPrototypeOf(o_(i),n.prototype),i.name=i.constructor.name,i}return X$(n)}(zd(Error)),eg=new RegExp("(?:"+i_()+")$","i");function t5(t){var e=t.search(eg);if(e<0)return{};for(var n=t.slice(0,e),r=t.match(eg),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}var n5={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 r5(t){return n5[t]}function i5(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=o5(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 o5(t,e){if(t){if(typeof t=="string")return tg(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 tg(t,e)}}function tg(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 ng(t){for(var e="",n=i5(t.split("")),r;!(r=n()).done;){var i=r.value;e+=s5(i,e)||""}return e}function s5(t,e,n){return t==="+"?e?void 0:"+":r5(t)}function a5(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=c5(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
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c5(t,e){if(t){if(typeof t=="string")return rg(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 rg(t,e)}}function rg(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 l5(t,e){var n=e.countries,r=e.metadata;r=new _t(r);for(var i=a5(n),o;!(o=i()).done;){var c=o.value;if(r.country(c),r.leadingDigits()){if(t&&t.search(r.leadingDigits())===0)return c}else if(tf({phone:t,country:c},void 0,r.metadata))return c}}function u5(t,e){var n=e.nationalNumber,r=e.defaultCountry,i=e.metadata,o=i.getCountryCodesForCallingCode(t);if(o)return o.length===1?o[0]:l5(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var s_="+",d5="[\\-\\.\\(\\)]?",ig="(["+cn+"]|"+d5+")",p5="^\\"+s_+ig+"*["+cn+"]"+ig+"*$",f5=new RegExp(p5,"g"),Dd=cn,h5="["+Dd+"]+((\\-)*["+Dd+"])*",g5="a-zA-Z",m5="["+g5+"]+((\\-)*["+Dd+"])*",_5="^("+h5+"\\.)*"+m5+"\\.?$",y5=new RegExp(_5,"g"),og="tel:",Rd=";phone-context=",w5=";isub=";function v5(t){var e=t.indexOf(Rd);if(e<0)return null;var n=e+Rd.length;if(n>=t.length)return"";var r=t.indexOf(";",n);return r>=0?t.substring(n,r):t.substring(n)}function b5(t){return t===null?!0:t.length===0?!1:f5.test(t)||y5.test(t)}function x5(t,e){var n=e.extractFormattedPhoneNumber,r=v5(t);if(!b5(r))throw new Cn("NOT_A_NUMBER");var i;if(r===null)i=n(t)||"";else{i="",r.charAt(0)===s_&&(i+=r);var o=t.indexOf(og),c;o>=0?c=o+og.length:c=0;var l=t.indexOf(Rd);i+=t.substring(c,l)}var u=i.indexOf(w5);if(u>0&&(i=i.substring(0,u)),i!=="")return i}var $5=250,A5=new RegExp("["+rf+cn+"]"),k5=new RegExp("[^"+cn+"#]+$");function E5(t,e,n){if(e=e||{},n=new _t(n),e.defaultCountry&&!n.hasCountry(e.defaultCountry))throw e.v2?new Cn("INVALID_COUNTRY"):new Error("Unknown country: ".concat(e.defaultCountry));var r=N5(t,e.v2,e.extract),i=r.number,o=r.ext,c=r.error;if(!i){if(e.v2)throw c==="TOO_SHORT"?new Cn("TOO_SHORT"):new Cn("NOT_A_NUMBER");return{}}var l=I5(i,e.defaultCountry,e.defaultCallingCode,n),u=l.country,d=l.nationalNumber,f=l.countryCallingCode,h=l.countryCallingCodeSource,_=l.carrierCode;if(!n.hasSelectedNumberingPlan()){if(e.v2)throw new Cn("INVALID_COUNTRY");return{}}if(!d||d.length<nf){if(e.v2)throw new Cn("TOO_SHORT");return{}}if(d.length>a$){if(e.v2)throw new Cn("TOO_LONG");return{}}if(e.v2){var $=new H$(f,d,n.metadata);return u&&($.country=u),_&&($.carrierCode=_),o&&($.ext=o),$.__countryCallingCodeSource=h,$}var m=(e.extended?n.hasSelectedNumberingPlan():u)?qn(d,n.nationalNumberPattern()):!1;return e.extended?{country:u,countryCallingCode:f,carrierCode:_,valid:m,possible:m?!0:!!(e.extended===!0&&n.possibleLengths()&&t_(d,n)),phone:d,ext:o}:m?C5(u,d,o):{}}function S5(t,e,n){if(t){if(t.length>$5){if(n)throw new Cn("TOO_LONG");return}if(e===!1)return t;var r=t.search(A5);if(!(r<0))return t.slice(r).replace(k5,"")}}function N5(t,e,n){var r=x5(t,{extractFormattedPhoneNumber:function(c){return S5(c,n,e)}});if(!r)return{};if(!O$(r))return z$(r)?{error:"TOO_SHORT"}:{};var i=t5(r);return i.ext?i:{number:r}}function C5(t,e,n){var r={country:t,phone:e};return n&&(r.ext=n),r}function I5(t,e,n,r){var i=n_(ng(t),e,n,r.metadata),o=i.countryCallingCodeSource,c=i.countryCallingCode,l=i.number,u;if(c)r.selectNumberingPlan(c);else if(l&&(e||n))r.selectNumberingPlan(e,n),e&&(u=e),c=n||Qp(e,r.metadata);else return{};if(!l)return{countryCallingCodeSource:o,countryCallingCode:c};var d=Td(ng(l),r),f=d.nationalNumber,h=d.carrierCode,_=u5(c,{nationalNumber:f,defaultCountry:e,metadata:r});return _&&(u=_,_==="001"||r.country(u)),{country:u,countryCallingCode:c,countryCallingCodeSource:o,nationalNumber:f,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 ag(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){T5(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 T5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O5(t,e,n){return E5(t,ag(ag({},e),{},{v2:!0}),n)}function cg(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 z5(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cg(Object(n),!0).forEach(function(r){D5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function D5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R5(t,e){return L5(t)||j5(t,e)||B5(t,e)||P5()}function P5(){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 B5(t,e){if(t){if(typeof t=="string")return lg(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 lg(t,e)}}function lg(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 j5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,c,l;try{for(n=n.call(t);!(i=(c=n.next()).done)&&(r.push(c.value),!(e&&r.length===e));i=!0);}catch(u){o=!0,l=u}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw l}}return r}}function L5(t){if(Array.isArray(t))return t}function F5(t){var e=Array.prototype.slice.call(t),n=R5(e,4),r=n[0],i=n[1],o=n[2],c=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")c?(u=o,d=c):(u=void 0,d=o),i&&(u=z5({defaultCountry:i},u));else if(Ei(i))o?(u=i,d=o):d=i;else throw new Error("Invalid second argument: ".concat(i));return{text:l,options:u,metadata:d}}function ug(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 dg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ug(Object(n),!0).forEach(function(r){U5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ug(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function M5(t,e,n){e&&e.defaultCountry&&!Zx(e.defaultCountry,n)&&(e=dg(dg({},e),{},{defaultCountry:void 0}));try{return O5(t,e,n)}catch(r){if(!(r instanceof Cn))throw r}}function q5(){var t=F5(arguments),e=t.text,n=t.options,r=t.metadata;return M5(e,n,r)}function V5(){return Mx(q5,arguments)}function gl(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=V5(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 of(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 H5(t){const n=of(t).split(".");return n.length!==4?!1:n.every(r=>/^\d+$/.test(r)&&Number(r)>=0&&Number(r)<=255)}function K5(t){const e=of(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 G5(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 o=e.slice(0,i),c=e.slice(i+1);/^[0-9.]+$/.test(o)&&/^\d+$/.test(c)&&(e=o)}return e}function pg(t){if(!t)return null;const e=of(G5(t));return H5(e)?{family:4,normalized:e}:K5(e)?{family:6,normalized:e.toLowerCase()}:null}function fg(t){if(t.includes("::")){let[e,n]=t.split("::"),r=e?e.split(":").filter(Boolean):[],i=n?n.split(":").filter(Boolean):[],o=8-(r.length+i.length);return[...r.map(c=>c.toLowerCase()||"0"),...Array(o).fill("0"),...i.map(c=>c.toLowerCase()||"0")]}else return t.split(":").map(e=>e.toLowerCase()||"0")}function W5(t,e,n=!0){const r=pg(t),i=pg(e);if(!r||!i||r.family!==i.family)return!1;if(r.family===4)return r.normalized===i.normalized;const o=fg(r.normalized),c=fg(i.normalized);return n?o.length===8&&c.length===8&&o.join(":")===c.join(":"):o.slice(0,4).join(":")===c.slice(0,4).join(":")}class hs extends Error{constructor(n,r=302){super(`Redirect to ${n}`);xe(this,"location");xe(this,"status");this.name=hs.name,this.location=n,this.status=r}}const X5=s.z.object({client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),otp:s.z.string(),authParams:$o.optional(),enforceIpCheck:s.z.boolean().optional().default(!1)});async function a_(t,{client_id:e,username:n,otp:r,authParams:i,enforceIpCheck:o=!1}){var x;const c=t.get("ip"),l=t.get("countryCode"),{connectionType:u,normalized:d}=gl(n,l);if(!d)throw new P(400,{message:"Invalid username format"});const f=await t.env.data.clients.get(e);if(!f)throw new P(403,{message:"Client not found"});const{env:h}=t,_=await h.data.codes.get(f.tenant.id,r,"otp");if(!_)throw new P(400,{message:$e("code_invalid")});if(_.expires_at<new Date().toISOString())throw new P(400,{message:$e("code_expired")});if(_.used_at)throw new P(400,{message:$e("code_used")});const $=await h.data.loginSessions.get(f.tenant.id,_.login_id);if(!$||$.authParams.username!==n)throw new P(400,{message:"Code not found or expired"});if(o&&$.ip&&c&&!W5($.ip,c))throw new hs(`${jt(t.env)}invalid-session?state=${$.id}`);const m=await _c(t,{client:f,username:d,provider:u,connection:u,isSocial:!1,ip:t.req.header("x-real-ip")});return await h.data.codes.used(f.tenant.id,r),((x=m.app_metadata)==null?void 0:x.strategy)!=="email"&&Pt(t,t.env.data.users.update(f.tenant.id,m.user_id,{app_metadata:{...m.app_metadata||{},strategy:"email"}})),{user:m,client:f,loginSession:$,session_id:$.session_id,authParams:{...$.authParams,...i||{}}}}async function sf(t,e){const n=await a_(t,e);return xr(t,{authParams:n.authParams,client:n.client,user:n.user,loginSession:n.loginSession})}const hg=s.z.object({client_id:s.z.string().optional(),client_secret:s.z.string().optional()}),J5=s.z.union([Z1.extend(hg.shape),s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string(),code_verifier:s.z.string().min(43).max(128)}),s.z.object({grant_type:s.z.literal("authorization_code"),code:s.z.string(),redirect_uri:s.z.string().optional(),...hg.shape}),s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),refresh_token:s.z.string(),redirect_uri:s.z.string().optional()}),s.z.object({grant_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:s.z.string(),username:s.z.string(),otp:s.z.string(),realm:s.z.enum(["email","sms"])})]);function Y5(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 Z5=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:J5}}}},responses:{200:{content:{"application/json":{schema:Yd}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=Y5(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new P(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case wi.AuthorizationCode:i=await jx(t,Bx.parse(r));break;case wi.ClientCredential:i=await Px(t,Z1.parse(r));break;case wi.RefreshToken:i=await Fx(t,Lx.parse(r));break;case wi.OTP:i=await a_(t,X5.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}const o=new Headers;if(i.session_id){const l=ha(i.client.tenant.id,i.session_id,t.var.custom_domain||t.req.header("host")||"");o.set("Set-Cookie",l)}const c=await mc(t,i);return t.json(c,{headers:o})});var af={exports:{}};const cf=[{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}],c_=(t,e=cf,n="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";e[0].minDiversity=0,e[0].minLength=0;const i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];n&&i.push({regex:`[${n}]`,message:"symbol"});let o={};o.contains=i.filter(l=>new RegExp(`${l.regex}`).test(r)).map(l=>l.message),o.length=r.length;let c=e.filter(l=>o.contains.length>=l.minDiversity).filter(l=>o.length>=l.minLength).sort((l,u)=>u.id-l.id).map(l=>({id:l.id,value:l.value}));return Object.assign(o,c[0]),o};af.exports={passwordStrength:c_,defaultOptions:cf};var Q5=af.exports.passwordStrength=c_;af.exports.defaultOptions=cf;function lf(t){return Q5(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 gs(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 P(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new P(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function l_(t,e){var c,l;if(!t.var.client_id)throw new P(500,{message:"Client not found"});const n=await fs(t.env,t.var.client_id),r=n.connections.find(u=>u.strategy==="sms");if(!r)throw new P(500,{message:"SMS provider not found"});const i=((c=r.options)==null?void 0:c.provider)||"twilio",o=(l=t.env.smsProviders)==null?void 0:l[i];if(!o)throw new P(500,{message:"SMS provider not found"});await o({options:r.options,to:e.to,from:e.from,text:e.text,template:"auth-code",data:{code:e.code,tenantName:n.tenant.name,tenantId:n.tenant.id}})}async function u_(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new P(500,{message:"Tenant not found"});const o=`${jt(t.env)}reset-password?state=${r}&code=${n}`,c={vendorName:i.name,lng:i.language||"en"};await gs(t,{to:e,subject:$e("reset_password_title",c),html:`Click here to reset your password: ${jt(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:o,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:$e("password_reset_title",c),resetPasswordEmailClickToReset:$e("reset_password_email_click_to_reset",c),resetPasswordEmailReset:$e("reset_password_email_reset",c),supportInfo:$e("support_info",c),contactUs:$e("contact_us",c),copyright:$e("copyright",c),tenantName:i.name,tenantId:i.id}})}async function d_(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new P(500,{message:"Tenant not found"});const{connectionType:i}=gl(e),o=new URL(jt(t.env)),c={vendorName:r.name,vendorId:r.id,loginDomain:o.hostname,code:n,lng:r.language||"en"};i==="email"?await gs(t,{to:e,subject:$e("code_email_subject",c),html:`Click here to validate your email: ${jt(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",c),linkEmailClickToLogin:$e("link_email_click_to_login",c),linkEmailLogin:$e("link_email_login",c),linkEmailOrEnterCode:$e("link_email_or_enter_code",c),codeValid30Mins:$e("code_valid_30_minutes",c),supportInfo:$e("support_info",c),contactUs:$e("contact_us",c),copyright:$e("copyright",c)}}):i==="sms"&&await l_(t,{to:e,text:$e("sms_code_text",c),code:n,from:r.name});const l=qe(t,{type:Fe.CODE_LINK_SENT,description:e});Pt(t,t.env.data.logs.create(r.id,l))}async function uf(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new P(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new P(400,{message:"redirect_uri is required"});const{connectionType:o}=gl(e),c=new URL(rt(t.env));c.pathname="passwordless/verify_redirect",c.searchParams.set("verification_code",n),c.searchParams.set("connection",o),c.searchParams.set("client_id",r.client_id),c.searchParams.set("redirect_uri",r.redirect_uri),c.searchParams.set("email",e),r.response_type&&c.searchParams.set("response_type",r.response_type),r.scope&&c.searchParams.set("scope",r.scope),r.state&&c.searchParams.set("state",r.state),r.nonce&&c.searchParams.set("nonce",r.nonce),r.code_challenge&&c.searchParams.set("code_challenge",r.code_challenge),r.code_challenge_method&&c.searchParams.set("code_challenge_method",r.code_challenge_method),r.audience&&c.searchParams.set("audience",r.audience);const l={vendorName:i.name,code:n,lng:i.language||"en"};if(o==="email")await gs(t,{to:e,subject:$e("code_email_subject",l),html:`Click here to validate your email: ${jt(t.env)}validate-email`,template:"auth-link",data:{code:n,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:c.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(o==="sms")await l_(t,{to:e,text:`${$e("link_sms_login",l)}: ${c.toString()}`,code:n,from:i.name});else throw new P(400,{message:"Only email and SMS connections are supported for magic links"});const u=qe(t,{type:Fe.CODE_LINK_SENT,description:e});Pt(t,t.env.data.logs.create(i.id,u))}async function df(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new P(500,{message:"Tenant not found"});if(!e.email)throw new P(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await gs(t,{to:e.email,subject:$e("welcome_to_your_account",r),html:`Click here to validate your email: ${jt(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${jt(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 e8(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new P(500,{message:"Tenant not found"});const o={vendorName:i.name,lng:i.language||"en"},c=`${jt(t.env)}signup?state=${r}&code=${n}`;await gs(t,{to:e,subject:$e("register_password_account",o),html:`Click here to register: ${c}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:c,setPassword:$e("set_password",o),registerPasswordAccount:$e("register_password_account",o),clickToSignUpDescription:$e("click_to_sign_up_description",o),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:$e("welcome_to_your_account",o),verifyEmailVerify:$e("verify_email_verify",o),supportInfo:$e("support_info",o),contactUs:$e("contact_us",o),copyright:$e("copyright",o)}})}const t8=new s.OpenAPIHono().openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string()})}}}},responses:{200:{content:{"application/json":{schema:s.z.object({_id:s.z.string(),email:s.z.string().optional(),email_verified:s.z.boolean(),app_metadata:s.z.object({}),user_metadata:s.z.object({})})}},description:"Created user"}}}),async t=>{const{email:e,password:n,client_id:r}=t.req.valid("json"),i=await t.env.data.clients.get(r);if(!i)throw new P(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!lf(n))throw new P(400,{message:"Password does not meet the requirements"});if(await Ao({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new P(400,{message:"Invalid sign up"});const c=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${fc()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});t.set("user_id",c.user_id),t.set("username",c.email),t.set("connection",c.connection);const l=await Go.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:c.user_id,password:l,algorithm:"bcrypt"}),await df(t,c);const u=qe(t,{type:Fe.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,u),t.json({_id:c.user_id,email:c.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async t=>{const{email:e,client_id:n}=t.req.valid("json"),r=await t.env.data.clients.get(n);if(!r)throw new P(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await Hi({userAdapter:t.env.data.users,tenant_id:r.tenant.id,username:e,provider:"auth2"}))return t.html("If an account with that email exists, we've sent instructions to reset your password.");const o={client_id:n,username:e},c=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:o,csrf_token:He(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:mr(t.get("auth0_client"))});return await u_(t,e,c.id,c.authParams.state),t.html("If an account with that email exists, we've sent instructions to reset your password.")});function Yr(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const n8=new s.OpenAPIHono().openapi(s.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({connection:s.z.literal("email"),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),send:s.z.enum(["link","code"]),authParams:$o.omit({client_id:!0})}),s.z.object({client_id:s.z.string(),connection:s.z.literal("sms"),phone_number:s.z.string(),send:s.z.enum(["link","code"]),authParams:$o.omit({client_id:!0})})])}}}},responses:{200:{description:"Status"}}}),async t=>{const e=t.req.valid("json"),{env:n}=t,{client_id:r,send:i,authParams:o,connection:c}=e,l=await t.env.data.clients.get(r);if(!l)throw new P(400,{message:"Client not found"});t.set("client_id",l.id),t.set("tenant_id",l.tenant.id);const u=c==="email"?e.email:e.phone_number,d=t.get("ip"),f=t.get("useragent"),h=t.get("auth0_client"),_=mr(h),$=await n.data.loginSessions.create(l.tenant.id,{authParams:{...o,client_id:r,username:u},expires_at:new Date(Date.now()+qs).toISOString(),csrf_token:He(),ip:d,useragent:f,auth0Client:_}),m=await n.data.codes.create(l.tenant.id,{code_id:Yr(),code_type:"otp",login_id:$.id,expires_at:new Date(Date.now()+qs).toISOString(),redirect_uri:o.redirect_uri});return i==="link"?await uf(t,{to:u,code:m.code_id,authParams:{...o,client_id:r}}):await d_(t,{to:u,code:m.code_id}),t.html("OK")}).openapi(s.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:s.z.object({scope:s.z.string(),response_type:s.z.nativeEnum(xt),redirect_uri:s.z.string(),state:s.z.string(),nonce:s.z.string().optional(),verification_code:s.z.string(),connection:s.z.string(),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),audience:s.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:o,state:c,scope:l,audience:u,response_type:d,nonce:f}=t.req.valid("query"),h=await fs(e,n);t.set("client_id",h.id),t.set("tenant_id",h.tenant.id),t.set("connection","email");const _={client_id:n,redirect_uri:o,state:c,nonce:f,scope:l,audience:u,response_type:d};let $="Something went wrong. Please try again later.";try{const O=await sf(t,{client_id:n,username:r,otp:i,authParams:_,enforceIpCheck:!0});if(O instanceof Response)return O;if(O&&typeof O=="object"&&"access_token"in O)return t.json(O)}catch(O){const q=O;"message"in q&&typeof q.message=="string"&&($=q.message)}const m=t.get("ip"),x=t.get("useragent"),S=t.get("auth0_client"),k=mr(S),v=await e.data.loginSessions.create(h.tenant.id,{authParams:{..._,username:r},expires_at:new Date(Date.now()+qs).toISOString(),csrf_token:He(),ip:m,useragent:x,auth0Client:k});return t.redirect(`${jt(t.env)}invalid-session?state=${v.id}&error=${encodeURIComponent($)}`,302)});class gi extends P{constructor(n,r){super(n,r);xe(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function p_(t,e,n,r){var $;const{data:i}=t.env,{username:o}=n;if(t.set("username",o),!o)throw new P(400,{message:"Username is required"});const c=await Hi({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:o,provider:"auth2"});if(!c){const m=qe(t,{type:Fe.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Pt(t,i.logs.create(e.tenant.id,m)),new gi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const l=c.linked_to?await i.users.get(e.tenant.id,c.linked_to):c;if(!l)throw new gi(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",c.connection),t.set("user_id",l.user_id);const u=await i.passwords.get(e.tenant.id,c.user_id);if(!(u&&await Go.compare(n.password,u.password))){const m=qe(t,{type:Fe.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Pt(t,i.logs.create(e.tenant.id,m)),new gi(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(m=>m.type===Fe.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(m.date)>new Date(Date.now()-1e3*60*5)).length>=3){const m=qe(t,{type:Fe.FAILED_LOGIN,description:"Too many failed login attempts"});throw Pt(t,i.logs.create(e.tenant.id,m)),new gi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!c.email_verified&&e.email_validation==="enforced"){await df(t,c);const m=qe(t,{type:Fe.FAILED_LOGIN,description:"Email not verified"});throw await i.logs.create(e.tenant.id,m),new gi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}(($=l.app_metadata)==null?void 0:$.strategy)!=="Username-Password-Authentication"&&Pt(t,i.users.update(e.tenant.id,l.user_id,{app_metadata:{...l.app_metadata||{},strategy:"Username-Password-Authentication"}}));const _=qe(t,{type:Fe.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Pt(t,i.logs.create(e.tenant.id,_)),{client:e,authParams:n,user:l,loginSession:r}}async function f_(t,e,n,r,i){const o=await p_(t,e,n,r);return xr(t,{...o,ticketAuth:i})}async function r8(t,e,n,r){await _c(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=Yr(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;o;)i=Yr(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const c=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client"),d=mr(u),f=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+qw).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:He(),ip:c,useragent:l,auth0Client:d}),h=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:f.id,expires_at:new Date(Date.now()+Mw).toISOString()});await u_(t,n,h.code_id,r)}const i8=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:s.z.string(),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),realm:s.z.enum(["email"]),scope:s.z.string().optional()}),s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string(),realm:s.z.enum(["Username-Password-Authentication"]),scope:s.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async t=>{const e=t.req.valid("json"),{client_id:n,username:r}=e;t.set("username",r);const i=await t.env.data.clients.get(n);if(!i)throw new P(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const o=r.toLocaleLowerCase(),c=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client");let d;if("otp"in e)d=await sf(t,{client_id:n,username:o,otp:e.otp});else if("password"in e){const f=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:{client_id:n,username:o},csrf_token:He(),ip:c,useragent:l,auth0Client:mr(u)});d=await f_(t,i,{username:o,password:e.password,client_id:n},f,!0)}else throw new P(400,{message:"Code or password required"});if(!(d instanceof Response))throw new P(500,{message:"Unexpected response from loginWithPassword"});return d});function o8(t,e){var r,i,o;if(!t||e.length===0)return!1;const n=((r=Ul(t))==null?void 0:r.host)??null;if(!n)return!1;for(const c of e){let l;if(c.startsWith("http://")||c.startsWith("https://")?l=((i=Ul(c))==null?void 0:i.host)??null:l=((o=Ul("https://"+c))==null?void 0:o.host)??null,n===l)return!0}return!1}function Ul(t){try{return new URL(t)}catch{return null}}async function s8({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:o}){const c=new URL(t.req.url);t.var.custom_domain&&(c.hostname=t.var.custom_domain);const{ip:l,auth0_client:u,useragent:d}=t.var,f=mr(u),h=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:r,csrf_token:He(),authorization_url:c.toString(),ip:l,useragent:d,auth0Client:f});if(e&&o){const _=await t.env.data.users.get(n.tenant.id,e.user_id);if((_==null?void 0:_.email)===o)return xr(t,{client:n,loginSession:h,authParams:r,user:_,sessionId:e.id})}if(i==="email"&&o){const _=Yr();return await t.env.data.codes.create(n.tenant.id,{code_id:_,code_type:"otp",login_id:h.id,expires_at:new Date(Date.now()+Si*1e3).toISOString(),redirect_uri:r.redirect_uri}),await uf(t,{code:_,to:o,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 a8(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new P(403,{message:"Invalid realm"})}async function c8(t,e,n,r,i){var _;const{env:o}=t;t.set("connection",i);const c=await o.data.codes.get(e,n,"ticket");if(!c||c.used_at)throw new P(403,{message:"Ticket not found"});const l=await o.data.loginSessions.get(e,c.login_id);if(!l||!l.authParams.username)throw new P(403,{message:"Session not found"});const u=await o.data.clients.get(l.authParams.client_id);if(!u)throw new P(403,{message:"Client not found"});t.set("client_id",l.authParams.client_id),await o.data.codes.used(e,n);const d=a8(i);let f=await _c(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",f.email||f.phone_number),t.set("user_id",f.user_id);const h=await Jm(t,{user:f,client:u,loginSession:l});return xr(t,{authParams:{scope:(_=l.authParams)==null?void 0:_.scope,...r},loginSession:l,sessionId:h.id,user:f,client:u})}async function l8({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:o,code_challenge_method:c,code_challenge:l,audience:u,scope:d,response_type:f}){const{env:h}=t,_=new URL(r),$=`${_.protocol}//${_.host}`;async function m(H="Login required"){const W=qe(t,{type:Fe.FAILED_SILENT_AUTH,description:H});return await t.env.data.logs.create(e.tenant.id,W),t.html(lu($,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 m();t.set("user_id",n.user_id);const S=await h.data.users.get(e.tenant.id,n.user_id);if(!S)return console.error("User not found",n.user_id),m("User not found");t.set("username",S.email),t.set("connection",S.connection);const k={client:e,authParams:{client_id:e.id,audience:u,code_challenge_method:c,code_challenge:l,scope:d,state:i,nonce:o,response_type:f,redirect_uri:r},user:S,session_id:n.id},v=f===xt.CODE?await uu(t,{user:S,client:e,authParams:k.authParams,login_id:n.login_session_id}):await mc(t,k);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()+hc*1e3).toISOString():void 0});const O=qe(t,{type:Fe.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,O);const q=new Headers;q.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const F=ha(e.tenant.id,n.id,t.req.header("host"));return q.set("set-cookie",F),t.html(lu($,JSON.stringify({...v,state:i})),{headers:q})}const u8=["email","sms","Username-Password-Authentication"],d8=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),vendor_id:s.z.string().optional(),redirect_uri:s.z.string(),scope:s.z.string().optional(),state:s.z.string(),prompt:s.z.string().optional(),response_mode:s.z.nativeEnum(Pn).optional(),response_type:s.z.nativeEnum(xt).optional(),audience:s.z.string().optional(),connection:s.z.string().optional(),nonce:s.z.string().optional(),max_age:s.z.string().optional(),login_ticket:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(lc).optional(),code_challenge:s.z.string().optional(),realm:s.z.string().optional(),auth0Client:s.z.string().optional(),organization:s.z.string().optional(),login_hint:s.z.string().optional(),screen_hint:s.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:s.z.string().optional()})},responses:{200:{description:"Successful authorization response. This can be an HTML page (e.g., for silent authentication iframe or universal login page) or a JSON object containing tokens (e.g., for response_mode=web_message).",content:{"text/html":{schema:s.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:Yd}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:o,state:c,audience:l,nonce:u,connection:d,response_type:f,response_mode:h,code_challenge:_,code_challenge_method:$,prompt:m,login_ticket:x,realm:S,auth0Client:k,login_hint:v,ui_locales:O,organization:q}=t.req.valid("query");t.set("log","authorize");const F=await fs(e,n);t.set("client_id",F.id),t.set("tenant_id",F.tenant.id);const H={redirect_uri:i.split("#")[0],scope:o,state:c,client_id:n,vendor_id:r,audience:l,nonce:u,prompt:m,response_type:f,response_mode:h,code_challenge:_,code_challenge_method:$,username:v,ui_locales:O,organization:q},W=t.req.header("origin");if(W&&!o8(W,F.web_origins||[]))throw new P(403,{message:`Origin ${W} not allowed`});if(H.redirect_uri&&!Y1(H.redirect_uri,F.callbacks||[],{allowPathWildcards:!0}))throw new P(400,{message:`Invalid redirect URI - ${H.redirect_uri}`});const J=fa(F.tenant.id,t.req.header("cookie")),ue=J?await e.data.sessions.get(F.tenant.id,J):void 0,Ne=ue&&!ue.revoked_at?ue:void 0;if(m=="none"){if(!f)throw new P(400,{message:"Missing response_type"});return l8({ctx:t,session:Ne||void 0,redirect_uri:i,state:c,response_type:f,client:F,nonce:u,code_challenge_method:$,code_challenge:_,audience:l,scope:o})}if(F.connections.length===1&&F.connections[0]&&!u8.includes(F.connections[0].strategy||""))return Lh(t,F,F.connections[0].name,H);if(d&&d!=="email")return Lh(t,F,d,H);if(x){const L=await c8(t,F.tenant.id,x,H,S);return L instanceof Response?L:t.json(L)}const B=await s8({ctx:t,client:F,auth0Client:k,authParams:H,session:Ne||void 0,connection:d,login_hint:v});return B instanceof Response?B:t.json(B)});function p8(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}),e.use("/oauth/token",Zg({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(ul).use(ll).use(Yp(e));const n=e.route("/v2/logout",zx).route("/userinfo",Dx).route("/.well-known",Rx).route("/oauth/token",Z5).route("/dbconnections",t8).route("/passwordless",n8).route("/co/authenticate",i8).route("/authorize",d8).route("/callback",Tx);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),Jp(n),n}var f8={Stringify:1,BeforeStream:2,Stream:3},on=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},h8=/[&<>'"]/,h_=async(t,e)=>{let n="";e||(e=[]);const r=await Promise.all(t);for(let i=r.length-1;n+=r[i],i--,!(i<0);i--){let o=r[i];typeof o=="object"&&e.push(...o.callbacks||[]);const c=o.isEscaped;if(o=await(typeof o=="object"?o.toString():o),typeof o=="object"&&e.push(...o.callbacks||[]),o.isEscaped??c)n+=o;else{const l=[n];dr(o,l),n=l[0]}}return on(n,e)},dr=(t,e)=>{const n=t.search(h8);if(n===-1){e[0]+=t;return}let r,i,o=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r="&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(o,i)+r,o=i+1}e[0]+=t.substring(o,i)},g_=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:f8.Stringify,buffer:n,context:r})),n[0]},m_=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const o=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let c=0,l=o.length;c<l;c++){const u=o[c];if(typeof u=="string")dr(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):dr(u.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?on(g_(on(n[0],n.callbacks))):on(n[0]):h_(n,n.callbacks)},pf=Symbol("RENDERER"),Pd=Symbol("ERROR_HANDLER"),Qe=Symbol("STASH"),__=Symbol("INTERNAL"),g8=Symbol("MEMO"),Qa=Symbol("PERMALINK"),gg=t=>(t[__]=!0,t),y_=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:gg(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:gg(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[Pd]=o=>{throw t.pop(),o},i},w_=t=>{const e=[t],n=y_(e);return n.values=e,n.Provider=n,Li.push(n),n},Li=[],m8=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new $_("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(o=>on(o,o.callbacks)):on(i)};return n.values=e,n.Provider=n,n[pf]=y_(e),Li.push(n),n},no=t=>t.values.at(-1),Ys={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},Bd={},Zs="data-precedence",ms=t=>Array.isArray(t)?t:[t],mg=new WeakMap,_g=(t,e,n,r)=>({buffer:i,context:o})=>{if(!i)return;const c=mg.get(o)||{};mg.set(o,c);const l=c[t]||(c[t]=[]);let u=!1;const d=Ys[t];if(d.length>0){e:for(const[,f]of l)for(const h of d)if(((f==null?void 0:f[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 f;if(r===void 0)f=l.map(([h])=>h);else{const h=[];f=l.map(([_,,$])=>{let m=h.indexOf($);return m===-1&&(h.push($),m=h.length-1),[_,m]}).sort((_,$)=>_[1]-$[1]).map(([_])=>_)}f.forEach(h=>{i[0]=i[0].replaceAll(h,"")}),i[0]=i[0].replace(/(?=<\/head>)/,f.join(""))}},_s=(t,e,n)=>on(new sn(t,n,ms(e??[])).toString()),ys=(t,e,n,r)=>{if("itemProp"in n)return _s(t,e,n);let{precedence:i,blocking:o,...c}=n;i=r?i??"":void 0,r&&(c[Zs]=i);const l=new sn(t,c,ms(e||[])).toString();return l instanceof Promise?l.then(u=>on(l,[...u.callbacks||[],_g(t,u,c,i)])):on(l,[_g(t,l,c,i)])},_8=({children:t,...e})=>{const n=ff();if(n){const r=no(n);if(r==="svg"||r==="head")return new sn("title",e,ms(t??[]))}return ys("title",t,e,!1)},y8=({children:t,...e})=>{const n=ff();return["src","async"].some(r=>!e[r])||n&&no(n)==="head"?_s("script",t,e):ys("script",t,e,!1)},w8=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,ys("style",t,e,!0)):_s("style",t,e),v8=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?_s("link",t,e):ys("link",t,e,"precedence"in e),b8=({children:t,...e})=>{const n=ff();return n&&no(n)==="head"?_s("meta",t,e):ys("meta",t,e,!1)},v_=(t,{children:e,...n})=>new sn(t,n,ms(e??[])),x8=t=>(typeof t.action=="function"&&(t.action=Qa in t.action?t.action[Qa]:void 0),v_("form",t)),b_=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=Qa in e.formAction?e.formAction[Qa]:void 0),v_(t,e)),$8=t=>b_("input",t),A8=t=>b_("button",t);const Ml=Object.freeze(Object.defineProperty({__proto__:null,button:A8,form:x8,input:$8,link:v8,meta:b8,script:y8,style:w8,title:_8},Symbol.toStringTag,{value:"Module"}));var k8=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),ec=t=>k8.get(t)||t,x_=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e(i,r==null?null:typeof r=="number"?i.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`:r)}},Uo=void 0,ff=()=>Uo,E8=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,S8=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],N8=["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"],hf=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")dr(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof sn?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):hf(i,e)}}},sn=class{constructor(t,e,n){xe(this,"tag");xe(this,"props");xe(this,"key");xe(this,"children");xe(this,"isEscaped",!0);xe(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?g_(on(t[0],t.callbacks)).toString():t[0]:h_(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=Uo&&no(Uo)==="svg"?o=>E8(ec(o)):o=>ec(o);for(let[o,c]of Object.entries(n))if(o=i(o),o!=="children"){if(o==="style"&&typeof c=="object"){let l="";x_(c,(u,d)=>{d!=null&&(l+=`${l?";":""}${u}:${d}`)}),t[0]+=' style="',dr(l,t),t[0]+='"'}else if(typeof c=="string")t[0]+=` ${o}="`,dr(c,t),t[0]+='"';else if(c!=null)if(typeof c=="number"||c.isEscaped)t[0]+=` ${o}="${c}"`;else if(typeof c=="boolean"&&N8.includes(o))c&&(t[0]+=` ${o}=""`);else if(o==="dangerouslySetInnerHTML"){if(r.length>0)throw"Can only set one of `children` or `props.dangerouslySetInnerHTML`.";r=[on(c.__html)]}else if(c instanceof Promise)t[0]+=` ${o}="`,t.unshift('"',c);else if(typeof c=="function"){if(!o.startsWith("on"))throw`Invalid prop '${o}' of type 'function' supplied to '${e}'.`}else t[0]+=` ${o}="`,dr(c.toString(),t),t[0]+='"'}if(S8.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",hf(r,t),t[0]+=`</${e}>`}},ql=class extends sn{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(Li.length===0)t.unshift("",n);else{const r=Li.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof sn&&(i.localContexts=r),i)))}else n instanceof sn?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):dr(n,t)}},$_=class extends sn{toStringToBuffer(t){hf(this.children,t)}},C8=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=Qs(t,e,n);return i.key=r,i},yg=!1,Qs=(t,e,n)=>{if(!yg){for(const r in Bd)Ml[r][pf]=Bd[r];yg=!0}return typeof t=="function"?new ql(t,e,n):Ml[t]?new ql(Ml[t],e,n):t==="svg"||t==="head"?(Uo||(Uo=m8("")),new sn(t,e,[new ql(Uo,{value:t},n)])):new sn(t,e,n)},gf=({children:t})=>new $_("",{children:t},Array.isArray(t)?t:t?[t]:[]),I8=(t,e,...n)=>C8(t.tag,{...t.props,...e},...n);function A(t,e,n){let r;if(!e||!("children"in e))r=Qs(t,e,[]);else{const i=e.children;r=Array.isArray(i)?Qs(t,e,i):Qs(t,e,[i])}return r.key=n,r}const wg={name:"sesamy",logoUrl:"https://assets.sesamy.com/static/images/email/sesamy-logo.png",style:{primaryColor:"#7D68F4",buttonTextColor:"#FFFFFF",primaryHoverColor:"#A091F2"},loginBackgroundImage:"",checkoutHideSocial:!1,supportEmail:"support@sesamy.com",supportUrl:"https://support.sesamy.com",siteUrl:"https://sesamy.com",termsAndConditionsUrl:"https://store.sesamy.com/pages/terms-of-service",manageSubscriptionsUrl:"https://account.sesamy.com/manage-subscriptions"};async function A_(t,e,n){if(!n&&!e)return wg;const r=n||e;try{const i=await fetch(`${t.API_URL}/profile/vendors/${r}/style`);if(!i.ok)throw new Error("Failed to fetch vendor settings");const o=await i.json();return mm.parse(o)}catch(i){return console.error(i),wg}}async function Je(t,e,n=!1){var d;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new P(400,{message:"Login session not found"});t.set("loginSession",i);const o=await fs(r,i.authParams.client_id);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const c=await r.data.tenants.get(o.tenant.id);if(c){if(i.session_id&&!n){if(!i.authParams.redirect_uri)throw new P(400,{message:"Login session closed and no redirect URI available"});const f=new URL(i.authParams.redirect_uri);throw f.searchParams.set("error","access_denied"),f.searchParams.set("error_description","Login session closed"),i.authParams.state&&f.searchParams.set("state",i.authParams.state),new hs(f.toString(),302)}}else throw new P(400,{message:"Tenant not found"});const l=await A_(r,o.id,i.authParams.vendor_id),u=(d=i.authParams.ui_locales)==null?void 0:d.split(" ").map(f=>f.split("-")[0]).find(f=>{if(Array.isArray(U.options.supportedLngs))return U.options.supportedLngs.includes(f)});return await U.changeLanguage(u||c.language||"sv"),{vendorSettings:{...l,termsAndConditionsUrl:o.id==="fokus-app"?"https://www.fokus.se/kopvillkor-app/":l.termsAndConditionsUrl},client:o,tenant:c,loginSession:i}}async function T8(t,e,n,r){if(r!==void 0)return r==="password";const i=await ap({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 k_=({vendorSettings:t})=>t!=null&&t.logoUrl?A("div",{className:"flex h-9 items-center",children:A("img",{src:t.logoUrl,className:"max-h-full",alt:"Vendor logo"})}):A(gf,{}),E_=({vendorSettings:t})=>{const{termsAndConditionsUrl:e}=t;return A("div",{className:"mt-8",children:e&&A("div",{className:"text-xs text-gray-300",children:[U.t("agree_to")," ",A("a",{href:e,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:U.t("terms")})]})})};var S_={exports:{}};/*!
196
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c5(t,e){if(t){if(typeof t=="string")return rg(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 rg(t,e)}}function rg(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 l5(t,e){var n=e.countries,r=e.metadata;r=new _t(r);for(var i=a5(n),o;!(o=i()).done;){var c=o.value;if(r.country(c),r.leadingDigits()){if(t&&t.search(r.leadingDigits())===0)return c}else if(tf({phone:t,country:c},void 0,r.metadata))return c}}function u5(t,e){var n=e.nationalNumber,r=e.defaultCountry,i=e.metadata,o=i.getCountryCodesForCallingCode(t);if(o)return o.length===1?o[0]:l5(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var a_="+",d5="[\\-\\.\\(\\)]?",ig="(["+cn+"]|"+d5+")",p5="^\\"+a_+ig+"*["+cn+"]"+ig+"*$",f5=new RegExp(p5,"g"),Dd=cn,h5="["+Dd+"]+((\\-)*["+Dd+"])*",g5="a-zA-Z",m5="["+g5+"]+((\\-)*["+Dd+"])*",_5="^("+h5+"\\.)*"+m5+"\\.?$",y5=new RegExp(_5,"g"),og="tel:",Rd=";phone-context=",w5=";isub=";function v5(t){var e=t.indexOf(Rd);if(e<0)return null;var n=e+Rd.length;if(n>=t.length)return"";var r=t.indexOf(";",n);return r>=0?t.substring(n,r):t.substring(n)}function b5(t){return t===null?!0:t.length===0?!1:f5.test(t)||y5.test(t)}function x5(t,e){var n=e.extractFormattedPhoneNumber,r=v5(t);if(!b5(r))throw new Cn("NOT_A_NUMBER");var i;if(r===null)i=n(t)||"";else{i="",r.charAt(0)===a_&&(i+=r);var o=t.indexOf(og),c;o>=0?c=o+og.length:c=0;var l=t.indexOf(Rd);i+=t.substring(c,l)}var u=i.indexOf(w5);if(u>0&&(i=i.substring(0,u)),i!=="")return i}var $5=250,A5=new RegExp("["+rf+cn+"]"),k5=new RegExp("[^"+cn+"#]+$");function E5(t,e,n){if(e=e||{},n=new _t(n),e.defaultCountry&&!n.hasCountry(e.defaultCountry))throw e.v2?new Cn("INVALID_COUNTRY"):new Error("Unknown country: ".concat(e.defaultCountry));var r=N5(t,e.v2,e.extract),i=r.number,o=r.ext,c=r.error;if(!i){if(e.v2)throw c==="TOO_SHORT"?new Cn("TOO_SHORT"):new Cn("NOT_A_NUMBER");return{}}var l=I5(i,e.defaultCountry,e.defaultCallingCode,n),u=l.country,d=l.nationalNumber,f=l.countryCallingCode,h=l.countryCallingCodeSource,_=l.carrierCode;if(!n.hasSelectedNumberingPlan()){if(e.v2)throw new Cn("INVALID_COUNTRY");return{}}if(!d||d.length<nf){if(e.v2)throw new Cn("TOO_SHORT");return{}}if(d.length>a$){if(e.v2)throw new Cn("TOO_LONG");return{}}if(e.v2){var $=new H$(f,d,n.metadata);return u&&($.country=u),_&&($.carrierCode=_),o&&($.ext=o),$.__countryCallingCodeSource=h,$}var m=(e.extended?n.hasSelectedNumberingPlan():u)?qn(d,n.nationalNumberPattern()):!1;return e.extended?{country:u,countryCallingCode:f,carrierCode:_,valid:m,possible:m?!0:!!(e.extended===!0&&n.possibleLengths()&&n_(d,n)),phone:d,ext:o}:m?C5(u,d,o):{}}function S5(t,e,n){if(t){if(t.length>$5){if(n)throw new Cn("TOO_LONG");return}if(e===!1)return t;var r=t.search(A5);if(!(r<0))return t.slice(r).replace(k5,"")}}function N5(t,e,n){var r=x5(t,{extractFormattedPhoneNumber:function(c){return S5(c,n,e)}});if(!r)return{};if(!O$(r))return z$(r)?{error:"TOO_SHORT"}:{};var i=t5(r);return i.ext?i:{number:r}}function C5(t,e,n){var r={country:t,phone:e};return n&&(r.ext=n),r}function I5(t,e,n,r){var i=r_(ng(t),e,n,r.metadata),o=i.countryCallingCodeSource,c=i.countryCallingCode,l=i.number,u;if(c)r.selectNumberingPlan(c);else if(l&&(e||n))r.selectNumberingPlan(e,n),e&&(u=e),c=n||Qp(e,r.metadata);else return{};if(!l)return{countryCallingCodeSource:o,countryCallingCode:c};var d=Td(ng(l),r),f=d.nationalNumber,h=d.carrierCode,_=u5(c,{nationalNumber:f,defaultCountry:e,metadata:r});return _&&(u=_,_==="001"||r.country(u)),{country:u,countryCallingCode:c,countryCallingCodeSource:o,nationalNumber:f,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 ag(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){T5(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 T5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O5(t,e,n){return E5(t,ag(ag({},e),{},{v2:!0}),n)}function cg(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 z5(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cg(Object(n),!0).forEach(function(r){D5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function D5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R5(t,e){return L5(t)||j5(t,e)||B5(t,e)||P5()}function P5(){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 B5(t,e){if(t){if(typeof t=="string")return lg(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 lg(t,e)}}function lg(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 j5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,c,l;try{for(n=n.call(t);!(i=(c=n.next()).done)&&(r.push(c.value),!(e&&r.length===e));i=!0);}catch(u){o=!0,l=u}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw l}}return r}}function L5(t){if(Array.isArray(t))return t}function F5(t){var e=Array.prototype.slice.call(t),n=R5(e,4),r=n[0],i=n[1],o=n[2],c=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")c?(u=o,d=c):(u=void 0,d=o),i&&(u=z5({defaultCountry:i},u));else if(Ei(i))o?(u=i,d=o):d=i;else throw new Error("Invalid second argument: ".concat(i));return{text:l,options:u,metadata:d}}function ug(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 dg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ug(Object(n),!0).forEach(function(r){U5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ug(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function M5(t,e,n){e&&e.defaultCountry&&!Zx(e.defaultCountry,n)&&(e=dg(dg({},e),{},{defaultCountry:void 0}));try{return O5(t,e,n)}catch(r){if(!(r instanceof Cn))throw r}}function q5(){var t=F5(arguments),e=t.text,n=t.options,r=t.metadata;return M5(e,n,r)}function V5(){return Mx(q5,arguments)}function gl(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=V5(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 of(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 H5(t){const n=of(t).split(".");return n.length!==4?!1:n.every(r=>/^\d+$/.test(r)&&Number(r)>=0&&Number(r)<=255)}function K5(t){const e=of(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 G5(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 o=e.slice(0,i),c=e.slice(i+1);/^[0-9.]+$/.test(o)&&/^\d+$/.test(c)&&(e=o)}return e}function pg(t){if(!t)return null;const e=of(G5(t));return H5(e)?{family:4,normalized:e}:K5(e)?{family:6,normalized:e.toLowerCase()}:null}function fg(t){if(t.includes("::")){let[e,n]=t.split("::"),r=e?e.split(":").filter(Boolean):[],i=n?n.split(":").filter(Boolean):[],o=8-(r.length+i.length);return[...r.map(c=>c.toLowerCase()||"0"),...Array(o).fill("0"),...i.map(c=>c.toLowerCase()||"0")]}else return t.split(":").map(e=>e.toLowerCase()||"0")}function W5(t,e,n=!0){const r=pg(t),i=pg(e);if(!r||!i||r.family!==i.family)return!1;if(r.family===4)return r.normalized===i.normalized;const o=fg(r.normalized),c=fg(i.normalized);return n?o.length===8&&c.length===8&&o.join(":")===c.join(":"):o.slice(0,4).join(":")===c.slice(0,4).join(":")}class hs extends Error{constructor(n,r=302){super(`Redirect to ${n}`);xe(this,"location");xe(this,"status");this.name=hs.name,this.location=n,this.status=r}}const X5=s.z.object({client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),otp:s.z.string(),authParams:$o.optional(),enforceIpCheck:s.z.boolean().optional().default(!1)});async function c_(t,{client_id:e,username:n,otp:r,authParams:i,enforceIpCheck:o=!1}){var x;const c=t.get("ip"),l=t.get("countryCode"),{connectionType:u,normalized:d}=gl(n,l);if(!d)throw new P(400,{message:"Invalid username format"});const f=await t.env.data.clients.get(e);if(!f)throw new P(403,{message:"Client not found"});const{env:h}=t,_=await h.data.codes.get(f.tenant.id,r,"otp");if(!_)throw new P(400,{message:$e("code_invalid")});if(_.expires_at<new Date().toISOString())throw new P(400,{message:$e("code_expired")});if(_.used_at)throw new P(400,{message:$e("code_used")});const $=await h.data.loginSessions.get(f.tenant.id,_.login_id);if(!$||$.authParams.username!==n)throw new P(400,{message:"Code not found or expired"});if(o&&$.ip&&c&&!W5($.ip,c))throw new hs(`${jt(t.env)}invalid-session?state=${$.id}`);const m=await _c(t,{client:f,username:d,provider:u,connection:u,isSocial:!1,ip:t.req.header("x-real-ip")});return await h.data.codes.used(f.tenant.id,r),((x=m.app_metadata)==null?void 0:x.strategy)!=="email"&&Pt(t,t.env.data.users.update(f.tenant.id,m.user_id,{app_metadata:{...m.app_metadata||{},strategy:"email"}})),{user:m,client:f,loginSession:$,session_id:$.session_id,authParams:{...$.authParams,...i||{}}}}async function sf(t,e){const n=await c_(t,e);return xr(t,{authParams:n.authParams,client:n.client,user:n.user,loginSession:n.loginSession})}const hg=s.z.object({client_id:s.z.string().optional(),client_secret:s.z.string().optional()}),J5=s.z.union([Q1.extend(hg.shape),s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string(),code_verifier:s.z.string().min(43).max(128)}),s.z.object({grant_type:s.z.literal("authorization_code"),code:s.z.string(),redirect_uri:s.z.string().optional(),...hg.shape}),s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),refresh_token:s.z.string(),redirect_uri:s.z.string().optional()}),s.z.object({grant_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:s.z.string(),username:s.z.string(),otp:s.z.string(),realm:s.z.enum(["email","sms"])})]);function Y5(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 Z5=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:J5}}}},responses:{200:{content:{"application/json":{schema:Yd}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=Y5(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new P(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case wi.AuthorizationCode:i=await jx(t,Bx.parse(r));break;case wi.ClientCredential:i=await Px(t,Q1.parse(r));break;case wi.RefreshToken:i=await Fx(t,Lx.parse(r));break;case wi.OTP:i=await c_(t,X5.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}const o=new Headers;if(i.session_id){const l=ha(i.client.tenant.id,i.session_id,t.var.custom_domain||t.req.header("host")||"");o.set("Set-Cookie",l)}const c=await mc(t,i);return t.json(c,{headers:o})});var af={exports:{}};const cf=[{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}],l_=(t,e=cf,n="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";e[0].minDiversity=0,e[0].minLength=0;const i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];n&&i.push({regex:`[${n}]`,message:"symbol"});let o={};o.contains=i.filter(l=>new RegExp(`${l.regex}`).test(r)).map(l=>l.message),o.length=r.length;let c=e.filter(l=>o.contains.length>=l.minDiversity).filter(l=>o.length>=l.minLength).sort((l,u)=>u.id-l.id).map(l=>({id:l.id,value:l.value}));return Object.assign(o,c[0]),o};af.exports={passwordStrength:l_,defaultOptions:cf};var Q5=af.exports.passwordStrength=l_;af.exports.defaultOptions=cf;function lf(t){return Q5(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 gs(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 P(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new P(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function u_(t,e){var c,l;if(!t.var.client_id)throw new P(500,{message:"Client not found"});const n=await fs(t.env,t.var.client_id),r=n.connections.find(u=>u.strategy==="sms");if(!r)throw new P(500,{message:"SMS provider not found"});const i=((c=r.options)==null?void 0:c.provider)||"twilio",o=(l=t.env.smsProviders)==null?void 0:l[i];if(!o)throw new P(500,{message:"SMS provider not found"});await o({options:r.options,to:e.to,from:e.from,text:e.text,template:"auth-code",data:{code:e.code,tenantName:n.tenant.name,tenantId:n.tenant.id}})}async function d_(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new P(500,{message:"Tenant not found"});const o=`${jt(t.env)}reset-password?state=${r}&code=${n}`,c={vendorName:i.name,lng:i.language||"en"};await gs(t,{to:e,subject:$e("reset_password_title",c),html:`Click here to reset your password: ${jt(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:o,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:$e("password_reset_title",c),resetPasswordEmailClickToReset:$e("reset_password_email_click_to_reset",c),resetPasswordEmailReset:$e("reset_password_email_reset",c),supportInfo:$e("support_info",c),contactUs:$e("contact_us",c),copyright:$e("copyright",c),tenantName:i.name,tenantId:i.id}})}async function p_(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new P(500,{message:"Tenant not found"});const{connectionType:i}=gl(e),o=new URL(jt(t.env)),c={vendorName:r.name,vendorId:r.id,loginDomain:o.hostname,code:n,lng:r.language||"en"};i==="email"?await gs(t,{to:e,subject:$e("code_email_subject",c),html:`Click here to validate your email: ${jt(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",c),linkEmailClickToLogin:$e("link_email_click_to_login",c),linkEmailLogin:$e("link_email_login",c),linkEmailOrEnterCode:$e("link_email_or_enter_code",c),codeValid30Mins:$e("code_valid_30_minutes",c),supportInfo:$e("support_info",c),contactUs:$e("contact_us",c),copyright:$e("copyright",c)}}):i==="sms"&&await u_(t,{to:e,text:$e("sms_code_text",c),code:n,from:r.name});const l=qe(t,{type:Fe.CODE_LINK_SENT,description:e});Pt(t,t.env.data.logs.create(r.id,l))}async function uf(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new P(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new P(400,{message:"redirect_uri is required"});const{connectionType:o}=gl(e),c=new URL(rt(t.env));c.pathname="passwordless/verify_redirect",c.searchParams.set("verification_code",n),c.searchParams.set("connection",o),c.searchParams.set("client_id",r.client_id),c.searchParams.set("redirect_uri",r.redirect_uri),c.searchParams.set("email",e),r.response_type&&c.searchParams.set("response_type",r.response_type),r.scope&&c.searchParams.set("scope",r.scope),r.state&&c.searchParams.set("state",r.state),r.nonce&&c.searchParams.set("nonce",r.nonce),r.code_challenge&&c.searchParams.set("code_challenge",r.code_challenge),r.code_challenge_method&&c.searchParams.set("code_challenge_method",r.code_challenge_method),r.audience&&c.searchParams.set("audience",r.audience);const l={vendorName:i.name,code:n,lng:i.language||"en"};if(o==="email")await gs(t,{to:e,subject:$e("code_email_subject",l),html:`Click here to validate your email: ${jt(t.env)}validate-email`,template:"auth-link",data:{code:n,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:c.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(o==="sms")await u_(t,{to:e,text:`${$e("link_sms_login",l)}: ${c.toString()}`,code:n,from:i.name});else throw new P(400,{message:"Only email and SMS connections are supported for magic links"});const u=qe(t,{type:Fe.CODE_LINK_SENT,description:e});Pt(t,t.env.data.logs.create(i.id,u))}async function df(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new P(500,{message:"Tenant not found"});if(!e.email)throw new P(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await gs(t,{to:e.email,subject:$e("welcome_to_your_account",r),html:`Click here to validate your email: ${jt(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${jt(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 e8(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new P(500,{message:"Tenant not found"});const o={vendorName:i.name,lng:i.language||"en"},c=`${jt(t.env)}signup?state=${r}&code=${n}`;await gs(t,{to:e,subject:$e("register_password_account",o),html:`Click here to register: ${c}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:c,setPassword:$e("set_password",o),registerPasswordAccount:$e("register_password_account",o),clickToSignUpDescription:$e("click_to_sign_up_description",o),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:$e("welcome_to_your_account",o),verifyEmailVerify:$e("verify_email_verify",o),supportInfo:$e("support_info",o),contactUs:$e("contact_us",o),copyright:$e("copyright",o)}})}const t8=new s.OpenAPIHono().openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string()})}}}},responses:{200:{content:{"application/json":{schema:s.z.object({_id:s.z.string(),email:s.z.string().optional(),email_verified:s.z.boolean(),app_metadata:s.z.object({}),user_metadata:s.z.object({})})}},description:"Created user"}}}),async t=>{const{email:e,password:n,client_id:r}=t.req.valid("json"),i=await t.env.data.clients.get(r);if(!i)throw new P(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!lf(n))throw new P(400,{message:"Password does not meet the requirements"});if(await Ao({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new P(400,{message:"Invalid sign up"});const c=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${fc()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});t.set("user_id",c.user_id),t.set("username",c.email),t.set("connection",c.connection);const l=await Go.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:c.user_id,password:l,algorithm:"bcrypt"}),await df(t,c);const u=qe(t,{type:Fe.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,u),t.json({_id:c.user_id,email:c.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async t=>{const{email:e,client_id:n}=t.req.valid("json"),r=await t.env.data.clients.get(n);if(!r)throw new P(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await Hi({userAdapter:t.env.data.users,tenant_id:r.tenant.id,username:e,provider:"auth2"}))return t.html("If an account with that email exists, we've sent instructions to reset your password.");const o={client_id:n,username:e},c=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:o,csrf_token:He(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:mr(t.get("auth0_client"))});return await d_(t,e,c.id,c.authParams.state),t.html("If an account with that email exists, we've sent instructions to reset your password.")});function Yr(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const n8=new s.OpenAPIHono().openapi(s.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({connection:s.z.literal("email"),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),send:s.z.enum(["link","code"]),authParams:$o.omit({client_id:!0})}),s.z.object({client_id:s.z.string(),connection:s.z.literal("sms"),phone_number:s.z.string(),send:s.z.enum(["link","code"]),authParams:$o.omit({client_id:!0})})])}}}},responses:{200:{description:"Status"}}}),async t=>{const e=t.req.valid("json"),{env:n}=t,{client_id:r,send:i,authParams:o,connection:c}=e,l=await t.env.data.clients.get(r);if(!l)throw new P(400,{message:"Client not found"});t.set("client_id",l.id),t.set("tenant_id",l.tenant.id);const u=c==="email"?e.email:e.phone_number,d=t.get("ip"),f=t.get("useragent"),h=t.get("auth0_client"),_=mr(h),$=await n.data.loginSessions.create(l.tenant.id,{authParams:{...o,client_id:r,username:u},expires_at:new Date(Date.now()+qs).toISOString(),csrf_token:He(),ip:d,useragent:f,auth0Client:_}),m=await n.data.codes.create(l.tenant.id,{code_id:Yr(),code_type:"otp",login_id:$.id,expires_at:new Date(Date.now()+qs).toISOString(),redirect_uri:o.redirect_uri});return i==="link"?await uf(t,{to:u,code:m.code_id,authParams:{...o,client_id:r}}):await p_(t,{to:u,code:m.code_id}),t.html("OK")}).openapi(s.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:s.z.object({scope:s.z.string(),response_type:s.z.nativeEnum(xt),redirect_uri:s.z.string(),state:s.z.string(),nonce:s.z.string().optional(),verification_code:s.z.string(),connection:s.z.string(),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),audience:s.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:o,state:c,scope:l,audience:u,response_type:d,nonce:f}=t.req.valid("query"),h=await fs(e,n);t.set("client_id",h.id),t.set("tenant_id",h.tenant.id),t.set("connection","email");const _={client_id:n,redirect_uri:o,state:c,nonce:f,scope:l,audience:u,response_type:d};let $="Something went wrong. Please try again later.";try{const O=await sf(t,{client_id:n,username:r,otp:i,authParams:_,enforceIpCheck:!0});if(O instanceof Response)return O;if(O&&typeof O=="object"&&"access_token"in O)return t.json(O)}catch(O){const q=O;"message"in q&&typeof q.message=="string"&&($=q.message)}const m=t.get("ip"),x=t.get("useragent"),S=t.get("auth0_client"),k=mr(S),v=await e.data.loginSessions.create(h.tenant.id,{authParams:{..._,username:r},expires_at:new Date(Date.now()+qs).toISOString(),csrf_token:He(),ip:m,useragent:x,auth0Client:k});return t.redirect(`${jt(t.env)}invalid-session?state=${v.id}&error=${encodeURIComponent($)}`,302)});class gi extends P{constructor(n,r){super(n,r);xe(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function f_(t,e,n,r){var $;const{data:i}=t.env,{username:o}=n;if(t.set("username",o),!o)throw new P(400,{message:"Username is required"});const c=await Hi({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:o,provider:"auth2"});if(!c){const m=qe(t,{type:Fe.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Pt(t,i.logs.create(e.tenant.id,m)),new gi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const l=c.linked_to?await i.users.get(e.tenant.id,c.linked_to):c;if(!l)throw new gi(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",c.connection),t.set("user_id",l.user_id);const u=await i.passwords.get(e.tenant.id,c.user_id);if(!(u&&await Go.compare(n.password,u.password))){const m=qe(t,{type:Fe.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Pt(t,i.logs.create(e.tenant.id,m)),new gi(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(m=>m.type===Fe.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(m.date)>new Date(Date.now()-1e3*60*5)).length>=3){const m=qe(t,{type:Fe.FAILED_LOGIN,description:"Too many failed login attempts"});throw Pt(t,i.logs.create(e.tenant.id,m)),new gi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!c.email_verified&&e.email_validation==="enforced"){await df(t,c);const m=qe(t,{type:Fe.FAILED_LOGIN,description:"Email not verified"});throw await i.logs.create(e.tenant.id,m),new gi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}(($=l.app_metadata)==null?void 0:$.strategy)!=="Username-Password-Authentication"&&Pt(t,i.users.update(e.tenant.id,l.user_id,{app_metadata:{...l.app_metadata||{},strategy:"Username-Password-Authentication"}}));const _=qe(t,{type:Fe.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Pt(t,i.logs.create(e.tenant.id,_)),{client:e,authParams:n,user:l,loginSession:r}}async function h_(t,e,n,r,i){const o=await f_(t,e,n,r);return xr(t,{...o,ticketAuth:i})}async function r8(t,e,n,r){await _c(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=Yr(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;o;)i=Yr(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const c=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client"),d=mr(u),f=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Vw).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:He(),ip:c,useragent:l,auth0Client:d}),h=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:f.id,expires_at:new Date(Date.now()+qw).toISOString()});await d_(t,n,h.code_id,r)}const i8=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:s.z.string(),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),realm:s.z.enum(["email"]),scope:s.z.string().optional()}),s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string(),realm:s.z.enum(["Username-Password-Authentication"]),scope:s.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async t=>{const e=t.req.valid("json"),{client_id:n,username:r}=e;t.set("username",r);const i=await t.env.data.clients.get(n);if(!i)throw new P(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const o=r.toLocaleLowerCase(),c=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client");let d;if("otp"in e)d=await sf(t,{client_id:n,username:o,otp:e.otp});else if("password"in e){const f=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:{client_id:n,username:o},csrf_token:He(),ip:c,useragent:l,auth0Client:mr(u)});d=await h_(t,i,{username:o,password:e.password,client_id:n},f,!0)}else throw new P(400,{message:"Code or password required"});if(!(d instanceof Response))throw new P(500,{message:"Unexpected response from loginWithPassword"});return d});function o8(t,e){var r,i,o;if(!t||e.length===0)return!1;const n=((r=Ul(t))==null?void 0:r.host)??null;if(!n)return!1;for(const c of e){let l;if(c.startsWith("http://")||c.startsWith("https://")?l=((i=Ul(c))==null?void 0:i.host)??null:l=((o=Ul("https://"+c))==null?void 0:o.host)??null,n===l)return!0}return!1}function Ul(t){try{return new URL(t)}catch{return null}}async function s8({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:o}){const c=new URL(t.req.url);t.var.custom_domain&&(c.hostname=t.var.custom_domain);const{ip:l,auth0_client:u,useragent:d}=t.var,f=mr(u),h=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+Si*1e3).toISOString(),authParams:r,csrf_token:He(),authorization_url:c.toString(),ip:l,useragent:d,auth0Client:f});if(e&&o){const _=await t.env.data.users.get(n.tenant.id,e.user_id);if((_==null?void 0:_.email)===o)return xr(t,{client:n,loginSession:h,authParams:r,user:_,sessionId:e.id})}if(i==="email"&&o){const _=Yr();return await t.env.data.codes.create(n.tenant.id,{code_id:_,code_type:"otp",login_id:h.id,expires_at:new Date(Date.now()+Si*1e3).toISOString(),redirect_uri:r.redirect_uri}),await uf(t,{code:_,to:o,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 a8(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new P(403,{message:"Invalid realm"})}async function c8(t,e,n,r,i){var _;const{env:o}=t;t.set("connection",i);const c=await o.data.codes.get(e,n,"ticket");if(!c||c.used_at)throw new P(403,{message:"Ticket not found"});const l=await o.data.loginSessions.get(e,c.login_id);if(!l||!l.authParams.username)throw new P(403,{message:"Session not found"});const u=await o.data.clients.get(l.authParams.client_id);if(!u)throw new P(403,{message:"Client not found"});t.set("client_id",l.authParams.client_id),await o.data.codes.used(e,n);const d=a8(i);let f=await _c(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",f.email||f.phone_number),t.set("user_id",f.user_id);const h=await Ym(t,{user:f,client:u,loginSession:l});return xr(t,{authParams:{scope:(_=l.authParams)==null?void 0:_.scope,...r},loginSession:l,sessionId:h.id,user:f,client:u})}async function l8({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:o,code_challenge_method:c,code_challenge:l,audience:u,scope:d,response_type:f}){const{env:h}=t,_=new URL(r),$=`${_.protocol}//${_.host}`;async function m(H="Login required"){const W=qe(t,{type:Fe.FAILED_SILENT_AUTH,description:H});return await t.env.data.logs.create(e.tenant.id,W),t.html(lu($,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 m();t.set("user_id",n.user_id);const S=await h.data.users.get(e.tenant.id,n.user_id);if(!S)return console.error("User not found",n.user_id),m("User not found");t.set("username",S.email),t.set("connection",S.connection);const k={client:e,authParams:{client_id:e.id,audience:u,code_challenge_method:c,code_challenge:l,scope:d,state:i,nonce:o,response_type:f,redirect_uri:r},user:S,session_id:n.id},v=f===xt.CODE?await uu(t,{user:S,client:e,authParams:k.authParams,login_id:n.login_session_id}):await mc(t,k);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()+hc*1e3).toISOString():void 0});const O=qe(t,{type:Fe.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,O);const q=new Headers;q.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const F=ha(e.tenant.id,n.id,t.req.header("host"));return q.set("set-cookie",F),t.html(lu($,JSON.stringify({...v,state:i})),{headers:q})}const u8=["email","sms","Username-Password-Authentication"],d8=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),vendor_id:s.z.string().optional(),redirect_uri:s.z.string(),scope:s.z.string().optional(),state:s.z.string(),prompt:s.z.string().optional(),response_mode:s.z.nativeEnum(Pn).optional(),response_type:s.z.nativeEnum(xt).optional(),audience:s.z.string().optional(),connection:s.z.string().optional(),nonce:s.z.string().optional(),max_age:s.z.string().optional(),login_ticket:s.z.string().optional(),code_challenge_method:s.z.nativeEnum(lc).optional(),code_challenge:s.z.string().optional(),realm:s.z.string().optional(),auth0Client:s.z.string().optional(),organization:s.z.string().optional(),login_hint:s.z.string().optional(),screen_hint:s.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:s.z.string().optional()})},responses:{200:{description:"Successful authorization response. This can be an HTML page (e.g., for silent authentication iframe or universal login page) or a JSON object containing tokens (e.g., for response_mode=web_message).",content:{"text/html":{schema:s.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:Yd}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:o,state:c,audience:l,nonce:u,connection:d,response_type:f,response_mode:h,code_challenge:_,code_challenge_method:$,prompt:m,login_ticket:x,realm:S,auth0Client:k,login_hint:v,ui_locales:O,organization:q}=t.req.valid("query");t.set("log","authorize");const F=await fs(e,n);t.set("client_id",F.id),t.set("tenant_id",F.tenant.id);const H={redirect_uri:i.split("#")[0],scope:o,state:c,client_id:n,vendor_id:r,audience:l,nonce:u,prompt:m,response_type:f,response_mode:h,code_challenge:_,code_challenge_method:$,username:v,ui_locales:O,organization:q},W=t.req.header("origin");if(W&&!o8(W,F.web_origins||[]))throw new P(403,{message:`Origin ${W} not allowed`});if(H.redirect_uri&&!Z1(H.redirect_uri,F.callbacks||[],{allowPathWildcards:!0}))throw new P(400,{message:`Invalid redirect URI - ${H.redirect_uri}`});const J=fa(F.tenant.id,t.req.header("cookie")),ue=J?await e.data.sessions.get(F.tenant.id,J):void 0,Ne=ue&&!ue.revoked_at?ue:void 0;if(m=="none"){if(!f)throw new P(400,{message:"Missing response_type"});return l8({ctx:t,session:Ne||void 0,redirect_uri:i,state:c,response_type:f,client:F,nonce:u,code_challenge_method:$,code_challenge:_,audience:l,scope:o})}if(F.connections.length===1&&F.connections[0]&&!u8.includes(F.connections[0].strategy||""))return Lh(t,F,F.connections[0].name,H);if(d&&d!=="email")return Lh(t,F,d,H);if(x){const L=await c8(t,F.tenant.id,x,H,S);return L instanceof Response?L:t.json(L)}const B=await s8({ctx:t,client:F,auth0Client:k,authParams:H,session:Ne||void 0,connection:d,login_hint:v});return B instanceof Response?B:t.json(B)});function p8(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}),e.use("/oauth/token",Zg({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(ul).use(ll).use(Yp(e));const n=e.route("/v2/logout",zx).route("/userinfo",Dx).route("/.well-known",Rx).route("/oauth/token",Z5).route("/dbconnections",t8).route("/passwordless",n8).route("/co/authenticate",i8).route("/authorize",d8).route("/callback",Tx);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),Jp(n),n}var f8={Stringify:1,BeforeStream:2,Stream:3},on=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},h8=/[&<>'"]/,g_=async(t,e)=>{let n="";e||(e=[]);const r=await Promise.all(t);for(let i=r.length-1;n+=r[i],i--,!(i<0);i--){let o=r[i];typeof o=="object"&&e.push(...o.callbacks||[]);const c=o.isEscaped;if(o=await(typeof o=="object"?o.toString():o),typeof o=="object"&&e.push(...o.callbacks||[]),o.isEscaped??c)n+=o;else{const l=[n];dr(o,l),n=l[0]}}return on(n,e)},dr=(t,e)=>{const n=t.search(h8);if(n===-1){e[0]+=t;return}let r,i,o=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r="&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(o,i)+r,o=i+1}e[0]+=t.substring(o,i)},m_=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:f8.Stringify,buffer:n,context:r})),n[0]},__=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const o=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let c=0,l=o.length;c<l;c++){const u=o[c];if(typeof u=="string")dr(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):dr(u.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?on(m_(on(n[0],n.callbacks))):on(n[0]):g_(n,n.callbacks)},pf=Symbol("RENDERER"),Pd=Symbol("ERROR_HANDLER"),Qe=Symbol("STASH"),y_=Symbol("INTERNAL"),g8=Symbol("MEMO"),Qa=Symbol("PERMALINK"),gg=t=>(t[y_]=!0,t),w_=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:gg(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:gg(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[Pd]=o=>{throw t.pop(),o},i},v_=t=>{const e=[t],n=w_(e);return n.values=e,n.Provider=n,Li.push(n),n},Li=[],m8=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new A_("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(o=>on(o,o.callbacks)):on(i)};return n.values=e,n.Provider=n,n[pf]=w_(e),Li.push(n),n},no=t=>t.values.at(-1),Ys={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},Bd={},Zs="data-precedence",ms=t=>Array.isArray(t)?t:[t],mg=new WeakMap,_g=(t,e,n,r)=>({buffer:i,context:o})=>{if(!i)return;const c=mg.get(o)||{};mg.set(o,c);const l=c[t]||(c[t]=[]);let u=!1;const d=Ys[t];if(d.length>0){e:for(const[,f]of l)for(const h of d)if(((f==null?void 0:f[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 f;if(r===void 0)f=l.map(([h])=>h);else{const h=[];f=l.map(([_,,$])=>{let m=h.indexOf($);return m===-1&&(h.push($),m=h.length-1),[_,m]}).sort((_,$)=>_[1]-$[1]).map(([_])=>_)}f.forEach(h=>{i[0]=i[0].replaceAll(h,"")}),i[0]=i[0].replace(/(?=<\/head>)/,f.join(""))}},_s=(t,e,n)=>on(new sn(t,n,ms(e??[])).toString()),ys=(t,e,n,r)=>{if("itemProp"in n)return _s(t,e,n);let{precedence:i,blocking:o,...c}=n;i=r?i??"":void 0,r&&(c[Zs]=i);const l=new sn(t,c,ms(e||[])).toString();return l instanceof Promise?l.then(u=>on(l,[...u.callbacks||[],_g(t,u,c,i)])):on(l,[_g(t,l,c,i)])},_8=({children:t,...e})=>{const n=ff();if(n){const r=no(n);if(r==="svg"||r==="head")return new sn("title",e,ms(t??[]))}return ys("title",t,e,!1)},y8=({children:t,...e})=>{const n=ff();return["src","async"].some(r=>!e[r])||n&&no(n)==="head"?_s("script",t,e):ys("script",t,e,!1)},w8=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,ys("style",t,e,!0)):_s("style",t,e),v8=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?_s("link",t,e):ys("link",t,e,"precedence"in e),b8=({children:t,...e})=>{const n=ff();return n&&no(n)==="head"?_s("meta",t,e):ys("meta",t,e,!1)},b_=(t,{children:e,...n})=>new sn(t,n,ms(e??[])),x8=t=>(typeof t.action=="function"&&(t.action=Qa in t.action?t.action[Qa]:void 0),b_("form",t)),x_=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=Qa in e.formAction?e.formAction[Qa]:void 0),b_(t,e)),$8=t=>x_("input",t),A8=t=>x_("button",t);const Ml=Object.freeze(Object.defineProperty({__proto__:null,button:A8,form:x8,input:$8,link:v8,meta:b8,script:y8,style:w8,title:_8},Symbol.toStringTag,{value:"Module"}));var k8=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),ec=t=>k8.get(t)||t,$_=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e(i,r==null?null:typeof r=="number"?i.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`:r)}},Uo=void 0,ff=()=>Uo,E8=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,S8=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],N8=["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"],hf=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")dr(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof sn?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):hf(i,e)}}},sn=class{constructor(t,e,n){xe(this,"tag");xe(this,"props");xe(this,"key");xe(this,"children");xe(this,"isEscaped",!0);xe(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?m_(on(t[0],t.callbacks)).toString():t[0]:g_(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=Uo&&no(Uo)==="svg"?o=>E8(ec(o)):o=>ec(o);for(let[o,c]of Object.entries(n))if(o=i(o),o!=="children"){if(o==="style"&&typeof c=="object"){let l="";$_(c,(u,d)=>{d!=null&&(l+=`${l?";":""}${u}:${d}`)}),t[0]+=' style="',dr(l,t),t[0]+='"'}else if(typeof c=="string")t[0]+=` ${o}="`,dr(c,t),t[0]+='"';else if(c!=null)if(typeof c=="number"||c.isEscaped)t[0]+=` ${o}="${c}"`;else if(typeof c=="boolean"&&N8.includes(o))c&&(t[0]+=` ${o}=""`);else if(o==="dangerouslySetInnerHTML"){if(r.length>0)throw"Can only set one of `children` or `props.dangerouslySetInnerHTML`.";r=[on(c.__html)]}else if(c instanceof Promise)t[0]+=` ${o}="`,t.unshift('"',c);else if(typeof c=="function"){if(!o.startsWith("on"))throw`Invalid prop '${o}' of type 'function' supplied to '${e}'.`}else t[0]+=` ${o}="`,dr(c.toString(),t),t[0]+='"'}if(S8.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",hf(r,t),t[0]+=`</${e}>`}},ql=class extends sn{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(Li.length===0)t.unshift("",n);else{const r=Li.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof sn&&(i.localContexts=r),i)))}else n instanceof sn?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):dr(n,t)}},A_=class extends sn{toStringToBuffer(t){hf(this.children,t)}},C8=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=Qs(t,e,n);return i.key=r,i},yg=!1,Qs=(t,e,n)=>{if(!yg){for(const r in Bd)Ml[r][pf]=Bd[r];yg=!0}return typeof t=="function"?new ql(t,e,n):Ml[t]?new ql(Ml[t],e,n):t==="svg"||t==="head"?(Uo||(Uo=m8("")),new sn(t,e,[new ql(Uo,{value:t},n)])):new sn(t,e,n)},gf=({children:t})=>new A_("",{children:t},Array.isArray(t)?t:t?[t]:[]),I8=(t,e,...n)=>C8(t.tag,{...t.props,...e},...n);function A(t,e,n){let r;if(!e||!("children"in e))r=Qs(t,e,[]);else{const i=e.children;r=Array.isArray(i)?Qs(t,e,i):Qs(t,e,[i])}return r.key=n,r}const wg={name:"sesamy",logoUrl:"https://assets.sesamy.com/static/images/email/sesamy-logo.png",style:{primaryColor:"#7D68F4",buttonTextColor:"#FFFFFF",primaryHoverColor:"#A091F2"},loginBackgroundImage:"",checkoutHideSocial:!1,supportEmail:"support@sesamy.com",supportUrl:"https://support.sesamy.com",siteUrl:"https://sesamy.com",termsAndConditionsUrl:"https://store.sesamy.com/pages/terms-of-service",manageSubscriptionsUrl:"https://account.sesamy.com/manage-subscriptions"};async function k_(t,e,n){if(!n&&!e)return wg;const r=n||e;try{const i=await fetch(`${t.API_URL}/profile/vendors/${r}/style`);if(!i.ok)throw new Error("Failed to fetch vendor settings");const o=await i.json();return mm.parse(o)}catch(i){return console.error(i),wg}}async function Je(t,e,n=!1){var d;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new P(400,{message:"Login session not found"});t.set("loginSession",i);const o=await fs(r,i.authParams.client_id);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const c=await r.data.tenants.get(o.tenant.id);if(c){if(i.session_id&&!n){if(!i.authParams.redirect_uri)throw new P(400,{message:"Login session closed and no redirect URI available"});const f=new URL(i.authParams.redirect_uri);throw f.searchParams.set("error","access_denied"),f.searchParams.set("error_description","Login session closed"),i.authParams.state&&f.searchParams.set("state",i.authParams.state),new hs(f.toString(),302)}}else throw new P(400,{message:"Tenant not found"});const l=await k_(r,o.id,i.authParams.vendor_id),u=(d=i.authParams.ui_locales)==null?void 0:d.split(" ").map(f=>f.split("-")[0]).find(f=>{if(Array.isArray(U.options.supportedLngs))return U.options.supportedLngs.includes(f)});return await U.changeLanguage(u||c.language||"sv"),{vendorSettings:{...l,termsAndConditionsUrl:o.id==="fokus-app"?"https://www.fokus.se/kopvillkor-app/":l.termsAndConditionsUrl},client:o,tenant:c,loginSession:i}}async function T8(t,e,n,r){if(r!==void 0)return r==="password";const i=await ap({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 E_=({vendorSettings:t})=>t!=null&&t.logoUrl?A("div",{className:"flex h-9 items-center",children:A("img",{src:t.logoUrl,className:"max-h-full",alt:"Vendor logo"})}):A(gf,{}),S_=({vendorSettings:t})=>{const{termsAndConditionsUrl:e}=t;return A("div",{className:"mt-8",children:e&&A("div",{className:"text-xs text-gray-300",children:[U.t("agree_to")," ",A("a",{href:e,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:U.t("terms")})]})})};var N_={exports:{}};/*!
198
198
  Copyright (c) 2018 Jed Watson.
199
199
  Licensed under the MIT License (MIT), see
200
200
  http://jedwatson.github.io/classnames
201
- */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",c=0;c<arguments.length;c++){var l=arguments[c];l&&(o=i(o,r(l)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var c="";for(var l in o)e.call(o,l)&&o[l]&&(c=i(c,l));return c}function i(o,c){return c?o?o+" "+c:o+c:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(S_);var O8=S_.exports;const _r=Rm(O8),z8=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",st=({name:t,size:e,className:n=""})=>{const r=z8(e);return A("span",{className:_r(`uicon-${t}`,n,r)})};var vg=Object.freeze,D8=Object.defineProperty,R8=(t,e)=>vg(D8(t,"raw",{value:vg(t.slice())})),bg;const P8=t=>{const{style:e}=t;return`
201
+ */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",c=0;c<arguments.length;c++){var l=arguments[c];l&&(o=i(o,r(l)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var c="";for(var l in o)e.call(o,l)&&o[l]&&(c=i(c,l));return c}function i(o,c){return c?o?o+" "+c:o+c:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(N_);var O8=N_.exports;const _r=Rm(O8),z8=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",st=({name:t,size:e,className:n=""})=>{const r=z8(e);return A("span",{className:_r(`uicon-${t}`,n,r)})};var vg=Object.freeze,D8=Object.defineProperty,R8=(t,e)=>vg(D8(t,"raw",{value:vg(t.slice())})),bg;const P8=t=>{const{style:e}=t;return`
202
202
  body {
203
203
  --primary-color: ${e.primaryColor};
204
204
  --primary-hover: ${e.primaryHoverColor};
205
205
  --text-on-primary: ${e.buttonTextColor};
206
206
  }
207
- `},B8="https://assets.sesamy.com/images/login-bg.jpg",dt=({title:t,children:e,vendorSettings:n})=>{const r={backgroundImage:`url(${(n==null?void 0:n.loginBackgroundImage)||B8})`};return A("html",{lang:"en",children:[A("head",{children:[A("title",{children:t}),A("meta",{charset:"UTF-8"}),A("meta",{name:"robots",content:"noindex, follow"}),A("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),A("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),A("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),A("link",{rel:"stylesheet",href:"/u/css/tailwind.css"}),A("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"}),A("style",{children:P8(n)}),A("meta",{name:"theme-color",content:"#000000"})]}),A("body",{children:A("div",{className:"row min-h-full w-full overflow-hidden bg-cover bg-center text-sm sm:bg-fixed sm:bg-left-top sm:pt-16 py-2",style:r,children:A("div",{className:"row-up-left w-[calc(100%-theme(space.2)-theme(space.2))] max-w-[1295px] !flex-nowrap sm:w-[calc(100%-theme(space.16)-theme(space.16))]",children:A("div",{className:"column-left w-full sm:w-auto",children:[A("div",{className:"relative flex w-full flex-col rounded-2xl bg-white px-5 py-10 dark:bg-gray-800 dark:text-white sm:min-h-[700px] sm:max-w-md sm:px-14 sm:py-14 md:min-w-[448px] short:min-h-[558px] min-h-[calc(100vh-83px)]",children:[A("div",{className:"mb-16",children:A(k_,{vendorSettings:n})}),A("div",{className:"flex flex-1 flex-col",children:[e,A(E_,{vendorSettings:n})]})]}),A("div",{className:"flex w-full items-center px-6 pb-8 pt-4 justify-between",children:[A("div",{className:"flex justify-center leading-[0]",children:A("a",{href:"https://sesamy.com",target:"_blank",rel:"noreferrer",children:A(st,{name:"sesamy",className:"text-xl text-white"})})}),A("div",{className:"flex justify-center space-x-2 text-xs text-white sm:justify-normal md:text-xs",children:n.supportUrl&&A("a",{className:"text-xs text-white hover:underline md:text-xs",href:n.supportUrl,target:"_blank",rel:"noopener noreferrer",children:U.t("contact_support")})})]})]})})})}),m_(bg||(bg=R8([`
207
+ `},B8="https://assets.sesamy.com/images/login-bg.jpg",dt=({title:t,children:e,vendorSettings:n})=>{const r={backgroundImage:`url(${(n==null?void 0:n.loginBackgroundImage)||B8})`};return A("html",{lang:"en",children:[A("head",{children:[A("title",{children:t}),A("meta",{charset:"UTF-8"}),A("meta",{name:"robots",content:"noindex, follow"}),A("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),A("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),A("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),A("link",{rel:"stylesheet",href:"/u/css/tailwind.css"}),A("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"}),A("style",{children:P8(n)}),A("meta",{name:"theme-color",content:"#000000"})]}),A("body",{children:A("div",{className:"row min-h-full w-full overflow-hidden bg-cover bg-center text-sm sm:bg-fixed sm:bg-left-top sm:pt-16 py-2",style:r,children:A("div",{className:"row-up-left w-[calc(100%-theme(space.2)-theme(space.2))] max-w-[1295px] !flex-nowrap sm:w-[calc(100%-theme(space.16)-theme(space.16))]",children:A("div",{className:"column-left w-full sm:w-auto",children:[A("div",{className:"relative flex w-full flex-col rounded-2xl bg-white px-5 py-10 dark:bg-gray-800 dark:text-white sm:min-h-[700px] sm:max-w-md sm:px-14 sm:py-14 md:min-w-[448px] short:min-h-[558px] min-h-[calc(100vh-83px)]",children:[A("div",{className:"mb-16",children:A(E_,{vendorSettings:n})}),A("div",{className:"flex flex-1 flex-col",children:[e,A(S_,{vendorSettings:n})]})]}),A("div",{className:"flex w-full items-center px-6 pb-8 pt-4 justify-between",children:[A("div",{className:"flex justify-center leading-[0]",children:A("a",{href:"https://sesamy.com",target:"_blank",rel:"noreferrer",children:A(st,{name:"sesamy",className:"text-xl text-white"})})}),A("div",{className:"flex justify-center space-x-2 text-xs text-white sm:justify-normal md:text-xs",children:n.supportUrl&&A("a",{className:"text-xs text-white hover:underline md:text-xs",href:n.supportUrl,target:"_blank",rel:"noopener noreferrer",children:U.t("contact_support")})})]})]})})})}),__(bg||(bg=R8([`
208
208
  <script>
209
209
  // Add loading class to submit button on form submission
210
210
  var form = document.getElementById("form");
@@ -219,9 +219,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
219
219
  }
220
220
  });
221
221
  <\/script>
222
- `])))]})},oi=({children:t})=>A("div",{className:"mb-2 text-sm text-red",children:t}),j8=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",N_=({size:t})=>{const e=j8(t);return A("div",{className:"relative inline-block leading-[0]",children:[A(st,{className:_r("text-gray-200 dark:text-[#201a41]",{[e]:e}),name:"spinner-circle"}),A(st,{className:_r("absolute inset-0 animate-spin text-primary",{[e]:e}),name:"spinner-inner"})]})},at=({children:t,className:e,Component:n="button",variant:r="primary",href:i,disabled:o,isLoading:c,id:l})=>{const u=n==="a"?{href:i}:{};return A(n,{class:_r("btn relative w-full rounded-lg text-center",{"px-4 py-5":r!=="custom","bg-primary text-textOnPrimary hover:bg-primaryHover":r==="primary","border border-gray-300 bg-white text-black":r==="secondary","pointer-events-none cursor-not-allowed opacity-40":o,"is-loading":c},"focus:outline-none focus:ring",e),type:"submit",disabled:o,id:l,...u,children:[A("span",{className:"btn-label flex items-center justify-center space-x-2",children:t}),A("div",{className:"btn-spinner absolute left-0 top-0 flex h-full w-full items-center justify-center",children:A(N_,{size:"medium"})})]})},po=({connection:t,text:e,icon:n=null,canResize:r=!1,loginSession:i})=>{const o=new URLSearchParams({client_id:i.authParams.client_id,connection:t});i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.redirect_uri&&o.set("redirect_uri",i.authParams.redirect_uri),i.authParams.scope&&o.set("scope",i.authParams.scope),i.authParams.nonce&&o.set("nonce",i.authParams.nonce),i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.state&&o.set("state",i.id);const c=`/authorize?${o.toString()}`;return A(at,{className:_r("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:c,children:[n||"",A("div",{className:_r("text-left text-black dark:text-white sm:text-base",{"hidden sm:inline short:hidden":r}),children:e})]})},C_=({...t})=>A("svg",{width:"45",height:"45",viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",...t,children:[A("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"}),A("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"}),A("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"}),A("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"})]}),Jn=({children:t,className:e})=>A("form",{id:"form",method:"post",className:e,children:t}),I_=({...t})=>A("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:[A("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"}),A("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
222
+ `])))]})},oi=({children:t})=>A("div",{className:"mb-2 text-sm text-red",children:t}),j8=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",C_=({size:t})=>{const e=j8(t);return A("div",{className:"relative inline-block leading-[0]",children:[A(st,{className:_r("text-gray-200 dark:text-[#201a41]",{[e]:e}),name:"spinner-circle"}),A(st,{className:_r("absolute inset-0 animate-spin text-primary",{[e]:e}),name:"spinner-inner"})]})},at=({children:t,className:e,Component:n="button",variant:r="primary",href:i,disabled:o,isLoading:c,id:l})=>{const u=n==="a"?{href:i}:{};return A(n,{class:_r("btn relative w-full rounded-lg text-center",{"px-4 py-5":r!=="custom","bg-primary text-textOnPrimary hover:bg-primaryHover":r==="primary","border border-gray-300 bg-white text-black":r==="secondary","pointer-events-none cursor-not-allowed opacity-40":o,"is-loading":c},"focus:outline-none focus:ring",e),type:"submit",disabled:o,id:l,...u,children:[A("span",{className:"btn-label flex items-center justify-center space-x-2",children:t}),A("div",{className:"btn-spinner absolute left-0 top-0 flex h-full w-full items-center justify-center",children:A(C_,{size:"medium"})})]})},po=({connection:t,text:e,icon:n=null,canResize:r=!1,loginSession:i})=>{const o=new URLSearchParams({client_id:i.authParams.client_id,connection:t});i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.redirect_uri&&o.set("redirect_uri",i.authParams.redirect_uri),i.authParams.scope&&o.set("scope",i.authParams.scope),i.authParams.nonce&&o.set("nonce",i.authParams.nonce),i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.state&&o.set("state",i.id);const c=`/authorize?${o.toString()}`;return A(at,{className:_r("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:c,children:[n||"",A("div",{className:_r("text-left text-black dark:text-white sm:text-base",{"hidden sm:inline short:hidden":r}),children:e})]})},I_=({...t})=>A("svg",{width:"45",height:"45",viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",...t,children:[A("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"}),A("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"}),A("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"}),A("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"})]}),Jn=({children:t,className:e})=>A("form",{id:"form",method:"post",className:e,children:t}),T_=({...t})=>A("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:[A("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"}),A("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FFFFFF",d:`M27.9,20.3c1.4,0,2.6-1,2.6-2.5h0c0-1.5-1.2-2.5-2.6-2.5c-1.4,0-2.6,1-2.6,2.5C25.3,19.2,26.5,20.3,27.9,20.3z
223
223
  M31.2,24.4c-1.7,2.2-3.5,3.8-6.7,3.8h0c-3.2,0-5.8-2-7.7-4.8c-0.8-1.2-2-1.4-2.9-0.8c-0.8,0.6-1,1.8-0.3,2.9
224
- c2.7,4.1,6.5,6.6,10.9,6.6c4,0,7.2-2,9.6-5.2c0.9-1.2,0.9-2.5,0-3.1C33.3,22.9,32.1,23.2,31.2,24.4z`})]}),ea=({error:t,vendorSettings:e,loginSession:n,email:r,client:i})=>{const o=i.connections.map(({strategy:O})=>O),c=o.includes("email")||o.includes("Username-Password-Authentication"),l=o.includes("sms"),u=o.includes("facebook"),d=o.includes("google-oauth2"),f=o.includes("apple"),h=o.includes("vipps"),_=u||d||f||h,$=c||l;let m="text",x="username";const S=c&&l?"email_or_phone_placeholder":c?"email_placeholder":"phone_placeholder";let k=U.t(S,c&&l?"Email or Phone Number":c?"Email Address":"Phone Number");return A(dt,{title:U.t("welcome"),vendorSettings:e,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("welcome")}),A("div",{className:"mb-8 text-gray-300",children:U.t("login_description_template",{authMethod:U.t(S,{defaultValue:c&&l?"email or phone number":c?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),A("div",{className:"flex flex-1 flex-col justify-center",children:[$&&A(Jn,{className:"mb-7",children:[A("input",{type:m,name:x,placeholder:k,className:_r("mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),required:!0,value:r||""}),t&&A(oi,{children:t}),A(at,{className:"sm:mt-4 !text-base",children:[A("span",{children:U.t("continue")}),A(st,{className:"text-xs",name:"arrow-right"})]})]}),$&&_&&A("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[A("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),A("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:U.t("continue_social_login")})]}),A("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:[u&&A(po,{connection:"facebook",text:U.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:A(st,{className:"text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"facebook"}),loginSession:n}),d&&A(po,{connection:"google-oauth2",text:U.t("continue_with",{provider:"Google"}),canResize:!0,icon:A(C_,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n}),f&&A(po,{connection:"apple",text:U.t("continue_with",{provider:"Apple"}),canResize:!0,icon:A(st,{className:"text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"apple"}),loginSession:n}),h&&A(po,{connection:"vipps",text:U.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:A(I_,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n})]})]})]})},L8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:s.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r,client:i}=await Je(t,e);return t.html(A(ea,{vendorSettings:n,loginSession:r,client:i,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({username:s.z.string().transform(t=>t.toLowerCase()),login_selection:s.z.enum(["code","password"]).optional()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form");t.set("body",r),t.set("username",r.username);const{client:i,loginSession:o,vendorSettings:c}=await Je(t,n);t.set("client_id",i.id);const l=t.get("countryCode"),{normalized:u,connectionType:d}=gl(r.username,l);if(!u)return t.html(A(ea,{vendorSettings:c,loginSession:o,error:U.t("invalid_identifier"),email:r.username,client:i}),400);const f=await Ao({userAdapter:e.data.users,tenant_id:i.tenant.id,username:u,provider:d});if(f&&t.set("user_id",f.user_id),!f)try{await bb(t,i,t.env.data,u)}catch{const x=qe(t,{type:Fe.FAILED_SIGNUP,description:"Public signup is disabled"});return Pt(t,t.env.data.logs.create(i.tenant.id,x)),t.html(A(ea,{vendorSettings:c,loginSession:o,error:U.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(o.authParams.username=u,await e.data.loginSessions.update(i.tenant.id,o.id,o),await T8(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let h=Yr(),_=await e.data.codes.get(i.tenant.id,h,"otp");for(;_;)h=Yr(),_=await e.data.codes.get(i.tenant.id,h,"otp");const $=await t.env.data.codes.create(i.tenant.id,{code_id:h,code_type:"otp",login_id:o.id,expires_at:new Date(Date.now()+qs).toISOString(),redirect_uri:o.authParams.redirect_uri}),m=i.connections.find(x=>x.strategy===d);if(!m)throw new P(400,{message:U.t("connection_not_found",{connection:d})});return d==="email"&&m.options.authentication_method==="magic_link"?await uf(t,{to:u,code:$.code_id,authParams:o.authParams}):await d_(t,{to:u,code:$.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),ln=t=>A("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:U.t("go_back")});var Mo="_hp",F8={Change:"Input",DoubleClick:"DblClick"},U8={svg:"2000/svg",math:"1998/Math/MathML"},qo=[],jd=new WeakMap,Fi=void 0,M8=()=>Fi,In=t=>"t"in t,Vl={onClick:["click",!1]},xg=t=>{if(!t.startsWith("on"))return;if(Vl[t])return Vl[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return Vl[t]=[(F8[n]||n).toLowerCase(),!!r]}},$g=(t,e)=>Fi&&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,q8=(t,e,n)=>{var r;e||(e={});for(let i in e){const o=e[i];if(i!=="children"&&(!n||n[i]!==o)){i=ec(i);const c=xg(i);if(c){if((n==null?void 0:n[i])!==o&&(n&&t.removeEventListener(c[0],n[i],c[1]),o!=null)){if(typeof o!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(c[0],o,c[1])}}else if(i==="dangerouslySetInnerHTML"&&o)t.innerHTML=o.__html;else if(i==="ref"){let l;typeof o=="function"?l=o(t)||(()=>o(null)):o&&"current"in o&&(o.current=t,l=()=>o.current=null),jd.set(t,l)}else if(i==="style"){const l=t.style;typeof o=="string"?l.cssText=o:(l.cssText="",o!=null&&x_(o,l.setProperty.bind(l)))}else{if(i==="value"){const u=t.nodeName;if(u==="INPUT"||u==="TEXTAREA"||u==="SELECT"){if(t.value=o==null||o===!1?null:o,u==="TEXTAREA"){t.textContent=o;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]=o);const l=$g(t,i);o==null||o===!1?t.removeAttribute(l):o===!0?t.setAttribute(l,""):typeof o=="string"||typeof o=="number"?t.setAttribute(l,o):t.setAttribute(l,o.toString())}}}if(n)for(let i in n){const o=n[i];if(i!=="children"&&!(i in e)){i=ec(i);const c=xg(i);c?t.removeEventListener(c[0],o,c[1]):i==="ref"?(r=jd.get(t))==null||r():t.removeAttribute($g(t,i))}}},V8=(t,e)=>{e[Qe][0]=0,qo.push([t,e]);const n=e.tag[pf]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{qo.pop()}},T_=(t,e,n,r,i)=>{var o,c;(o=t.vR)!=null&&o.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((c=t[Qe][1][R_])==null||c.forEach(l=>i.push(l))),t.vC.forEach(l=>{var u;if(In(l))n.push(l);else if(typeof l.tag=="function"||l.tag===""){l.c=e;const d=n.length;if(T_(l,e,n,r,i),l.s){for(let f=d;f<n.length;f++)n[f].s=!0;l.s=!1}}else n.push(l),(u=l.vR)!=null&&u.length&&(r.push(...l.vR),delete l.vR)})},H8=t=>{for(;;t=t.tag===Mo||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==Mo&&t.e)return t.e}},O_=t=>{var e,n,r,i,o,c;In(t)||((n=(e=t[Qe])==null?void 0:e[1][R_])==null||n.forEach(l=>{var u;return(u=l[2])==null?void 0:u.call(l)}),(r=jd.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(l=>l.p=2)),(o=t.vC)==null||o.forEach(O_)),t.p||((c=t.e)==null||c.remove(),delete t.e),typeof t.tag=="function"&&(fo.delete(t),ta.delete(t),delete t[Qe][3],t.a=!0)},z_=(t,e,n)=>{t.c=e,D_(t,e,n)},Ag=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},kg=Symbol(),D_=(t,e,n)=>{var d;const r=[],i=[],o=[];T_(t,e,r,i,o),i.forEach(O_);const c=n?void 0:e.childNodes;let l,u=null;if(n)l=-1;else if(!c.length)l=0;else{const f=Ag(c,H8(t.nN));f!==void 0?(u=c[f],l=f):l=Ag(c,(d=r.find(h=>h.tag!==Mo&&h.e))==null?void 0:d.e)??-1,l===-1&&(n=!0)}for(let f=0,h=r.length;f<h;f++,l++){const _=r[f];let $;if(_.s&&_.e)$=_.e,_.s=!1;else{const m=n||!_.e;In(_)?(_.e&&_.d&&(_.e.textContent=_.t),_.d=!1,$=_.e||(_.e=document.createTextNode(_.t))):($=_.e||(_.e=_.n?document.createElementNS(_.n,_.tag):document.createElement(_.tag)),q8($,_.props,_.pP),D_(_,$,m))}_.tag===Mo?l--:n?$.parentNode||e.appendChild($):c[l]!==$&&c[l-1]!==$&&(c[l+1]===$?e.appendChild(c[l]):e.insertBefore($,u||c[l]||null))}if(t.pP&&delete t.pP,o.length){const f=[],h=[];o.forEach(([,_,,$,m])=>{_&&f.push(_),$&&h.push($),m==null||m()}),f.forEach(_=>_()),h.length&&requestAnimationFrame(()=>{h.forEach(_=>_())})}},ta=new WeakMap,Ld=(t,e,n)=>{var o,c,l,u,d,f;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?V8(t,e):ms(e.props.children)),((o=n[0])==null?void 0:o.tag)===""&&n[0][Pd]&&(i=n[0][Pd],t[5].push([t,i,e]));const h=r?[...e.pC]:e.vC?[...e.vC]:void 0,_=[];let $;for(let m=0;m<n.length;m++){Array.isArray(n[m])&&n.splice(m,1,...n[m].flat());let x=K8(n[m]);if(x){typeof x.tag=="function"&&!x.tag[__]&&(Li.length>0&&(x[Qe][2]=Li.map(k=>[k,k.values.at(-1)])),(c=t[5])!=null&&c.length&&(x[Qe][3]=t[5].at(-1)));let S;if(h&&h.length){const k=h.findIndex(In(x)?v=>In(v):x.key!==void 0?v=>v.key===x.key&&v.tag===x.tag:v=>v.tag===x.tag);k!==-1&&(S=h[k],h.splice(k,1))}if(S)if(In(x))S.t!==x.t&&(S.t=x.t,S.d=!0),x=S;else{const k=S.pP=S.props;S.props=x.props,S.f||(S.f=x.f||e.f),typeof x.tag=="function"&&(S[Qe][2]=x[Qe][2]||[],S[Qe][3]=x[Qe][3],!S.f&&((S.o||S)===x.o||(u=(l=S.tag)[g8])!=null&&u.call(l,k,S.props))&&(S.s=!0)),x=S}else if(!In(x)&&Fi){const k=no(Fi);k&&(x.n=k)}if(!In(x)&&!x.s&&(Ld(t,x),delete x.f),_.push(x),$&&!$.s&&!x.s)for(let k=$;k&&!In(k);k=(d=k.vC)==null?void 0:d.at(-1))k.nN=x;$=x}}e.vR=r?[...e.vC,...h||[]]:h||[],e.vC=_,r&&delete e.pC}catch(h){if(e.f=!0,h===kg){if(i)return;throw h}const[_,$,m]=((f=e[Qe])==null?void 0:f[3])||[];if($){const x=()=>na([0,!1,t[2]],m),S=ta.get(m)||[];S.push(x),ta.set(m,S);const k=$(h,()=>{const v=ta.get(m);if(v){const O=v.indexOf(x);if(O!==-1)return v.splice(O,1),x()}});if(k){if(t[0]===1)t[1]=!0;else if(Ld(t,m,[k]),($.length===1||t!==_)&&m.c){z_(m,m.c,!1);return}throw kg}}throw h}finally{i&&t[5].pop()}},K8=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[Qe]=[0,[]];else{const e=U8[t.tag];e&&(Fi||(Fi=w_("")),t.props.children=[{tag:Fi,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},Eg=(t,e)=>{var n,r;(n=e[Qe][2])==null||n.forEach(([i,o])=>{i.values.push(o)});try{Ld(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Qe][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&z_(e,e.c,!1)},fo=new WeakMap,Sg=[],na=async(t,e)=>{t[5]||(t[5]=[]);const n=fo.get(e);n&&n[0](void 0);let r;const i=new Promise(o=>r=o);if(fo.set(e,[r,()=>{t[2]?t[2](t,e,o=>{Eg(o,e)}).then(()=>r(e)):(Eg(t,e),r(e))}]),Sg.length)Sg.at(-1).add(e);else{await Promise.resolve();const o=fo.get(e);o&&(fo.delete(e),o[1]())}return i},G8=(t,e,n)=>({tag:Mo,props:{children:t},key:n,e,p:1}),Hl=0,R_=1,Kl=2,Gl=3,Wl=new WeakMap,P_=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),W8=void 0,Ng=[],X8=t=>{var c;const e=()=>typeof t=="function"?t():t,n=qo.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(c=r[Qe][1])[Hl]||(c[Hl]=[]),o=r[Qe][0]++;return i[o]||(i[o]=[e(),l=>{const u=W8,d=i[o];if(typeof l=="function"&&(l=l(d[0])),!Object.is(l,d[0]))if(d[0]=l,Ng.length){const[f,h]=Ng.at(-1);Promise.all([f===3?r:na([f,!1,u],r),h]).then(([_])=>{if(!_||!(f===2||f===3))return;const $=_.vC;requestAnimationFrame(()=>{setTimeout(()=>{$===_.vC&&na([f===3?1:0,!1,u],_)})})})}else na([0,!1,u],r)}])},mf=(t,e)=>{var l;const n=qo.at(-1);if(!n)return t;const[,r]=n,i=(l=r[Qe][1])[Kl]||(l[Kl]=[]),o=r[Qe][0]++,c=i[o];return P_(c==null?void 0:c[1],e)?i[o]=[t,e]:t=i[o][0],t},J8=t=>{const e=Wl.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>Wl.set(t,[n]),n=>Wl.set(t,[void 0,n])),t},Y8=(t,e)=>{var l;const n=qo.at(-1);if(!n)return t();const[,r]=n,i=(l=r[Qe][1])[Gl]||(l[Gl]=[]),o=r[Qe][0]++,c=i[o];return P_(c==null?void 0:c[1],e)&&(i[o]=[t(),e]),i[o][0]},Z8=w_({pending:!1,data:null,method:null,action:null}),Cg=new Set,Q8=t=>{Cg.add(t),t.finally(()=>Cg.delete(t))},_f=(t,e)=>Y8(()=>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]),ui=Object.create(null),Ds=Object.create(null),ws=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const o=document.head;let{onLoad:c,onError:l,precedence:u,blocking:d,...f}=e,h=null,_=!1;const $=Ys[t];let m;if($.length>0){const v=o.querySelectorAll(t);e:for(const O of v)for(const q of Ys[t])if(O.getAttribute(q)===e[q]){h=O;break e}if(!h){const O=$.reduce((q,F)=>e[F]===void 0?q:`${q}-${F}-${e[F]}`,t);_=!Ds[O],h=Ds[O]||(Ds[O]=(()=>{const q=document.createElement(t);for(const F of $)e[F]!==void 0&&q.setAttribute(F,e[F]),e.rel&&q.setAttribute("rel",e.rel);return q})())}}else m=o.querySelectorAll(t);u=r?u??"":void 0,r&&(f[Zs]=u);const x=mf(v=>{if($.length>0){let O=!1;for(const q of o.querySelectorAll(t)){if(O&&q.getAttribute(Zs)!==u){o.insertBefore(v,q);return}q.getAttribute(Zs)===u&&(O=!0)}o.appendChild(v)}else if(m){let O=!1;for(const q of m)if(q===v){O=!0;break}O||o.insertBefore(v,o.contains(m[0])?m[0]:o.querySelector(t)),m=void 0}},[u]),S=_f(e.ref,v=>{var F;const O=$[0];if(n===2&&(v.innerHTML=""),(_||m)&&x(v),!l&&!c)return;let q=ui[F=v.getAttribute(O)]||(ui[F]=new Promise((H,W)=>{v.addEventListener("load",H),v.addEventListener("error",W)}));c&&(q=q.then(c)),l&&(q=q.catch(l)),q.catch(()=>{})});if(i&&d==="render"){const v=Ys[t][0];if(e[v]){const O=e[v],q=ui[O]||(ui[O]=new Promise((F,H)=>{x(h),h.addEventListener("load",F),h.addEventListener("error",H)}));J8(q)}}const k={tag:t,type:t,props:{...f,ref:S},ref:S};return k.p=n,h&&(k.e=h),G8(k,o)},e6=t=>{const e=M8(),n=e&&no(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:ws("title",t,void 0,!1,!1)},t6=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:ws("script",t,1,!1,!0),n6=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,ws("style",t,2,!0,!0)),r6=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}:ws("link",t,1,"precedence"in t,!0),i6=t=>ws("meta",t,void 0,!1,!1),B_=Symbol(),o6=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=X8([null,!1]),o=mf(async d=>{const f=d.isTrusted?e:d.detail[B_];if(typeof f!="function")return;d.preventDefault();const h=new FormData(d.target);i([h,!0]);const _=f(h);_ instanceof Promise&&(Q8(_),await _),i([null,!0])},[]),c=_f(t.ref,d=>(d.addEventListener("submit",o),()=>{d.removeEventListener("submit",o)})),[l,u]=r;return r[1]=!1,{tag:Z8,props:{value:{pending:l!==null,data:l,method:l?"post":null,action:l?e:null},children:{tag:"form",props:{...n,ref:c},type:"form",ref:c}},f:u}},j_=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=mf(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[B_]:e}}))},[]);n.ref=_f(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},s6=t=>j_("input",t),a6=t=>j_("button",t);Object.assign(Bd,{title:e6,script:t6,style:n6,link:r6,meta:i6,form:o6,input:s6,button:a6});new TextEncoder;const ml=t=>{const{i18nKey:e,values:n,components:r}=t,i=U.t(e,n),o=/<(\d+)>(.*?)<\/\d+>/g,c=[];let l=0,u;for(;(u=o.exec(i))!==null;){const[,d,f]=u,h=i.substring(l,u.index);h&&c.push(h);const _=parseInt(d,10);c.push(I8(r[_],{},f)),l=o.lastIndex}return l<i.length&&c.push(i.substring(l)),A(gf,{children:c})},Ig=6,Fd=({error:t,vendorSettings:e,email:n,state:r,client:i,hasPasswordLogin:o})=>{const c=new URLSearchParams({state:r}),u=i.connections.map(({name:d})=>d).includes("auth2");return A(dt,{title:U.t("verify_your_email"),vendorSettings:e,children:[A("div",{className:"mb-4 text-2xl font-medium",children:U.t("verify_your_email")}),A("div",{className:"mb-8 text-gray-300",children:A(ml,{i18nKey:"code_sent_template",components:[A("span",{className:"text-black dark:text-white"},"span")],values:{username:n}})}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{className:"pt-2",children:[A("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Ig,inputMode:"numeric",name:"code",placeholder:"******",className:_r("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:Ig,required:!0,id:"code-input"}),t&&A(oi,{children:t}),A(at,{className:"sm:mt-4 !text-base",children:[A("span",{children:U.t("login")}),A(st,{className:"text-xs",name:"arrow-right"})]}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]}),u&&A("div",{className:"text-center mb-12",children:[A("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[A("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),A("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:U.t("or")})]}),A(at,{Component:"a",href:`/u/${o?"enter-password":"pre-signup"}?${c.toString()}`,variant:"secondary",className:"block",children:U.t("enter_your_password_btn")})]})]}),A(ln,{state:r})]})]})},yr=t=>{const{message:e,vendorSettings:n,pageTitle:r,state:i}=t;return A(dt,{title:"Login",vendorSettings:n,children:[r?A("div",{className:"mb-6 text-gray-300",children:r}):"",A("div",{className:"flex flex-1 flex-col justify-center",children:e}),i?A(ln,{state:i}):""]})},c6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:s.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i;try{if({vendorSettings:n,loginSession:r,client:i}=await Je(t,e),!r.authParams.username)return t.html(A(yr,{vendorSettings:n,state:e,pageTitle:U.t("error_page_title")||"Error",message:U.t("username_not_found_error")||"Username not found in session."}),400);const o=await Ao({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:r.authParams.username,provider:"auth2"});return t.html(A(Fd,{vendorSettings:n,email:r.authParams.username,state:e,client:i,hasPasswordLogin:!!o}))}catch(o){return console.error("Error in GET /u/enter-code:",o),n||(n={styles:"",disable_signup:!1,disable_connection_signup:!1,domains:[],client:{id:"",tenant:{id:""}}}),t.html(A(yr,{vendorSettings:n,state:e,pageTitle:U.t("error_page_title")||"Error",message:U.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var c;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{vendorSettings:r,client:i,loginSession:o}=await Je(t,e);if(!o.authParams.username)throw new P(400,{message:U.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",i.id);const l=await sf(t,{client_id:i.id,authParams:o.authParams,username:o.authParams.username,otp:n});if(l instanceof Response)return l;throw new P(500,{message:U.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(l){let u;try{u=await Ao({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:o.authParams.username,provider:"auth2"})}catch{u=null}return t.html(A(Fd,{vendorSettings:r,email:(c=o.authParams)==null?void 0:c.username,state:e,client:i,error:l.message,hasPasswordLogin:!!u}),400)}}),L_=t=>{const{vendorSettings:e,state:n}=t;return A(dt,{title:U.t("unverified_email"),vendorSettings:e,children:[A("div",{className:"flex flex-1 flex-col justify-center",children:[A("p",{className:"mb-8 text-gray-300 text-lg",children:U.t("unverified_email")}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]}),A(ln,{state:n})]}),A(ln,{state:n})]})},l6=({width:t=22,height:e=17})=>A("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:A("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"})}),u6=({width:t=23,height:e=18})=>A("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:A("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"})}),Ud=({name:t,placeholder:e=U.t("password")})=>A("div",{className:"password-input relative mb-2",children:[A("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}),A("button",{type:"button","aria-label":U.t("show_password"),title:U.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:A(l6,{})}),A("button",{type:"button","aria-label":U.t("hide_password"),title:U.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:A(u6,{})})]});var Tg=Object.freeze,d6=Object.defineProperty,p6=(t,e)=>Tg(d6(t,"raw",{value:Tg(t.slice())})),Og;const ho=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t,o=new URLSearchParams({state:i});return A(dt,{title:U.t("enter_password"),vendorSettings:n,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("enter_password")}),A("div",{className:"mb-6 text-gray-300",children:U.t("enter_password_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{className:"mb-7",children:[A("input",{type:"text",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r}),A(Ud,{name:"password"}),e&&A(oi,{children:e}),A(at,{className:"sm:mt-4 !text-base",children:[A("span",{children:U.t("login")}),A(st,{className:"text-xs",name:"arrow-right"})]})]}),A("a",{href:`/u/forgot-password?${o.toString()}`,className:"text-primary hover:underline mb-4",children:U.t("forgot_password_link")}),A("div",{className:"text-center mb-12",children:[A("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[A("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),A("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:U.t("or")})]}),A("form",{method:"post",action:`/u/login/identifier?${o.toString()}`,children:[A("input",{type:"hidden",name:"login_selection",value:"code"}),A("input",{type:"hidden",name:"username",value:r}),A(at,{variant:"secondary",className:"block",children:U.t("enter_a_code_btn")})]})]}),A(ln,{state:i})]}),m_(Og||(Og=p6([`
224
+ c2.7,4.1,6.5,6.6,10.9,6.6c4,0,7.2-2,9.6-5.2c0.9-1.2,0.9-2.5,0-3.1C33.3,22.9,32.1,23.2,31.2,24.4z`})]}),ea=({error:t,vendorSettings:e,loginSession:n,email:r,client:i})=>{const o=i.connections.map(({strategy:O})=>O),c=o.includes("email")||o.includes("Username-Password-Authentication"),l=o.includes("sms"),u=o.includes("facebook"),d=o.includes("google-oauth2"),f=o.includes("apple"),h=o.includes("vipps"),_=u||d||f||h,$=c||l;let m="text",x="username";const S=c&&l?"email_or_phone_placeholder":c?"email_placeholder":"phone_placeholder";let k=U.t(S,c&&l?"Email or Phone Number":c?"Email Address":"Phone Number");return A(dt,{title:U.t("welcome"),vendorSettings:e,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("welcome")}),A("div",{className:"mb-8 text-gray-300",children:U.t("login_description_template",{authMethod:U.t(S,{defaultValue:c&&l?"email or phone number":c?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),A("div",{className:"flex flex-1 flex-col justify-center",children:[$&&A(Jn,{className:"mb-7",children:[A("input",{type:m,name:x,placeholder:k,className:_r("mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),required:!0,value:r||""}),t&&A(oi,{children:t}),A(at,{className:"sm:mt-4 !text-base",children:[A("span",{children:U.t("continue")}),A(st,{className:"text-xs",name:"arrow-right"})]})]}),$&&_&&A("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[A("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),A("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:U.t("continue_social_login")})]}),A("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:[u&&A(po,{connection:"facebook",text:U.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:A(st,{className:"text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"facebook"}),loginSession:n}),d&&A(po,{connection:"google-oauth2",text:U.t("continue_with",{provider:"Google"}),canResize:!0,icon:A(I_,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n}),f&&A(po,{connection:"apple",text:U.t("continue_with",{provider:"Apple"}),canResize:!0,icon:A(st,{className:"text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"apple"}),loginSession:n}),h&&A(po,{connection:"vipps",text:U.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:A(T_,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:n})]})]})]})},L8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:s.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r,client:i}=await Je(t,e);return t.html(A(ea,{vendorSettings:n,loginSession:r,client:i,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({username:s.z.string().transform(t=>t.toLowerCase()),login_selection:s.z.enum(["code","password"]).optional()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form");t.set("body",r),t.set("username",r.username);const{client:i,loginSession:o,vendorSettings:c}=await Je(t,n);t.set("client_id",i.id);const l=t.get("countryCode"),u=c.country,{normalized:d,connectionType:f}=gl(r.username,u||l);if(!d)return t.html(A(ea,{vendorSettings:c,loginSession:o,error:U.t("invalid_identifier"),email:r.username,client:i}),400);const h=await Ao({userAdapter:e.data.users,tenant_id:i.tenant.id,username:d,provider:f});if(h&&t.set("user_id",h.user_id),!h)try{await bb(t,i,t.env.data,d)}catch{const S=qe(t,{type:Fe.FAILED_SIGNUP,description:"Public signup is disabled"});return Pt(t,t.env.data.logs.create(i.tenant.id,S)),t.html(A(ea,{vendorSettings:c,loginSession:o,error:U.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(o.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,o.id,o),await T8(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let _=Yr(),$=await e.data.codes.get(i.tenant.id,_,"otp");for(;$;)_=Yr(),$=await e.data.codes.get(i.tenant.id,_,"otp");const m=await t.env.data.codes.create(i.tenant.id,{code_id:_,code_type:"otp",login_id:o.id,expires_at:new Date(Date.now()+qs).toISOString(),redirect_uri:o.authParams.redirect_uri}),x=i.connections.find(S=>S.strategy===f);if(!x)throw new P(400,{message:U.t("connection_not_found",{connection:f})});return f==="email"&&x.options.authentication_method==="magic_link"?await uf(t,{to:d,code:m.code_id,authParams:o.authParams}):await p_(t,{to:d,code:m.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),ln=t=>A("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:U.t("go_back")});var Mo="_hp",F8={Change:"Input",DoubleClick:"DblClick"},U8={svg:"2000/svg",math:"1998/Math/MathML"},qo=[],jd=new WeakMap,Fi=void 0,M8=()=>Fi,In=t=>"t"in t,Vl={onClick:["click",!1]},xg=t=>{if(!t.startsWith("on"))return;if(Vl[t])return Vl[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return Vl[t]=[(F8[n]||n).toLowerCase(),!!r]}},$g=(t,e)=>Fi&&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,q8=(t,e,n)=>{var r;e||(e={});for(let i in e){const o=e[i];if(i!=="children"&&(!n||n[i]!==o)){i=ec(i);const c=xg(i);if(c){if((n==null?void 0:n[i])!==o&&(n&&t.removeEventListener(c[0],n[i],c[1]),o!=null)){if(typeof o!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(c[0],o,c[1])}}else if(i==="dangerouslySetInnerHTML"&&o)t.innerHTML=o.__html;else if(i==="ref"){let l;typeof o=="function"?l=o(t)||(()=>o(null)):o&&"current"in o&&(o.current=t,l=()=>o.current=null),jd.set(t,l)}else if(i==="style"){const l=t.style;typeof o=="string"?l.cssText=o:(l.cssText="",o!=null&&$_(o,l.setProperty.bind(l)))}else{if(i==="value"){const u=t.nodeName;if(u==="INPUT"||u==="TEXTAREA"||u==="SELECT"){if(t.value=o==null||o===!1?null:o,u==="TEXTAREA"){t.textContent=o;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]=o);const l=$g(t,i);o==null||o===!1?t.removeAttribute(l):o===!0?t.setAttribute(l,""):typeof o=="string"||typeof o=="number"?t.setAttribute(l,o):t.setAttribute(l,o.toString())}}}if(n)for(let i in n){const o=n[i];if(i!=="children"&&!(i in e)){i=ec(i);const c=xg(i);c?t.removeEventListener(c[0],o,c[1]):i==="ref"?(r=jd.get(t))==null||r():t.removeAttribute($g(t,i))}}},V8=(t,e)=>{e[Qe][0]=0,qo.push([t,e]);const n=e.tag[pf]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{qo.pop()}},O_=(t,e,n,r,i)=>{var o,c;(o=t.vR)!=null&&o.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((c=t[Qe][1][P_])==null||c.forEach(l=>i.push(l))),t.vC.forEach(l=>{var u;if(In(l))n.push(l);else if(typeof l.tag=="function"||l.tag===""){l.c=e;const d=n.length;if(O_(l,e,n,r,i),l.s){for(let f=d;f<n.length;f++)n[f].s=!0;l.s=!1}}else n.push(l),(u=l.vR)!=null&&u.length&&(r.push(...l.vR),delete l.vR)})},H8=t=>{for(;;t=t.tag===Mo||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==Mo&&t.e)return t.e}},z_=t=>{var e,n,r,i,o,c;In(t)||((n=(e=t[Qe])==null?void 0:e[1][P_])==null||n.forEach(l=>{var u;return(u=l[2])==null?void 0:u.call(l)}),(r=jd.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(l=>l.p=2)),(o=t.vC)==null||o.forEach(z_)),t.p||((c=t.e)==null||c.remove(),delete t.e),typeof t.tag=="function"&&(fo.delete(t),ta.delete(t),delete t[Qe][3],t.a=!0)},D_=(t,e,n)=>{t.c=e,R_(t,e,n)},Ag=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},kg=Symbol(),R_=(t,e,n)=>{var d;const r=[],i=[],o=[];O_(t,e,r,i,o),i.forEach(z_);const c=n?void 0:e.childNodes;let l,u=null;if(n)l=-1;else if(!c.length)l=0;else{const f=Ag(c,H8(t.nN));f!==void 0?(u=c[f],l=f):l=Ag(c,(d=r.find(h=>h.tag!==Mo&&h.e))==null?void 0:d.e)??-1,l===-1&&(n=!0)}for(let f=0,h=r.length;f<h;f++,l++){const _=r[f];let $;if(_.s&&_.e)$=_.e,_.s=!1;else{const m=n||!_.e;In(_)?(_.e&&_.d&&(_.e.textContent=_.t),_.d=!1,$=_.e||(_.e=document.createTextNode(_.t))):($=_.e||(_.e=_.n?document.createElementNS(_.n,_.tag):document.createElement(_.tag)),q8($,_.props,_.pP),R_(_,$,m))}_.tag===Mo?l--:n?$.parentNode||e.appendChild($):c[l]!==$&&c[l-1]!==$&&(c[l+1]===$?e.appendChild(c[l]):e.insertBefore($,u||c[l]||null))}if(t.pP&&delete t.pP,o.length){const f=[],h=[];o.forEach(([,_,,$,m])=>{_&&f.push(_),$&&h.push($),m==null||m()}),f.forEach(_=>_()),h.length&&requestAnimationFrame(()=>{h.forEach(_=>_())})}},ta=new WeakMap,Ld=(t,e,n)=>{var o,c,l,u,d,f;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?V8(t,e):ms(e.props.children)),((o=n[0])==null?void 0:o.tag)===""&&n[0][Pd]&&(i=n[0][Pd],t[5].push([t,i,e]));const h=r?[...e.pC]:e.vC?[...e.vC]:void 0,_=[];let $;for(let m=0;m<n.length;m++){Array.isArray(n[m])&&n.splice(m,1,...n[m].flat());let x=K8(n[m]);if(x){typeof x.tag=="function"&&!x.tag[y_]&&(Li.length>0&&(x[Qe][2]=Li.map(k=>[k,k.values.at(-1)])),(c=t[5])!=null&&c.length&&(x[Qe][3]=t[5].at(-1)));let S;if(h&&h.length){const k=h.findIndex(In(x)?v=>In(v):x.key!==void 0?v=>v.key===x.key&&v.tag===x.tag:v=>v.tag===x.tag);k!==-1&&(S=h[k],h.splice(k,1))}if(S)if(In(x))S.t!==x.t&&(S.t=x.t,S.d=!0),x=S;else{const k=S.pP=S.props;S.props=x.props,S.f||(S.f=x.f||e.f),typeof x.tag=="function"&&(S[Qe][2]=x[Qe][2]||[],S[Qe][3]=x[Qe][3],!S.f&&((S.o||S)===x.o||(u=(l=S.tag)[g8])!=null&&u.call(l,k,S.props))&&(S.s=!0)),x=S}else if(!In(x)&&Fi){const k=no(Fi);k&&(x.n=k)}if(!In(x)&&!x.s&&(Ld(t,x),delete x.f),_.push(x),$&&!$.s&&!x.s)for(let k=$;k&&!In(k);k=(d=k.vC)==null?void 0:d.at(-1))k.nN=x;$=x}}e.vR=r?[...e.vC,...h||[]]:h||[],e.vC=_,r&&delete e.pC}catch(h){if(e.f=!0,h===kg){if(i)return;throw h}const[_,$,m]=((f=e[Qe])==null?void 0:f[3])||[];if($){const x=()=>na([0,!1,t[2]],m),S=ta.get(m)||[];S.push(x),ta.set(m,S);const k=$(h,()=>{const v=ta.get(m);if(v){const O=v.indexOf(x);if(O!==-1)return v.splice(O,1),x()}});if(k){if(t[0]===1)t[1]=!0;else if(Ld(t,m,[k]),($.length===1||t!==_)&&m.c){D_(m,m.c,!1);return}throw kg}}throw h}finally{i&&t[5].pop()}},K8=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[Qe]=[0,[]];else{const e=U8[t.tag];e&&(Fi||(Fi=v_("")),t.props.children=[{tag:Fi,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},Eg=(t,e)=>{var n,r;(n=e[Qe][2])==null||n.forEach(([i,o])=>{i.values.push(o)});try{Ld(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Qe][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&D_(e,e.c,!1)},fo=new WeakMap,Sg=[],na=async(t,e)=>{t[5]||(t[5]=[]);const n=fo.get(e);n&&n[0](void 0);let r;const i=new Promise(o=>r=o);if(fo.set(e,[r,()=>{t[2]?t[2](t,e,o=>{Eg(o,e)}).then(()=>r(e)):(Eg(t,e),r(e))}]),Sg.length)Sg.at(-1).add(e);else{await Promise.resolve();const o=fo.get(e);o&&(fo.delete(e),o[1]())}return i},G8=(t,e,n)=>({tag:Mo,props:{children:t},key:n,e,p:1}),Hl=0,P_=1,Kl=2,Gl=3,Wl=new WeakMap,B_=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),W8=void 0,Ng=[],X8=t=>{var c;const e=()=>typeof t=="function"?t():t,n=qo.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(c=r[Qe][1])[Hl]||(c[Hl]=[]),o=r[Qe][0]++;return i[o]||(i[o]=[e(),l=>{const u=W8,d=i[o];if(typeof l=="function"&&(l=l(d[0])),!Object.is(l,d[0]))if(d[0]=l,Ng.length){const[f,h]=Ng.at(-1);Promise.all([f===3?r:na([f,!1,u],r),h]).then(([_])=>{if(!_||!(f===2||f===3))return;const $=_.vC;requestAnimationFrame(()=>{setTimeout(()=>{$===_.vC&&na([f===3?1:0,!1,u],_)})})})}else na([0,!1,u],r)}])},mf=(t,e)=>{var l;const n=qo.at(-1);if(!n)return t;const[,r]=n,i=(l=r[Qe][1])[Kl]||(l[Kl]=[]),o=r[Qe][0]++,c=i[o];return B_(c==null?void 0:c[1],e)?i[o]=[t,e]:t=i[o][0],t},J8=t=>{const e=Wl.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>Wl.set(t,[n]),n=>Wl.set(t,[void 0,n])),t},Y8=(t,e)=>{var l;const n=qo.at(-1);if(!n)return t();const[,r]=n,i=(l=r[Qe][1])[Gl]||(l[Gl]=[]),o=r[Qe][0]++,c=i[o];return B_(c==null?void 0:c[1],e)&&(i[o]=[t(),e]),i[o][0]},Z8=v_({pending:!1,data:null,method:null,action:null}),Cg=new Set,Q8=t=>{Cg.add(t),t.finally(()=>Cg.delete(t))},_f=(t,e)=>Y8(()=>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]),ui=Object.create(null),Ds=Object.create(null),ws=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const o=document.head;let{onLoad:c,onError:l,precedence:u,blocking:d,...f}=e,h=null,_=!1;const $=Ys[t];let m;if($.length>0){const v=o.querySelectorAll(t);e:for(const O of v)for(const q of Ys[t])if(O.getAttribute(q)===e[q]){h=O;break e}if(!h){const O=$.reduce((q,F)=>e[F]===void 0?q:`${q}-${F}-${e[F]}`,t);_=!Ds[O],h=Ds[O]||(Ds[O]=(()=>{const q=document.createElement(t);for(const F of $)e[F]!==void 0&&q.setAttribute(F,e[F]),e.rel&&q.setAttribute("rel",e.rel);return q})())}}else m=o.querySelectorAll(t);u=r?u??"":void 0,r&&(f[Zs]=u);const x=mf(v=>{if($.length>0){let O=!1;for(const q of o.querySelectorAll(t)){if(O&&q.getAttribute(Zs)!==u){o.insertBefore(v,q);return}q.getAttribute(Zs)===u&&(O=!0)}o.appendChild(v)}else if(m){let O=!1;for(const q of m)if(q===v){O=!0;break}O||o.insertBefore(v,o.contains(m[0])?m[0]:o.querySelector(t)),m=void 0}},[u]),S=_f(e.ref,v=>{var F;const O=$[0];if(n===2&&(v.innerHTML=""),(_||m)&&x(v),!l&&!c)return;let q=ui[F=v.getAttribute(O)]||(ui[F]=new Promise((H,W)=>{v.addEventListener("load",H),v.addEventListener("error",W)}));c&&(q=q.then(c)),l&&(q=q.catch(l)),q.catch(()=>{})});if(i&&d==="render"){const v=Ys[t][0];if(e[v]){const O=e[v],q=ui[O]||(ui[O]=new Promise((F,H)=>{x(h),h.addEventListener("load",F),h.addEventListener("error",H)}));J8(q)}}const k={tag:t,type:t,props:{...f,ref:S},ref:S};return k.p=n,h&&(k.e=h),G8(k,o)},e6=t=>{const e=M8(),n=e&&no(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:ws("title",t,void 0,!1,!1)},t6=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:ws("script",t,1,!1,!0),n6=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,ws("style",t,2,!0,!0)),r6=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}:ws("link",t,1,"precedence"in t,!0),i6=t=>ws("meta",t,void 0,!1,!1),j_=Symbol(),o6=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=X8([null,!1]),o=mf(async d=>{const f=d.isTrusted?e:d.detail[j_];if(typeof f!="function")return;d.preventDefault();const h=new FormData(d.target);i([h,!0]);const _=f(h);_ instanceof Promise&&(Q8(_),await _),i([null,!0])},[]),c=_f(t.ref,d=>(d.addEventListener("submit",o),()=>{d.removeEventListener("submit",o)})),[l,u]=r;return r[1]=!1,{tag:Z8,props:{value:{pending:l!==null,data:l,method:l?"post":null,action:l?e:null},children:{tag:"form",props:{...n,ref:c},type:"form",ref:c}},f:u}},L_=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=mf(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[j_]:e}}))},[]);n.ref=_f(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},s6=t=>L_("input",t),a6=t=>L_("button",t);Object.assign(Bd,{title:e6,script:t6,style:n6,link:r6,meta:i6,form:o6,input:s6,button:a6});new TextEncoder;const ml=t=>{const{i18nKey:e,values:n,components:r}=t,i=U.t(e,n),o=/<(\d+)>(.*?)<\/\d+>/g,c=[];let l=0,u;for(;(u=o.exec(i))!==null;){const[,d,f]=u,h=i.substring(l,u.index);h&&c.push(h);const _=parseInt(d,10);c.push(I8(r[_],{},f)),l=o.lastIndex}return l<i.length&&c.push(i.substring(l)),A(gf,{children:c})},Ig=6,Fd=({error:t,vendorSettings:e,email:n,state:r,client:i,hasPasswordLogin:o})=>{const c=new URLSearchParams({state:r}),u=i.connections.map(({name:d})=>d).includes("auth2");return A(dt,{title:U.t("verify_your_email"),vendorSettings:e,children:[A("div",{className:"mb-4 text-2xl font-medium",children:U.t("verify_your_email")}),A("div",{className:"mb-8 text-gray-300",children:A(ml,{i18nKey:"code_sent_template",components:[A("span",{className:"text-black dark:text-white"},"span")],values:{username:n}})}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{className:"pt-2",children:[A("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Ig,inputMode:"numeric",name:"code",placeholder:"******",className:_r("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:Ig,required:!0,id:"code-input"}),t&&A(oi,{children:t}),A(at,{className:"sm:mt-4 !text-base",children:[A("span",{children:U.t("login")}),A(st,{className:"text-xs",name:"arrow-right"})]}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]}),u&&A("div",{className:"text-center mb-12",children:[A("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[A("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),A("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:U.t("or")})]}),A(at,{Component:"a",href:`/u/${o?"enter-password":"pre-signup"}?${c.toString()}`,variant:"secondary",className:"block",children:U.t("enter_your_password_btn")})]})]}),A(ln,{state:r})]})]})},yr=t=>{const{message:e,vendorSettings:n,pageTitle:r,state:i}=t;return A(dt,{title:"Login",vendorSettings:n,children:[r?A("div",{className:"mb-6 text-gray-300",children:r}):"",A("div",{className:"flex flex-1 flex-col justify-center",children:e}),i?A(ln,{state:i}):""]})},c6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:s.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i;try{if({vendorSettings:n,loginSession:r,client:i}=await Je(t,e),!r.authParams.username)return t.html(A(yr,{vendorSettings:n,state:e,pageTitle:U.t("error_page_title")||"Error",message:U.t("username_not_found_error")||"Username not found in session."}),400);const o=await Ao({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:r.authParams.username,provider:"auth2"});return t.html(A(Fd,{vendorSettings:n,email:r.authParams.username,state:e,client:i,hasPasswordLogin:!!o}))}catch(o){return console.error("Error in GET /u/enter-code:",o),n||(n={styles:"",disable_signup:!1,disable_connection_signup:!1,domains:[],client:{id:"",tenant:{id:""}}}),t.html(A(yr,{vendorSettings:n,state:e,pageTitle:U.t("error_page_title")||"Error",message:U.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var c;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{vendorSettings:r,client:i,loginSession:o}=await Je(t,e);if(!o.authParams.username)throw new P(400,{message:U.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",i.id);const l=await sf(t,{client_id:i.id,authParams:o.authParams,username:o.authParams.username,otp:n});if(l instanceof Response)return l;throw new P(500,{message:U.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(l){let u;try{u=await Ao({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:o.authParams.username,provider:"auth2"})}catch{u=null}return t.html(A(Fd,{vendorSettings:r,email:(c=o.authParams)==null?void 0:c.username,state:e,client:i,error:l.message,hasPasswordLogin:!!u}),400)}}),F_=t=>{const{vendorSettings:e,state:n}=t;return A(dt,{title:U.t("unverified_email"),vendorSettings:e,children:[A("div",{className:"flex flex-1 flex-col justify-center",children:[A("p",{className:"mb-8 text-gray-300 text-lg",children:U.t("unverified_email")}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]}),A(ln,{state:n})]}),A(ln,{state:n})]})},l6=({width:t=22,height:e=17})=>A("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:A("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"})}),u6=({width:t=23,height:e=18})=>A("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:A("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"})}),Ud=({name:t,placeholder:e=U.t("password")})=>A("div",{className:"password-input relative mb-2",children:[A("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}),A("button",{type:"button","aria-label":U.t("show_password"),title:U.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:A(l6,{})}),A("button",{type:"button","aria-label":U.t("hide_password"),title:U.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:A(u6,{})})]});var Tg=Object.freeze,d6=Object.defineProperty,p6=(t,e)=>Tg(d6(t,"raw",{value:Tg(t.slice())})),Og;const ho=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t,o=new URLSearchParams({state:i});return A(dt,{title:U.t("enter_password"),vendorSettings:n,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("enter_password")}),A("div",{className:"mb-6 text-gray-300",children:U.t("enter_password_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{className:"mb-7",children:[A("input",{type:"text",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r}),A(Ud,{name:"password"}),e&&A(oi,{children:e}),A(at,{className:"sm:mt-4 !text-base",children:[A("span",{children:U.t("login")}),A(st,{className:"text-xs",name:"arrow-right"})]})]}),A("a",{href:`/u/forgot-password?${o.toString()}`,className:"text-primary hover:underline mb-4",children:U.t("forgot_password_link")}),A("div",{className:"text-center mb-12",children:[A("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[A("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),A("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:U.t("or")})]}),A("form",{method:"post",action:`/u/login/identifier?${o.toString()}`,children:[A("input",{type:"hidden",name:"login_selection",value:"code"}),A("input",{type:"hidden",name:"username",value:r}),A(at,{variant:"secondary",className:"block",children:U.t("enter_a_code_btn")})]})]}),A(ln,{state:i})]}),__(Og||(Og=p6([`
225
225
  <script>
226
226
  // Show password toggle
227
227
  var passwordInputs = document.querySelectorAll(".password-input");
@@ -245,7 +245,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
245
245
  });
246
246
  });
247
247
  <\/script>
248
- `])))]})},f6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await Je(t,e);if(!i.authParams.username)throw new P(400,{message:"Username required"});return t.html(A(ho,{vendorSettings:n,email:i.authParams.username,state:e,client:r}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string()})}}}},responses:{200:{description:"HTML page indicating success or a next step (if not redirecting).",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent).",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid password, username required).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{password:r}=n,{vendorSettings:i,client:o,loginSession:c}=await Je(t,e),{username:l}=c.authParams;if(!l)throw new P(400,{message:"Username required"});try{const u=await f_(t,o,{...c.authParams,password:r},c);return u instanceof Response?u:(console.error("Unexpected TokenResponse in POST /u/enter-password. This might indicate a flow misconfiguration as this route expects HTML or redirect.",u),t.html(A(ho,{vendorSettings:i,email:l,error:"An unexpected error occurred. Please try again.",state:e,client:o}),500))}catch(u){const d=u;return d.code==="INVALID_PASSWORD"||d.code==="USER_NOT_FOUND"?t.html(A(ho,{vendorSettings:i,email:l,error:U.t("invalid_password"),state:e,client:o}),400):d.code==="EMAIL_NOT_VERIFIED"?t.html(A(L_,{vendorSettings:i,state:e}),400):t.html(A(ho,{vendorSettings:i,email:l,error:d.message||"An unknown error occurred.",state:e,client:o}),d.code?400:500)}}),Cr=t=>{const{state:e,error:n,vendorSettings:r,email:i,code:o}=t;return A(dt,{title:U.t("create_account_title"),vendorSettings:r,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("create_account_title")}),A("div",{className:"mb-6 text-gray-300",children:U.t("create_account_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{children:[A("input",{type:"hidden",name:"code",value:o}),A("input",{type:"email",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:i,disabled:!!i}),A("input",{type:"password",name:"password",placeholder:U.t("enter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),A("input",{type:"password",name:"re-enter-password",placeholder:U.t("reenter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),n&&A(oi,{children:n}),A(at,{className:"sm:mt-4 !text-base",children:U.t("continue")})]}),A(ln,{state:e})]})]})},h6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().optional().openapi({description:"The code parameter from an email verification link"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{vendorSettings:r,loginSession:i}=await Je(t,e),{username:o}=i.authParams;if(!o)throw new P(400,{message:"Username required"});return n?t.html(A(Cr,{state:e,vendorSettings:r,email:o,code:n})):t.html(A(Cr,{state:e,vendorSettings:r,email:o}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string(),code:s.z.string().optional()})}}}},responses:{200:{description:"HTML page indicating success (e.g., email verification sent) or a next step.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent) after successful login.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., passwords don't match, weak password, user exists).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{env:r}=t,{vendorSettings:i,client:o,loginSession:c}=await Je(t,e);try{if(!c.authParams.username)throw new P(400,{message:"Username required"});const l="Username-Password-Authentication";if(t.set("connection",l),n.password!==n["re-enter-password"])return t.html(A(Cr,{state:e,code:n.code,vendorSettings:i,error:U.t("create_account_passwords_didnt_match"),email:c.authParams.username}),400);if(!lf(n.password))return t.html(A(Cr,{state:e,code:n.code,vendorSettings:i,error:U.t("create_account_weak_password"),email:c.authParams.username}),400);const u=n.code?await r.data.codes.get(o.tenant.id,n.code,"email_verification"):void 0,d=u?await r.data.loginSessions.get(o.tenant.id,u.login_id):void 0;if(await Hi({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:c.authParams.username,provider:"auth2"}))return t.html(A(Cr,{state:e,code:n.code,vendorSettings:i,error:U.t("user_exists_error"),email:c.authParams.username}),400);const h=(d==null?void 0:d.authParams.username)===c.authParams.username,_=`auth2|${fc()}`,$=await r.data.users.create(o.tenant.id,{user_id:_,email:c.authParams.username,email_verified:h,provider:"auth2",connection:l,is_social:!1});if(await r.data.passwords.create(o.tenant.id,{user_id:_,password:await Go.hash(n.password,10),algorithm:"bcrypt"}),!h)return await df(t,$),t.html(A(yr,{message:U.t("validate_email_body"),pageTitle:U.t("validate_email_title"),vendorSettings:i,state:e}));const m=await p_(t,o,{...c.authParams,password:n.password},c);return xr(t,m)}catch(l){let u=U.t("unknown_error_message"),d=400;return l instanceof P?(u=l.message||u,d=l.status===400?400:500):l instanceof gi?u=l.message||u:l instanceof Error&&(u=l.message||u,d=500),t.html(A(Cr,{state:e,vendorSettings:i,error:u,email:c.authParams.username,code:n.code}),d)}}),mi=t=>{const{error:e,vendorSettings:n,email:r}=t;return A(dt,{title:U.t("reset_password_title"),vendorSettings:n,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("reset_password_title")}),A("div",{className:"mb-6 text-gray-300",children:`${U.t("reset_password_description")} ${r}`}),A("div",{className:"flex flex-1 flex-col justify-center",children:A(Jn,{children:[A(Ud,{name:"password",placeholder:U.t("enter_new_password_placeholder")}),A(Ud,{name:"re-enter-password",placeholder:U.t("reenter_new_password_placeholder")}),e&&A(oi,{children:e}),A(at,{className:"sm:mt-4 !text-base",children:U.t("reset_password_cta")})]})})]})},g6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e);if(!r.authParams.username)throw new P(400,{message:"Username required"});return t.html(A(mi,{vendorSettings:n,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{password:r,"re-enter-password":i}=t.req.valid("form"),{env:o}=t,{vendorSettings:c,client:l,loginSession:u}=await Je(t,e);if(!u.authParams.username)throw new P(400,{message:"Username required"});if(r!==i)return t.html(A(mi,{error:U.t("create_account_passwords_didnt_match"),vendorSettings:c,email:u.authParams.username}),400);if(!lf(r))return t.html(A(mi,{error:U.t("create_account_weak_password"),vendorSettings:c,email:u.authParams.username}),400);const d=await Hi({userAdapter:o.data.users,tenant_id:l.tenant.id,username:u.authParams.username,provider:"auth2"});if(!d)throw new P(400,{message:"User not found"});try{if(!await o.data.codes.get(l.tenant.id,n,"password_reset"))return t.html(A(mi,{error:"Code not found or expired",vendorSettings:c,email:u.authParams.username}),400);const h={user_id:d.user_id,password:await Go.hash(r,10),algorithm:"bcrypt"};await o.data.passwords.get(l.tenant.id,d.user_id)?await o.data.passwords.update(l.tenant.id,h):await o.data.passwords.create(l.tenant.id,h),d.email_verified||await o.data.users.update(l.tenant.id,d.user_id,{email_verified:!0})}catch{return t.html(A(mi,{error:"The password could not be reset",vendorSettings:c,email:u.authParams.username}),400)}return t.html(A(yr,{message:U.t("password_has_been_reset"),vendorSettings:c,state:e}))}),F_=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t;return A(dt,{title:U.t("forgot_password_title"),vendorSettings:n,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("forgot_password_title")}),A("div",{className:"mb-6 text-gray-300",children:U.t("forgot_password_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{className:"pt-2",children:[A("input",{type:"email",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r,disabled:!!r}),e&&A(oi,{children:e}),A(at,{className:"sm:mt-4 !text-base",children:U.t("forgot_password_cta")})]}),A(ln,{state:i})]})]})},U_=t=>{const{vendorSettings:e,state:n}=t;return A(dt,{title:"Login",vendorSettings:e,children:[A("div",{className:"flex flex-1 flex-col justify-center",children:[A("div",{children:U.t("forgot_password_email_sent")}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]})]}),A(ln,{state:n})]})},m6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e);return t.html(A(F_,{vendorSettings:n,state:e,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await Je(t,e);return await r8(t,r,i.authParams.username,i.id),t.html(A(U_,{vendorSettings:n,state:e}))}),M_=({vendorSettings:t,state:e,user:n})=>A(dt,{title:$e("check_email_title"),vendorSettings:t,children:A("div",{className:"flex flex-1 flex-col justify-center",children:[A("div",{className:"mb-8 text-gray-700 dark:text-gray-300",children:[A(ml,{i18nKey:"currently_logged_in_as",components:[A("span",{className:"font-semibold text-gray-900 dark:text-white"},"span")],values:{email:n.email||""}}),A("br",{}),$e("continue_with_sso_provider_headline")]}),A("div",{className:"space-y-6",children:[A(Jn,{children:A(at,{className:"!text-base",children:A("span",{children:U.t("yes_continue_with_existing_account")})})}),A("a",{className:"block text-center text-primary hover:text-primaryHover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 dark:focus:ring-offset-gray-900",href:`/u/login/identifier?state=${encodeURIComponent(e)}`,children:U.t("no_use_another")})]})]})}),_6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page to check account status or verify email.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login identifier page if no valid session.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var u;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i}=await Je(t,n);if(!i||!((u=i.tenant)!=null&&u.id))return console.error("Client or tenant ID missing in GET /u/check-account after initJSXRoute"),t.html(A(yr,{vendorSettings:r,state:n,pageTitle:U.t("error_page_title")||"Error",message:U.t("configuration_error_message")||"A configuration error occurred."}),500);const o=fa(i.tenant.id,t.req.header("cookie")),c=o?await e.data.sessions.get(i.tenant.id,o):null;if(!c)return t.redirect(`/u/login/identifier?state=${n}`);const l=await e.data.users.get(i.tenant.id,c.user_id);return l?t.html(A(M_,{vendorSettings:r,state:n,user:l})):t.redirect(`/u/login/identifier?state=${n}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow or to login identifier.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues or if TokenResponse is returned.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var f;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i,loginSession:o}=await Je(t,n);if(!i||!((f=i.tenant)!=null&&f.id))return console.error("Client or tenant ID missing in POST /u/check-account after initJSXRoute"),t.html(A(yr,{vendorSettings:r,state:n,pageTitle:U.t("error_page_title")||"Error",message:U.t("configuration_error_message")}),500);const c=fa(i.tenant.id,t.req.header("cookie")),l=c?await e.data.sessions.get(i.tenant.id,c):null;if(!l)return t.redirect(`/u/login/identifier?state=${n}`);const u=await e.data.users.get(i.tenant.id,l.user_id);if(!u)return t.redirect(`/u/login/identifier?state=${n}`);const d=await xr(t,{user:u,authParams:o.authParams,client:i,loginSession:o});if(!(d instanceof Response))throw new P(500,{message:U.t("unexpected_error_try_again")});return d}),q_=t=>{const{vendorSettings:e,email:n,state:r}=t;return A(dt,{title:U.t("create_password_account_title"),vendorSettings:e,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("create_password_account_title")}),A("div",{className:"mb-6 text-gray-300",children:U.t("enter_email_for_verification_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:A(Jn,{className:"pt-2",children:[A("input",{type:"email",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:n,disabled:!0}),A(at,{className:"sm:mt-4 !text-base",children:U.t("send")})]})}),A(ln,{state:r})]})},y6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e),{username:i}=r.authParams;if(!i)throw new P(400,{message:"Username required"});return t.html(A(q_,{state:e,vendorSettings:n,email:i}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{loginSession:n,client:r}=await Je(t,e),{username:i}=n.authParams;if(!i)throw new P(400,{message:"Username required"});const o=await t.env.data.codes.create(r.tenant.id,{code_id:Yr(),code_type:"email_verification",login_id:n.id,expires_at:new Date(Date.now()+jw).toISOString()});return await e8(t,i,o.code_id,n.id),t.redirect(`/u/pre-signup-sent?state=${e}`)}),V_=t=>{const{redirectUrl:e,vendorSettings:n}=t;return A(dt,{title:U.t("invalid_session_title"),vendorSettings:n,children:[A("div",{className:"flex flex-1 flex-col justify-center",children:U.t("invalid_session_body")}),A("div",{className:"flex flex-1 flex-col justify-center",children:e&&A("a",{className:"block text-primary hover:text-primaryHover text-center",href:e,children:U.t("go_back")})})]})},w6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e);let i;return r.authParams.redirect_uri&&r.authParams.state&&(i=new URL(r.authParams.redirect_uri),i.searchParams.set("state",r.authParams.state),i.searchParams.set("error","invalid_session"),i.searchParams.set("error_description",r.authParams.username||"")),t.html(A(V_,{redirectUrl:i==null?void 0:i.href,vendorSettings:n}))}),v6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const e=await A_(t.env),{state:n}=t.req.valid("query");return t.html(A(yr,{message:"Not implemented",pageTitle:"User info",vendorSettings:e,state:n}))}),H_=({vendorSettings:t,state:e})=>{const n=new URLSearchParams({state:e});return A(dt,{title:U.t("email_validated"),vendorSettings:t,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("email_validated")}),A("div",{className:"flex flex-1 flex-col justify-center mb-7",children:A(at,{Component:"a",href:`/u/enter-password?${n}`,className:"text-base sm:mt-4 md:text-base",children:A("div",{className:"flex items-center space-x-2",children:[A("span",{children:U.t("email_validated_cta")}),A(st,{className:"text-xs",name:"arrow-right"})]})})})]})},b6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{var _;const{state:e,code:n}=t.req.valid("query"),{env:r}=t,{client:i,loginSession:o,vendorSettings:c}=await Je(t,e),{username:l}=o.authParams;if(!l)throw new P(400,{message:"Username not found in state"});const u=await Hi({userAdapter:r.data.users,tenant_id:i.tenant.id,username:l,provider:"auth2"});if(!u)throw new P(500,{message:"No user found"});if(!await r.data.codes.get(i.tenant.id,n,"email_verification"))throw new P(400,{message:"Code not found or expired"});await r.data.users.update(i.tenant.id,u.user_id,{email_verified:!0});const h=(await sp(r.data.users,i.tenant.id,l)).filter($=>$.provider!=="auth2");if(h.length>0){const $=h.filter(m=>!m.linked_to);$.length>1&&console.error("More than one primary user found for email",l),$.length===0&&console.error("No primary user found for email",l),$.length===1&&await r.data.users.update(i.tenant.id,u.user_id,{linked_to:(_=$[0])==null?void 0:_.user_id})}return t.html(A(H_,{vendorSettings:c,state:e}))}),K_=t=>{const{vendorSettings:e,email:n,state:r}=t;return A(dt,{title:U.t("email_verification_for_signup_sent_title"),vendorSettings:e,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("email_verification_for_signup_sent_title")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A("div",{className:"mb-6 text-gray-300",children:A(ml,{i18nKey:"email_verification_for_signup_sent_description",components:[A("span",{className:"text-black dark:text-white"},"span")],values:{email:n}})}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]})]}),A(ln,{state:r})]})},x6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e),{username:i}=r.authParams;if(!i)throw new P(400,{message:"Username required"});return t.html(A(K_,{vendorSettings:n,state:e,email:i}))}),yf=`
248
+ `])))]})},f6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await Je(t,e);if(!i.authParams.username)throw new P(400,{message:"Username required"});return t.html(A(ho,{vendorSettings:n,email:i.authParams.username,state:e,client:r}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string()})}}}},responses:{200:{description:"HTML page indicating success or a next step (if not redirecting).",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent).",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid password, username required).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{password:r}=n,{vendorSettings:i,client:o,loginSession:c}=await Je(t,e),{username:l}=c.authParams;if(!l)throw new P(400,{message:"Username required"});try{const u=await h_(t,o,{...c.authParams,password:r},c);return u instanceof Response?u:(console.error("Unexpected TokenResponse in POST /u/enter-password. This might indicate a flow misconfiguration as this route expects HTML or redirect.",u),t.html(A(ho,{vendorSettings:i,email:l,error:"An unexpected error occurred. Please try again.",state:e,client:o}),500))}catch(u){const d=u;return d.code==="INVALID_PASSWORD"||d.code==="USER_NOT_FOUND"?t.html(A(ho,{vendorSettings:i,email:l,error:U.t("invalid_password"),state:e,client:o}),400):d.code==="EMAIL_NOT_VERIFIED"?t.html(A(F_,{vendorSettings:i,state:e}),400):t.html(A(ho,{vendorSettings:i,email:l,error:d.message||"An unknown error occurred.",state:e,client:o}),d.code?400:500)}}),Cr=t=>{const{state:e,error:n,vendorSettings:r,email:i,code:o}=t;return A(dt,{title:U.t("create_account_title"),vendorSettings:r,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("create_account_title")}),A("div",{className:"mb-6 text-gray-300",children:U.t("create_account_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{children:[A("input",{type:"hidden",name:"code",value:o}),A("input",{type:"email",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:i,disabled:!!i}),A("input",{type:"password",name:"password",placeholder:U.t("enter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),A("input",{type:"password",name:"re-enter-password",placeholder:U.t("reenter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),n&&A(oi,{children:n}),A(at,{className:"sm:mt-4 !text-base",children:U.t("continue")})]}),A(ln,{state:e})]})]})},h6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().optional().openapi({description:"The code parameter from an email verification link"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{vendorSettings:r,loginSession:i}=await Je(t,e),{username:o}=i.authParams;if(!o)throw new P(400,{message:"Username required"});return n?t.html(A(Cr,{state:e,vendorSettings:r,email:o,code:n})):t.html(A(Cr,{state:e,vendorSettings:r,email:o}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string(),code:s.z.string().optional()})}}}},responses:{200:{description:"HTML page indicating success (e.g., email verification sent) or a next step.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent) after successful login.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., passwords don't match, weak password, user exists).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{env:r}=t,{vendorSettings:i,client:o,loginSession:c}=await Je(t,e);try{if(!c.authParams.username)throw new P(400,{message:"Username required"});const l="Username-Password-Authentication";if(t.set("connection",l),n.password!==n["re-enter-password"])return t.html(A(Cr,{state:e,code:n.code,vendorSettings:i,error:U.t("create_account_passwords_didnt_match"),email:c.authParams.username}),400);if(!lf(n.password))return t.html(A(Cr,{state:e,code:n.code,vendorSettings:i,error:U.t("create_account_weak_password"),email:c.authParams.username}),400);const u=n.code?await r.data.codes.get(o.tenant.id,n.code,"email_verification"):void 0,d=u?await r.data.loginSessions.get(o.tenant.id,u.login_id):void 0;if(await Hi({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:c.authParams.username,provider:"auth2"}))return t.html(A(Cr,{state:e,code:n.code,vendorSettings:i,error:U.t("user_exists_error"),email:c.authParams.username}),400);const h=(d==null?void 0:d.authParams.username)===c.authParams.username,_=`auth2|${fc()}`,$=await r.data.users.create(o.tenant.id,{user_id:_,email:c.authParams.username,email_verified:h,provider:"auth2",connection:l,is_social:!1});if(await r.data.passwords.create(o.tenant.id,{user_id:_,password:await Go.hash(n.password,10),algorithm:"bcrypt"}),!h)return await df(t,$),t.html(A(yr,{message:U.t("validate_email_body"),pageTitle:U.t("validate_email_title"),vendorSettings:i,state:e}));const m=await f_(t,o,{...c.authParams,password:n.password},c);return xr(t,m)}catch(l){let u=U.t("unknown_error_message"),d=400;return l instanceof P?(u=l.message||u,d=l.status===400?400:500):l instanceof gi?u=l.message||u:l instanceof Error&&(u=l.message||u,d=500),t.html(A(Cr,{state:e,vendorSettings:i,error:u,email:c.authParams.username,code:n.code}),d)}}),mi=t=>{const{error:e,vendorSettings:n,email:r}=t;return A(dt,{title:U.t("reset_password_title"),vendorSettings:n,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("reset_password_title")}),A("div",{className:"mb-6 text-gray-300",children:`${U.t("reset_password_description")} ${r}`}),A("div",{className:"flex flex-1 flex-col justify-center",children:A(Jn,{children:[A(Ud,{name:"password",placeholder:U.t("enter_new_password_placeholder")}),A(Ud,{name:"re-enter-password",placeholder:U.t("reenter_new_password_placeholder")}),e&&A(oi,{children:e}),A(at,{className:"sm:mt-4 !text-base",children:U.t("reset_password_cta")})]})})]})},g6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e);if(!r.authParams.username)throw new P(400,{message:"Username required"});return t.html(A(mi,{vendorSettings:n,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{password:r,"re-enter-password":i}=t.req.valid("form"),{env:o}=t,{vendorSettings:c,client:l,loginSession:u}=await Je(t,e);if(!u.authParams.username)throw new P(400,{message:"Username required"});if(r!==i)return t.html(A(mi,{error:U.t("create_account_passwords_didnt_match"),vendorSettings:c,email:u.authParams.username}),400);if(!lf(r))return t.html(A(mi,{error:U.t("create_account_weak_password"),vendorSettings:c,email:u.authParams.username}),400);const d=await Hi({userAdapter:o.data.users,tenant_id:l.tenant.id,username:u.authParams.username,provider:"auth2"});if(!d)throw new P(400,{message:"User not found"});try{if(!await o.data.codes.get(l.tenant.id,n,"password_reset"))return t.html(A(mi,{error:"Code not found or expired",vendorSettings:c,email:u.authParams.username}),400);const h={user_id:d.user_id,password:await Go.hash(r,10),algorithm:"bcrypt"};await o.data.passwords.get(l.tenant.id,d.user_id)?await o.data.passwords.update(l.tenant.id,h):await o.data.passwords.create(l.tenant.id,h),d.email_verified||await o.data.users.update(l.tenant.id,d.user_id,{email_verified:!0})}catch{return t.html(A(mi,{error:"The password could not be reset",vendorSettings:c,email:u.authParams.username}),400)}return t.html(A(yr,{message:U.t("password_has_been_reset"),vendorSettings:c,state:e}))}),U_=t=>{const{error:e,vendorSettings:n,email:r,state:i}=t;return A(dt,{title:U.t("forgot_password_title"),vendorSettings:n,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("forgot_password_title")}),A("div",{className:"mb-6 text-gray-300",children:U.t("forgot_password_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A(Jn,{className:"pt-2",children:[A("input",{type:"email",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:r,disabled:!!r}),e&&A(oi,{children:e}),A(at,{className:"sm:mt-4 !text-base",children:U.t("forgot_password_cta")})]}),A(ln,{state:i})]})]})},M_=t=>{const{vendorSettings:e,state:n}=t;return A(dt,{title:"Login",vendorSettings:e,children:[A("div",{className:"flex flex-1 flex-col justify-center",children:[A("div",{children:U.t("forgot_password_email_sent")}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]})]}),A(ln,{state:n})]})},m6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e);return t.html(A(U_,{vendorSettings:n,state:e,email:r.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,client:r,loginSession:i}=await Je(t,e);return await r8(t,r,i.authParams.username,i.id),t.html(A(M_,{vendorSettings:n,state:e}))}),q_=({vendorSettings:t,state:e,user:n})=>A(dt,{title:$e("check_email_title"),vendorSettings:t,children:A("div",{className:"flex flex-1 flex-col justify-center",children:[A("div",{className:"mb-8 text-gray-700 dark:text-gray-300",children:[A(ml,{i18nKey:"currently_logged_in_as",components:[A("span",{className:"font-semibold text-gray-900 dark:text-white"},"span")],values:{email:n.email||""}}),A("br",{}),$e("continue_with_sso_provider_headline")]}),A("div",{className:"space-y-6",children:[A(Jn,{children:A(at,{className:"!text-base",children:A("span",{children:U.t("yes_continue_with_existing_account")})})}),A("a",{className:"block text-center text-primary hover:text-primaryHover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 dark:focus:ring-offset-gray-900",href:`/u/login/identifier?state=${encodeURIComponent(e)}`,children:U.t("no_use_another")})]})]})}),_6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page to check account status or verify email.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login identifier page if no valid session.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var u;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i}=await Je(t,n);if(!i||!((u=i.tenant)!=null&&u.id))return console.error("Client or tenant ID missing in GET /u/check-account after initJSXRoute"),t.html(A(yr,{vendorSettings:r,state:n,pageTitle:U.t("error_page_title")||"Error",message:U.t("configuration_error_message")||"A configuration error occurred."}),500);const o=fa(i.tenant.id,t.req.header("cookie")),c=o?await e.data.sessions.get(i.tenant.id,o):null;if(!c)return t.redirect(`/u/login/identifier?state=${n}`);const l=await e.data.users.get(i.tenant.id,c.user_id);return l?t.html(A(q_,{vendorSettings:r,state:n,user:l})):t.redirect(`/u/login/identifier?state=${n}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow or to login identifier.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues or if TokenResponse is returned.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var f;const{env:e}=t,{state:n}=t.req.valid("query"),{vendorSettings:r,client:i,loginSession:o}=await Je(t,n);if(!i||!((f=i.tenant)!=null&&f.id))return console.error("Client or tenant ID missing in POST /u/check-account after initJSXRoute"),t.html(A(yr,{vendorSettings:r,state:n,pageTitle:U.t("error_page_title")||"Error",message:U.t("configuration_error_message")}),500);const c=fa(i.tenant.id,t.req.header("cookie")),l=c?await e.data.sessions.get(i.tenant.id,c):null;if(!l)return t.redirect(`/u/login/identifier?state=${n}`);const u=await e.data.users.get(i.tenant.id,l.user_id);if(!u)return t.redirect(`/u/login/identifier?state=${n}`);const d=await xr(t,{user:u,authParams:o.authParams,client:i,loginSession:o});if(!(d instanceof Response))throw new P(500,{message:U.t("unexpected_error_try_again")});return d}),V_=t=>{const{vendorSettings:e,email:n,state:r}=t;return A(dt,{title:U.t("create_password_account_title"),vendorSettings:e,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("create_password_account_title")}),A("div",{className:"mb-6 text-gray-300",children:U.t("enter_email_for_verification_description")}),A("div",{className:"flex flex-1 flex-col justify-center",children:A(Jn,{className:"pt-2",children:[A("input",{type:"email",name:"username",placeholder:U.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:n,disabled:!0}),A(at,{className:"sm:mt-4 !text-base",children:U.t("send")})]})}),A(ln,{state:r})]})},y6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e),{username:i}=r.authParams;if(!i)throw new P(400,{message:"Username required"});return t.html(A(V_,{state:e,vendorSettings:n,email:i}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{loginSession:n,client:r}=await Je(t,e),{username:i}=n.authParams;if(!i)throw new P(400,{message:"Username required"});const o=await t.env.data.codes.create(r.tenant.id,{code_id:Yr(),code_type:"email_verification",login_id:n.id,expires_at:new Date(Date.now()+Lw).toISOString()});return await e8(t,i,o.code_id,n.id),t.redirect(`/u/pre-signup-sent?state=${e}`)}),H_=t=>{const{redirectUrl:e,vendorSettings:n}=t;return A(dt,{title:U.t("invalid_session_title"),vendorSettings:n,children:[A("div",{className:"flex flex-1 flex-col justify-center",children:U.t("invalid_session_body")}),A("div",{className:"flex flex-1 flex-col justify-center",children:e&&A("a",{className:"block text-primary hover:text-primaryHover text-center",href:e,children:U.t("go_back")})})]})},w6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e);let i;return r.authParams.redirect_uri&&r.authParams.state&&(i=new URL(r.authParams.redirect_uri),i.searchParams.set("state",r.authParams.state),i.searchParams.set("error","invalid_session"),i.searchParams.set("error_description",r.authParams.username||"")),t.html(A(H_,{redirectUrl:i==null?void 0:i.href,vendorSettings:n}))}),v6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const e=await k_(t.env),{state:n}=t.req.valid("query");return t.html(A(yr,{message:"Not implemented",pageTitle:"User info",vendorSettings:e,state:n}))}),K_=({vendorSettings:t,state:e})=>{const n=new URLSearchParams({state:e});return A(dt,{title:U.t("email_validated"),vendorSettings:t,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("email_validated")}),A("div",{className:"flex flex-1 flex-col justify-center mb-7",children:A(at,{Component:"a",href:`/u/enter-password?${n}`,className:"text-base sm:mt-4 md:text-base",children:A("div",{className:"flex items-center space-x-2",children:[A("span",{children:U.t("email_validated_cta")}),A(st,{className:"text-xs",name:"arrow-right"})]})})})]})},b6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{var _;const{state:e,code:n}=t.req.valid("query"),{env:r}=t,{client:i,loginSession:o,vendorSettings:c}=await Je(t,e),{username:l}=o.authParams;if(!l)throw new P(400,{message:"Username not found in state"});const u=await Hi({userAdapter:r.data.users,tenant_id:i.tenant.id,username:l,provider:"auth2"});if(!u)throw new P(500,{message:"No user found"});if(!await r.data.codes.get(i.tenant.id,n,"email_verification"))throw new P(400,{message:"Code not found or expired"});await r.data.users.update(i.tenant.id,u.user_id,{email_verified:!0});const h=(await sp(r.data.users,i.tenant.id,l)).filter($=>$.provider!=="auth2");if(h.length>0){const $=h.filter(m=>!m.linked_to);$.length>1&&console.error("More than one primary user found for email",l),$.length===0&&console.error("No primary user found for email",l),$.length===1&&await r.data.users.update(i.tenant.id,u.user_id,{linked_to:(_=$[0])==null?void 0:_.user_id})}return t.html(A(K_,{vendorSettings:c,state:e}))}),G_=t=>{const{vendorSettings:e,email:n,state:r}=t;return A(dt,{title:U.t("email_verification_for_signup_sent_title"),vendorSettings:e,children:[A("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:U.t("email_verification_for_signup_sent_title")}),A("div",{className:"flex flex-1 flex-col justify-center",children:[A("div",{className:"mb-6 text-gray-300",children:A(ml,{i18nKey:"email_verification_for_signup_sent_description",components:[A("span",{className:"text-black dark:text-white"},"span")],values:{email:n}})}),A("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[A(st,{className:"text-base",name:"info-bubble"}),A("div",{className:"text-sm text-gray-300 md:text-sm",children:U.t("sent_code_spam")})]})]}),A(ln,{state:r})]})},x6=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{vendorSettings:n,loginSession:r}=await Je(t,e),{username:i}=r.authParams;if(!i)throw new P(400,{message:"Username required"});return t.html(A(G_,{vendorSettings:n,state:e,email:i}))}),yf=`
249
249
  @font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:400;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2) format("woff2")}@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:500;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2) format("woff2")}@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:600;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2) format("woff2")}@font-face{font-family:uicon;src:url(https://login2.sesamy.com/_next/static/media/uicon.0b00e08a.woff2)}[class*=" uicon-"],[class^=uicon-]{font-family:uicon!important;font-size:inherit;font-style:normal;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.uicon-apple:before{content:"\\ea01"}.uicon-arrow-down:before{content:"\\ea02"}.uicon-arrow-left:before{content:"\\ea03"}.uicon-arrow-right:before{content:"\\ea04"}.uicon-arrow-up:before{content:"\\ea05"}.uicon-facebook:before{content:"\\ea06"}.uicon-google:before{content:"\\ea07"}.uicon-info-bubble:before{content:"\\ea08"}.uicon-info:before{content:"\\ea09"}.uicon-sesamy:before{content:"\\ea0a"}.uicon-spinner-circle:before{content:"\\ea0b"}.uicon-spinner-inner:before{content:"\\ea0c"}
250
250
 
251
251
  /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #bfbcd7;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:KHTeka,Helvetica Neue,HelveticaNeue,TeX Gyre Heros,TeXGyreHeros,FreeSans,Nimbus Sans L,Liberation Sans,Arimo,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#4b4a58;opacity:1}input::placeholder,textarea::placeholder{color:#4b4a58;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}body,html{height:100%}body{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity));font-size:1rem;letter-spacing:.0125rem;line-height:120%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:1280px){body{font-size:1.125rem;line-height:120%}}:is(.dark body){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}button,input,optgroup,select,textarea{font-size:.875rem;letter-spacing:.0125rem;line-height:120%}@media (min-width:1280px){button,input,optgroup,select,textarea{font-size:1rem;line-height:120%}}h1{font-size:1.5rem;font-weight:500;line-height:120%}@media (min-width:1280px){h1{font-size:2rem;line-height:120%}}@media (min-width:640px){h1{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}@media (min-width:1280px){h1{font-size:3.5rem;letter-spacing:-.0625rem;line-height:100%}}h2{font-size:1.25rem;font-weight:500;line-height:120%}@media (min-width:1280px){h2{font-size:1.5rem;line-height:120%}}@media (min-width:640px){h2{font-size:2rem;letter-spacing:0;line-height:120%}}@media (min-width:1280px){h2{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}h3{font-size:1.125rem;font-weight:500;line-height:120%}@media (min-width:1280px){h3{font-size:1.25rem;line-height:120%}}@media (min-width:640px){h3{font-size:1.5rem;line-height:120%}}@media (min-width:1280px){h3{font-size:2rem;line-height:120%}}h4{font-size:1rem;font-weight:500;line-height:120%}@media (min-width:1280px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:640px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:1280px){h4{font-size:1.5rem;line-height:120%}}h5{font-size:.875rem;font-weight:500;line-height:120%}@media (min-width:1280px){h5{font-size:1rem;line-height:120%}}@media (min-width:640px){h5{font-size:1rem;line-height:120%}}@media (min-width:1280px){h5{font-size:1.125rem;line-height:120%}}h6{font-size:.75rem;font-weight:500;line-height:135%}@media (min-width:1280px){h6{font-size:.875rem;line-height:120%}}@media (min-width:640px){h6{font-size:.875rem;line-height:120%}}@media (min-width:1280px){h6{font-size:1rem;line-height:120%}}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1920px){.container{max-width:1920px}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\\/2{top:50%}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-12{margin-bottom:3rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-8{margin-bottom:2rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.\\!hidden{display:none!important}.hidden{display:none}.h-5{height:1.25rem}.h-9{height:2.25rem}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-\\[calc\\(100vh-83px\\)\\]{min-height:calc(100vh - 83px)}.min-h-full{min-height:100%}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-\\[calc\\(100\\%-theme\\(space\\.2\\)-theme\\(space\\.2\\)\\)\\]{width:calc(100% - 1rem)}.w-full{width:100%}.max-w-\\[1295px\\]{max-width:1295px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.\\!flex-nowrap{flex-wrap:nowrap!important}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:1.25rem}.rounded-lg{border-radius:.625rem}.rounded-r-lg{border-bottom-right-radius:.625rem;border-top-right-radius:.625rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(248 249 251/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(191 188 215/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(136 134 159/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}.border-red{--tw-border-opacity:1;border-color:rgb(252 90 90/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary-color)}.bg-primaryHover{background-color:var(--primary-hover)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.px-0{padding-left:0;padding-right:0}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-2{padding-top:.5rem}.pt-2\\.5{padding-top:.625rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.indent-\\[5px\\]{text-indent:5px}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.\\!text-base{font-size:1rem!important;line-height:120%!important}.text-2xl{font-size:1.5rem;line-height:120%}.text-3xl{font-size:2rem;line-height:120%}.text-base{font-size:1rem;line-height:120%}.text-lg{font-size:1.125rem;line-height:120%}.text-sm{font-size:.875rem;line-height:120%}.text-xl{font-size:1.25rem;line-height:120%}.text-xs{font-size:.75rem;line-height:135%}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-\\[0\\]{line-height:0}.leading-tight{line-height:1.25}.text-\\[\\#1196F5\\]{--tw-text-opacity:1;color:rgb(17 150 245/var(--tw-text-opacity))}.text-\\[\\#B2B2B2\\]{--tw-text-opacity:1;color:rgb(178 178 178/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(191 188 215/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(75 74 88/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(30 30 39/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(8 8 14/var(--tw-text-opacity))}.text-primary{color:var(--primary-color)}.text-red{--tw-text-opacity:1;color:rgb(252 90 90/var(--tw-text-opacity))}.text-textOnPrimary{color:var(--text-on-primary)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.accent-\\[\\#4F2D7F\\]{accent-color:#4f2d7f}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.row-up-left{align-content:flex-start;justify-content:flex-start}.row,.row-up-left{display:flex;flex-direction:row;flex-wrap:wrap}.row{align-content:center;align-items:center;justify-content:center}.column-left{align-items:flex-start}.column,.column-left{display:flex;flex-direction:column;justify-content:center}.column{align-items:center}@media (min-width:1280px){.text-5xl{font-size:5.125rem;letter-spacing:-.125rem;line-height:100%}.text-4xl{font-size:3.5rem}.text-3xl,.text-4xl{letter-spacing:-.0625rem;line-height:100%}.text-3xl{font-size:3rem}.text-2xl{font-size:2rem}.text-2xl,.text-xl{line-height:120%}.text-xl{font-size:1.5rem}.text-lg{font-size:1.25rem}.text-base,.text-lg{line-height:120%}.text-base{font-size:1.125rem}.text-sm{font-size:1rem}.text-sm,.text-xs{line-height:120%}.text-xs{font-size:.875rem}}:root{--primary-color:#7d68f4;--primary-hover:#7e69f4;--text-on-primary:#fff}svg{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}*,:after,:before{text-underline-offset:4px}input[type=number],input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield!important}.btn.is-loading{cursor:not-allowed;opacity:.4;pointer-events:none}.btn .btn-spinner,.btn.is-loading .btn-label{opacity:0;visibility:hidden}.btn.is-loading .btn-spinner{opacity:1;visibility:visible}[class*=" uicon-"],[class^=uicon-]{letter-spacing:0;line-height:100%}.placeholder\\:text-gray-300::-moz-placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.placeholder\\:text-gray-300::placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.hover\\:bg-black\\/5:hover{background-color:rgba(0,0,0,.05)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.hover\\:bg-primaryHover:hover{background-color:var(--primary-hover)}.hover\\:text-primaryHover:hover{color:var(--primary-hover)}.hover\\:underline:hover{text-decoration-line:underline}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-2:focus,.focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-primary:focus{--tw-ring-color:var(--primary-color)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}:is(.dark .dark\\:border-gray-400){--tw-border-opacity:1;border-color:rgb(75 74 88/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-500){--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-600){--tw-border-opacity:1;border-color:rgb(40 40 52/var(--tw-border-opacity))}:is(.dark .dark\\:bg-black){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(40 40 52/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(20 20 26/var(--tw-bg-opacity))}:is(.dark .dark\\:text-\\[\\#201a41\\]){--tw-text-opacity:1;color:rgb(32 26 65/var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-300){--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}:is(.dark .dark\\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\\:hover\\:bg-black\\/90:hover){background-color:rgba(0,0,0,.9)}:is(.dark .dark\\:focus\\:ring-offset-gray-900:focus){--tw-ring-offset-color:#08080e}@media (min-width:640px){.sm\\:absolute{position:absolute}.sm\\:left-4{left:1rem}.sm\\:top-1\\/2{top:50%}.sm\\:mt-4{margin-top:1rem}.sm\\:inline{display:inline}.sm\\:h-6{height:1.5rem}.sm\\:min-h-\\[700px\\]{min-height:700px}.sm\\:w-6{width:1.5rem}.sm\\:w-\\[calc\\(100\\%-theme\\(space\\.16\\)-theme\\(space\\.16\\)\\)\\]{width:calc(100% - 8rem)}.sm\\:w-auto{width:auto}.sm\\:max-w-md{max-width:28rem}.sm\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:flex-col{flex-direction:column}.sm\\:justify-normal{justify-content:normal}.sm\\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(0px*(1 - var(--tw-space-x-reverse)));margin-right:calc(0px*var(--tw-space-x-reverse))}.sm\\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.sm\\:bg-fixed{background-attachment:fixed}.sm\\:bg-left-top{background-position:0 0}.sm\\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\\:px-14{padding-left:3.5rem;padding-right:3.5rem}.sm\\:py-14{padding-bottom:3.5rem;padding-top:3.5rem}.sm\\:py-4{padding-bottom:1rem;padding-top:1rem}.sm\\:pt-16{padding-top:4rem}.sm\\:text-2xl{font-size:1.5rem;line-height:120%}.sm\\:text-base{font-size:1rem;line-height:120%}}@media (min-width:1280px){.md\\:min-w-\\[448px\\]{min-width:448px}.md\\:text-3xl{font-size:2rem;line-height:120%}.md\\:text-base{font-size:1rem;line-height:120%}.md\\:text-sm{font-size:.875rem;line-height:120%}.md\\:text-xs{font-size:.75rem;line-height:135%}}@media (max-height:900px) and (min-width:640px){.short\\:static{position:static}.short\\:left-auto{left:auto}.short\\:top-auto{top:auto}.short\\:hidden{display:none}.short\\:h-5{height:1.25rem}.short\\:min-h-\\[558px\\]{min-height:558px}.short\\:w-5{width:1.25rem}.short\\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.short\\:flex-row{flex-direction:row}.short\\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.short\\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(0px*var(--tw-space-y-reverse));margin-top:calc(0px*(1 - var(--tw-space-y-reverse)))}.short\\:px-0{padding-left:0;padding-right:0}.short\\:py-3{padding-bottom:.75rem;padding-top:.75rem}.short\\:text-xl{font-size:1.25rem;line-height:120%}}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:0}.\\[\\&_h1\\]\\:mb-6 h1,.\\[\\&_h2\\]\\:mb-6 h2{margin-bottom:1.5rem}`;function $6(){if(typeof document<"u"){const t=document.createElement("style");t.innerHTML=yf,t.setAttribute("data-authhero-tailwind",""),document.head.appendChild(t)}}const A6=t=>A("div",{className:"rich-text mb-6 prose prose-gray max-w-none [&>*:last-child]:mb-0 [&_h1]:mb-6 [&_h2]:mb-6",dangerouslySetInnerHTML:{__html:t.config.content}},t.id),k6=t=>A("div",{className:"flex items-center gap-2",children:[A("input",{type:"checkbox",name:t.id,required:!!t.required,className:"w-5 h-5 accent-[#4F2D7F] align-middle",id:t.id}),A("span",{className:"text-base leading-tight",children:A("span",{dangerouslySetInnerHTML:{__html:t.config.text}})})]},t.id),E6=t=>{var e;return A("div",{className:"mb-4",children:A("input",{type:"text",name:t.id,placeholder:((e=t.config)==null?void 0:e.placeholder)||"",required:!!t.required,className:"w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 border-gray-100 dark:border-gray-500",id:t.id})},t.id)};function S6(t){switch(t.type){case"RICH_TEXT":return A6(t);case"LEGAL":return k6(t);case"TEXT":return E6(t);default:return null}}const Xl=({vendorSettings:t,formName:e,error:n,components:r})=>{const i=r==null?void 0:r.find(l=>l.type==="LEGAL"&&l.required),o=i==null?void 0:i.id,c=r==null?void 0:r.find(l=>l.type==="NEXT_BUTTON");return A(dt,{title:e,vendorSettings:t,children:[n&&A("div",{className:"mb-4 text-red-500",children:n}),A("div",{className:"flex flex-1 flex-col justify-center",children:A("form",{className:"pt-2",method:"post",children:[o&&A("style",{dangerouslySetInnerHTML:{__html:`
@@ -262,20 +262,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
262
262
  display: block;
263
263
  }
264
264
  `}}),A("div",{id:"_legalWrapper",children:[r&&r.map(l=>{if(l.type==="NEXT_BUTTON")return null;const u=S6(l);return u?A("div",{className:l.type==="RICH_TEXT"?"mb-6":"mb-4",children:u},l.id):null}),c&&A("div",{className:"mb-4",children:o?A(gf,{children:[A(at,{id:"continueBtn",className:"sm:mt-4 !text-base w-full",children:[A("span",{children:c.config.text||"Continue"}),A(st,{className:"text-xs",name:"arrow-right"})]}),A(at,{id:"continueBtnDisabled",className:"sm:mt-4 !text-base w-full opacity-50 cursor-not-allowed",disabled:!0,children:[A("span",{children:c.config.text||"Continue"}),A(st,{className:"text-xs",name:"arrow-right"})]})]}):A(at,{className:"sm:mt-4 !text-base w-full",children:[A("span",{children:c.config.text||"Continue"}),A(st,{className:"text-xs",name:"arrow-right"})]})})]})]})})]})},N6=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()})},responses:{200:{description:"Form node HTML"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{client:i,vendorSettings:o}=await Je(t,r,!0),c=await t.env.data.forms.get(i.tenant.id,e);if(!c)throw new P(404,{message:"Form not found"});const l=(c.nodes||[]).find(u=>u.id===n&&u.type==="STEP");if(!l)throw new P(404,{message:"Node not found or not a STEP node"});return t.html(A(Xl,{vendorSettings:o,client:i,state:r,formName:c.name,nodeAlias:l.alias||l.type,components:"components"in l.config?l.config.components:[]}))}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.record(s.z.string())}}}},responses:{200:{description:"Form node submitted"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{vendorSettings:i,client:o}=await Je(t,r,!0);let c,l,u=[];try{if(c=await t.env.data.forms.get(o.tenant.id,e),!c)throw new P(404,{message:"Form not found"});if(l=(c.nodes||[]).find(S=>S.id===n&&S.type==="STEP"),!l)throw new P(404,{message:"Node not found or not a STEP node"});u="components"in l.config?l.config.components:[];const d=await t.req.parseBody(),f=[],h={};for(const S of u)if(S.type==="LEGAL"){const k=S.id,v=!!S.required,O=d[k];v&&(!O||O==="")?f.push(k):typeof O=="string"&&(h[k]=O)}if(f.length>0)return t.html(A(Xl,{vendorSettings:i,client:o,state:r,formName:c.name,nodeAlias:l.alias||l.type,components:u,error:`Missing required fields: ${f.join(", ")}`}));const _=await t.env.data.loginSessions.get(o.tenant.id,r);if(!_||!_.session_id||!_.authParams)throw new Error("Session expired");const $=await t.env.data.sessions.get(o.tenant.id,_.session_id);if(!$||!$.user_id)throw new Error("Session expired");const m=await t.env.data.users.get(t.var.tenant_id,$.user_id);if(!m)throw new Error("Session expired");const x=await xr(t,{authParams:_.authParams,client:o,user:m,loginSession:_});return x instanceof Response?x:t.json(x)}catch{return t.html(A(Xl,{vendorSettings:i,client:o,state:r,formName:(c==null?void 0:c.name)||"",nodeAlias:(l==null?void 0:l.alias)||n||"",components:u||[],error:"Your session has expired. Please try again."}))}});function C6(t){const e=new s.OpenAPIHono;e.onError((r,i)=>r instanceof hs?i.redirect(r.location,r.status):r instanceof P?i.text(r.message||"Error",r.status):i.text("Unexpected error",500)),e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}).use(ul).use(ll),e.get("/css/tailwind.css",async r=>{const i=yf;return r.text(i,200,{"content-type":"text/css; charset=utf-8"})});const n=e.route("/info",v6).route("/check-account",_6).route("/login/identifier",L8).route("/enter-code",c6).route("/enter-password",f6).route("/invalid-session",w6).route("/pre-signup",y6).route("/pre-signup-sent",x6).route("/reset-password",g6).route("/forgot-password",m6).route("/validate-email",b6).route("/signup",h6).route("/forms",N6);return n.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),n}const Vt=s.z.object({"#text":s.z.string()}),I6=s.z.object({"#text":s.z.string(),"@_xmlns:saml":s.z.string().optional()}),T6=s.z.object({"samlp:AuthnRequest":s.z.object({"saml:Issuer":I6,"@_xmlns:samlp":s.z.string(),"@_xmlns:saml":s.z.string().optional(),"@_ForceAuthn":s.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":s.z.string(),"@_IssueInstant":s.z.string().datetime(),"@_Destination":s.z.string().url(),"@_AssertionConsumerServiceURL":s.z.string().url().optional(),"@_ProtocolBinding":s.z.string().optional(),"@_Version":s.z.string()})});s.z.array(s.z.object({":@":s.z.object({"@_xmlns":s.z.string(),"@_entityID":s.z.string()}),EntityDescriptor:s.z.array(s.z.object({":@":s.z.object({"@_protocolSupportEnumeration":s.z.string()}),IDPSSODescriptor:s.z.array(s.z.union([s.z.object({KeyDescriptor:s.z.array(s.z.object({KeyInfo:s.z.array(s.z.object({X509Data:s.z.array(s.z.object({X509Certificate:s.z.array(Vt)}))})),":@":s.z.object({"@_xmlns":s.z.string()})})),":@":s.z.object({"@_use":s.z.string()})}),s.z.object({SingleLogoutService:s.z.array(s.z.object({})),":@":s.z.object({"@_Binding":s.z.string(),"@_Location":s.z.string()})}),s.z.object({NameIDFormat:s.z.array(Vt)}),s.z.object({SingleSignOnService:s.z.array(s.z.object({})),":@":s.z.object({"@_Binding":s.z.string(),"@_Location":s.z.string()})}),s.z.object({Attribute:s.z.array(s.z.object({})),":@":s.z.object({"@_Name":s.z.string(),"@_NameFormat":s.z.string(),"@_FriendlyName":s.z.string(),"@_xmlns":s.z.string()})})]))}))}));const O6=s.z.object({"saml:AttributeValue":s.z.array(s.z.object({"#text":s.z.string()})),":@":s.z.object({"@_xmlns:xs":s.z.string().optional(),"@_xmlns:xsi":s.z.string(),"@_xsi:type":s.z.string(),"@_Name":s.z.string().optional(),"@_NameFormat":s.z.string().optional()})}),z6=s.z.object({"ds:Transform":s.z.array(s.z.any()),":@":s.z.object({"@_Algorithm":s.z.string()})}),zg=s.z.object({"ds:Signature":s.z.array(s.z.union([s.z.object({"ds:SignedInfo":s.z.array(s.z.union([s.z.object({"ds:CanonicalizationMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:SignatureMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:Reference":s.z.array(s.z.union([s.z.object({"ds:Transforms":s.z.array(z6)}),s.z.object({"ds:DigestMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:DigestValue":s.z.array(Vt)})]))})]))}),s.z.object({"ds:SignatureValue":s.z.array(Vt)}),s.z.object({"ds:KeyInfo":s.z.array(s.z.object({"ds:KeyValue":s.z.array(s.z.object({"ds:RSAKeyValue":s.z.array(s.z.union([s.z.object({"ds:Modulus":s.z.array(Vt)}),s.z.object({"ds:Exponent":s.z.array(Vt)})]))}))}))})])),":@":s.z.object({"@_xmlns:ds":s.z.string()})});s.z.array(s.z.object({"samlp:Response":s.z.array(s.z.union([s.z.object({"saml:Issuer":s.z.array(Vt)}),zg,s.z.object({"samlp:Status":s.z.array(s.z.object({"samlp:StatusCode":s.z.array(Vt),":@":s.z.object({"@_Value":s.z.string()})}))}),s.z.object({"saml:Assertion":s.z.array(s.z.union([s.z.object({"saml:Issuer":s.z.array(Vt)}),zg,s.z.object({"saml:Subject":s.z.array(s.z.union([s.z.object({"saml:NameID":s.z.array(Vt),":@":s.z.object({"@_Format":s.z.string()})}),s.z.object({"saml:SubjectConfirmation":s.z.array(s.z.object({"saml:SubjectConfirmationData":s.z.array(s.z.any()),":@":s.z.object({"@_InResponseTo":s.z.string(),"@_NotOnOrAfter":s.z.string(),"@_Recipient":s.z.string()})})),":@":s.z.object({"@_Method":s.z.string()})})]))}),s.z.object({"saml:Conditions":s.z.array(s.z.object({"saml:AudienceRestriction":s.z.array(s.z.object({"saml:Audience":s.z.array(Vt)}))})),":@":s.z.object({"@_NotBefore":s.z.string(),"@_NotOnOrAfter":s.z.string()})}),s.z.object({"saml:AuthnStatement":s.z.array(s.z.object({"saml:AuthnContext":s.z.array(s.z.object({"saml:AuthnContextClassRef":s.z.array(Vt)}))})),":@":s.z.object({"@_AuthnInstant":s.z.string(),"@_SessionIndex":s.z.string(),"@_SessionNotOnOrAfter":s.z.string()})}),s.z.object({"saml:AttributeStatement":s.z.array(s.z.object({"saml:Attribute":s.z.array(O6),":@":s.z.object({"@_FriendlyName":s.z.string().optional(),"@_Name":s.z.string(),"@_NameFormat":s.z.string()})}))})])),":@":s.z.object({"@_xmlns":s.z.string(),"@_ID":s.z.string(),"@_IssueInstant":s.z.string(),"@_Version":s.z.string()})})])),":@":s.z.object({"@_xmlns:samlp":s.z.string(),"@_xmlns:saml":s.z.string(),"@_Destination":s.z.string(),"@_ID":s.z.string(),"@_InResponseTo":s.z.string(),"@_IssueInstant":s.z.string(),"@_Version":s.z.string()})}));var D6={},Zr={},vs={},_l={};(function(t){var e=t;(function(n){function r(a){var p=Array.prototype.slice,y=a.length,E=function(N,G){return function(){return G.apply(this,N.concat(p.call(arguments)))}},b=function(){var N=p.call(arguments);return N.length<y?E(N,b):a.apply(this,p.apply(arguments,[0,y]))};return b}var i=function(a,p){for(var y=0;y<p.length;y+=1)a(p[y],y,p)},o=function(a,p,y){var E=p;return i(function(b,N){E=a(E,b,N)},y),E},c=function(a,p){var y=new Array(p.length);return i(function(E,b){y[b]=a(E)},p),y},l=function(a,p){var y=[];return i(function(E,b){a(E,b)&&y.push(E)},p),y},u=function(a,p){for(var y=0;y<a.length;y+=1)if(a[y]===p)return!0;return!1};function d(a){return function(){return a}}function f(a){return a.toString()}var h=function(a,p){return p.join(a)},_=function(a,p,y){return a+y+p},$=Array.prototype.concat,m=32767;function x(a){for(var p=[],y=0;y<a.length;y+=m){var E=a.slice(y,y+m);p=$.apply(p,E)}return p}function S(a,p){for(var y=Object(a),E=1;E<arguments.length;E++){var b=arguments[E];if(b!=null)for(var N in b)Object.prototype.hasOwnProperty.call(b,N)&&(y[N]=b[N])}return y}var k={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};v.prototype=new Object,v.prototype.constructor=v,v.superclass=Object.prototype;function v(){this.init()}v.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(a){return new ue(a[0],a[2])},this.reduceActions[5]=function(a){return new Ne(a[0],a[2])},this.reduceActions[7]=function(a){return new B(a[0],a[2])},this.reduceActions[8]=function(a){return new L(a[0],a[2])},this.reduceActions[10]=function(a){return new R(a[0],a[2])},this.reduceActions[11]=function(a){return new I(a[0],a[2])},this.reduceActions[12]=function(a){return new C(a[0],a[2])},this.reduceActions[13]=function(a){return new j(a[0],a[2])},this.reduceActions[15]=function(a){return new V(a[0],a[2])},this.reduceActions[16]=function(a){return new de(a[0],a[2])},this.reduceActions[18]=function(a){return new ne(a[0],a[2])},this.reduceActions[19]=function(a){return new ve(a[0],a[2])},this.reduceActions[20]=function(a){return new Ee(a[0],a[2])},this.reduceActions[22]=function(a){return new W(a[1])},this.reduceActions[24]=function(a){return new Z(a[0],a[2])},this.reduceActions[25]=function(a){return new ye(void 0,void 0,a[0])},this.reduceActions[27]=function(a){return a[0].locationPath=a[2],a[0]},this.reduceActions[28]=function(a){return a[0].locationPath=a[2],a[0].locationPath.steps.unshift(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),a[0]},this.reduceActions[29]=function(a){return new ye(a[0],[],void 0)},this.reduceActions[30]=function(a){return ae.instance_of(a[0],ye)?(a[0].filterPredicates==null&&(a[0].filterPredicates=[]),a[0].filterPredicates.push(a[1]),a[0]):new ye(a[0],[a[1]],void 0)},this.reduceActions[32]=function(a){return a[1]},this.reduceActions[33]=function(a){return new he(a[0])},this.reduceActions[34]=function(a){return new ge(a[0])},this.reduceActions[36]=function(a){return new Tt(a[0],[])},this.reduceActions[37]=function(a){return new Tt(a[0],a[2])},this.reduceActions[38]=function(a){return[a[0]]},this.reduceActions[39]=function(a){return a[2].unshift(a[0]),a[2]},this.reduceActions[43]=function(a){return new Zt(!0,[])},this.reduceActions[44]=function(a){return a[1].absolute=!0,a[1]},this.reduceActions[46]=function(a){return new Zt(!1,[a[0]])},this.reduceActions[47]=function(a){return a[0].steps.push(a[2]),a[0]},this.reduceActions[49]=function(a){return new Q(a[0],a[1],[])},this.reduceActions[50]=function(a){return new Q(Q.CHILD,a[0],[])},this.reduceActions[51]=function(a){return new Q(a[0],a[1],a[2])},this.reduceActions[52]=function(a){return new Q(Q.CHILD,a[0],a[1])},this.reduceActions[54]=function(a){return[a[0]]},this.reduceActions[55]=function(a){return a[1].unshift(a[0]),a[1]},this.reduceActions[56]=function(a){return a[0]=="ancestor"?Q.ANCESTOR:a[0]=="ancestor-or-self"?Q.ANCESTORORSELF:a[0]=="attribute"?Q.ATTRIBUTE:a[0]=="child"?Q.CHILD:a[0]=="descendant"?Q.DESCENDANT:a[0]=="descendant-or-self"?Q.DESCENDANTORSELF:a[0]=="following"?Q.FOLLOWING:a[0]=="following-sibling"?Q.FOLLOWINGSIBLING:a[0]=="namespace"?Q.NAMESPACE:a[0]=="parent"?Q.PARENT:a[0]=="preceding"?Q.PRECEDING:a[0]=="preceding-sibling"?Q.PRECEDINGSIBLING:a[0]=="self"?Q.SELF:-1},this.reduceActions[57]=function(a){return Q.ATTRIBUTE},this.reduceActions[59]=function(a){return a[0]=="comment"?oe.commentTest:a[0]=="text"?oe.textTest:a[0]=="processing-instruction"?oe.anyPiTest:a[0]=="node"?oe.nodeTest:new oe(-1,void 0)},this.reduceActions[60]=function(a){return new oe.PITest(a[2])},this.reduceActions[61]=function(a){return a[1]},this.reduceActions[63]=function(a){return a[1].absolute=!0,a[1].steps.unshift(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),a[1]},this.reduceActions[64]=function(a){return a[0].steps.push(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),a[0].steps.push(a[2]),a[0]},this.reduceActions[65]=function(a){return new Q(Q.SELF,oe.nodeTest,[])},this.reduceActions[66]=function(a){return new Q(Q.PARENT,oe.nodeTest,[])},this.reduceActions[67]=function(a){return new Ye(a[1])},this.reduceActions[68]=function(a){return oe.nameTestAny},this.reduceActions[69]=function(a){return new oe.NameTestPrefixAny(a[0].split(":")[0])},this.reduceActions[70]=function(a){return new oe.NameTestQName(a[0])}},v.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 "],v.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 "],v.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 "," "," "],v.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]],v.DOUBLEDOT=2,v.DOUBLECOLON=3,v.DOUBLESLASH=4,v.NOTEQUAL=5,v.LESSTHANOREQUAL=6,v.GREATERTHANOREQUAL=7,v.AND=8,v.OR=9,v.MOD=10,v.DIV=11,v.MULTIPLYOPERATOR=12,v.FUNCTIONNAME=13,v.AXISNAME=14,v.LITERAL=15,v.NUMBER=16,v.ASTERISKNAMETEST=17,v.QNAME=18,v.NCNAMECOLONASTERISK=19,v.NODETYPE=20,v.PROCESSINGINSTRUCTIONWITHLITERAL=21,v.EQUALS=22,v.LESSTHAN=23,v.GREATERTHAN=24,v.PLUS=25,v.MINUS=26,v.BAR=27,v.SLASH=28,v.LEFTPARENTHESIS=29,v.RIGHTPARENTHESIS=30,v.COMMA=31,v.AT=32,v.LEFTBRACKET=33,v.RIGHTBRACKET=34,v.DOT=35,v.DOLLAR=36,v.prototype.tokenize=function(a){for(var p=[],y=[],E=a+"\0",b=0,N=E.charAt(b++);;){for(;N==" "||N==" "||N=="\r"||N==`
265
- `;)N=E.charAt(b++);if(N=="\0"||b>=E.length)break;if(N=="("){p.push(v.LEFTPARENTHESIS),y.push(N),N=E.charAt(b++);continue}if(N==")"){p.push(v.RIGHTPARENTHESIS),y.push(N),N=E.charAt(b++);continue}if(N=="["){p.push(v.LEFTBRACKET),y.push(N),N=E.charAt(b++);continue}if(N=="]"){p.push(v.RIGHTBRACKET),y.push(N),N=E.charAt(b++);continue}if(N=="@"){p.push(v.AT),y.push(N),N=E.charAt(b++);continue}if(N==","){p.push(v.COMMA),y.push(N),N=E.charAt(b++);continue}if(N=="|"){p.push(v.BAR),y.push(N),N=E.charAt(b++);continue}if(N=="+"){p.push(v.PLUS),y.push(N),N=E.charAt(b++);continue}if(N=="-"){p.push(v.MINUS),y.push(N),N=E.charAt(b++);continue}if(N=="="){p.push(v.EQUALS),y.push(N),N=E.charAt(b++);continue}if(N=="$"){p.push(v.DOLLAR),y.push(N),N=E.charAt(b++);continue}if(N=="."){if(N=E.charAt(b++),N=="."){p.push(v.DOUBLEDOT),y.push(".."),N=E.charAt(b++);continue}if(N>="0"&&N<="9"){var G="."+N;for(N=E.charAt(b++);N>="0"&&N<="9";)G+=N,N=E.charAt(b++);p.push(v.NUMBER),y.push(G);continue}p.push(v.DOT),y.push(".");continue}if(N=="'"||N=='"'){for(var _e=N,Ce="";b<E.length&&(N=E.charAt(b))!==_e;)Ce+=N,b+=1;if(N!==_e)throw Mt.fromMessage("Unterminated string literal: "+_e+Ce);b+=1,p.push(v.LITERAL),y.push(Ce),N=E.charAt(b++);continue}if(N>="0"&&N<="9"){var G=N;for(N=E.charAt(b++);N>="0"&&N<="9";)G+=N,N=E.charAt(b++);if(N=="."&&E.charAt(b)>="0"&&E.charAt(b)<="9")for(G+=N,G+=E.charAt(b++),N=E.charAt(b++);N>="0"&&N<="9";)G+=N,N=E.charAt(b++);p.push(v.NUMBER),y.push(G);continue}if(N=="*"){if(p.length>0){var ie=p[p.length-1];if(ie!=v.AT&&ie!=v.DOUBLECOLON&&ie!=v.LEFTPARENTHESIS&&ie!=v.LEFTBRACKET&&ie!=v.AND&&ie!=v.OR&&ie!=v.MOD&&ie!=v.DIV&&ie!=v.MULTIPLYOPERATOR&&ie!=v.SLASH&&ie!=v.DOUBLESLASH&&ie!=v.BAR&&ie!=v.PLUS&&ie!=v.MINUS&&ie!=v.EQUALS&&ie!=v.NOTEQUAL&&ie!=v.LESSTHAN&&ie!=v.LESSTHANOREQUAL&&ie!=v.GREATERTHAN&&ie!=v.GREATERTHANOREQUAL){p.push(v.MULTIPLYOPERATOR),y.push(N),N=E.charAt(b++);continue}}p.push(v.ASTERISKNAMETEST),y.push(N),N=E.charAt(b++);continue}if(N==":"&&E.charAt(b)==":"){p.push(v.DOUBLECOLON),y.push("::"),b++,N=E.charAt(b++);continue}if(N=="/"){if(N=E.charAt(b++),N=="/"){p.push(v.DOUBLESLASH),y.push("//"),N=E.charAt(b++);continue}p.push(v.SLASH),y.push("/");continue}if(N=="!"&&E.charAt(b)=="="){p.push(v.NOTEQUAL),y.push("!="),b++,N=E.charAt(b++);continue}if(N=="<"){if(E.charAt(b)=="="){p.push(v.LESSTHANOREQUAL),y.push("<="),b++,N=E.charAt(b++);continue}p.push(v.LESSTHAN),y.push("<"),N=E.charAt(b++);continue}if(N==">"){if(E.charAt(b)=="="){p.push(v.GREATERTHANOREQUAL),y.push(">="),b++,N=E.charAt(b++);continue}p.push(v.GREATERTHAN),y.push(">"),N=E.charAt(b++);continue}if(N=="_"||ae.isLetter(N.charCodeAt(0))){var Ae=N;for(N=E.charAt(b++);ae.isNCNameChar(N.charCodeAt(0));)Ae+=N,N=E.charAt(b++);if(p.length>0){var ie=p[p.length-1];if(ie!=v.AT&&ie!=v.DOUBLECOLON&&ie!=v.LEFTPARENTHESIS&&ie!=v.LEFTBRACKET&&ie!=v.AND&&ie!=v.OR&&ie!=v.MOD&&ie!=v.DIV&&ie!=v.MULTIPLYOPERATOR&&ie!=v.SLASH&&ie!=v.DOUBLESLASH&&ie!=v.BAR&&ie!=v.PLUS&&ie!=v.MINUS&&ie!=v.EQUALS&&ie!=v.NOTEQUAL&&ie!=v.LESSTHAN&&ie!=v.LESSTHANOREQUAL&&ie!=v.GREATERTHAN&&ie!=v.GREATERTHANOREQUAL){if(Ae=="and"){p.push(v.AND),y.push(Ae);continue}if(Ae=="or"){p.push(v.OR),y.push(Ae);continue}if(Ae=="mod"){p.push(v.MOD),y.push(Ae);continue}if(Ae=="div"){p.push(v.DIV),y.push(Ae);continue}}}if(N==":"){if(E.charAt(b)=="*"){p.push(v.NCNAMECOLONASTERISK),y.push(Ae+":*"),b++,N=E.charAt(b++);continue}if(E.charAt(b)=="_"||ae.isLetter(E.charCodeAt(b))){for(Ae+=":",N=E.charAt(b++);ae.isNCNameChar(N.charCodeAt(0));)Ae+=N,N=E.charAt(b++);if(N=="("){p.push(v.FUNCTIONNAME),y.push(Ae);continue}p.push(v.QNAME),y.push(Ae);continue}if(E.charAt(b)==":"){p.push(v.AXISNAME),y.push(Ae);continue}}if(N=="("){if(Ae=="comment"||Ae=="text"||Ae=="node"){p.push(v.NODETYPE),y.push(Ae);continue}if(Ae=="processing-instruction"){E.charAt(b)==")"?p.push(v.NODETYPE):p.push(v.PROCESSINGINSTRUCTIONWITHLITERAL),y.push(Ae);continue}p.push(v.FUNCTIONNAME),y.push(Ae);continue}p.push(v.QNAME),y.push(Ae);continue}throw new Error("Unexpected character "+N)}return p.push(1),y.push("[EOF]"),[p,y]},v.SHIFT="s",v.REDUCE="r",v.ACCEPT="a",v.prototype.parse=function(Ce){var p,y,E=this.tokenize(Ce);if(E!=null){p=E[0],y=E[1];var b=0,N=[],G=[],_e=[],Ce,ie,Ae;for(N.push(0),G.push(1),_e.push("_S"),ie=p[b],Ae=y[b++];;)switch(Ce=N[N.length-1],v.actionTable[Ce].charAt(ie-1)){case v.SHIFT:G.push(-ie),_e.push(Ae),N.push(v.actionTableNumber[Ce].charCodeAt(ie-1)-32),ie=p[b],Ae=y[b++];break;case v.REDUCE:for(var wt=v.productions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32][1],je=[],er=0;er<wt;er++)G.pop(),je.unshift(_e.pop()),N.pop();var tr=N[N.length-1];G.push(v.productions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32][0]),this.reduceActions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32]==null?_e.push(je[0]):_e.push(this.reduceActions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32](je)),N.push(v.gotoTable[tr].charCodeAt(v.productions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32][0]-2)-33);break;case v.ACCEPT:return new O(_e.pop());default:throw new Error("XPath parse error")}}},O.prototype=new Object,O.prototype.constructor=O,O.superclass=Object.prototype;function O(a){this.expression=a}O.prototype.toString=function(){return this.expression.toString()};function q(a,p,y){p in a||(a[p]=y)}O.prototype.evaluate=function(a){return a.contextNode=a.expressionContextNode,a.contextSize=1,a.contextPosition=1,a.isHtml&&(q(a,"caseInsensitive",!0),q(a,"allowAnyNamespaceForNoPrefix",!0)),q(a,"caseInsensitive",!1),this.expression.evaluate(a)},O.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",O.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(a){throw new Error("Could not evaluate expression.")},H.prototype=new F,H.prototype.constructor=H,H.superclass=F.prototype;function H(a){arguments.length>0&&this.init(a)}H.prototype.init=function(a){this.rhs=a},W.prototype=new H,W.prototype.constructor=W,W.superclass=H.prototype;function W(a){arguments.length>0&&this.init(a)}W.prototype.init=function(a){W.superclass.init.call(this,a)},W.prototype.evaluate=function(a){return this.rhs.evaluate(a).number().negate()},W.prototype.toString=function(){return"-"+this.rhs.toString()},J.prototype=new F,J.prototype.constructor=J,J.superclass=F.prototype;function J(a,p){arguments.length>0&&this.init(a,p)}J.prototype.init=function(a,p){this.lhs=a,this.rhs=p},ue.prototype=new J,ue.prototype.constructor=ue,ue.superclass=J.prototype;function ue(a,p){arguments.length>0&&this.init(a,p)}ue.prototype.init=function(a,p){ue.superclass.init.call(this,a,p)},ue.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},ue.prototype.evaluate=function(a){var p=this.lhs.evaluate(a).bool();return p.booleanValue()?p:this.rhs.evaluate(a).bool()},Ne.prototype=new J,Ne.prototype.constructor=Ne,Ne.superclass=J.prototype;function Ne(a,p){arguments.length>0&&this.init(a,p)}Ne.prototype.init=function(a,p){Ne.superclass.init.call(this,a,p)},Ne.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ne.prototype.evaluate=function(a){var p=this.lhs.evaluate(a).bool();return p.booleanValue()?this.rhs.evaluate(a).bool():p},B.prototype=new J,B.prototype.constructor=B,B.superclass=J.prototype;function B(a,p){arguments.length>0&&this.init(a,p)}B.prototype.init=function(a,p){B.superclass.init.call(this,a,p)},B.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},B.prototype.evaluate=function(a){return this.lhs.evaluate(a).equals(this.rhs.evaluate(a))},L.prototype=new J,L.prototype.constructor=L,L.superclass=J.prototype;function L(a,p){arguments.length>0&&this.init(a,p)}L.prototype.init=function(a,p){L.superclass.init.call(this,a,p)},L.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},L.prototype.evaluate=function(a){return this.lhs.evaluate(a).notequal(this.rhs.evaluate(a))},R.prototype=new J,R.prototype.constructor=R,R.superclass=J.prototype;function R(a,p){arguments.length>0&&this.init(a,p)}R.prototype.init=function(a,p){R.superclass.init.call(this,a,p)},R.prototype.evaluate=function(a){return this.lhs.evaluate(a).lessthan(this.rhs.evaluate(a))},R.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},I.prototype=new J,I.prototype.constructor=I,I.superclass=J.prototype;function I(a,p){arguments.length>0&&this.init(a,p)}I.prototype.init=function(a,p){I.superclass.init.call(this,a,p)},I.prototype.evaluate=function(a){return this.lhs.evaluate(a).greaterthan(this.rhs.evaluate(a))},I.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},C.prototype=new J,C.prototype.constructor=C,C.superclass=J.prototype;function C(a,p){arguments.length>0&&this.init(a,p)}C.prototype.init=function(a,p){C.superclass.init.call(this,a,p)},C.prototype.evaluate=function(a){return this.lhs.evaluate(a).lessthanorequal(this.rhs.evaluate(a))},C.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},j.prototype=new J,j.prototype.constructor=j,j.superclass=J.prototype;function j(a,p){arguments.length>0&&this.init(a,p)}j.prototype.init=function(a,p){j.superclass.init.call(this,a,p)},j.prototype.evaluate=function(a){return this.lhs.evaluate(a).greaterthanorequal(this.rhs.evaluate(a))},j.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},V.prototype=new J,V.prototype.constructor=V,V.superclass=J.prototype;function V(a,p){arguments.length>0&&this.init(a,p)}V.prototype.init=function(a,p){V.superclass.init.call(this,a,p)},V.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().plus(this.rhs.evaluate(a).number())},V.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},de.prototype=new J,de.prototype.constructor=de,de.superclass=J.prototype;function de(a,p){arguments.length>0&&this.init(a,p)}de.prototype.init=function(a,p){de.superclass.init.call(this,a,p)},de.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().minus(this.rhs.evaluate(a).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},ne.prototype=new J,ne.prototype.constructor=ne,ne.superclass=J.prototype;function ne(a,p){arguments.length>0&&this.init(a,p)}ne.prototype.init=function(a,p){ne.superclass.init.call(this,a,p)},ne.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().multiply(this.rhs.evaluate(a).number())},ne.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},ve.prototype=new J,ve.prototype.constructor=ve,ve.superclass=J.prototype;function ve(a,p){arguments.length>0&&this.init(a,p)}ve.prototype.init=function(a,p){ve.superclass.init.call(this,a,p)},ve.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().div(this.rhs.evaluate(a).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Ee.prototype=new J,Ee.prototype.constructor=Ee,Ee.superclass=J.prototype;function Ee(a,p){arguments.length>0&&this.init(a,p)}Ee.prototype.init=function(a,p){Ee.superclass.init.call(this,a,p)},Ee.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().mod(this.rhs.evaluate(a).number())},Ee.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},Z.prototype=new J,Z.prototype.constructor=Z,Z.superclass=J.prototype;function Z(a,p){arguments.length>0&&this.init(a,p)}Z.prototype.init=function(a,p){Z.superclass.init.call(this,a,p)},Z.prototype.evaluate=function(a){return this.lhs.evaluate(a).nodeset().union(this.rhs.evaluate(a).nodeset())},Z.prototype.toString=function(){return c(f,[this.lhs,this.rhs]).join(" | ")},ye.prototype=new F,ye.prototype.constructor=ye,ye.superclass=F.prototype;function ye(a,p,y){arguments.length>0&&this.init(a,p,y)}ye.prototype.init=function(a,p,y){ye.superclass.init.call(this),this.filter=a,this.filterPredicates=p,this.locationPath=y};function Nn(a){for(;a&&a.parentNode;)a=a.parentNode;return a}ye.applyPredicates=function(a,p,y){if(a.length===0)return y;var E=p.extend({});return o(function(b,N){return E.contextSize=b.length,l(function(G,_e){return E.contextNode=G,E.contextPosition=_e+1,ye.predicateMatches(N,E)},b)},y,a)},ye.getRoot=function(a,p){var y=p[0];if(y.nodeType===k.DOCUMENT_NODE)return y;if(a.virtualRoot)return a.virtualRoot;var E=y.ownerDocument;if(E)return E;for(var b=y;b.parentNode!=null;)b=b.parentNode;return b},ye.applyStep=function(a,p,y){var E=[];switch(p.contextNode=y,a.axis){case Q.ANCESTOR:if(p.contextNode===p.virtualRoot)break;var b;for(p.contextNode.nodeType==k.ATTRIBUTE_NODE?b=ye.getOwnerElement(p.contextNode):b=p.contextNode.parentNode;b!=null&&(a.nodeTest.matches(b,p)&&E.push(b),b!==p.virtualRoot);)b=b.parentNode;break;case Q.ANCESTORORSELF:for(var b=p.contextNode;b!=null&&(a.nodeTest.matches(b,p)&&E.push(b),b!==p.virtualRoot);b=b.nodeType==k.ATTRIBUTE_NODE?ye.getOwnerElement(b):b.parentNode);break;case Q.ATTRIBUTE:var N=p.contextNode.attributes;if(N!=null)for(var G=0;G<N.length;G++){var b=N.item(G);a.nodeTest.matches(b,p)&&E.push(b)}break;case Q.CHILD:for(var b=p.contextNode.firstChild;b!=null;b=b.nextSibling)a.nodeTest.matches(b,p)&&E.push(b);break;case Q.DESCENDANT:for(var je=[p.contextNode.firstChild];je.length>0;)for(var b=je.pop();b!=null;)a.nodeTest.matches(b,p)&&E.push(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling;break;case Q.DESCENDANTORSELF:a.nodeTest.matches(p.contextNode,p)&&E.push(p.contextNode);for(var je=[p.contextNode.firstChild];je.length>0;)for(var b=je.pop();b!=null;)a.nodeTest.matches(b,p)&&E.push(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling;break;case Q.FOLLOWING:if(p.contextNode===p.virtualRoot)break;var je=[];p.contextNode.firstChild!=null?je.unshift(p.contextNode.firstChild):je.unshift(p.contextNode.nextSibling);for(var b=p.contextNode.parentNode;b!=null&&b.nodeType!=k.DOCUMENT_NODE&&b!==p.virtualRoot;b=b.parentNode)je.unshift(b.nextSibling);do for(var b=je.pop();b!=null;)a.nodeTest.matches(b,p)&&E.push(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling;while(je.length>0);break;case Q.FOLLOWINGSIBLING:if(p.contextNode===p.virtualRoot)break;for(var b=p.contextNode.nextSibling;b!=null;b=b.nextSibling)a.nodeTest.matches(b,p)&&E.push(b);break;case Q.NAMESPACE:var _e={};if(p.contextNode.nodeType==k.ELEMENT_NODE){_e.xml=O.XML_NAMESPACE_URI,_e.xmlns=O.XMLNS_NAMESPACE_URI;for(var b=p.contextNode;b!=null&&b.nodeType==k.ELEMENT_NODE;b=b.parentNode)for(var G=0;G<b.attributes.length;G++){var Ce=b.attributes.item(G),ie=String(Ce.name);if(ie=="xmlns")_e[""]==null&&(_e[""]=Ce.value);else if(ie.length>6&&ie.substring(0,6)=="xmlns:"){var Ae=ie.substring(6,ie.length);_e[Ae]==null&&(_e[Ae]=Ce.value)}}for(var Ae in _e){var wt=new Ot(Ae,_e[Ae],p.contextNode);a.nodeTest.matches(wt,p)&&E.push(wt)}}break;case Q.PARENT:b=null,p.contextNode!==p.virtualRoot&&(p.contextNode.nodeType==k.ATTRIBUTE_NODE?b=ye.getOwnerElement(p.contextNode):b=p.contextNode.parentNode),b!=null&&a.nodeTest.matches(b,p)&&E.push(b);break;case Q.PRECEDING:var je;p.virtualRoot!=null?je=[p.virtualRoot]:je=[Nn(p.contextNode)];e:for(;je.length>0;)for(var b=je.pop();b!=null;){if(b==p.contextNode)break e;a.nodeTest.matches(b,p)&&E.unshift(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling}break;case Q.PRECEDINGSIBLING:if(p.contextNode===p.virtualRoot)break;for(var b=p.contextNode.previousSibling;b!=null;b=b.previousSibling)a.nodeTest.matches(b,p)&&E.push(b);break;case Q.SELF:a.nodeTest.matches(p.contextNode,p)&&E.push(p.contextNode);break}return E};function Be(a,p,y){return ye.applyPredicates(a.predicates,p,ye.applyStep(a,p,y))}function Ve(a,p,y){return x(c(Be.bind(null,y,a),p))}ye.applySteps=function(a,p,y){return o(Ve.bind(null,p),y,a)},ye.prototype.applyFilter=function(a,p){if(!this.filter)return{nodes:[a.contextNode]};var y=this.filter.evaluate(a);if(!ae.instance_of(y,se)){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:y}}return{nodes:ye.applyPredicates(this.filterPredicates||[],p,y.toUnsortedArray())}},ye.applyLocationPath=function(a,p,y){if(!a)return y;var E=a.absolute?[ye.getRoot(p,y)]:y;return ye.applySteps(a.steps,p,E)},ye.prototype.evaluate=function(a){var p=S(new Ut,a),y=this.applyFilter(a,p);if("nonNodes"in y)return y.nonNodes;var E=new se;return E.addArray(ye.applyLocationPath(this.locationPath,p,y.nodes)),E},ye.predicateMatches=function(a,p){var y=a.evaluate(p);return ae.instance_of(y,ge)?p.contextPosition===y.numberValue():y.booleanValue()},ye.predicateString=function(a){return _("[","]",a.toString())},ye.predicatesString=function(a){return h("",c(ye.predicateString,a))},ye.prototype.toString=function(){if(this.filter!=null){var a=f(this.filter);return ae.instance_of(this.filter,he)?_("'","'",a):this.filterPredicates!=null&&this.filterPredicates.length?_("(",")",a)+ye.predicatesString(this.filterPredicates):this.locationPath!=null?a+(this.locationPath.absolute?"":"/")+f(this.locationPath):a}return f(this.locationPath)},ye.getOwnerElement=function(a){if(a.ownerElement)return a.ownerElement;try{if(a.selectSingleNode)return a.selectSingleNode("..")}catch{}for(var p=a.nodeType==k.DOCUMENT_NODE?a:a.ownerDocument,y=p.getElementsByTagName("*"),E=0;E<y.length;E++)for(var b=y.item(E),N=b.attributes,G=0;G<N.length;G++){var _e=N.item(G);if(_e===a)return b}return null},Zt.prototype=new Object,Zt.prototype.constructor=Zt,Zt.superclass=Object.prototype;function Zt(a,p){arguments.length>0&&this.init(a,p)}Zt.prototype.init=function(a,p){this.absolute=a,this.steps=p},Zt.prototype.toString=function(){return(this.absolute?"/":"")+c(f,this.steps).join("/")},Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(a,p,y){arguments.length>0&&this.init(a,p,y)}Q.prototype.init=function(a,p,y){this.axis=a,this.nodeTest=p,this.predicates=y},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=o(function(a,p){return a[p[0]]=p[1],a},{},[[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"]]),oe.prototype=new Object,oe.prototype.constructor=oe,oe.superclass=Object.prototype;function oe(a,p){arguments.length>0&&this.init(a,p)}oe.prototype.init=function(a,p){this.type=a,this.value=p},oe.prototype.toString=function(){return"<unknown nodetest type>"},oe.prototype.matches=function(a,p){console.warn("unknown node test type")},oe.NAMETESTANY=0,oe.NAMETESTPREFIXANY=1,oe.NAMETESTQNAME=2,oe.COMMENT=3,oe.TEXT=4,oe.PI=5,oe.NODE=6,oe.isNodeType=function(a){return function(p){return u(a,p.nodeType)}},oe.makeNodeTestType=function(a,p,y){var E=y||function(){};return E.prototype=new oe(a),E.prototype.constructor=E,S(E.prototype,p),E},oe.makeNodeTypeTest=function(a,p,y){return new(oe.makeNodeTestType(a,{matches:oe.isNodeType(p),toString:d(y)}))},oe.hasPrefix=function(a){return a.prefix||(a.nodeName||a.tagName).indexOf(":")!==-1},oe.isElementOrAttribute=oe.isNodeType([1,2]),oe.nameSpaceMatches=function(a,p,y){var E=y.namespaceURI||"";if(!a)return!E||p.allowAnyNamespaceForNoPrefix&&!oe.hasPrefix(y);var b=p.namespaceResolver.getNamespace(a,p.expressionContextNode);if(b==null)throw new Error("Cannot resolve QName "+a);return b===E},oe.localNameMatches=function(a,p,y){var E=y.localName||y.nodeName;return p.caseInsensitive?a.toLowerCase()===E.toLowerCase():a===E},oe.NameTestPrefixAny=oe.makeNodeTestType(oe.NAMETESTPREFIXANY,{matches:function(a,p){return oe.isElementOrAttribute(a)&&oe.nameSpaceMatches(this.prefix,p,a)},toString:function(){return this.prefix+":*"}},function(p){this.prefix=p}),oe.NameTestQName=oe.makeNodeTestType(oe.NAMETESTQNAME,{matches:function(a,p){return oe.isNodeType([k.ELEMENT_NODE,k.ATTRIBUTE_NODE,Ot.XPATH_NAMESPACE_NODE])(a)&&oe.nameSpaceMatches(this.prefix,p,a)&&oe.localNameMatches(this.localName,p,a)},toString:function(){return this.name}},function(p){var y=p.split(":");this.name=p,this.prefix=y.length>1?y[0]:null,this.localName=y[y.length>1?1:0]}),oe.PITest=oe.makeNodeTestType(oe.PI,{matches:function(a,p){return oe.isNodeType([k.PROCESSING_INSTRUCTION_NODE])(a)&&(a.target||a.nodeName)===this.name},toString:function(){return _('processing-instruction("','")',this.name)}},function(a){this.name=a}),oe.nameTestAny=oe.makeNodeTypeTest(oe.NAMETESTANY,[k.ELEMENT_NODE,k.ATTRIBUTE_NODE,Ot.XPATH_NAMESPACE_NODE],"*"),oe.textTest=oe.makeNodeTypeTest(oe.TEXT,[k.TEXT_NODE,k.CDATA_SECTION_NODE],"text()"),oe.commentTest=oe.makeNodeTypeTest(oe.COMMENT,[k.COMMENT_NODE],"comment()"),oe.nodeTest=oe.makeNodeTypeTest(oe.NODE,[k.ELEMENT_NODE,k.ATTRIBUTE_NODE,k.TEXT_NODE,k.CDATA_SECTION_NODE,k.PROCESSING_INSTRUCTION_NODE,k.COMMENT_NODE,k.DOCUMENT_NODE],"node()"),oe.anyPiTest=oe.makeNodeTypeTest(oe.PI,[k.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ye.prototype=new F,Ye.prototype.constructor=Ye,Ye.superclass=F.prototype;function Ye(a){arguments.length>0&&this.init(a)}Ye.prototype.init=function(a){this.variable=a},Ye.prototype.toString=function(){return"$"+this.variable},Ye.prototype.evaluate=function(a){var p=ae.resolveQName(this.variable,a.namespaceResolver,a.contextNode,!1);if(p[0]==null)throw new Error("Cannot resolve QName "+fn);var y=a.variableResolver.getVariable(p[1],p[0]);if(!y)throw Mt.fromMessage("Undeclared variable: "+this.toString());return y},Tt.prototype=new F,Tt.prototype.constructor=Tt,Tt.superclass=F.prototype;function Tt(a,p){arguments.length>0&&this.init(a,p)}Tt.prototype.init=function(a,p){this.functionName=a,this.arguments=p},Tt.prototype.toString=function(){for(var a=this.functionName+"(",p=0;p<this.arguments.length;p++)p>0&&(a+=", "),a+=this.arguments[p].toString();return a+")"},Tt.prototype.evaluate=function(a){var p=yt.getFunctionFromContext(this.functionName,a);if(!p)throw new Error("Unknown function "+this.functionName);var y=[a].concat(this.arguments);return p.apply(a.functionResolver.thisArg,y)};var Le=new Object;Le.equals=function(a,p){return a.equals(p)},Le.notequal=function(a,p){return a.notequal(p)},Le.lessthan=function(a,p){return a.lessthan(p)},Le.greaterthan=function(a,p){return a.greaterthan(p)},Le.lessthanorequal=function(a,p){return a.lessthanorequal(p)},Le.greaterthanorequal=function(a,p){return a.greaterthanorequal(p)},he.prototype=new F,he.prototype.constructor=he,he.superclass=F.prototype;function he(a){arguments.length>0&&this.init(a)}he.prototype.init=function(a){this.str=String(a)},he.prototype.toString=function(){return this.str},he.prototype.evaluate=function(a){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(a){return ae.instance_of(a,pe)?this.bool().equals(a):ae.instance_of(a,ge)?this.number().equals(a):ae.instance_of(a,se)?a.compareWithString(this,Le.equals):new pe(this.str==a.str)},he.prototype.notequal=function(a){return ae.instance_of(a,pe)?this.bool().notequal(a):ae.instance_of(a,ge)?this.number().notequal(a):ae.instance_of(a,se)?a.compareWithString(this,Le.notequal):new pe(this.str!=a.str)},he.prototype.lessthan=function(a){return this.number().lessthan(a)},he.prototype.greaterthan=function(a){return this.number().greaterthan(a)},he.prototype.lessthanorequal=function(a){return this.number().lessthanorequal(a)},he.prototype.greaterthanorequal=function(a){return this.number().greaterthanorequal(a)},ge.prototype=new F,ge.prototype.constructor=ge,ge.superclass=F.prototype;function ge(a){arguments.length>0&&this.init(a)}ge.prototype.init=function(a){this.num=typeof a=="string"?this.parse(a):Number(a)},ge.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,ge.prototype.parse=function(a){return this.numberFormat.test(a)?parseFloat(a):Number.NaN};function ro(a){for(var p=a.split("e-"),y=p[0].replace(".",""),E=Number(p[1]),b=0;b<E-1;b+=1)y="0"+y;return"0."+y}function Es(a){for(var p=a.split("e"),y=p[0].replace(".",""),E=Number(p[1]),b=E+1-y.length,N=0;N<b;N+=1)y+="0";return y}ge.prototype.toString=function(){var a=this.num.toString();return a.indexOf("e-")!==-1?ro(a):a.indexOf("e")!==-1?Es(a):a},ge.prototype.evaluate=function(a){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(a){return ae.instance_of(a,pe)?this.bool().equals(a):ae.instance_of(a,he)?this.equals(a.number()):ae.instance_of(a,se)?a.compareWithNumber(this,Le.equals):new pe(this.num==a.num)},ge.prototype.notequal=function(a){return ae.instance_of(a,pe)?this.bool().notequal(a):ae.instance_of(a,he)?this.notequal(a.number()):ae.instance_of(a,se)?a.compareWithNumber(this,Le.notequal):new pe(this.num!=a.num)},ge.prototype.lessthan=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.greaterthan):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.lessthan(a.number()):new pe(this.num<a.num)},ge.prototype.greaterthan=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.lessthan):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.greaterthan(a.number()):new pe(this.num>a.num)},ge.prototype.lessthanorequal=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.greaterthanorequal):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.lessthanorequal(a.number()):new pe(this.num<=a.num)},ge.prototype.greaterthanorequal=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.lessthanorequal):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.greaterthanorequal(a.number()):new pe(this.num>=a.num)},ge.prototype.plus=function(a){return new ge(this.num+a.num)},ge.prototype.minus=function(a){return new ge(this.num-a.num)},ge.prototype.multiply=function(a){return new ge(this.num*a.num)},ge.prototype.div=function(a){return new ge(this.num/a.num)},ge.prototype.mod=function(a){return new ge(this.num%a.num)},pe.prototype=new F,pe.prototype.constructor=pe,pe.superclass=F.prototype;function pe(a){arguments.length>0&&this.init(a)}pe.prototype.init=function(a){this.b=!!a},pe.prototype.toString=function(){return this.b.toString()},pe.prototype.evaluate=function(a){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(a){return ae.instance_of(a,he)||ae.instance_of(a,ge)?this.equals(a.bool()):ae.instance_of(a,se)?a.compareWithBoolean(this,Le.equals):new pe(this.b==a.b)},pe.prototype.notequal=function(a){return ae.instance_of(a,he)||ae.instance_of(a,ge)?this.notequal(a.bool()):ae.instance_of(a,se)?a.compareWithBoolean(this,Le.notequal):new pe(this.b!=a.b)},pe.prototype.lessthan=function(a){return this.number().lessthan(a)},pe.prototype.greaterthan=function(a){return this.number().greaterthan(a)},pe.prototype.lessthanorequal=function(a){return this.number().lessthanorequal(a)},pe.prototype.greaterthanorequal=function(a){return this.number().greaterthanorequal(a)},pe.true_=new pe(!0),pe.false_=new pe(!1),nt.prototype=new Object,nt.prototype.constructor=nt,nt.superclass=Object.prototype;function nt(a){this.init(a)}nt.prototype.init=function(a){this.left=null,this.right=null,this.node=a,this.depth=1},nt.prototype.balance=function(){var a=this.left==null?0:this.left.depth,p=this.right==null?0:this.right.depth;if(a>p+1){var y=this.left.left==null?0:this.left.left.depth,E=this.left.right==null?0:this.left.right.depth;y<E&&this.left.rotateRR(),this.rotateLL()}else if(a+1<p){var b=this.right.right==null?0:this.right.right.depth,N=this.right.left==null?0:this.right.left.depth;N>b&&this.right.rotateLL(),this.rotateRR()}},nt.prototype.rotateLL=function(){var a=this.node,p=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=p,this.right.node=a,this.right.updateInNewLocation(),this.updateInNewLocation()},nt.prototype.rotateRR=function(){var a=this.node,p=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=p,this.left.node=a,this.left.updateInNewLocation(),this.updateInNewLocation()},nt.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},nt.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 Ss(a,p){if(a===p)return 0;if(a.compareDocumentPosition){var y=a.compareDocumentPosition(p);return y&1||y&10?1:y&20?-1:0}for(var E=0,b=0,N=a;N!=null;N=N.parentNode||N.ownerElement)E++;for(var G=p;G!=null;G=G.parentNode||G.ownerElement)b++;if(E>b){for(;E>b;)a=a.parentNode||a.ownerElement,E--;if(a===p)return 1}else if(b>E){for(;b>E;)p=p.parentNode||p.ownerElement,b--;if(a===p)return-1}for(var _e=a.parentNode||a.ownerElement,Ce=p.parentNode||p.ownerElement;_e!==Ce;)a=_e,p=Ce,_e=a.parentNode||a.ownerElement,Ce=p.parentNode||p.ownerElement;var ie=ae.isAttribute(a),Ae=ae.isAttribute(p);if(ie&&!Ae)return-1;if(!ie&&Ae)return 1;if(_e)for(var wt=ie?_e.attributes:_e.childNodes,je=wt.length,er=0;er<je;er+=1){var tr=wt[er];if(tr===a)return-1;if(tr===p)return 1}throw new Error("Unexpected: could not determine node order")}nt.prototype.add=function(a){if(a===this.node)return!1;var p=Ss(a,this.node),y=!1;return p==-1?this.left==null?(this.left=new nt(a),y=!0):(y=this.left.add(a),y&&this.balance()):p==1&&(this.right==null?(this.right=new nt(a),y=!0):(y=this.right.add(a),y&&this.balance())),y&&this.getDepthFromChildren(),y},se.prototype=new F,se.prototype.constructor=se,se.superclass=F.prototype;function se(){this.init()}se.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},se.prototype.toString=function(){var a=this.first();return a==null?"":this.stringForNode(a)},se.prototype.evaluate=function(a){return this},se.prototype.string=function(){return new he(this.toString())},se.prototype.stringValue=function(){return this.toString()},se.prototype.number=function(){return new ge(this.string())},se.prototype.numberValue=function(){return Number(this.string())},se.prototype.bool=function(){return new pe(this.booleanValue())},se.prototype.booleanValue=function(){return!!this.size},se.prototype.nodeset=function(){return this},se.prototype.stringForNode=function(a){return a.nodeType==k.DOCUMENT_NODE||a.nodeType==k.ELEMENT_NODE||a.nodeType===k.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(a):a.nodeType===k.ATTRIBUTE_NODE?a.value||a.nodeValue:a.isNamespaceNode?a.namespace:a.nodeValue},se.prototype.stringForContainerNode=function(a){for(var p="",y=a.firstChild;y!=null;y=y.nextSibling){var E=y.nodeType;(E===1||E===3||E===4||E===9||E===11)&&(p+=this.stringForNode(y))}return p},se.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new nt(this.nodes[0]);for(var a=1;a<this.nodes.length;a+=1)this.tree.add(this.nodes[a])}return this.tree},se.prototype.first=function(){var a=this.buildTree();if(a==null)return null;for(;a.left!=null;)a=a.left;return a.node},se.prototype.add=function(a){for(var p=0;p<this.nodes.length;p+=1)if(a===this.nodes[p])return;this.tree=null,this.nodes.push(a),this.size+=1},se.prototype.addArray=function(a){var p=this;i(function(y){p.add(y)},a)},se.prototype.toArray=function(){var a=[];return this.toArrayRec(this.buildTree(),a),a},se.prototype.toArrayRec=function(a,p){a!=null&&(this.toArrayRec(a.left,p),p.push(a.node),this.toArrayRec(a.right,p))},se.prototype.toUnsortedArray=function(){return this.nodes.slice()},se.prototype.compareWithString=function(a,p){for(var y=this.toUnsortedArray(),E=0;E<y.length;E++){var b=y[E],N=new he(this.stringForNode(b)),G=p(N,a);if(G.booleanValue())return G}return new pe(!1)},se.prototype.compareWithNumber=function(a,p){for(var y=this.toUnsortedArray(),E=0;E<y.length;E++){var b=y[E],N=new ge(this.stringForNode(b)),G=p(N,a);if(G.booleanValue())return G}return new pe(!1)},se.prototype.compareWithBoolean=function(a,p){return p(this.bool(),a)},se.prototype.compareWithNodeSet=function(a,p){for(var y=this.toUnsortedArray(),E=function(_e,Ce){return p(Ce,_e)},b=0;b<y.length;b++){var N=new he(this.stringForNode(y[b])),G=a.compareWithString(N,E);if(G.booleanValue())return G}return new pe(!1)},se.compareWith=r(function(a,p){return ae.instance_of(p,he)?this.compareWithString(p,a):ae.instance_of(p,ge)?this.compareWithNumber(p,a):ae.instance_of(p,pe)?this.compareWithBoolean(p,a):this.compareWithNodeSet(p,a)}),se.prototype.equals=se.compareWith(Le.equals),se.prototype.notequal=se.compareWith(Le.notequal),se.prototype.lessthan=se.compareWith(Le.lessthan),se.prototype.greaterthan=se.compareWith(Le.greaterthan),se.prototype.lessthanorequal=se.compareWith(Le.lessthanorequal),se.prototype.greaterthanorequal=se.compareWith(Le.greaterthanorequal),se.prototype.union=function(a){var p=new se;return p.addArray(this.toUnsortedArray()),p.addArray(a.toUnsortedArray()),p},Ot.prototype=new Object,Ot.prototype.constructor=Ot,Ot.superclass=Object.prototype;function Ot(a,p,y){this.isXPathNamespace=!0,this.ownerDocument=y.ownerDocument,this.nodeName="#namespace",this.prefix=a,this.localName=a,this.namespaceURI=p,this.nodeValue=p,this.ownerElement=y,this.nodeType=Ot.XPATH_NAMESPACE_NODE}Ot.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Ut.prototype=new Object,Ut.prototype.constructor=Ut,Ut.superclass=Object.prototype;function Ut(a,p,y){this.variableResolver=a??new pn,this.namespaceResolver=p??new Qt,this.functionResolver=y??new yt}Ut.prototype.extend=function(a){return S(new Ut,this,a)},pn.prototype=new Object,pn.prototype.constructor=pn,pn.superclass=Object.prototype;function pn(){}pn.prototype.getVariable=function(a,p){return null},yt.prototype=new Object,yt.prototype.constructor=yt,yt.superclass=Object.prototype;function yt(a){this.thisArg=a??me,this.functions=new Object,this.addStandardFunctions()}yt.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},yt.prototype.addFunction=function(a,p,y){this.functions["{"+a+"}"+p]=y},yt.getFunctionFromContext=function(a,p){var y=ae.resolveQName(a,p.namespaceResolver,p.contextNode,!1);if(y[0]===null)throw new Error("Cannot resolve QName "+name);return p.functionResolver.getFunction(y[1],y[0])},yt.prototype.getFunction=function(a,p){return this.functions["{"+p+"}"+a]},Qt.prototype=new Object,Qt.prototype.constructor=Qt,Qt.superclass=Object.prototype;function Qt(){}Qt.prototype.getNamespace=function(a,p){if(a=="xml")return O.XML_NAMESPACE_URI;if(a=="xmlns")return O.XMLNS_NAMESPACE_URI;for(p.nodeType==k.DOCUMENT_NODE?p=p.documentElement:p.nodeType==k.ATTRIBUTE_NODE?p=ye.getOwnerElement(p):p.nodeType!=k.ELEMENT_NODE&&(p=p.parentNode);p!=null&&p.nodeType==k.ELEMENT_NODE;){for(var y=p.attributes,E=0;E<y.length;E++){var b=y.item(E),N=b.name||b.nodeName;if(N==="xmlns"&&a===""||N==="xmlns:"+a)return String(b.value||b.nodeValue)}p=p.parentNode}return null};var me=new Object;me.last=function(a){if(arguments.length!=1)throw new Error("Function last expects ()");return new ge(a.contextSize)},me.position=function(a){if(arguments.length!=1)throw new Error("Function position expects ()");return new ge(a.contextPosition)},me.count=function(){var a=arguments[0],p;if(arguments.length!=2||!ae.instance_of(p=arguments[1].evaluate(a),se))throw new Error("Function count expects (node-set)");return new ge(p.size)},me.id=function(){var a=arguments[0],p;if(arguments.length!=2)throw new Error("Function id expects (object)");p=arguments[1].evaluate(a),ae.instance_of(p,se)?p=p.toArray().join(" "):p=p.stringValue();for(var y=p.split(/[\x0d\x0a\x09\x20]+/),E=new se,b=a.contextNode.nodeType==k.DOCUMENT_NODE?a.contextNode:a.contextNode.ownerDocument,N=0;N<y.length;N++){var G;b.getElementById?G=b.getElementById(y[N]):G=ae.getElementById(b,y[N]),G!=null&&E.add(G)}return E},me.localName=function(a,p){var y;if(arguments.length==1)y=a.contextNode;else if(arguments.length==2)y=p.evaluate(a).first();else throw new Error("Function local-name expects (node-set?)");return y==null?new he(""):new he(y.localName||y.baseName||y.target||y.nodeName||"")},me.namespaceURI=function(){var a=arguments[0],p;if(arguments.length==1)p=a.contextNode;else if(arguments.length==2)p=arguments[1].evaluate(a).first();else throw new Error("Function namespace-uri expects (node-set?)");return p==null?new he(""):new he(p.namespaceURI)},me.name=function(){var a=arguments[0],p;if(arguments.length==1)p=a.contextNode;else if(arguments.length==2)p=arguments[1].evaluate(a).first();else throw new Error("Function name expects (node-set?)");return p==null?new he(""):p.nodeType==k.ELEMENT_NODE?new he(p.nodeName):p.nodeType==k.ATTRIBUTE_NODE?new he(p.name||p.nodeName):p.nodeType===k.PROCESSING_INSTRUCTION_NODE?new he(p.target||p.nodeName):p.localName==null?new he(""):new he(p.localName)},me.string=function(){var a=arguments[0];if(arguments.length==1)return new he(se.prototype.stringForNode(a.contextNode));if(arguments.length==2)return arguments[1].evaluate(a).string();throw new Error("Function string expects (object?)")},me.concat=function(a){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var p="",y=1;y<arguments.length;y++)p+=arguments[y].evaluate(a).stringValue();return new he(p)},me.startsWith=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();return new pe(p.substring(0,y.length)==y)},me.contains=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();return new pe(p.indexOf(y)!==-1)},me.substringBefore=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();return new he(p.substring(0,p.indexOf(y)))},me.substringAfter=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();if(y.length==0)return new he(p);var E=p.indexOf(y);return E==-1?new he(""):new he(p.substring(E+y.length))},me.substring=function(){var a=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var p=arguments[1].evaluate(a).stringValue(),y=Math.round(arguments[2].evaluate(a).numberValue())-1,E=arguments.length==4?y+Math.round(arguments[3].evaluate(a).numberValue()):void 0;return new he(p.substring(y,E))},me.stringLength=function(){var a=arguments[0],p;if(arguments.length==1)p=se.prototype.stringForNode(a.contextNode);else if(arguments.length==2)p=arguments[1].evaluate(a).stringValue();else throw new Error("Function string-length expects (string?)");return new ge(p.length)},me.normalizeSpace=function(){var a=arguments[0],p;if(arguments.length==1)p=se.prototype.stringForNode(a.contextNode);else if(arguments.length==2)p=arguments[1].evaluate(a).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var y=0,E=p.length-1;ae.isSpace(p.charCodeAt(E));)E--;for(var b="";y<=E&&ae.isSpace(p.charCodeAt(y));)y++;for(;y<=E;)if(ae.isSpace(p.charCodeAt(y)))for(b+=" ";y<=E&&ae.isSpace(p.charCodeAt(y));)y++;else b+=p.charAt(y),y++;return new he(b)},me.translate=function(a,p,y,E){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var b=p.evaluate(a).stringValue(),N=y.evaluate(a).stringValue(),G=E.evaluate(a).stringValue(),_e=o(function(ie,Ae,wt){return Ae in ie||(ie[Ae]=wt>G.length?"":G[wt]),ie},{},N),Ce=h("",c(function(ie){return ie in _e?_e[ie]:ie},b));return new he(Ce)},me.boolean_=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(a).bool()},me.not=function(a,p){if(arguments.length!=2)throw new Error("Function not expects (object)");return p.evaluate(a).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 a=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var p,y=a.contextNode;y!=null&&y.nodeType!=k.DOCUMENT_NODE;y=y.parentNode){var E=y.getAttributeNS(O.XML_NAMESPACE_URI,"lang");if(E!=null){p=String(E);break}}if(p==null)return pe.false_;var b=arguments[1].evaluate(a).stringValue();return new pe(p.substring(0,b.length)==b&&(p.length==b.length||p.charAt(b.length)=="-"))},me.number=function(){var a=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new ge(se.prototype.stringForNode(a.contextNode)):arguments[1].evaluate(a).number()},me.sum=function(){var a=arguments[0],p;if(arguments.length!=2||!ae.instance_of(p=arguments[1].evaluate(a),se))throw new Error("Function sum expects (node-set)");p=p.toUnsortedArray();for(var y=0,E=0;E<p.length;E++)y+=new ge(se.prototype.stringForNode(p[E])).numberValue();return new ge(y)},me.floor=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new ge(Math.floor(arguments[1].evaluate(a).numberValue()))},me.ceiling=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new ge(Math.ceil(arguments[1].evaluate(a).numberValue()))},me.round=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new ge(Math.round(arguments[1].evaluate(a).numberValue()))};var ae=new Object;ae.isAttribute=function(a){return a&&(a.nodeType===k.ATTRIBUTE_NODE||a.ownerElement)},ae.splitQName=function(a){var p=a.indexOf(":");return p==-1?[null,a]:[a.substring(0,p),a.substring(p+1)]},ae.resolveQName=function(a,p,y,E){var b=ae.splitQName(a);return b[0]!=null?b[0]=p.getNamespace(b[0],y):E?(b[0]=p.getNamespace("",y),b[0]==null&&(b[0]="")):b[0]="",b},ae.isSpace=function(a){return a==9||a==13||a==10||a==32},ae.isLetter=function(a){return a>=65&&a<=90||a>=97&&a<=122||a>=192&&a<=214||a>=216&&a<=246||a>=248&&a<=255||a>=256&&a<=305||a>=308&&a<=318||a>=321&&a<=328||a>=330&&a<=382||a>=384&&a<=451||a>=461&&a<=496||a>=500&&a<=501||a>=506&&a<=535||a>=592&&a<=680||a>=699&&a<=705||a==902||a>=904&&a<=906||a==908||a>=910&&a<=929||a>=931&&a<=974||a>=976&&a<=982||a==986||a==988||a==990||a==992||a>=994&&a<=1011||a>=1025&&a<=1036||a>=1038&&a<=1103||a>=1105&&a<=1116||a>=1118&&a<=1153||a>=1168&&a<=1220||a>=1223&&a<=1224||a>=1227&&a<=1228||a>=1232&&a<=1259||a>=1262&&a<=1269||a>=1272&&a<=1273||a>=1329&&a<=1366||a==1369||a>=1377&&a<=1414||a>=1488&&a<=1514||a>=1520&&a<=1522||a>=1569&&a<=1594||a>=1601&&a<=1610||a>=1649&&a<=1719||a>=1722&&a<=1726||a>=1728&&a<=1742||a>=1744&&a<=1747||a==1749||a>=1765&&a<=1766||a>=2309&&a<=2361||a==2365||a>=2392&&a<=2401||a>=2437&&a<=2444||a>=2447&&a<=2448||a>=2451&&a<=2472||a>=2474&&a<=2480||a==2482||a>=2486&&a<=2489||a>=2524&&a<=2525||a>=2527&&a<=2529||a>=2544&&a<=2545||a>=2565&&a<=2570||a>=2575&&a<=2576||a>=2579&&a<=2600||a>=2602&&a<=2608||a>=2610&&a<=2611||a>=2613&&a<=2614||a>=2616&&a<=2617||a>=2649&&a<=2652||a==2654||a>=2674&&a<=2676||a>=2693&&a<=2699||a==2701||a>=2703&&a<=2705||a>=2707&&a<=2728||a>=2730&&a<=2736||a>=2738&&a<=2739||a>=2741&&a<=2745||a==2749||a==2784||a>=2821&&a<=2828||a>=2831&&a<=2832||a>=2835&&a<=2856||a>=2858&&a<=2864||a>=2866&&a<=2867||a>=2870&&a<=2873||a==2877||a>=2908&&a<=2909||a>=2911&&a<=2913||a>=2949&&a<=2954||a>=2958&&a<=2960||a>=2962&&a<=2965||a>=2969&&a<=2970||a==2972||a>=2974&&a<=2975||a>=2979&&a<=2980||a>=2984&&a<=2986||a>=2990&&a<=2997||a>=2999&&a<=3001||a>=3077&&a<=3084||a>=3086&&a<=3088||a>=3090&&a<=3112||a>=3114&&a<=3123||a>=3125&&a<=3129||a>=3168&&a<=3169||a>=3205&&a<=3212||a>=3214&&a<=3216||a>=3218&&a<=3240||a>=3242&&a<=3251||a>=3253&&a<=3257||a==3294||a>=3296&&a<=3297||a>=3333&&a<=3340||a>=3342&&a<=3344||a>=3346&&a<=3368||a>=3370&&a<=3385||a>=3424&&a<=3425||a>=3585&&a<=3630||a==3632||a>=3634&&a<=3635||a>=3648&&a<=3653||a>=3713&&a<=3714||a==3716||a>=3719&&a<=3720||a==3722||a==3725||a>=3732&&a<=3735||a>=3737&&a<=3743||a>=3745&&a<=3747||a==3749||a==3751||a>=3754&&a<=3755||a>=3757&&a<=3758||a==3760||a>=3762&&a<=3763||a==3773||a>=3776&&a<=3780||a>=3904&&a<=3911||a>=3913&&a<=3945||a>=4256&&a<=4293||a>=4304&&a<=4342||a==4352||a>=4354&&a<=4355||a>=4357&&a<=4359||a==4361||a>=4363&&a<=4364||a>=4366&&a<=4370||a==4412||a==4414||a==4416||a==4428||a==4430||a==4432||a>=4436&&a<=4437||a==4441||a>=4447&&a<=4449||a==4451||a==4453||a==4455||a==4457||a>=4461&&a<=4462||a>=4466&&a<=4467||a==4469||a==4510||a==4520||a==4523||a>=4526&&a<=4527||a>=4535&&a<=4536||a==4538||a>=4540&&a<=4546||a==4587||a==4592||a==4601||a>=7680&&a<=7835||a>=7840&&a<=7929||a>=7936&&a<=7957||a>=7960&&a<=7965||a>=7968&&a<=8005||a>=8008&&a<=8013||a>=8016&&a<=8023||a==8025||a==8027||a==8029||a>=8031&&a<=8061||a>=8064&&a<=8116||a>=8118&&a<=8124||a==8126||a>=8130&&a<=8132||a>=8134&&a<=8140||a>=8144&&a<=8147||a>=8150&&a<=8155||a>=8160&&a<=8172||a>=8178&&a<=8180||a>=8182&&a<=8188||a==8486||a>=8490&&a<=8491||a==8494||a>=8576&&a<=8578||a>=12353&&a<=12436||a>=12449&&a<=12538||a>=12549&&a<=12588||a>=44032&&a<=55203||a>=19968&&a<=40869||a==12295||a>=12321&&a<=12329},ae.isNCNameChar=function(a){return a>=48&&a<=57||a>=1632&&a<=1641||a>=1776&&a<=1785||a>=2406&&a<=2415||a>=2534&&a<=2543||a>=2662&&a<=2671||a>=2790&&a<=2799||a>=2918&&a<=2927||a>=3047&&a<=3055||a>=3174&&a<=3183||a>=3302&&a<=3311||a>=3430&&a<=3439||a>=3664&&a<=3673||a>=3792&&a<=3801||a>=3872&&a<=3881||a==46||a==45||a==95||ae.isLetter(a)||a>=768&&a<=837||a>=864&&a<=865||a>=1155&&a<=1158||a>=1425&&a<=1441||a>=1443&&a<=1465||a>=1467&&a<=1469||a==1471||a>=1473&&a<=1474||a==1476||a>=1611&&a<=1618||a==1648||a>=1750&&a<=1756||a>=1757&&a<=1759||a>=1760&&a<=1764||a>=1767&&a<=1768||a>=1770&&a<=1773||a>=2305&&a<=2307||a==2364||a>=2366&&a<=2380||a==2381||a>=2385&&a<=2388||a>=2402&&a<=2403||a>=2433&&a<=2435||a==2492||a==2494||a==2495||a>=2496&&a<=2500||a>=2503&&a<=2504||a>=2507&&a<=2509||a==2519||a>=2530&&a<=2531||a==2562||a==2620||a==2622||a==2623||a>=2624&&a<=2626||a>=2631&&a<=2632||a>=2635&&a<=2637||a>=2672&&a<=2673||a>=2689&&a<=2691||a==2748||a>=2750&&a<=2757||a>=2759&&a<=2761||a>=2763&&a<=2765||a>=2817&&a<=2819||a==2876||a>=2878&&a<=2883||a>=2887&&a<=2888||a>=2891&&a<=2893||a>=2902&&a<=2903||a>=2946&&a<=2947||a>=3006&&a<=3010||a>=3014&&a<=3016||a>=3018&&a<=3021||a==3031||a>=3073&&a<=3075||a>=3134&&a<=3140||a>=3142&&a<=3144||a>=3146&&a<=3149||a>=3157&&a<=3158||a>=3202&&a<=3203||a>=3262&&a<=3268||a>=3270&&a<=3272||a>=3274&&a<=3277||a>=3285&&a<=3286||a>=3330&&a<=3331||a>=3390&&a<=3395||a>=3398&&a<=3400||a>=3402&&a<=3405||a==3415||a==3633||a>=3636&&a<=3642||a>=3655&&a<=3662||a==3761||a>=3764&&a<=3769||a>=3771&&a<=3772||a>=3784&&a<=3789||a>=3864&&a<=3865||a==3893||a==3895||a==3897||a==3902||a==3903||a>=3953&&a<=3972||a>=3974&&a<=3979||a>=3984&&a<=3989||a==3991||a>=3993&&a<=4013||a>=4017&&a<=4023||a==4025||a>=8400&&a<=8412||a==8417||a>=12330&&a<=12335||a==12441||a==12442||a==183||a==720||a==721||a==903||a==1600||a==3654||a==3782||a==12293||a>=12337&&a<=12341||a>=12445&&a<=12446||a>=12540&&a<=12542},ae.coalesceText=function(a){for(var p=a.firstChild;p!=null;p=p.nextSibling)if(p.nodeType==k.TEXT_NODE||p.nodeType==k.CDATA_SECTION_NODE){var y=p.nodeValue,E=p;for(p=p.nextSibling;p!=null&&(p.nodeType==k.TEXT_NODE||p.nodeType==k.CDATA_SECTION_NODE);){y+=p.nodeValue;var b=p;p=p.nextSibling,b.parentNode.removeChild(b)}if(E.nodeType==k.CDATA_SECTION_NODE){var N=E.parentNode;if(E.nextSibling==null)N.removeChild(E),N.appendChild(N.ownerDocument.createTextNode(y));else{var G=E.nextSibling;N.removeChild(E),N.insertBefore(N.ownerDocument.createTextNode(y),G)}}else E.nodeValue=y;if(p==null)break}else p.nodeType==k.ELEMENT_NODE&&ae.coalesceText(p)},ae.instance_of=function(a,p){for(;a!=null;){if(a.constructor===p)return!0;if(a===Object)return!1;a=a.constructor.superclass}return!1},ae.getElementById=function(a,p){if(a.nodeType==k.ELEMENT_NODE&&(a.getAttribute("id")==p||a.getAttributeNS(null,"id")==p))return a;for(var y=a.firstChild;y!=null;y=y.nextSibling){var E=ae.getElementById(y,p);if(E!=null)return E}return null};var Mt=function(){function a(y,E){var b=E?": "+E.toString():"";switch(y){case p.INVALID_EXPRESSION_ERR:return"Invalid expression"+b;case p.TYPE_ERR:return"Type error"+b}return null}function p(y,E,b){var N=Error.call(this,a(y,E)||b);return N.code=y,N.exception=E,N}return p.prototype=Object.create(Error.prototype),p.prototype.constructor=p,p.superclass=Error,p.prototype.toString=function(){return this.message},p.fromMessage=function(y,E){return new p(null,E,y)},p.INVALID_EXPRESSION_ERR=51,p.TYPE_ERR=52,p}();zt.prototype={},zt.prototype.constructor=zt,zt.superclass=Object.prototype;function zt(a,p,y){this.xpath=y.parse(a),this.context=new Ut,this.context.namespaceResolver=new hn(p)}zt.getOwnerDocument=function(a){return a.nodeType===k.DOCUMENT_NODE?a:a.ownerDocument},zt.detectHtmlDom=function(a){if(!a)return!1;var p=zt.getOwnerDocument(a);try{return p.implementation.hasFeature("HTML","2.0")}catch{return!0}},zt.prototype.evaluate=function(a,p,y){this.context.expressionContextNode=a,this.context.caseInsensitive=zt.detectHtmlDom(a);var E=this.xpath.evaluate(this.context);return new z(E,p)},hn.prototype={},hn.prototype.constructor=hn,hn.superclass=Object.prototype;function hn(a){this.xpathNSResolver=a}hn.prototype.getNamespace=function(a,p){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(a)},D.prototype={},D.prototype.constructor=D,D.superclass=Object.prototype;function D(a){this.node=a,this.namespaceResolver=new Qt}D.prototype.lookupNamespaceURI=function(a){return this.namespaceResolver.getNamespace(a,this.node)},z.prototype={},z.prototype.constructor=z,z.superclass=Object.prototype;function z(a,p){switch(p==z.ANY_TYPE&&(a.constructor===he?p=z.STRING_TYPE:a.constructor===ge?p=z.NUMBER_TYPE:a.constructor===pe?p=z.BOOLEAN_TYPE:a.constructor===se&&(p=z.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=p,p){case z.NUMBER_TYPE:this.numberValue=a.numberValue();return;case z.STRING_TYPE:this.stringValue=a.stringValue();return;case z.BOOLEAN_TYPE:this.booleanValue=a.booleanValue();return;case z.ANY_UNORDERED_NODE_TYPE:case z.FIRST_ORDERED_NODE_TYPE:if(a.constructor===se){this.singleNodeValue=a.first();return}break;case z.UNORDERED_NODE_ITERATOR_TYPE:case z.ORDERED_NODE_ITERATOR_TYPE:if(a.constructor===se){this.invalidIteratorState=!1,this.nodes=a.toArray(),this.iteratorIndex=0;return}break;case z.UNORDERED_NODE_SNAPSHOT_TYPE:case z.ORDERED_NODE_SNAPSHOT_TYPE:if(a.constructor===se){this.nodes=a.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Mt(Mt.TYPE_ERR)}z.prototype.iterateNext=function(){if(this.resultType!=z.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=z.ORDERED_NODE_ITERATOR_TYPE)throw new Mt(Mt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},z.prototype.snapshotItem=function(a){if(this.resultType!=z.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=z.ORDERED_NODE_SNAPSHOT_TYPE)throw new Mt(Mt.TYPE_ERR);return this.nodes[a]},z.ANY_TYPE=0,z.NUMBER_TYPE=1,z.STRING_TYPE=2,z.BOOLEAN_TYPE=3,z.UNORDERED_NODE_ITERATOR_TYPE=4,z.ORDERED_NODE_ITERATOR_TYPE=5,z.UNORDERED_NODE_SNAPSHOT_TYPE=6,z.ORDERED_NODE_SNAPSHOT_TYPE=7,z.ANY_UNORDERED_NODE_TYPE=8,z.FIRST_ORDERED_NODE_TYPE=9;function M(a,p){a.createExpression=function(y,E){try{return new zt(y,E,p)}catch(b){throw new Mt(Mt.INVALID_EXPRESSION_ERR,b)}},a.createNSResolver=function(y){return new D(y)},a.evaluate=function(y,E,b,N,G){if(N<0||N>9)throw{code:0,toString:function(){return"Request type not supported"}};return a.createExpression(y,b,p).evaluate(E,N,G)}}try{var ee=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(ee=!1)}catch{}ee&&M(document,new v)}catch{}M(n,new v),function(){var a=new v,p=new Qt,y=new yt,E=new pn;function b(Y){return{getNamespace:function(Ie,vt){var nr=Y(Ie,vt);return nr||p.getNamespace(Ie,vt)}}}function N(Y){return b(Y.getNamespace.bind(Y))}function G(Y){return b(function(Ie){return Y[Ie]})}function _e(Y){return Y&&typeof Y.getNamespace=="function"?N(Y):typeof Y=="function"?b(Y):typeof Y=="object"?G(Y):p}function Ce(Y){if(Y===null||typeof Y>"u"||Y instanceof he||Y instanceof pe||Y instanceof ge||Y instanceof se)return Y;switch(typeof Y){case"string":return new he(Y);case"boolean":return new pe(Y);case"number":return new ge(Y)}var Ie=new se;return Ie.addArray([].concat(Y)),Ie}function ie(Y){return function(Ie){var vt=Array.prototype.slice.call(arguments,1).map(function(Ty){return Ty.evaluate(Ie)}),nr=Y.apply(this,[].concat(Ie,vt));return Ce(nr)}}function Ae(Y){return{getFunction:function(Ie,vt){var nr=Y(Ie,vt);return nr?ie(nr):y.getFunction(Ie,vt)}}}function wt(Y){return Ae(Y.getFunction.bind(Y))}function je(Y){return Ae(function(Ie){return Y[Ie]})}function er(Y){return Y&&typeof Y.getFunction=="function"?wt(Y):typeof Y=="function"?Ae(Y):typeof Y=="object"?je(Y):y}function tr(Y){return{getVariable:function(Ie,vt){var nr=Y(Ie,vt);return Ce(nr)}}}function Ey(Y){if(Y){if(typeof Y.getVariable=="function")return tr(Y.getVariable.bind(Y));if(typeof Y=="function")return tr(Y);if(typeof Y=="object")return tr(function(Ie){return Y[Ie]})}return E}function If(Y,Ie,vt){Y in vt&&(Ie[Y]=vt[Y])}function Sy(Y){var Ie=new Ut;return Y?(Ie.namespaceResolver=_e(Y.namespaces),Ie.functionResolver=er(Y.functions),Ie.variableResolver=Ey(Y.variables),Ie.expressionContextNode=Y.node,If("allowAnyNamespaceForNoPrefix",Ie,Y),If("isHtml",Ie,Y)):Ie.namespaceResolver=p,Ie}function Ny(Y,Ie){var vt=Sy(Ie);return Y.evaluate(vt)}var Cy={evaluate:function(Y){return Ny(this.expression,Y)},evaluateNumber:function(Y){return this.evaluate(Y).numberValue()},evaluateString:function(Y){return this.evaluate(Y).stringValue()},evaluateBoolean:function(Y){return this.evaluate(Y).booleanValue()},evaluateNodeSet:function(Y){return this.evaluate(Y).nodeset()},select:function(Y){return this.evaluateNodeSet(Y).toArray()},select1:function(Y){return this.select(Y)[0]}};function Iy(Y){var Ie=a.parse(Y);return Object.create(Cy,{expression:{value:Ie}})}n.parse=Iy}(),S(n,{XPath:O,XPathParser:v,XPathResult:z,Step:Q,PathExpr:ye,NodeTest:oe,LocationPath:Zt,OrOperation:ue,AndOperation:Ne,BarOperation:Z,EqualsOperation:B,NotEqualOperation:L,LessThanOperation:R,GreaterThanOperation:I,LessThanOrEqualOperation:C,GreaterThanOrEqualOperation:j,PlusOperation:V,MinusOperation:de,MultiplyOperation:ne,DivOperation:ve,ModOperation:Ee,UnaryMinusOperation:W,FunctionCall:Tt,VariableReference:Ye,XPathContext:Ut,XNodeSet:se,XBoolean:pe,XString:he,XNumber:ge,NamespaceResolver:Qt,FunctionResolver:yt,VariableResolver:pn,Utilities:ae}),n.select=function(a,p,y){return n.selectWithResolver(a,p,null,y)},n.useNamespaces=function(a){var p={mappings:a||{},lookupNamespaceURI:function(y){return this.mappings[y]}};return function(y,E,b){return n.selectWithResolver(y,E,p,b)}},n.selectWithResolver=function(a,p,y,E){var b=new zt(a,y,new v),N=z.ANY_TYPE,G=b.evaluate(p,N,null);return G.resultType==z.STRING_TYPE?G=G.stringValue:G.resultType==z.NUMBER_TYPE?G=G.numberValue:G.resultType==z.BOOLEAN_TYPE?G=G.booleanValue:(G=G.nodes,E&&(G=G[0])),G},n.select1=function(a,p){return n.select(a,p,!0)};var we=function(a){return a&&typeof a.nodeType=="number"&&Number.isInteger(a.nodeType)&&a.nodeType>=1&&a.nodeType<=11&&typeof a.nodeName=="string"},Ze=function(a){return Array.isArray(a)&&a.every(we)},Re=function(a){return function(p){return we(p)&&p.nodeType===a}};S(n,{isNodeLike:we,isArrayOfNodes:Ze,isElement:Re(k.ELEMENT_NODE),isAttribute:Re(k.ATTRIBUTE_NODE),isTextNode:Re(k.TEXT_NODE),isCDATASection:Re(k.CDATA_SECTION_NODE),isProcessingInstruction:Re(k.PROCESSING_INSTRUCTION_NODE),isComment:Re(k.COMMENT_NODE),isDocumentNode:Re(k.DOCUMENT_NODE),isDocumentTypeNode:Re(k.DOCUMENT_TYPE_NODE),isDocumentFragment:Re(k.DOCUMENT_FRAGMENT_NODE)})})(e)})(_l);var be={};Object.defineProperty(be,"__esModule",{value:!0});be.assertIsDocumentFragmentNode=be.assertIsDocumentTypeNode=be.assertIsDocumentNode=be.assertIsCommentNode=be.assertIsProcessingInstructionNode=be.assertIsCDATASectionNode=be.assertIsTextNode=be.assertIsAttributeNode=be.assertIsElementNode=be.isDocumentFragmentNode=be.isDocumentTypeNode=be.isDocumentNode=be.isCommentNode=be.isProcessingInstructionNode=be.isCDATASectionNode=be.isTextNode=be.isAttributeNode=be.isElementNode=be.assertIsArrayOfNodes=be.isArrayOfNodes=be.assertIsNodeLike=be.isNodeLike=be.NodeTypes=void 0;var Ke;(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"})(Ke||(be.NodeTypes=Ke={}));function yl(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"}be.isNodeLike=yl;function R6(t){if(!yl(t))throw new Error(`Value is not a Node-like object. Received: ${t}`)}be.assertIsNodeLike=R6;function G_(t){return Array.isArray(t)&&t.every(yl)}be.isArrayOfNodes=G_;function P6(t){if(!G_(t))throw new Error("Value is not an array of Nodes")}be.assertIsArrayOfNodes=P6;function Sn(t,e){return yl(e)&&e.nodeType===t}function Yn(t,e){const n=Object.keys(Ke).find(r=>Ke[r]===t);if(!Sn(t,e))throw new Error(`Value is not of type ${n}`)}const B6=t=>Sn(Ke.ELEMENT_NODE,t);be.isElementNode=B6;const j6=t=>Sn(Ke.ATTRIBUTE_NODE,t);be.isAttributeNode=j6;const L6=t=>Sn(Ke.TEXT_NODE,t);be.isTextNode=L6;const F6=t=>Sn(Ke.CDATA_SECTION_NODE,t);be.isCDATASectionNode=F6;const U6=t=>Sn(Ke.PROCESSING_INSTRUCTION_NODE,t);be.isProcessingInstructionNode=U6;const M6=t=>Sn(Ke.COMMENT_NODE,t);be.isCommentNode=M6;const q6=t=>Sn(Ke.DOCUMENT_NODE,t);be.isDocumentNode=q6;const V6=t=>Sn(Ke.DOCUMENT_TYPE_NODE,t);be.isDocumentTypeNode=V6;const H6=t=>Sn(Ke.DOCUMENT_FRAGMENT_NODE,t);be.isDocumentFragmentNode=H6;const K6=t=>{Yn(Ke.ELEMENT_NODE,t)};be.assertIsElementNode=K6;const G6=t=>Yn(Ke.ATTRIBUTE_NODE,t);be.assertIsAttributeNode=G6;const W6=t=>Yn(Ke.TEXT_NODE,t);be.assertIsTextNode=W6;const X6=t=>Yn(Ke.CDATA_SECTION_NODE,t);be.assertIsCDATASectionNode=X6;const J6=t=>Yn(Ke.PROCESSING_INSTRUCTION_NODE,t);be.assertIsProcessingInstructionNode=J6;const Y6=t=>Yn(Ke.COMMENT_NODE,t);be.assertIsCommentNode=Y6;const Z6=t=>Yn(Ke.DOCUMENT_NODE,t);be.assertIsDocumentNode=Z6;const Q6=t=>Yn(Ke.DOCUMENT_TYPE_NODE,t);be.assertIsDocumentTypeNode=Q6;const e9=t=>Yn(Ke.DOCUMENT_FRAGMENT_NODE,t);be.assertIsDocumentFragmentNode=e9;(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=_l,n=be;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 o(F,H,W,J){return F.localName===H&&(!F.namespaceURI&&(J==null?void 0:J.namespaceURI)===W||W==null)}function c(F,H,W){for(let J=0;J<F.attributes.length;J++){const ue=F.attributes[J];if(i(ue,H,W)||o(ue,H,W,F))return ue}return null}t.findAttr=c;function l(F,H,W){const J=F.documentElement??F,ue=[];for(let Ne=0;Ne<J.childNodes.length;Ne++){const B=J.childNodes[Ne];n.isElementNode(B)&&B.localName===H&&(B.namespaceURI===W||W==null)&&ue.push(B)}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;"},f={"&":"&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 _(F){return F.replace(/([&<>\r])/g,function(H,W){return f[W]})}t.encodeSpecialCharactersInText=_,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 $(F){return`${(F.trim().replace(/(\r\n|\r)/g,`
265
+ `;)N=E.charAt(b++);if(N=="\0"||b>=E.length)break;if(N=="("){p.push(v.LEFTPARENTHESIS),y.push(N),N=E.charAt(b++);continue}if(N==")"){p.push(v.RIGHTPARENTHESIS),y.push(N),N=E.charAt(b++);continue}if(N=="["){p.push(v.LEFTBRACKET),y.push(N),N=E.charAt(b++);continue}if(N=="]"){p.push(v.RIGHTBRACKET),y.push(N),N=E.charAt(b++);continue}if(N=="@"){p.push(v.AT),y.push(N),N=E.charAt(b++);continue}if(N==","){p.push(v.COMMA),y.push(N),N=E.charAt(b++);continue}if(N=="|"){p.push(v.BAR),y.push(N),N=E.charAt(b++);continue}if(N=="+"){p.push(v.PLUS),y.push(N),N=E.charAt(b++);continue}if(N=="-"){p.push(v.MINUS),y.push(N),N=E.charAt(b++);continue}if(N=="="){p.push(v.EQUALS),y.push(N),N=E.charAt(b++);continue}if(N=="$"){p.push(v.DOLLAR),y.push(N),N=E.charAt(b++);continue}if(N=="."){if(N=E.charAt(b++),N=="."){p.push(v.DOUBLEDOT),y.push(".."),N=E.charAt(b++);continue}if(N>="0"&&N<="9"){var G="."+N;for(N=E.charAt(b++);N>="0"&&N<="9";)G+=N,N=E.charAt(b++);p.push(v.NUMBER),y.push(G);continue}p.push(v.DOT),y.push(".");continue}if(N=="'"||N=='"'){for(var _e=N,Ce="";b<E.length&&(N=E.charAt(b))!==_e;)Ce+=N,b+=1;if(N!==_e)throw Mt.fromMessage("Unterminated string literal: "+_e+Ce);b+=1,p.push(v.LITERAL),y.push(Ce),N=E.charAt(b++);continue}if(N>="0"&&N<="9"){var G=N;for(N=E.charAt(b++);N>="0"&&N<="9";)G+=N,N=E.charAt(b++);if(N=="."&&E.charAt(b)>="0"&&E.charAt(b)<="9")for(G+=N,G+=E.charAt(b++),N=E.charAt(b++);N>="0"&&N<="9";)G+=N,N=E.charAt(b++);p.push(v.NUMBER),y.push(G);continue}if(N=="*"){if(p.length>0){var ie=p[p.length-1];if(ie!=v.AT&&ie!=v.DOUBLECOLON&&ie!=v.LEFTPARENTHESIS&&ie!=v.LEFTBRACKET&&ie!=v.AND&&ie!=v.OR&&ie!=v.MOD&&ie!=v.DIV&&ie!=v.MULTIPLYOPERATOR&&ie!=v.SLASH&&ie!=v.DOUBLESLASH&&ie!=v.BAR&&ie!=v.PLUS&&ie!=v.MINUS&&ie!=v.EQUALS&&ie!=v.NOTEQUAL&&ie!=v.LESSTHAN&&ie!=v.LESSTHANOREQUAL&&ie!=v.GREATERTHAN&&ie!=v.GREATERTHANOREQUAL){p.push(v.MULTIPLYOPERATOR),y.push(N),N=E.charAt(b++);continue}}p.push(v.ASTERISKNAMETEST),y.push(N),N=E.charAt(b++);continue}if(N==":"&&E.charAt(b)==":"){p.push(v.DOUBLECOLON),y.push("::"),b++,N=E.charAt(b++);continue}if(N=="/"){if(N=E.charAt(b++),N=="/"){p.push(v.DOUBLESLASH),y.push("//"),N=E.charAt(b++);continue}p.push(v.SLASH),y.push("/");continue}if(N=="!"&&E.charAt(b)=="="){p.push(v.NOTEQUAL),y.push("!="),b++,N=E.charAt(b++);continue}if(N=="<"){if(E.charAt(b)=="="){p.push(v.LESSTHANOREQUAL),y.push("<="),b++,N=E.charAt(b++);continue}p.push(v.LESSTHAN),y.push("<"),N=E.charAt(b++);continue}if(N==">"){if(E.charAt(b)=="="){p.push(v.GREATERTHANOREQUAL),y.push(">="),b++,N=E.charAt(b++);continue}p.push(v.GREATERTHAN),y.push(">"),N=E.charAt(b++);continue}if(N=="_"||ae.isLetter(N.charCodeAt(0))){var Ae=N;for(N=E.charAt(b++);ae.isNCNameChar(N.charCodeAt(0));)Ae+=N,N=E.charAt(b++);if(p.length>0){var ie=p[p.length-1];if(ie!=v.AT&&ie!=v.DOUBLECOLON&&ie!=v.LEFTPARENTHESIS&&ie!=v.LEFTBRACKET&&ie!=v.AND&&ie!=v.OR&&ie!=v.MOD&&ie!=v.DIV&&ie!=v.MULTIPLYOPERATOR&&ie!=v.SLASH&&ie!=v.DOUBLESLASH&&ie!=v.BAR&&ie!=v.PLUS&&ie!=v.MINUS&&ie!=v.EQUALS&&ie!=v.NOTEQUAL&&ie!=v.LESSTHAN&&ie!=v.LESSTHANOREQUAL&&ie!=v.GREATERTHAN&&ie!=v.GREATERTHANOREQUAL){if(Ae=="and"){p.push(v.AND),y.push(Ae);continue}if(Ae=="or"){p.push(v.OR),y.push(Ae);continue}if(Ae=="mod"){p.push(v.MOD),y.push(Ae);continue}if(Ae=="div"){p.push(v.DIV),y.push(Ae);continue}}}if(N==":"){if(E.charAt(b)=="*"){p.push(v.NCNAMECOLONASTERISK),y.push(Ae+":*"),b++,N=E.charAt(b++);continue}if(E.charAt(b)=="_"||ae.isLetter(E.charCodeAt(b))){for(Ae+=":",N=E.charAt(b++);ae.isNCNameChar(N.charCodeAt(0));)Ae+=N,N=E.charAt(b++);if(N=="("){p.push(v.FUNCTIONNAME),y.push(Ae);continue}p.push(v.QNAME),y.push(Ae);continue}if(E.charAt(b)==":"){p.push(v.AXISNAME),y.push(Ae);continue}}if(N=="("){if(Ae=="comment"||Ae=="text"||Ae=="node"){p.push(v.NODETYPE),y.push(Ae);continue}if(Ae=="processing-instruction"){E.charAt(b)==")"?p.push(v.NODETYPE):p.push(v.PROCESSINGINSTRUCTIONWITHLITERAL),y.push(Ae);continue}p.push(v.FUNCTIONNAME),y.push(Ae);continue}p.push(v.QNAME),y.push(Ae);continue}throw new Error("Unexpected character "+N)}return p.push(1),y.push("[EOF]"),[p,y]},v.SHIFT="s",v.REDUCE="r",v.ACCEPT="a",v.prototype.parse=function(Ce){var p,y,E=this.tokenize(Ce);if(E!=null){p=E[0],y=E[1];var b=0,N=[],G=[],_e=[],Ce,ie,Ae;for(N.push(0),G.push(1),_e.push("_S"),ie=p[b],Ae=y[b++];;)switch(Ce=N[N.length-1],v.actionTable[Ce].charAt(ie-1)){case v.SHIFT:G.push(-ie),_e.push(Ae),N.push(v.actionTableNumber[Ce].charCodeAt(ie-1)-32),ie=p[b],Ae=y[b++];break;case v.REDUCE:for(var wt=v.productions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32][1],je=[],er=0;er<wt;er++)G.pop(),je.unshift(_e.pop()),N.pop();var tr=N[N.length-1];G.push(v.productions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32][0]),this.reduceActions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32]==null?_e.push(je[0]):_e.push(this.reduceActions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32](je)),N.push(v.gotoTable[tr].charCodeAt(v.productions[v.actionTableNumber[Ce].charCodeAt(ie-1)-32][0]-2)-33);break;case v.ACCEPT:return new O(_e.pop());default:throw new Error("XPath parse error")}}},O.prototype=new Object,O.prototype.constructor=O,O.superclass=Object.prototype;function O(a){this.expression=a}O.prototype.toString=function(){return this.expression.toString()};function q(a,p,y){p in a||(a[p]=y)}O.prototype.evaluate=function(a){return a.contextNode=a.expressionContextNode,a.contextSize=1,a.contextPosition=1,a.isHtml&&(q(a,"caseInsensitive",!0),q(a,"allowAnyNamespaceForNoPrefix",!0)),q(a,"caseInsensitive",!1),this.expression.evaluate(a)},O.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",O.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(a){throw new Error("Could not evaluate expression.")},H.prototype=new F,H.prototype.constructor=H,H.superclass=F.prototype;function H(a){arguments.length>0&&this.init(a)}H.prototype.init=function(a){this.rhs=a},W.prototype=new H,W.prototype.constructor=W,W.superclass=H.prototype;function W(a){arguments.length>0&&this.init(a)}W.prototype.init=function(a){W.superclass.init.call(this,a)},W.prototype.evaluate=function(a){return this.rhs.evaluate(a).number().negate()},W.prototype.toString=function(){return"-"+this.rhs.toString()},J.prototype=new F,J.prototype.constructor=J,J.superclass=F.prototype;function J(a,p){arguments.length>0&&this.init(a,p)}J.prototype.init=function(a,p){this.lhs=a,this.rhs=p},ue.prototype=new J,ue.prototype.constructor=ue,ue.superclass=J.prototype;function ue(a,p){arguments.length>0&&this.init(a,p)}ue.prototype.init=function(a,p){ue.superclass.init.call(this,a,p)},ue.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},ue.prototype.evaluate=function(a){var p=this.lhs.evaluate(a).bool();return p.booleanValue()?p:this.rhs.evaluate(a).bool()},Ne.prototype=new J,Ne.prototype.constructor=Ne,Ne.superclass=J.prototype;function Ne(a,p){arguments.length>0&&this.init(a,p)}Ne.prototype.init=function(a,p){Ne.superclass.init.call(this,a,p)},Ne.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ne.prototype.evaluate=function(a){var p=this.lhs.evaluate(a).bool();return p.booleanValue()?this.rhs.evaluate(a).bool():p},B.prototype=new J,B.prototype.constructor=B,B.superclass=J.prototype;function B(a,p){arguments.length>0&&this.init(a,p)}B.prototype.init=function(a,p){B.superclass.init.call(this,a,p)},B.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},B.prototype.evaluate=function(a){return this.lhs.evaluate(a).equals(this.rhs.evaluate(a))},L.prototype=new J,L.prototype.constructor=L,L.superclass=J.prototype;function L(a,p){arguments.length>0&&this.init(a,p)}L.prototype.init=function(a,p){L.superclass.init.call(this,a,p)},L.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},L.prototype.evaluate=function(a){return this.lhs.evaluate(a).notequal(this.rhs.evaluate(a))},R.prototype=new J,R.prototype.constructor=R,R.superclass=J.prototype;function R(a,p){arguments.length>0&&this.init(a,p)}R.prototype.init=function(a,p){R.superclass.init.call(this,a,p)},R.prototype.evaluate=function(a){return this.lhs.evaluate(a).lessthan(this.rhs.evaluate(a))},R.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},I.prototype=new J,I.prototype.constructor=I,I.superclass=J.prototype;function I(a,p){arguments.length>0&&this.init(a,p)}I.prototype.init=function(a,p){I.superclass.init.call(this,a,p)},I.prototype.evaluate=function(a){return this.lhs.evaluate(a).greaterthan(this.rhs.evaluate(a))},I.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},C.prototype=new J,C.prototype.constructor=C,C.superclass=J.prototype;function C(a,p){arguments.length>0&&this.init(a,p)}C.prototype.init=function(a,p){C.superclass.init.call(this,a,p)},C.prototype.evaluate=function(a){return this.lhs.evaluate(a).lessthanorequal(this.rhs.evaluate(a))},C.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},j.prototype=new J,j.prototype.constructor=j,j.superclass=J.prototype;function j(a,p){arguments.length>0&&this.init(a,p)}j.prototype.init=function(a,p){j.superclass.init.call(this,a,p)},j.prototype.evaluate=function(a){return this.lhs.evaluate(a).greaterthanorequal(this.rhs.evaluate(a))},j.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},V.prototype=new J,V.prototype.constructor=V,V.superclass=J.prototype;function V(a,p){arguments.length>0&&this.init(a,p)}V.prototype.init=function(a,p){V.superclass.init.call(this,a,p)},V.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().plus(this.rhs.evaluate(a).number())},V.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},de.prototype=new J,de.prototype.constructor=de,de.superclass=J.prototype;function de(a,p){arguments.length>0&&this.init(a,p)}de.prototype.init=function(a,p){de.superclass.init.call(this,a,p)},de.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().minus(this.rhs.evaluate(a).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},ne.prototype=new J,ne.prototype.constructor=ne,ne.superclass=J.prototype;function ne(a,p){arguments.length>0&&this.init(a,p)}ne.prototype.init=function(a,p){ne.superclass.init.call(this,a,p)},ne.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().multiply(this.rhs.evaluate(a).number())},ne.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},ve.prototype=new J,ve.prototype.constructor=ve,ve.superclass=J.prototype;function ve(a,p){arguments.length>0&&this.init(a,p)}ve.prototype.init=function(a,p){ve.superclass.init.call(this,a,p)},ve.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().div(this.rhs.evaluate(a).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Ee.prototype=new J,Ee.prototype.constructor=Ee,Ee.superclass=J.prototype;function Ee(a,p){arguments.length>0&&this.init(a,p)}Ee.prototype.init=function(a,p){Ee.superclass.init.call(this,a,p)},Ee.prototype.evaluate=function(a){return this.lhs.evaluate(a).number().mod(this.rhs.evaluate(a).number())},Ee.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},Z.prototype=new J,Z.prototype.constructor=Z,Z.superclass=J.prototype;function Z(a,p){arguments.length>0&&this.init(a,p)}Z.prototype.init=function(a,p){Z.superclass.init.call(this,a,p)},Z.prototype.evaluate=function(a){return this.lhs.evaluate(a).nodeset().union(this.rhs.evaluate(a).nodeset())},Z.prototype.toString=function(){return c(f,[this.lhs,this.rhs]).join(" | ")},ye.prototype=new F,ye.prototype.constructor=ye,ye.superclass=F.prototype;function ye(a,p,y){arguments.length>0&&this.init(a,p,y)}ye.prototype.init=function(a,p,y){ye.superclass.init.call(this),this.filter=a,this.filterPredicates=p,this.locationPath=y};function Nn(a){for(;a&&a.parentNode;)a=a.parentNode;return a}ye.applyPredicates=function(a,p,y){if(a.length===0)return y;var E=p.extend({});return o(function(b,N){return E.contextSize=b.length,l(function(G,_e){return E.contextNode=G,E.contextPosition=_e+1,ye.predicateMatches(N,E)},b)},y,a)},ye.getRoot=function(a,p){var y=p[0];if(y.nodeType===k.DOCUMENT_NODE)return y;if(a.virtualRoot)return a.virtualRoot;var E=y.ownerDocument;if(E)return E;for(var b=y;b.parentNode!=null;)b=b.parentNode;return b},ye.applyStep=function(a,p,y){var E=[];switch(p.contextNode=y,a.axis){case Q.ANCESTOR:if(p.contextNode===p.virtualRoot)break;var b;for(p.contextNode.nodeType==k.ATTRIBUTE_NODE?b=ye.getOwnerElement(p.contextNode):b=p.contextNode.parentNode;b!=null&&(a.nodeTest.matches(b,p)&&E.push(b),b!==p.virtualRoot);)b=b.parentNode;break;case Q.ANCESTORORSELF:for(var b=p.contextNode;b!=null&&(a.nodeTest.matches(b,p)&&E.push(b),b!==p.virtualRoot);b=b.nodeType==k.ATTRIBUTE_NODE?ye.getOwnerElement(b):b.parentNode);break;case Q.ATTRIBUTE:var N=p.contextNode.attributes;if(N!=null)for(var G=0;G<N.length;G++){var b=N.item(G);a.nodeTest.matches(b,p)&&E.push(b)}break;case Q.CHILD:for(var b=p.contextNode.firstChild;b!=null;b=b.nextSibling)a.nodeTest.matches(b,p)&&E.push(b);break;case Q.DESCENDANT:for(var je=[p.contextNode.firstChild];je.length>0;)for(var b=je.pop();b!=null;)a.nodeTest.matches(b,p)&&E.push(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling;break;case Q.DESCENDANTORSELF:a.nodeTest.matches(p.contextNode,p)&&E.push(p.contextNode);for(var je=[p.contextNode.firstChild];je.length>0;)for(var b=je.pop();b!=null;)a.nodeTest.matches(b,p)&&E.push(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling;break;case Q.FOLLOWING:if(p.contextNode===p.virtualRoot)break;var je=[];p.contextNode.firstChild!=null?je.unshift(p.contextNode.firstChild):je.unshift(p.contextNode.nextSibling);for(var b=p.contextNode.parentNode;b!=null&&b.nodeType!=k.DOCUMENT_NODE&&b!==p.virtualRoot;b=b.parentNode)je.unshift(b.nextSibling);do for(var b=je.pop();b!=null;)a.nodeTest.matches(b,p)&&E.push(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling;while(je.length>0);break;case Q.FOLLOWINGSIBLING:if(p.contextNode===p.virtualRoot)break;for(var b=p.contextNode.nextSibling;b!=null;b=b.nextSibling)a.nodeTest.matches(b,p)&&E.push(b);break;case Q.NAMESPACE:var _e={};if(p.contextNode.nodeType==k.ELEMENT_NODE){_e.xml=O.XML_NAMESPACE_URI,_e.xmlns=O.XMLNS_NAMESPACE_URI;for(var b=p.contextNode;b!=null&&b.nodeType==k.ELEMENT_NODE;b=b.parentNode)for(var G=0;G<b.attributes.length;G++){var Ce=b.attributes.item(G),ie=String(Ce.name);if(ie=="xmlns")_e[""]==null&&(_e[""]=Ce.value);else if(ie.length>6&&ie.substring(0,6)=="xmlns:"){var Ae=ie.substring(6,ie.length);_e[Ae]==null&&(_e[Ae]=Ce.value)}}for(var Ae in _e){var wt=new Ot(Ae,_e[Ae],p.contextNode);a.nodeTest.matches(wt,p)&&E.push(wt)}}break;case Q.PARENT:b=null,p.contextNode!==p.virtualRoot&&(p.contextNode.nodeType==k.ATTRIBUTE_NODE?b=ye.getOwnerElement(p.contextNode):b=p.contextNode.parentNode),b!=null&&a.nodeTest.matches(b,p)&&E.push(b);break;case Q.PRECEDING:var je;p.virtualRoot!=null?je=[p.virtualRoot]:je=[Nn(p.contextNode)];e:for(;je.length>0;)for(var b=je.pop();b!=null;){if(b==p.contextNode)break e;a.nodeTest.matches(b,p)&&E.unshift(b),b.firstChild!=null?(je.push(b.nextSibling),b=b.firstChild):b=b.nextSibling}break;case Q.PRECEDINGSIBLING:if(p.contextNode===p.virtualRoot)break;for(var b=p.contextNode.previousSibling;b!=null;b=b.previousSibling)a.nodeTest.matches(b,p)&&E.push(b);break;case Q.SELF:a.nodeTest.matches(p.contextNode,p)&&E.push(p.contextNode);break}return E};function Be(a,p,y){return ye.applyPredicates(a.predicates,p,ye.applyStep(a,p,y))}function Ve(a,p,y){return x(c(Be.bind(null,y,a),p))}ye.applySteps=function(a,p,y){return o(Ve.bind(null,p),y,a)},ye.prototype.applyFilter=function(a,p){if(!this.filter)return{nodes:[a.contextNode]};var y=this.filter.evaluate(a);if(!ae.instance_of(y,se)){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:y}}return{nodes:ye.applyPredicates(this.filterPredicates||[],p,y.toUnsortedArray())}},ye.applyLocationPath=function(a,p,y){if(!a)return y;var E=a.absolute?[ye.getRoot(p,y)]:y;return ye.applySteps(a.steps,p,E)},ye.prototype.evaluate=function(a){var p=S(new Ut,a),y=this.applyFilter(a,p);if("nonNodes"in y)return y.nonNodes;var E=new se;return E.addArray(ye.applyLocationPath(this.locationPath,p,y.nodes)),E},ye.predicateMatches=function(a,p){var y=a.evaluate(p);return ae.instance_of(y,ge)?p.contextPosition===y.numberValue():y.booleanValue()},ye.predicateString=function(a){return _("[","]",a.toString())},ye.predicatesString=function(a){return h("",c(ye.predicateString,a))},ye.prototype.toString=function(){if(this.filter!=null){var a=f(this.filter);return ae.instance_of(this.filter,he)?_("'","'",a):this.filterPredicates!=null&&this.filterPredicates.length?_("(",")",a)+ye.predicatesString(this.filterPredicates):this.locationPath!=null?a+(this.locationPath.absolute?"":"/")+f(this.locationPath):a}return f(this.locationPath)},ye.getOwnerElement=function(a){if(a.ownerElement)return a.ownerElement;try{if(a.selectSingleNode)return a.selectSingleNode("..")}catch{}for(var p=a.nodeType==k.DOCUMENT_NODE?a:a.ownerDocument,y=p.getElementsByTagName("*"),E=0;E<y.length;E++)for(var b=y.item(E),N=b.attributes,G=0;G<N.length;G++){var _e=N.item(G);if(_e===a)return b}return null},Zt.prototype=new Object,Zt.prototype.constructor=Zt,Zt.superclass=Object.prototype;function Zt(a,p){arguments.length>0&&this.init(a,p)}Zt.prototype.init=function(a,p){this.absolute=a,this.steps=p},Zt.prototype.toString=function(){return(this.absolute?"/":"")+c(f,this.steps).join("/")},Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(a,p,y){arguments.length>0&&this.init(a,p,y)}Q.prototype.init=function(a,p,y){this.axis=a,this.nodeTest=p,this.predicates=y},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=o(function(a,p){return a[p[0]]=p[1],a},{},[[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"]]),oe.prototype=new Object,oe.prototype.constructor=oe,oe.superclass=Object.prototype;function oe(a,p){arguments.length>0&&this.init(a,p)}oe.prototype.init=function(a,p){this.type=a,this.value=p},oe.prototype.toString=function(){return"<unknown nodetest type>"},oe.prototype.matches=function(a,p){console.warn("unknown node test type")},oe.NAMETESTANY=0,oe.NAMETESTPREFIXANY=1,oe.NAMETESTQNAME=2,oe.COMMENT=3,oe.TEXT=4,oe.PI=5,oe.NODE=6,oe.isNodeType=function(a){return function(p){return u(a,p.nodeType)}},oe.makeNodeTestType=function(a,p,y){var E=y||function(){};return E.prototype=new oe(a),E.prototype.constructor=E,S(E.prototype,p),E},oe.makeNodeTypeTest=function(a,p,y){return new(oe.makeNodeTestType(a,{matches:oe.isNodeType(p),toString:d(y)}))},oe.hasPrefix=function(a){return a.prefix||(a.nodeName||a.tagName).indexOf(":")!==-1},oe.isElementOrAttribute=oe.isNodeType([1,2]),oe.nameSpaceMatches=function(a,p,y){var E=y.namespaceURI||"";if(!a)return!E||p.allowAnyNamespaceForNoPrefix&&!oe.hasPrefix(y);var b=p.namespaceResolver.getNamespace(a,p.expressionContextNode);if(b==null)throw new Error("Cannot resolve QName "+a);return b===E},oe.localNameMatches=function(a,p,y){var E=y.localName||y.nodeName;return p.caseInsensitive?a.toLowerCase()===E.toLowerCase():a===E},oe.NameTestPrefixAny=oe.makeNodeTestType(oe.NAMETESTPREFIXANY,{matches:function(a,p){return oe.isElementOrAttribute(a)&&oe.nameSpaceMatches(this.prefix,p,a)},toString:function(){return this.prefix+":*"}},function(p){this.prefix=p}),oe.NameTestQName=oe.makeNodeTestType(oe.NAMETESTQNAME,{matches:function(a,p){return oe.isNodeType([k.ELEMENT_NODE,k.ATTRIBUTE_NODE,Ot.XPATH_NAMESPACE_NODE])(a)&&oe.nameSpaceMatches(this.prefix,p,a)&&oe.localNameMatches(this.localName,p,a)},toString:function(){return this.name}},function(p){var y=p.split(":");this.name=p,this.prefix=y.length>1?y[0]:null,this.localName=y[y.length>1?1:0]}),oe.PITest=oe.makeNodeTestType(oe.PI,{matches:function(a,p){return oe.isNodeType([k.PROCESSING_INSTRUCTION_NODE])(a)&&(a.target||a.nodeName)===this.name},toString:function(){return _('processing-instruction("','")',this.name)}},function(a){this.name=a}),oe.nameTestAny=oe.makeNodeTypeTest(oe.NAMETESTANY,[k.ELEMENT_NODE,k.ATTRIBUTE_NODE,Ot.XPATH_NAMESPACE_NODE],"*"),oe.textTest=oe.makeNodeTypeTest(oe.TEXT,[k.TEXT_NODE,k.CDATA_SECTION_NODE],"text()"),oe.commentTest=oe.makeNodeTypeTest(oe.COMMENT,[k.COMMENT_NODE],"comment()"),oe.nodeTest=oe.makeNodeTypeTest(oe.NODE,[k.ELEMENT_NODE,k.ATTRIBUTE_NODE,k.TEXT_NODE,k.CDATA_SECTION_NODE,k.PROCESSING_INSTRUCTION_NODE,k.COMMENT_NODE,k.DOCUMENT_NODE],"node()"),oe.anyPiTest=oe.makeNodeTypeTest(oe.PI,[k.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ye.prototype=new F,Ye.prototype.constructor=Ye,Ye.superclass=F.prototype;function Ye(a){arguments.length>0&&this.init(a)}Ye.prototype.init=function(a){this.variable=a},Ye.prototype.toString=function(){return"$"+this.variable},Ye.prototype.evaluate=function(a){var p=ae.resolveQName(this.variable,a.namespaceResolver,a.contextNode,!1);if(p[0]==null)throw new Error("Cannot resolve QName "+fn);var y=a.variableResolver.getVariable(p[1],p[0]);if(!y)throw Mt.fromMessage("Undeclared variable: "+this.toString());return y},Tt.prototype=new F,Tt.prototype.constructor=Tt,Tt.superclass=F.prototype;function Tt(a,p){arguments.length>0&&this.init(a,p)}Tt.prototype.init=function(a,p){this.functionName=a,this.arguments=p},Tt.prototype.toString=function(){for(var a=this.functionName+"(",p=0;p<this.arguments.length;p++)p>0&&(a+=", "),a+=this.arguments[p].toString();return a+")"},Tt.prototype.evaluate=function(a){var p=yt.getFunctionFromContext(this.functionName,a);if(!p)throw new Error("Unknown function "+this.functionName);var y=[a].concat(this.arguments);return p.apply(a.functionResolver.thisArg,y)};var Le=new Object;Le.equals=function(a,p){return a.equals(p)},Le.notequal=function(a,p){return a.notequal(p)},Le.lessthan=function(a,p){return a.lessthan(p)},Le.greaterthan=function(a,p){return a.greaterthan(p)},Le.lessthanorequal=function(a,p){return a.lessthanorequal(p)},Le.greaterthanorequal=function(a,p){return a.greaterthanorequal(p)},he.prototype=new F,he.prototype.constructor=he,he.superclass=F.prototype;function he(a){arguments.length>0&&this.init(a)}he.prototype.init=function(a){this.str=String(a)},he.prototype.toString=function(){return this.str},he.prototype.evaluate=function(a){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(a){return ae.instance_of(a,pe)?this.bool().equals(a):ae.instance_of(a,ge)?this.number().equals(a):ae.instance_of(a,se)?a.compareWithString(this,Le.equals):new pe(this.str==a.str)},he.prototype.notequal=function(a){return ae.instance_of(a,pe)?this.bool().notequal(a):ae.instance_of(a,ge)?this.number().notequal(a):ae.instance_of(a,se)?a.compareWithString(this,Le.notequal):new pe(this.str!=a.str)},he.prototype.lessthan=function(a){return this.number().lessthan(a)},he.prototype.greaterthan=function(a){return this.number().greaterthan(a)},he.prototype.lessthanorequal=function(a){return this.number().lessthanorequal(a)},he.prototype.greaterthanorequal=function(a){return this.number().greaterthanorequal(a)},ge.prototype=new F,ge.prototype.constructor=ge,ge.superclass=F.prototype;function ge(a){arguments.length>0&&this.init(a)}ge.prototype.init=function(a){this.num=typeof a=="string"?this.parse(a):Number(a)},ge.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,ge.prototype.parse=function(a){return this.numberFormat.test(a)?parseFloat(a):Number.NaN};function ro(a){for(var p=a.split("e-"),y=p[0].replace(".",""),E=Number(p[1]),b=0;b<E-1;b+=1)y="0"+y;return"0."+y}function Es(a){for(var p=a.split("e"),y=p[0].replace(".",""),E=Number(p[1]),b=E+1-y.length,N=0;N<b;N+=1)y+="0";return y}ge.prototype.toString=function(){var a=this.num.toString();return a.indexOf("e-")!==-1?ro(a):a.indexOf("e")!==-1?Es(a):a},ge.prototype.evaluate=function(a){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(a){return ae.instance_of(a,pe)?this.bool().equals(a):ae.instance_of(a,he)?this.equals(a.number()):ae.instance_of(a,se)?a.compareWithNumber(this,Le.equals):new pe(this.num==a.num)},ge.prototype.notequal=function(a){return ae.instance_of(a,pe)?this.bool().notequal(a):ae.instance_of(a,he)?this.notequal(a.number()):ae.instance_of(a,se)?a.compareWithNumber(this,Le.notequal):new pe(this.num!=a.num)},ge.prototype.lessthan=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.greaterthan):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.lessthan(a.number()):new pe(this.num<a.num)},ge.prototype.greaterthan=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.lessthan):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.greaterthan(a.number()):new pe(this.num>a.num)},ge.prototype.lessthanorequal=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.greaterthanorequal):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.lessthanorequal(a.number()):new pe(this.num<=a.num)},ge.prototype.greaterthanorequal=function(a){return ae.instance_of(a,se)?a.compareWithNumber(this,Le.lessthanorequal):ae.instance_of(a,pe)||ae.instance_of(a,he)?this.greaterthanorequal(a.number()):new pe(this.num>=a.num)},ge.prototype.plus=function(a){return new ge(this.num+a.num)},ge.prototype.minus=function(a){return new ge(this.num-a.num)},ge.prototype.multiply=function(a){return new ge(this.num*a.num)},ge.prototype.div=function(a){return new ge(this.num/a.num)},ge.prototype.mod=function(a){return new ge(this.num%a.num)},pe.prototype=new F,pe.prototype.constructor=pe,pe.superclass=F.prototype;function pe(a){arguments.length>0&&this.init(a)}pe.prototype.init=function(a){this.b=!!a},pe.prototype.toString=function(){return this.b.toString()},pe.prototype.evaluate=function(a){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(a){return ae.instance_of(a,he)||ae.instance_of(a,ge)?this.equals(a.bool()):ae.instance_of(a,se)?a.compareWithBoolean(this,Le.equals):new pe(this.b==a.b)},pe.prototype.notequal=function(a){return ae.instance_of(a,he)||ae.instance_of(a,ge)?this.notequal(a.bool()):ae.instance_of(a,se)?a.compareWithBoolean(this,Le.notequal):new pe(this.b!=a.b)},pe.prototype.lessthan=function(a){return this.number().lessthan(a)},pe.prototype.greaterthan=function(a){return this.number().greaterthan(a)},pe.prototype.lessthanorequal=function(a){return this.number().lessthanorequal(a)},pe.prototype.greaterthanorequal=function(a){return this.number().greaterthanorequal(a)},pe.true_=new pe(!0),pe.false_=new pe(!1),nt.prototype=new Object,nt.prototype.constructor=nt,nt.superclass=Object.prototype;function nt(a){this.init(a)}nt.prototype.init=function(a){this.left=null,this.right=null,this.node=a,this.depth=1},nt.prototype.balance=function(){var a=this.left==null?0:this.left.depth,p=this.right==null?0:this.right.depth;if(a>p+1){var y=this.left.left==null?0:this.left.left.depth,E=this.left.right==null?0:this.left.right.depth;y<E&&this.left.rotateRR(),this.rotateLL()}else if(a+1<p){var b=this.right.right==null?0:this.right.right.depth,N=this.right.left==null?0:this.right.left.depth;N>b&&this.right.rotateLL(),this.rotateRR()}},nt.prototype.rotateLL=function(){var a=this.node,p=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=p,this.right.node=a,this.right.updateInNewLocation(),this.updateInNewLocation()},nt.prototype.rotateRR=function(){var a=this.node,p=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=p,this.left.node=a,this.left.updateInNewLocation(),this.updateInNewLocation()},nt.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},nt.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 Ss(a,p){if(a===p)return 0;if(a.compareDocumentPosition){var y=a.compareDocumentPosition(p);return y&1||y&10?1:y&20?-1:0}for(var E=0,b=0,N=a;N!=null;N=N.parentNode||N.ownerElement)E++;for(var G=p;G!=null;G=G.parentNode||G.ownerElement)b++;if(E>b){for(;E>b;)a=a.parentNode||a.ownerElement,E--;if(a===p)return 1}else if(b>E){for(;b>E;)p=p.parentNode||p.ownerElement,b--;if(a===p)return-1}for(var _e=a.parentNode||a.ownerElement,Ce=p.parentNode||p.ownerElement;_e!==Ce;)a=_e,p=Ce,_e=a.parentNode||a.ownerElement,Ce=p.parentNode||p.ownerElement;var ie=ae.isAttribute(a),Ae=ae.isAttribute(p);if(ie&&!Ae)return-1;if(!ie&&Ae)return 1;if(_e)for(var wt=ie?_e.attributes:_e.childNodes,je=wt.length,er=0;er<je;er+=1){var tr=wt[er];if(tr===a)return-1;if(tr===p)return 1}throw new Error("Unexpected: could not determine node order")}nt.prototype.add=function(a){if(a===this.node)return!1;var p=Ss(a,this.node),y=!1;return p==-1?this.left==null?(this.left=new nt(a),y=!0):(y=this.left.add(a),y&&this.balance()):p==1&&(this.right==null?(this.right=new nt(a),y=!0):(y=this.right.add(a),y&&this.balance())),y&&this.getDepthFromChildren(),y},se.prototype=new F,se.prototype.constructor=se,se.superclass=F.prototype;function se(){this.init()}se.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},se.prototype.toString=function(){var a=this.first();return a==null?"":this.stringForNode(a)},se.prototype.evaluate=function(a){return this},se.prototype.string=function(){return new he(this.toString())},se.prototype.stringValue=function(){return this.toString()},se.prototype.number=function(){return new ge(this.string())},se.prototype.numberValue=function(){return Number(this.string())},se.prototype.bool=function(){return new pe(this.booleanValue())},se.prototype.booleanValue=function(){return!!this.size},se.prototype.nodeset=function(){return this},se.prototype.stringForNode=function(a){return a.nodeType==k.DOCUMENT_NODE||a.nodeType==k.ELEMENT_NODE||a.nodeType===k.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(a):a.nodeType===k.ATTRIBUTE_NODE?a.value||a.nodeValue:a.isNamespaceNode?a.namespace:a.nodeValue},se.prototype.stringForContainerNode=function(a){for(var p="",y=a.firstChild;y!=null;y=y.nextSibling){var E=y.nodeType;(E===1||E===3||E===4||E===9||E===11)&&(p+=this.stringForNode(y))}return p},se.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new nt(this.nodes[0]);for(var a=1;a<this.nodes.length;a+=1)this.tree.add(this.nodes[a])}return this.tree},se.prototype.first=function(){var a=this.buildTree();if(a==null)return null;for(;a.left!=null;)a=a.left;return a.node},se.prototype.add=function(a){for(var p=0;p<this.nodes.length;p+=1)if(a===this.nodes[p])return;this.tree=null,this.nodes.push(a),this.size+=1},se.prototype.addArray=function(a){var p=this;i(function(y){p.add(y)},a)},se.prototype.toArray=function(){var a=[];return this.toArrayRec(this.buildTree(),a),a},se.prototype.toArrayRec=function(a,p){a!=null&&(this.toArrayRec(a.left,p),p.push(a.node),this.toArrayRec(a.right,p))},se.prototype.toUnsortedArray=function(){return this.nodes.slice()},se.prototype.compareWithString=function(a,p){for(var y=this.toUnsortedArray(),E=0;E<y.length;E++){var b=y[E],N=new he(this.stringForNode(b)),G=p(N,a);if(G.booleanValue())return G}return new pe(!1)},se.prototype.compareWithNumber=function(a,p){for(var y=this.toUnsortedArray(),E=0;E<y.length;E++){var b=y[E],N=new ge(this.stringForNode(b)),G=p(N,a);if(G.booleanValue())return G}return new pe(!1)},se.prototype.compareWithBoolean=function(a,p){return p(this.bool(),a)},se.prototype.compareWithNodeSet=function(a,p){for(var y=this.toUnsortedArray(),E=function(_e,Ce){return p(Ce,_e)},b=0;b<y.length;b++){var N=new he(this.stringForNode(y[b])),G=a.compareWithString(N,E);if(G.booleanValue())return G}return new pe(!1)},se.compareWith=r(function(a,p){return ae.instance_of(p,he)?this.compareWithString(p,a):ae.instance_of(p,ge)?this.compareWithNumber(p,a):ae.instance_of(p,pe)?this.compareWithBoolean(p,a):this.compareWithNodeSet(p,a)}),se.prototype.equals=se.compareWith(Le.equals),se.prototype.notequal=se.compareWith(Le.notequal),se.prototype.lessthan=se.compareWith(Le.lessthan),se.prototype.greaterthan=se.compareWith(Le.greaterthan),se.prototype.lessthanorequal=se.compareWith(Le.lessthanorequal),se.prototype.greaterthanorequal=se.compareWith(Le.greaterthanorequal),se.prototype.union=function(a){var p=new se;return p.addArray(this.toUnsortedArray()),p.addArray(a.toUnsortedArray()),p},Ot.prototype=new Object,Ot.prototype.constructor=Ot,Ot.superclass=Object.prototype;function Ot(a,p,y){this.isXPathNamespace=!0,this.ownerDocument=y.ownerDocument,this.nodeName="#namespace",this.prefix=a,this.localName=a,this.namespaceURI=p,this.nodeValue=p,this.ownerElement=y,this.nodeType=Ot.XPATH_NAMESPACE_NODE}Ot.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Ut.prototype=new Object,Ut.prototype.constructor=Ut,Ut.superclass=Object.prototype;function Ut(a,p,y){this.variableResolver=a??new pn,this.namespaceResolver=p??new Qt,this.functionResolver=y??new yt}Ut.prototype.extend=function(a){return S(new Ut,this,a)},pn.prototype=new Object,pn.prototype.constructor=pn,pn.superclass=Object.prototype;function pn(){}pn.prototype.getVariable=function(a,p){return null},yt.prototype=new Object,yt.prototype.constructor=yt,yt.superclass=Object.prototype;function yt(a){this.thisArg=a??me,this.functions=new Object,this.addStandardFunctions()}yt.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},yt.prototype.addFunction=function(a,p,y){this.functions["{"+a+"}"+p]=y},yt.getFunctionFromContext=function(a,p){var y=ae.resolveQName(a,p.namespaceResolver,p.contextNode,!1);if(y[0]===null)throw new Error("Cannot resolve QName "+name);return p.functionResolver.getFunction(y[1],y[0])},yt.prototype.getFunction=function(a,p){return this.functions["{"+p+"}"+a]},Qt.prototype=new Object,Qt.prototype.constructor=Qt,Qt.superclass=Object.prototype;function Qt(){}Qt.prototype.getNamespace=function(a,p){if(a=="xml")return O.XML_NAMESPACE_URI;if(a=="xmlns")return O.XMLNS_NAMESPACE_URI;for(p.nodeType==k.DOCUMENT_NODE?p=p.documentElement:p.nodeType==k.ATTRIBUTE_NODE?p=ye.getOwnerElement(p):p.nodeType!=k.ELEMENT_NODE&&(p=p.parentNode);p!=null&&p.nodeType==k.ELEMENT_NODE;){for(var y=p.attributes,E=0;E<y.length;E++){var b=y.item(E),N=b.name||b.nodeName;if(N==="xmlns"&&a===""||N==="xmlns:"+a)return String(b.value||b.nodeValue)}p=p.parentNode}return null};var me=new Object;me.last=function(a){if(arguments.length!=1)throw new Error("Function last expects ()");return new ge(a.contextSize)},me.position=function(a){if(arguments.length!=1)throw new Error("Function position expects ()");return new ge(a.contextPosition)},me.count=function(){var a=arguments[0],p;if(arguments.length!=2||!ae.instance_of(p=arguments[1].evaluate(a),se))throw new Error("Function count expects (node-set)");return new ge(p.size)},me.id=function(){var a=arguments[0],p;if(arguments.length!=2)throw new Error("Function id expects (object)");p=arguments[1].evaluate(a),ae.instance_of(p,se)?p=p.toArray().join(" "):p=p.stringValue();for(var y=p.split(/[\x0d\x0a\x09\x20]+/),E=new se,b=a.contextNode.nodeType==k.DOCUMENT_NODE?a.contextNode:a.contextNode.ownerDocument,N=0;N<y.length;N++){var G;b.getElementById?G=b.getElementById(y[N]):G=ae.getElementById(b,y[N]),G!=null&&E.add(G)}return E},me.localName=function(a,p){var y;if(arguments.length==1)y=a.contextNode;else if(arguments.length==2)y=p.evaluate(a).first();else throw new Error("Function local-name expects (node-set?)");return y==null?new he(""):new he(y.localName||y.baseName||y.target||y.nodeName||"")},me.namespaceURI=function(){var a=arguments[0],p;if(arguments.length==1)p=a.contextNode;else if(arguments.length==2)p=arguments[1].evaluate(a).first();else throw new Error("Function namespace-uri expects (node-set?)");return p==null?new he(""):new he(p.namespaceURI)},me.name=function(){var a=arguments[0],p;if(arguments.length==1)p=a.contextNode;else if(arguments.length==2)p=arguments[1].evaluate(a).first();else throw new Error("Function name expects (node-set?)");return p==null?new he(""):p.nodeType==k.ELEMENT_NODE?new he(p.nodeName):p.nodeType==k.ATTRIBUTE_NODE?new he(p.name||p.nodeName):p.nodeType===k.PROCESSING_INSTRUCTION_NODE?new he(p.target||p.nodeName):p.localName==null?new he(""):new he(p.localName)},me.string=function(){var a=arguments[0];if(arguments.length==1)return new he(se.prototype.stringForNode(a.contextNode));if(arguments.length==2)return arguments[1].evaluate(a).string();throw new Error("Function string expects (object?)")},me.concat=function(a){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var p="",y=1;y<arguments.length;y++)p+=arguments[y].evaluate(a).stringValue();return new he(p)},me.startsWith=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();return new pe(p.substring(0,y.length)==y)},me.contains=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();return new pe(p.indexOf(y)!==-1)},me.substringBefore=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();return new he(p.substring(0,p.indexOf(y)))},me.substringAfter=function(){var a=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var p=arguments[1].evaluate(a).stringValue(),y=arguments[2].evaluate(a).stringValue();if(y.length==0)return new he(p);var E=p.indexOf(y);return E==-1?new he(""):new he(p.substring(E+y.length))},me.substring=function(){var a=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var p=arguments[1].evaluate(a).stringValue(),y=Math.round(arguments[2].evaluate(a).numberValue())-1,E=arguments.length==4?y+Math.round(arguments[3].evaluate(a).numberValue()):void 0;return new he(p.substring(y,E))},me.stringLength=function(){var a=arguments[0],p;if(arguments.length==1)p=se.prototype.stringForNode(a.contextNode);else if(arguments.length==2)p=arguments[1].evaluate(a).stringValue();else throw new Error("Function string-length expects (string?)");return new ge(p.length)},me.normalizeSpace=function(){var a=arguments[0],p;if(arguments.length==1)p=se.prototype.stringForNode(a.contextNode);else if(arguments.length==2)p=arguments[1].evaluate(a).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var y=0,E=p.length-1;ae.isSpace(p.charCodeAt(E));)E--;for(var b="";y<=E&&ae.isSpace(p.charCodeAt(y));)y++;for(;y<=E;)if(ae.isSpace(p.charCodeAt(y)))for(b+=" ";y<=E&&ae.isSpace(p.charCodeAt(y));)y++;else b+=p.charAt(y),y++;return new he(b)},me.translate=function(a,p,y,E){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var b=p.evaluate(a).stringValue(),N=y.evaluate(a).stringValue(),G=E.evaluate(a).stringValue(),_e=o(function(ie,Ae,wt){return Ae in ie||(ie[Ae]=wt>G.length?"":G[wt]),ie},{},N),Ce=h("",c(function(ie){return ie in _e?_e[ie]:ie},b));return new he(Ce)},me.boolean_=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(a).bool()},me.not=function(a,p){if(arguments.length!=2)throw new Error("Function not expects (object)");return p.evaluate(a).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 a=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var p,y=a.contextNode;y!=null&&y.nodeType!=k.DOCUMENT_NODE;y=y.parentNode){var E=y.getAttributeNS(O.XML_NAMESPACE_URI,"lang");if(E!=null){p=String(E);break}}if(p==null)return pe.false_;var b=arguments[1].evaluate(a).stringValue();return new pe(p.substring(0,b.length)==b&&(p.length==b.length||p.charAt(b.length)=="-"))},me.number=function(){var a=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new ge(se.prototype.stringForNode(a.contextNode)):arguments[1].evaluate(a).number()},me.sum=function(){var a=arguments[0],p;if(arguments.length!=2||!ae.instance_of(p=arguments[1].evaluate(a),se))throw new Error("Function sum expects (node-set)");p=p.toUnsortedArray();for(var y=0,E=0;E<p.length;E++)y+=new ge(se.prototype.stringForNode(p[E])).numberValue();return new ge(y)},me.floor=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new ge(Math.floor(arguments[1].evaluate(a).numberValue()))},me.ceiling=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new ge(Math.ceil(arguments[1].evaluate(a).numberValue()))},me.round=function(){var a=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new ge(Math.round(arguments[1].evaluate(a).numberValue()))};var ae=new Object;ae.isAttribute=function(a){return a&&(a.nodeType===k.ATTRIBUTE_NODE||a.ownerElement)},ae.splitQName=function(a){var p=a.indexOf(":");return p==-1?[null,a]:[a.substring(0,p),a.substring(p+1)]},ae.resolveQName=function(a,p,y,E){var b=ae.splitQName(a);return b[0]!=null?b[0]=p.getNamespace(b[0],y):E?(b[0]=p.getNamespace("",y),b[0]==null&&(b[0]="")):b[0]="",b},ae.isSpace=function(a){return a==9||a==13||a==10||a==32},ae.isLetter=function(a){return a>=65&&a<=90||a>=97&&a<=122||a>=192&&a<=214||a>=216&&a<=246||a>=248&&a<=255||a>=256&&a<=305||a>=308&&a<=318||a>=321&&a<=328||a>=330&&a<=382||a>=384&&a<=451||a>=461&&a<=496||a>=500&&a<=501||a>=506&&a<=535||a>=592&&a<=680||a>=699&&a<=705||a==902||a>=904&&a<=906||a==908||a>=910&&a<=929||a>=931&&a<=974||a>=976&&a<=982||a==986||a==988||a==990||a==992||a>=994&&a<=1011||a>=1025&&a<=1036||a>=1038&&a<=1103||a>=1105&&a<=1116||a>=1118&&a<=1153||a>=1168&&a<=1220||a>=1223&&a<=1224||a>=1227&&a<=1228||a>=1232&&a<=1259||a>=1262&&a<=1269||a>=1272&&a<=1273||a>=1329&&a<=1366||a==1369||a>=1377&&a<=1414||a>=1488&&a<=1514||a>=1520&&a<=1522||a>=1569&&a<=1594||a>=1601&&a<=1610||a>=1649&&a<=1719||a>=1722&&a<=1726||a>=1728&&a<=1742||a>=1744&&a<=1747||a==1749||a>=1765&&a<=1766||a>=2309&&a<=2361||a==2365||a>=2392&&a<=2401||a>=2437&&a<=2444||a>=2447&&a<=2448||a>=2451&&a<=2472||a>=2474&&a<=2480||a==2482||a>=2486&&a<=2489||a>=2524&&a<=2525||a>=2527&&a<=2529||a>=2544&&a<=2545||a>=2565&&a<=2570||a>=2575&&a<=2576||a>=2579&&a<=2600||a>=2602&&a<=2608||a>=2610&&a<=2611||a>=2613&&a<=2614||a>=2616&&a<=2617||a>=2649&&a<=2652||a==2654||a>=2674&&a<=2676||a>=2693&&a<=2699||a==2701||a>=2703&&a<=2705||a>=2707&&a<=2728||a>=2730&&a<=2736||a>=2738&&a<=2739||a>=2741&&a<=2745||a==2749||a==2784||a>=2821&&a<=2828||a>=2831&&a<=2832||a>=2835&&a<=2856||a>=2858&&a<=2864||a>=2866&&a<=2867||a>=2870&&a<=2873||a==2877||a>=2908&&a<=2909||a>=2911&&a<=2913||a>=2949&&a<=2954||a>=2958&&a<=2960||a>=2962&&a<=2965||a>=2969&&a<=2970||a==2972||a>=2974&&a<=2975||a>=2979&&a<=2980||a>=2984&&a<=2986||a>=2990&&a<=2997||a>=2999&&a<=3001||a>=3077&&a<=3084||a>=3086&&a<=3088||a>=3090&&a<=3112||a>=3114&&a<=3123||a>=3125&&a<=3129||a>=3168&&a<=3169||a>=3205&&a<=3212||a>=3214&&a<=3216||a>=3218&&a<=3240||a>=3242&&a<=3251||a>=3253&&a<=3257||a==3294||a>=3296&&a<=3297||a>=3333&&a<=3340||a>=3342&&a<=3344||a>=3346&&a<=3368||a>=3370&&a<=3385||a>=3424&&a<=3425||a>=3585&&a<=3630||a==3632||a>=3634&&a<=3635||a>=3648&&a<=3653||a>=3713&&a<=3714||a==3716||a>=3719&&a<=3720||a==3722||a==3725||a>=3732&&a<=3735||a>=3737&&a<=3743||a>=3745&&a<=3747||a==3749||a==3751||a>=3754&&a<=3755||a>=3757&&a<=3758||a==3760||a>=3762&&a<=3763||a==3773||a>=3776&&a<=3780||a>=3904&&a<=3911||a>=3913&&a<=3945||a>=4256&&a<=4293||a>=4304&&a<=4342||a==4352||a>=4354&&a<=4355||a>=4357&&a<=4359||a==4361||a>=4363&&a<=4364||a>=4366&&a<=4370||a==4412||a==4414||a==4416||a==4428||a==4430||a==4432||a>=4436&&a<=4437||a==4441||a>=4447&&a<=4449||a==4451||a==4453||a==4455||a==4457||a>=4461&&a<=4462||a>=4466&&a<=4467||a==4469||a==4510||a==4520||a==4523||a>=4526&&a<=4527||a>=4535&&a<=4536||a==4538||a>=4540&&a<=4546||a==4587||a==4592||a==4601||a>=7680&&a<=7835||a>=7840&&a<=7929||a>=7936&&a<=7957||a>=7960&&a<=7965||a>=7968&&a<=8005||a>=8008&&a<=8013||a>=8016&&a<=8023||a==8025||a==8027||a==8029||a>=8031&&a<=8061||a>=8064&&a<=8116||a>=8118&&a<=8124||a==8126||a>=8130&&a<=8132||a>=8134&&a<=8140||a>=8144&&a<=8147||a>=8150&&a<=8155||a>=8160&&a<=8172||a>=8178&&a<=8180||a>=8182&&a<=8188||a==8486||a>=8490&&a<=8491||a==8494||a>=8576&&a<=8578||a>=12353&&a<=12436||a>=12449&&a<=12538||a>=12549&&a<=12588||a>=44032&&a<=55203||a>=19968&&a<=40869||a==12295||a>=12321&&a<=12329},ae.isNCNameChar=function(a){return a>=48&&a<=57||a>=1632&&a<=1641||a>=1776&&a<=1785||a>=2406&&a<=2415||a>=2534&&a<=2543||a>=2662&&a<=2671||a>=2790&&a<=2799||a>=2918&&a<=2927||a>=3047&&a<=3055||a>=3174&&a<=3183||a>=3302&&a<=3311||a>=3430&&a<=3439||a>=3664&&a<=3673||a>=3792&&a<=3801||a>=3872&&a<=3881||a==46||a==45||a==95||ae.isLetter(a)||a>=768&&a<=837||a>=864&&a<=865||a>=1155&&a<=1158||a>=1425&&a<=1441||a>=1443&&a<=1465||a>=1467&&a<=1469||a==1471||a>=1473&&a<=1474||a==1476||a>=1611&&a<=1618||a==1648||a>=1750&&a<=1756||a>=1757&&a<=1759||a>=1760&&a<=1764||a>=1767&&a<=1768||a>=1770&&a<=1773||a>=2305&&a<=2307||a==2364||a>=2366&&a<=2380||a==2381||a>=2385&&a<=2388||a>=2402&&a<=2403||a>=2433&&a<=2435||a==2492||a==2494||a==2495||a>=2496&&a<=2500||a>=2503&&a<=2504||a>=2507&&a<=2509||a==2519||a>=2530&&a<=2531||a==2562||a==2620||a==2622||a==2623||a>=2624&&a<=2626||a>=2631&&a<=2632||a>=2635&&a<=2637||a>=2672&&a<=2673||a>=2689&&a<=2691||a==2748||a>=2750&&a<=2757||a>=2759&&a<=2761||a>=2763&&a<=2765||a>=2817&&a<=2819||a==2876||a>=2878&&a<=2883||a>=2887&&a<=2888||a>=2891&&a<=2893||a>=2902&&a<=2903||a>=2946&&a<=2947||a>=3006&&a<=3010||a>=3014&&a<=3016||a>=3018&&a<=3021||a==3031||a>=3073&&a<=3075||a>=3134&&a<=3140||a>=3142&&a<=3144||a>=3146&&a<=3149||a>=3157&&a<=3158||a>=3202&&a<=3203||a>=3262&&a<=3268||a>=3270&&a<=3272||a>=3274&&a<=3277||a>=3285&&a<=3286||a>=3330&&a<=3331||a>=3390&&a<=3395||a>=3398&&a<=3400||a>=3402&&a<=3405||a==3415||a==3633||a>=3636&&a<=3642||a>=3655&&a<=3662||a==3761||a>=3764&&a<=3769||a>=3771&&a<=3772||a>=3784&&a<=3789||a>=3864&&a<=3865||a==3893||a==3895||a==3897||a==3902||a==3903||a>=3953&&a<=3972||a>=3974&&a<=3979||a>=3984&&a<=3989||a==3991||a>=3993&&a<=4013||a>=4017&&a<=4023||a==4025||a>=8400&&a<=8412||a==8417||a>=12330&&a<=12335||a==12441||a==12442||a==183||a==720||a==721||a==903||a==1600||a==3654||a==3782||a==12293||a>=12337&&a<=12341||a>=12445&&a<=12446||a>=12540&&a<=12542},ae.coalesceText=function(a){for(var p=a.firstChild;p!=null;p=p.nextSibling)if(p.nodeType==k.TEXT_NODE||p.nodeType==k.CDATA_SECTION_NODE){var y=p.nodeValue,E=p;for(p=p.nextSibling;p!=null&&(p.nodeType==k.TEXT_NODE||p.nodeType==k.CDATA_SECTION_NODE);){y+=p.nodeValue;var b=p;p=p.nextSibling,b.parentNode.removeChild(b)}if(E.nodeType==k.CDATA_SECTION_NODE){var N=E.parentNode;if(E.nextSibling==null)N.removeChild(E),N.appendChild(N.ownerDocument.createTextNode(y));else{var G=E.nextSibling;N.removeChild(E),N.insertBefore(N.ownerDocument.createTextNode(y),G)}}else E.nodeValue=y;if(p==null)break}else p.nodeType==k.ELEMENT_NODE&&ae.coalesceText(p)},ae.instance_of=function(a,p){for(;a!=null;){if(a.constructor===p)return!0;if(a===Object)return!1;a=a.constructor.superclass}return!1},ae.getElementById=function(a,p){if(a.nodeType==k.ELEMENT_NODE&&(a.getAttribute("id")==p||a.getAttributeNS(null,"id")==p))return a;for(var y=a.firstChild;y!=null;y=y.nextSibling){var E=ae.getElementById(y,p);if(E!=null)return E}return null};var Mt=function(){function a(y,E){var b=E?": "+E.toString():"";switch(y){case p.INVALID_EXPRESSION_ERR:return"Invalid expression"+b;case p.TYPE_ERR:return"Type error"+b}return null}function p(y,E,b){var N=Error.call(this,a(y,E)||b);return N.code=y,N.exception=E,N}return p.prototype=Object.create(Error.prototype),p.prototype.constructor=p,p.superclass=Error,p.prototype.toString=function(){return this.message},p.fromMessage=function(y,E){return new p(null,E,y)},p.INVALID_EXPRESSION_ERR=51,p.TYPE_ERR=52,p}();zt.prototype={},zt.prototype.constructor=zt,zt.superclass=Object.prototype;function zt(a,p,y){this.xpath=y.parse(a),this.context=new Ut,this.context.namespaceResolver=new hn(p)}zt.getOwnerDocument=function(a){return a.nodeType===k.DOCUMENT_NODE?a:a.ownerDocument},zt.detectHtmlDom=function(a){if(!a)return!1;var p=zt.getOwnerDocument(a);try{return p.implementation.hasFeature("HTML","2.0")}catch{return!0}},zt.prototype.evaluate=function(a,p,y){this.context.expressionContextNode=a,this.context.caseInsensitive=zt.detectHtmlDom(a);var E=this.xpath.evaluate(this.context);return new z(E,p)},hn.prototype={},hn.prototype.constructor=hn,hn.superclass=Object.prototype;function hn(a){this.xpathNSResolver=a}hn.prototype.getNamespace=function(a,p){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(a)},D.prototype={},D.prototype.constructor=D,D.superclass=Object.prototype;function D(a){this.node=a,this.namespaceResolver=new Qt}D.prototype.lookupNamespaceURI=function(a){return this.namespaceResolver.getNamespace(a,this.node)},z.prototype={},z.prototype.constructor=z,z.superclass=Object.prototype;function z(a,p){switch(p==z.ANY_TYPE&&(a.constructor===he?p=z.STRING_TYPE:a.constructor===ge?p=z.NUMBER_TYPE:a.constructor===pe?p=z.BOOLEAN_TYPE:a.constructor===se&&(p=z.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=p,p){case z.NUMBER_TYPE:this.numberValue=a.numberValue();return;case z.STRING_TYPE:this.stringValue=a.stringValue();return;case z.BOOLEAN_TYPE:this.booleanValue=a.booleanValue();return;case z.ANY_UNORDERED_NODE_TYPE:case z.FIRST_ORDERED_NODE_TYPE:if(a.constructor===se){this.singleNodeValue=a.first();return}break;case z.UNORDERED_NODE_ITERATOR_TYPE:case z.ORDERED_NODE_ITERATOR_TYPE:if(a.constructor===se){this.invalidIteratorState=!1,this.nodes=a.toArray(),this.iteratorIndex=0;return}break;case z.UNORDERED_NODE_SNAPSHOT_TYPE:case z.ORDERED_NODE_SNAPSHOT_TYPE:if(a.constructor===se){this.nodes=a.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Mt(Mt.TYPE_ERR)}z.prototype.iterateNext=function(){if(this.resultType!=z.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=z.ORDERED_NODE_ITERATOR_TYPE)throw new Mt(Mt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},z.prototype.snapshotItem=function(a){if(this.resultType!=z.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=z.ORDERED_NODE_SNAPSHOT_TYPE)throw new Mt(Mt.TYPE_ERR);return this.nodes[a]},z.ANY_TYPE=0,z.NUMBER_TYPE=1,z.STRING_TYPE=2,z.BOOLEAN_TYPE=3,z.UNORDERED_NODE_ITERATOR_TYPE=4,z.ORDERED_NODE_ITERATOR_TYPE=5,z.UNORDERED_NODE_SNAPSHOT_TYPE=6,z.ORDERED_NODE_SNAPSHOT_TYPE=7,z.ANY_UNORDERED_NODE_TYPE=8,z.FIRST_ORDERED_NODE_TYPE=9;function M(a,p){a.createExpression=function(y,E){try{return new zt(y,E,p)}catch(b){throw new Mt(Mt.INVALID_EXPRESSION_ERR,b)}},a.createNSResolver=function(y){return new D(y)},a.evaluate=function(y,E,b,N,G){if(N<0||N>9)throw{code:0,toString:function(){return"Request type not supported"}};return a.createExpression(y,b,p).evaluate(E,N,G)}}try{var ee=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(ee=!1)}catch{}ee&&M(document,new v)}catch{}M(n,new v),function(){var a=new v,p=new Qt,y=new yt,E=new pn;function b(Y){return{getNamespace:function(Ie,vt){var nr=Y(Ie,vt);return nr||p.getNamespace(Ie,vt)}}}function N(Y){return b(Y.getNamespace.bind(Y))}function G(Y){return b(function(Ie){return Y[Ie]})}function _e(Y){return Y&&typeof Y.getNamespace=="function"?N(Y):typeof Y=="function"?b(Y):typeof Y=="object"?G(Y):p}function Ce(Y){if(Y===null||typeof Y>"u"||Y instanceof he||Y instanceof pe||Y instanceof ge||Y instanceof se)return Y;switch(typeof Y){case"string":return new he(Y);case"boolean":return new pe(Y);case"number":return new ge(Y)}var Ie=new se;return Ie.addArray([].concat(Y)),Ie}function ie(Y){return function(Ie){var vt=Array.prototype.slice.call(arguments,1).map(function(Oy){return Oy.evaluate(Ie)}),nr=Y.apply(this,[].concat(Ie,vt));return Ce(nr)}}function Ae(Y){return{getFunction:function(Ie,vt){var nr=Y(Ie,vt);return nr?ie(nr):y.getFunction(Ie,vt)}}}function wt(Y){return Ae(Y.getFunction.bind(Y))}function je(Y){return Ae(function(Ie){return Y[Ie]})}function er(Y){return Y&&typeof Y.getFunction=="function"?wt(Y):typeof Y=="function"?Ae(Y):typeof Y=="object"?je(Y):y}function tr(Y){return{getVariable:function(Ie,vt){var nr=Y(Ie,vt);return Ce(nr)}}}function Sy(Y){if(Y){if(typeof Y.getVariable=="function")return tr(Y.getVariable.bind(Y));if(typeof Y=="function")return tr(Y);if(typeof Y=="object")return tr(function(Ie){return Y[Ie]})}return E}function If(Y,Ie,vt){Y in vt&&(Ie[Y]=vt[Y])}function Ny(Y){var Ie=new Ut;return Y?(Ie.namespaceResolver=_e(Y.namespaces),Ie.functionResolver=er(Y.functions),Ie.variableResolver=Sy(Y.variables),Ie.expressionContextNode=Y.node,If("allowAnyNamespaceForNoPrefix",Ie,Y),If("isHtml",Ie,Y)):Ie.namespaceResolver=p,Ie}function Cy(Y,Ie){var vt=Ny(Ie);return Y.evaluate(vt)}var Iy={evaluate:function(Y){return Cy(this.expression,Y)},evaluateNumber:function(Y){return this.evaluate(Y).numberValue()},evaluateString:function(Y){return this.evaluate(Y).stringValue()},evaluateBoolean:function(Y){return this.evaluate(Y).booleanValue()},evaluateNodeSet:function(Y){return this.evaluate(Y).nodeset()},select:function(Y){return this.evaluateNodeSet(Y).toArray()},select1:function(Y){return this.select(Y)[0]}};function Ty(Y){var Ie=a.parse(Y);return Object.create(Iy,{expression:{value:Ie}})}n.parse=Ty}(),S(n,{XPath:O,XPathParser:v,XPathResult:z,Step:Q,PathExpr:ye,NodeTest:oe,LocationPath:Zt,OrOperation:ue,AndOperation:Ne,BarOperation:Z,EqualsOperation:B,NotEqualOperation:L,LessThanOperation:R,GreaterThanOperation:I,LessThanOrEqualOperation:C,GreaterThanOrEqualOperation:j,PlusOperation:V,MinusOperation:de,MultiplyOperation:ne,DivOperation:ve,ModOperation:Ee,UnaryMinusOperation:W,FunctionCall:Tt,VariableReference:Ye,XPathContext:Ut,XNodeSet:se,XBoolean:pe,XString:he,XNumber:ge,NamespaceResolver:Qt,FunctionResolver:yt,VariableResolver:pn,Utilities:ae}),n.select=function(a,p,y){return n.selectWithResolver(a,p,null,y)},n.useNamespaces=function(a){var p={mappings:a||{},lookupNamespaceURI:function(y){return this.mappings[y]}};return function(y,E,b){return n.selectWithResolver(y,E,p,b)}},n.selectWithResolver=function(a,p,y,E){var b=new zt(a,y,new v),N=z.ANY_TYPE,G=b.evaluate(p,N,null);return G.resultType==z.STRING_TYPE?G=G.stringValue:G.resultType==z.NUMBER_TYPE?G=G.numberValue:G.resultType==z.BOOLEAN_TYPE?G=G.booleanValue:(G=G.nodes,E&&(G=G[0])),G},n.select1=function(a,p){return n.select(a,p,!0)};var we=function(a){return a&&typeof a.nodeType=="number"&&Number.isInteger(a.nodeType)&&a.nodeType>=1&&a.nodeType<=11&&typeof a.nodeName=="string"},Ze=function(a){return Array.isArray(a)&&a.every(we)},Re=function(a){return function(p){return we(p)&&p.nodeType===a}};S(n,{isNodeLike:we,isArrayOfNodes:Ze,isElement:Re(k.ELEMENT_NODE),isAttribute:Re(k.ATTRIBUTE_NODE),isTextNode:Re(k.TEXT_NODE),isCDATASection:Re(k.CDATA_SECTION_NODE),isProcessingInstruction:Re(k.PROCESSING_INSTRUCTION_NODE),isComment:Re(k.COMMENT_NODE),isDocumentNode:Re(k.DOCUMENT_NODE),isDocumentTypeNode:Re(k.DOCUMENT_TYPE_NODE),isDocumentFragment:Re(k.DOCUMENT_FRAGMENT_NODE)})})(e)})(_l);var be={};Object.defineProperty(be,"__esModule",{value:!0});be.assertIsDocumentFragmentNode=be.assertIsDocumentTypeNode=be.assertIsDocumentNode=be.assertIsCommentNode=be.assertIsProcessingInstructionNode=be.assertIsCDATASectionNode=be.assertIsTextNode=be.assertIsAttributeNode=be.assertIsElementNode=be.isDocumentFragmentNode=be.isDocumentTypeNode=be.isDocumentNode=be.isCommentNode=be.isProcessingInstructionNode=be.isCDATASectionNode=be.isTextNode=be.isAttributeNode=be.isElementNode=be.assertIsArrayOfNodes=be.isArrayOfNodes=be.assertIsNodeLike=be.isNodeLike=be.NodeTypes=void 0;var Ke;(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"})(Ke||(be.NodeTypes=Ke={}));function yl(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"}be.isNodeLike=yl;function R6(t){if(!yl(t))throw new Error(`Value is not a Node-like object. Received: ${t}`)}be.assertIsNodeLike=R6;function W_(t){return Array.isArray(t)&&t.every(yl)}be.isArrayOfNodes=W_;function P6(t){if(!W_(t))throw new Error("Value is not an array of Nodes")}be.assertIsArrayOfNodes=P6;function Sn(t,e){return yl(e)&&e.nodeType===t}function Yn(t,e){const n=Object.keys(Ke).find(r=>Ke[r]===t);if(!Sn(t,e))throw new Error(`Value is not of type ${n}`)}const B6=t=>Sn(Ke.ELEMENT_NODE,t);be.isElementNode=B6;const j6=t=>Sn(Ke.ATTRIBUTE_NODE,t);be.isAttributeNode=j6;const L6=t=>Sn(Ke.TEXT_NODE,t);be.isTextNode=L6;const F6=t=>Sn(Ke.CDATA_SECTION_NODE,t);be.isCDATASectionNode=F6;const U6=t=>Sn(Ke.PROCESSING_INSTRUCTION_NODE,t);be.isProcessingInstructionNode=U6;const M6=t=>Sn(Ke.COMMENT_NODE,t);be.isCommentNode=M6;const q6=t=>Sn(Ke.DOCUMENT_NODE,t);be.isDocumentNode=q6;const V6=t=>Sn(Ke.DOCUMENT_TYPE_NODE,t);be.isDocumentTypeNode=V6;const H6=t=>Sn(Ke.DOCUMENT_FRAGMENT_NODE,t);be.isDocumentFragmentNode=H6;const K6=t=>{Yn(Ke.ELEMENT_NODE,t)};be.assertIsElementNode=K6;const G6=t=>Yn(Ke.ATTRIBUTE_NODE,t);be.assertIsAttributeNode=G6;const W6=t=>Yn(Ke.TEXT_NODE,t);be.assertIsTextNode=W6;const X6=t=>Yn(Ke.CDATA_SECTION_NODE,t);be.assertIsCDATASectionNode=X6;const J6=t=>Yn(Ke.PROCESSING_INSTRUCTION_NODE,t);be.assertIsProcessingInstructionNode=J6;const Y6=t=>Yn(Ke.COMMENT_NODE,t);be.assertIsCommentNode=Y6;const Z6=t=>Yn(Ke.DOCUMENT_NODE,t);be.assertIsDocumentNode=Z6;const Q6=t=>Yn(Ke.DOCUMENT_TYPE_NODE,t);be.assertIsDocumentTypeNode=Q6;const e9=t=>Yn(Ke.DOCUMENT_FRAGMENT_NODE,t);be.assertIsDocumentFragmentNode=e9;(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=_l,n=be;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 o(F,H,W,J){return F.localName===H&&(!F.namespaceURI&&(J==null?void 0:J.namespaceURI)===W||W==null)}function c(F,H,W){for(let J=0;J<F.attributes.length;J++){const ue=F.attributes[J];if(i(ue,H,W)||o(ue,H,W,F))return ue}return null}t.findAttr=c;function l(F,H,W){const J=F.documentElement??F,ue=[];for(let Ne=0;Ne<J.childNodes.length;Ne++){const B=J.childNodes[Ne];n.isElementNode(B)&&B.localName===H&&(B.namespaceURI===W||W==null)&&ue.push(B)}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;"},f={"&":"&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 _(F){return F.replace(/([&<>\r])/g,function(H,W){return f[W]})}t.encodeSpecialCharactersInText=_,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 $(F){return`${(F.trim().replace(/(\r\n|\r)/g,`
266
266
  `).match(/.{1,64}/g)??[]).join(`
267
267
  `)}
268
268
  `}t.normalizePem=$;function m(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=m;function x(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 $(W);if(t.BASE64_REGEX.test(W.replace(/ /g,""))){if(H==null)throw new Error("PEM label is required when DER is given.");const J=`-----BEGIN ${H}-----
269
269
  ${W.replace(/ /g,"")}
270
- -----END ${H}-----`;return $(J)}throw new Error("Unknown DER format.")}t.derToPem=x;function S(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 J=0;J<W.attributes.length;J++){const ue=W.attributes[J];ue&&ue.nodeName&&ue.nodeName.search(/^xmlns:?/)!==-1&&H.push({prefix:ue.nodeName.replace(/^xmlns:?/,""),namespaceURI:ue.nodeValue||""})}return S(W,H)}function k(F){const H=F.attributes;for(let W=0;W<H.length;W++){const J=H[W].nodeName;if(J.search(/^xmlns:?/)!==-1)return J.replace(/^xmlns:?/,"")}return F.prefix||""}function v(F){return F.every(H=>n.isElementNode(H))}function O(F,H,W){if(H==null)return[];const J=e.selectWithResolver(H,F,W);if(!r(J))return[];if(!v(J))throw new Error("Document subset must be list of elements");const ue=S(J[0]),Ne=[];for(let R=0;R<ue.length;R++){let I=!0;for(const C in Ne)if(Ne[C].prefix===ue[R].prefix){I=!1;break}I&&Ne.push(ue[R])}const B=[],L=k(J[0]);for(const R of Ne)R.prefix!==L&&B.push(R);return B}t.findAncestorNs=O;function q(F,H){const W=Buffer.from(F,"base64"),J=Buffer.from(H,"base64");if(typeof W.equals=="function")return W.equals(J);if(W.length!==J.length)return!1;for(let ue=0;ue<W.length;ue++)if(W[ue]!==J[ue])return!1;return!0}t.validateDigestValue=q})(vs);Object.defineProperty(Zr,"__esModule",{value:!0});Zr.C14nCanonicalizationWithComments=Zr.C14nCanonicalization=void 0;const Rs=vs,Jl=be;class W_{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(Jl.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(c=>` ${c.name}="${Rs.encodeSpecialCharactersInAttribute(c.value)}"`).join("")}renderNs(e,n,r,i,o){let c,l;const u=[];let d=r;const f=[],h=e.namespaceURI||"";if(e.prefix?n.indexOf(e.prefix)===-1&&(f.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(c=0;c<e.attributes.length;++c)l=e.attributes[c],l.prefix==="xmlns"&&n.indexOf(l.localName)===-1&&(f.push({prefix:l.localName,namespaceURI:l.value}),n.push(l.localName)),l.prefix&&n.indexOf(l.prefix)===-1&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(f.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push(l.prefix));if(Rs.isArrayHasLength(o))for(const _ of o){let $=!1;for(const m of f)m.prefix===_.prefix&&m.namespaceURI===_.namespaceURI&&($=!0);$||f.push(_)}return f.sort(this.nsCompare),u.push(...f.map(_=>_.prefix?` xmlns:${_.prefix}="${_.namespaceURI}"`:` xmlns="${_.namespaceURI}"`)),{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,o){if(Jl.isCommentNode(e))return this.renderComment(e);if(e.data)return Rs.encodeSpecialCharactersInText(e.data);if(Jl.isElementNode(e)){let c,l;const u=this.renderNs(e,n,r,i,o),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(c=0;c<e.childNodes.length;++c)l=n.slice(0),d.push(this.processInner(e.childNodes[c],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 o=i?`
270
+ -----END ${H}-----`;return $(J)}throw new Error("Unknown DER format.")}t.derToPem=x;function S(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 J=0;J<W.attributes.length;J++){const ue=W.attributes[J];ue&&ue.nodeName&&ue.nodeName.search(/^xmlns:?/)!==-1&&H.push({prefix:ue.nodeName.replace(/^xmlns:?/,""),namespaceURI:ue.nodeValue||""})}return S(W,H)}function k(F){const H=F.attributes;for(let W=0;W<H.length;W++){const J=H[W].nodeName;if(J.search(/^xmlns:?/)!==-1)return J.replace(/^xmlns:?/,"")}return F.prefix||""}function v(F){return F.every(H=>n.isElementNode(H))}function O(F,H,W){if(H==null)return[];const J=e.selectWithResolver(H,F,W);if(!r(J))return[];if(!v(J))throw new Error("Document subset must be list of elements");const ue=S(J[0]),Ne=[];for(let R=0;R<ue.length;R++){let I=!0;for(const C in Ne)if(Ne[C].prefix===ue[R].prefix){I=!1;break}I&&Ne.push(ue[R])}const B=[],L=k(J[0]);for(const R of Ne)R.prefix!==L&&B.push(R);return B}t.findAncestorNs=O;function q(F,H){const W=Buffer.from(F,"base64"),J=Buffer.from(H,"base64");if(typeof W.equals=="function")return W.equals(J);if(W.length!==J.length)return!1;for(let ue=0;ue<W.length;ue++)if(W[ue]!==J[ue])return!1;return!0}t.validateDigestValue=q})(vs);Object.defineProperty(Zr,"__esModule",{value:!0});Zr.C14nCanonicalizationWithComments=Zr.C14nCanonicalization=void 0;const Rs=vs,Jl=be;class X_{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(Jl.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(c=>` ${c.name}="${Rs.encodeSpecialCharactersInAttribute(c.value)}"`).join("")}renderNs(e,n,r,i,o){let c,l;const u=[];let d=r;const f=[],h=e.namespaceURI||"";if(e.prefix?n.indexOf(e.prefix)===-1&&(f.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(c=0;c<e.attributes.length;++c)l=e.attributes[c],l.prefix==="xmlns"&&n.indexOf(l.localName)===-1&&(f.push({prefix:l.localName,namespaceURI:l.value}),n.push(l.localName)),l.prefix&&n.indexOf(l.prefix)===-1&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(f.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push(l.prefix));if(Rs.isArrayHasLength(o))for(const _ of o){let $=!1;for(const m of f)m.prefix===_.prefix&&m.namespaceURI===_.namespaceURI&&($=!0);$||f.push(_)}return f.sort(this.nsCompare),u.push(...f.map(_=>_.prefix?` xmlns:${_.prefix}="${_.namespaceURI}"`:` xmlns="${_.namespaceURI}"`)),{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,o){if(Jl.isCommentNode(e))return this.renderComment(e);if(e.data)return Rs.encodeSpecialCharactersInText(e.data);if(Jl.isElementNode(e)){let c,l;const u=this.renderNs(e,n,r,i,o),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(c=0;c<e.childNodes.length;++c)l=n.slice(0),d.push(this.processInner(e.childNodes[c],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 o=i?`
271
271
  `:"",c=r?`
272
- `:"",l=Rs.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${c}`}process(e,n){n=n||{};const r=n.defaultNs||"",i=n.defaultNsForPrefix||{},o=n.ancestorNamespaces||[],c=[];for(let u=0;u<o.length;u++)c.push(o[u].prefix);return this.processInner(e,c,r,i,o)}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}Zr.C14nCanonicalization=W_;class t9 extends W_{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"}}Zr.C14nCanonicalizationWithComments=t9;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ExclusiveCanonicalizationWithComments=Qr.ExclusiveCanonicalization=void 0;const Er=vs,Yl=be;function Zl(t,e,n){let r=!1;return t.forEach(function(i){i.prefix===e&&i.namespaceURI===n&&(r=!0)}),r}class X_{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=[],o=[];if(Yl.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&&o.push(r);o.sort(this.attrCompare);for(r of o)i.push(" ",r.name,'="',Er.encodeSpecialCharactersInAttribute(r.value),'"');return i.join("")}renderNs(e,n,r,i,o){let c,l;const u=[];let d=r;const f=[],h=e.namespaceURI||"";if(e.prefix?Zl(n,e.prefix,e.namespaceURI||i[e.prefix])||(f.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(c=0;c<e.attributes.length;++c)l=e.attributes[c],l.prefix&&!Zl(n,l.localName,l.value)&&o.indexOf(l.localName)>=0&&(f.push({prefix:l.localName,namespaceURI:l.value}),n.push({prefix:l.localName,namespaceURI:l.value})),l.prefix&&!Zl(n,l.prefix,l.namespaceURI)&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(f.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push({prefix:l.prefix,namespaceURI:l.namespaceURI}));f.sort(this.nsCompare);for(const _ of f)u.push(" xmlns:",_.prefix,'="',_.namespaceURI,'"');return{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,o){if(Yl.isCommentNode(e))return this.renderComment(e);if(e.data)return Er.encodeSpecialCharactersInText(e.data);if(Yl.isElementNode(e)){let c,l;const u=this.renderNs(e,n,r,i,o),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(c=0;c<e.childNodes.length;++c)l=n.slice(0),d.push(this.processInner(e.childNodes[c],l,u.newDefaultNs,i,o));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 o=i?`
272
+ `:"",l=Rs.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${c}`}process(e,n){n=n||{};const r=n.defaultNs||"",i=n.defaultNsForPrefix||{},o=n.ancestorNamespaces||[],c=[];for(let u=0;u<o.length;u++)c.push(o[u].prefix);return this.processInner(e,c,r,i,o)}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}Zr.C14nCanonicalization=X_;class t9 extends X_{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"}}Zr.C14nCanonicalizationWithComments=t9;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ExclusiveCanonicalizationWithComments=Qr.ExclusiveCanonicalization=void 0;const Er=vs,Yl=be;function Zl(t,e,n){let r=!1;return t.forEach(function(i){i.prefix===e&&i.namespaceURI===n&&(r=!0)}),r}class J_{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=[],o=[];if(Yl.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&&o.push(r);o.sort(this.attrCompare);for(r of o)i.push(" ",r.name,'="',Er.encodeSpecialCharactersInAttribute(r.value),'"');return i.join("")}renderNs(e,n,r,i,o){let c,l;const u=[];let d=r;const f=[],h=e.namespaceURI||"";if(e.prefix?Zl(n,e.prefix,e.namespaceURI||i[e.prefix])||(f.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(c=0;c<e.attributes.length;++c)l=e.attributes[c],l.prefix&&!Zl(n,l.localName,l.value)&&o.indexOf(l.localName)>=0&&(f.push({prefix:l.localName,namespaceURI:l.value}),n.push({prefix:l.localName,namespaceURI:l.value})),l.prefix&&!Zl(n,l.prefix,l.namespaceURI)&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(f.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push({prefix:l.prefix,namespaceURI:l.namespaceURI}));f.sort(this.nsCompare);for(const _ of f)u.push(" xmlns:",_.prefix,'="',_.namespaceURI,'"');return{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,o){if(Yl.isCommentNode(e))return this.renderComment(e);if(e.data)return Er.encodeSpecialCharactersInText(e.data);if(Yl.isElementNode(e)){let c,l;const u=this.renderNs(e,n,r,i,o),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(c=0;c<e.childNodes.length;++c)l=n.slice(0),d.push(this.processInner(e.childNodes[c],l,u.newDefaultNs,i,o));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 o=i?`
273
273
  `:"",c=r?`
274
- `:"",l=Er.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${c}`}process(e,n){n=n||{};let r=n.inclusiveNamespacesPrefixList||[];const i=n.defaultNs||"",o=n.defaultNsForPrefix||{},c=n.ancestorNamespaces||[];if(!Er.isArrayHasLength(r)){const u=Er.findChildren(e,"CanonicalizationMethod");if(u.length!==0){const d=Er.findChildren(u[0],"InclusiveNamespaces");d.length!==0&&(r=(d[0].getAttribute("PrefixList")||"").split(" "))}}return Er.isArrayHasLength(r)&&r.forEach(function(u){c&&c.forEach(function(d){u===d.prefix&&e.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${u}`,d.namespaceURI)})}),this.processInner(e,[],i,o,r)}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#"}}Qr.ExclusiveCanonicalization=X_;class n9 extends X_{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"}}Qr.ExclusiveCanonicalizationWithComments=n9;var wl={},vl={},Zn={},Qn={};function r9(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 wf(t,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(t):t}function i9(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 J_=wf({HTML:"text/html",isHTML:function(t){return t===J_.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Y_=wf({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===Y_.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Qn.assign=i9;Qn.find=r9;Qn.freeze=wf;Qn.MIME_TYPE=J_;Qn.NAMESPACE=Y_;var Z_=Qn,bn=Z_.find,Vo=Z_.NAMESPACE;function o9(t){return t!==""}function s9(t){return t?t.split(/[\t\n\f\r ]+/).filter(o9):[]}function a9(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function Dg(t){if(!t)return[];var e=s9(t);return Object.keys(e.reduce(a9,{}))}function c9(t){return function(e){return t&&t.indexOf(e)!==-1}}function bs(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Ct(t,e){var n=t.prototype;if(!(n instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,bs(n,r),t.prototype=n=r}n.constructor!=t&&(typeof t!="function"&&console.error("unknown Class:"+t),n.constructor=t)}var It={},an=It.ELEMENT_NODE=1,Ui=It.ATTRIBUTE_NODE=2,tc=It.TEXT_NODE=3,Q_=It.CDATA_SECTION_NODE=4,ey=It.ENTITY_REFERENCE_NODE=5,l9=It.ENTITY_NODE=6,ty=It.PROCESSING_INSTRUCTION_NODE=7,ny=It.COMMENT_NODE=8,ry=It.DOCUMENT_NODE=9,iy=It.DOCUMENT_TYPE_NODE=10,Vn=It.DOCUMENT_FRAGMENT_NODE=11,u9=It.NOTATION_NODE=12,ft={},tt={};ft.INDEX_SIZE_ERR=(tt[1]="Index size error",1);ft.DOMSTRING_SIZE_ERR=(tt[2]="DOMString size error",2);var At=ft.HIERARCHY_REQUEST_ERR=(tt[3]="Hierarchy request error",3);ft.WRONG_DOCUMENT_ERR=(tt[4]="Wrong document",4);ft.INVALID_CHARACTER_ERR=(tt[5]="Invalid character",5);ft.NO_DATA_ALLOWED_ERR=(tt[6]="No data allowed",6);ft.NO_MODIFICATION_ALLOWED_ERR=(tt[7]="No modification allowed",7);var oy=ft.NOT_FOUND_ERR=(tt[8]="Not found",8);ft.NOT_SUPPORTED_ERR=(tt[9]="Not supported",9);var Rg=ft.INUSE_ATTRIBUTE_ERR=(tt[10]="Attribute in use",10);ft.INVALID_STATE_ERR=(tt[11]="Invalid state",11);ft.SYNTAX_ERR=(tt[12]="Syntax error",12);ft.INVALID_MODIFICATION_ERR=(tt[13]="Invalid modification",13);ft.NAMESPACE_ERR=(tt[14]="Invalid namespace",14);ft.INVALID_ACCESS_ERR=(tt[15]="Invalid access",15);function We(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,tt[t]),this.message=tt[t],Error.captureStackTrace&&Error.captureStackTrace(this,We);return n.code=t,e&&(this.message=this.message+": "+e),n}We.prototype=Error.prototype;bs(ft,We);function Rn(){}Rn.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++)bi(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 Mi(t,e){this._node=t,this._refresh=e,vf(this)}function vf(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(_y(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];bs(n,t),t._inc=e}}Mi.prototype.item=function(t){return vf(this),this[t]||null};Ct(Mi,Rn);function nc(){}function sy(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function Pg(t,e,n,r){if(r?e[sy(e,r)]=n:e[e.length++]=n,t){n.ownerElement=t;var i=t.ownerDocument;i&&(r&&ly(i,t,r),d9(i,t,n))}}function Bg(t,e,n){var r=sy(e,n);if(r>=0){for(var i=e.length-1;r<i;)e[r]=e[++r];if(e.length=i,t){var o=t.ownerDocument;o&&(ly(o,t,n),n.ownerElement=null)}}else throw new We(oy,new Error(t.tagName+"@"+n))}nc.prototype={length:0,item:Rn.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 We(Rg);var n=this.getNamedItem(t.nodeName);return Pg(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e=t.ownerElement,n;if(e&&e!=this._ownerElement)throw new We(Rg);return n=this.getNamedItemNS(t.namespaceURI,t.localName),Pg(this._ownerElement,this,t,n),n},removeNamedItem:function(t){var e=this.getNamedItem(t);return Bg(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return Bg(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 ay(){}ay.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var r=new xs;if(r.implementation=this,r.childNodes=new Rn,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 bl;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 rc(this,t,e)},replaceChild:function(t,e){rc(this,t,e,dy),e&&this.removeChild(e)},removeChild:function(t){return uy(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return Md(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==tc&&t.nodeType==tc?(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==Ui?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==Ui?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function cy(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}bs(It,Pe);bs(It,Pe.prototype);function Ho(t,e){if(e(t))return!0;if(t=t.firstChild)do if(Ho(t,e))return!0;while(t=t.nextSibling)}function xs(){this.ownerDocument=this}function d9(t,e,n){t&&t._inc++;var r=n.namespaceURI;r===Vo.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}function ly(t,e,n,r){t&&t._inc++;var i=n.namespaceURI;i===Vo.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function bf(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,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o,delete r[r.length]}}}function uy(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,bf(t.ownerDocument,t),e}function p9(t){return t&&(t.nodeType===Pe.DOCUMENT_NODE||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.ELEMENT_NODE)}function f9(t){return t&&(xn(t)||xf(t)||Hn(t)||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.COMMENT_NODE||t.nodeType===Pe.PROCESSING_INSTRUCTION_NODE)}function Hn(t){return t&&t.nodeType===Pe.DOCUMENT_TYPE_NODE}function xn(t){return t&&t.nodeType===Pe.ELEMENT_NODE}function xf(t){return t&&t.nodeType===Pe.TEXT_NODE}function jg(t,e){var n=t.childNodes||[];if(bn(n,xn)||Hn(e))return!1;var r=bn(n,Hn);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function Lg(t,e){var n=t.childNodes||[];function r(o){return xn(o)&&o!==e}if(bn(n,r))return!1;var i=bn(n,Hn);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function h9(t,e,n){if(!p9(t))throw new We(At,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new We(oy,"child not in parent");if(!f9(e)||Hn(e)&&t.nodeType!==Pe.DOCUMENT_NODE)throw new We(At,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function g9(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(xn);if(o.length>1||bn(i,xf))throw new We(At,"More than one element or text in fragment");if(o.length===1&&!jg(t,n))throw new We(At,"Element in fragment can not be inserted before doctype")}if(xn(e)&&!jg(t,n))throw new We(At,"Only one element can be added and only after doctype");if(Hn(e)){if(bn(r,Hn))throw new We(At,"Only one doctype is allowed");var c=bn(r,xn);if(n&&r.indexOf(c)<r.indexOf(n))throw new We(At,"Doctype can only be inserted before an element");if(!n&&c)throw new We(At,"Doctype can not be appended since element is present")}}function dy(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(xn);if(o.length>1||bn(i,xf))throw new We(At,"More than one element or text in fragment");if(o.length===1&&!Lg(t,n))throw new We(At,"Element in fragment can not be inserted before doctype")}if(xn(e)&&!Lg(t,n))throw new We(At,"Only one element can be added and only after doctype");if(Hn(e)){if(bn(r,function(u){return Hn(u)&&u!==n}))throw new We(At,"Only one doctype is allowed");var c=bn(r,xn);if(n&&r.indexOf(c)<r.indexOf(n))throw new We(At,"Doctype can only be inserted before an element")}}function rc(t,e,n,r){h9(t,e,n),t.nodeType===Pe.DOCUMENT_NODE&&(r||g9)(t,e,n);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===Vn){var o=e.firstChild;if(o==null)return e;var c=e.lastChild}else o=c=e;var l=n?n.previousSibling:t.lastChild;o.previousSibling=l,c.nextSibling=n,l?l.nextSibling=o:t.firstChild=o,n==null?t.lastChild=c:n.previousSibling=c;do o.parentNode=t;while(o!==c&&(o=o.nextSibling));return bf(t.ownerDocument||t,t),e.nodeType==Vn&&(e.firstChild=e.lastChild=null),e}function m9(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,bf(t.ownerDocument,t,e),e}xs.prototype={nodeName:"#document",nodeType:ry,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==Vn){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return rc(this,t,e),t.ownerDocument=this,this.documentElement===null&&t.nodeType===an&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),uy(this,t)},replaceChild:function(t,e){rc(this,t,e,dy),t.ownerDocument=this,e&&this.removeChild(e),xn(t)&&(this.documentElement=t)},importNode:function(t,e){return my(this,t,e)},getElementById:function(t){var e=null;return Ho(this.documentElement,function(n){if(n.nodeType==an&&n.getAttribute("id")==t)return e=n,!0}),e},getElementsByClassName:function(t){var e=Dg(t);return new Mi(this,function(n){var r=[];return e.length>0&&Ho(n.documentElement,function(i){if(i!==n&&i.nodeType===an){var o=i.getAttribute("class");if(o){var c=t===o;if(!c){var l=Dg(o);c=e.every(c9(l))}c&&r.push(i)}}}),r})},createElement:function(t){var e=new ei;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Rn;var n=e.attributes=new nc;return n._ownerElement=e,e},createDocumentFragment:function(){var t=new xl;return t.ownerDocument=this,t.childNodes=new Rn,t},createTextNode:function(t){var e=new $f;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Af;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new kf;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Sf;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new ic;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Ef;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new ei,r=e.split(":"),i=n.attributes=new nc;return n.childNodes=new Rn,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 ic,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}};Ct(xs,Pe);function ei(){this._nsMap={}}ei.prototype={nodeType:an,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===Vn?this.insertBefore(t,null):m9(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 Mi(this,function(e){var n=[];return Ho(e,function(r){r!==e&&r.nodeType==an&&(t==="*"||r.tagName==t)&&n.push(r)}),n})},getElementsByTagNameNS:function(t,e){return new Mi(this,function(n){var r=[];return Ho(n,function(i){i!==n&&i.nodeType===an&&(t==="*"||i.namespaceURI===t)&&(e==="*"||i.localName==e)&&r.push(i)}),r})}};xs.prototype.getElementsByTagName=ei.prototype.getElementsByTagName;xs.prototype.getElementsByTagNameNS=ei.prototype.getElementsByTagNameNS;Ct(ei,Pe);function ic(){}ic.prototype.nodeType=Ui;Ct(ic,Pe);function $s(){}$s.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(tt[At])},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}};Ct($s,Pe);function $f(){}$f.prototype={nodeName:"#text",nodeType:tc,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}};Ct($f,$s);function Af(){}Af.prototype={nodeName:"#comment",nodeType:ny};Ct(Af,$s);function kf(){}kf.prototype={nodeName:"#cdata-section",nodeType:Q_};Ct(kf,$s);function bl(){}bl.prototype.nodeType=iy;Ct(bl,Pe);function py(){}py.prototype.nodeType=u9;Ct(py,Pe);function fy(){}fy.prototype.nodeType=l9;Ct(fy,Pe);function Ef(){}Ef.prototype.nodeType=ey;Ct(Ef,Pe);function xl(){}xl.prototype.nodeName="#document-fragment";xl.prototype.nodeType=Vn;Ct(xl,Pe);function Sf(){}Sf.prototype.nodeType=ty;Ct(Sf,Pe);function hy(){}hy.prototype.serializeToString=function(t,e,n){return gy.call(t,e,n)};Pe.prototype.toString=gy;function gy(t,e){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,o=r.namespaceURI;if(o&&i==null){var i=r.lookupPrefix(o);if(i==null)var c=[{namespace:o,prefix:null}]}return bi(this,n,t,e,c),n.join("")}function Fg(t,e,n){var r=t.prefix||"",i=t.namespaceURI;if(!i||r==="xml"&&i===Vo.XML||i===Vo.XMLNS)return!1;for(var o=n.length;o--;){var c=n[o];if(c.prefix===r)return c.namespace!==i}return!0}function Ql(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,cy),'"')}function bi(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 an:var o=t.attributes,c=o.length,k=t.firstChild,l=t.tagName;n=Vo.isHTML(t.namespaceURI)||n;var u=l;if(!n&&!t.prefix&&t.namespaceURI){for(var d,f=0;f<o.length;f++)if(o.item(f).name==="xmlns"){d=o.item(f).value;break}if(!d)for(var h=i.length-1;h>=0;h--){var _=i[h];if(_.prefix===""&&_.namespace===t.namespaceURI){d=_.namespace;break}}if(d!==t.namespaceURI)for(var h=i.length-1;h>=0;h--){var _=i[h];if(_.namespace===t.namespaceURI){_.prefix&&(u=_.prefix+":"+l);break}}}e.push("<",u);for(var $=0;$<c;$++){var m=o.item($);m.prefix=="xmlns"?i.push({prefix:m.localName,namespace:m.value}):m.nodeName=="xmlns"&&i.push({prefix:"",namespace:m.value})}for(var $=0;$<c;$++){var m=o.item($);if(Fg(m,n,i)){var x=m.prefix||"",S=m.namespaceURI;Ql(e,x?"xmlns:"+x:"xmlns",S),i.push({prefix:x,namespace:S})}bi(m,e,n,r,i)}if(l===u&&Fg(t,n,i)){var x=t.prefix||"",S=t.namespaceURI;Ql(e,x?"xmlns:"+x:"xmlns",S),i.push({prefix:x,namespace:S})}if(k||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),n&&/^script$/i.test(l))for(;k;)k.data?e.push(k.data):bi(k,e,n,r,i.slice()),k=k.nextSibling;else for(;k;)bi(k,e,n,r,i.slice()),k=k.nextSibling;e.push("</",u,">")}else e.push("/>");return;case ry:case Vn:for(var k=t.firstChild;k;)bi(k,e,n,r,i.slice()),k=k.nextSibling;return;case Ui:return Ql(e,t.name,t.value);case tc:return e.push(t.data.replace(/[<&>]/g,cy));case Q_:return e.push("<![CDATA[",t.data,"]]>");case ny:return e.push("<!--",t.data,"-->");case iy:var v=t.publicId,O=t.systemId;if(e.push("<!DOCTYPE ",t.name),v)e.push(" PUBLIC ",v),O&&O!="."&&e.push(" ",O),e.push(">");else if(O&&O!=".")e.push(" SYSTEM ",O,">");else{var q=t.internalSubset;q&&e.push(" [",q,"]"),e.push(">")}return;case ty:return e.push("<?",t.target," ",t.data,"?>");case ey:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function my(t,e,n){var r;switch(e.nodeType){case an:r=e.cloneNode(!1),r.ownerDocument=t;case Vn:break;case Ui:n=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(my(t,i,n)),i=i.nextSibling;return r}function Md(t,e,n){var r=new e.constructor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];typeof o!="object"&&o!=r[i]&&(r[i]=o)}switch(e.childNodes&&(r.childNodes=new Rn),r.ownerDocument=t,r.nodeType){case an:var c=e.attributes,l=r.attributes=new nc,u=c.length;l._ownerElement=r;for(var d=0;d<u;d++)r.setAttributeNode(Md(t,c.item(d),!0));break;case Ui:n=!0}if(n)for(var f=e.firstChild;f;)r.appendChild(Md(t,f,n)),f=f.nextSibling;return r}function _y(t,e,n){t[e]=n}try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case an:case Vn: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(Mi.prototype,"length",{get:function(){return vf(this),this.$$length}}),Object.defineProperty(Pe.prototype,"textContent",{get:function(){return t(this)},set:function(e){switch(this.nodeType){case an:case Vn: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}}}),_y=function(e,n,r){e["$$"+n]=r}}}catch{}Zn.DocumentType=bl;Zn.DOMException=We;Zn.DOMImplementation=ay;Zn.Element=ei;Zn.Node=Pe;Zn.NodeList=Rn;Zn.XMLSerializer=hy;var $l={},yy={};(function(t){var e=Qn.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:`
275
- `,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})(yy);var Nf={},Ko=Qn.NAMESPACE,qd=/[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]/,Ug=new RegExp("[\\-\\.0-9"+qd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Mg=new RegExp("^"+qd.source+Ug.source+"*(?::"+qd.source+Ug.source+"*)?$"),co=0,rr=1,di=2,lo=3,pi=4,fi=5,uo=6,Ps=7;function qi(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,qi)}qi.prototype=new Error;qi.prototype.name=qi.name;function wy(){}wy.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),vy(e,e={}),_9(t,e,n,r,this.errorHandler),r.endDocument()}};function _9(t,e,n,r,i){function o(j){if(j>65535){j-=65536;var V=55296+(j>>10),de=56320+(j&1023);return String.fromCharCode(V,de)}else return String.fromCharCode(j)}function c(j){var V=j.slice(1,-1);return Object.hasOwnProperty.call(n,V)?n[V]:V.charAt(0)==="#"?o(parseInt(V.substr(1).replace("x","0x"))):(i.error("entity not found:"+j),j)}function l(j){if(j>x){var V=t.substring(x,j).replace(/&#?\w+;/g,c);_&&u(x),r.characters(V,0,j-x),x=j}}function u(j,V){for(;j>=f&&(V=h.exec(t));)d=V.index,f=d+V[0].length,_.lineNumber++;_.columnNumber=j-d+1}for(var d=0,f=0,h=/.*(?:\r\n?|\n)|.*$/g,_=r.locator,$=[{currentNSMap:e}],m={},x=0;;){try{var S=t.indexOf("<",x);if(S<0){if(!t.substr(x).match(/^\s*$/)){var k=r.doc,v=k.createTextNode(t.substr(x));k.appendChild(v),r.currentElement=v}return}switch(S>x&&l(S),t.charAt(S+1)){case"/":var B=t.indexOf(">",S+3),O=t.substring(S+2,B).replace(/[ \t\n\r]+$/g,""),q=$.pop();B<0?(O=t.substring(S+2).replace(/[\s<].*/,""),i.error("end tag name: "+O+" is not complete:"+q.tagName),B=S+1+O.length):O.match(/\s</)&&(O=O.replace(/[\s<].*/,""),i.error("end tag name: "+O+" maybe not complete"),B=S+1+O.length);var F=q.localNSMap,H=q.tagName==O,W=H||q.tagName&&q.tagName.toLowerCase()==O.toLowerCase();if(W){if(r.endElement(q.uri,q.localName,O),F)for(var J in F)Object.prototype.hasOwnProperty.call(F,J)&&r.endPrefixMapping(J);H||i.fatalError("end tag name: "+O+" is not match the current start tagName:"+q.tagName)}else $.push(q);B++;break;case"?":_&&u(S),B=x9(t,S,r);break;case"!":_&&u(S),B=b9(t,S,r,i);break;default:_&&u(S);var ue=new by,Ne=$[$.length-1].currentNSMap,B=y9(t,S,ue,Ne,c,i),L=ue.length;if(!ue.closed&&v9(t,B,ue.tagName,m)&&(ue.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),_&&L){for(var R=qg(_,{}),I=0;I<L;I++){var C=ue[I];u(C.offset),C.locator=qg(_,{})}r.locator=R,Vg(ue,r,Ne)&&$.push(ue),r.locator=_}else Vg(ue,r,Ne)&&$.push(ue);Ko.isHTML(ue.uri)&&!ue.closed?B=w9(t,B,ue.tagName,c,r):B++}}catch(j){if(j instanceof qi)throw j;i.error("element parse error: "+j),B=-1}B>x?x=B:l(Math.max(S,x)+1)}}function qg(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function y9(t,e,n,r,i,o){function c(_,$,m){n.attributeNames.hasOwnProperty(_)&&o.fatalError("Attribute "+_+" redefined"),n.addValue(_,$.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),m)}for(var l,u,d=++e,f=co;;){var h=t.charAt(d);switch(h){case"=":if(f===rr)l=t.slice(e,d),f=lo;else if(f===di)f=lo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(f===lo||f===rr)if(f===rr&&(o.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),c(l,u,e-1),f=fi;else throw new Error("attribute value no end '"+h+"' match");else if(f==pi)u=t.slice(e,d),c(l,u,e),o.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=d+1,f=fi;else throw new Error('attribute value must after "="');break;case"/":switch(f){case co:n.setTagName(t.slice(e,d));case fi:case uo:case Ps:f=Ps,n.closed=!0;case pi:case rr:break;case di:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),f==co&&n.setTagName(t.slice(e,d)),d;case">":switch(f){case co:n.setTagName(t.slice(e,d));case fi:case uo:case Ps:break;case pi:case rr:u=t.slice(e,d),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case di:f===di&&(u=l),f==pi?(o.warning('attribute "'+u+'" missed quot(")!'),c(l,u,e)):((!Ko.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),c(u,u,e));break;case lo:throw new Error("attribute value missed!!")}return d;case"€":h=" ";default:if(h<=" ")switch(f){case co:n.setTagName(t.slice(e,d)),f=uo;break;case rr:l=t.slice(e,d),f=di;break;case pi:var u=t.slice(e,d);o.warning('attribute "'+u+'" missed quot(")!!'),c(l,u,e);case fi:f=uo;break}else switch(f){case di:n.tagName,(!Ko.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),c(l,l,e),e=d,f=rr;break;case fi:o.warning('attribute space is required"'+l+'"!!');case uo:f=rr,e=d;break;case lo:f=pi,e=d;break;case Ps:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function Vg(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var o=t[h],c=o.qName,l=o.value,_=c.indexOf(":");if(_>0)var u=o.prefix=c.slice(0,_),d=c.slice(_+1),f=u==="xmlns"&&d;else d=c,u=null,f=c==="xmlns"&&"";o.localName=d,f!==!1&&(i==null&&(i={},vy(n,n={})),n[f]=i[f]=l,o.uri=Ko.XMLNS,e.startPrefixMapping(f,l))}for(var h=t.length;h--;){o=t[h];var u=o.prefix;u&&(u==="xml"&&(o.uri=Ko.XML),u!=="xmlns"&&(o.uri=n[u||""]))}var _=r.indexOf(":");_>0?(u=t.prefix=r.slice(0,_),d=t.localName=r.slice(_+1)):(u=null,d=t.localName=r);var $=t.uri=n[u||""];if(e.startElement($,d,r,t),t.closed){if(e.endElement($,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 w9(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=t.indexOf("</"+n+">",e),c=t.substring(e+1,o);if(/[&<]/.test(c))return/^script$/i.test(n)?(i.characters(c,0,c.length),o):(c=c.replace(/&#?\w+;/g,r),i.characters(c,0,c.length),o)}return e+1}function v9(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 vy(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function b9(t,e,n,r){var i=t.charAt(e+2);switch(i){case"-":if(t.charAt(e+3)==="-"){var o=t.indexOf("-->",e+4);return o>e?(n.comment(t,e+4,o-e-4),o+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var o=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,o-e-9),n.endCDATA(),o+3}var c=$9(t,e),l=c.length;if(l>1&&/!doctype/i.test(c[0][0])){var u=c[1][0],d=!1,f=!1;l>3&&(/^public$/i.test(c[2][0])?(d=c[3][0],f=l>4&&c[4][0]):/^system$/i.test(c[2][0])&&(f=c[3][0]));var h=c[l-1];return n.startDTD(u,d,f),n.endDTD(),h.index+h[0].length}}return-1}function x9(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 by(){this.attributeNames={}}by.prototype={setTagName:function(t){if(!Mg.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!Mg.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 $9(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}Nf.XMLReader=wy;Nf.ParseError=qi;var A9=Qn,k9=Zn,Hg=yy,xy=Nf,E9=k9.DOMImplementation,Kg=A9.NAMESPACE,S9=xy.ParseError,N9=xy.XMLReader;function $y(t){return t.replace(/\r[\n\u0085]/g,`
274
+ `:"",l=Er.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${c}`}process(e,n){n=n||{};let r=n.inclusiveNamespacesPrefixList||[];const i=n.defaultNs||"",o=n.defaultNsForPrefix||{},c=n.ancestorNamespaces||[];if(!Er.isArrayHasLength(r)){const u=Er.findChildren(e,"CanonicalizationMethod");if(u.length!==0){const d=Er.findChildren(u[0],"InclusiveNamespaces");d.length!==0&&(r=(d[0].getAttribute("PrefixList")||"").split(" "))}}return Er.isArrayHasLength(r)&&r.forEach(function(u){c&&c.forEach(function(d){u===d.prefix&&e.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${u}`,d.namespaceURI)})}),this.processInner(e,[],i,o,r)}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#"}}Qr.ExclusiveCanonicalization=J_;class n9 extends J_{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"}}Qr.ExclusiveCanonicalizationWithComments=n9;var wl={},vl={},Zn={},Qn={};function r9(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 wf(t,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(t):t}function i9(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 Y_=wf({HTML:"text/html",isHTML:function(t){return t===Y_.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Z_=wf({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===Z_.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Qn.assign=i9;Qn.find=r9;Qn.freeze=wf;Qn.MIME_TYPE=Y_;Qn.NAMESPACE=Z_;var Q_=Qn,bn=Q_.find,Vo=Q_.NAMESPACE;function o9(t){return t!==""}function s9(t){return t?t.split(/[\t\n\f\r ]+/).filter(o9):[]}function a9(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function Dg(t){if(!t)return[];var e=s9(t);return Object.keys(e.reduce(a9,{}))}function c9(t){return function(e){return t&&t.indexOf(e)!==-1}}function bs(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Ct(t,e){var n=t.prototype;if(!(n instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,bs(n,r),t.prototype=n=r}n.constructor!=t&&(typeof t!="function"&&console.error("unknown Class:"+t),n.constructor=t)}var It={},an=It.ELEMENT_NODE=1,Ui=It.ATTRIBUTE_NODE=2,tc=It.TEXT_NODE=3,ey=It.CDATA_SECTION_NODE=4,ty=It.ENTITY_REFERENCE_NODE=5,l9=It.ENTITY_NODE=6,ny=It.PROCESSING_INSTRUCTION_NODE=7,ry=It.COMMENT_NODE=8,iy=It.DOCUMENT_NODE=9,oy=It.DOCUMENT_TYPE_NODE=10,Vn=It.DOCUMENT_FRAGMENT_NODE=11,u9=It.NOTATION_NODE=12,ft={},tt={};ft.INDEX_SIZE_ERR=(tt[1]="Index size error",1);ft.DOMSTRING_SIZE_ERR=(tt[2]="DOMString size error",2);var At=ft.HIERARCHY_REQUEST_ERR=(tt[3]="Hierarchy request error",3);ft.WRONG_DOCUMENT_ERR=(tt[4]="Wrong document",4);ft.INVALID_CHARACTER_ERR=(tt[5]="Invalid character",5);ft.NO_DATA_ALLOWED_ERR=(tt[6]="No data allowed",6);ft.NO_MODIFICATION_ALLOWED_ERR=(tt[7]="No modification allowed",7);var sy=ft.NOT_FOUND_ERR=(tt[8]="Not found",8);ft.NOT_SUPPORTED_ERR=(tt[9]="Not supported",9);var Rg=ft.INUSE_ATTRIBUTE_ERR=(tt[10]="Attribute in use",10);ft.INVALID_STATE_ERR=(tt[11]="Invalid state",11);ft.SYNTAX_ERR=(tt[12]="Syntax error",12);ft.INVALID_MODIFICATION_ERR=(tt[13]="Invalid modification",13);ft.NAMESPACE_ERR=(tt[14]="Invalid namespace",14);ft.INVALID_ACCESS_ERR=(tt[15]="Invalid access",15);function We(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,tt[t]),this.message=tt[t],Error.captureStackTrace&&Error.captureStackTrace(this,We);return n.code=t,e&&(this.message=this.message+": "+e),n}We.prototype=Error.prototype;bs(ft,We);function Rn(){}Rn.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++)bi(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 Mi(t,e){this._node=t,this._refresh=e,vf(this)}function vf(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(yy(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];bs(n,t),t._inc=e}}Mi.prototype.item=function(t){return vf(this),this[t]||null};Ct(Mi,Rn);function nc(){}function ay(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function Pg(t,e,n,r){if(r?e[ay(e,r)]=n:e[e.length++]=n,t){n.ownerElement=t;var i=t.ownerDocument;i&&(r&&uy(i,t,r),d9(i,t,n))}}function Bg(t,e,n){var r=ay(e,n);if(r>=0){for(var i=e.length-1;r<i;)e[r]=e[++r];if(e.length=i,t){var o=t.ownerDocument;o&&(uy(o,t,n),n.ownerElement=null)}}else throw new We(sy,new Error(t.tagName+"@"+n))}nc.prototype={length:0,item:Rn.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 We(Rg);var n=this.getNamedItem(t.nodeName);return Pg(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e=t.ownerElement,n;if(e&&e!=this._ownerElement)throw new We(Rg);return n=this.getNamedItemNS(t.namespaceURI,t.localName),Pg(this._ownerElement,this,t,n),n},removeNamedItem:function(t){var e=this.getNamedItem(t);return Bg(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return Bg(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 cy(){}cy.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var r=new xs;if(r.implementation=this,r.childNodes=new Rn,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 bl;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 rc(this,t,e)},replaceChild:function(t,e){rc(this,t,e,py),e&&this.removeChild(e)},removeChild:function(t){return dy(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return Md(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==tc&&t.nodeType==tc?(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==Ui?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==Ui?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function ly(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}bs(It,Pe);bs(It,Pe.prototype);function Ho(t,e){if(e(t))return!0;if(t=t.firstChild)do if(Ho(t,e))return!0;while(t=t.nextSibling)}function xs(){this.ownerDocument=this}function d9(t,e,n){t&&t._inc++;var r=n.namespaceURI;r===Vo.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}function uy(t,e,n,r){t&&t._inc++;var i=n.namespaceURI;i===Vo.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function bf(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,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o,delete r[r.length]}}}function dy(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,bf(t.ownerDocument,t),e}function p9(t){return t&&(t.nodeType===Pe.DOCUMENT_NODE||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.ELEMENT_NODE)}function f9(t){return t&&(xn(t)||xf(t)||Hn(t)||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.COMMENT_NODE||t.nodeType===Pe.PROCESSING_INSTRUCTION_NODE)}function Hn(t){return t&&t.nodeType===Pe.DOCUMENT_TYPE_NODE}function xn(t){return t&&t.nodeType===Pe.ELEMENT_NODE}function xf(t){return t&&t.nodeType===Pe.TEXT_NODE}function jg(t,e){var n=t.childNodes||[];if(bn(n,xn)||Hn(e))return!1;var r=bn(n,Hn);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function Lg(t,e){var n=t.childNodes||[];function r(o){return xn(o)&&o!==e}if(bn(n,r))return!1;var i=bn(n,Hn);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function h9(t,e,n){if(!p9(t))throw new We(At,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new We(sy,"child not in parent");if(!f9(e)||Hn(e)&&t.nodeType!==Pe.DOCUMENT_NODE)throw new We(At,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function g9(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(xn);if(o.length>1||bn(i,xf))throw new We(At,"More than one element or text in fragment");if(o.length===1&&!jg(t,n))throw new We(At,"Element in fragment can not be inserted before doctype")}if(xn(e)&&!jg(t,n))throw new We(At,"Only one element can be added and only after doctype");if(Hn(e)){if(bn(r,Hn))throw new We(At,"Only one doctype is allowed");var c=bn(r,xn);if(n&&r.indexOf(c)<r.indexOf(n))throw new We(At,"Doctype can only be inserted before an element");if(!n&&c)throw new We(At,"Doctype can not be appended since element is present")}}function py(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(xn);if(o.length>1||bn(i,xf))throw new We(At,"More than one element or text in fragment");if(o.length===1&&!Lg(t,n))throw new We(At,"Element in fragment can not be inserted before doctype")}if(xn(e)&&!Lg(t,n))throw new We(At,"Only one element can be added and only after doctype");if(Hn(e)){if(bn(r,function(u){return Hn(u)&&u!==n}))throw new We(At,"Only one doctype is allowed");var c=bn(r,xn);if(n&&r.indexOf(c)<r.indexOf(n))throw new We(At,"Doctype can only be inserted before an element")}}function rc(t,e,n,r){h9(t,e,n),t.nodeType===Pe.DOCUMENT_NODE&&(r||g9)(t,e,n);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===Vn){var o=e.firstChild;if(o==null)return e;var c=e.lastChild}else o=c=e;var l=n?n.previousSibling:t.lastChild;o.previousSibling=l,c.nextSibling=n,l?l.nextSibling=o:t.firstChild=o,n==null?t.lastChild=c:n.previousSibling=c;do o.parentNode=t;while(o!==c&&(o=o.nextSibling));return bf(t.ownerDocument||t,t),e.nodeType==Vn&&(e.firstChild=e.lastChild=null),e}function m9(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,bf(t.ownerDocument,t,e),e}xs.prototype={nodeName:"#document",nodeType:iy,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==Vn){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return rc(this,t,e),t.ownerDocument=this,this.documentElement===null&&t.nodeType===an&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),dy(this,t)},replaceChild:function(t,e){rc(this,t,e,py),t.ownerDocument=this,e&&this.removeChild(e),xn(t)&&(this.documentElement=t)},importNode:function(t,e){return _y(this,t,e)},getElementById:function(t){var e=null;return Ho(this.documentElement,function(n){if(n.nodeType==an&&n.getAttribute("id")==t)return e=n,!0}),e},getElementsByClassName:function(t){var e=Dg(t);return new Mi(this,function(n){var r=[];return e.length>0&&Ho(n.documentElement,function(i){if(i!==n&&i.nodeType===an){var o=i.getAttribute("class");if(o){var c=t===o;if(!c){var l=Dg(o);c=e.every(c9(l))}c&&r.push(i)}}}),r})},createElement:function(t){var e=new ei;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Rn;var n=e.attributes=new nc;return n._ownerElement=e,e},createDocumentFragment:function(){var t=new xl;return t.ownerDocument=this,t.childNodes=new Rn,t},createTextNode:function(t){var e=new $f;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Af;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new kf;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Sf;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new ic;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Ef;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new ei,r=e.split(":"),i=n.attributes=new nc;return n.childNodes=new Rn,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 ic,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}};Ct(xs,Pe);function ei(){this._nsMap={}}ei.prototype={nodeType:an,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===Vn?this.insertBefore(t,null):m9(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 Mi(this,function(e){var n=[];return Ho(e,function(r){r!==e&&r.nodeType==an&&(t==="*"||r.tagName==t)&&n.push(r)}),n})},getElementsByTagNameNS:function(t,e){return new Mi(this,function(n){var r=[];return Ho(n,function(i){i!==n&&i.nodeType===an&&(t==="*"||i.namespaceURI===t)&&(e==="*"||i.localName==e)&&r.push(i)}),r})}};xs.prototype.getElementsByTagName=ei.prototype.getElementsByTagName;xs.prototype.getElementsByTagNameNS=ei.prototype.getElementsByTagNameNS;Ct(ei,Pe);function ic(){}ic.prototype.nodeType=Ui;Ct(ic,Pe);function $s(){}$s.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(tt[At])},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}};Ct($s,Pe);function $f(){}$f.prototype={nodeName:"#text",nodeType:tc,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}};Ct($f,$s);function Af(){}Af.prototype={nodeName:"#comment",nodeType:ry};Ct(Af,$s);function kf(){}kf.prototype={nodeName:"#cdata-section",nodeType:ey};Ct(kf,$s);function bl(){}bl.prototype.nodeType=oy;Ct(bl,Pe);function fy(){}fy.prototype.nodeType=u9;Ct(fy,Pe);function hy(){}hy.prototype.nodeType=l9;Ct(hy,Pe);function Ef(){}Ef.prototype.nodeType=ty;Ct(Ef,Pe);function xl(){}xl.prototype.nodeName="#document-fragment";xl.prototype.nodeType=Vn;Ct(xl,Pe);function Sf(){}Sf.prototype.nodeType=ny;Ct(Sf,Pe);function gy(){}gy.prototype.serializeToString=function(t,e,n){return my.call(t,e,n)};Pe.prototype.toString=my;function my(t,e){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,o=r.namespaceURI;if(o&&i==null){var i=r.lookupPrefix(o);if(i==null)var c=[{namespace:o,prefix:null}]}return bi(this,n,t,e,c),n.join("")}function Fg(t,e,n){var r=t.prefix||"",i=t.namespaceURI;if(!i||r==="xml"&&i===Vo.XML||i===Vo.XMLNS)return!1;for(var o=n.length;o--;){var c=n[o];if(c.prefix===r)return c.namespace!==i}return!0}function Ql(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,ly),'"')}function bi(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 an:var o=t.attributes,c=o.length,k=t.firstChild,l=t.tagName;n=Vo.isHTML(t.namespaceURI)||n;var u=l;if(!n&&!t.prefix&&t.namespaceURI){for(var d,f=0;f<o.length;f++)if(o.item(f).name==="xmlns"){d=o.item(f).value;break}if(!d)for(var h=i.length-1;h>=0;h--){var _=i[h];if(_.prefix===""&&_.namespace===t.namespaceURI){d=_.namespace;break}}if(d!==t.namespaceURI)for(var h=i.length-1;h>=0;h--){var _=i[h];if(_.namespace===t.namespaceURI){_.prefix&&(u=_.prefix+":"+l);break}}}e.push("<",u);for(var $=0;$<c;$++){var m=o.item($);m.prefix=="xmlns"?i.push({prefix:m.localName,namespace:m.value}):m.nodeName=="xmlns"&&i.push({prefix:"",namespace:m.value})}for(var $=0;$<c;$++){var m=o.item($);if(Fg(m,n,i)){var x=m.prefix||"",S=m.namespaceURI;Ql(e,x?"xmlns:"+x:"xmlns",S),i.push({prefix:x,namespace:S})}bi(m,e,n,r,i)}if(l===u&&Fg(t,n,i)){var x=t.prefix||"",S=t.namespaceURI;Ql(e,x?"xmlns:"+x:"xmlns",S),i.push({prefix:x,namespace:S})}if(k||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),n&&/^script$/i.test(l))for(;k;)k.data?e.push(k.data):bi(k,e,n,r,i.slice()),k=k.nextSibling;else for(;k;)bi(k,e,n,r,i.slice()),k=k.nextSibling;e.push("</",u,">")}else e.push("/>");return;case iy:case Vn:for(var k=t.firstChild;k;)bi(k,e,n,r,i.slice()),k=k.nextSibling;return;case Ui:return Ql(e,t.name,t.value);case tc:return e.push(t.data.replace(/[<&>]/g,ly));case ey:return e.push("<![CDATA[",t.data,"]]>");case ry:return e.push("<!--",t.data,"-->");case oy:var v=t.publicId,O=t.systemId;if(e.push("<!DOCTYPE ",t.name),v)e.push(" PUBLIC ",v),O&&O!="."&&e.push(" ",O),e.push(">");else if(O&&O!=".")e.push(" SYSTEM ",O,">");else{var q=t.internalSubset;q&&e.push(" [",q,"]"),e.push(">")}return;case ny:return e.push("<?",t.target," ",t.data,"?>");case ty:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function _y(t,e,n){var r;switch(e.nodeType){case an:r=e.cloneNode(!1),r.ownerDocument=t;case Vn:break;case Ui:n=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(_y(t,i,n)),i=i.nextSibling;return r}function Md(t,e,n){var r=new e.constructor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];typeof o!="object"&&o!=r[i]&&(r[i]=o)}switch(e.childNodes&&(r.childNodes=new Rn),r.ownerDocument=t,r.nodeType){case an:var c=e.attributes,l=r.attributes=new nc,u=c.length;l._ownerElement=r;for(var d=0;d<u;d++)r.setAttributeNode(Md(t,c.item(d),!0));break;case Ui:n=!0}if(n)for(var f=e.firstChild;f;)r.appendChild(Md(t,f,n)),f=f.nextSibling;return r}function yy(t,e,n){t[e]=n}try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case an:case Vn: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(Mi.prototype,"length",{get:function(){return vf(this),this.$$length}}),Object.defineProperty(Pe.prototype,"textContent",{get:function(){return t(this)},set:function(e){switch(this.nodeType){case an:case Vn: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}}}),yy=function(e,n,r){e["$$"+n]=r}}}catch{}Zn.DocumentType=bl;Zn.DOMException=We;Zn.DOMImplementation=cy;Zn.Element=ei;Zn.Node=Pe;Zn.NodeList=Rn;Zn.XMLSerializer=gy;var $l={},wy={};(function(t){var e=Qn.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:`
275
+ `,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})(wy);var Nf={},Ko=Qn.NAMESPACE,qd=/[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]/,Ug=new RegExp("[\\-\\.0-9"+qd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Mg=new RegExp("^"+qd.source+Ug.source+"*(?::"+qd.source+Ug.source+"*)?$"),co=0,rr=1,di=2,lo=3,pi=4,fi=5,uo=6,Ps=7;function qi(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,qi)}qi.prototype=new Error;qi.prototype.name=qi.name;function vy(){}vy.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),by(e,e={}),_9(t,e,n,r,this.errorHandler),r.endDocument()}};function _9(t,e,n,r,i){function o(j){if(j>65535){j-=65536;var V=55296+(j>>10),de=56320+(j&1023);return String.fromCharCode(V,de)}else return String.fromCharCode(j)}function c(j){var V=j.slice(1,-1);return Object.hasOwnProperty.call(n,V)?n[V]:V.charAt(0)==="#"?o(parseInt(V.substr(1).replace("x","0x"))):(i.error("entity not found:"+j),j)}function l(j){if(j>x){var V=t.substring(x,j).replace(/&#?\w+;/g,c);_&&u(x),r.characters(V,0,j-x),x=j}}function u(j,V){for(;j>=f&&(V=h.exec(t));)d=V.index,f=d+V[0].length,_.lineNumber++;_.columnNumber=j-d+1}for(var d=0,f=0,h=/.*(?:\r\n?|\n)|.*$/g,_=r.locator,$=[{currentNSMap:e}],m={},x=0;;){try{var S=t.indexOf("<",x);if(S<0){if(!t.substr(x).match(/^\s*$/)){var k=r.doc,v=k.createTextNode(t.substr(x));k.appendChild(v),r.currentElement=v}return}switch(S>x&&l(S),t.charAt(S+1)){case"/":var B=t.indexOf(">",S+3),O=t.substring(S+2,B).replace(/[ \t\n\r]+$/g,""),q=$.pop();B<0?(O=t.substring(S+2).replace(/[\s<].*/,""),i.error("end tag name: "+O+" is not complete:"+q.tagName),B=S+1+O.length):O.match(/\s</)&&(O=O.replace(/[\s<].*/,""),i.error("end tag name: "+O+" maybe not complete"),B=S+1+O.length);var F=q.localNSMap,H=q.tagName==O,W=H||q.tagName&&q.tagName.toLowerCase()==O.toLowerCase();if(W){if(r.endElement(q.uri,q.localName,O),F)for(var J in F)Object.prototype.hasOwnProperty.call(F,J)&&r.endPrefixMapping(J);H||i.fatalError("end tag name: "+O+" is not match the current start tagName:"+q.tagName)}else $.push(q);B++;break;case"?":_&&u(S),B=x9(t,S,r);break;case"!":_&&u(S),B=b9(t,S,r,i);break;default:_&&u(S);var ue=new xy,Ne=$[$.length-1].currentNSMap,B=y9(t,S,ue,Ne,c,i),L=ue.length;if(!ue.closed&&v9(t,B,ue.tagName,m)&&(ue.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),_&&L){for(var R=qg(_,{}),I=0;I<L;I++){var C=ue[I];u(C.offset),C.locator=qg(_,{})}r.locator=R,Vg(ue,r,Ne)&&$.push(ue),r.locator=_}else Vg(ue,r,Ne)&&$.push(ue);Ko.isHTML(ue.uri)&&!ue.closed?B=w9(t,B,ue.tagName,c,r):B++}}catch(j){if(j instanceof qi)throw j;i.error("element parse error: "+j),B=-1}B>x?x=B:l(Math.max(S,x)+1)}}function qg(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function y9(t,e,n,r,i,o){function c(_,$,m){n.attributeNames.hasOwnProperty(_)&&o.fatalError("Attribute "+_+" redefined"),n.addValue(_,$.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),m)}for(var l,u,d=++e,f=co;;){var h=t.charAt(d);switch(h){case"=":if(f===rr)l=t.slice(e,d),f=lo;else if(f===di)f=lo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(f===lo||f===rr)if(f===rr&&(o.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),c(l,u,e-1),f=fi;else throw new Error("attribute value no end '"+h+"' match");else if(f==pi)u=t.slice(e,d),c(l,u,e),o.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=d+1,f=fi;else throw new Error('attribute value must after "="');break;case"/":switch(f){case co:n.setTagName(t.slice(e,d));case fi:case uo:case Ps:f=Ps,n.closed=!0;case pi:case rr:break;case di:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),f==co&&n.setTagName(t.slice(e,d)),d;case">":switch(f){case co:n.setTagName(t.slice(e,d));case fi:case uo:case Ps:break;case pi:case rr:u=t.slice(e,d),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case di:f===di&&(u=l),f==pi?(o.warning('attribute "'+u+'" missed quot(")!'),c(l,u,e)):((!Ko.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),c(u,u,e));break;case lo:throw new Error("attribute value missed!!")}return d;case"€":h=" ";default:if(h<=" ")switch(f){case co:n.setTagName(t.slice(e,d)),f=uo;break;case rr:l=t.slice(e,d),f=di;break;case pi:var u=t.slice(e,d);o.warning('attribute "'+u+'" missed quot(")!!'),c(l,u,e);case fi:f=uo;break}else switch(f){case di:n.tagName,(!Ko.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),c(l,l,e),e=d,f=rr;break;case fi:o.warning('attribute space is required"'+l+'"!!');case uo:f=rr,e=d;break;case lo:f=pi,e=d;break;case Ps:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function Vg(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var o=t[h],c=o.qName,l=o.value,_=c.indexOf(":");if(_>0)var u=o.prefix=c.slice(0,_),d=c.slice(_+1),f=u==="xmlns"&&d;else d=c,u=null,f=c==="xmlns"&&"";o.localName=d,f!==!1&&(i==null&&(i={},by(n,n={})),n[f]=i[f]=l,o.uri=Ko.XMLNS,e.startPrefixMapping(f,l))}for(var h=t.length;h--;){o=t[h];var u=o.prefix;u&&(u==="xml"&&(o.uri=Ko.XML),u!=="xmlns"&&(o.uri=n[u||""]))}var _=r.indexOf(":");_>0?(u=t.prefix=r.slice(0,_),d=t.localName=r.slice(_+1)):(u=null,d=t.localName=r);var $=t.uri=n[u||""];if(e.startElement($,d,r,t),t.closed){if(e.endElement($,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 w9(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=t.indexOf("</"+n+">",e),c=t.substring(e+1,o);if(/[&<]/.test(c))return/^script$/i.test(n)?(i.characters(c,0,c.length),o):(c=c.replace(/&#?\w+;/g,r),i.characters(c,0,c.length),o)}return e+1}function v9(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 by(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function b9(t,e,n,r){var i=t.charAt(e+2);switch(i){case"-":if(t.charAt(e+3)==="-"){var o=t.indexOf("-->",e+4);return o>e?(n.comment(t,e+4,o-e-4),o+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var o=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,o-e-9),n.endCDATA(),o+3}var c=$9(t,e),l=c.length;if(l>1&&/!doctype/i.test(c[0][0])){var u=c[1][0],d=!1,f=!1;l>3&&(/^public$/i.test(c[2][0])?(d=c[3][0],f=l>4&&c[4][0]):/^system$/i.test(c[2][0])&&(f=c[3][0]));var h=c[l-1];return n.startDTD(u,d,f),n.endDTD(),h.index+h[0].length}}return-1}function x9(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 xy(){this.attributeNames={}}xy.prototype={setTagName:function(t){if(!Mg.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!Mg.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 $9(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}Nf.XMLReader=vy;Nf.ParseError=qi;var A9=Qn,k9=Zn,Hg=wy,$y=Nf,E9=k9.DOMImplementation,Kg=A9.NAMESPACE,S9=$y.ParseError,N9=$y.XMLReader;function Ay(t){return t.replace(/\r[\n\u0085]/g,`
276
276
  `).replace(/[\r\u0085\u2028]/g,`
277
- `)}function Ay(t){this.options=t||{locator:{}}}Ay.prototype.parseFromString=function(t,e){var n=this.options,r=new N9,i=n.domBuilder||new As,o=n.errorHandler,c=n.locator,l=n.xmlns||{},u=/\/x?html?$/.test(e),d=u?Hg.HTML_ENTITIES:Hg.XML_ENTITIES;c&&i.setDocumentLocator(c),r.errorHandler=C9(o,i,c),r.domBuilder=n.domBuilder||i,u&&(l[""]=Kg.HTML),l.xml=l.xml||Kg.XML;var f=n.normalizeLineEndings||$y;return t&&typeof t=="string"?r.parse(f(t),l,d):r.errorHandler.error("invalid doc source"),i.doc};function C9(t,e,n){if(!t){if(e instanceof As)return e;t=e}var r={},i=t instanceof Function;n=n||{};function o(c){var l=t[c];!l&&i&&(l=t.length==2?function(u){t(c,u)}:t),r[c]=l&&function(u){l("[xmldom "+c+"] "+u+Vd(n))}||function(){}}return o("warning"),o("error"),o("fatalError"),r}function As(){this.cdata=!1}function hi(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}As.prototype={startDocument:function(){this.doc=new E9().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,o=i.createElementNS(t,n||e),c=r.length;Bs(this,o),this.currentElement=o,this.locator&&hi(this.locator,o);for(var l=0;l<c;l++){var t=r.getURI(l),u=r.getValue(l),n=r.getQName(l),d=i.createAttributeNS(t,n);this.locator&&hi(r.getLocator(l),d),d.value=d.nodeValue=u,o.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&&hi(this.locator,n),Bs(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=Gg.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&&hi(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=Gg.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&hi(this.locator,r),Bs(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&&hi(this.locator,i),Bs(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning] "+t,Vd(this.locator))},error:function(t){console.error("[xmldom error] "+t,Vd(this.locator))},fatalError:function(t){throw new S9(t,this.locator)}};function Vd(t){if(t)return`
278
- @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function Gg(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){As.prototype[t]=function(){return null}});function Bs(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}$l.__DOMHandler=As;$l.normalizeLineEndings=$y;$l.DOMParser=Ay;var ky=Zn;vl.DOMImplementation=ky.DOMImplementation;vl.XMLSerializer=ky.XMLSerializer;vl.DOMParser=$l.DOMParser;var Al={};Object.defineProperty(Al,"__esModule",{value:!0});Al.EnvelopedSignature=void 0;const js=_l,eu=be;class I9{constructor(){this.includeComments=!1,this.includeComments=!1}process(e,n){if(n.signatureNode==null){const o=js.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return eu.isNodeLike(o)&&o.parentNode&&o.parentNode.removeChild(o),e}const r=n.signatureNode,i=js.select1(".//*[local-name(.)='SignatureValue']/text()",r);if(eu.isTextNode(i)){const o=i.data,c=js.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);for(const l of Array.isArray(c)?c:[]){const u=js.select1(".//*[local-name(.)='SignatureValue']/text()",l);if(eu.isTextNode(u)){const d=u.data;o===d&&l.parentNode&&l.parentNode.removeChild(l)}}}return e}getAlgorithmName(){return"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}}Al.EnvelopedSignature=I9;var pr={};Object.defineProperty(pr,"__esModule",{value:!0});pr.Sha512=pr.Sha256=pr.Sha1=void 0;const Cf=pc;class T9{constructor(){this.getHash=function(e){const n=Cf.createHash("sha1");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2000/09/xmldsig#sha1"}}}pr.Sha1=T9;class O9{constructor(){this.getHash=function(e){const n=Cf.createHash("sha256");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha256"}}}pr.Sha256=O9;class z9{constructor(){this.getHash=function(e){const n=Cf.createHash("sha512");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha512"}}}pr.Sha512=z9;var wn={},ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.createOptionalCallbackFunction=void 0;function D9(t){return typeof t=="function"}function R9(t){return(...e)=>{const n=e[e.length-1];if(D9(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)}}ks.createOptionalCallbackFunction=R9;Object.defineProperty(wn,"__esModule",{value:!0});wn.HmacSha1=wn.RsaSha512=wn.RsaSha256=wn.RsaSha1=void 0;const wr=pc,vr=ks;class P9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createSign("RSA-SHA1");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createVerify("RSA-SHA1");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"}}wn.RsaSha1=P9;class B9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createSign("RSA-SHA256");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createVerify("RSA-SHA256");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"}}wn.RsaSha256=B9;class j9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createSign("RSA-SHA512");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createVerify("RSA-SHA512");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"}}wn.RsaSha512=j9;class L9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createHmac("SHA1",n);return r.update(e),r.digest("base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createHmac("SHA1",n);return i.update(e),i.digest("base64")===r}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#hmac-sha1"}}wn.HmacSha1=L9;Object.defineProperty(wl,"__esModule",{value:!0});wl.SignedXml=void 0;const Dt=be,Sr=vl,F9=pc,qt=_l,Wg=Zr,U9=Al,Xg=Qr,tu=pr,Ls=wn,Oe=vs;class Tn{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=Tn.getKeyInfoContent,this.getCertFromKeyInfo=Tn.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":Wg.C14nCanonicalization,"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":Wg.C14nCanonicalizationWithComments,"http://www.w3.org/2001/10/xml-exc-c14n#":Xg.ExclusiveCanonicalization,"http://www.w3.org/2001/10/xml-exc-c14n#WithComments":Xg.ExclusiveCanonicalizationWithComments,"http://www.w3.org/2000/09/xmldsig#enveloped-signature":U9.EnvelopedSignature},this.HashAlgorithms={"http://www.w3.org/2000/09/xmldsig#sha1":tu.Sha1,"http://www.w3.org/2001/04/xmlenc#sha256":tu.Sha256,"http://www.w3.org/2001/04/xmlenc#sha512":tu.Sha512},this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#rsa-sha1":Ls.RsaSha1,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":Ls.RsaSha256,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":Ls.RsaSha512};const{idMode:n,idAttribute:r,privateKey:i,publicCert:o,signatureAlgorithm:c,canonicalizationAlgorithm:l,inclusiveNamespacesPrefixList:u,implicitTransforms:d,keyInfoAttributes:f,getKeyInfoContent:h,getCertFromKeyInfo:_}=e;this.idMode=n,this.idAttributes=["Id","ID","id"],r&&this.idAttributes.unshift(r),this.privateKey=i,this.publicCert=o,this.signatureAlgorithm=c??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=f??this.keyInfoAttributes,this.getKeyInfoContent=h??this.getKeyInfoContent,this.getCertFromKeyInfo=_??Tn.noop,this.CanonicalizationAlgorithms,this.HashAlgorithms,this.SignatureAlgorithms}enableHMAC(){this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#hmac-sha1":Ls.HmacSha1},this.getKeyInfoContent=Tn.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(o=>`<${n}X509Certificate>${Oe.pemToDer(o).toString("base64")}</${n}X509Certificate>`).join("")),`<${n}X509Data>${r}</${n}X509Data>`}static getCertFromKeyInfo(e){if(e!=null){const n=qt.select1(".//*[local-name(.)='X509Certificate']",e);if(Dt.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 Sr.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 c=new Sr.DOMParser().parseFromString(i,"text/xml").documentElement;if(!c){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(c,"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 o=qt.select1(e,n);Dt.assertIsElementNode(o),r=o}else r=e;for(const o of this.getReferences()){const c=((i=o.uri)==null?void 0:i[0])==="#"?o.uri.substring(1):o.uri;for(const f of this.idAttributes){const h=r.getAttribute(f);if(c===h){o.xpath=`//*[@*[local-name(.)='${f}']='${c}']`;break}}const l=this.getCanonReferenceXml(n,o,r),d=this.findHashAlgorithm(o.digestAlgorithm).getHash(l);if(Oe.validateDigestValue(d,o.digestValue))return o}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=qt.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 f of this.idAttributes){const h=`//*[@*[local-name(.)='${f}']='${r}']`,_=qt.select(h,n);if(Oe.isArrayHasLength(_)){if(d+=_.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=_[0],e.xpath=h}}}}if(e.getValidatedNode=(0,F9.deprecate)(d=>{if(d=d||e.xpath,typeof d!="string"||e.validationError!=null)return null;const f=qt.select1(d,n);return Dt.isNodeLike(f)?f:null},"`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead."),!Dt.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 o=this.getCanonReferenceXml(n,e,i),l=this.findHashAlgorithm(e.digestAlgorithm).getHash(o);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(o),e.signedReference=o,!0}findSignatures(e){const n=qt.select("//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return Dt.isArrayOfNodes(n)?n:[]}loadSignature(e){typeof e=="string"?this.signatureNode=e=new Sr.DOMParser().parseFromString(e):this.signatureNode=e,this.signatureXml=e.toString();const n=qt.select1(".//*[local-name(.)='CanonicalizationMethod']/@Algorithm",e);if(!Dt.isNodeLike(n))throw new Error("could not find CanonicalizationMethod/@Algorithm element");Dt.isAttributeNode(n)&&(this.canonicalizationAlgorithm=n.value);const r=qt.select1(".//*[local-name(.)='SignatureMethod']/@Algorithm",e);Dt.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 o=this.canonicalizationAlgorithm;(!o||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(o="http://www.w3.org/2001/10/xml-exc-c14n#");const c=this.getCanonXml([o],i[0]),u=new Sr.DOMParser().parseFromString(c,"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 _ of d)this.loadReference(_);const f=qt.select1(".//*[local-name(.)='SignatureValue']/text()",e);Dt.isTextNode(f)&&(this.signatureValue=f.data.replace(/\r?\n/g,""));const h=qt.select1(".//*[local-name(.)='KeyInfo']",e);Dt.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 o=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 c=n[0].textContent;if(!c)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 f=n[0],h=Oe.findChildren(f,"Transform");for(const $ of h){const m=Oe.findAttr($,"Algorithm");m&&l.push(m.value)}const _=Oe.findChildren(h[h.length-1],"InclusiveNamespaces");Oe.isArrayHasLength(_)&&(u=_.flatMap($=>($.getAttribute("PrefixList")??"").split(" ")).filter($=>$.length>0))}Oe.isArrayHasLength(this.implicitTransforms)&&this.implicitTransforms.forEach(function(f){l.push(f)}),(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=Dt.isElementNode(e)&&e.getAttribute("URI")||void 0;this.addReference({transforms:l,digestAlgorithm:o,uri:d,digestValue:c,inclusiveNamespacesPrefixList:u,isEmptyUri:!1})}addReference({xpath:e,transforms:n,digestAlgorithm:r,uri:i="",digestValue:o,inclusiveNamespacesPrefixList:c=[],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:o,inclusiveNamespacesPrefixList:c,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 o=new Sr.DOMParser().parseFromString(e);let c="xmlns";const l=[];let u;const d=["append","prepend","before","after"],f=n.prefix,h=n.attrs||{},_=n.location||{},$=n.existingPrefixes||{};if(this.namespaceResolver={lookupNamespaceURI:function(H){return H?$[H]:null}},_.reference=_.reference||"/*",_.action=_.action||"append",d.indexOf(_.action)===-1){const H=new Error(`location.action option has an invalid action: ${_.action}, must be any of the following values: ${d.join(", ")}`);if(i){i(H);return}else throw H}f?(c+=`:${f}`,u=`${f}:`):u="",Object.keys(h).forEach(function(H){H!=="xmlns"&&H!==c&&l.push(`${H}="${h[H]}"`)}),l.push(`${c}="http://www.w3.org/2000/09/xmldsig#"`);let m=`<${u}Signature ${l.join(" ")}>`;m+=this.createSignedInfo(o,f),m+=this.getKeyInfo(f),m+=`</${u}Signature>`,this.originalXmlWithIds=o.toString();let x="";Object.keys($).forEach(function(H){x+=`xmlns:${H}="${$[H]}" `});const S=`<Dummy ${x}>${m}</Dummy>`,v=new Sr.DOMParser().parseFromString(S).documentElement.firstChild,O=qt.select1(_.reference,o);if(!Dt.isNodeLike(O)){const H=new Error(`the following xpath cannot be used because it was not found: ${_.reference}`);if(i){i(H);return}else throw H}if(_.action==="append")O.appendChild(v);else if(_.action==="prepend")O.insertBefore(v,O.firstChild);else if(_.action==="before"){if(O.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");O.parentNode.insertBefore(v,O)}else if(_.action==="after"){if(O.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");O.parentNode.insertBefore(v,O.nextSibling)}this.signatureNode=v;const q=Oe.findChildren(this.signatureNode,"SignedInfo");if(q.length===0){const H=new Error("could not find SignedInfo element in the message");if(i){i(H);return}else throw H}const F=q[0];typeof i=="function"?this.calculateSignatureValue(o,(H,W)=>{H?i(H):(this.signatureValue=W||"",v.insertBefore(this.createSignature(f),F.nextSibling),this.signatureXml=v.toString(),this.signedXml=o.toString(),i(null,this))}):(this.calculateSignatureValue(o),v.insertBefore(this.createSignature(f),F.nextSibling),this.signatureXml=v.toString(),this.signedXml=o.toString())}getKeyInfo(e){const n=e?`${e}:`:"";let r="";this.keyInfoAttributes&&Object.keys(this.keyInfoAttributes).forEach(o=>{r+=` ${o}="${this.keyInfoAttributes[o]}"`});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 o=qt.selectWithResolver(i.xpath??"",e,this.namespaceResolver);if(!Oe.isArrayHasLength(o))throw new Error(`the following xpath cannot be signed because it was not found: ${i.xpath}`);for(const c of o){if(i.isEmptyUri)r+=`<${n}Reference URI="">`;else{const d=this.ensureHasId(c);i.uri=d,r+=`<${n}Reference URI="#${d}">`}r+=`<${n}Transforms>`;for(const d of i.transforms||[]){const f=this.findCanonicalizationAlgorithm(d);r+=`<${n}Transform Algorithm="${f.getAlgorithmName()}"`,Oe.isArrayHasLength(i.inclusiveNamespacesPrefixList)?(r+=">",r+=`<InclusiveNamespaces PrefixList="${i.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${f.getAlgorithmName()}"/>`,r+=`</${n}Transform>`):r+=" />"}const l=this.getCanonReferenceXml(e,i,c),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??Tn.defaultNsForPrefix,r.signatureNode=this.signatureNode;let o=n.cloneNode(!0);return e.forEach(c=>{Dt.isNodeLike(o)&&(o=this.findCanonicalizationAlgorithm(c).process(o,r))}),o.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 o;o=n||"",o=o&&`${o}:`;let c=`<${o}SignedInfo>`;return c+=`<${o}CanonicalizationMethod Algorithm="${r.getAlgorithmName()}"`,Oe.isArrayHasLength(this.inclusiveNamespacesPrefixList)?(c+=">",c+=`<InclusiveNamespaces PrefixList="${this.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${r.getAlgorithmName()}"/>`,c+=`</${o}CanonicalizationMethod>`):c+=" />",c+=`<${o}SignatureMethod Algorithm="${i.getAlgorithmName()}" />`,c+=this.createReferences(e,n),c+=`</${o}SignedInfo>`,c}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 Sr.DOMParser().parseFromString(i).documentElement.firstChild}getSignatureXml(){return this.signatureXml}getOriginalXmlWithIds(){return this.originalXmlWithIds}getSignedXml(){return this.signedXml}}wl.SignedXml=Tn;Tn.defaultNsForPrefix={ds:"http://www.w3.org/2000/09/xmldsig#"};Tn.noop=()=>null;(function(t){var e=sr&&sr.__createBinding||(Object.create?function(c,l,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(l,u);(!f||("get"in f?!l.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(c,d,f)}:function(c,l,u,d){d===void 0&&(d=u),c[d]=l[u]}),n=sr&&sr.__exportStar||function(c,l){for(var u in c)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,c,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.SignedXml=t.ExclusiveCanonicalizationWithComments=t.ExclusiveCanonicalization=t.C14nCanonicalizationWithComments=t.C14nCanonicalization=void 0;var r=Zr;Object.defineProperty(t,"C14nCanonicalization",{enumerable:!0,get:function(){return r.C14nCanonicalization}}),Object.defineProperty(t,"C14nCanonicalizationWithComments",{enumerable:!0,get:function(){return r.C14nCanonicalizationWithComments}});var i=Qr;Object.defineProperty(t,"ExclusiveCanonicalization",{enumerable:!0,get:function(){return i.ExclusiveCanonicalization}}),Object.defineProperty(t,"ExclusiveCanonicalizationWithComments",{enumerable:!0,get:function(){return i.ExclusiveCanonicalizationWithComments}});var o=wl;Object.defineProperty(t,"SignedXml",{enumerable:!0,get:function(){return o.SignedXml}}),n(ks,t),n(vs,t)})(D6);async function M9(t){const e=new DecompressionStream("deflate-raw"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}async function q9(t){const e=await Fm.decode(t.replace(/ /g,"+"));try{const n=await M9(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 V9(t){const e=await q9(t),r=new op.XMLParser({attributeNamePrefix:"@_",alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(e);return T6.parse(r)}function H9(t){const e=[{":@":{"@_entityID":t.entityId,"@_xmlns":"urn:oasis:names:tc:SAML:2.0:metadata"},EntityDescriptor:[{":@":{"@_protocolSupportEnumeration":"urn:oasis:names:tc:SAML:2.0:protocol"},IDPSSODescriptor:[{":@":{"@_use":"signing"},KeyDescriptor:[{":@":{"@_xmlns":"http://www.w3.org/2000/09/xmldsig#"},KeyInfo:[{X509Data:[{X509Certificate:[{"#text":t.cert}]}]}]}]},{":@":{"@_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 op.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0,format:!0}).build(e)}const K9=new s.OpenAPIHono().openapi(s.createRoute({tags:["saml"],method:"get",path:"/metadata/{client_id}",request:{params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.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 P(404,{message:"Client not found"});const[r]=await t.env.data.keys.list();if(!r)throw new P(500,{message:"No signing key found"});const i=new al(r.cert),o=t.env.ISSUER,c=H9({entityId:((u=(l=n.addons)==null?void 0:l.samlp)==null?void 0:u.audience)||n.id,cert:i.toString("base64"),assertionConsumerServiceUrl:`${o}samlp/${e}`,singleLogoutServiceUrl:`${o}samlp/${e}/logout`});return new Response(c,{headers:{"Content-Type":"text/xml"}})}).openapi(s.createRoute({tags:["saml"],method:"get",path:"/{client_id}",request:{query:s.z.object({SAMLRequest:s.z.string(),RelayState:s.z.string().optional(),SigAlg:s.z.string().optional(),Signature:s.z.string().optional()}),params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.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 V9(n),o=i["samlp:AuthnRequest"]["saml:Issuer"]["#text"],c=await t.env.data.loginSessions.create(t.var.tenant_id,{csrf_token:He(),authParams:{client_id:e,state:JSON.stringify({requestId:i["samlp:AuthnRequest"]["@_ID"],relayState:r}),response_mode:Pn.SAML_POST,redirect_uri:i["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"],audience:o},expires_at:new Date(Date.now()+Si*1e3).toISOString(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:mr(t.get("auth0_client"))});return t.redirect(`/u/login/identifier?state=${c.id}`)});function G9(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}),e.use(ul).use(ll).use(Yp(e));const n=e.route("/",K9);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"SAML API"},security:[{oauth2:["openid","email","profile"]}]}),Jp(n),n}const W9="Account detected",X9="We have detected that you have already created an account through",J9="By signing in, you agree to our",Y9="and",Z9="email address",Q9="email or phone number",eA="phone number",tA="Callback URL mismatch",nA="The provided redirect_uri is not in the list of allowed callback URLs.",rA="continue with user",iA="Please click the button to create a new password account.",oA="Enter the code at {{vendorName}} to complete the login",sA="Welcome to {{vendorName}}! {{code}} is the login code",aA="Welcome to {{vendorName}}! {{code}} is the login code",cA="Code expired",lA="Invalid code",uA="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",dA="The code is already used",pA="The code is valid for 30 minutes",fA="Confirm password",hA="Need Help?",gA="Contact us",mA="or continue with social account",_A="Continue with {{provider}}",yA="Would you like to continue with your existing account?",wA="Copyright © 2023 SESAMY. All rights reserved.",vA="©2023 Sesamy",bA="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",xA="Please enter a valid email address.",$A="The passwords didn't match. Try again.",AA="Choose password",kA="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",EA="Create new account",SA="Sign up with password",NA="You are currently logged in as <0>{{email}}</0>",CA="Email",IA="Email or Phone Number",TA="Email address",OA="Your email address has been validated",zA="Now enter your password to login again",DA="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.",RA="Email verification sent",PA="Enter a code",BA="We'll send you a verification link to ensure you own this email address.",jA="Enter new password",LA="Enter password",FA="Enter your email address and password to login.",UA="Enter your password",MA="The magic link has expired. Please click on the button below to receive a new link in your inbox.",qA="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",VA="Send password reset email",HA="Click the button below and we’ll send instructions on how to reset your password.",KA="Password reset email sent",GA="Forgot password?",WA="Forgot password?",XA="Go back",JA="Hide password",YA="Invalid password",ZA=`The link is no longer valid.
277
+ `)}function ky(t){this.options=t||{locator:{}}}ky.prototype.parseFromString=function(t,e){var n=this.options,r=new N9,i=n.domBuilder||new As,o=n.errorHandler,c=n.locator,l=n.xmlns||{},u=/\/x?html?$/.test(e),d=u?Hg.HTML_ENTITIES:Hg.XML_ENTITIES;c&&i.setDocumentLocator(c),r.errorHandler=C9(o,i,c),r.domBuilder=n.domBuilder||i,u&&(l[""]=Kg.HTML),l.xml=l.xml||Kg.XML;var f=n.normalizeLineEndings||Ay;return t&&typeof t=="string"?r.parse(f(t),l,d):r.errorHandler.error("invalid doc source"),i.doc};function C9(t,e,n){if(!t){if(e instanceof As)return e;t=e}var r={},i=t instanceof Function;n=n||{};function o(c){var l=t[c];!l&&i&&(l=t.length==2?function(u){t(c,u)}:t),r[c]=l&&function(u){l("[xmldom "+c+"] "+u+Vd(n))}||function(){}}return o("warning"),o("error"),o("fatalError"),r}function As(){this.cdata=!1}function hi(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}As.prototype={startDocument:function(){this.doc=new E9().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,o=i.createElementNS(t,n||e),c=r.length;Bs(this,o),this.currentElement=o,this.locator&&hi(this.locator,o);for(var l=0;l<c;l++){var t=r.getURI(l),u=r.getValue(l),n=r.getQName(l),d=i.createAttributeNS(t,n);this.locator&&hi(r.getLocator(l),d),d.value=d.nodeValue=u,o.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&&hi(this.locator,n),Bs(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=Gg.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&&hi(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=Gg.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&hi(this.locator,r),Bs(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&&hi(this.locator,i),Bs(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning] "+t,Vd(this.locator))},error:function(t){console.error("[xmldom error] "+t,Vd(this.locator))},fatalError:function(t){throw new S9(t,this.locator)}};function Vd(t){if(t)return`
278
+ @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function Gg(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){As.prototype[t]=function(){return null}});function Bs(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}$l.__DOMHandler=As;$l.normalizeLineEndings=Ay;$l.DOMParser=ky;var Ey=Zn;vl.DOMImplementation=Ey.DOMImplementation;vl.XMLSerializer=Ey.XMLSerializer;vl.DOMParser=$l.DOMParser;var Al={};Object.defineProperty(Al,"__esModule",{value:!0});Al.EnvelopedSignature=void 0;const js=_l,eu=be;class I9{constructor(){this.includeComments=!1,this.includeComments=!1}process(e,n){if(n.signatureNode==null){const o=js.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return eu.isNodeLike(o)&&o.parentNode&&o.parentNode.removeChild(o),e}const r=n.signatureNode,i=js.select1(".//*[local-name(.)='SignatureValue']/text()",r);if(eu.isTextNode(i)){const o=i.data,c=js.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);for(const l of Array.isArray(c)?c:[]){const u=js.select1(".//*[local-name(.)='SignatureValue']/text()",l);if(eu.isTextNode(u)){const d=u.data;o===d&&l.parentNode&&l.parentNode.removeChild(l)}}}return e}getAlgorithmName(){return"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}}Al.EnvelopedSignature=I9;var pr={};Object.defineProperty(pr,"__esModule",{value:!0});pr.Sha512=pr.Sha256=pr.Sha1=void 0;const Cf=pc;class T9{constructor(){this.getHash=function(e){const n=Cf.createHash("sha1");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2000/09/xmldsig#sha1"}}}pr.Sha1=T9;class O9{constructor(){this.getHash=function(e){const n=Cf.createHash("sha256");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha256"}}}pr.Sha256=O9;class z9{constructor(){this.getHash=function(e){const n=Cf.createHash("sha512");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha512"}}}pr.Sha512=z9;var wn={},ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.createOptionalCallbackFunction=void 0;function D9(t){return typeof t=="function"}function R9(t){return(...e)=>{const n=e[e.length-1];if(D9(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)}}ks.createOptionalCallbackFunction=R9;Object.defineProperty(wn,"__esModule",{value:!0});wn.HmacSha1=wn.RsaSha512=wn.RsaSha256=wn.RsaSha1=void 0;const wr=pc,vr=ks;class P9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createSign("RSA-SHA1");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createVerify("RSA-SHA1");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"}}wn.RsaSha1=P9;class B9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createSign("RSA-SHA256");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createVerify("RSA-SHA256");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"}}wn.RsaSha256=B9;class j9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createSign("RSA-SHA512");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createVerify("RSA-SHA512");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"}}wn.RsaSha512=j9;class L9{constructor(){this.getSignature=(0,vr.createOptionalCallbackFunction)((e,n)=>{const r=wr.createHmac("SHA1",n);return r.update(e),r.digest("base64")}),this.verifySignature=(0,vr.createOptionalCallbackFunction)((e,n,r)=>{const i=wr.createHmac("SHA1",n);return i.update(e),i.digest("base64")===r}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#hmac-sha1"}}wn.HmacSha1=L9;Object.defineProperty(wl,"__esModule",{value:!0});wl.SignedXml=void 0;const Dt=be,Sr=vl,F9=pc,qt=_l,Wg=Zr,U9=Al,Xg=Qr,tu=pr,Ls=wn,Oe=vs;class Tn{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=Tn.getKeyInfoContent,this.getCertFromKeyInfo=Tn.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":Wg.C14nCanonicalization,"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":Wg.C14nCanonicalizationWithComments,"http://www.w3.org/2001/10/xml-exc-c14n#":Xg.ExclusiveCanonicalization,"http://www.w3.org/2001/10/xml-exc-c14n#WithComments":Xg.ExclusiveCanonicalizationWithComments,"http://www.w3.org/2000/09/xmldsig#enveloped-signature":U9.EnvelopedSignature},this.HashAlgorithms={"http://www.w3.org/2000/09/xmldsig#sha1":tu.Sha1,"http://www.w3.org/2001/04/xmlenc#sha256":tu.Sha256,"http://www.w3.org/2001/04/xmlenc#sha512":tu.Sha512},this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#rsa-sha1":Ls.RsaSha1,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":Ls.RsaSha256,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":Ls.RsaSha512};const{idMode:n,idAttribute:r,privateKey:i,publicCert:o,signatureAlgorithm:c,canonicalizationAlgorithm:l,inclusiveNamespacesPrefixList:u,implicitTransforms:d,keyInfoAttributes:f,getKeyInfoContent:h,getCertFromKeyInfo:_}=e;this.idMode=n,this.idAttributes=["Id","ID","id"],r&&this.idAttributes.unshift(r),this.privateKey=i,this.publicCert=o,this.signatureAlgorithm=c??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=f??this.keyInfoAttributes,this.getKeyInfoContent=h??this.getKeyInfoContent,this.getCertFromKeyInfo=_??Tn.noop,this.CanonicalizationAlgorithms,this.HashAlgorithms,this.SignatureAlgorithms}enableHMAC(){this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#hmac-sha1":Ls.HmacSha1},this.getKeyInfoContent=Tn.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(o=>`<${n}X509Certificate>${Oe.pemToDer(o).toString("base64")}</${n}X509Certificate>`).join("")),`<${n}X509Data>${r}</${n}X509Data>`}static getCertFromKeyInfo(e){if(e!=null){const n=qt.select1(".//*[local-name(.)='X509Certificate']",e);if(Dt.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 Sr.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 c=new Sr.DOMParser().parseFromString(i,"text/xml").documentElement;if(!c){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(c,"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 o=qt.select1(e,n);Dt.assertIsElementNode(o),r=o}else r=e;for(const o of this.getReferences()){const c=((i=o.uri)==null?void 0:i[0])==="#"?o.uri.substring(1):o.uri;for(const f of this.idAttributes){const h=r.getAttribute(f);if(c===h){o.xpath=`//*[@*[local-name(.)='${f}']='${c}']`;break}}const l=this.getCanonReferenceXml(n,o,r),d=this.findHashAlgorithm(o.digestAlgorithm).getHash(l);if(Oe.validateDigestValue(d,o.digestValue))return o}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=qt.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 f of this.idAttributes){const h=`//*[@*[local-name(.)='${f}']='${r}']`,_=qt.select(h,n);if(Oe.isArrayHasLength(_)){if(d+=_.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=_[0],e.xpath=h}}}}if(e.getValidatedNode=(0,F9.deprecate)(d=>{if(d=d||e.xpath,typeof d!="string"||e.validationError!=null)return null;const f=qt.select1(d,n);return Dt.isNodeLike(f)?f:null},"`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead."),!Dt.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 o=this.getCanonReferenceXml(n,e,i),l=this.findHashAlgorithm(e.digestAlgorithm).getHash(o);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(o),e.signedReference=o,!0}findSignatures(e){const n=qt.select("//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return Dt.isArrayOfNodes(n)?n:[]}loadSignature(e){typeof e=="string"?this.signatureNode=e=new Sr.DOMParser().parseFromString(e):this.signatureNode=e,this.signatureXml=e.toString();const n=qt.select1(".//*[local-name(.)='CanonicalizationMethod']/@Algorithm",e);if(!Dt.isNodeLike(n))throw new Error("could not find CanonicalizationMethod/@Algorithm element");Dt.isAttributeNode(n)&&(this.canonicalizationAlgorithm=n.value);const r=qt.select1(".//*[local-name(.)='SignatureMethod']/@Algorithm",e);Dt.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 o=this.canonicalizationAlgorithm;(!o||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(o="http://www.w3.org/2001/10/xml-exc-c14n#");const c=this.getCanonXml([o],i[0]),u=new Sr.DOMParser().parseFromString(c,"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 _ of d)this.loadReference(_);const f=qt.select1(".//*[local-name(.)='SignatureValue']/text()",e);Dt.isTextNode(f)&&(this.signatureValue=f.data.replace(/\r?\n/g,""));const h=qt.select1(".//*[local-name(.)='KeyInfo']",e);Dt.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 o=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 c=n[0].textContent;if(!c)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 f=n[0],h=Oe.findChildren(f,"Transform");for(const $ of h){const m=Oe.findAttr($,"Algorithm");m&&l.push(m.value)}const _=Oe.findChildren(h[h.length-1],"InclusiveNamespaces");Oe.isArrayHasLength(_)&&(u=_.flatMap($=>($.getAttribute("PrefixList")??"").split(" ")).filter($=>$.length>0))}Oe.isArrayHasLength(this.implicitTransforms)&&this.implicitTransforms.forEach(function(f){l.push(f)}),(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=Dt.isElementNode(e)&&e.getAttribute("URI")||void 0;this.addReference({transforms:l,digestAlgorithm:o,uri:d,digestValue:c,inclusiveNamespacesPrefixList:u,isEmptyUri:!1})}addReference({xpath:e,transforms:n,digestAlgorithm:r,uri:i="",digestValue:o,inclusiveNamespacesPrefixList:c=[],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:o,inclusiveNamespacesPrefixList:c,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 o=new Sr.DOMParser().parseFromString(e);let c="xmlns";const l=[];let u;const d=["append","prepend","before","after"],f=n.prefix,h=n.attrs||{},_=n.location||{},$=n.existingPrefixes||{};if(this.namespaceResolver={lookupNamespaceURI:function(H){return H?$[H]:null}},_.reference=_.reference||"/*",_.action=_.action||"append",d.indexOf(_.action)===-1){const H=new Error(`location.action option has an invalid action: ${_.action}, must be any of the following values: ${d.join(", ")}`);if(i){i(H);return}else throw H}f?(c+=`:${f}`,u=`${f}:`):u="",Object.keys(h).forEach(function(H){H!=="xmlns"&&H!==c&&l.push(`${H}="${h[H]}"`)}),l.push(`${c}="http://www.w3.org/2000/09/xmldsig#"`);let m=`<${u}Signature ${l.join(" ")}>`;m+=this.createSignedInfo(o,f),m+=this.getKeyInfo(f),m+=`</${u}Signature>`,this.originalXmlWithIds=o.toString();let x="";Object.keys($).forEach(function(H){x+=`xmlns:${H}="${$[H]}" `});const S=`<Dummy ${x}>${m}</Dummy>`,v=new Sr.DOMParser().parseFromString(S).documentElement.firstChild,O=qt.select1(_.reference,o);if(!Dt.isNodeLike(O)){const H=new Error(`the following xpath cannot be used because it was not found: ${_.reference}`);if(i){i(H);return}else throw H}if(_.action==="append")O.appendChild(v);else if(_.action==="prepend")O.insertBefore(v,O.firstChild);else if(_.action==="before"){if(O.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");O.parentNode.insertBefore(v,O)}else if(_.action==="after"){if(O.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");O.parentNode.insertBefore(v,O.nextSibling)}this.signatureNode=v;const q=Oe.findChildren(this.signatureNode,"SignedInfo");if(q.length===0){const H=new Error("could not find SignedInfo element in the message");if(i){i(H);return}else throw H}const F=q[0];typeof i=="function"?this.calculateSignatureValue(o,(H,W)=>{H?i(H):(this.signatureValue=W||"",v.insertBefore(this.createSignature(f),F.nextSibling),this.signatureXml=v.toString(),this.signedXml=o.toString(),i(null,this))}):(this.calculateSignatureValue(o),v.insertBefore(this.createSignature(f),F.nextSibling),this.signatureXml=v.toString(),this.signedXml=o.toString())}getKeyInfo(e){const n=e?`${e}:`:"";let r="";this.keyInfoAttributes&&Object.keys(this.keyInfoAttributes).forEach(o=>{r+=` ${o}="${this.keyInfoAttributes[o]}"`});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 o=qt.selectWithResolver(i.xpath??"",e,this.namespaceResolver);if(!Oe.isArrayHasLength(o))throw new Error(`the following xpath cannot be signed because it was not found: ${i.xpath}`);for(const c of o){if(i.isEmptyUri)r+=`<${n}Reference URI="">`;else{const d=this.ensureHasId(c);i.uri=d,r+=`<${n}Reference URI="#${d}">`}r+=`<${n}Transforms>`;for(const d of i.transforms||[]){const f=this.findCanonicalizationAlgorithm(d);r+=`<${n}Transform Algorithm="${f.getAlgorithmName()}"`,Oe.isArrayHasLength(i.inclusiveNamespacesPrefixList)?(r+=">",r+=`<InclusiveNamespaces PrefixList="${i.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${f.getAlgorithmName()}"/>`,r+=`</${n}Transform>`):r+=" />"}const l=this.getCanonReferenceXml(e,i,c),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??Tn.defaultNsForPrefix,r.signatureNode=this.signatureNode;let o=n.cloneNode(!0);return e.forEach(c=>{Dt.isNodeLike(o)&&(o=this.findCanonicalizationAlgorithm(c).process(o,r))}),o.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 o;o=n||"",o=o&&`${o}:`;let c=`<${o}SignedInfo>`;return c+=`<${o}CanonicalizationMethod Algorithm="${r.getAlgorithmName()}"`,Oe.isArrayHasLength(this.inclusiveNamespacesPrefixList)?(c+=">",c+=`<InclusiveNamespaces PrefixList="${this.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${r.getAlgorithmName()}"/>`,c+=`</${o}CanonicalizationMethod>`):c+=" />",c+=`<${o}SignatureMethod Algorithm="${i.getAlgorithmName()}" />`,c+=this.createReferences(e,n),c+=`</${o}SignedInfo>`,c}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 Sr.DOMParser().parseFromString(i).documentElement.firstChild}getSignatureXml(){return this.signatureXml}getOriginalXmlWithIds(){return this.originalXmlWithIds}getSignedXml(){return this.signedXml}}wl.SignedXml=Tn;Tn.defaultNsForPrefix={ds:"http://www.w3.org/2000/09/xmldsig#"};Tn.noop=()=>null;(function(t){var e=sr&&sr.__createBinding||(Object.create?function(c,l,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(l,u);(!f||("get"in f?!l.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(c,d,f)}:function(c,l,u,d){d===void 0&&(d=u),c[d]=l[u]}),n=sr&&sr.__exportStar||function(c,l){for(var u in c)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,c,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.SignedXml=t.ExclusiveCanonicalizationWithComments=t.ExclusiveCanonicalization=t.C14nCanonicalizationWithComments=t.C14nCanonicalization=void 0;var r=Zr;Object.defineProperty(t,"C14nCanonicalization",{enumerable:!0,get:function(){return r.C14nCanonicalization}}),Object.defineProperty(t,"C14nCanonicalizationWithComments",{enumerable:!0,get:function(){return r.C14nCanonicalizationWithComments}});var i=Qr;Object.defineProperty(t,"ExclusiveCanonicalization",{enumerable:!0,get:function(){return i.ExclusiveCanonicalization}}),Object.defineProperty(t,"ExclusiveCanonicalizationWithComments",{enumerable:!0,get:function(){return i.ExclusiveCanonicalizationWithComments}});var o=wl;Object.defineProperty(t,"SignedXml",{enumerable:!0,get:function(){return o.SignedXml}}),n(ks,t),n(vs,t)})(D6);async function M9(t){const e=new DecompressionStream("deflate-raw"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}async function q9(t){const e=await Fm.decode(t.replace(/ /g,"+"));try{const n=await M9(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 V9(t){const e=await q9(t),r=new op.XMLParser({attributeNamePrefix:"@_",alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(e);return T6.parse(r)}function H9(t){const e=[{":@":{"@_entityID":t.entityId,"@_xmlns":"urn:oasis:names:tc:SAML:2.0:metadata"},EntityDescriptor:[{":@":{"@_protocolSupportEnumeration":"urn:oasis:names:tc:SAML:2.0:protocol"},IDPSSODescriptor:[{":@":{"@_use":"signing"},KeyDescriptor:[{":@":{"@_xmlns":"http://www.w3.org/2000/09/xmldsig#"},KeyInfo:[{X509Data:[{X509Certificate:[{"#text":t.cert}]}]}]}]},{":@":{"@_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 op.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0,format:!0}).build(e)}const K9=new s.OpenAPIHono().openapi(s.createRoute({tags:["saml"],method:"get",path:"/metadata/{client_id}",request:{params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.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 P(404,{message:"Client not found"});const[r]=await t.env.data.keys.list();if(!r)throw new P(500,{message:"No signing key found"});const i=new al(r.cert),o=t.env.ISSUER,c=H9({entityId:((u=(l=n.addons)==null?void 0:l.samlp)==null?void 0:u.audience)||n.id,cert:i.toString("base64"),assertionConsumerServiceUrl:`${o}samlp/${e}`,singleLogoutServiceUrl:`${o}samlp/${e}/logout`});return new Response(c,{headers:{"Content-Type":"text/xml"}})}).openapi(s.createRoute({tags:["saml"],method:"get",path:"/{client_id}",request:{query:s.z.object({SAMLRequest:s.z.string(),RelayState:s.z.string().optional(),SigAlg:s.z.string().optional(),Signature:s.z.string().optional()}),params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.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 V9(n),o=i["samlp:AuthnRequest"]["saml:Issuer"]["#text"],c=await t.env.data.loginSessions.create(t.var.tenant_id,{csrf_token:He(),authParams:{client_id:e,state:JSON.stringify({requestId:i["samlp:AuthnRequest"]["@_ID"],relayState:r}),response_mode:Pn.SAML_POST,redirect_uri:i["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"],audience:o},expires_at:new Date(Date.now()+Si*1e3).toISOString(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:mr(t.get("auth0_client"))});return t.redirect(`/u/login/identifier?state=${c.id}`)});function G9(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Wo(r,t.dataAdapter),c=dl(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=cl(r,c),i()}),e.use(ul).use(ll).use(Yp(e));const n=e.route("/",K9);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"SAML API"},security:[{oauth2:["openid","email","profile"]}]}),Jp(n),n}const W9="Account detected",X9="We have detected that you have already created an account through",J9="By signing in, you agree to our",Y9="and",Z9="email address",Q9="email or phone number",eA="phone number",tA="Callback URL mismatch",nA="The provided redirect_uri is not in the list of allowed callback URLs.",rA="continue with user",iA="Please click the button to create a new password account.",oA="Enter the code at {{vendorName}} to complete the login",sA="Welcome to {{vendorName}}! {{code}} is the login code",aA="Welcome to {{vendorName}}! {{code}} is the login code",cA="Code expired",lA="Invalid code",uA="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",dA="The code is already used",pA="The code is valid for 30 minutes",fA="Confirm password",hA="Need Help?",gA="Contact us",mA="or continue with social account",_A="Continue with {{provider}}",yA="Would you like to continue with your existing account?",wA="Copyright © 2023 SESAMY. All rights reserved.",vA="©2023 Sesamy",bA="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",xA="Please enter a valid email address.",$A="The passwords didn't match. Try again.",AA="Choose password",kA="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",EA="Create new account",SA="Sign up with password",NA="You are currently logged in as <0>{{email}}</0>",CA="Email",IA="Email or Phone Number",TA="Email address",OA="Your email address has been validated",zA="Now enter your password to login again",DA="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.",RA="Email verification sent",PA="Enter a code",BA="We'll send you a verification link to ensure you own this email address.",jA="Enter new password",LA="Enter password",FA="Enter your email address and password to login.",UA="Enter your password",MA="The magic link has expired. Please click on the button below to receive a new link in your inbox.",qA="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",VA="Send password reset email",HA="Click the button below and we’ll send instructions on how to reset your password.",KA="Password reset email sent",GA="Forgot password?",WA="Forgot password?",XA="Go back",JA="Hide password",YA="Invalid password",ZA=`The link is no longer valid.
279
279
 
280
280
  Please make sure to open the login link in the same browser you started the login with.
281
281
 
@@ -303,4 +303,4 @@ Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,mP="Neplatn
303
303
 
304
304
  Varmista, että avaat kirjautumislinkin samalla selaimella, jolla aloitit kirjautumisen.
305
305
 
306
- Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,Uj="Virheellinen linkki",Mj="Kirjaudu sisään napsauttamalla painiketta",qj="Kirjaudu sisään",Vj="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",Hj="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",Kj="Yhdistä tilisi {{service}}",Gj="Olet kirjautunut sisään nimellä",Wj="Kirjaudu sisään",Xj="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",Jj="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",Yj="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",Zj="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",Qj="Anna puhelinnumerosi kirjautuaksesi sisään",eL="Kirjoita {{authMethod}} kirjautuaksesi sisään.",tL="Kirjaudu ulos",nL="Ei, haluan käyttää toista tiliä",rL="tai",iL="Salasana",oL="Salasana on nollattu",sL="Menestys",aL="Vaihda salasana tilillesi {{vendorName}} ",cL="Vaihda salasana tilillesi {{vendorName}} ",lL="Puhelinnumero",uL="Tietosuojakäytäntö",dL="Uudelleenohjaus",pL="Vahvista salasana",fL="Rekisteröi uusi salasana",hL="Lähetä koodi uudelleen",gL="Vaihda salasana",mL="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",_L="Napsauta painiketta salasanasi palauttamiseksi",yL="Napsauta painiketta salasanasi palauttamiseksi",wL="Nollaa salasanasi",vL="Vaihda salasana tilillesi {{vendorName}} ",bL="Nollaa salasana",xL="Lähetä",$L="Lähetä minulle uusi maaginen linkki",AL="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",kL="Aseta salasana",EL="Näytä salasana",SL="Kirjaudu sisään",NL="Rekisteröityminen",CL="Rekisteröidy onnistuneesti",IL="{{code}} on kirjautumiskoodisi {{vendorName}}",TL="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.",OL="Siirry Spotifyn Content Access -sivulle",zL='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ä.',DL="Vaihe 1: Poista Spotify-tilisi linkitys",RL="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",PL="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",BL="Hups! Spotify-tilisi on jo linkitetty",jL="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",LL="Ehdot ja edellytykset",FL="Jokin meni pieleen. Yritä uudelleen.",UL="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",ML="Käyttäjätiliä ei ole olemassa",qL="Käyttäjätiliä ei ole olemassa",VL="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",HL="Yritä uudelleen.",KL="Validoi koodi",GL="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",WL="Rekisteröitynyt",XL="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",JL="Vahvista sähköpostiosoitteesi",YL="Vahvista sähköpostiosoitteesi",ZL="Vahvista tili",QL="Vahvista sähköpostiosoitteesi",eF="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",tF="Tervetuloa",nF="Tervetuloa tilillesi {{vendorName}}!",rF="Jatka tällä tilillä",iF="Kyllä, jatka {{text}}",oF="Kyllä, jatka olemassa olevalla tilillä",sF={"Server error: Invalid code":"Virheellinen koodi",account_detected:PB,account_with_sso_provider:BB,agree_to:jB,and:LB,auth_method_email:FB,auth_method_email_or_phone:UB,auth_method_phone:MB,callback_url_mismatch:qB,callback_url_not_allowed:VB,check_email_title:HB,click_to_sign_up_description:KB,code_email_enter_code:GB,code_email_subject:WB,code_email_title:XB,code_expired:JB,code_invalid:YB,code_sent_template:ZB,code_used:QB,code_valid_30_minutes:ej,confirm_password:tj,contact_support:nj,contact_us:rj,continue:"Jatka",continue_social_login:ij,continue_with:oj,continue_with_sso_provider_headline:sj,copyright:aj,copyright_sesamy:cj,create_account_description:lj,create_account_email_invalid:uj,create_account_passwords_didnt_match:dj,create_account_title:pj,create_account_weak_password:fj,create_new_account_link:hj,create_password_account_title:gj,currently_logged_in_as:mj,email:_j,email_or_phone_placeholder:yj,email_placeholder:wj,email_validated:vj,email_validated_cta:bj,email_verification_for_signup_sent_description:xj,email_verification_for_signup_sent_title:$j,enter_a_code_btn:Aj,enter_email_for_verification_description:kj,enter_new_password_placeholder:Ej,enter_password:Sj,enter_password_description:Nj,enter_your_password_btn:Cj,expired_code:Ij,fokus_info_message:Tj,forgot_password_cta:Oj,forgot_password_description:zj,forgot_password_email_sent:Dj,forgot_password_link:Rj,forgot_password_title:Pj,go_back:Bj,hide_password:jj,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:Lj,invalid_session_body:Fj,invalid_session_title:Uj,link_email_click_to_login:Mj,link_email_login:qj,link_email_or_enter_code:Vj,link_page_body:Hj,link_page_headline:Kj,logged_in_as:Gj,login:Wj,login_description:Xj,login_description_code:Jj,login_description_combined:Yj,login_description_link:Zj,login_description_phone:Qj,login_description_template:eL,logout:tL,no_use_another:nL,or:rL,password:iL,password_has_been_reset:oL,password_has_been_reset_title:sL,password_reset_subject:aL,password_reset_title:cL,phone_placeholder:lL,privacy_policy:uL,redirecting:dL,reenter_new_password_placeholder:pL,register_password_account:fL,resend_code:hL,reset_password_cta:gL,reset_password_description:mL,reset_password_email_click_to_reset:_L,reset_password_email_cta:yL,reset_password_email_reset:wL,reset_password_subject:vL,reset_password_title:bL,send:xL,send_me_a_new_magic_link:$L,sent_code_spam:AL,set_password:kL,show_password:EL,sign_in:SL,signup:NL,signup_success:CL,sms_code_text:IL,spotify_already_linked_body:TL,spotify_already_linked_cta:OL,spotify_already_linked_step1_body:zL,spotify_already_linked_step1_title:DL,spotify_already_linked_step2_body:RL,spotify_already_linked_step2_title:PL,spotify_already_linked_title:BL,support_info:jL,terms:LL,unexpected_error_try_again:FL,unverified_email:UL,user_account_does_not_exist:ML,user_not_found:qL,user_not_found_body:VL,user_not_found_cta:HL,validate_code:KL,validate_email_body:GL,validate_email_title:WL,verify_email_click_to_verify:XL,verify_email_subject:JL,verify_email_title:YL,verify_email_verify:ZL,verify_your_email:QL,we_sent_a_code_to:eF,welcome:tF,welcome_to_your_account:nF,yes_continue:rF,yes_continue_with:iF,yes_continue_with_existing_account:oF},aF="Konto opdaget",cF="Vi har opdaget, at du allerede har oprettet en konto gennem",lF="Når du logger ind, accepterer du vores",uF="og",dF="e-mail-adresse",pF="e-mail eller telefonnummer",fF="Telefonnummer",hF="Uoverensstemmelse mellem URL og tilbagekald",gF="Den angivne redirect_uri er ikke på listen over tilladte tilbagekalds-URL'er.",mF="Fortsæt med brugeren",_F="Klik på knappen for at oprette en ny adgangskodekonto.",yF="Indtast koden på {{vendorName}} for at gennemføre login.",wF="Velkommen til {{vendorName}}! {{code}} er login-koden",vF="Velkommen til {{vendorName}}! {{code}} er login-koden",bF="Koden er udløbet",xF="Ugyldig kode",$F="Tjek venligst <0>{{username}}</0> og indtast den sekscifrede kode, som vi har sendt til dig.",AF="Koden er allerede brugt",kF="Koden er gyldig i 30 minutter",EF="Bekræft adgangskode",SF="Har du brug for hjælp?",NF="Kontakt os",CF="eller fortsæt med social konto",IF="Fortsæt med {{provider}}",TF="Vil du gerne fortsætte med din eksisterende konto?",OF="Ophavsret © 2023 SESAMY. Alle rettigheder forbeholdes.",zF="©2023 Sesamy",DF="Vælg en adgangskode med en blanding af store og små bogstaver, tal og symboler.",RF="Indtast venligst en gyldig e-mailadresse.",PF="Adgangskoderne stemte ikke overens. Prøv igen.",BF="Vælg adgangskode",jF="Adgangskoden skal være mindst 8 tegn lang og indeholde mindst et lille bogstav, et stort bogstav, et tal og et symbol.",LF="Opret ny konto",FF="Tilmeld dig med adgangskode",UF="Du er i øjeblikket logget ind som <0>{{email}}</0>",MF="E-mail",qF="E-mail eller telefonnummer",VF="E-mail-adresse",HF="Din e-mailadresse er blevet valideret",KF="Indtast nu din adgangskode for at logge ind igen",GF="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.",WF="E-mail-bekræftelse sendt",XF="Indtast en kode",JF="Vi sender dig et bekræftelseslink for at sikre, at du ejer denne e-mailadresse.",YF="Indtast ny adgangskode",ZF="Indtast adgangskode",QF="Indtast din e-mailadresse og adgangskode for at logge ind.",eU="Indtast din adgangskode",tU="Det magiske link er udløbet. Klik på knappen nedenfor for at modtage et nyt link i din indbakke.",nU="Hej! Vi har opdateret vores login-oplevelse. <0>Klik her for at lære mere om det.</0>",rU="Send e-mail til nulstilling af adgangskode",iU="Klik på knappen nedenfor, så sender vi instruktioner om, hvordan du nulstiller din adgangskode.",oU="E-mail til nulstilling af adgangskode sendt",sU="Har du glemt din adgangskode?",aU="Har du glemt din adgangskode?",cU="Gå tilbage",lU="Skjul adgangskode",uU="Ugyldig adgangskode",dU="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.",pU="Ugyldigt link",fU="Klik på knappen for at logge ind",hU="Login",gU="Eller indtast koden på {{vendorName}} for at gennemføre login.",mU="Indtast din e-mailadresse for at låse op for dette show på {{service}}",_U="Forbind din konto med {{service}}",yU="Du er logget ind som",wU="Login",vU="Indtast din e-mailadresse for at logge ind.",bU="Indtast din e-mailadresse, så sender vi dig en login-kode.",xU="Indtast din e-mail eller dit telefonnummer for at logge ind",$U="Indtast din e-mailadresse, så sender vi dig et login-link.",AU="Indtast dit telefonnummer for at logge ind",kU="Indtast din {{authMethod}} for at logge ind.",EU="Log ud",SU="Nej, jeg vil bruge en anden konto",NU="eller",CU="Adgangskode",IU="Adgangskoden er blevet nulstillet",TU="Succes",OU="Skift adgangskode til din {{vendorName}} -konto",zU="Skift adgangskode til din {{vendorName}} -konto",DU="Telefonnummer",RU="Politik for beskyttelse af personlige oplysninger",PU="Omdirigering",BU="Bekræft adgangskode",jU="Registrer en ny adgangskode",LU="Send koden igen",FU="Skift adgangskode",UU="Indtast din nye adgangskode til e-mailkontoen nedenfor: ",MU="Klik på knappen for at nulstille din adgangskode",qU="Klik på knappen for at nulstille din adgangskode",VU="Nulstil din adgangskode",HU="Skift adgangskode til din {{vendorName}} -konto",KU="Nulstil adgangskode",GU="Send",WU="Send mig et nyt magisk link",XU="Husk at tjekke din spam-mappe, hvis e-mailen ikke er kommet frem.",JU="Indstil adgangskode",YU="Vis adgangskode",ZU="Log ind",QU="Tilmelding",eM="Tilmeld dig med succes",tM="{{code}} er din login-kode til {{vendorName}}",nM="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.",rM="Gå til Spotifys side for adgang til indhold",iM='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.',oM="Trin 1: Fjern forbindelsen til din Spotify-konto",sM="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.",aM="Trin 2: Relink din Spotify-konto til Sesamy",cM="Ups! Din Spotify-konto er allerede forbundet",lM="Hvis du har spørgsmål eller brug for hjælp, kan du kontakte vores supportteam",uM="Vilkår og betingelser",dM="Noget gik galt. Prøv venligst igen.",pM="Din e-mailadresse skal valideres. Vi har sendt en ny e-mail til din indbakke",fM="Brugerkontoen findes ikke",hM="Brugerkontoen findes ikke",gM="Vi kunne ikke finde en bruger med den angivne e-mailadresse. Prøv venligst igen.",mM="Prøv igen.",_M="Valider koden",yM="Tjek din indbakke for instruktioner om validering af e-mail.",wM="Tilmeldte sig",vM="Klik på knappen for at bekræfte din e-mailadresse",bM="Bekræft din e-mailadresse",xM="Bekræft din e-mailadresse",$M="Bekræft konto",AM="Bekræft din e-mail",kM="Tjek venligst din e-mail på <0>{{email}}</0> og indtast den sekscifrede kode, vi har sendt dig.",EM="Velkommen",SM="Velkommen til din {{vendorName}} konto!",NM="Fortsæt med denne konto",CM="Ja, fortsæt med {{text}}",IM="Ja, fortsæt med eksisterende konto",TM={"Server error: Invalid code":"Ugyldig kode",account_detected:aF,account_with_sso_provider:cF,agree_to:lF,and:uF,auth_method_email:dF,auth_method_email_or_phone:pF,auth_method_phone:fF,callback_url_mismatch:hF,callback_url_not_allowed:gF,check_email_title:mF,click_to_sign_up_description:_F,code_email_enter_code:yF,code_email_subject:wF,code_email_title:vF,code_expired:bF,code_invalid:xF,code_sent_template:$F,code_used:AF,code_valid_30_minutes:kF,confirm_password:EF,contact_support:SF,contact_us:NF,continue:"Fortsæt",continue_social_login:CF,continue_with:IF,continue_with_sso_provider_headline:TF,copyright:OF,copyright_sesamy:zF,create_account_description:DF,create_account_email_invalid:RF,create_account_passwords_didnt_match:PF,create_account_title:BF,create_account_weak_password:jF,create_new_account_link:LF,create_password_account_title:FF,currently_logged_in_as:UF,email:MF,email_or_phone_placeholder:qF,email_placeholder:VF,email_validated:HF,email_validated_cta:KF,email_verification_for_signup_sent_description:GF,email_verification_for_signup_sent_title:WF,enter_a_code_btn:XF,enter_email_for_verification_description:JF,enter_new_password_placeholder:YF,enter_password:ZF,enter_password_description:QF,enter_your_password_btn:eU,expired_code:tU,fokus_info_message:nU,forgot_password_cta:rU,forgot_password_description:iU,forgot_password_email_sent:oU,forgot_password_link:sU,forgot_password_title:aU,go_back:cU,hide_password:lU,"invalid-email":"Ugyldig e-mail",invalid_password:uU,invalid_session_body:dU,invalid_session_title:pU,link_email_click_to_login:fU,link_email_login:hU,link_email_or_enter_code:gU,link_page_body:mU,link_page_headline:_U,logged_in_as:yU,login:wU,login_description:vU,login_description_code:bU,login_description_combined:xU,login_description_link:$U,login_description_phone:AU,login_description_template:kU,logout:EU,no_use_another:SU,or:NU,password:CU,password_has_been_reset:IU,password_has_been_reset_title:TU,password_reset_subject:OU,password_reset_title:zU,phone_placeholder:DU,privacy_policy:RU,redirecting:PU,reenter_new_password_placeholder:BU,register_password_account:jU,resend_code:LU,reset_password_cta:FU,reset_password_description:UU,reset_password_email_click_to_reset:MU,reset_password_email_cta:qU,reset_password_email_reset:VU,reset_password_subject:HU,reset_password_title:KU,send:GU,send_me_a_new_magic_link:WU,sent_code_spam:XU,set_password:JU,show_password:YU,sign_in:ZU,signup:QU,signup_success:eM,sms_code_text:tM,spotify_already_linked_body:nM,spotify_already_linked_cta:rM,spotify_already_linked_step1_body:iM,spotify_already_linked_step1_title:oM,spotify_already_linked_step2_body:sM,spotify_already_linked_step2_title:aM,spotify_already_linked_title:cM,support_info:lM,terms:uM,unexpected_error_try_again:dM,unverified_email:pM,user_account_does_not_exist:fM,user_not_found:hM,user_not_found_body:gM,user_not_found_cta:mM,validate_code:_M,validate_email_body:yM,validate_email_title:wM,verify_email_click_to_verify:vM,verify_email_subject:bM,verify_email_title:xM,verify_email_verify:$M,verify_your_email:AM,we_sent_a_code_to:kM,welcome:EM,welcome_to_your_account:SM,yes_continue:NM,yes_continue_with:CM,yes_continue_with_existing_account:IM},OM=t=>{const{vendorSettings:e,authParams:n}=t,i=`/authorize?${new URLSearchParams({...n})}`;return A(dt,{vendorSettings:e,title:U.t("user_not_found"),children:A("div",{className:"flex flex-1 flex-col justify-center",children:[A("p",{className:"mb-8 text-gray-300 text-lg",children:U.t("user_not_found_body")}),A(at,{Component:"a",href:i,children:U.t("user_not_found_cta")})]})})};U.init({supportedLngs:["en","it","nb","sv","pl","cs","fi","da"],fallbackLng:"en",resources:{en:{translation:yE},it:{translation:q7},nb:{translation:hI},sv:{translation:LO},pl:{translation:uR},cs:{translation:RB},fi:{translation:sF},da:{translation:TM}}});function zM(t){const e=new s.OpenAPIHono;e.get("/",c=>c.json({name:"authhero"}));const n=W4(t);e.route("/api/v2",n);const r=p8(t);e.route("/",r);const i=C6(t);e.route("/u",i);const o=G9(t);return e.route("/samlp",o),{app:e,managementApp:n,oauthApp:r,samlApp:o,universalApp:i,createX509Certificate:Nd}}exports.AppLogo=k_;exports.Auth0Client=km;exports.AuthorizationResponseMode=Pn;exports.AuthorizationResponseType=xt;exports.Button=at;exports.CheckEmailPage=M_;exports.CodeChallengeMethod=lc;exports.ComponentCategory=Gd;exports.ComponentType=Kd;exports.EmailValidatedPage=H_;exports.EnterCodePage=Fd;exports.EnterPasswordPage=ho;exports.ErrorMessage=oi;exports.Footer=E_;exports.ForgotPasswordPage=F_;exports.ForgotPasswordSentPage=U_;exports.FormComponent=Jn;exports.GoBack=ln;exports.GoogleLogo=C_;exports.GrantType=wi;exports.Icon=st;exports.IdentifierPage=ea;exports.InvalidSession=V_;exports.Layout=dt;exports.LogTypes=Fe;exports.Message=yr;exports.NodeType=cm;exports.PreSignUpConfirmationPage=K_;exports.PreSignUpPage=q_;exports.ResetPasswordPage=mi;exports.SignUpPage=Cr;exports.SocialButton=po;exports.Spinner=N_;exports.Trans=ml;exports.UnverifiedEmailPage=L_;exports.UserNotFoundPage=OM;exports.VippsLogo=I_;exports.applicationInsertSchema=ca;exports.applicationSchema=Or;exports.auth0FlowInsertSchema=tw;exports.auth0FlowSchema=gm;exports.auth0UserResponseSchema=_n;exports.authParamsSchema=$o;exports.baseUserSchema=ac;exports.bordersSchema=Cm;exports.brandingSchema=ru;exports.buttonComponentSchema=rm;exports.codeInsertSchema=ym;exports.codeSchema=nw;exports.codeTypeSchema=_m;exports.colorsSchema=Im;exports.componentSchema=am;exports.connectionInsertSchema=la;exports.connectionOptionsSchema=Wd;exports.connectionSchema=or;exports.coordinatesSchema=Vi;exports.customDomainInsertSchema=Xd;exports.customDomainSchema=ir;exports.customDomainWithTenantIdSchema=rw;exports.emailProviderSchema=Ms;exports.endingSchema=hm;exports.fieldComponentSchema=om;exports.flowNodeSchema=um;exports.fontDetailsSchema=Nr;exports.fontsSchema=Tm;exports.formControlSchema=iw;exports.formInsertSchema=da;exports.formNodeComponentDefinition=vm;exports.formSchema=_i;exports.genericComponentSchema=sm;exports.genericNodeSchema=dm;exports.hookInsertSchema=Fs;exports.hookSchema=yi;exports.identitySchema=em;exports.init=zM;exports.injectTailwindCSS=$6;exports.jwksKeySchema=$m;exports.jwksSchema=Jd;exports.legalComponentSchema=im;exports.logSchema=pa;exports.loginSessionInsertSchema=Am;exports.loginSessionSchema=lw;exports.nodeSchema=pm;exports.openIDConfigurationSchema=iu;exports.pageBackgroundSchema=Om;exports.parseUserId=mw;exports.passwordInsertSchema=Em;exports.passwordSchema=dw;exports.profileDataSchema=Qg;exports.promptSettingSchema=Us;exports.refreshTokenInsertSchema=Zd;exports.refreshTokenSchema=fw;exports.richTextComponentSchema=nm;exports.samlpAddon=tm;exports.sessionInsertSchema=Nm;exports.sessionSchema=dc;exports.signingKeySchema=ou;exports.smsProviderSchema=gw;exports.smsSendParamsSchema=hw;exports.startSchema=fm;exports.stepNodeSchema=lm;exports.tailwindCss=yf;exports.tenantInsertSchema=ua;exports.tenantSchema=xi;exports.themeInsertSchema=Dm;exports.themeSchema=pw;exports.tokenResponseSchema=Yd;exports.totalsSchema=Kn;exports.userInsertSchema=aa;exports.userResponseSchema=Zy;exports.userSchema=Hd;exports.vendorSettingsSchema=mm;exports.verificationMethodsSchema=wm;exports.widgetSchema=zm;
306
+ Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,Uj="Virheellinen linkki",Mj="Kirjaudu sisään napsauttamalla painiketta",qj="Kirjaudu sisään",Vj="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",Hj="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",Kj="Yhdistä tilisi {{service}}",Gj="Olet kirjautunut sisään nimellä",Wj="Kirjaudu sisään",Xj="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",Jj="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",Yj="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",Zj="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",Qj="Anna puhelinnumerosi kirjautuaksesi sisään",eL="Kirjoita {{authMethod}} kirjautuaksesi sisään.",tL="Kirjaudu ulos",nL="Ei, haluan käyttää toista tiliä",rL="tai",iL="Salasana",oL="Salasana on nollattu",sL="Menestys",aL="Vaihda salasana tilillesi {{vendorName}} ",cL="Vaihda salasana tilillesi {{vendorName}} ",lL="Puhelinnumero",uL="Tietosuojakäytäntö",dL="Uudelleenohjaus",pL="Vahvista salasana",fL="Rekisteröi uusi salasana",hL="Lähetä koodi uudelleen",gL="Vaihda salasana",mL="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",_L="Napsauta painiketta salasanasi palauttamiseksi",yL="Napsauta painiketta salasanasi palauttamiseksi",wL="Nollaa salasanasi",vL="Vaihda salasana tilillesi {{vendorName}} ",bL="Nollaa salasana",xL="Lähetä",$L="Lähetä minulle uusi maaginen linkki",AL="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",kL="Aseta salasana",EL="Näytä salasana",SL="Kirjaudu sisään",NL="Rekisteröityminen",CL="Rekisteröidy onnistuneesti",IL="{{code}} on kirjautumiskoodisi {{vendorName}}",TL="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.",OL="Siirry Spotifyn Content Access -sivulle",zL='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ä.',DL="Vaihe 1: Poista Spotify-tilisi linkitys",RL="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",PL="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",BL="Hups! Spotify-tilisi on jo linkitetty",jL="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",LL="Ehdot ja edellytykset",FL="Jokin meni pieleen. Yritä uudelleen.",UL="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",ML="Käyttäjätiliä ei ole olemassa",qL="Käyttäjätiliä ei ole olemassa",VL="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",HL="Yritä uudelleen.",KL="Validoi koodi",GL="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",WL="Rekisteröitynyt",XL="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",JL="Vahvista sähköpostiosoitteesi",YL="Vahvista sähköpostiosoitteesi",ZL="Vahvista tili",QL="Vahvista sähköpostiosoitteesi",eF="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",tF="Tervetuloa",nF="Tervetuloa tilillesi {{vendorName}}!",rF="Jatka tällä tilillä",iF="Kyllä, jatka {{text}}",oF="Kyllä, jatka olemassa olevalla tilillä",sF={"Server error: Invalid code":"Virheellinen koodi",account_detected:PB,account_with_sso_provider:BB,agree_to:jB,and:LB,auth_method_email:FB,auth_method_email_or_phone:UB,auth_method_phone:MB,callback_url_mismatch:qB,callback_url_not_allowed:VB,check_email_title:HB,click_to_sign_up_description:KB,code_email_enter_code:GB,code_email_subject:WB,code_email_title:XB,code_expired:JB,code_invalid:YB,code_sent_template:ZB,code_used:QB,code_valid_30_minutes:ej,confirm_password:tj,contact_support:nj,contact_us:rj,continue:"Jatka",continue_social_login:ij,continue_with:oj,continue_with_sso_provider_headline:sj,copyright:aj,copyright_sesamy:cj,create_account_description:lj,create_account_email_invalid:uj,create_account_passwords_didnt_match:dj,create_account_title:pj,create_account_weak_password:fj,create_new_account_link:hj,create_password_account_title:gj,currently_logged_in_as:mj,email:_j,email_or_phone_placeholder:yj,email_placeholder:wj,email_validated:vj,email_validated_cta:bj,email_verification_for_signup_sent_description:xj,email_verification_for_signup_sent_title:$j,enter_a_code_btn:Aj,enter_email_for_verification_description:kj,enter_new_password_placeholder:Ej,enter_password:Sj,enter_password_description:Nj,enter_your_password_btn:Cj,expired_code:Ij,fokus_info_message:Tj,forgot_password_cta:Oj,forgot_password_description:zj,forgot_password_email_sent:Dj,forgot_password_link:Rj,forgot_password_title:Pj,go_back:Bj,hide_password:jj,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:Lj,invalid_session_body:Fj,invalid_session_title:Uj,link_email_click_to_login:Mj,link_email_login:qj,link_email_or_enter_code:Vj,link_page_body:Hj,link_page_headline:Kj,logged_in_as:Gj,login:Wj,login_description:Xj,login_description_code:Jj,login_description_combined:Yj,login_description_link:Zj,login_description_phone:Qj,login_description_template:eL,logout:tL,no_use_another:nL,or:rL,password:iL,password_has_been_reset:oL,password_has_been_reset_title:sL,password_reset_subject:aL,password_reset_title:cL,phone_placeholder:lL,privacy_policy:uL,redirecting:dL,reenter_new_password_placeholder:pL,register_password_account:fL,resend_code:hL,reset_password_cta:gL,reset_password_description:mL,reset_password_email_click_to_reset:_L,reset_password_email_cta:yL,reset_password_email_reset:wL,reset_password_subject:vL,reset_password_title:bL,send:xL,send_me_a_new_magic_link:$L,sent_code_spam:AL,set_password:kL,show_password:EL,sign_in:SL,signup:NL,signup_success:CL,sms_code_text:IL,spotify_already_linked_body:TL,spotify_already_linked_cta:OL,spotify_already_linked_step1_body:zL,spotify_already_linked_step1_title:DL,spotify_already_linked_step2_body:RL,spotify_already_linked_step2_title:PL,spotify_already_linked_title:BL,support_info:jL,terms:LL,unexpected_error_try_again:FL,unverified_email:UL,user_account_does_not_exist:ML,user_not_found:qL,user_not_found_body:VL,user_not_found_cta:HL,validate_code:KL,validate_email_body:GL,validate_email_title:WL,verify_email_click_to_verify:XL,verify_email_subject:JL,verify_email_title:YL,verify_email_verify:ZL,verify_your_email:QL,we_sent_a_code_to:eF,welcome:tF,welcome_to_your_account:nF,yes_continue:rF,yes_continue_with:iF,yes_continue_with_existing_account:oF},aF="Konto opdaget",cF="Vi har opdaget, at du allerede har oprettet en konto gennem",lF="Når du logger ind, accepterer du vores",uF="og",dF="e-mail-adresse",pF="e-mail eller telefonnummer",fF="Telefonnummer",hF="Uoverensstemmelse mellem URL og tilbagekald",gF="Den angivne redirect_uri er ikke på listen over tilladte tilbagekalds-URL'er.",mF="Fortsæt med brugeren",_F="Klik på knappen for at oprette en ny adgangskodekonto.",yF="Indtast koden på {{vendorName}} for at gennemføre login.",wF="Velkommen til {{vendorName}}! {{code}} er login-koden",vF="Velkommen til {{vendorName}}! {{code}} er login-koden",bF="Koden er udløbet",xF="Ugyldig kode",$F="Tjek venligst <0>{{username}}</0> og indtast den sekscifrede kode, som vi har sendt til dig.",AF="Koden er allerede brugt",kF="Koden er gyldig i 30 minutter",EF="Bekræft adgangskode",SF="Har du brug for hjælp?",NF="Kontakt os",CF="eller fortsæt med social konto",IF="Fortsæt med {{provider}}",TF="Vil du gerne fortsætte med din eksisterende konto?",OF="Ophavsret © 2023 SESAMY. Alle rettigheder forbeholdes.",zF="©2023 Sesamy",DF="Vælg en adgangskode med en blanding af store og små bogstaver, tal og symboler.",RF="Indtast venligst en gyldig e-mailadresse.",PF="Adgangskoderne stemte ikke overens. Prøv igen.",BF="Vælg adgangskode",jF="Adgangskoden skal være mindst 8 tegn lang og indeholde mindst et lille bogstav, et stort bogstav, et tal og et symbol.",LF="Opret ny konto",FF="Tilmeld dig med adgangskode",UF="Du er i øjeblikket logget ind som <0>{{email}}</0>",MF="E-mail",qF="E-mail eller telefonnummer",VF="E-mail-adresse",HF="Din e-mailadresse er blevet valideret",KF="Indtast nu din adgangskode for at logge ind igen",GF="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.",WF="E-mail-bekræftelse sendt",XF="Indtast en kode",JF="Vi sender dig et bekræftelseslink for at sikre, at du ejer denne e-mailadresse.",YF="Indtast ny adgangskode",ZF="Indtast adgangskode",QF="Indtast din e-mailadresse og adgangskode for at logge ind.",eU="Indtast din adgangskode",tU="Det magiske link er udløbet. Klik på knappen nedenfor for at modtage et nyt link i din indbakke.",nU="Hej! Vi har opdateret vores login-oplevelse. <0>Klik her for at lære mere om det.</0>",rU="Send e-mail til nulstilling af adgangskode",iU="Klik på knappen nedenfor, så sender vi instruktioner om, hvordan du nulstiller din adgangskode.",oU="E-mail til nulstilling af adgangskode sendt",sU="Har du glemt din adgangskode?",aU="Har du glemt din adgangskode?",cU="Gå tilbage",lU="Skjul adgangskode",uU="Ugyldig adgangskode",dU="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.",pU="Ugyldigt link",fU="Klik på knappen for at logge ind",hU="Login",gU="Eller indtast koden på {{vendorName}} for at gennemføre login.",mU="Indtast din e-mailadresse for at låse op for dette show på {{service}}",_U="Forbind din konto med {{service}}",yU="Du er logget ind som",wU="Login",vU="Indtast din e-mailadresse for at logge ind.",bU="Indtast din e-mailadresse, så sender vi dig en login-kode.",xU="Indtast din e-mail eller dit telefonnummer for at logge ind",$U="Indtast din e-mailadresse, så sender vi dig et login-link.",AU="Indtast dit telefonnummer for at logge ind",kU="Indtast din {{authMethod}} for at logge ind.",EU="Log ud",SU="Nej, jeg vil bruge en anden konto",NU="eller",CU="Adgangskode",IU="Adgangskoden er blevet nulstillet",TU="Succes",OU="Skift adgangskode til din {{vendorName}} -konto",zU="Skift adgangskode til din {{vendorName}} -konto",DU="Telefonnummer",RU="Politik for beskyttelse af personlige oplysninger",PU="Omdirigering",BU="Bekræft adgangskode",jU="Registrer en ny adgangskode",LU="Send koden igen",FU="Skift adgangskode",UU="Indtast din nye adgangskode til e-mailkontoen nedenfor: ",MU="Klik på knappen for at nulstille din adgangskode",qU="Klik på knappen for at nulstille din adgangskode",VU="Nulstil din adgangskode",HU="Skift adgangskode til din {{vendorName}} -konto",KU="Nulstil adgangskode",GU="Send",WU="Send mig et nyt magisk link",XU="Husk at tjekke din spam-mappe, hvis e-mailen ikke er kommet frem.",JU="Indstil adgangskode",YU="Vis adgangskode",ZU="Log ind",QU="Tilmelding",eM="Tilmeld dig med succes",tM="{{code}} er din login-kode til {{vendorName}}",nM="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.",rM="Gå til Spotifys side for adgang til indhold",iM='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.',oM="Trin 1: Fjern forbindelsen til din Spotify-konto",sM="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.",aM="Trin 2: Relink din Spotify-konto til Sesamy",cM="Ups! Din Spotify-konto er allerede forbundet",lM="Hvis du har spørgsmål eller brug for hjælp, kan du kontakte vores supportteam",uM="Vilkår og betingelser",dM="Noget gik galt. Prøv venligst igen.",pM="Din e-mailadresse skal valideres. Vi har sendt en ny e-mail til din indbakke",fM="Brugerkontoen findes ikke",hM="Brugerkontoen findes ikke",gM="Vi kunne ikke finde en bruger med den angivne e-mailadresse. Prøv venligst igen.",mM="Prøv igen.",_M="Valider koden",yM="Tjek din indbakke for instruktioner om validering af e-mail.",wM="Tilmeldte sig",vM="Klik på knappen for at bekræfte din e-mailadresse",bM="Bekræft din e-mailadresse",xM="Bekræft din e-mailadresse",$M="Bekræft konto",AM="Bekræft din e-mail",kM="Tjek venligst din e-mail på <0>{{email}}</0> og indtast den sekscifrede kode, vi har sendt dig.",EM="Velkommen",SM="Velkommen til din {{vendorName}} konto!",NM="Fortsæt med denne konto",CM="Ja, fortsæt med {{text}}",IM="Ja, fortsæt med eksisterende konto",TM={"Server error: Invalid code":"Ugyldig kode",account_detected:aF,account_with_sso_provider:cF,agree_to:lF,and:uF,auth_method_email:dF,auth_method_email_or_phone:pF,auth_method_phone:fF,callback_url_mismatch:hF,callback_url_not_allowed:gF,check_email_title:mF,click_to_sign_up_description:_F,code_email_enter_code:yF,code_email_subject:wF,code_email_title:vF,code_expired:bF,code_invalid:xF,code_sent_template:$F,code_used:AF,code_valid_30_minutes:kF,confirm_password:EF,contact_support:SF,contact_us:NF,continue:"Fortsæt",continue_social_login:CF,continue_with:IF,continue_with_sso_provider_headline:TF,copyright:OF,copyright_sesamy:zF,create_account_description:DF,create_account_email_invalid:RF,create_account_passwords_didnt_match:PF,create_account_title:BF,create_account_weak_password:jF,create_new_account_link:LF,create_password_account_title:FF,currently_logged_in_as:UF,email:MF,email_or_phone_placeholder:qF,email_placeholder:VF,email_validated:HF,email_validated_cta:KF,email_verification_for_signup_sent_description:GF,email_verification_for_signup_sent_title:WF,enter_a_code_btn:XF,enter_email_for_verification_description:JF,enter_new_password_placeholder:YF,enter_password:ZF,enter_password_description:QF,enter_your_password_btn:eU,expired_code:tU,fokus_info_message:nU,forgot_password_cta:rU,forgot_password_description:iU,forgot_password_email_sent:oU,forgot_password_link:sU,forgot_password_title:aU,go_back:cU,hide_password:lU,"invalid-email":"Ugyldig e-mail",invalid_password:uU,invalid_session_body:dU,invalid_session_title:pU,link_email_click_to_login:fU,link_email_login:hU,link_email_or_enter_code:gU,link_page_body:mU,link_page_headline:_U,logged_in_as:yU,login:wU,login_description:vU,login_description_code:bU,login_description_combined:xU,login_description_link:$U,login_description_phone:AU,login_description_template:kU,logout:EU,no_use_another:SU,or:NU,password:CU,password_has_been_reset:IU,password_has_been_reset_title:TU,password_reset_subject:OU,password_reset_title:zU,phone_placeholder:DU,privacy_policy:RU,redirecting:PU,reenter_new_password_placeholder:BU,register_password_account:jU,resend_code:LU,reset_password_cta:FU,reset_password_description:UU,reset_password_email_click_to_reset:MU,reset_password_email_cta:qU,reset_password_email_reset:VU,reset_password_subject:HU,reset_password_title:KU,send:GU,send_me_a_new_magic_link:WU,sent_code_spam:XU,set_password:JU,show_password:YU,sign_in:ZU,signup:QU,signup_success:eM,sms_code_text:tM,spotify_already_linked_body:nM,spotify_already_linked_cta:rM,spotify_already_linked_step1_body:iM,spotify_already_linked_step1_title:oM,spotify_already_linked_step2_body:sM,spotify_already_linked_step2_title:aM,spotify_already_linked_title:cM,support_info:lM,terms:uM,unexpected_error_try_again:dM,unverified_email:pM,user_account_does_not_exist:fM,user_not_found:hM,user_not_found_body:gM,user_not_found_cta:mM,validate_code:_M,validate_email_body:yM,validate_email_title:wM,verify_email_click_to_verify:vM,verify_email_subject:bM,verify_email_title:xM,verify_email_verify:$M,verify_your_email:AM,we_sent_a_code_to:kM,welcome:EM,welcome_to_your_account:SM,yes_continue:NM,yes_continue_with:CM,yes_continue_with_existing_account:IM},OM=t=>{const{vendorSettings:e,authParams:n}=t,i=`/authorize?${new URLSearchParams({...n})}`;return A(dt,{vendorSettings:e,title:U.t("user_not_found"),children:A("div",{className:"flex flex-1 flex-col justify-center",children:[A("p",{className:"mb-8 text-gray-300 text-lg",children:U.t("user_not_found_body")}),A(at,{Component:"a",href:i,children:U.t("user_not_found_cta")})]})})};U.init({supportedLngs:["en","it","nb","sv","pl","cs","fi","da"],fallbackLng:"en",resources:{en:{translation:yE},it:{translation:q7},nb:{translation:hI},sv:{translation:LO},pl:{translation:uR},cs:{translation:RB},fi:{translation:sF},da:{translation:TM}}});function zM(t){const e=new s.OpenAPIHono;e.get("/",c=>c.json({name:"authhero"}));const n=W4(t);e.route("/api/v2",n);const r=p8(t);e.route("/",r);const i=C6(t);e.route("/u",i);const o=G9(t);return e.route("/samlp",o),{app:e,managementApp:n,oauthApp:r,samlApp:o,universalApp:i,createX509Certificate:Nd}}exports.AppLogo=E_;exports.Auth0Client=km;exports.AuthorizationResponseMode=Pn;exports.AuthorizationResponseType=xt;exports.Button=at;exports.CheckEmailPage=q_;exports.CodeChallengeMethod=lc;exports.ComponentCategory=Gd;exports.ComponentType=Kd;exports.EmailValidatedPage=K_;exports.EnterCodePage=Fd;exports.EnterPasswordPage=ho;exports.ErrorMessage=oi;exports.Footer=S_;exports.ForgotPasswordPage=U_;exports.ForgotPasswordSentPage=M_;exports.FormComponent=Jn;exports.GoBack=ln;exports.GoogleLogo=I_;exports.GrantType=wi;exports.Icon=st;exports.IdentifierPage=ea;exports.InvalidSession=H_;exports.Layout=dt;exports.LogTypes=Fe;exports.Message=yr;exports.NodeType=cm;exports.PreSignUpConfirmationPage=G_;exports.PreSignUpPage=V_;exports.ResetPasswordPage=mi;exports.SignUpPage=Cr;exports.SocialButton=po;exports.Spinner=C_;exports.Trans=ml;exports.UnverifiedEmailPage=F_;exports.UserNotFoundPage=OM;exports.VippsLogo=T_;exports.applicationInsertSchema=ca;exports.applicationSchema=Or;exports.auth0FlowInsertSchema=nw;exports.auth0FlowSchema=gm;exports.auth0UserResponseSchema=_n;exports.authParamsSchema=$o;exports.baseUserSchema=ac;exports.bordersSchema=Cm;exports.brandingSchema=ru;exports.buttonComponentSchema=rm;exports.codeInsertSchema=ym;exports.codeSchema=rw;exports.codeTypeSchema=_m;exports.colorsSchema=Im;exports.componentSchema=am;exports.connectionInsertSchema=la;exports.connectionOptionsSchema=Wd;exports.connectionSchema=or;exports.coordinatesSchema=Vi;exports.customDomainInsertSchema=Xd;exports.customDomainSchema=ir;exports.customDomainWithTenantIdSchema=iw;exports.emailProviderSchema=Ms;exports.endingSchema=hm;exports.fieldComponentSchema=om;exports.flowNodeSchema=um;exports.fontDetailsSchema=Nr;exports.fontsSchema=Tm;exports.formControlSchema=ow;exports.formInsertSchema=da;exports.formNodeComponentDefinition=vm;exports.formSchema=_i;exports.genericComponentSchema=sm;exports.genericNodeSchema=dm;exports.hookInsertSchema=Fs;exports.hookSchema=yi;exports.identitySchema=em;exports.init=zM;exports.injectTailwindCSS=$6;exports.jwksKeySchema=$m;exports.jwksSchema=Jd;exports.legalComponentSchema=im;exports.logSchema=pa;exports.loginSessionInsertSchema=Am;exports.loginSessionSchema=uw;exports.nodeSchema=pm;exports.openIDConfigurationSchema=iu;exports.pageBackgroundSchema=Om;exports.parseUserId=_w;exports.passwordInsertSchema=Em;exports.passwordSchema=pw;exports.profileDataSchema=Qg;exports.promptSettingSchema=Us;exports.refreshTokenInsertSchema=Zd;exports.refreshTokenSchema=hw;exports.richTextComponentSchema=nm;exports.samlpAddon=tm;exports.sessionInsertSchema=Nm;exports.sessionSchema=dc;exports.signingKeySchema=ou;exports.smsProviderSchema=mw;exports.smsSendParamsSchema=gw;exports.startSchema=fm;exports.stepNodeSchema=lm;exports.tailwindCss=yf;exports.tenantInsertSchema=ua;exports.tenantSchema=xi;exports.themeInsertSchema=Dm;exports.themeSchema=fw;exports.tokenResponseSchema=Yd;exports.totalsSchema=Kn;exports.userInsertSchema=aa;exports.userResponseSchema=Qy;exports.userSchema=Hd;exports.vendorSettingsSchema=mm;exports.verificationMethodsSchema=wm;exports.widgetSchema=zm;