authhero 0.179.0 → 0.180.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/authhero.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var cw=Object.defineProperty;var lw=(t,e,n)=>e in t?cw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xe=(t,e,n)=>lw(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@hono/zod-openapi"),Ee=t=>typeof t=="string",ao=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},qf=t=>t==null?"":""+t,uw=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},dw=/###/g,Vf=t=>t&&t.indexOf("###")>-1?t.replace(dw,"."):t,Hf=t=>!t||Ee(t),_o=(t,e,n)=>{const r=Ee(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(Hf(t))return{};const o=Vf(r[i]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++i}return Hf(t)?{}:{obj:t,k:Vf(r[i])}},Kf=(t,e,n)=>{const{obj:r,k:i}=_o(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=_o(t,c,Object);for(;l.obj===void 0&&c.length;)o=`${c[c.length-1]}.${o}`,c=c.slice(0,c.length-1),l=_o(t,c,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},pw=(t,e,n,r)=>{const{obj:i,k:o}=_o(t,e,Object);i[o]=i[o]||[],i[o].push(n)},la=(t,e)=>{const{obj:n,k:r}=_o(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},fw=(t,e,n)=>{const r=la(t,n);return r!==void 0?r:la(e,n)},fm=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?Ee(t[r])||t[r]instanceof String||Ee(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):fm(t[r],e[r],n):t[r]=e[r]);return t},si=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var hw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const gw=t=>Ee(t)?t.replace(/[&<>"'\/]/g,e=>hw[e]):t;class mw{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 _w=[" ",",","?","!",";"],yw=new mw(20),ww=(t,e,n)=>{e=e||"",n=n||"";const r=_w.filter(c=>e.indexOf(c)<0&&n.indexOf(c)<0);if(r.length===0)return!0;const i=yw.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},cu=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},ua=t=>t==null?void 0:t.replace("_","-"),vw={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 da{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||vw,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,i){return i&&!this.debug?null:(Ee(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new da(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new da(this.logger,e)}}var yn=new da;class uc{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 Gf extends uc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){var d,p;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const 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):Ee(r)&&o?l.push(...r.split(o)):l.push(r)));const u=la(this.data,l);return!u&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),u||!c||!Ee(r)?u:cu((p=(d=this.data)==null?void 0:d[e])==null?void 0:p[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),Kf(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)(Ee(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=la(this.data,l)||{};c.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?fm(u,r,o):u={...u,...r},Kf(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 hm={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 Wf={};class pa extends uc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),uw(["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&&!ww(e,r,i);if(c&&!l){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:Ee(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:Ee(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,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(p){const M=n.nsSeparator||this.options.nsSeparator;return i?{res:`${u}${M}${c}`,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${M}${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 g=h==null?void 0:h.res;const A=(h==null?void 0:h.usedKey)||c,_=(h==null?void 0:h.exactUsedKey)||c,$=Object.prototype.toString.apply(g),S=["[object Number]","[object Function]","[object RegExp]"],k=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,T=!Ee(g)&&typeof g!="boolean"&&typeof g!="number";if(b&&g&&T&&S.indexOf($)<0&&!(Ee(k)&&Array.isArray(g))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(A,g,{...n,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(h.res=M,h.usedParams=this.getUsedParamsDetails(n),h):M}if(o){const M=Array.isArray(g),U=M?[]:{},H=M?_:A;for(const W in g)if(Object.prototype.hasOwnProperty.call(g,W)){const J=`${H}${o}${W}`;U[W]=this.translate(J,{...n,joinArrays:!1,ns:l}),U[W]===J&&(U[W]=g[W])}g=U}}else if(b&&Ee(k)&&Array.isArray(g))g=g.join(k),g&&(g=this.extendTranslation(g,e,n,r));else{let M=!1,U=!1;const H=n.count!==void 0&&!Ee(n.count),W=pa.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(g)&&W&&(M=!0,g=B),this.isValidLookup(g)||(U=!0,g=c);const P=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&U?void 0:g,I=W&&B!==g&&this.options.updateMissing;if(U||M||I){if(this.logger.log(I?"updateKey":"missingKey",d,u,c,I?B:g),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 Se=W&&ve!==g?ve:P;this.options.missingKeyHandler?this.options.missingKeyHandler(de,u,ne,Se,I,n):(Z=this.backendConnector)!=null&&Z.saveMissing&&this.backendConnector.saveMissing(de,u,ne,Se,I,n),this.emit("missingKey",de,u,ne,g)};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))}g=this.extendTranslation(g,e,n,h,r),U&&g===c&&this.options.appendNamespaceToMissingKey&&(g=`${u}:${c}`),(U||M)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${c}`:c,M?g:void 0))}return i?(h.res=g,h.usedParams=this.getUsedParamsDetails(n),h):g}extendTranslation(e,n,r,i,o){var d,p;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=Ee(e)&&(((p=r==null?void 0:r.interpolation)==null?void 0:p.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let g;if(h){const _=e.match(this.interpolator.nestingRegexp);g=_&&_.length}let A=r.replace&&!Ee(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(A={...this.options.interpolation.defaultVariables,...A}),e=this.interpolator.interpolate(e,A,r.lng||this.language||i.usedLng,r),h){const _=e.match(this.interpolator.nestingRegexp),$=_&&_.length;g<$&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var _=arguments.length,$=new Array(_),S=0;S<_;S++)$[S]=arguments[S];return(o==null?void 0:o[0])===$[0]&&!r.context?(c.logger.warn(`It seems you are nesting recursively key: ${$[0]} in key: ${n[0]}`),null):c.translate(...$,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=Ee(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=hm.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 Ee(e)&&(e=[e]),e.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),p=d.key;i=p;let h=d.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const g=n.count!==void 0&&!Ee(n.count),A=g&&!n.ordinal&&n.count===0,_=n.context!==void 0&&(Ee(n.context)||typeof n.context=="number")&&n.context!=="",$=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(S=>{var k,b;this.isValidLookup(r)||(l=S,!Wf[`${$[0]}-${S}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((b=this.utils)!=null&&b.hasLoadedNamespace(l))&&(Wf[`${$[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${$.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!!!")),$.forEach(T=>{var H;if(this.isValidLookup(r))return;c=T;const M=[p];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(M,p,T,S,n);else{let W;g&&(W=this.pluralResolver.getSuffix(T,n.count,n));const J=`${this.options.pluralSeparator}zero`,ue=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(M.push(p+W),n.ordinal&&W.indexOf(ue)===0&&M.push(p+W.replace(ue,this.options.pluralSeparator)),A&&M.push(p+J)),_){const Ne=`${p}${this.options.contextSeparator}${n.context}`;M.push(Ne),g&&(M.push(Ne+W),n.ordinal&&W.indexOf(ue)===0&&M.push(Ne+W.replace(ue,this.options.pluralSeparator)),A&&M.push(Ne+J))}}let U;for(;U=M.pop();)this.isValidLookup(r)||(o=U,r=this.getResource(T,S,U,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&&!Ee(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const 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 Xf{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=yn.create("languageUtils")}getScriptPartFromCode(e){if(e=ua(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=ua(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ee(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(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)),Ee(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return Ee(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))):Ee(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},Yf={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class bw{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=ua(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!"),Yf;if(!e.match(/-|_/))return Yf;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 Zf=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=fw(t,e,n);return!o&&i&&Ee(n)&&(o=cu(t,n,r),o===void 0&&(o=cu(e,n,r))),o},Il=t=>t.replace(/\$/g,"$$$$");class xw{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:p,unescapePrefix:h,nestingPrefix:g,nestingPrefixEscaped:A,nestingSuffix:_,nestingSuffixEscaped:$,nestingOptionsSeparator:S,maxReplaces:k,alwaysFormat:b}=e.interpolation;this.escape=n!==void 0?n:gw,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=p?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=g?si(g):A||si("$t("),this.nestingSuffix=_?si(_):$||si(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=k||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,r,i){var A;let o,c,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=_=>{if(_.indexOf(this.formatSeparator)<0){const b=Zf(n,u,_,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...i,...n,interpolationkey:_}):b}const $=_.split(this.formatSeparator),S=$.shift().trim(),k=$.join(this.formatSeparator).trim();return this.format(Zf(n,u,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...i,...n,interpolationkey:S})};this.resetRegExp();const p=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((A=i==null?void 0:i.interpolation)==null?void 0:A.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:_=>Il(_)},{regex:this.regexp,safeValue:_=>this.escapeValue?Il(this.escape(_)):Il(_)}].forEach(_=>{for(l=0;o=_.regex.exec(e);){const $=o[1].trim();if(c=d($),c===void 0)if(typeof p=="function"){const k=p(e,o,i);c=Ee(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,$))c="";else if(h){c=o[0];continue}else this.logger.warn(`missed to pass in variable ${$} for interpolating ${e}`),c="";else!Ee(c)&&!this.useRawValueToEscape&&(c=qf(c));const S=_.safeValue(c);if(e=e.replace(o[0],S),h?(_.regex.lastIndex+=c.length,_.regex.lastIndex-=o[0].length):_.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,c;const l=(u,d)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const h=u.split(new RegExp(`${p}[ ]*{`));let g=`{${h[1]}`;u=h[0],g=this.interpolate(g,c);const A=g.match(/'/g),_=g.match(/"/g);(((A==null?void 0:A.length)??0)%2===0&&!_||_.length%2!==0)&&(g=g.replace(/'/g,'"'));try{c=JSON.parse(g),d&&(c={...d,...c})}catch($){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,$),`${u}${p}${g}`}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&&!Ee(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 p=i[1].split(this.formatSeparator).map(h=>h.trim());i[1]=p.shift(),u=p,d=!0}if(o=n(l.call(this,i[1].trim(),c),c),o&&i[0]===e&&!Ee(o))return o;Ee(o)||(o=qf(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),d&&(o=u.reduce((p,h)=>this.format(p,h,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const $w=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,""),p=l.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},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(ua(r),i),e[c]=l),l(n)}};class Aw{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:p}=$w(u);if(this.formats[d]){let g=l;try{const A=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},_=A.locale||A.lng||i.locale||i.lng||r;g=this.formats[d](l,_,{...p,...i,...A})}catch(A){this.logger.warn(A)}return g}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Ew=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Sw extends uc{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 p=!0;n.forEach(h=>{const g=`${d}|${h}`;!r.reload&&this.store.hasResourceBundle(d,h)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?c[g]===void 0&&(c[g]=!0):(this.state[g]=1,p=!1,c[g]===void 0&&(c[g]=!0),o[g]===void 0&&(o[g]=!0),u[h]===void 0&&(u[h]=!0)))}),p||(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=>{pw(u.loaded,[o],c),Ew(u,e),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const p=u.loaded[d];p.length&&p.forEach(h=>{l[d][h]===void 0&&(l[d][h]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(u=>!u.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,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,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(d&&p&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,o*2,c)},o);return}c(d,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(e,n);d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}return}return u(e,n,l)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Ee(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ee(n)&&(n=[n]);const 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,p,h,g;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=(p=this.services)==null?void 0:p.utils)!=null&&h.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((g=this.backend)!=null&&g.create){const A={...c,isUpdate:o},_=this.backend.create.bind(this.backend);if(_.length<6)try{let $;_.length===5?$=_(e,n,r,i,A):$=_(e,n,r,i),$&&typeof $.then=="function"?$.then(S=>l(null,S)).catch(l):l(null,$)}catch($){l($)}else _(e,n,r,i,l,A)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const Qf=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Ee(t[1])&&(e.defaultValue=t[1]),Ee(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),e0=t=>{var e,n;return Ee(t.ns)&&(t.ns=[t.ns]),Ee(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ee(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Os=()=>{},kw=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Ao extends uc{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=e0(e),this.services={},this.logger=yn,this.modules={external:[]},kw(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(Ee(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Qf();this.options={...i,...this.options,...e0(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=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?yn.init(o(this.modules.logger),this.options):yn.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Aw;const h=new Xf(this.options);this.store=new Gf(this.options.resources,this.options);const g=this.services;g.logger=yn,g.resourceStore=this.store,g.languageUtils=h,g.pluralResolver=new bw(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(g.formatter=o(p),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new xw(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new Sw(o(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(A){for(var _=arguments.length,$=new Array(_>1?_-1:0),S=1;S<_;S++)$[S-1]=arguments[S];e.emit(A,...$)}),this.modules.languageDetector&&(g.languageDetector=o(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=o(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new pa(this.services,this.options),this.translator.on("*",function(A){for(var _=arguments.length,$=new Array(_>1?_-1:0),S=1;S<_;S++)$[S-1]=arguments[S];e.emit(A,...$)}),this.modules.external.forEach(A=>{A.init&&A.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Os),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const u=ao(),d=()=>{const p=(h,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),u.resolve(g),r(h,g)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e){var o,c;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Os;const i=Ee(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],u=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(h=>{h!=="cimode"&&l.indexOf(h)<0&&l.push(h)})};i?u(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>u(p)),(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=ao();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=Os),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"&&hm.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=ao();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 p,h;!e&&!u&&this.services.languageDetector&&(u=[]);const d=Ee(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||o(d),this.translator.language||this.translator.changeLanguage(d),(h=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||h.call(p,d)),this.loadResources(d,g=>{c(g,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),i}getFixedT(e,n,r){var i=this;const o=function(c,l){let u;if(typeof l!="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),h=2;h<d;h++)p[h-2]=arguments[h];u=i.options.overloadTranslationOptionHandler([c,l].concat(p))}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 g=i.options.keySeparator||".";let A;return u.keyPrefix&&Array.isArray(c)?A=c.map(_=>`${u.keyPrefix}${g}${_}`):A=u.keyPrefix?`${u.keyPrefix}${g}${c}`:c,i.t(A,u)};return Ee(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=ao();return this.options.ns?(Ee(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=ao();Ee(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 Xf(Qf());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 Ao(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Os;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new Ao(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((p,h)=>(p[h]={...u[d][h]},p),{})),{});o.store=new Gf(l,i),o.services.resourceStore=o.store}return o.translator=new pa(o.services,i),o.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p<u;p++)d[p-1]=arguments[p];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 F=Ao.createInstance();F.createInstance=Ao.createInstance;F.createInstance;F.dir;F.init;F.loadResources;F.reloadResources;F.use;F.changeLanguage;F.getFixedT;const $e=F.t;F.exists;F.setDefaultNamespace;F.hasLoadedNamespace;F.loadNamespaces;F.loadLanguages;var gm=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(o=>typeof o=="string"?o==="*"?()=>o:c=>o===c?c:null:typeof o=="function"?o:c=>o.includes(c)?c:null)(n.origin),i=(o=>typeof o=="function"?o:Array.isArray(o)?()=>o:()=>[])(n.allowMethods);return async function(c,l){var p;function u(h,g){c.res.headers.set(h,g)}const d=r(c.req.header("origin")||"",c);if(d&&u("Access-Control-Allow-Origin",d),n.origin!=="*"){const h=c.req.header("Vary");h?u("Vary",h):u("Vary","Origin")}if(n.credentials&&u("Access-Control-Allow-Credentials","true"),(p=n.exposeHeaders)!=null&&p.length&&u("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),c.req.method==="OPTIONS"){n.maxAge!=null&&u("Access-Control-Max-Age",n.maxAge.toString());const h=i(c.req.header("origin")||"",c);h.length&&u("Access-Control-Allow-Methods",h.join(","));let g=n.allowHeaders;if(!(g!=null&&g.length)){const A=c.req.header("Access-Control-Request-Headers");A&&(g=A.split(/\s*,\s*/))}return g!=null&&g.length&&(u("Access-Control-Allow-Headers",g.join(",")),c.res.headers.append("Vary","Access-Control-Request-Headers")),c.res.headers.delete("Content-Length"),c.res.headers.delete("Content-Type"),new Response(null,{headers:c.res.headers,status:204,statusText:"No Content"})}await l()}};const Wn=s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()}),dc=s.z.object({created_at:s.z.string(),updated_at:s.z.string()}),mm=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()),_m=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:mm.optional()}),pc=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()}),fa=pc.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()}),ep=s.z.object({...fa.shape,...dc.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(_m).optional()}),_n=ep,Nw=pc.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()),Cw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Iw=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Cw[n[t]&63];return e};const ym=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()}),ha=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:ym.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(()=>Iw()).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"})}),zr=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ha.shape}),Hi=s.z.object({x:s.z.number(),y:s.z.number()});var tp=(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))(tp||{}),np=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(np||{});const fc=s.z.object({id:s.z.string(),category:s.z.nativeEnum(np),type:s.z.nativeEnum(tp)}),wm=fc.extend({category:s.z.literal("BLOCK"),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}).passthrough()}),vm=fc.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()}),bm=fc.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()}),xm=fc.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()}),$m=s.z.object({id:s.z.string(),category:s.z.string(),type:s.z.string()}).passthrough(),Am=s.z.union([wm,vm,bm,xm,$m]);var Em=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(Em||{});const Sm=s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:Hi,alias:s.z.string().optional(),config:s.z.object({components:s.z.array(Am),next_node:s.z.string()}).passthrough()}),km=s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:Hi,alias:s.z.string().optional(),config:s.z.object({flow_id:s.z.string(),next_node:s.z.string()})}),Nm=s.z.object({id:s.z.string(),type:s.z.string(),coordinates:Hi}).passthrough(),Cm=s.z.union([Sm,km,Nm]),Im=s.z.object({next_node:s.z.string(),coordinates:Hi}).passthrough(),Tm=s.z.object({resume_flow:s.z.boolean().optional(),coordinates:Hi}).passthrough(),Om=s.z.object({id:s.z.string(),name:s.z.string(),languages:s.z.object({primary:s.z.string()}).passthrough(),nodes:s.z.array(Cm),start:Im,ending:Tm,created_at:s.z.string(),updated_at:s.z.string(),links:s.z.object({sdkSrc:s.z.string().optional(),sdk_src:s.z.string().optional()}).passthrough()}).passthrough(),Tw=Om.omit({id:!0,created_at:!0,updated_at:!0});var tn=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(tn||{}),vn=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(vn||{}),hc=(t=>(t.S256="S256",t.Plain="plain",t))(hc||{});const Eo=s.z.object({client_id:s.z.string(),act_as:s.z.string().optional(),response_type:s.z.nativeEnum(tn).optional(),response_mode:s.z.nativeEnum(vn).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(hc).optional(),code_challenge:s.z.string().optional(),username:s.z.string().optional(),ui_locales:s.z.string().optional(),vendor_id:s.z.string().optional()}),lu=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()}),rp=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()}),ga=s.z.object({id:s.z.string().optional(),name:s.z.string(),strategy:s.z.string(),options:rp.default({}),enabled_clients:s.z.array(s.z.string()).default([]).optional(),response_type:s.z.custom().optional(),response_mode:s.z.custom().optional()}),ar=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(ga.shape),ma=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),...ma.shape,id:s.z.string()}),Dm=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({...zr.shape,tenant:xi,connections:s.z.array(ar)});const zm=s.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),Rm=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:zm,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()}),Ow=s.z.object({...Rm.shape,created_at:s.z.string()}),ip=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()}),Pm=s.z.object({name:s.z.literal("txt"),record:s.z.string(),domain:s.z.string()}),sr=s.z.object({...ip.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(Pm)}).optional(),tls_policy:s.z.string().optional()}),Dw=sr.extend({tenant_id:s.z.string()}),zw=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()}),Bm=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)})]),_a=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(Bm),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({...dc.shape,..._a.shape,id:s.z.string()}),jm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Lm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),gc={enabled:s.z.boolean().default(!1),synchronous:s.z.boolean().default(!1),priority:s.z.number().optional(),hook_id:s.z.string().optional()},Rw=s.z.object({...gc,trigger_id:jm,url:s.z.string()}),Pw=s.z.object({...gc,trigger_id:Lm,form_id:s.z.string()}),Vs=s.z.union([Rw,Pw]),Bw=s.z.object({...gc,trigger_id:jm,...dc.shape,hook_id:s.z.string(),url:s.z.string()}),jw=s.z.object({...gc,trigger_id:Lm,...dc.shape,hook_id:s.z.string(),form_id:s.z.string()}),yi=s.z.union([Bw,jw]),op=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()}),Fm=s.z.object({keys:s.z.array(op)}),uu=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())}),Um=s.z.object({csrf_token:s.z.string(),auth0Client:s.z.string().optional(),authParams:Eo,expires_at:s.z.string(),deleted_at:s.z.string().optional(),ip:s.z.string().optional(),useragent:s.z.string().optional(),session_id:s.z.string().optional(),authorization_url:s.z.string().optional(),login_completed:s.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),Lw=s.z.object({...Um.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()}),Le={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},Fw=s.z.string().refine(t=>Object.values(Le).includes(t),{message:"Invalid log type"}),Mm=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()}),ya=s.z.object({type:Fw,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:Mm.optional()}),qm=s.z.object({user_id:s.z.string(),password:s.z.string(),algorithm:s.z.enum(["bcrypt","argon2id"]).default("argon2id")}),Uw=s.z.object({...qm.shape,created_at:s.z.string(),updated_at:s.z.string()}),Vm=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")}),Hm=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:Vm.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")}),mc=s.z.object({created_at:s.z.string(),updated_at:s.z.string(),authenticated_at:s.z.string(),last_interaction_at:s.z.string(),...Hm.shape}),du=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 sp=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 Km=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()}),Gm=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()}),Ir=s.z.object({bold:s.z.boolean(),size:s.z.number()}),Wm=s.z.object({body_text:Ir,buttons_text:Ir,font_url:s.z.string(),input_labels:Ir,links:Ir,links_style:s.z.enum(["normal"]),reference_text_size:s.z.number(),subtitle:Ir,title:Ir}),Xm=s.z.object({background_color:s.z.string(),background_image_url:s.z.string(),page_layout:s.z.enum(["center"])}),Jm=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"])}),Ym=s.z.object({borders:Km,colors:Gm,displayName:s.z.string(),fonts:Wm,page_background:Xm,widget:Jm}),Hs=Ym.extend({themeId:s.z.string()}),Ks=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()}),Gs=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()}),ap=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:Vm,resource_servers:s.z.array(s.z.object({audience:s.z.string(),scopes:s.z.string()})),rotating:s.z.boolean()}),Mw=s.z.object({created_at:s.z.string(),...ap.shape}),qw=s.z.object({to:s.z.string(),message:s.z.string()}),Vw=s.z.object({name:s.z.string(),options:s.z.object({})});function Hw(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const t0={themeId:"default",borders:{button_border_radius:8,button_border_weight:1,buttons_style:"pill",input_border_radius:8,input_border_weight:1,inputs_style:"pill",show_widget_shadow:!0,widget_border_weight:1,widget_corner_radius:16},colors:{base_focus_color:"#7D68F4",base_hover_color:"#A091F2",body_text:"#000000",captcha_widget_theme:"auto",error:"#FC5A5A",header:"#000000",icons:"#666666",input_background:"#FFFFFF",input_border:"#BFBCD7",input_filled_text:"#000000",input_labels_placeholders:"#88869F",links_focused_components:"#7D68F4",primary_button:"#7D68F4",primary_button_label:"#FFFFFF",secondary_button_border:"#BFBCD7",secondary_button_label:"#000000",success:"#36BF76",widget_background:"#FFFFFF",widget_border:"#BFBCD7"},displayName:"Default Theme",fonts:{body_text:{bold:!1,size:16},buttons_text:{bold:!1,size:16},font_url:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",input_labels:{bold:!1,size:14},links:{bold:!1,size:16},links_style:"normal",reference_text_size:16,subtitle:{bold:!1,size:18},title:{bold:!0,size:24}},page_background:{background_color:"#F8F9FB",background_image_url:"https://assets.sesamy.com/images/login-bg.jpg",page_layout:"center"},widget:{header_text_alignment:"center",logo_height:36,logo_position:"center",logo_url:"https://assets.sesamy.com/images/sesamy-logo.svg",social_buttons_layout:"bottom"}};function n0(t,e){const n=structuredClone(t);function r(i,o){for(const c in o)o[c]!==void 0&&typeof o[c]=="object"&&!Array.isArray(o[c])&&typeof i[c]=="object"&&i[c]!==null?r(i[c],o[c]):i[c]=o[c];return i}return r(n,e)}const Kw=new s.OpenAPIHono().openapi(s.createRoute({tags:["branding"],method:"get",path:"/default",request:{headers:s.z.object({"tenant-id":s.z.string().optional()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Hs}},description:"Default theme settings"}}}),async t=>{const e=await t.env.data.themes.get(t.var.tenant_id,"default");return e?t.json(e):t.json(t0)}).openapi(s.createRoute({tags:["branding"],method:"put",path:"/default",request:{body:{content:{"application/json":{schema:Hs.deepPartial()}}},headers:s.z.object({"tenant-id":s.z.string().optional()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Hs}},description:"Updated theme settings"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.themes.get(t.var.tenant_id,"default");if(n){const r=n0(n,e);await t.env.data.themes.update(t.var.tenant_id,"default",r);const i=await t.env.data.themes.get(t.var.tenant_id,"default");return t.json(i)}else{const r=n0(t0,e),i=await t.env.data.themes.create(t.var.tenant_id,r);return t.json(i)}}),Gw=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:lu}},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(lu.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.branding.set(e,n),t.text("OK")}).route("/themes",Kw);var R=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})}},cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zm(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 Xw(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 Qm={exports:{}};const Jw={},Yw=Object.freeze(Object.defineProperty({__proto__:null,default:Jw},Symbol.toStringTag,{value:"Module"})),_c=Ww(Yw);(function(t){/**
1
+ "use strict";var cw=Object.defineProperty;var lw=(t,e,n)=>e in t?cw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xe=(t,e,n)=>lw(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@hono/zod-openapi"),Ee=t=>typeof t=="string",ao=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},qf=t=>t==null?"":""+t,uw=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},dw=/###/g,Vf=t=>t&&t.indexOf("###")>-1?t.replace(dw,"."):t,Hf=t=>!t||Ee(t),_o=(t,e,n)=>{const r=Ee(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(Hf(t))return{};const o=Vf(r[i]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++i}return Hf(t)?{}:{obj:t,k:Vf(r[i])}},Kf=(t,e,n)=>{const{obj:r,k:i}=_o(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=_o(t,c,Object);for(;l.obj===void 0&&c.length;)o=`${c[c.length-1]}.${o}`,c=c.slice(0,c.length-1),l=_o(t,c,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},pw=(t,e,n,r)=>{const{obj:i,k:o}=_o(t,e,Object);i[o]=i[o]||[],i[o].push(n)},la=(t,e)=>{const{obj:n,k:r}=_o(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},fw=(t,e,n)=>{const r=la(t,n);return r!==void 0?r:la(e,n)},fm=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?Ee(t[r])||t[r]instanceof String||Ee(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):fm(t[r],e[r],n):t[r]=e[r]);return t},si=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var hw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const gw=t=>Ee(t)?t.replace(/[&<>"'\/]/g,e=>hw[e]):t;class mw{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 _w=[" ",",","?","!",";"],yw=new mw(20),ww=(t,e,n)=>{e=e||"",n=n||"";const r=_w.filter(c=>e.indexOf(c)<0&&n.indexOf(c)<0);if(r.length===0)return!0;const i=yw.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},cu=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},ua=t=>t==null?void 0:t.replace("_","-"),vw={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 da{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||vw,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,i){return i&&!this.debug?null:(Ee(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new da(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new da(this.logger,e)}}var yn=new da;class uc{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 Gf extends uc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){var d,p;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const 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):Ee(r)&&o?l.push(...r.split(o)):l.push(r)));const u=la(this.data,l);return!u&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),u||!c||!Ee(r)?u:cu((p=(d=this.data)==null?void 0:d[e])==null?void 0:p[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),Kf(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)(Ee(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=la(this.data,l)||{};c.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?fm(u,r,o):u={...u,...r},Kf(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 hm={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 Wf={};class pa extends uc{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),uw(["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&&!ww(e,r,i);if(c&&!l){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:Ee(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:Ee(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,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(p){const M=n.nsSeparator||this.options.nsSeparator;return i?{res:`${u}${M}${c}`,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${M}${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 g=h==null?void 0:h.res;const A=(h==null?void 0:h.usedKey)||c,_=(h==null?void 0:h.exactUsedKey)||c,$=Object.prototype.toString.apply(g),S=["[object Number]","[object Function]","[object RegExp]"],k=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,T=!Ee(g)&&typeof g!="boolean"&&typeof g!="number";if(b&&g&&T&&S.indexOf($)<0&&!(Ee(k)&&Array.isArray(g))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(A,g,{...n,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(h.res=M,h.usedParams=this.getUsedParamsDetails(n),h):M}if(o){const M=Array.isArray(g),U=M?[]:{},H=M?_:A;for(const W in g)if(Object.prototype.hasOwnProperty.call(g,W)){const J=`${H}${o}${W}`;U[W]=this.translate(J,{...n,joinArrays:!1,ns:l}),U[W]===J&&(U[W]=g[W])}g=U}}else if(b&&Ee(k)&&Array.isArray(g))g=g.join(k),g&&(g=this.extendTranslation(g,e,n,r));else{let M=!1,U=!1;const H=n.count!==void 0&&!Ee(n.count),W=pa.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(g)&&W&&(M=!0,g=B),this.isValidLookup(g)||(U=!0,g=c);const P=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&U?void 0:g,I=W&&B!==g&&this.options.updateMissing;if(U||M||I){if(this.logger.log(I?"updateKey":"missingKey",d,u,c,I?B:g),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 Se=W&&ve!==g?ve:P;this.options.missingKeyHandler?this.options.missingKeyHandler(de,u,ne,Se,I,n):(Z=this.backendConnector)!=null&&Z.saveMissing&&this.backendConnector.saveMissing(de,u,ne,Se,I,n),this.emit("missingKey",de,u,ne,g)};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))}g=this.extendTranslation(g,e,n,h,r),U&&g===c&&this.options.appendNamespaceToMissingKey&&(g=`${u}:${c}`),(U||M)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${c}`:c,M?g:void 0))}return i?(h.res=g,h.usedParams=this.getUsedParamsDetails(n),h):g}extendTranslation(e,n,r,i,o){var d,p;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=Ee(e)&&(((p=r==null?void 0:r.interpolation)==null?void 0:p.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let g;if(h){const _=e.match(this.interpolator.nestingRegexp);g=_&&_.length}let A=r.replace&&!Ee(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(A={...this.options.interpolation.defaultVariables,...A}),e=this.interpolator.interpolate(e,A,r.lng||this.language||i.usedLng,r),h){const _=e.match(this.interpolator.nestingRegexp),$=_&&_.length;g<$&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var _=arguments.length,$=new Array(_),S=0;S<_;S++)$[S]=arguments[S];return(o==null?void 0:o[0])===$[0]&&!r.context?(c.logger.warn(`It seems you are nesting recursively key: ${$[0]} in key: ${n[0]}`),null):c.translate(...$,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=Ee(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=hm.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 Ee(e)&&(e=[e]),e.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),p=d.key;i=p;let h=d.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const g=n.count!==void 0&&!Ee(n.count),A=g&&!n.ordinal&&n.count===0,_=n.context!==void 0&&(Ee(n.context)||typeof n.context=="number")&&n.context!=="",$=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(S=>{var k,b;this.isValidLookup(r)||(l=S,!Wf[`${$[0]}-${S}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((b=this.utils)!=null&&b.hasLoadedNamespace(l))&&(Wf[`${$[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${$.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!!!")),$.forEach(T=>{var H;if(this.isValidLookup(r))return;c=T;const M=[p];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(M,p,T,S,n);else{let W;g&&(W=this.pluralResolver.getSuffix(T,n.count,n));const J=`${this.options.pluralSeparator}zero`,ue=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(M.push(p+W),n.ordinal&&W.indexOf(ue)===0&&M.push(p+W.replace(ue,this.options.pluralSeparator)),A&&M.push(p+J)),_){const Ne=`${p}${this.options.contextSeparator}${n.context}`;M.push(Ne),g&&(M.push(Ne+W),n.ordinal&&W.indexOf(ue)===0&&M.push(Ne+W.replace(ue,this.options.pluralSeparator)),A&&M.push(Ne+J))}}let U;for(;U=M.pop();)this.isValidLookup(r)||(o=U,r=this.getResource(T,S,U,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&&!Ee(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const 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 Xf{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=yn.create("languageUtils")}getScriptPartFromCode(e){if(e=ua(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=ua(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ee(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(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)),Ee(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return Ee(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))):Ee(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},Yf={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class bw{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=ua(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!"),Yf;if(!e.match(/-|_/))return Yf;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 Zf=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=fw(t,e,n);return!o&&i&&Ee(n)&&(o=cu(t,n,r),o===void 0&&(o=cu(e,n,r))),o},Il=t=>t.replace(/\$/g,"$$$$");class xw{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:p,unescapePrefix:h,nestingPrefix:g,nestingPrefixEscaped:A,nestingSuffix:_,nestingSuffixEscaped:$,nestingOptionsSeparator:S,maxReplaces:k,alwaysFormat:b}=e.interpolation;this.escape=n!==void 0?n:gw,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=p?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=g?si(g):A||si("$t("),this.nestingSuffix=_?si(_):$||si(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=k||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,r,i){var A;let o,c,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=_=>{if(_.indexOf(this.formatSeparator)<0){const b=Zf(n,u,_,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...i,...n,interpolationkey:_}):b}const $=_.split(this.formatSeparator),S=$.shift().trim(),k=$.join(this.formatSeparator).trim();return this.format(Zf(n,u,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...i,...n,interpolationkey:S})};this.resetRegExp();const p=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((A=i==null?void 0:i.interpolation)==null?void 0:A.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:_=>Il(_)},{regex:this.regexp,safeValue:_=>this.escapeValue?Il(this.escape(_)):Il(_)}].forEach(_=>{for(l=0;o=_.regex.exec(e);){const $=o[1].trim();if(c=d($),c===void 0)if(typeof p=="function"){const k=p(e,o,i);c=Ee(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,$))c="";else if(h){c=o[0];continue}else this.logger.warn(`missed to pass in variable ${$} for interpolating ${e}`),c="";else!Ee(c)&&!this.useRawValueToEscape&&(c=qf(c));const S=_.safeValue(c);if(e=e.replace(o[0],S),h?(_.regex.lastIndex+=c.length,_.regex.lastIndex-=o[0].length):_.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,c;const l=(u,d)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const h=u.split(new RegExp(`${p}[ ]*{`));let g=`{${h[1]}`;u=h[0],g=this.interpolate(g,c);const A=g.match(/'/g),_=g.match(/"/g);(((A==null?void 0:A.length)??0)%2===0&&!_||_.length%2!==0)&&(g=g.replace(/'/g,'"'));try{c=JSON.parse(g),d&&(c={...d,...c})}catch($){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,$),`${u}${p}${g}`}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&&!Ee(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 p=i[1].split(this.formatSeparator).map(h=>h.trim());i[1]=p.shift(),u=p,d=!0}if(o=n(l.call(this,i[1].trim(),c),c),o&&i[0]===e&&!Ee(o))return o;Ee(o)||(o=qf(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),d&&(o=u.reduce((p,h)=>this.format(p,h,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const $w=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,""),p=l.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},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(ua(r),i),e[c]=l),l(n)}};class Aw{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:p}=$w(u);if(this.formats[d]){let g=l;try{const A=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},_=A.locale||A.lng||i.locale||i.lng||r;g=this.formats[d](l,_,{...p,...i,...A})}catch(A){this.logger.warn(A)}return g}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Ew=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Sw extends uc{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 p=!0;n.forEach(h=>{const g=`${d}|${h}`;!r.reload&&this.store.hasResourceBundle(d,h)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?c[g]===void 0&&(c[g]=!0):(this.state[g]=1,p=!1,c[g]===void 0&&(c[g]=!0),o[g]===void 0&&(o[g]=!0),u[h]===void 0&&(u[h]=!0)))}),p||(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=>{pw(u.loaded,[o],c),Ew(u,e),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const p=u.loaded[d];p.length&&p.forEach(h=>{l[d][h]===void 0&&(l[d][h]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(u=>!u.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,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,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(d&&p&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,i+1,o*2,c)},o);return}c(d,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(e,n);d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}return}return u(e,n,l)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Ee(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ee(n)&&(n=[n]);const 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,p,h,g;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=(p=this.services)==null?void 0:p.utils)!=null&&h.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((g=this.backend)!=null&&g.create){const A={...c,isUpdate:o},_=this.backend.create.bind(this.backend);if(_.length<6)try{let $;_.length===5?$=_(e,n,r,i,A):$=_(e,n,r,i),$&&typeof $.then=="function"?$.then(S=>l(null,S)).catch(l):l(null,$)}catch($){l($)}else _(e,n,r,i,l,A)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const Qf=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Ee(t[1])&&(e.defaultValue=t[1]),Ee(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),e0=t=>{var e,n;return Ee(t.ns)&&(t.ns=[t.ns]),Ee(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ee(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Os=()=>{},kw=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Ao extends uc{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=e0(e),this.services={},this.logger=yn,this.modules={external:[]},kw(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(Ee(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Qf();this.options={...i,...this.options,...e0(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=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?yn.init(o(this.modules.logger),this.options):yn.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Aw;const h=new Xf(this.options);this.store=new Gf(this.options.resources,this.options);const g=this.services;g.logger=yn,g.resourceStore=this.store,g.languageUtils=h,g.pluralResolver=new bw(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(g.formatter=o(p),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new xw(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new Sw(o(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(A){for(var _=arguments.length,$=new Array(_>1?_-1:0),S=1;S<_;S++)$[S-1]=arguments[S];e.emit(A,...$)}),this.modules.languageDetector&&(g.languageDetector=o(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=o(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new pa(this.services,this.options),this.translator.on("*",function(A){for(var _=arguments.length,$=new Array(_>1?_-1:0),S=1;S<_;S++)$[S-1]=arguments[S];e.emit(A,...$)}),this.modules.external.forEach(A=>{A.init&&A.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Os),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const u=ao(),d=()=>{const p=(h,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),u.resolve(g),r(h,g)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e){var o,c;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Os;const i=Ee(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],u=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(h=>{h!=="cimode"&&l.indexOf(h)<0&&l.push(h)})};i?u(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>u(p)),(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=ao();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=Os),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"&&hm.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=ao();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 p,h;!e&&!u&&this.services.languageDetector&&(u=[]);const d=Ee(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||o(d),this.translator.language||this.translator.changeLanguage(d),(h=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||h.call(p,d)),this.loadResources(d,g=>{c(g,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),i}getFixedT(e,n,r){var i=this;const o=function(c,l){let u;if(typeof l!="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),h=2;h<d;h++)p[h-2]=arguments[h];u=i.options.overloadTranslationOptionHandler([c,l].concat(p))}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 g=i.options.keySeparator||".";let A;return u.keyPrefix&&Array.isArray(c)?A=c.map(_=>`${u.keyPrefix}${g}${_}`):A=u.keyPrefix?`${u.keyPrefix}${g}${c}`:c,i.t(A,u)};return Ee(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=ao();return this.options.ns?(Ee(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=ao();Ee(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 Xf(Qf());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 Ao(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Os;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new Ao(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((p,h)=>(p[h]={...u[d][h]},p),{})),{});o.store=new Gf(l,i),o.services.resourceStore=o.store}return o.translator=new pa(o.services,i),o.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p<u;p++)d[p-1]=arguments[p];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 F=Ao.createInstance();F.createInstance=Ao.createInstance;F.createInstance;F.dir;F.init;F.loadResources;F.reloadResources;F.use;F.changeLanguage;F.getFixedT;const $e=F.t;F.exists;F.setDefaultNamespace;F.hasLoadedNamespace;F.loadNamespaces;F.loadLanguages;var gm=t=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...t},r=(o=>typeof o=="string"?o==="*"?()=>o:c=>o===c?c:null:typeof o=="function"?o:c=>o.includes(c)?c:null)(n.origin),i=(o=>typeof o=="function"?o:Array.isArray(o)?()=>o:()=>[])(n.allowMethods);return async function(c,l){var p;function u(h,g){c.res.headers.set(h,g)}const d=r(c.req.header("origin")||"",c);if(d&&u("Access-Control-Allow-Origin",d),n.origin!=="*"){const h=c.req.header("Vary");h?u("Vary",h):u("Vary","Origin")}if(n.credentials&&u("Access-Control-Allow-Credentials","true"),(p=n.exposeHeaders)!=null&&p.length&&u("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),c.req.method==="OPTIONS"){n.maxAge!=null&&u("Access-Control-Max-Age",n.maxAge.toString());const h=i(c.req.header("origin")||"",c);h.length&&u("Access-Control-Allow-Methods",h.join(","));let g=n.allowHeaders;if(!(g!=null&&g.length)){const A=c.req.header("Access-Control-Request-Headers");A&&(g=A.split(/\s*,\s*/))}return g!=null&&g.length&&(u("Access-Control-Allow-Headers",g.join(",")),c.res.headers.append("Vary","Access-Control-Request-Headers")),c.res.headers.delete("Content-Length"),c.res.headers.delete("Content-Type"),new Response(null,{headers:c.res.headers,status:204,statusText:"No Content"})}await l()}};const Wn=s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()}),dc=s.z.object({created_at:s.z.string(),updated_at:s.z.string()}),mm=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()),_m=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:mm.optional()}),pc=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()}),fa=pc.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()}),ep=s.z.object({...fa.shape,...dc.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(_m).optional()}),_n=ep,Nw=pc.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()),Cw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Iw=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Cw[n[t]&63];return e};const ym=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()}),ha=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:ym.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(()=>Iw()).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"})}),zr=s.z.object({created_at:s.z.string().transform(t=>t===null?"":t),updated_at:s.z.string().transform(t=>t===null?"":t),...ha.shape}),Hi=s.z.object({x:s.z.number(),y:s.z.number()});var tp=(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))(tp||{}),np=(t=>(t.BLOCK="BLOCK",t.FIELD="FIELD",t))(np||{});const fc=s.z.object({id:s.z.string(),category:s.z.nativeEnum(np),type:s.z.nativeEnum(tp)}),wm=fc.extend({category:s.z.literal("BLOCK"),type:s.z.literal("RICH_TEXT"),config:s.z.object({content:s.z.string()}).passthrough()}),vm=fc.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()}),bm=fc.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()}),xm=fc.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()}),$m=s.z.object({id:s.z.string(),category:s.z.string(),type:s.z.string()}).passthrough(),Am=s.z.union([wm,vm,bm,xm,$m]);var Em=(t=>(t.STEP="STEP",t.FLOW="FLOW",t.CONDITION="CONDITION",t.ACTION="ACTION",t))(Em||{});const Sm=s.z.object({id:s.z.string(),type:s.z.literal("STEP"),coordinates:Hi,alias:s.z.string().optional(),config:s.z.object({components:s.z.array(Am),next_node:s.z.string()}).passthrough()}),km=s.z.object({id:s.z.string(),type:s.z.literal("FLOW"),coordinates:Hi,alias:s.z.string().optional(),config:s.z.object({flow_id:s.z.string(),next_node:s.z.string()})}),Nm=s.z.object({id:s.z.string(),type:s.z.string(),coordinates:Hi}).passthrough(),Cm=s.z.union([Sm,km,Nm]),Im=s.z.object({next_node:s.z.string(),coordinates:Hi}).passthrough(),Tm=s.z.object({resume_flow:s.z.boolean().optional(),coordinates:Hi}).passthrough(),Om=s.z.object({id:s.z.string(),name:s.z.string(),languages:s.z.object({primary:s.z.string()}).passthrough(),nodes:s.z.array(Cm),start:Im,ending:Tm,created_at:s.z.string(),updated_at:s.z.string(),links:s.z.object({sdkSrc:s.z.string().optional(),sdk_src:s.z.string().optional()}).passthrough()}).passthrough(),Tw=Om.omit({id:!0,created_at:!0,updated_at:!0});var tn=(t=>(t.TOKEN="token",t.TOKEN_ID_TOKEN="token id_token",t.CODE="code",t))(tn||{}),vn=(t=>(t.QUERY="query",t.FRAGMENT="fragment",t.FORM_POST="form_post",t.WEB_MESSAGE="web_message",t.SAML_POST="saml_post",t))(vn||{}),hc=(t=>(t.S256="S256",t.Plain="plain",t))(hc||{});const Eo=s.z.object({client_id:s.z.string(),act_as:s.z.string().optional(),response_type:s.z.nativeEnum(tn).optional(),response_mode:s.z.nativeEnum(vn).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(hc).optional(),code_challenge:s.z.string().optional(),username:s.z.string().optional(),ui_locales:s.z.string().optional(),vendor_id:s.z.string().optional()}),lu=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()}),rp=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()}),ga=s.z.object({id:s.z.string().optional(),name:s.z.string(),strategy:s.z.string(),options:rp.default({}),enabled_clients:s.z.array(s.z.string()).default([]).optional(),response_type:s.z.custom().optional(),response_mode:s.z.custom().optional()}),ar=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(ga.shape),ma=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),...ma.shape,id:s.z.string()}),Dm=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({...zr.shape,tenant:xi,connections:s.z.array(ar)});const zm=s.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),Rm=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:zm,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()}),Ow=s.z.object({...Rm.shape,created_at:s.z.string()}),ip=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()}),Pm=s.z.object({name:s.z.literal("txt"),record:s.z.string(),domain:s.z.string()}),sr=s.z.object({...ip.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(Pm)}).optional(),tls_policy:s.z.string().optional()}),Dw=sr.extend({tenant_id:s.z.string()}),zw=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()}),Bm=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)})]),_a=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(Bm),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({...dc.shape,..._a.shape,id:s.z.string()}),jm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),Lm=s.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),gc={enabled:s.z.boolean().default(!1),synchronous:s.z.boolean().default(!1),priority:s.z.number().optional(),hook_id:s.z.string().optional()},Rw=s.z.object({...gc,trigger_id:jm,url:s.z.string()}),Pw=s.z.object({...gc,trigger_id:Lm,form_id:s.z.string()}),Vs=s.z.union([Rw,Pw]),Bw=s.z.object({...gc,trigger_id:jm,...dc.shape,hook_id:s.z.string(),url:s.z.string()}),jw=s.z.object({...gc,trigger_id:Lm,...dc.shape,hook_id:s.z.string(),form_id:s.z.string()}),yi=s.z.union([Bw,jw]),op=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()}),Fm=s.z.object({keys:s.z.array(op)}),uu=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())}),Um=s.z.object({csrf_token:s.z.string(),auth0Client:s.z.string().optional(),authParams:Eo,expires_at:s.z.string(),deleted_at:s.z.string().optional(),ip:s.z.string().optional(),useragent:s.z.string().optional(),session_id:s.z.string().optional(),authorization_url:s.z.string().optional(),login_completed:s.z.boolean().optional().default(!1)}).openapi({description:"This represents a login sesion"}),Lw=s.z.object({...Um.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()}),Le={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},Fw=s.z.string().refine(t=>Object.values(Le).includes(t),{message:"Invalid log type"}),Mm=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()}),ya=s.z.object({type:Fw,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:Mm.optional()}),qm=s.z.object({user_id:s.z.string(),password:s.z.string(),algorithm:s.z.enum(["bcrypt","argon2id"]).default("argon2id")}),Uw=s.z.object({...qm.shape,created_at:s.z.string(),updated_at:s.z.string()}),Vm=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")}),Hm=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:Vm.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")}),mc=s.z.object({created_at:s.z.string(),updated_at:s.z.string(),authenticated_at:s.z.string(),last_interaction_at:s.z.string(),...Hm.shape}),du=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 sp=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 Km=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()}),Gm=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()}),Ir=s.z.object({bold:s.z.boolean(),size:s.z.number()}),Wm=s.z.object({body_text:Ir,buttons_text:Ir,font_url:s.z.string(),input_labels:Ir,links:Ir,links_style:s.z.enum(["normal"]),reference_text_size:s.z.number(),subtitle:Ir,title:Ir}),Xm=s.z.object({background_color:s.z.string(),background_image_url:s.z.string(),page_layout:s.z.enum(["center"])}),Jm=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"])}),Ym=s.z.object({borders:Km,colors:Gm,displayName:s.z.string(),fonts:Wm,page_background:Xm,widget:Jm}),Hs=Ym.extend({themeId:s.z.string()}),Ks=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()}),Gs=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()}),ap=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:Vm,resource_servers:s.z.array(s.z.object({audience:s.z.string(),scopes:s.z.string()})),rotating:s.z.boolean()}),Mw=s.z.object({created_at:s.z.string(),...ap.shape}),qw=s.z.object({to:s.z.string(),message:s.z.string()}),Vw=s.z.object({name:s.z.string(),options:s.z.object({})});function Hw(t){const[e,n]=t.split("|");if(!e||!n)throw new Error(`Invalid user_id: ${t}`);return{connection:e,id:n}}const t0={themeId:"default",borders:{button_border_radius:8,button_border_weight:1,buttons_style:"pill",input_border_radius:8,input_border_weight:1,inputs_style:"pill",show_widget_shadow:!0,widget_border_weight:1,widget_corner_radius:16},colors:{base_focus_color:"#7D68F4",base_hover_color:"#A091F2",body_text:"#000000",captcha_widget_theme:"auto",error:"#FC5A5A",header:"#000000",icons:"#666666",input_background:"#FFFFFF",input_border:"#BFBCD7",input_filled_text:"#000000",input_labels_placeholders:"#88869F",links_focused_components:"#7D68F4",primary_button:"#7D68F4",primary_button_label:"#FFFFFF",secondary_button_border:"#BFBCD7",secondary_button_label:"#000000",success:"#36BF76",widget_background:"#FFFFFF",widget_border:"#BFBCD7"},displayName:"Default Theme",fonts:{body_text:{bold:!1,size:16},buttons_text:{bold:!1,size:16},font_url:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",input_labels:{bold:!1,size:14},links:{bold:!1,size:16},links_style:"normal",reference_text_size:16,subtitle:{bold:!1,size:18},title:{bold:!0,size:24}},page_background:{background_color:"#F8F9FB",background_image_url:"https://assets.sesamy.com/images/login-bg.jpg",page_layout:"center"},widget:{header_text_alignment:"center",logo_height:36,logo_position:"center",logo_url:"https://assets.sesamy.com/images/sesamy-logo.svg",social_buttons_layout:"bottom"}};function n0(t,e){const n=structuredClone(t);function r(i,o){for(const c in o)o[c]!==void 0&&typeof o[c]=="object"&&!Array.isArray(o[c])&&typeof i[c]=="object"&&i[c]!==null?r(i[c],o[c]):i[c]=o[c];return i}return r(n,e)}const Kw=new s.OpenAPIHono().openapi(s.createRoute({tags:["branding"],method:"get",path:"/default",request:{headers:s.z.object({"tenant-id":s.z.string().optional()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Hs}},description:"Default theme settings"}}}),async t=>{const e=await t.env.data.themes.get(t.var.tenant_id,"default");return e?t.json(e):t.json(t0)}).openapi(s.createRoute({tags:["branding"],method:"patch",path:"/default",request:{body:{content:{"application/json":{schema:Hs.deepPartial()}}},headers:s.z.object({"tenant-id":s.z.string().optional()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Hs}},description:"Updated theme settings"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.themes.get(t.var.tenant_id,"default");if(n){const r=n0(n,e);await t.env.data.themes.update(t.var.tenant_id,"default",r);const i=await t.env.data.themes.get(t.var.tenant_id,"default");return t.json(i)}else{const r=n0(t0,e),i=await t.env.data.themes.create(t.var.tenant_id,r);return t.json(i)}}),Gw=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:lu}},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(lu.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.branding.set(e,n),t.text("OK")}).route("/themes",Kw);var R=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})}},cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zm(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 Xw(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 Qm={exports:{}};const Jw={},Yw=Object.freeze(Object.defineProperty({__proto__:null,default:Jw},Symbol.toStringTag,{value:"Module"})),_c=Ww(Yw);(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
@@ -281,7 +281,7 @@ ${W.replace(/ /g,"")}
281
281
  `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(Wy);var Ff={},Yo=tr.NAMESPACE,Zd=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,im=new RegExp("[\\-\\.0-9"+Zd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),om=new RegExp("^"+Zd.source+im.source+"*(?::"+Zd.source+im.source+"*)?$"),po=0,or=1,di=2,fo=3,pi=4,fi=5,ho=6,Fs=7;function Vi(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Vi)}Vi.prototype=new Error;Vi.prototype.name=Vi.name;function Xy(){}Xy.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),Jy(e,e={}),fE(t,e,n,r,this.errorHandler),r.endDocument()}};function fE(t,e,n,r,i){function o(j){if(j>65535){j-=65536;var V=55296+(j>>10),de=56320+(j&1023);return String.fromCharCode(V,de)}else return String.fromCharCode(j)}function c(j){var V=j.slice(1,-1);return Object.hasOwnProperty.call(n,V)?n[V]:V.charAt(0)==="#"?o(parseInt(V.substr(1).replace("x","0x"))):(i.error("entity not found:"+j),j)}function l(j){if(j>$){var V=t.substring($,j).replace(/&#?\w+;/g,c);g&&u($),r.characters(V,0,j-$),$=j}}function u(j,V){for(;j>=p&&(V=h.exec(t));)d=V.index,p=d+V[0].length,g.lineNumber++;g.columnNumber=j-d+1}for(var d=0,p=0,h=/.*(?:\r\n?|\n)|.*$/g,g=r.locator,A=[{currentNSMap:e}],_={},$=0;;){try{var S=t.indexOf("<",$);if(S<0){if(!t.substr($).match(/^\s*$/)){var k=r.doc,b=k.createTextNode(t.substr($));k.appendChild(b),r.currentElement=b}return}switch(S>$&&l(S),t.charAt(S+1)){case"/":var B=t.indexOf(">",S+3),T=t.substring(S+2,B).replace(/[ \t\n\r]+$/g,""),M=A.pop();B<0?(T=t.substring(S+2).replace(/[\s<].*/,""),i.error("end tag name: "+T+" is not complete:"+M.tagName),B=S+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),i.error("end tag name: "+T+" maybe not complete"),B=S+1+T.length);var U=M.localNSMap,H=M.tagName==T,W=H||M.tagName&&M.tagName.toLowerCase()==T.toLowerCase();if(W){if(r.endElement(M.uri,M.localName,T),U)for(var J in U)Object.prototype.hasOwnProperty.call(U,J)&&r.endPrefixMapping(J);H||i.fatalError("end tag name: "+T+" is not match the current start tagName:"+M.tagName)}else A.push(M);B++;break;case"?":g&&u(S),B=yE(t,S,r);break;case"!":g&&u(S),B=_E(t,S,r,i);break;default:g&&u(S);var ue=new Yy,Ne=A[A.length-1].currentNSMap,B=hE(t,S,ue,Ne,c,i),L=ue.length;if(!ue.closed&&mE(t,B,ue.tagName,_)&&(ue.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),g&&L){for(var P=sm(g,{}),I=0;I<L;I++){var C=ue[I];u(C.offset),C.locator=sm(g,{})}r.locator=P,am(ue,r,Ne)&&A.push(ue),r.locator=g}else am(ue,r,Ne)&&A.push(ue);Yo.isHTML(ue.uri)&&!ue.closed?B=gE(t,B,ue.tagName,c,r):B++}}catch(j){if(j instanceof Vi)throw j;i.error("element parse error: "+j),B=-1}B>$?$=B:l(Math.max(S,$)+1)}}function sm(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function hE(t,e,n,r,i,o){function c(g,A,_){n.attributeNames.hasOwnProperty(g)&&o.fatalError("Attribute "+g+" redefined"),n.addValue(g,A.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),_)}for(var l,u,d=++e,p=po;;){var h=t.charAt(d);switch(h){case"=":if(p===or)l=t.slice(e,d),p=fo;else if(p===di)p=fo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===fo||p===or)if(p===or&&(o.warning('attribute value must after "="'),l=t.slice(e,d)),e=d+1,d=t.indexOf(h,e),d>0)u=t.slice(e,d),c(l,u,e-1),p=fi;else throw new Error("attribute value no end '"+h+"' match");else if(p==pi)u=t.slice(e,d),c(l,u,e),o.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=d+1,p=fi;else throw new Error('attribute value must after "="');break;case"/":switch(p){case po:n.setTagName(t.slice(e,d));case fi:case ho:case Fs:p=Fs,n.closed=!0;case pi:case or:break;case di:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),p==po&&n.setTagName(t.slice(e,d)),d;case">":switch(p){case po:n.setTagName(t.slice(e,d));case fi:case ho:case Fs:break;case pi:case or:u=t.slice(e,d),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case di:p===di&&(u=l),p==pi?(o.warning('attribute "'+u+'" missed quot(")!'),c(l,u,e)):((!Yo.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),c(u,u,e));break;case fo:throw new Error("attribute value missed!!")}return d;case"€":h=" ";default:if(h<=" ")switch(p){case po:n.setTagName(t.slice(e,d)),p=ho;break;case or:l=t.slice(e,d),p=di;break;case pi:var u=t.slice(e,d);o.warning('attribute "'+u+'" missed quot(")!!'),c(l,u,e);case fi:p=ho;break}else switch(p){case di:n.tagName,(!Yo.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),c(l,l,e),e=d,p=or;break;case fi:o.warning('attribute space is required"'+l+'"!!');case ho:p=or,e=d;break;case fo:p=pi,e=d;break;case Fs:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function am(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var o=t[h],c=o.qName,l=o.value,g=c.indexOf(":");if(g>0)var u=o.prefix=c.slice(0,g),d=c.slice(g+1),p=u==="xmlns"&&d;else d=c,u=null,p=c==="xmlns"&&"";o.localName=d,p!==!1&&(i==null&&(i={},Jy(n,n={})),n[p]=i[p]=l,o.uri=Yo.XMLNS,e.startPrefixMapping(p,l))}for(var h=t.length;h--;){o=t[h];var u=o.prefix;u&&(u==="xml"&&(o.uri=Yo.XML),u!=="xmlns"&&(o.uri=n[u||""]))}var g=r.indexOf(":");g>0?(u=t.prefix=r.slice(0,g),d=t.localName=r.slice(g+1)):(u=null,d=t.localName=r);var A=t.uri=n[u||""];if(e.startElement(A,d,r,t),t.closed){if(e.endElement(A,d,r),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&e.endPrefixMapping(u)}else return t.currentNSMap=n,t.localNSMap=i,!0}function gE(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=t.indexOf("</"+n+">",e),c=t.substring(e+1,o);if(/[&<]/.test(c))return/^script$/i.test(n)?(i.characters(c,0,c.length),o):(c=c.replace(/&#?\w+;/g,r),i.characters(c,0,c.length),o)}return e+1}function mE(t,e,n,r){var i=r[n];return i==null&&(i=t.lastIndexOf("</"+n+">"),i<e&&(i=t.lastIndexOf("</"+n)),r[n]=i),i<e}function Jy(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function _E(t,e,n,r){var i=t.charAt(e+2);switch(i){case"-":if(t.charAt(e+3)==="-"){var o=t.indexOf("-->",e+4);return o>e?(n.comment(t,e+4,o-e-4),o+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var o=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,o-e-9),n.endCDATA(),o+3}var c=wE(t,e),l=c.length;if(l>1&&/!doctype/i.test(c[0][0])){var u=c[1][0],d=!1,p=!1;l>3&&(/^public$/i.test(c[2][0])?(d=c[3][0],p=l>4&&c[4][0]):/^system$/i.test(c[2][0])&&(p=c[3][0]));var h=c[l-1];return n.startDTD(u,d,p),n.endDTD(),h.index+h[0].length}}return-1}function yE(t,e,n){var r=t.indexOf("?>",e);if(r){var i=t.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function Yy(){this.attributeNames={}}Yy.prototype={setTagName:function(t){if(!om.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!om.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function wE(t,e){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);n=i.exec(t);)if(r.push(n),n[1])return r}Ff.XMLReader=Xy;Ff.ParseError=Vi;var vE=tr,bE=er,cm=Wy,Zy=Ff,xE=bE.DOMImplementation,lm=vE.NAMESPACE,$E=Zy.ParseError,AE=Zy.XMLReader;function Qy(t){return t.replace(/\r[\n\u0085]/g,`
282
282
  `).replace(/[\r\u0085\u2028]/g,`
283
283
  `)}function ew(t){this.options=t||{locator:{}}}ew.prototype.parseFromString=function(t,e){var n=this.options,r=new AE,i=n.domBuilder||new Ns,o=n.errorHandler,c=n.locator,l=n.xmlns||{},u=/\/x?html?$/.test(e),d=u?cm.HTML_ENTITIES:cm.XML_ENTITIES;c&&i.setDocumentLocator(c),r.errorHandler=EE(o,i,c),r.domBuilder=n.domBuilder||i,u&&(l[""]=lm.HTML),l.xml=l.xml||lm.XML;var p=n.normalizeLineEndings||Qy;return t&&typeof t=="string"?r.parse(p(t),l,d):r.errorHandler.error("invalid doc source"),i.doc};function EE(t,e,n){if(!t){if(e instanceof Ns)return e;t=e}var r={},i=t instanceof Function;n=n||{};function o(c){var l=t[c];!l&&i&&(l=t.length==2?function(u){t(c,u)}:t),r[c]=l&&function(u){l("[xmldom "+c+"] "+u+Qd(n))}||function(){}}return o("warning"),o("error"),o("fatalError"),r}function Ns(){this.cdata=!1}function hi(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}Ns.prototype={startDocument:function(){this.doc=new xE().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,o=i.createElementNS(t,n||e),c=r.length;Us(this,o),this.currentElement=o,this.locator&&hi(this.locator,o);for(var l=0;l<c;l++){var t=r.getURI(l),u=r.getValue(l),n=r.getQName(l),d=i.createAttributeNS(t,n);this.locator&&hi(r.getLocator(l),d),d.value=d.nodeValue=u,o.setAttributeNode(d)}},endElement:function(t,e,n){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&hi(this.locator,n),Us(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=um.apply(this,arguments),t){if(this.cdata)var r=this.doc.createCDATASection(t);else var r=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(t)&&this.doc.appendChild(r),this.locator&&hi(this.locator,r)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,n){t=um.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&hi(this.locator,r),Us(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(t,e,n);this.locator&&hi(this.locator,i),Us(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning] "+t,Qd(this.locator))},error:function(t){console.error("[xmldom error] "+t,Qd(this.locator))},fatalError:function(t){throw new $E(t,this.locator)}};function Qd(t){if(t)return`
284
- @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function um(t,e,n){return typeof t=="string"?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Ns.prototype[t]=function(){return null}});function Us(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Nl.__DOMHandler=Ns;Nl.normalizeLineEndings=Qy;Nl.DOMParser=ew;var tw=er;El.DOMImplementation=tw.DOMImplementation;El.XMLSerializer=tw.XMLSerializer;El.DOMParser=Nl.DOMParser;var Cl={};Object.defineProperty(Cl,"__esModule",{value:!0});Cl.EnvelopedSignature=void 0;const Ms=xl,su=be;class SE{constructor(){this.includeComments=!1,this.includeComments=!1}process(e,n){if(n.signatureNode==null){const o=Ms.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return su.isNodeLike(o)&&o.parentNode&&o.parentNode.removeChild(o),e}const r=n.signatureNode,i=Ms.select1(".//*[local-name(.)='SignatureValue']/text()",r);if(su.isTextNode(i)){const o=i.data,c=Ms.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);for(const l of Array.isArray(c)?c:[]){const u=Ms.select1(".//*[local-name(.)='SignatureValue']/text()",l);if(su.isTextNode(u)){const d=u.data;o===d&&l.parentNode&&l.parentNode.removeChild(l)}}}return e}getAlgorithmName(){return"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}}Cl.EnvelopedSignature=SE;var hr={};Object.defineProperty(hr,"__esModule",{value:!0});hr.Sha512=hr.Sha256=hr.Sha1=void 0;const Uf=_c;class kE{constructor(){this.getHash=function(e){const n=Uf.createHash("sha1");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2000/09/xmldsig#sha1"}}}hr.Sha1=kE;class NE{constructor(){this.getHash=function(e){const n=Uf.createHash("sha256");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha256"}}}hr.Sha256=NE;class CE{constructor(){this.getHash=function(e){const n=Uf.createHash("sha512");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha512"}}}hr.Sha512=CE;var wn={},Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.createOptionalCallbackFunction=void 0;function IE(t){return typeof t=="function"}function TE(t){return(...e)=>{const n=e[e.length-1];if(IE(n))try{const r=t(...e.slice(0,-1));n(null,r)}catch(r){n(r instanceof Error?r:new Error("Unknown error"))}else return t(...e)}}Cs.createOptionalCallbackFunction=TE;Object.defineProperty(wn,"__esModule",{value:!0});wn.HmacSha1=wn.RsaSha512=wn.RsaSha256=wn.RsaSha1=void 0;const br=_c,xr=Cs;class OE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createSign("RSA-SHA1");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createVerify("RSA-SHA1");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"}}wn.RsaSha1=OE;class DE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createSign("RSA-SHA256");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createVerify("RSA-SHA256");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"}}wn.RsaSha256=DE;class zE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createSign("RSA-SHA512");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createVerify("RSA-SHA512");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"}}wn.RsaSha512=zE;class RE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createHmac("SHA1",n);return r.update(e),r.digest("base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createHmac("SHA1",n);return i.update(e),i.digest("base64")===r}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#hmac-sha1"}}wn.HmacSha1=RE;Object.defineProperty(Al,"__esModule",{value:!0});Al.SignedXml=void 0;const zt=be,Cr=El,PE=_c,Mt=xl,dm=Qr,BE=Cl,pm=ei,au=hr,qs=wn,Oe=As;class Dn{constructor(e={}){this.signatureAlgorithm=void 0,this.canonicalizationAlgorithm=void 0,this.inclusiveNamespacesPrefixList=[],this.namespaceResolver={lookupNamespaceURI:function(){throw new Error("Not implemented")}},this.implicitTransforms=[],this.keyInfoAttributes={},this.getKeyInfoContent=Dn.getKeyInfoContent,this.getCertFromKeyInfo=Dn.getCertFromKeyInfo,this.id=0,this.signedXml="",this.signatureXml="",this.signatureNode=null,this.signatureValue="",this.originalXmlWithIds="",this.keyInfo=null,this.references=[],this.signedReferences=[],this.CanonicalizationAlgorithms={"http://www.w3.org/TR/2001/REC-xml-c14n-20010315":dm.C14nCanonicalization,"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":dm.C14nCanonicalizationWithComments,"http://www.w3.org/2001/10/xml-exc-c14n#":pm.ExclusiveCanonicalization,"http://www.w3.org/2001/10/xml-exc-c14n#WithComments":pm.ExclusiveCanonicalizationWithComments,"http://www.w3.org/2000/09/xmldsig#enveloped-signature":BE.EnvelopedSignature},this.HashAlgorithms={"http://www.w3.org/2000/09/xmldsig#sha1":au.Sha1,"http://www.w3.org/2001/04/xmlenc#sha256":au.Sha256,"http://www.w3.org/2001/04/xmlenc#sha512":au.Sha512},this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#rsa-sha1":qs.RsaSha1,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":qs.RsaSha256,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":qs.RsaSha512};const{idMode:n,idAttribute:r,privateKey:i,publicCert:o,signatureAlgorithm:c,canonicalizationAlgorithm:l,inclusiveNamespacesPrefixList:u,implicitTransforms:d,keyInfoAttributes:p,getKeyInfoContent:h,getCertFromKeyInfo:g}=e;this.idMode=n,this.idAttributes=["Id","ID","id"],r&&this.idAttributes.unshift(r),this.privateKey=i,this.publicCert=o,this.signatureAlgorithm=c??this.signatureAlgorithm,this.canonicalizationAlgorithm=l,typeof u=="string"?this.inclusiveNamespacesPrefixList=u.split(" "):Oe.isArrayHasLength(u)&&(this.inclusiveNamespacesPrefixList=u),this.implicitTransforms=d??this.implicitTransforms,this.keyInfoAttributes=p??this.keyInfoAttributes,this.getKeyInfoContent=h??this.getKeyInfoContent,this.getCertFromKeyInfo=g??Dn.noop,this.CanonicalizationAlgorithms,this.HashAlgorithms,this.SignatureAlgorithms}enableHMAC(){this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#hmac-sha1":qs.HmacSha1},this.getKeyInfoContent=Dn.noop}static getKeyInfoContent({publicCert:e,prefix:n}){if(e==null)return null;n=n?`${n}:`:"";let r="";Buffer.isBuffer(e)&&(e=e.toString("latin1"));let i=[];return typeof e=="string"&&(i=e.match(Oe.EXTRACT_X509_CERTS)||[]),i.length>0&&(r=i.map(o=>`<${n}X509Certificate>${Oe.pemToDer(o).toString("base64")}</${n}X509Certificate>`).join("")),`<${n}X509Data>${r}</${n}X509Data>`}static getCertFromKeyInfo(e){if(e!=null){const n=Mt.select1(".//*[local-name(.)='X509Certificate']",e);if(zt.isNodeLike(n))return Oe.derToPem(n.textContent??"","CERTIFICATE")}return null}checkSignature(e,n){if(n!=null&&typeof n!="function")throw new Error("Last parameter must be a callback function");this.signedXml=e;const r=new Cr.DOMParser().parseFromString(e);this.references=[];const i=this.getCanonSignedInfoXml(r);if(!i){if(n){n(new Error("Canonical signed info cannot be empty"),!1);return}throw new Error("Canonical signed info cannot be empty")}const c=new Cr.DOMParser().parseFromString(i,"text/xml").documentElement;if(!c){if(n){n(new Error("Could not parse unverifiedSignedInfoCanon into a document"),!1);return}throw new Error("Could not parse unverifiedSignedInfoCanon into a document")}const l=Oe.findChildren(c,"Reference");if(!Oe.isArrayHasLength(l)){if(n){n(new Error("could not find any Reference elements"),!1);return}throw new Error("could not find any Reference elements")}for(const h of l)this.loadReference(h);if(!this.getReferences().every(h=>this.validateReference(h,r))){if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error("Could not validate all references"),!1);return}return!1}const u=this.findSignatureAlgorithm(this.signatureAlgorithm),d=this.getCertFromKeyInfo(this.keyInfo)||this.publicCert||this.privateKey;if(d==null)throw new Error("KeyInfo or publicCert or privateKey is required to validate signature");if(u.verifySignature(i,d,this.signatureValue)===!0)if(n)n(null,!0);else return!0;else if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`));return}else throw new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`)}getCanonSignedInfoXml(e){if(this.signatureNode==null)throw new Error("No signature found.");if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to get signed info for XML");const n=Oe.findChildren(this.signatureNode,"SignedInfo");if(n.length===0)throw new Error("could not find SignedInfo element in the message");if(n.length>1)throw new Error("could not get canonicalized signed info for a signature that contains multiple SignedInfo nodes");if((this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(!e||typeof e!="object"))throw new Error("When canonicalization method is non-exclusive, whole xml dom must be provided as an argument");const i={ancestorNamespaces:Oe.findAncestorNs(e,"//*[local-name()='SignedInfo']")};return this.getCanonXml([this.canonicalizationAlgorithm],n[0],i)}getCanonReferenceXml(e,n,r){Array.isArray(n.transforms)&&(n.ancestorNamespaces=Oe.findAncestorNs(e,n.xpath,this.namespaceResolver));const i={inclusiveNamespacesPrefixList:n.inclusiveNamespacesPrefixList,ancestorNamespaces:n.ancestorNamespaces};return this.getCanonXml(n.transforms,r,i)}calculateSignatureValue(e,n){const r=this.getCanonSignedInfoXml(e),i=this.findSignatureAlgorithm(this.signatureAlgorithm);if(this.privateKey==null)throw new Error("Private key is required to compute signature");typeof n=="function"?i.getSignature(r,this.privateKey,n):this.signatureValue=i.getSignature(r,this.privateKey)}findSignatureAlgorithm(e){if(e==null)throw new Error("signatureAlgorithm is required");const n=this.SignatureAlgorithms[e];if(n)return new n;throw new Error(`signature algorithm '${e}' is not supported`)}findCanonicalizationAlgorithm(e){if(e!=null){const n=this.CanonicalizationAlgorithms[e];if(n)return new n}throw new Error(`canonicalization algorithm '${e}' is not supported`)}findHashAlgorithm(e){const n=this.HashAlgorithms[e];if(n)return new n;throw new Error(`hash algorithm '${e}' is not supported`)}validateElementAgainstReferences(e,n){var i;let r;if(typeof e=="string"){const o=Mt.select1(e,n);zt.assertIsElementNode(o),r=o}else r=e;for(const o of this.getReferences()){const c=((i=o.uri)==null?void 0:i[0])==="#"?o.uri.substring(1):o.uri;for(const p of this.idAttributes){const h=r.getAttribute(p);if(c===h){o.xpath=`//*[@*[local-name(.)='${p}']='${c}']`;break}}const l=this.getCanonReferenceXml(n,o,r),d=this.findHashAlgorithm(o.digestAlgorithm).getHash(l);if(Oe.validateDigestValue(d,o.digestValue))return o}throw new Error("No references passed validation")}validateReference(e,n){var u;const r=((u=e.uri)==null?void 0:u[0])==="#"?e.uri.substring(1):e.uri;let i=null;if(r==="")i=Mt.select1("//*",n);else{if((r==null?void 0:r.indexOf("'"))!==-1)throw new Error("Cannot validate a uri with quotes inside it");{let d=0;for(const p of this.idAttributes){const h=`//*[@*[local-name(.)='${p}']='${r}']`,g=Mt.select(h,n);if(Oe.isArrayHasLength(g)){if(d+=g.length,d>1)throw new Error("Cannot validate a document which contains multiple elements with the same value for the ID / Id / Id attributes, in order to prevent signature wrapping attack.");i=g[0],e.xpath=h}}}}if(e.getValidatedNode=(0,PE.deprecate)(d=>{if(d=d||e.xpath,typeof d!="string"||e.validationError!=null)return null;const p=Mt.select1(d,n);return zt.isNodeLike(p)?p:null},"`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead."),!zt.isNodeLike(i)){const d=new Error(`invalid signature: the signature references an element with uri ${e.uri} but could not find such element in the xml`);return e.validationError=d,!1}const o=this.getCanonReferenceXml(n,e,i),l=this.findHashAlgorithm(e.digestAlgorithm).getHash(o);if(!Oe.validateDigestValue(l,e.digestValue)){const d=new Error(`invalid signature: for uri ${e.uri} calculated digest is ${l} but the xml to validate supplies digest ${e.digestValue}`);return e.validationError=d,!1}return this.signedReferences.push(o),e.signedReference=o,!0}findSignatures(e){const n=Mt.select("//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return zt.isArrayOfNodes(n)?n:[]}loadSignature(e){typeof e=="string"?this.signatureNode=e=new Cr.DOMParser().parseFromString(e):this.signatureNode=e,this.signatureXml=e.toString();const n=Mt.select1(".//*[local-name(.)='CanonicalizationMethod']/@Algorithm",e);if(!zt.isNodeLike(n))throw new Error("could not find CanonicalizationMethod/@Algorithm element");zt.isAttributeNode(n)&&(this.canonicalizationAlgorithm=n.value);const r=Mt.select1(".//*[local-name(.)='SignatureMethod']/@Algorithm",e);zt.isAttributeNode(r)&&(this.signatureAlgorithm=r.value);const i=Oe.findChildren(this.signatureNode,"SignedInfo");if(!Oe.isArrayHasLength(i))throw new Error("no signed info node found");if(i.length>1)throw new Error("could not load signature that contains multiple SignedInfo nodes");let o=this.canonicalizationAlgorithm;(!o||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(o="http://www.w3.org/2001/10/xml-exc-c14n#");const c=this.getCanonXml([o],i[0]),u=new Cr.DOMParser().parseFromString(c,"text/xml").documentElement;this.references=[];const d=Oe.findChildren(u,"Reference");if(!Oe.isArrayHasLength(d))throw new Error("could not find any Reference elements");for(const g of d)this.loadReference(g);const p=Mt.select1(".//*[local-name(.)='SignatureValue']/text()",e);zt.isTextNode(p)&&(this.signatureValue=p.data.replace(/\r?\n/g,""));const h=Mt.select1(".//*[local-name(.)='KeyInfo']",e);zt.isNodeLike(h)&&(this.keyInfo=h)}loadReference(e){let n=Oe.findChildren(e,"DigestMethod");if(n.length===0)throw new Error(`could not find DigestMethod in reference ${e.toString()}`);const r=n[0],i=Oe.findAttr(r,"Algorithm");if(!i)throw new Error(`could not find Algorithm attribute in node ${r.toString()}`);const o=i.value;if(n=Oe.findChildren(e,"DigestValue"),n.length===0)throw new Error(`could not find DigestValue node in reference ${e.toString()}`);if(n.length>1)throw new Error(`could not load reference for a node that contains multiple DigestValue nodes: ${e.toString()}`);const c=n[0].textContent;if(!c)throw new Error(`could not find the value of DigestValue in ${e.toString()}`);const l=[];let u=[];if(n=Oe.findChildren(e,"Transforms"),n.length!==0){const p=n[0],h=Oe.findChildren(p,"Transform");for(const A of h){const _=Oe.findAttr(A,"Algorithm");_&&l.push(_.value)}const g=Oe.findChildren(h[h.length-1],"InclusiveNamespaces");Oe.isArrayHasLength(g)&&(u=g.flatMap(A=>(A.getAttribute("PrefixList")??"").split(" ")).filter(A=>A.length>0))}Oe.isArrayHasLength(this.implicitTransforms)&&this.implicitTransforms.forEach(function(p){l.push(p)}),(l.length===0||l[l.length-1]==="http://www.w3.org/2000/09/xmldsig#enveloped-signature")&&l.push("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");const d=zt.isElementNode(e)&&e.getAttribute("URI")||void 0;this.addReference({transforms:l,digestAlgorithm:o,uri:d,digestValue:c,inclusiveNamespacesPrefixList:u,isEmptyUri:!1})}addReference({xpath:e,transforms:n,digestAlgorithm:r,uri:i="",digestValue:o,inclusiveNamespacesPrefixList:c=[],isEmptyUri:l=!1}){if(r==null)throw new Error("digestAlgorithm is required");if(!Oe.isArrayHasLength(n))throw new Error("transforms must contain at least one transform algorithm");this.references.push({xpath:e,transforms:n,digestAlgorithm:r,uri:i,digestValue:o,inclusiveNamespacesPrefixList:c,isEmptyUri:l,getValidatedNode:()=>{throw new Error("Reference has not been validated yet; Did you call `sig.checkSignature()`?")}})}getReferences(){return this.references}getSignedReferences(){return[...this.signedReferences]}computeSignature(e,n,r){let i;typeof n=="function"&&r==null?(i=n,n={}):(i=r,n=n??{});const o=new Cr.DOMParser().parseFromString(e);let c="xmlns";const l=[];let u;const d=["append","prepend","before","after"],p=n.prefix,h=n.attrs||{},g=n.location||{},A=n.existingPrefixes||{};if(this.namespaceResolver={lookupNamespaceURI:function(H){return H?A[H]:null}},g.reference=g.reference||"/*",g.action=g.action||"append",d.indexOf(g.action)===-1){const H=new Error(`location.action option has an invalid action: ${g.action}, must be any of the following values: ${d.join(", ")}`);if(i){i(H);return}else throw H}p?(c+=`:${p}`,u=`${p}:`):u="",Object.keys(h).forEach(function(H){H!=="xmlns"&&H!==c&&l.push(`${H}="${h[H]}"`)}),l.push(`${c}="http://www.w3.org/2000/09/xmldsig#"`);let _=`<${u}Signature ${l.join(" ")}>`;_+=this.createSignedInfo(o,p),_+=this.getKeyInfo(p),_+=`</${u}Signature>`,this.originalXmlWithIds=o.toString();let $="";Object.keys(A).forEach(function(H){$+=`xmlns:${H}="${A[H]}" `});const S=`<Dummy ${$}>${_}</Dummy>`,b=new Cr.DOMParser().parseFromString(S).documentElement.firstChild,T=Mt.select1(g.reference,o);if(!zt.isNodeLike(T)){const H=new Error(`the following xpath cannot be used because it was not found: ${g.reference}`);if(i){i(H);return}else throw H}if(g.action==="append")T.appendChild(b);else if(g.action==="prepend")T.insertBefore(b,T.firstChild);else if(g.action==="before"){if(T.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");T.parentNode.insertBefore(b,T)}else if(g.action==="after"){if(T.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");T.parentNode.insertBefore(b,T.nextSibling)}this.signatureNode=b;const M=Oe.findChildren(this.signatureNode,"SignedInfo");if(M.length===0){const H=new Error("could not find SignedInfo element in the message");if(i){i(H);return}else throw H}const U=M[0];typeof i=="function"?this.calculateSignatureValue(o,(H,W)=>{H?i(H):(this.signatureValue=W||"",b.insertBefore(this.createSignature(p),U.nextSibling),this.signatureXml=b.toString(),this.signedXml=o.toString(),i(null,this))}):(this.calculateSignatureValue(o),b.insertBefore(this.createSignature(p),U.nextSibling),this.signatureXml=b.toString(),this.signedXml=o.toString())}getKeyInfo(e){const n=e?`${e}:`:"";let r="";this.keyInfoAttributes&&Object.keys(this.keyInfoAttributes).forEach(o=>{r+=` ${o}="${this.keyInfoAttributes[o]}"`});const i=this.getKeyInfoContent({publicCert:this.publicCert,prefix:e});return r||i?`<${n}KeyInfo${r}>${i}</${n}KeyInfo>`:""}createReferences(e,n){let r="";n=n||"",n=n&&`${n}:`;for(const i of this.getReferences()){const o=Mt.selectWithResolver(i.xpath??"",e,this.namespaceResolver);if(!Oe.isArrayHasLength(o))throw new Error(`the following xpath cannot be signed because it was not found: ${i.xpath}`);for(const c of o){if(i.isEmptyUri)r+=`<${n}Reference URI="">`;else{const d=this.ensureHasId(c);i.uri=d,r+=`<${n}Reference URI="#${d}">`}r+=`<${n}Transforms>`;for(const d of i.transforms||[]){const p=this.findCanonicalizationAlgorithm(d);r+=`<${n}Transform Algorithm="${p.getAlgorithmName()}"`,Oe.isArrayHasLength(i.inclusiveNamespacesPrefixList)?(r+=">",r+=`<InclusiveNamespaces PrefixList="${i.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${p.getAlgorithmName()}"/>`,r+=`</${n}Transform>`):r+=" />"}const l=this.getCanonReferenceXml(e,i,c),u=this.findHashAlgorithm(i.digestAlgorithm);r+=`</${n}Transforms><${n}DigestMethod Algorithm="${u.getAlgorithmName()}" /><${n}DigestValue>${u.getHash(l)}</${n}DigestValue></${n}Reference>`}}return r}getCanonXml(e,n,r={}){r.defaultNsForPrefix=r.defaultNsForPrefix??Dn.defaultNsForPrefix,r.signatureNode=this.signatureNode;let o=n.cloneNode(!0);return e.forEach(c=>{zt.isNodeLike(o)&&(o=this.findCanonicalizationAlgorithm(c).process(o,r))}),o.toString()}ensureHasId(e){let n;if(this.idMode==="wssecurity"?n=Oe.findAttr(e,"Id","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"):this.idAttributes.some(i=>(n=Oe.findAttr(e,i),!!n)),n)return n.value;const r=`_${this.id++}`;return this.idMode==="wssecurity"?(e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:wsu","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"),e.setAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd","wsu:Id",r)):e.setAttribute("Id",r),r}createSignedInfo(e,n){if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to create signed info for XML");const r=this.findCanonicalizationAlgorithm(this.canonicalizationAlgorithm),i=this.findSignatureAlgorithm(this.signatureAlgorithm);let o;o=n||"",o=o&&`${o}:`;let c=`<${o}SignedInfo>`;return c+=`<${o}CanonicalizationMethod Algorithm="${r.getAlgorithmName()}"`,Oe.isArrayHasLength(this.inclusiveNamespacesPrefixList)?(c+=">",c+=`<InclusiveNamespaces PrefixList="${this.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${r.getAlgorithmName()}"/>`,c+=`</${o}CanonicalizationMethod>`):c+=" />",c+=`<${o}SignatureMethod Algorithm="${i.getAlgorithmName()}" />`,c+=this.createReferences(e,n),c+=`</${o}SignedInfo>`,c}createSignature(e){let n="xmlns";e?(n+=`:${e}`,e+=":"):e="";const r=`<${e}SignatureValue>${this.signatureValue}</${e}SignatureValue>`,i=`<${e}Signature ${n}="http://www.w3.org/2000/09/xmldsig#">${r}</${e}Signature>`;return new Cr.DOMParser().parseFromString(i).documentElement.firstChild}getSignatureXml(){return this.signatureXml}getOriginalXmlWithIds(){return this.originalXmlWithIds}getSignedXml(){return this.signedXml}}Al.SignedXml=Dn;Dn.defaultNsForPrefix={ds:"http://www.w3.org/2000/09/xmldsig#"};Dn.noop=()=>null;(function(t){var e=cr&&cr.__createBinding||(Object.create?function(c,l,u,d){d===void 0&&(d=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(c,d,p)}:function(c,l,u,d){d===void 0&&(d=u),c[d]=l[u]}),n=cr&&cr.__exportStar||function(c,l){for(var u in c)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,c,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.SignedXml=t.ExclusiveCanonicalizationWithComments=t.ExclusiveCanonicalization=t.C14nCanonicalizationWithComments=t.C14nCanonicalization=void 0;var r=Qr;Object.defineProperty(t,"C14nCanonicalization",{enumerable:!0,get:function(){return r.C14nCanonicalization}}),Object.defineProperty(t,"C14nCanonicalizationWithComments",{enumerable:!0,get:function(){return r.C14nCanonicalizationWithComments}});var i=ei;Object.defineProperty(t,"ExclusiveCanonicalization",{enumerable:!0,get:function(){return i.ExclusiveCanonicalization}}),Object.defineProperty(t,"ExclusiveCanonicalizationWithComments",{enumerable:!0,get:function(){return i.ExclusiveCanonicalizationWithComments}});var o=Al;Object.defineProperty(t,"SignedXml",{enumerable:!0,get:function(){return o.SignedXml}}),n(Cs,t),n(As,t)})(I8);async function jE(t){const e=new DecompressionStream("deflate-raw"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}async function LE(t){const e=await r2.decode(t.replace(/ /g,"+"));try{const n=await jE(e);return new TextDecoder().decode(n)}catch(n){return console.warn("Decompression failed, assuming data is not compressed:",n),new TextDecoder().decode(e)}}async function FE(t){const e=await LE(t),r=new hp.XMLParser({attributeNamePrefix:"@_",alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(e);return k8.parse(r)}function UE(t){const e=[{":@":{"@_entityID":t.entityId,"@_xmlns":"urn:oasis:names:tc:SAML:2.0:metadata"},EntityDescriptor:[{":@":{"@_protocolSupportEnumeration":"urn:oasis:names:tc:SAML:2.0:protocol"},IDPSSODescriptor:[{":@":{"@_use":"signing"},KeyDescriptor:[{":@":{"@_xmlns":"http://www.w3.org/2000/09/xmldsig#"},KeyInfo:[{X509Data:[{X509Certificate:[{"#text":t.cert}]}]}]}]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"}]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"E-Mail Address","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Given Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Surname","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name ID","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]}]}]}];return new hp.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0,format:!0}).build(e)}const ME=new s.OpenAPIHono().openapi(s.createRoute({tags:["saml"],method:"get",path:"/metadata/{client_id}",request:{params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.z.string()}}},400:{description:"Bad Request"}}}),async t=>{var l,u;const{client_id:e}=t.req.valid("param"),n=await t.env.data.clients.get(e);if(!n)throw new R(404,{message:"Client not found"});const[r]=await t.env.data.keys.list();if(!r)throw new R(500,{message:"No signing key found"});const i=new pl(r.cert),o=t.env.ISSUER,c=UE({entityId:((u=(l=n.addons)==null?void 0:l.samlp)==null?void 0:u.audience)||n.id,cert:i.toString("base64"),assertionConsumerServiceUrl:`${o}samlp/${e}`,singleLogoutServiceUrl:`${o}samlp/${e}/logout`});return new Response(c,{headers:{"Content-Type":"text/xml"}})}).openapi(s.createRoute({tags:["saml"],method:"get",path:"/{client_id}",request:{query:s.z.object({SAMLRequest:s.z.string(),RelayState:s.z.string().optional(),SigAlg:s.z.string().optional(),Signature:s.z.string().optional()}),params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.z.string()}}},400:{description:"Bad Request"}}}),async t=>{const{client_id:e}=t.req.valid("param"),{SAMLRequest:n,RelayState:r}=t.req.valid("query"),i=await FE(n),o=i["samlp:AuthnRequest"]["saml:Issuer"]["#text"],c=await t.env.data.loginSessions.create(t.var.tenant_id,{csrf_token:qe(),authParams:{client_id:e,state:JSON.stringify({requestId:i["samlp:AuthnRequest"]["@_ID"],relayState:r}),response_mode:vn.SAML_POST,redirect_uri:i["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"],audience:o},expires_at:new Date(Date.now()+ki*1e3).toISOString(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:yr(t.get("auth0_client"))});return t.redirect(`/u/login/identifier?state=${c.id}`)});function qE(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Qo(r,t.dataAdapter),c=_l(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=hl(r,c),i()}),e.use(ml).use(gl).use(af(e));const n=e.route("/",ME);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"SAML API"},security:[{oauth2:["openid","email","profile"]}]}),sf(n),n}const VE="Account detected",HE="Account",KE="We have detected that you have already created an account through",GE="By signing in, you agree to our",WE="and",XE="email address",JE="email or phone number",YE="phone number",ZE="Callback URL mismatch",QE="The provided redirect_uri is not in the list of allowed callback URLs.",eS="continue with user",tS="Please click the button to create a new password account.",nS="Enter the code at {{vendorName}} to complete the login",rS="Welcome to {{vendorName}}! {{code}} is the login code",iS="Welcome to {{vendorName}}! {{code}} is the login code",oS="Code expired",sS="Invalid code",aS="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",cS="The code is already used",lS="The code is valid for 30 minutes",uS="Confirm password",dS="Need Help?",pS="Contact us",fS="or continue with social account",hS="Continue with {{provider}}",gS="Would you like to continue with your existing account?",mS="Copyright © 2023 SESAMY. All rights reserved.",_S="©2023 Sesamy",yS="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",wS="Please enter a valid email address.",vS="The passwords didn't match. Try again.",bS="Choose password",xS="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",$S="Create new account",AS="Sign up with password",ES="You are currently logged in as <0>{{email}}</0>",SS="Email",kS="Email changed to <0>{{email}}</0> ",NS="Email or Phone Number",CS="Email address",IS="Your email address has been validated",TS="Now enter your password to login again",OS="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",DS="Email verification sent",zS="Enter a code",RS="We'll send you a verification link to ensure you own this email address.",PS="Enter new email",BS="Enter new password",jS="Enter password",LS="Enter your email address and password to login.",FS="Enter your password",US="The magic link has expired. Please click on the button below to receive a new link in your inbox.",MS="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",qS="Send password reset email",VS="Click the button below and we’ll send instructions on how to reset your password.",HS="Password reset email sent",KS="Forgot password?",GS="Forgot password?",WS="Go back",XS="Hide password",JS="Invalid identifier",YS="Invalid password",ZS=`The link is no longer valid.
284
+ @`+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function um(t,e,n){return typeof t=="string"?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Ns.prototype[t]=function(){return null}});function Us(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Nl.__DOMHandler=Ns;Nl.normalizeLineEndings=Qy;Nl.DOMParser=ew;var tw=er;El.DOMImplementation=tw.DOMImplementation;El.XMLSerializer=tw.XMLSerializer;El.DOMParser=Nl.DOMParser;var Cl={};Object.defineProperty(Cl,"__esModule",{value:!0});Cl.EnvelopedSignature=void 0;const Ms=xl,su=be;class SE{constructor(){this.includeComments=!1,this.includeComments=!1}process(e,n){if(n.signatureNode==null){const o=Ms.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return su.isNodeLike(o)&&o.parentNode&&o.parentNode.removeChild(o),e}const r=n.signatureNode,i=Ms.select1(".//*[local-name(.)='SignatureValue']/text()",r);if(su.isTextNode(i)){const o=i.data,c=Ms.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);for(const l of Array.isArray(c)?c:[]){const u=Ms.select1(".//*[local-name(.)='SignatureValue']/text()",l);if(su.isTextNode(u)){const d=u.data;o===d&&l.parentNode&&l.parentNode.removeChild(l)}}}return e}getAlgorithmName(){return"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}}Cl.EnvelopedSignature=SE;var hr={};Object.defineProperty(hr,"__esModule",{value:!0});hr.Sha512=hr.Sha256=hr.Sha1=void 0;const Uf=_c;class kE{constructor(){this.getHash=function(e){const n=Uf.createHash("sha1");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2000/09/xmldsig#sha1"}}}hr.Sha1=kE;class NE{constructor(){this.getHash=function(e){const n=Uf.createHash("sha256");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha256"}}}hr.Sha256=NE;class CE{constructor(){this.getHash=function(e){const n=Uf.createHash("sha512");return n.update(e,"utf8"),n.digest("base64")},this.getAlgorithmName=function(){return"http://www.w3.org/2001/04/xmlenc#sha512"}}}hr.Sha512=CE;var wn={},Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.createOptionalCallbackFunction=void 0;function IE(t){return typeof t=="function"}function TE(t){return(...e)=>{const n=e[e.length-1];if(IE(n))try{const r=t(...e.slice(0,-1));n(null,r)}catch(r){n(r instanceof Error?r:new Error("Unknown error"))}else return t(...e)}}Cs.createOptionalCallbackFunction=TE;Object.defineProperty(wn,"__esModule",{value:!0});wn.HmacSha1=wn.RsaSha512=wn.RsaSha256=wn.RsaSha1=void 0;const br=_c,xr=Cs;class OE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createSign("RSA-SHA1");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createVerify("RSA-SHA1");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"}}wn.RsaSha1=OE;class DE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createSign("RSA-SHA256");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createVerify("RSA-SHA256");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"}}wn.RsaSha256=DE;class zE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createSign("RSA-SHA512");return r.update(e),r.sign(n,"base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createVerify("RSA-SHA512");return i.update(e),i.verify(n,r,"base64")}),this.getAlgorithmName=()=>"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"}}wn.RsaSha512=zE;class RE{constructor(){this.getSignature=(0,xr.createOptionalCallbackFunction)((e,n)=>{const r=br.createHmac("SHA1",n);return r.update(e),r.digest("base64")}),this.verifySignature=(0,xr.createOptionalCallbackFunction)((e,n,r)=>{const i=br.createHmac("SHA1",n);return i.update(e),i.digest("base64")===r}),this.getAlgorithmName=()=>"http://www.w3.org/2000/09/xmldsig#hmac-sha1"}}wn.HmacSha1=RE;Object.defineProperty(Al,"__esModule",{value:!0});Al.SignedXml=void 0;const zt=be,Cr=El,PE=_c,Mt=xl,dm=Qr,BE=Cl,pm=ei,au=hr,qs=wn,Oe=As;class Dn{constructor(e={}){this.signatureAlgorithm=void 0,this.canonicalizationAlgorithm=void 0,this.inclusiveNamespacesPrefixList=[],this.namespaceResolver={lookupNamespaceURI:function(){throw new Error("Not implemented")}},this.implicitTransforms=[],this.keyInfoAttributes={},this.getKeyInfoContent=Dn.getKeyInfoContent,this.getCertFromKeyInfo=Dn.getCertFromKeyInfo,this.id=0,this.signedXml="",this.signatureXml="",this.signatureNode=null,this.signatureValue="",this.originalXmlWithIds="",this.keyInfo=null,this.references=[],this.signedReferences=[],this.CanonicalizationAlgorithms={"http://www.w3.org/TR/2001/REC-xml-c14n-20010315":dm.C14nCanonicalization,"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":dm.C14nCanonicalizationWithComments,"http://www.w3.org/2001/10/xml-exc-c14n#":pm.ExclusiveCanonicalization,"http://www.w3.org/2001/10/xml-exc-c14n#WithComments":pm.ExclusiveCanonicalizationWithComments,"http://www.w3.org/2000/09/xmldsig#enveloped-signature":BE.EnvelopedSignature},this.HashAlgorithms={"http://www.w3.org/2000/09/xmldsig#sha1":au.Sha1,"http://www.w3.org/2001/04/xmlenc#sha256":au.Sha256,"http://www.w3.org/2001/04/xmlenc#sha512":au.Sha512},this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#rsa-sha1":qs.RsaSha1,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":qs.RsaSha256,"http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":qs.RsaSha512};const{idMode:n,idAttribute:r,privateKey:i,publicCert:o,signatureAlgorithm:c,canonicalizationAlgorithm:l,inclusiveNamespacesPrefixList:u,implicitTransforms:d,keyInfoAttributes:p,getKeyInfoContent:h,getCertFromKeyInfo:g}=e;this.idMode=n,this.idAttributes=["Id","ID","id"],r&&this.idAttributes.unshift(r),this.privateKey=i,this.publicCert=o,this.signatureAlgorithm=c??this.signatureAlgorithm,this.canonicalizationAlgorithm=l,typeof u=="string"?this.inclusiveNamespacesPrefixList=u.split(" "):Oe.isArrayHasLength(u)&&(this.inclusiveNamespacesPrefixList=u),this.implicitTransforms=d??this.implicitTransforms,this.keyInfoAttributes=p??this.keyInfoAttributes,this.getKeyInfoContent=h??this.getKeyInfoContent,this.getCertFromKeyInfo=g??Dn.noop,this.CanonicalizationAlgorithms,this.HashAlgorithms,this.SignatureAlgorithms}enableHMAC(){this.SignatureAlgorithms={"http://www.w3.org/2000/09/xmldsig#hmac-sha1":qs.HmacSha1},this.getKeyInfoContent=Dn.noop}static getKeyInfoContent({publicCert:e,prefix:n}){if(e==null)return null;n=n?`${n}:`:"";let r="";Buffer.isBuffer(e)&&(e=e.toString("latin1"));let i=[];return typeof e=="string"&&(i=e.match(Oe.EXTRACT_X509_CERTS)||[]),i.length>0&&(r=i.map(o=>`<${n}X509Certificate>${Oe.pemToDer(o).toString("base64")}</${n}X509Certificate>`).join("")),`<${n}X509Data>${r}</${n}X509Data>`}static getCertFromKeyInfo(e){if(e!=null){const n=Mt.select1(".//*[local-name(.)='X509Certificate']",e);if(zt.isNodeLike(n))return Oe.derToPem(n.textContent??"","CERTIFICATE")}return null}checkSignature(e,n){if(n!=null&&typeof n!="function")throw new Error("Last parameter must be a callback function");this.signedXml=e;const r=new Cr.DOMParser().parseFromString(e);this.references=[];const i=this.getCanonSignedInfoXml(r);if(!i){if(n){n(new Error("Canonical signed info cannot be empty"),!1);return}throw new Error("Canonical signed info cannot be empty")}const c=new Cr.DOMParser().parseFromString(i,"text/xml").documentElement;if(!c){if(n){n(new Error("Could not parse unverifiedSignedInfoCanon into a document"),!1);return}throw new Error("Could not parse unverifiedSignedInfoCanon into a document")}const l=Oe.findChildren(c,"Reference");if(!Oe.isArrayHasLength(l)){if(n){n(new Error("could not find any Reference elements"),!1);return}throw new Error("could not find any Reference elements")}for(const h of l)this.loadReference(h);if(!this.getReferences().every(h=>this.validateReference(h,r))){if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error("Could not validate all references"),!1);return}return!1}const u=this.findSignatureAlgorithm(this.signatureAlgorithm),d=this.getCertFromKeyInfo(this.keyInfo)||this.publicCert||this.privateKey;if(d==null)throw new Error("KeyInfo or publicCert or privateKey is required to validate signature");if(u.verifySignature(i,d,this.signatureValue)===!0)if(n)n(null,!0);else return!0;else if(this.signedReferences=[],this.references.forEach(h=>{h.signedReference=void 0}),n){n(new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`));return}else throw new Error(`invalid signature: the signature value ${this.signatureValue} is incorrect`)}getCanonSignedInfoXml(e){if(this.signatureNode==null)throw new Error("No signature found.");if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to get signed info for XML");const n=Oe.findChildren(this.signatureNode,"SignedInfo");if(n.length===0)throw new Error("could not find SignedInfo element in the message");if(n.length>1)throw new Error("could not get canonicalized signed info for a signature that contains multiple SignedInfo nodes");if((this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||this.canonicalizationAlgorithm==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(!e||typeof e!="object"))throw new Error("When canonicalization method is non-exclusive, whole xml dom must be provided as an argument");const i={ancestorNamespaces:Oe.findAncestorNs(e,"//*[local-name()='SignedInfo']")};return this.getCanonXml([this.canonicalizationAlgorithm],n[0],i)}getCanonReferenceXml(e,n,r){Array.isArray(n.transforms)&&(n.ancestorNamespaces=Oe.findAncestorNs(e,n.xpath,this.namespaceResolver));const i={inclusiveNamespacesPrefixList:n.inclusiveNamespacesPrefixList,ancestorNamespaces:n.ancestorNamespaces};return this.getCanonXml(n.transforms,r,i)}calculateSignatureValue(e,n){const r=this.getCanonSignedInfoXml(e),i=this.findSignatureAlgorithm(this.signatureAlgorithm);if(this.privateKey==null)throw new Error("Private key is required to compute signature");typeof n=="function"?i.getSignature(r,this.privateKey,n):this.signatureValue=i.getSignature(r,this.privateKey)}findSignatureAlgorithm(e){if(e==null)throw new Error("signatureAlgorithm is required");const n=this.SignatureAlgorithms[e];if(n)return new n;throw new Error(`signature algorithm '${e}' is not supported`)}findCanonicalizationAlgorithm(e){if(e!=null){const n=this.CanonicalizationAlgorithms[e];if(n)return new n}throw new Error(`canonicalization algorithm '${e}' is not supported`)}findHashAlgorithm(e){const n=this.HashAlgorithms[e];if(n)return new n;throw new Error(`hash algorithm '${e}' is not supported`)}validateElementAgainstReferences(e,n){var i;let r;if(typeof e=="string"){const o=Mt.select1(e,n);zt.assertIsElementNode(o),r=o}else r=e;for(const o of this.getReferences()){const c=((i=o.uri)==null?void 0:i[0])==="#"?o.uri.substring(1):o.uri;for(const p of this.idAttributes){const h=r.getAttribute(p);if(c===h){o.xpath=`//*[@*[local-name(.)='${p}']='${c}']`;break}}const l=this.getCanonReferenceXml(n,o,r),d=this.findHashAlgorithm(o.digestAlgorithm).getHash(l);if(Oe.validateDigestValue(d,o.digestValue))return o}throw new Error("No references passed validation")}validateReference(e,n){var u;const r=((u=e.uri)==null?void 0:u[0])==="#"?e.uri.substring(1):e.uri;let i=null;if(r==="")i=Mt.select1("//*",n);else{if((r==null?void 0:r.indexOf("'"))!==-1)throw new Error("Cannot validate a uri with quotes inside it");{let d=0;for(const p of this.idAttributes){const h=`//*[@*[local-name(.)='${p}']='${r}']`,g=Mt.select(h,n);if(Oe.isArrayHasLength(g)){if(d+=g.length,d>1)throw new Error("Cannot validate a document which contains multiple elements with the same value for the ID / Id / Id attributes, in order to prevent signature wrapping attack.");i=g[0],e.xpath=h}}}}if(e.getValidatedNode=(0,PE.deprecate)(d=>{if(d=d||e.xpath,typeof d!="string"||e.validationError!=null)return null;const p=Mt.select1(d,n);return zt.isNodeLike(p)?p:null},"`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead."),!zt.isNodeLike(i)){const d=new Error(`invalid signature: the signature references an element with uri ${e.uri} but could not find such element in the xml`);return e.validationError=d,!1}const o=this.getCanonReferenceXml(n,e,i),l=this.findHashAlgorithm(e.digestAlgorithm).getHash(o);if(!Oe.validateDigestValue(l,e.digestValue)){const d=new Error(`invalid signature: for uri ${e.uri} calculated digest is ${l} but the xml to validate supplies digest ${e.digestValue}`);return e.validationError=d,!1}return this.signedReferences.push(o),e.signedReference=o,!0}findSignatures(e){const n=Mt.select("//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",e);return zt.isArrayOfNodes(n)?n:[]}loadSignature(e){typeof e=="string"?this.signatureNode=e=new Cr.DOMParser().parseFromString(e):this.signatureNode=e,this.signatureXml=e.toString();const n=Mt.select1(".//*[local-name(.)='CanonicalizationMethod']/@Algorithm",e);if(!zt.isNodeLike(n))throw new Error("could not find CanonicalizationMethod/@Algorithm element");zt.isAttributeNode(n)&&(this.canonicalizationAlgorithm=n.value);const r=Mt.select1(".//*[local-name(.)='SignatureMethod']/@Algorithm",e);zt.isAttributeNode(r)&&(this.signatureAlgorithm=r.value);const i=Oe.findChildren(this.signatureNode,"SignedInfo");if(!Oe.isArrayHasLength(i))throw new Error("no signed info node found");if(i.length>1)throw new Error("could not load signature that contains multiple SignedInfo nodes");let o=this.canonicalizationAlgorithm;(!o||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"||o==="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")&&(o="http://www.w3.org/2001/10/xml-exc-c14n#");const c=this.getCanonXml([o],i[0]),u=new Cr.DOMParser().parseFromString(c,"text/xml").documentElement;this.references=[];const d=Oe.findChildren(u,"Reference");if(!Oe.isArrayHasLength(d))throw new Error("could not find any Reference elements");for(const g of d)this.loadReference(g);const p=Mt.select1(".//*[local-name(.)='SignatureValue']/text()",e);zt.isTextNode(p)&&(this.signatureValue=p.data.replace(/\r?\n/g,""));const h=Mt.select1(".//*[local-name(.)='KeyInfo']",e);zt.isNodeLike(h)&&(this.keyInfo=h)}loadReference(e){let n=Oe.findChildren(e,"DigestMethod");if(n.length===0)throw new Error(`could not find DigestMethod in reference ${e.toString()}`);const r=n[0],i=Oe.findAttr(r,"Algorithm");if(!i)throw new Error(`could not find Algorithm attribute in node ${r.toString()}`);const o=i.value;if(n=Oe.findChildren(e,"DigestValue"),n.length===0)throw new Error(`could not find DigestValue node in reference ${e.toString()}`);if(n.length>1)throw new Error(`could not load reference for a node that contains multiple DigestValue nodes: ${e.toString()}`);const c=n[0].textContent;if(!c)throw new Error(`could not find the value of DigestValue in ${e.toString()}`);const l=[];let u=[];if(n=Oe.findChildren(e,"Transforms"),n.length!==0){const p=n[0],h=Oe.findChildren(p,"Transform");for(const A of h){const _=Oe.findAttr(A,"Algorithm");_&&l.push(_.value)}const g=Oe.findChildren(h[h.length-1],"InclusiveNamespaces");Oe.isArrayHasLength(g)&&(u=g.flatMap(A=>(A.getAttribute("PrefixList")??"").split(" ")).filter(A=>A.length>0))}Oe.isArrayHasLength(this.implicitTransforms)&&this.implicitTransforms.forEach(function(p){l.push(p)}),(l.length===0||l[l.length-1]==="http://www.w3.org/2000/09/xmldsig#enveloped-signature")&&l.push("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");const d=zt.isElementNode(e)&&e.getAttribute("URI")||void 0;this.addReference({transforms:l,digestAlgorithm:o,uri:d,digestValue:c,inclusiveNamespacesPrefixList:u,isEmptyUri:!1})}addReference({xpath:e,transforms:n,digestAlgorithm:r,uri:i="",digestValue:o,inclusiveNamespacesPrefixList:c=[],isEmptyUri:l=!1}){if(r==null)throw new Error("digestAlgorithm is required");if(!Oe.isArrayHasLength(n))throw new Error("transforms must contain at least one transform algorithm");this.references.push({xpath:e,transforms:n,digestAlgorithm:r,uri:i,digestValue:o,inclusiveNamespacesPrefixList:c,isEmptyUri:l,getValidatedNode:()=>{throw new Error("Reference has not been validated yet; Did you call `sig.checkSignature()`?")}})}getReferences(){return this.references}getSignedReferences(){return[...this.signedReferences]}computeSignature(e,n,r){let i;typeof n=="function"&&r==null?(i=n,n={}):(i=r,n=n??{});const o=new Cr.DOMParser().parseFromString(e);let c="xmlns";const l=[];let u;const d=["append","prepend","before","after"],p=n.prefix,h=n.attrs||{},g=n.location||{},A=n.existingPrefixes||{};if(this.namespaceResolver={lookupNamespaceURI:function(H){return H?A[H]:null}},g.reference=g.reference||"/*",g.action=g.action||"append",d.indexOf(g.action)===-1){const H=new Error(`location.action option has an invalid action: ${g.action}, must be any of the following values: ${d.join(", ")}`);if(i){i(H);return}else throw H}p?(c+=`:${p}`,u=`${p}:`):u="",Object.keys(h).forEach(function(H){H!=="xmlns"&&H!==c&&l.push(`${H}="${h[H]}"`)}),l.push(`${c}="http://www.w3.org/2000/09/xmldsig#"`);let _=`<${u}Signature ${l.join(" ")}>`;_+=this.createSignedInfo(o,p),_+=this.getKeyInfo(p),_+=`</${u}Signature>`,this.originalXmlWithIds=o.toString();let $="";Object.keys(A).forEach(function(H){$+=`xmlns:${H}="${A[H]}" `});const S=`<Dummy ${$}>${_}</Dummy>`,b=new Cr.DOMParser().parseFromString(S).documentElement.firstChild,T=Mt.select1(g.reference,o);if(!zt.isNodeLike(T)){const H=new Error(`the following xpath cannot be used because it was not found: ${g.reference}`);if(i){i(H);return}else throw H}if(g.action==="append")T.appendChild(b);else if(g.action==="prepend")T.insertBefore(b,T.firstChild);else if(g.action==="before"){if(T.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");T.parentNode.insertBefore(b,T)}else if(g.action==="after"){if(T.parentNode==null)throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");T.parentNode.insertBefore(b,T.nextSibling)}this.signatureNode=b;const M=Oe.findChildren(this.signatureNode,"SignedInfo");if(M.length===0){const H=new Error("could not find SignedInfo element in the message");if(i){i(H);return}else throw H}const U=M[0];typeof i=="function"?this.calculateSignatureValue(o,(H,W)=>{H?i(H):(this.signatureValue=W||"",b.insertBefore(this.createSignature(p),U.nextSibling),this.signatureXml=b.toString(),this.signedXml=o.toString(),i(null,this))}):(this.calculateSignatureValue(o),b.insertBefore(this.createSignature(p),U.nextSibling),this.signatureXml=b.toString(),this.signedXml=o.toString())}getKeyInfo(e){const n=e?`${e}:`:"";let r="";this.keyInfoAttributes&&Object.keys(this.keyInfoAttributes).forEach(o=>{r+=` ${o}="${this.keyInfoAttributes[o]}"`});const i=this.getKeyInfoContent({publicCert:this.publicCert,prefix:e});return r||i?`<${n}KeyInfo${r}>${i}</${n}KeyInfo>`:""}createReferences(e,n){let r="";n=n||"",n=n&&`${n}:`;for(const i of this.getReferences()){const o=Mt.selectWithResolver(i.xpath??"",e,this.namespaceResolver);if(!Oe.isArrayHasLength(o))throw new Error(`the following xpath cannot be signed because it was not found: ${i.xpath}`);for(const c of o){if(i.isEmptyUri)r+=`<${n}Reference URI="">`;else{const d=this.ensureHasId(c);i.uri=d,r+=`<${n}Reference URI="#${d}">`}r+=`<${n}Transforms>`;for(const d of i.transforms||[]){const p=this.findCanonicalizationAlgorithm(d);r+=`<${n}Transform Algorithm="${p.getAlgorithmName()}"`,Oe.isArrayHasLength(i.inclusiveNamespacesPrefixList)?(r+=">",r+=`<InclusiveNamespaces PrefixList="${i.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${p.getAlgorithmName()}"/>`,r+=`</${n}Transform>`):r+=" />"}const l=this.getCanonReferenceXml(e,i,c),u=this.findHashAlgorithm(i.digestAlgorithm);r+=`</${n}Transforms><${n}DigestMethod Algorithm="${u.getAlgorithmName()}" /><${n}DigestValue>${u.getHash(l)}</${n}DigestValue></${n}Reference>`}}return r}getCanonXml(e,n,r={}){r.defaultNsForPrefix=r.defaultNsForPrefix??Dn.defaultNsForPrefix,r.signatureNode=this.signatureNode;let o=n.cloneNode(!0);return e.forEach(c=>{zt.isNodeLike(o)&&(o=this.findCanonicalizationAlgorithm(c).process(o,r))}),o.toString()}ensureHasId(e){let n;if(this.idMode==="wssecurity"?n=Oe.findAttr(e,"Id","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"):this.idAttributes.some(i=>(n=Oe.findAttr(e,i),!!n)),n)return n.value;const r=`_${this.id++}`;return this.idMode==="wssecurity"?(e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:wsu","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"),e.setAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd","wsu:Id",r)):e.setAttribute("Id",r),r}createSignedInfo(e,n){if(typeof this.canonicalizationAlgorithm!="string")throw new Error("Missing canonicalizationAlgorithm when trying to create signed info for XML");const r=this.findCanonicalizationAlgorithm(this.canonicalizationAlgorithm),i=this.findSignatureAlgorithm(this.signatureAlgorithm);let o;o=n||"",o=o&&`${o}:`;let c=`<${o}SignedInfo>`;return c+=`<${o}CanonicalizationMethod Algorithm="${r.getAlgorithmName()}"`,Oe.isArrayHasLength(this.inclusiveNamespacesPrefixList)?(c+=">",c+=`<InclusiveNamespaces PrefixList="${this.inclusiveNamespacesPrefixList.join(" ")}" xmlns="${r.getAlgorithmName()}"/>`,c+=`</${o}CanonicalizationMethod>`):c+=" />",c+=`<${o}SignatureMethod Algorithm="${i.getAlgorithmName()}" />`,c+=this.createReferences(e,n),c+=`</${o}SignedInfo>`,c}createSignature(e){let n="xmlns";e?(n+=`:${e}`,e+=":"):e="";const r=`<${e}SignatureValue>${this.signatureValue}</${e}SignatureValue>`,i=`<${e}Signature ${n}="http://www.w3.org/2000/09/xmldsig#">${r}</${e}Signature>`;return new Cr.DOMParser().parseFromString(i).documentElement.firstChild}getSignatureXml(){return this.signatureXml}getOriginalXmlWithIds(){return this.originalXmlWithIds}getSignedXml(){return this.signedXml}}Al.SignedXml=Dn;Dn.defaultNsForPrefix={ds:"http://www.w3.org/2000/09/xmldsig#"};Dn.noop=()=>null;(function(t){var e=cr&&cr.__createBinding||(Object.create?function(c,l,u,d){d===void 0&&(d=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(c,d,p)}:function(c,l,u,d){d===void 0&&(d=u),c[d]=l[u]}),n=cr&&cr.__exportStar||function(c,l){for(var u in c)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,c,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.SignedXml=t.ExclusiveCanonicalizationWithComments=t.ExclusiveCanonicalization=t.C14nCanonicalizationWithComments=t.C14nCanonicalization=void 0;var r=Qr;Object.defineProperty(t,"C14nCanonicalization",{enumerable:!0,get:function(){return r.C14nCanonicalization}}),Object.defineProperty(t,"C14nCanonicalizationWithComments",{enumerable:!0,get:function(){return r.C14nCanonicalizationWithComments}});var i=ei;Object.defineProperty(t,"ExclusiveCanonicalization",{enumerable:!0,get:function(){return i.ExclusiveCanonicalization}}),Object.defineProperty(t,"ExclusiveCanonicalizationWithComments",{enumerable:!0,get:function(){return i.ExclusiveCanonicalizationWithComments}});var o=Al;Object.defineProperty(t,"SignedXml",{enumerable:!0,get:function(){return o.SignedXml}}),n(Cs,t),n(As,t)})(I8);async function jE(t){const e=new DecompressionStream("deflate-raw"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}async function LE(t){const e=await r2.decode(t.replace(/ /g,"+"));try{const n=await jE(e);return new TextDecoder().decode(n)}catch(n){return console.warn("Decompression failed, assuming data is not compressed:",n),new TextDecoder().decode(e)}}async function FE(t){const e=await LE(t),r=new hp.XMLParser({attributeNamePrefix:"@_",alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(e);return k8.parse(r)}function UE(t){const e=[{":@":{"@_entityID":t.entityId,"@_xmlns":"urn:oasis:names:tc:SAML:2.0:metadata"},EntityDescriptor:[{":@":{"@_protocolSupportEnumeration":"urn:oasis:names:tc:SAML:2.0:protocol"},IDPSSODescriptor:[{":@":{"@_use":"signing"},KeyDescriptor:[{":@":{"@_xmlns":"http://www.w3.org/2000/09/xmldsig#"},KeyInfo:[{X509Data:[{X509Certificate:[{"#text":t.cert}]}]}]}]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.singleLogoutServiceUrl},SingleLogoutService:[]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"}]},{NameIDFormat:[{"#text":"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"}]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","@_Location":t.assertionConsumerServiceUrl},SingleSignOnService:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"E-Mail Address","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Given Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Surname","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]},{":@":{"@_Name":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:uri","@_FriendlyName":"Name ID","@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion"},Attribute:[]}]}]}];return new hp.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0,format:!0}).build(e)}const ME=new s.OpenAPIHono().openapi(s.createRoute({tags:["saml"],method:"get",path:"/metadata/{client_id}",request:{params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.z.string()}}},400:{description:"Bad Request"}}}),async t=>{var l,u;const{client_id:e}=t.req.valid("param"),n=await t.env.data.clients.get(e);if(!n)throw new R(404,{message:"Client not found"});const[r]=await t.env.data.keys.list();if(!r)throw new R(500,{message:"No signing key found"});const i=new pl(r.cert),o=t.env.ISSUER,c=UE({entityId:((u=(l=n.addons)==null?void 0:l.samlp)==null?void 0:u.audience)||n.id,cert:i.toString("base64"),assertionConsumerServiceUrl:`${o}samlp/${e}`,singleLogoutServiceUrl:`${o}samlp/${e}/logout`});return new Response(c,{headers:{"Content-Type":"text/xml"}})}).openapi(s.createRoute({tags:["saml"],method:"get",path:"/{client_id}",request:{query:s.z.object({SAMLRequest:s.z.string(),RelayState:s.z.string().optional(),SigAlg:s.z.string().optional(),Signature:s.z.string().optional()}),params:s.z.object({client_id:s.z.string()})},responses:{200:{description:"Decoded SAML Request",content:{"text/xml":{schema:s.z.string()}}},400:{description:"Bad Request"}}}),async t=>{const{client_id:e}=t.req.valid("param"),{SAMLRequest:n,RelayState:r}=t.req.valid("query"),i=await t.env.data.clients.get(e);if(!i)throw new R(404,{message:"Client not found"});t.set("client_id",i.id),t.set("tenant_id",i.tenant.id);const o=await FE(n),c=o["samlp:AuthnRequest"]["saml:Issuer"]["#text"],l=await t.env.data.loginSessions.create(t.var.tenant_id,{csrf_token:qe(),authParams:{client_id:e,state:JSON.stringify({requestId:o["samlp:AuthnRequest"]["@_ID"],relayState:r}),response_mode:vn.SAML_POST,redirect_uri:o["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"],audience:c},expires_at:new Date(Date.now()+ki*1e3).toISOString(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:yr(t.get("auth0_client"))});return t.redirect(`/u/login/identifier?state=${l.id}`)});function qE(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=Qo(r,t.dataAdapter),c=_l(o,{defaultTtl:3e5,cacheEntities:["tenants","connections","clients"]});return r.env.data=hl(r,c),i()}),e.use(ml).use(gl).use(af(e));const n=e.route("/",ME);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"SAML API"},security:[{oauth2:["openid","email","profile"]}]}),sf(n),n}const VE="Account detected",HE="Account",KE="We have detected that you have already created an account through",GE="By signing in, you agree to our",WE="and",XE="email address",JE="email or phone number",YE="phone number",ZE="Callback URL mismatch",QE="The provided redirect_uri is not in the list of allowed callback URLs.",eS="continue with user",tS="Please click the button to create a new password account.",nS="Enter the code at {{vendorName}} to complete the login",rS="Welcome to {{vendorName}}! {{code}} is the login code",iS="Welcome to {{vendorName}}! {{code}} is the login code",oS="Code expired",sS="Invalid code",aS="Please check <0>{{username}}</0> and enter the six-digit code that we've sent you.",cS="The code is already used",lS="The code is valid for 30 minutes",uS="Confirm password",dS="Need Help?",pS="Contact us",fS="or continue with social account",hS="Continue with {{provider}}",gS="Would you like to continue with your existing account?",mS="Copyright © 2023 SESAMY. All rights reserved.",_S="©2023 Sesamy",yS="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",wS="Please enter a valid email address.",vS="The passwords didn't match. Try again.",bS="Choose password",xS="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",$S="Create new account",AS="Sign up with password",ES="You are currently logged in as <0>{{email}}</0>",SS="Email",kS="Email changed to <0>{{email}}</0> ",NS="Email or Phone Number",CS="Email address",IS="Your email address has been validated",TS="Now enter your password to login again",OS="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",DS="Email verification sent",zS="Enter a code",RS="We'll send you a verification link to ensure you own this email address.",PS="Enter new email",BS="Enter new password",jS="Enter password",LS="Enter your email address and password to login.",FS="Enter your password",US="The magic link has expired. Please click on the button below to receive a new link in your inbox.",MS="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",qS="Send password reset email",VS="Click the button below and we’ll send instructions on how to reset your password.",HS="Password reset email sent",KS="Forgot password?",GS="Forgot password?",WS="Go back",XS="Hide password",JS="Invalid identifier",YS="Invalid password",ZS=`The link is no longer valid.
285
285
 
286
286
  Please make sure to open the login link in the same browser you started the login with.
287
287
 
@@ -17704,7 +17704,7 @@ export declare function init(config: AuthHeroConfig): {
17704
17704
  };
17705
17705
  } & {
17706
17706
  "/default": {
17707
- $put: {
17707
+ $patch: {
17708
17708
  input: {
17709
17709
  header: {
17710
17710
  "tenant-id"?: string | undefined;
package/dist/authhero.mjs CHANGED
@@ -2651,7 +2651,7 @@ const Aw = new Ee().openapi(
2651
2651
  ).openapi(
2652
2652
  G({
2653
2653
  tags: ["branding"],
2654
- method: "put",
2654
+ method: "patch",
2655
2655
  path: "/default",
2656
2656
  request: {
2657
2657
  body: {
@@ -35878,22 +35878,28 @@ const OE = new Ee().openapi(
35878
35878
  }
35879
35879
  }),
35880
35880
  async (t) => {
35881
- const { client_id: e } = t.req.valid("param"), { SAMLRequest: n, RelayState: r } = t.req.valid("query"), i = await IE(n), o = i["samlp:AuthnRequest"]["saml:Issuer"]["#text"], c = await t.env.data.loginSessions.create(
35881
+ const { client_id: e } = t.req.valid("param"), { SAMLRequest: n, RelayState: r } = t.req.valid("query"), i = await t.env.data.clients.get(e);
35882
+ if (!i)
35883
+ throw new P(404, {
35884
+ message: "Client not found"
35885
+ });
35886
+ t.set("client_id", i.id), t.set("tenant_id", i.tenant.id);
35887
+ const o = await IE(n), c = o["samlp:AuthnRequest"]["saml:Issuer"]["#text"], l = await t.env.data.loginSessions.create(
35882
35888
  t.var.tenant_id,
35883
35889
  {
35884
35890
  csrf_token: ze(),
35885
35891
  authParams: {
35886
35892
  client_id: e,
35887
35893
  state: JSON.stringify({
35888
- requestId: i["samlp:AuthnRequest"]["@_ID"],
35894
+ requestId: o["samlp:AuthnRequest"]["@_ID"],
35889
35895
  relayState: r
35890
35896
  }),
35891
35897
  response_mode: Pn.SAML_POST,
35892
35898
  redirect_uri: (
35893
35899
  // TODO: validate this URL against the saml settings
35894
- i["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"]
35900
+ o["samlp:AuthnRequest"]["@_AssertionConsumerServiceURL"]
35895
35901
  ),
35896
- audience: o
35902
+ audience: c
35897
35903
  },
35898
35904
  expires_at: new Date(
35899
35905
  Date.now() + Ai * 1e3
@@ -35903,7 +35909,7 @@ const OE = new Ee().openapi(
35903
35909
  auth0Client: mr(t.get("auth0_client"))
35904
35910
  }
35905
35911
  );
35906
- return t.redirect(`/u/login/identifier?state=${c.id}`);
35912
+ return t.redirect(`/u/login/identifier?state=${l.id}`);
35907
35913
  }
35908
35914
  );
35909
35915
  function DE(t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authhero",
3
- "version": "0.179.0",
3
+ "version": "0.180.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],