authhero 0.170.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 +2 -2
- package/dist/authhero.d.ts +3 -0
- package/dist/authhero.mjs +31 -27
- package/package.json +3 -3
package/dist/authhero.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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()}),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){/**
|
|
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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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
|
|
@@ -221,7 +221,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
221
221
|
<\/script>
|
|
222
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(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"),{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 p_(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&&$_(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([`
|
|
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");
|
package/dist/authhero.d.ts
CHANGED
|
@@ -12289,6 +12289,7 @@ export declare const vendorSettingsSchema: z.ZodObject<{
|
|
|
12289
12289
|
buttonTextColor: string;
|
|
12290
12290
|
primaryHoverColor: string;
|
|
12291
12291
|
}>;
|
|
12292
|
+
country: z.ZodOptional<z.ZodString>;
|
|
12292
12293
|
supportEmail: z.ZodNullable<z.ZodString>;
|
|
12293
12294
|
supportUrl: z.ZodNullable<z.ZodString>;
|
|
12294
12295
|
name: z.ZodString;
|
|
@@ -12311,6 +12312,7 @@ export declare const vendorSettingsSchema: z.ZodObject<{
|
|
|
12311
12312
|
termsAndConditionsUrl: string | null;
|
|
12312
12313
|
siteUrl: string | null;
|
|
12313
12314
|
loginBackgroundImage?: string | null | undefined;
|
|
12315
|
+
country?: string | undefined;
|
|
12314
12316
|
showGreyishBackground?: boolean | undefined;
|
|
12315
12317
|
companyName?: string | undefined;
|
|
12316
12318
|
checkoutHideSocial?: boolean | undefined;
|
|
@@ -12328,6 +12330,7 @@ export declare const vendorSettingsSchema: z.ZodObject<{
|
|
|
12328
12330
|
termsAndConditionsUrl: string | null;
|
|
12329
12331
|
siteUrl: string | null;
|
|
12330
12332
|
loginBackgroundImage?: string | null | undefined;
|
|
12333
|
+
country?: string | undefined;
|
|
12331
12334
|
showGreyishBackground?: boolean | undefined;
|
|
12332
12335
|
companyName?: string | undefined;
|
|
12333
12336
|
checkoutHideSocial?: boolean | undefined;
|
package/dist/authhero.mjs
CHANGED
|
@@ -1811,6 +1811,7 @@ const ia = a.object({
|
|
|
1811
1811
|
buttonTextColor: a.string(),
|
|
1812
1812
|
primaryHoverColor: a.string()
|
|
1813
1813
|
}),
|
|
1814
|
+
country: a.string().optional(),
|
|
1814
1815
|
supportEmail: a.string().nullable(),
|
|
1815
1816
|
supportUrl: a.string().nullable(),
|
|
1816
1817
|
name: a.string(),
|
|
@@ -24346,8 +24347,11 @@ const g8 = (t) => {
|
|
|
24346
24347
|
n
|
|
24347
24348
|
);
|
|
24348
24349
|
t.set("client_id", i.id);
|
|
24349
|
-
const l = t.get("countryCode"), { normalized:
|
|
24350
|
-
|
|
24350
|
+
const l = t.get("countryCode"), u = c.country, { normalized: d, connectionType: f } = il(
|
|
24351
|
+
r.username,
|
|
24352
|
+
u || l
|
|
24353
|
+
);
|
|
24354
|
+
if (!d)
|
|
24351
24355
|
return t.html(
|
|
24352
24356
|
/* @__PURE__ */ A(
|
|
24353
24357
|
Bl,
|
|
@@ -24361,21 +24365,21 @@ const g8 = (t) => {
|
|
|
24361
24365
|
),
|
|
24362
24366
|
400
|
|
24363
24367
|
);
|
|
24364
|
-
const
|
|
24368
|
+
const h = await xo({
|
|
24365
24369
|
userAdapter: e.data.users,
|
|
24366
24370
|
tenant_id: i.tenant.id,
|
|
24367
|
-
username:
|
|
24368
|
-
provider:
|
|
24371
|
+
username: d,
|
|
24372
|
+
provider: f
|
|
24369
24373
|
});
|
|
24370
|
-
if (
|
|
24374
|
+
if (h && t.set("user_id", h.user_id), !h)
|
|
24371
24375
|
try {
|
|
24372
|
-
await Zv(t, i, t.env.data,
|
|
24376
|
+
await Zv(t, i, t.env.data, d);
|
|
24373
24377
|
} catch {
|
|
24374
|
-
const
|
|
24378
|
+
const S = He(t, {
|
|
24375
24379
|
type: qe.FAILED_SIGNUP,
|
|
24376
24380
|
description: "Public signup is disabled"
|
|
24377
24381
|
});
|
|
24378
|
-
return Lt(t, t.env.data.logs.create(i.tenant.id,
|
|
24382
|
+
return Lt(t, t.env.data.logs.create(i.tenant.id, S)), t.html(
|
|
24379
24383
|
/* @__PURE__ */ A(
|
|
24380
24384
|
Bl,
|
|
24381
24385
|
{
|
|
@@ -24389,7 +24393,7 @@ const g8 = (t) => {
|
|
|
24389
24393
|
400
|
|
24390
24394
|
);
|
|
24391
24395
|
}
|
|
24392
|
-
if (o.authParams.username =
|
|
24396
|
+
if (o.authParams.username = d, await e.data.loginSessions.update(
|
|
24393
24397
|
i.tenant.id,
|
|
24394
24398
|
o.id,
|
|
24395
24399
|
o
|
|
@@ -24400,40 +24404,40 @@ const g8 = (t) => {
|
|
|
24400
24404
|
r.login_selection
|
|
24401
24405
|
))
|
|
24402
24406
|
return t.redirect(`/u/enter-password?state=${n}`);
|
|
24403
|
-
let
|
|
24407
|
+
let _ = Xr(), $ = await e.data.codes.get(
|
|
24404
24408
|
i.tenant.id,
|
|
24405
|
-
|
|
24409
|
+
_,
|
|
24406
24410
|
"otp"
|
|
24407
24411
|
);
|
|
24408
|
-
for (;
|
|
24409
|
-
|
|
24412
|
+
for (; $; )
|
|
24413
|
+
_ = Xr(), $ = await e.data.codes.get(
|
|
24410
24414
|
i.tenant.id,
|
|
24411
|
-
|
|
24415
|
+
_,
|
|
24412
24416
|
"otp"
|
|
24413
24417
|
);
|
|
24414
|
-
const
|
|
24415
|
-
code_id:
|
|
24418
|
+
const m = await t.env.data.codes.create(i.tenant.id, {
|
|
24419
|
+
code_id: _,
|
|
24416
24420
|
code_type: "otp",
|
|
24417
24421
|
login_id: o.id,
|
|
24418
24422
|
expires_at: new Date(Date.now() + Ms).toISOString(),
|
|
24419
24423
|
redirect_uri: o.authParams.redirect_uri
|
|
24420
|
-
}),
|
|
24421
|
-
(
|
|
24424
|
+
}), x = i.connections.find(
|
|
24425
|
+
(S) => S.strategy === f
|
|
24422
24426
|
);
|
|
24423
|
-
if (!
|
|
24427
|
+
if (!x)
|
|
24424
24428
|
throw new P(400, {
|
|
24425
24429
|
message: M.t("connection_not_found", {
|
|
24426
|
-
connection:
|
|
24430
|
+
connection: f
|
|
24427
24431
|
})
|
|
24428
24432
|
});
|
|
24429
|
-
return
|
|
24430
|
-
|
|
24431
|
-
to:
|
|
24432
|
-
code:
|
|
24433
|
+
return f === "email" && // This is different to how it works in auth0
|
|
24434
|
+
x.options.authentication_method === "magic_link" ? await Zp(t, {
|
|
24435
|
+
to: d,
|
|
24436
|
+
code: m.code_id,
|
|
24433
24437
|
authParams: o.authParams
|
|
24434
24438
|
}) : await R1(t, {
|
|
24435
|
-
to:
|
|
24436
|
-
code:
|
|
24439
|
+
to: d,
|
|
24440
|
+
code: m.code_id
|
|
24437
24441
|
}), t.redirect(`/u/enter-code?state=${n}`);
|
|
24438
24442
|
}
|
|
24439
24443
|
), An = (t) => /* @__PURE__ */ A(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authhero",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.171.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vite": "^5.4.11",
|
|
37
37
|
"vite-plugin-dts": "^4.3.0",
|
|
38
38
|
"vitest": "^2.1.5",
|
|
39
|
-
"@authhero/kysely-adapter": "^10.
|
|
39
|
+
"@authhero/kysely-adapter": "^10.25.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@peculiar/x509": "^1.12.3",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"nanoid": "^5.0.8",
|
|
51
51
|
"oslo": "^1.2.1",
|
|
52
52
|
"xml-crypto": "^6.1.2",
|
|
53
|
-
"@authhero/adapter-interfaces": "^0.
|
|
53
|
+
"@authhero/adapter-interfaces": "^0.73.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@hono/zod-openapi": "^0.19.2",
|