@langgenius/nodwork-darwin-arm64 0.0.2 → 0.0.3

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.
@@ -1,4 +1,4 @@
1
- import{t as e}from"./chunk-BjEoQXZ0.js";const t=e=>typeof e==`string`,n=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},r=e=>e==null?``:``+e,i=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},a=/###/g,o=e=>e&&e.indexOf(`###`)>-1?e.replace(a,`.`):e,s=e=>!e||t(e),c=(e,n,r)=>{let i=t(n)?n.split(`.`):n,a=0;for(;a<i.length-1;){if(s(e))return{};let t=o(i[a]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return s(e)?{}:{obj:e,k:o(i[a])}},l=(e,t,n)=>{let{obj:r,k:i}=c(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=c(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=c(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},u=(e,t,n,r)=>{let{obj:i,k:a}=c(e,t,Object);i[a]=i[a]||[],i[a].push(n)},d=(e,t)=>{let{obj:n,k:r}=c(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},f=(e,t,n)=>{let r=d(e,n);return r===void 0?d(t,n):r},p=(e,n,r)=>{for(let i in n)i!==`__proto__`&&i!==`constructor`&&(i in e?t(e[i])||e[i]instanceof String||t(n[i])||n[i]instanceof String?r&&(e[i]=n[i]):p(e[i],n[i],r):e[i]=n[i]);return e},m=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`);var h={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`};const ee=e=>t(e)?e.replace(/[&<>"'\/]/g,e=>h[e]):e;var te=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}};const ne=[` `,`,`,`?`,`!`,`;`],re=new te(20),ie=(e,t,n)=>{t||=``,n||=``;let r=ne.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=re.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},g=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},_=e=>e?.replace(/_/g,`-`),ae={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}};var v=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ae,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,n,r,i){return i&&!this.debug?null:(t(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},oe=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},y=class extends oe{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,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){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,n,r,i={}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=i.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:i.ignoreJSONStructure,s;e.indexOf(`.`)>-1?s=e.split(`.`):(s=[e,n],r&&(Array.isArray(r)?s.push(...r):t(r)&&a?s.push(...r.split(a)):s.push(r)));let c=d(this.data,s);return!c&&!n&&!r&&e.indexOf(`.`)>-1&&(e=s[0],n=s[1],r=s.slice(2).join(`.`)),c||!o||!t(r)?c:g(this.data?.[e]?.[n],r,a)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),l(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,n,r,i={silent:!1}){for(let i in r)(t(r[i])||Array.isArray(r[i]))&&this.addResource(e,n,i,r[i],{silent:!0});i.silent||this.emit(`added`,e,n,r)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=d(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?p(s,n,i):s={...s,...n},l(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},b={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}};const se=Symbol(`i18next/PATH_KEY`);function ce(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===se?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function x(e,t){let{[se]:n}=e(ce()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}const le={},ue=e=>!t(e)&&typeof e!=`boolean`&&typeof e!=`number`;var de=class e extends oe{constructor(e,t={}){super(),i([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=v.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=ue(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,n){let r=n.nsSeparator===void 0?this.options.nsSeparator:n.nsSeparator;r===void 0&&(r=`:`);let i=n.keySeparator===void 0?this.options.keySeparator:n.keySeparator,a=n.ns||this.options.defaultNS||[],o=r&&e.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!ie(e,r,i);if(o&&!s){let n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:t(a)?[a]:a};let o=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(i)}return{key:e,namespaces:t(a)?[a]:a}}translate(n,r,i){let a=typeof r==`object`?{...r}:r;if(typeof a!=`object`&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a==`object`&&(a={...a}),a||={},n==null)return``;typeof n==`function`&&(n=x(n,{...this.options,...a})),Array.isArray(n)||(n=[String(n)]),n=n.map(e=>typeof e==`function`?x(e,{...this.options,...a}):String(e));let o=a.returnDetails===void 0?this.options.returnDetails:a.returnDetails,s=a.keySeparator===void 0?this.options.keySeparator:a.keySeparator,{key:c,namespaces:l}=this.extractFromKey(n[n.length-1],a),u=l[l.length-1],d=a.nsSeparator===void 0?this.options.nsSeparator:a.nsSeparator;d===void 0&&(d=`:`);let f=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()===`cimode`)return p?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:c;let m=this.resolve(n,a),h=m?.res,ee=m?.usedKey||c,te=m?.exactUsedKey||c,ne=[`[object Number]`,`[object Function]`,`[object RegExp]`],re=a.joinArrays===void 0?this.options.joinArrays:a.joinArrays,ie=!this.i18nFormat||this.i18nFormat.handleAsObject,g=a.count!==void 0&&!t(a.count),_=e.hasDefaultValue(a),ae=g?this.pluralResolver.getSuffix(f,a.count,a):``,v=a.ordinal&&g?this.pluralResolver.getSuffix(f,a.count,{ordinal:!1}):``,oe=g&&!a.ordinal&&a.count===0,y=oe&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${ae}`]||a[`defaultValue${v}`]||a.defaultValue,b=h;ie&&!h&&_&&(b=y);let se=ue(b),ce=Object.prototype.toString.apply(b);if(ie&&b&&se&&ne.indexOf(ce)<0&&!(t(re)&&Array.isArray(b))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(ee,b,{...a,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=e,m.usedParams=this.getUsedParamsDetails(a),m):e}if(s){let e=Array.isArray(b),t=e?[]:{},n=e?te:ee;for(let e in b)if(Object.prototype.hasOwnProperty.call(b,e)){let r=`${n}${s}${e}`;_&&!h?t[e]=this.translate(r,{...a,defaultValue:ue(y)?y[e]:void 0,joinArrays:!1,ns:l}):t[e]=this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=b[e])}h=t}}else if(ie&&t(re)&&Array.isArray(h))h=h.join(re),h&&=this.extendTranslation(h,n,a,i);else{let e=!1,t=!1;!this.isValidLookup(h)&&_&&(e=!0,h=y),this.isValidLookup(h)||(t=!0,h=c);let r=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&t?void 0:h,o=_&&y!==h&&this.options.updateMissing;if(t||e||o){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,c,o?y:h),s){let e=this.resolve(c,{...a,keySeparator:!1});e&&e.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 e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(a.lng||this.language):e.push(a.lng||this.language);let n=(e,t,n)=>{let i=_&&n!==h?n:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,i,o,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,i,o,a),this.emit(`missingKey`,e,u,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&g?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,a);oe&&a[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],c+t,a[`defaultValue${t}`]||y)})}):n(e,c,y))}h=this.extendTranslation(h,n,a,m,i),t&&h===c&&this.options.appendNamespaceToMissingKey&&(h=`${u}${d}${c}`),(t||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,e?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(e,n,r,i,a){if(this.i18nFormat?.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}});let o=t(e)&&(r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables),s;if(o){let t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let c=r.replace&&!t(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,r.lng||this.language||i.usedLng,r),o){let t=e.match(this.interpolator.nestingRegexp),n=t&&t.length;s<n&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>a?.[0]===e[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${n[0]}`),null):this.translate(...e,n),r)),r.interpolation&&this.interpolator.reset()}let o=r.postProcess||this.options.postProcess,s=t(o)?[o]:o;return e!=null&&s?.length&&r.applyPostProcessor!==!1&&(e=b.handle(s,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,i,a,o,s;return t(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?x(e,{...this.options,...n}):e)),e.forEach(e=>{if(this.isValidLookup(r))return;let c=this.extractFromKey(e,n),l=c.key;i=l;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=n.count!==void 0&&!t(n.count),f=d&&!n.ordinal&&n.count===0,p=n.context!==void 0&&(t(n.context)||typeof n.context==`number`)&&n.context!==``,m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(e=>{this.isValidLookup(r)||(s=e,!le[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(le[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(`, `)}" won't get resolved as namespace "${s}" 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!!!`)),m.forEach(t=>{if(this.isValidLookup(r))return;o=t;let i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,t,e,n);else{let e;d&&(e=this.pluralResolver.getSuffix(t,n.count,n));let r=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(n.ordinal&&e.indexOf(a)===0&&i.push(l+e.replace(a,this.options.pluralSeparator)),i.push(l+e),f&&i.push(l+r)),p){let t=`${l}${this.options.contextSeparator||`_`}${n.context}`;i.push(t),d&&(n.ordinal&&e.indexOf(a)===0&&i.push(t+e.replace(a,this.options.pluralSeparator)),i.push(t+e),f&&i.push(t+r))}}let s;for(;s=i.pop();)this.isValidLookup(r)||(a=s,r=this.getResource(t,e,s,n))}))})}),{res:r,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let n=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],r=e.replace&&!t(e.replace),i=r?e.replace:e;if(r&&e.count!==void 0&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(let e of n)delete i[e]}return i}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},fe=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=v.create(`languageUtils`)}getScriptPartFromCode(e){if(e=_(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=_(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(t(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(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 t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,n){if(!e)return[];if(typeof e==`function`&&(e=e(n)),t(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||=e[this.getScriptPartFromCode(n)],r||=e[this.formatLanguageCode(n)],r||=e[this.getLanguagePartFromCode(n)],r||=e.default,r||[]}toResolveHierarchy(e,n){let r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],a=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return t(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&a(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&a(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&a(this.getLanguagePartFromCode(e))):t(e)&&a(this.formatLanguageCode(e)),r.forEach(e=>{i.indexOf(e)<0&&a(this.formatLanguageCode(e))}),i}};const pe={zero:0,one:1,two:2,few:3,many:4,other:5},me={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})};var he=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=v.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=_(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),me;if(!e.match(/-|_/))return me;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>pe[e]-pe[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}};const ge=(e,n,r,i=`.`,a=!0)=>{let o=f(e,n,r);return!o&&a&&t(r)&&(o=g(e,r,i),o===void 0&&(o=g(n,r,i))),o},_e=e=>e.replace(/\$/g,`$$$$`);var ve=class{constructor(e={}){this.logger=v.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:h,nestingOptionsSeparator:te,maxReplaces:ne,alwaysFormat:re}=e.interpolation;this.escape=t===void 0?ee:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?m(i):a||`{{`,this.suffix=o?m(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?m(d):f||m(`$t(`),this.nestingSuffix=p?m(p):h||m(`)`),this.nestingOptionsSeparator=te||`,`,this.maxReplaces=ne||1e3,this.alwaysFormat=re===void 0?!1:re,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`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,i,a){let o,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=e=>{if(e.indexOf(this.formatSeparator)<0){let t=ge(n,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(t,void 0,i,{...a,...n,interpolationkey:e}):t}let t=e.split(this.formatSeparator),r=t.shift().trim(),o=t.join(this.formatSeparator).trim();return this.format(ge(n,l,r,this.options.keySeparator,this.options.ignoreJSONStructure),o,i,{...a,...n,interpolationkey:r})};this.resetRegExp();let d=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=a?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:a.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>_e(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?_e(this.escape(e)):_e(e)}].forEach(n=>{for(c=0;o=n.regex.exec(e);){let i=o[1].trim();if(s=u(i),s===void 0)if(typeof d==`function`){let n=d(e,o,a);s=t(n)?n:``}else if(a&&Object.prototype.hasOwnProperty.call(a,i))s=``;else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${i} for interpolating ${e}`),s=``;else !t(s)&&!this.useRawValueToEscape&&(s=r(s));let l=n.safeValue(s);if(e=e.replace(o[0],l),f?(n.regex.lastIndex+=s.length,n.regex.lastIndex-=o[0].length):n.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,i={}){let a,o,s,c=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${m(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,s);let a=i.match(/'/g),o=i.match(/"/g);((a?.length??0)%2==0&&!o||(o?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{s=JSON.parse(i),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,e};for(;a=this.nestingRegexp.exec(e);){let l=[];s={...i},s=s.replace&&!t(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=/{.*}/.test(a[1])?a[1].lastIndexOf(`}`)+1:a[1].indexOf(this.formatSeparator);if(u!==-1&&(l=a[1].slice(u).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),a[1]=a[1].slice(0,u)),o=n(c.call(this,a[1].trim(),s),s),o&&a[0]===e&&!t(o))return o;t(o)||(o=r(o)),o||=(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),``),l.length&&(o=l.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:a[1].trim()}),o.trim())),e=e.replace(a[0],o),this.regexp.lastIndex=0}return e}};const ye=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},be=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(_(r),i),t[o]=s),s(n)}},xe=e=>(t,n,r)=>e(_(n),r)(t);var Se=class{constructor(e={}){this.logger=v.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?be:xe;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=be(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ye(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}};const Ce=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};var we=class extends oe{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=v.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{u(n.loaded,[i],a),Ce(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,n,r={},i){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),i&&i();t(e)&&(e=this.languageUtils.toResolveHierarchy(e)),t(n)&&(n=[n]);let a=this.queueLoad(e,n,r,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" 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(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}};const Te=()=>({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:e=>{let n={};if(typeof e[1]==`object`&&(n=e[1]),t(e[1])&&(n.defaultValue=e[1]),t(e[2])&&(n.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let t=e[3]||e[2];Object.keys(t).forEach(e=>{n[e]=t[e]})}return n},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ee=e=>(t(e.ns)&&(e.ns=[e.ns]),t(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),t(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),De=()=>{},Oe=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},ke=`__i18next_supportNoticeShown`,Ae=()=>!!(typeof globalThis<`u`&&globalThis[ke]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env&&process.env.NODE_ENV===`production`),je=()=>{typeof globalThis<`u`&&(globalThis[ke]=!0)},Me=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),S=class e extends oe{constructor(e={},t){if(super(),this.options=Ee(e),this.services={},this.logger=v,this.modules={external:[]},Oe(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},r){this.isInitializing=!0,typeof e==`function`&&(r=e,e={}),e.defaultNS==null&&e.ns&&(t(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let i=Te();this.options={...i,...this.options,...Ee(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Me(this)&&!Ae()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),je());let a=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?v.init(a(this.modules.logger),this.options):v.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Se;let t=new fe(this.options);this.store=new y(this.options.resources,this.options);let n=this.services;n.logger=v,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new he(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(n.formatter=a(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new ve(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new we(a(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=a(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=a(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new de(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,r||=De,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[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(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let o=n(),s=()=>{let e=(e,t)=>{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),o.resolve(t),r(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?s():setTimeout(s,0),o}loadResources(e,n=De){let r=n,i=t(e)?e:this.language;if(typeof e==`function`&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return r();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};i?t(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(e)})}else r(null)}reloadResources(e,t,r){let i=n();return typeof e==`function`&&(r=e,e=void 0),typeof t==`function`&&(r=t,t=void 0),e||=this.languages,t||=this.options.ns,r||=De,this.services.backendConnector.reload(e,t,e=>{i.resolve(),r(e)}),i}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw 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`&&b.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 e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let i=n();this.emit(`languageChanging`,e);let a=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(t,n)=>{n?this.isLanguageChangingTo===e&&(a(n),this.translator.changeLanguage(n),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,n),this.logger.log(`languageChanged`,n)):this.isLanguageChangingTo=void 0,i.resolve((...e)=>this.t(...e)),r&&r(t,(...e)=>this.t(...e))},s=n=>{!e&&!n&&this.services.languageDetector&&(n=[]);let r=t(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(t(n)?[n]:n);i&&(this.language||a(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{o(e,i)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),i}getFixedT(e,n,r){let i=(e,t,...n)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(n)),a.lng=a.lng||i.lng,a.lngs=a.lngs||i.lngs,a.ns=a.ns||i.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||r||i.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=x(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=x(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=x(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return t(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=r,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,r){let i=n();return this.options.ns?(t(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{i.resolve(),r&&r(e)}),i):(r&&r(),Promise.resolve())}loadLanguages(e,r){let i=n();t(e)&&(e=[e]);let a=this.options.preload||[],o=e.filter(e=>a.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=a.concat(o),this.loadResources(e=>{i.resolve(),r&&r(e)}),i):(r&&r(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`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`.split(`.`),n=this.services?.languageUtils||new fe(Te());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=De){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new y(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Te().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new ve(n)}return a.translator=new de(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();S.createInstance,S.dir,S.init,S.loadResources,S.reloadResources,S.use,S.changeLanguage,S.getFixedT,S.t,S.exists,S.setDefaultNamespace,S.hasLoadedNamespace,S.loadNamespaces,S.loadLanguages;const Ne=[`en`,`zh-Hans`],Pe=/^zh(?:[-_]|$)/i,Fe=e=>Ne.includes(e),Ie=e=>{if(!e)return null;let t=e.trim();return t?Fe(t)?t:Pe.test(t)?`zh-Hans`:t.toLowerCase().startsWith(`en`)?`en`:null:null},Le=e=>{for(let t of e){let e=Ie(t);if(e)return e}return`en`},Re={finish:()=>{}},ze=()=>({setContext:()=>{},setFingerprint:()=>{},setLevel:()=>{},setTag:()=>{},setUser:()=>{}}),Be=()=>({addBreadcrumb:e=>{},captureException:e=>{},destroy:async()=>{},enabled:!1,flush:async()=>!0,init:async()=>{},startInactiveSpan:e=>Re,withScope:e=>e(ze())}),Ve=e=>{if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t},He=e=>typeof e==`string`?e:String(e),Ue=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},We=e=>{let t={clientApp:e.clientApp,environment:e.environment,runtime:e.runtime,...e.appVersion?{appVersion:e.appVersion}:{},...e.release?{release:e.release}:{}},n={client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{}};return{contexts:{client:t},tags:n,user:{id:null}}},Ge=(e,t,n)=>{let r=Ue(n);if(Object.keys(r).length===0){delete e.contexts[t];return}e.contexts[t]=r},Ke=(e,t)=>{delete e.contexts[t]},qe=(e,t,n)=>{if(n==null||n===``){delete e.tags[t];return}e.tags[t]=He(n)},Je=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Ye=/^[a-f0-9]{16,}$/i,Xe=/^\d{4,}$/,Ze=new Set([`access_token`,`code`,`jwt`,`refresh_token`,`session`,`signature`,`state`,`token`]),Qe=new Set([`authorization`,`cookie`,`set-auth-token`,`set-cookie`,`x-api-key`,`x-auth-token`,`x-csrf-token`]),$e=e=>e&&(Je.test(e)?`:uuid`:Xe.test(e)?`:id`:Ye.test(e)?`:hash`:e),et=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`forEach`in e&&typeof e.forEach==`function`,tt=e=>{if(!e)return[];if(et(e)){let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t}return Array.isArray(e)?e.map(([e,t])=>[e,t]):Object.entries(e).flatMap(([e,t])=>Array.isArray(t)?t.map(t=>[e,String(t)]):t==null?[]:[[e,String(t)]])},nt=e=>{let t={};for(let[n,r]of tt(e)){let e=n.toLowerCase();Qe.has(e)||(t[e]=r)}return t},rt=e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``,t.pathname=t.pathname.split(`/`).map($e).join(`/`);let n=new URLSearchParams;return t.searchParams.forEach((e,t)=>{Ze.has(t.toLowerCase())||n.append(t,e)}),t.search=n.toString(),t.toString()}catch{let[t]=e.split(`?`);return t??e}},it=(e,t=512)=>e.length<=t?e:`${e.slice(0,t)}…`,at=e=>e<=0?!1:e>=1?!0:Math.random()<e,ot=e=>e.errorClass===`user_facing`?`warning`:`error`,st=e=>{switch(e){case`ok`:return`ok`;case`timeout`:return`deadline_exceeded`;case`send_failed`:return`internal_error`;default:return`internal_error`}},C=e=>e instanceof Error?e:Error(it(typeof e==`string`?e:`Unknown frontend stability error`)),ct=e=>e??`info`,lt=(e,t)=>{let n=e.flushTimeoutMs??1500,r=We(e),i=(e,n)=>t.withScope(t=>{for(let[e,n]of Object.entries(r.tags))t.setTag(e,n);for(let[e,n]of Object.entries(r.contexts))t.setContext(e,n);if(r.user.id&&t.setUser({id:r.user.id}),!e)return n();for(let[n,r]of Object.entries(e.tags??{}))r&&t.setTag(n,r);for(let[n,r]of Object.entries(e.contexts??{}))t.setContext(n,r);return e.level&&t.setLevel(e.level),e.fingerprint&&e.fingerprint.length>0&&t.setFingerprint(e.fingerprint),n()}),a=n=>{let r=Ve({client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{},...n.attributes??{}});return t.startInactiveSpan({name:n.name,op:n.op,attributes:r})};return{addBreadcrumb:e=>{t.enabled&&(e.level!==`error`&&e.level!==`fatal`&&!at(.2)||t.addBreadcrumb({...e,level:ct(e.level)}))},captureException:(e,n)=>{t.enabled&&i(n,()=>{t.captureException(C(e))})},clearScopeContext:e=>{Ke(r,e)},clearUser:()=>{r.user={id:null}},createHttpPort:()=>({onRequestStart:({kind:e,method:n,timeoutMs:r,url:o})=>{let s=a({name:`${n} ${e}`,op:`http.client`,attributes:{http_kind:e,http_method:n,http_url:o,...r===void 0?{}:{http_timeout_ms:r}}});return{finish:({error:a,status:c,statusCode:l})=>{s.finish({attributes:{http_result:c,...l===void 0?{}:{http_status_code:l}},status:st(c)}),c===`error`&&a&&i({contexts:{http:{method:n,statusCode:l,timeoutMs:r,url:o}},level:`error`,tags:{http_kind:e,http_method:n,http_result:c}},()=>{t.captureException(C(a))})}}}}),createNetworkPort:()=>({onHeartbeatTimeout:({error:e,intervalMs:n})=>{i({contexts:{network:{intervalMs:n}},level:`warning`,tags:{transport_phase:`heartbeat_timeout`}},()=>{t.captureException(C(e??Error(`Heartbeat timed out`)))})},onRpcStart:({channel:e,timeoutMs:n})=>{let r=a({name:e,op:`rpc.client`,attributes:{rpc_channel:e,rpc_timeout_ms:n}});return{finish:a=>{r.finish({attributes:{rpc_result:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{rpc_error_class:a.errorClass}:{}},status:st(a.status)}),a.status!==`ok`&&i({contexts:{rpc:{channel:e,code:a.code,domain:a.domain,errorClass:a.errorClass,timeoutMs:n}},level:ot(a),tags:{rpc_channel:e,rpc_result:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{rpc_error_class:a.errorClass}:{}}},()=>{t.captureException(C(a.error))})}}},onTransportError:({error:e,phase:n})=>{i({contexts:{transport:{phase:n}},level:`error`,tags:{transport_phase:n}},()=>{t.captureException(C(e))})},onWsConnectStart:({kind:e})=>{let n=a({name:`ws.${e}`,op:`ws.connect`,attributes:{ws_kind:e}});return{finish:({error:r,status:a})=>{n.finish({attributes:{ws_kind:e,ws_result:a},status:st(a)}),a===`error`&&i({contexts:{transport:{kind:e}},level:`error`,tags:{ws_kind:e,ws_result:a}},()=>{t.captureException(C(r))})}}},onWsEvent:({channel:e})=>{at(.2)&&t.addBreadcrumb({category:`ws.event`,data:{channel:e},level:`info`,message:`Received ${e}`})},onWsStatusChange:({status:e})=>{t.enabled&&t.addBreadcrumb({category:`ws.status`,data:{status:e},level:e===`error`?`error`:`info`,message:`Transport ${e}`})}}),flush:async e=>t.enabled?await t.flush(e??n):!1,setScopeContext:(e,t)=>{Ge(r,e,t)},setTag:(e,t)=>{qe(r,e,t)},setUser:e=>{r.user=e},startSpan:a}},ut=e=>e.length===0?[Be()]:e,dt=e=>{let t=ut(e);return t.find(e=>e.enabled)??t[0]??Be()},ft=e=>{let t=ut(e),n=dt(t),r=t.filter(e=>e.enabled);return{addBreadcrumb:e=>{for(let n of t)try{n.addBreadcrumb(e)}catch{}},captureException:e=>{for(let n of t)try{n.captureException(e)}catch{}},destroy:async()=>{for(let e of t)if(e.destroy)try{await e.destroy()}catch{}},enabled:t.some(e=>e.enabled),flush:async e=>(await Promise.allSettled((r.length>0?r:t).map(async t=>{try{return await t.flush(e)}catch{return!1}}))).every(e=>e.status===`fulfilled`&&e.value===!0),init:async()=>{for(let e of t)if(e.init)try{await e.init()}catch{}},startInactiveSpan:e=>{try{return n.startInactiveSpan(e)}catch{return Be().startInactiveSpan(e)}},withScope:e=>{let t=e;try{return n.withScope(t)}catch{return Be().withScope(t)}}}};let pt=function(e){return e.NOOP=`noop`,e.POSTHOG_BROWSER=`posthog-browser`,e.POSTHOG_REACT_NATIVE=`posthog-react-native`,e.SENTRY=`sentry`,e}({});const mt=new Set(Object.values(pt)),ht=(e,t=[pt.SENTRY])=>{let n=e?.trim();if(!n)return{invalidNames:[],names:[...t]};let r=n.split(`,`),i=[],a=[];for(let e of r){let t=e.trim().toLowerCase();if(!t)continue;if(!mt.has(t)){i.push(t);continue}let n=t;a.includes(n)||a.push(n)}return a.length>0?{invalidNames:i,names:a}:{invalidNames:i,names:[]}},gt=e=>{let t={};for(let[n,r]of Object.entries(e))r==null||r===``||(t[n]=r);return t},_t=e=>Object.keys(e).length>0,vt=(e,t)=>{t.userId?e.setUser({id:t.userId}):e.clearUser(),e.setTag(`workspace_id`,t.workspaceId??null),e.setTag(`pipeline_id`,t.pipelineId??null),e.setTag(`task_id`,t.taskId??null),e.setTag(`environment_id`,t.environmentId??null),e.setTag(`route_view`,t.routeView??null),e.setTag(`command_name`,t.commandName??null),e.setTag(`auth_phase`,t.authPhase??null);let n=gt({deviceCode:t.deviceCode,environmentId:t.environmentId,memberId:t.memberId,pipelineId:t.pipelineId,taskId:t.taskId,workspaceId:t.workspaceId});_t(n)?e.setScopeContext(`echo`,n):e.clearScopeContext(`echo`);let r=gt({authPhase:t.authPhase,commandName:t.commandName,cwd:t.cwd,interactive:t.interactive,routeTemplate:t.routeTemplate,routeView:t.routeView,screen:t.screen});_t(r)?e.setScopeContext(`surface`,r):e.clearScopeContext(`surface`)},yt={finish:()=>{}},bt={finish:()=>{}},xt={finish:()=>{}},St=()=>({onHeartbeatTimeout:()=>{},onRpcStart:()=>yt,onTransportError:()=>{},onWsConnectStart:()=>bt,onWsEvent:()=>{},onWsStatusChange:()=>{}}),Ct=()=>({onRequestStart:()=>xt}),wt=/^[^@]+@([^+]+)(?:\+.+)?$/,Tt=e=>{if(!e)return;let t=wt.exec(e.trim())?.[1]?.trim();if(t)return t},Et=/\/+$/,w=e=>e.replace(Et,``),Dt=e=>e instanceof Request?e.url:e instanceof URL?e.toString():e,Ot=(e,t)=>t?.method?t.method:e instanceof Request?e.method:`GET`,kt=(e={})=>{let t=e.fetchImpl??fetch,n=e.observability??Ct(),r=e.kind??`http`;return async(e,i)=>{let a=rt(Dt(e)),o=Ot(e,i).toUpperCase(),s=n.onRequestStart({kind:r,method:o,url:a});try{let n=await t(e,i);return s.finish({status:`ok`,statusCode:n.status}),n}catch(e){throw s.finish({status:`error`,error:e}),e}}};Object.freeze({status:`aborted`});function T(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var At=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},jt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const Mt={};function E(e){return e&&Object.assign(Mt,e),Mt}function Nt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Pt(e,t){return typeof t==`bigint`?t.toString():t}function Ft(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function It(e){return e==null}function Lt(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Rt(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const zt=Symbol(`evaluating`);function D(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==zt)return r===void 0&&(r=zt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function O(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function k(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Bt(e){return JSON.stringify(e)}function Vt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Ht=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Wt=Ft(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function A(e){if(Ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ut(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Gt(e){return A(e)?{...e}:Array.isArray(e)?[...e]:e}const Kt=new Set([`string`,`number`,`symbol`]);function j(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function M(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function qt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Jt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Yt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return M(e,k(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return O(this,`shape`,e),e},checks:[]}))}function Xt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return M(e,k(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return O(this,`shape`,r),r},checks:[]}))}function Zt(e,t){if(!A(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return M(e,k(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return O(this,`shape`,n),n}}))}function Qt(e,t){if(!A(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return M(e,k(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return O(this,`shape`,n),n}}))}function $t(e,t){return M(e,k(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return O(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function en(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return M(t,k(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return O(this,`shape`,i),i},checks:[]}))}function tn(e,t,n){return M(t,k(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return O(this,`shape`,i),i}}))}function P(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nn(e){return typeof e==`string`?e:e?.message}function I(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nn(e.inst?._zod.def?.error?.(e))??nn(t?.error?.(e))??nn(n.customError?.(e))??nn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function rn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function an(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const on=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pt,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},sn=T(`$ZodError`,on),cn=T(`$ZodError`,on,{Parent:Error});function ln(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function un(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}const dn=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new At;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,E())));throw Ht(t,i?.callee),t}return o.value},fn=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,E())));throw Ht(t,i?.callee),t}return o.value},pn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new At;return a.issues.length?{success:!1,error:new(e??sn)(a.issues.map(e=>I(e,i,E())))}:{success:!0,data:a.value}},mn=pn(cn),hn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>I(e,i,E())))}:{success:!0,data:a.value}},gn=hn(cn),_n=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dn(e)(t,n,i)},vn=e=>(t,n,r)=>dn(e)(t,n,r),yn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fn(e)(t,n,i)},bn=e=>async(t,n,r)=>fn(e)(t,n,r),xn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pn(e)(t,n,i)},Sn=e=>(t,n,r)=>pn(e)(t,n,r),Cn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hn(e)(t,n,i)},wn=e=>async(t,n,r)=>hn(e)(t,n,r),Tn=/^[cC][^\s-]{8,}$/,En=/^[0-9a-z]+$/,Dn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,On=/^[0-9a-vA-V]{20}$/,kn=/^[A-Za-z0-9]{27}$/,An=/^[a-zA-Z0-9_-]{21}$/,jn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Nn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Fn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const In=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vn=/^[A-Za-z0-9_-]*$/,Hn=/^\+[1-9]\d{6,14}$/,Un=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Wn=RegExp(`^${Un}$`);function Gn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kn(e){return RegExp(`^${Gn(e)}$`)}function qn(e){let t=Gn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Un}T(?:${r})$`)}const Jn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yn=/^-?\d+$/,Xn=/^-?\d+(?:\.\d+)?$/,Zn=/^(?:true|false)$/i,Qn=/^null$/i,$n=/^[^A-Z]*$/,er=/^[^a-z]*$/,L=T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tr={number:`number`,bigint:`bigint`,object:`date`},nr=T(`$ZodCheckLessThan`,(e,t)=>{L.init(e,t);let n=tr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rr=T(`$ZodCheckGreaterThan`,(e,t)=>{L.init(e,t);let n=tr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=T(`$ZodCheckMultipleOf`,(e,t)=>{L.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Rt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ar=T(`$ZodCheckNumberFormat`,(e,t)=>{L.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Jt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),or=T(`$ZodCheckMaxLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!It(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=rn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sr=T(`$ZodCheckMinLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!It(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=rn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cr=T(`$ZodCheckLengthEquals`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!It(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=rn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),lr=T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;L.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ur=T(`$ZodCheckRegex`,(e,t)=>{lr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dr=T(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$n,lr.init(e,t)}),fr=T(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=er,lr.init(e,t)}),pr=T(`$ZodCheckIncludes`,(e,t)=>{L.init(e,t);let n=j(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),mr=T(`$ZodCheckStartsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`^${j(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),hr=T(`$ZodCheckEndsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`.*${j(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),gr=T(`$ZodCheckOverwrite`,(e,t)=>{L.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var _r=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1
+ import{t as e}from"./chunk-BjEoQXZ0.js";const t=e=>typeof e==`string`,n=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},r=e=>e==null?``:``+e,i=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},a=/###/g,o=e=>e&&e.indexOf(`###`)>-1?e.replace(a,`.`):e,s=e=>!e||t(e),c=(e,n,r)=>{let i=t(n)?n.split(`.`):n,a=0;for(;a<i.length-1;){if(s(e))return{};let t=o(i[a]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return s(e)?{}:{obj:e,k:o(i[a])}},l=(e,t,n)=>{let{obj:r,k:i}=c(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=c(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=c(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},u=(e,t,n,r)=>{let{obj:i,k:a}=c(e,t,Object);i[a]=i[a]||[],i[a].push(n)},d=(e,t)=>{let{obj:n,k:r}=c(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},f=(e,t,n)=>{let r=d(e,n);return r===void 0?d(t,n):r},p=(e,n,r)=>{for(let i in n)i!==`__proto__`&&i!==`constructor`&&(i in e?t(e[i])||e[i]instanceof String||t(n[i])||n[i]instanceof String?r&&(e[i]=n[i]):p(e[i],n[i],r):e[i]=n[i]);return e},m=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`);var h={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`};const ee=e=>t(e)?e.replace(/[&<>"'\/]/g,e=>h[e]):e;var te=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}};const ne=[` `,`,`,`?`,`!`,`;`],re=new te(20),ie=(e,t,n)=>{t||=``,n||=``;let r=ne.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=re.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},g=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},_=e=>e?.replace(/_/g,`-`),ae={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}};var v=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ae,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,n,r,i){return i&&!this.debug?null:(t(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},oe=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},y=class extends oe{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,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){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,n,r,i={}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=i.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:i.ignoreJSONStructure,s;e.indexOf(`.`)>-1?s=e.split(`.`):(s=[e,n],r&&(Array.isArray(r)?s.push(...r):t(r)&&a?s.push(...r.split(a)):s.push(r)));let c=d(this.data,s);return!c&&!n&&!r&&e.indexOf(`.`)>-1&&(e=s[0],n=s[1],r=s.slice(2).join(`.`)),c||!o||!t(r)?c:g(this.data?.[e]?.[n],r,a)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),l(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,n,r,i={silent:!1}){for(let i in r)(t(r[i])||Array.isArray(r[i]))&&this.addResource(e,n,i,r[i],{silent:!0});i.silent||this.emit(`added`,e,n,r)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=d(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?p(s,n,i):s={...s,...n},l(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},b={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}};const se=Symbol(`i18next/PATH_KEY`);function ce(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===se?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function x(e,t){let{[se]:n}=e(ce()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}const le={},ue=e=>!t(e)&&typeof e!=`boolean`&&typeof e!=`number`;var de=class e extends oe{constructor(e,t={}){super(),i([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=v.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=ue(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,n){let r=n.nsSeparator===void 0?this.options.nsSeparator:n.nsSeparator;r===void 0&&(r=`:`);let i=n.keySeparator===void 0?this.options.keySeparator:n.keySeparator,a=n.ns||this.options.defaultNS||[],o=r&&e.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!ie(e,r,i);if(o&&!s){let n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:t(a)?[a]:a};let o=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(i)}return{key:e,namespaces:t(a)?[a]:a}}translate(n,r,i){let a=typeof r==`object`?{...r}:r;if(typeof a!=`object`&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a==`object`&&(a={...a}),a||={},n==null)return``;typeof n==`function`&&(n=x(n,{...this.options,...a})),Array.isArray(n)||(n=[String(n)]),n=n.map(e=>typeof e==`function`?x(e,{...this.options,...a}):String(e));let o=a.returnDetails===void 0?this.options.returnDetails:a.returnDetails,s=a.keySeparator===void 0?this.options.keySeparator:a.keySeparator,{key:c,namespaces:l}=this.extractFromKey(n[n.length-1],a),u=l[l.length-1],d=a.nsSeparator===void 0?this.options.nsSeparator:a.nsSeparator;d===void 0&&(d=`:`);let f=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()===`cimode`)return p?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:c;let m=this.resolve(n,a),h=m?.res,ee=m?.usedKey||c,te=m?.exactUsedKey||c,ne=[`[object Number]`,`[object Function]`,`[object RegExp]`],re=a.joinArrays===void 0?this.options.joinArrays:a.joinArrays,ie=!this.i18nFormat||this.i18nFormat.handleAsObject,g=a.count!==void 0&&!t(a.count),_=e.hasDefaultValue(a),ae=g?this.pluralResolver.getSuffix(f,a.count,a):``,v=a.ordinal&&g?this.pluralResolver.getSuffix(f,a.count,{ordinal:!1}):``,oe=g&&!a.ordinal&&a.count===0,y=oe&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${ae}`]||a[`defaultValue${v}`]||a.defaultValue,b=h;ie&&!h&&_&&(b=y);let se=ue(b),ce=Object.prototype.toString.apply(b);if(ie&&b&&se&&ne.indexOf(ce)<0&&!(t(re)&&Array.isArray(b))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(ee,b,{...a,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=e,m.usedParams=this.getUsedParamsDetails(a),m):e}if(s){let e=Array.isArray(b),t=e?[]:{},n=e?te:ee;for(let e in b)if(Object.prototype.hasOwnProperty.call(b,e)){let r=`${n}${s}${e}`;_&&!h?t[e]=this.translate(r,{...a,defaultValue:ue(y)?y[e]:void 0,joinArrays:!1,ns:l}):t[e]=this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=b[e])}h=t}}else if(ie&&t(re)&&Array.isArray(h))h=h.join(re),h&&=this.extendTranslation(h,n,a,i);else{let e=!1,t=!1;!this.isValidLookup(h)&&_&&(e=!0,h=y),this.isValidLookup(h)||(t=!0,h=c);let r=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&t?void 0:h,o=_&&y!==h&&this.options.updateMissing;if(t||e||o){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,c,o?y:h),s){let e=this.resolve(c,{...a,keySeparator:!1});e&&e.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 e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(a.lng||this.language):e.push(a.lng||this.language);let n=(e,t,n)=>{let i=_&&n!==h?n:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,i,o,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,i,o,a),this.emit(`missingKey`,e,u,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&g?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,a);oe&&a[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],c+t,a[`defaultValue${t}`]||y)})}):n(e,c,y))}h=this.extendTranslation(h,n,a,m,i),t&&h===c&&this.options.appendNamespaceToMissingKey&&(h=`${u}${d}${c}`),(t||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,e?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(e,n,r,i,a){if(this.i18nFormat?.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}});let o=t(e)&&(r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables),s;if(o){let t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let c=r.replace&&!t(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,r.lng||this.language||i.usedLng,r),o){let t=e.match(this.interpolator.nestingRegexp),n=t&&t.length;s<n&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>a?.[0]===e[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${n[0]}`),null):this.translate(...e,n),r)),r.interpolation&&this.interpolator.reset()}let o=r.postProcess||this.options.postProcess,s=t(o)?[o]:o;return e!=null&&s?.length&&r.applyPostProcessor!==!1&&(e=b.handle(s,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,i,a,o,s;return t(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?x(e,{...this.options,...n}):e)),e.forEach(e=>{if(this.isValidLookup(r))return;let c=this.extractFromKey(e,n),l=c.key;i=l;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=n.count!==void 0&&!t(n.count),f=d&&!n.ordinal&&n.count===0,p=n.context!==void 0&&(t(n.context)||typeof n.context==`number`)&&n.context!==``,m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(e=>{this.isValidLookup(r)||(s=e,!le[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(le[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(`, `)}" won't get resolved as namespace "${s}" 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!!!`)),m.forEach(t=>{if(this.isValidLookup(r))return;o=t;let i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,t,e,n);else{let e;d&&(e=this.pluralResolver.getSuffix(t,n.count,n));let r=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(n.ordinal&&e.indexOf(a)===0&&i.push(l+e.replace(a,this.options.pluralSeparator)),i.push(l+e),f&&i.push(l+r)),p){let t=`${l}${this.options.contextSeparator||`_`}${n.context}`;i.push(t),d&&(n.ordinal&&e.indexOf(a)===0&&i.push(t+e.replace(a,this.options.pluralSeparator)),i.push(t+e),f&&i.push(t+r))}}let s;for(;s=i.pop();)this.isValidLookup(r)||(a=s,r=this.getResource(t,e,s,n))}))})}),{res:r,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let n=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],r=e.replace&&!t(e.replace),i=r?e.replace:e;if(r&&e.count!==void 0&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(let e of n)delete i[e]}return i}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},fe=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=v.create(`languageUtils`)}getScriptPartFromCode(e){if(e=_(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=_(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(t(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(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 t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,n){if(!e)return[];if(typeof e==`function`&&(e=e(n)),t(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||=e[this.getScriptPartFromCode(n)],r||=e[this.formatLanguageCode(n)],r||=e[this.getLanguagePartFromCode(n)],r||=e.default,r||[]}toResolveHierarchy(e,n){let r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],a=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return t(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&a(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&a(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&a(this.getLanguagePartFromCode(e))):t(e)&&a(this.formatLanguageCode(e)),r.forEach(e=>{i.indexOf(e)<0&&a(this.formatLanguageCode(e))}),i}};const pe={zero:0,one:1,two:2,few:3,many:4,other:5},me={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})};var he=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=v.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=_(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),me;if(!e.match(/-|_/))return me;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>pe[e]-pe[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}};const ge=(e,n,r,i=`.`,a=!0)=>{let o=f(e,n,r);return!o&&a&&t(r)&&(o=g(e,r,i),o===void 0&&(o=g(n,r,i))),o},_e=e=>e.replace(/\$/g,`$$$$`);var ve=class{constructor(e={}){this.logger=v.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:h,nestingOptionsSeparator:te,maxReplaces:ne,alwaysFormat:re}=e.interpolation;this.escape=t===void 0?ee:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?m(i):a||`{{`,this.suffix=o?m(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?m(d):f||m(`$t(`),this.nestingSuffix=p?m(p):h||m(`)`),this.nestingOptionsSeparator=te||`,`,this.maxReplaces=ne||1e3,this.alwaysFormat=re===void 0?!1:re,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`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,i,a){let o,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=e=>{if(e.indexOf(this.formatSeparator)<0){let t=ge(n,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(t,void 0,i,{...a,...n,interpolationkey:e}):t}let t=e.split(this.formatSeparator),r=t.shift().trim(),o=t.join(this.formatSeparator).trim();return this.format(ge(n,l,r,this.options.keySeparator,this.options.ignoreJSONStructure),o,i,{...a,...n,interpolationkey:r})};this.resetRegExp();let d=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=a?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:a.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>_e(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?_e(this.escape(e)):_e(e)}].forEach(n=>{for(c=0;o=n.regex.exec(e);){let i=o[1].trim();if(s=u(i),s===void 0)if(typeof d==`function`){let n=d(e,o,a);s=t(n)?n:``}else if(a&&Object.prototype.hasOwnProperty.call(a,i))s=``;else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${i} for interpolating ${e}`),s=``;else !t(s)&&!this.useRawValueToEscape&&(s=r(s));let l=n.safeValue(s);if(e=e.replace(o[0],l),f?(n.regex.lastIndex+=s.length,n.regex.lastIndex-=o[0].length):n.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,i={}){let a,o,s,c=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${m(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,s);let a=i.match(/'/g),o=i.match(/"/g);((a?.length??0)%2==0&&!o||(o?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{s=JSON.parse(i),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,e};for(;a=this.nestingRegexp.exec(e);){let l=[];s={...i},s=s.replace&&!t(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=/{.*}/.test(a[1])?a[1].lastIndexOf(`}`)+1:a[1].indexOf(this.formatSeparator);if(u!==-1&&(l=a[1].slice(u).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),a[1]=a[1].slice(0,u)),o=n(c.call(this,a[1].trim(),s),s),o&&a[0]===e&&!t(o))return o;t(o)||(o=r(o)),o||=(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),``),l.length&&(o=l.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:a[1].trim()}),o.trim())),e=e.replace(a[0],o),this.regexp.lastIndex=0}return e}};const ye=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},be=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(_(r),i),t[o]=s),s(n)}},xe=e=>(t,n,r)=>e(_(n),r)(t);var Se=class{constructor(e={}){this.logger=v.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?be:xe;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=be(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ye(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}};const Ce=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};var we=class extends oe{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=v.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{u(n.loaded,[i],a),Ce(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,n,r={},i){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),i&&i();t(e)&&(e=this.languageUtils.toResolveHierarchy(e)),t(n)&&(n=[n]);let a=this.queueLoad(e,n,r,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" 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(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}};const Te=()=>({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:e=>{let n={};if(typeof e[1]==`object`&&(n=e[1]),t(e[1])&&(n.defaultValue=e[1]),t(e[2])&&(n.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let t=e[3]||e[2];Object.keys(t).forEach(e=>{n[e]=t[e]})}return n},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ee=e=>(t(e.ns)&&(e.ns=[e.ns]),t(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),t(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),De=()=>{},Oe=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},ke=`__i18next_supportNoticeShown`,Ae=()=>!!(typeof globalThis<`u`&&globalThis[ke]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env&&process.env.NODE_ENV===`production`),je=()=>{typeof globalThis<`u`&&(globalThis[ke]=!0)},Me=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),S=class e extends oe{constructor(e={},t){if(super(),this.options=Ee(e),this.services={},this.logger=v,this.modules={external:[]},Oe(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},r){this.isInitializing=!0,typeof e==`function`&&(r=e,e={}),e.defaultNS==null&&e.ns&&(t(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let i=Te();this.options={...i,...this.options,...Ee(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Me(this)&&!Ae()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),je());let a=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?v.init(a(this.modules.logger),this.options):v.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Se;let t=new fe(this.options);this.store=new y(this.options.resources,this.options);let n=this.services;n.logger=v,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new he(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(n.formatter=a(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new ve(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new we(a(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=a(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=a(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new de(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,r||=De,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[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(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let o=n(),s=()=>{let e=(e,t)=>{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),o.resolve(t),r(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?s():setTimeout(s,0),o}loadResources(e,n=De){let r=n,i=t(e)?e:this.language;if(typeof e==`function`&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return r();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};i?t(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(e)})}else r(null)}reloadResources(e,t,r){let i=n();return typeof e==`function`&&(r=e,e=void 0),typeof t==`function`&&(r=t,t=void 0),e||=this.languages,t||=this.options.ns,r||=De,this.services.backendConnector.reload(e,t,e=>{i.resolve(),r(e)}),i}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw 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`&&b.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 e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let i=n();this.emit(`languageChanging`,e);let a=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(t,n)=>{n?this.isLanguageChangingTo===e&&(a(n),this.translator.changeLanguage(n),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,n),this.logger.log(`languageChanged`,n)):this.isLanguageChangingTo=void 0,i.resolve((...e)=>this.t(...e)),r&&r(t,(...e)=>this.t(...e))},s=n=>{!e&&!n&&this.services.languageDetector&&(n=[]);let r=t(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(t(n)?[n]:n);i&&(this.language||a(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{o(e,i)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),i}getFixedT(e,n,r){let i=(e,t,...n)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(n)),a.lng=a.lng||i.lng,a.lngs=a.lngs||i.lngs,a.ns=a.ns||i.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||r||i.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=x(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=x(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=x(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return t(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=r,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,r){let i=n();return this.options.ns?(t(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{i.resolve(),r&&r(e)}),i):(r&&r(),Promise.resolve())}loadLanguages(e,r){let i=n();t(e)&&(e=[e]);let a=this.options.preload||[],o=e.filter(e=>a.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=a.concat(o),this.loadResources(e=>{i.resolve(),r&&r(e)}),i):(r&&r(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`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`.split(`.`),n=this.services?.languageUtils||new fe(Te());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=De){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new y(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Te().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new ve(n)}return a.translator=new de(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();S.createInstance,S.dir,S.init,S.loadResources,S.reloadResources,S.use,S.changeLanguage,S.getFixedT,S.t,S.exists,S.setDefaultNamespace,S.hasLoadedNamespace,S.loadNamespaces,S.loadLanguages;const Ne=[`en`,`zh-Hans`],Pe=/^zh(?:[-_]|$)/i,Fe=e=>Ne.includes(e),Ie=e=>{if(!e)return null;let t=e.trim();return t?Fe(t)?t:Pe.test(t)?`zh-Hans`:t.toLowerCase().startsWith(`en`)?`en`:null:null},Le=e=>{for(let t of e){let e=Ie(t);if(e)return e}return`en`};new Set(Ne);const Re={finish:()=>{}},ze=()=>({setContext:()=>{},setFingerprint:()=>{},setLevel:()=>{},setTag:()=>{},setUser:()=>{}}),Be=()=>({addBreadcrumb:e=>{},captureException:e=>{},destroy:async()=>{},enabled:!1,flush:async()=>!0,init:async()=>{},startInactiveSpan:e=>Re,withScope:e=>e(ze())}),Ve=e=>{if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t},He=e=>typeof e==`string`?e:String(e),Ue=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},We=e=>{let t={clientApp:e.clientApp,environment:e.environment,runtime:e.runtime,...e.appVersion?{appVersion:e.appVersion}:{},...e.release?{release:e.release}:{}},n={client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{}};return{contexts:{client:t},tags:n,user:{id:null}}},Ge=(e,t,n)=>{let r=Ue(n);if(Object.keys(r).length===0){delete e.contexts[t];return}e.contexts[t]=r},Ke=(e,t)=>{delete e.contexts[t]},qe=(e,t,n)=>{if(n==null||n===``){delete e.tags[t];return}e.tags[t]=He(n)},Je=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Ye=/^[a-f0-9]{16,}$/i,Xe=/^\d{4,}$/,Ze=new Set([`access_token`,`code`,`jwt`,`refresh_token`,`session`,`signature`,`state`,`token`]),Qe=new Set([`authorization`,`cookie`,`set-auth-token`,`set-cookie`,`x-api-key`,`x-auth-token`,`x-csrf-token`]),$e=e=>e&&(Je.test(e)?`:uuid`:Xe.test(e)?`:id`:Ye.test(e)?`:hash`:e),et=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`forEach`in e&&typeof e.forEach==`function`,tt=e=>{if(!e)return[];if(et(e)){let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t}return Array.isArray(e)?e.map(([e,t])=>[e,t]):Object.entries(e).flatMap(([e,t])=>Array.isArray(t)?t.map(t=>[e,String(t)]):t==null?[]:[[e,String(t)]])},nt=e=>{let t={};for(let[n,r]of tt(e)){let e=n.toLowerCase();Qe.has(e)||(t[e]=r)}return t},rt=e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``,t.pathname=t.pathname.split(`/`).map($e).join(`/`);let n=new URLSearchParams;return t.searchParams.forEach((e,t)=>{Ze.has(t.toLowerCase())||n.append(t,e)}),t.search=n.toString(),t.toString()}catch{let[t]=e.split(`?`);return t??e}},it=(e,t=512)=>e.length<=t?e:`${e.slice(0,t)}…`,at=e=>e<=0?!1:e>=1?!0:Math.random()<e,ot=e=>e.errorClass===`user_facing`?`warning`:`error`,st=e=>{switch(e){case`ok`:return`ok`;case`timeout`:return`deadline_exceeded`;case`send_failed`:return`internal_error`;default:return`internal_error`}},C=e=>e instanceof Error?e:Error(it(typeof e==`string`?e:`Unknown frontend stability error`)),ct=e=>e??`info`,lt=(e,t)=>{let n=e.flushTimeoutMs??1500,r=We(e),i=(e,n)=>t.withScope(t=>{for(let[e,n]of Object.entries(r.tags))t.setTag(e,n);for(let[e,n]of Object.entries(r.contexts))t.setContext(e,n);if(r.user.id&&t.setUser({id:r.user.id}),!e)return n();for(let[n,r]of Object.entries(e.tags??{}))r&&t.setTag(n,r);for(let[n,r]of Object.entries(e.contexts??{}))t.setContext(n,r);return e.level&&t.setLevel(e.level),e.fingerprint&&e.fingerprint.length>0&&t.setFingerprint(e.fingerprint),n()}),a=n=>{let r=Ve({client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{},...n.attributes??{}});return t.startInactiveSpan({name:n.name,op:n.op,attributes:r})};return{addBreadcrumb:e=>{t.enabled&&(e.level!==`error`&&e.level!==`fatal`&&!at(.2)||t.addBreadcrumb({...e,level:ct(e.level)}))},captureException:(e,n)=>{t.enabled&&i(n,()=>{t.captureException(C(e))})},clearScopeContext:e=>{Ke(r,e)},clearUser:()=>{r.user={id:null}},createHttpPort:()=>({onRequestStart:({kind:e,method:n,timeoutMs:r,url:o})=>{let s=a({name:`${n} ${e}`,op:`http.client`,attributes:{http_kind:e,http_method:n,http_url:o,...r===void 0?{}:{http_timeout_ms:r}}});return{finish:({error:a,status:c,statusCode:l})=>{s.finish({attributes:{http_result:c,...l===void 0?{}:{http_status_code:l}},status:st(c)}),c===`error`&&a&&i({contexts:{http:{method:n,statusCode:l,timeoutMs:r,url:o}},level:`error`,tags:{http_kind:e,http_method:n,http_result:c}},()=>{t.captureException(C(a))})}}}}),createNetworkPort:()=>({onHeartbeatTimeout:({error:e,intervalMs:n})=>{i({contexts:{network:{intervalMs:n}},level:`warning`,tags:{transport_phase:`heartbeat_timeout`}},()=>{t.captureException(C(e??Error(`Heartbeat timed out`)))})},onRpcStart:({channel:e,timeoutMs:n})=>{let r=a({name:e,op:`rpc.client`,attributes:{rpc_channel:e,rpc_timeout_ms:n}});return{finish:a=>{r.finish({attributes:{rpc_result:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{rpc_error_class:a.errorClass}:{}},status:st(a.status)}),a.status!==`ok`&&i({contexts:{rpc:{channel:e,code:a.code,domain:a.domain,errorClass:a.errorClass,timeoutMs:n}},level:ot(a),tags:{rpc_channel:e,rpc_result:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{rpc_error_class:a.errorClass}:{}}},()=>{t.captureException(C(a.error))})}}},onTransportError:({error:e,phase:n})=>{i({contexts:{transport:{phase:n}},level:`error`,tags:{transport_phase:n}},()=>{t.captureException(C(e))})},onWsConnectStart:({kind:e})=>{let n=a({name:`ws.${e}`,op:`ws.connect`,attributes:{ws_kind:e}});return{finish:({error:r,status:a})=>{n.finish({attributes:{ws_kind:e,ws_result:a},status:st(a)}),a===`error`&&i({contexts:{transport:{kind:e}},level:`error`,tags:{ws_kind:e,ws_result:a}},()=>{t.captureException(C(r))})}}},onWsEvent:({channel:e})=>{at(.2)&&t.addBreadcrumb({category:`ws.event`,data:{channel:e},level:`info`,message:`Received ${e}`})},onWsStatusChange:({status:e})=>{t.enabled&&t.addBreadcrumb({category:`ws.status`,data:{status:e},level:e===`error`?`error`:`info`,message:`Transport ${e}`})}}),flush:async e=>t.enabled?await t.flush(e??n):!1,setScopeContext:(e,t)=>{Ge(r,e,t)},setTag:(e,t)=>{qe(r,e,t)},setUser:e=>{r.user=e},startSpan:a}},ut=e=>e.length===0?[Be()]:e,dt=e=>{let t=ut(e);return t.find(e=>e.enabled)??t[0]??Be()},ft=e=>{let t=ut(e),n=dt(t),r=t.filter(e=>e.enabled);return{addBreadcrumb:e=>{for(let n of t)try{n.addBreadcrumb(e)}catch{}},captureException:e=>{for(let n of t)try{n.captureException(e)}catch{}},destroy:async()=>{for(let e of t)if(e.destroy)try{await e.destroy()}catch{}},enabled:t.some(e=>e.enabled),flush:async e=>(await Promise.allSettled((r.length>0?r:t).map(async t=>{try{return await t.flush(e)}catch{return!1}}))).every(e=>e.status===`fulfilled`&&e.value===!0),init:async()=>{for(let e of t)if(e.init)try{await e.init()}catch{}},startInactiveSpan:e=>{try{return n.startInactiveSpan(e)}catch{return Be().startInactiveSpan(e)}},withScope:e=>{let t=e;try{return n.withScope(t)}catch{return Be().withScope(t)}}}};let pt=function(e){return e.NOOP=`noop`,e.POSTHOG_BROWSER=`posthog-browser`,e.POSTHOG_REACT_NATIVE=`posthog-react-native`,e.SENTRY=`sentry`,e}({});const mt=new Set(Object.values(pt)),ht=(e,t=[pt.SENTRY])=>{let n=e?.trim();if(!n)return{invalidNames:[],names:[...t]};let r=n.split(`,`),i=[],a=[];for(let e of r){let t=e.trim().toLowerCase();if(!t)continue;if(!mt.has(t)){i.push(t);continue}let n=t;a.includes(n)||a.push(n)}return a.length>0?{invalidNames:i,names:a}:{invalidNames:i,names:[]}},gt=e=>{let t={};for(let[n,r]of Object.entries(e))r==null||r===``||(t[n]=r);return t},_t=e=>Object.keys(e).length>0,vt=(e,t)=>{t.userId?e.setUser({id:t.userId}):e.clearUser(),e.setTag(`workspace_id`,t.workspaceId??null),e.setTag(`pipeline_id`,t.pipelineId??null),e.setTag(`task_id`,t.taskId??null),e.setTag(`environment_id`,t.environmentId??null),e.setTag(`route_view`,t.routeView??null),e.setTag(`command_name`,t.commandName??null),e.setTag(`auth_phase`,t.authPhase??null);let n=gt({deviceCode:t.deviceCode,environmentId:t.environmentId,memberId:t.memberId,pipelineId:t.pipelineId,taskId:t.taskId,workspaceId:t.workspaceId});_t(n)?e.setScopeContext(`echo`,n):e.clearScopeContext(`echo`);let r=gt({authPhase:t.authPhase,commandName:t.commandName,cwd:t.cwd,interactive:t.interactive,routeTemplate:t.routeTemplate,routeView:t.routeView,screen:t.screen});_t(r)?e.setScopeContext(`surface`,r):e.clearScopeContext(`surface`)},yt={finish:()=>{}},bt={finish:()=>{}},xt={finish:()=>{}},St=()=>({onHeartbeatTimeout:()=>{},onRpcStart:()=>yt,onTransportError:()=>{},onWsConnectStart:()=>bt,onWsEvent:()=>{},onWsStatusChange:()=>{}}),Ct=()=>({onRequestStart:()=>xt}),wt=/^[^@]+@([^+]+)(?:\+.+)?$/,Tt=e=>{if(!e)return;let t=wt.exec(e.trim())?.[1]?.trim();if(t)return t},Et=/\/+$/,w=e=>e.replace(Et,``),Dt=e=>e instanceof Request?e.url:e instanceof URL?e.toString():e,Ot=(e,t)=>t?.method?t.method:e instanceof Request?e.method:`GET`,kt=(e={})=>{let t=e.fetchImpl??fetch,n=e.observability??Ct(),r=e.kind??`http`;return async(e,i)=>{let a=rt(Dt(e)),o=Ot(e,i).toUpperCase(),s=n.onRequestStart({kind:r,method:o,url:a});try{let n=await t(e,i);return s.finish({status:`ok`,statusCode:n.status}),n}catch(e){throw s.finish({status:`error`,error:e}),e}}};Object.freeze({status:`aborted`});function T(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var At=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},jt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const Mt={};function E(e){return e&&Object.assign(Mt,e),Mt}function Nt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Pt(e,t){return typeof t==`bigint`?t.toString():t}function Ft(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function It(e){return e==null}function Lt(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Rt(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const zt=Symbol(`evaluating`);function D(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==zt)return r===void 0&&(r=zt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function O(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function k(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Bt(e){return JSON.stringify(e)}function Vt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Ht=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Wt=Ft(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function A(e){if(Ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ut(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Gt(e){return A(e)?{...e}:Array.isArray(e)?[...e]:e}const Kt=new Set([`string`,`number`,`symbol`]);function j(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function M(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function qt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Jt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Yt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return M(e,k(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return O(this,`shape`,e),e},checks:[]}))}function Xt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return M(e,k(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return O(this,`shape`,r),r},checks:[]}))}function Zt(e,t){if(!A(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return M(e,k(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return O(this,`shape`,n),n}}))}function Qt(e,t){if(!A(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return M(e,k(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return O(this,`shape`,n),n}}))}function $t(e,t){return M(e,k(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return O(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function en(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return M(t,k(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return O(this,`shape`,i),i},checks:[]}))}function tn(e,t,n){return M(t,k(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return O(this,`shape`,i),i}}))}function P(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nn(e){return typeof e==`string`?e:e?.message}function I(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nn(e.inst?._zod.def?.error?.(e))??nn(t?.error?.(e))??nn(n.customError?.(e))??nn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function rn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function an(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const on=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pt,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},sn=T(`$ZodError`,on),cn=T(`$ZodError`,on,{Parent:Error});function ln(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function un(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}const dn=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new At;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,E())));throw Ht(t,i?.callee),t}return o.value},fn=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,E())));throw Ht(t,i?.callee),t}return o.value},pn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new At;return a.issues.length?{success:!1,error:new(e??sn)(a.issues.map(e=>I(e,i,E())))}:{success:!0,data:a.value}},mn=pn(cn),hn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>I(e,i,E())))}:{success:!0,data:a.value}},gn=hn(cn),_n=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dn(e)(t,n,i)},vn=e=>(t,n,r)=>dn(e)(t,n,r),yn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fn(e)(t,n,i)},bn=e=>async(t,n,r)=>fn(e)(t,n,r),xn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pn(e)(t,n,i)},Sn=e=>(t,n,r)=>pn(e)(t,n,r),Cn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hn(e)(t,n,i)},wn=e=>async(t,n,r)=>hn(e)(t,n,r),Tn=/^[cC][^\s-]{8,}$/,En=/^[0-9a-z]+$/,Dn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,On=/^[0-9a-vA-V]{20}$/,kn=/^[A-Za-z0-9]{27}$/,An=/^[a-zA-Z0-9_-]{21}$/,jn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Nn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Fn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const In=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vn=/^[A-Za-z0-9_-]*$/,Hn=/^\+[1-9]\d{6,14}$/,Un=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Wn=RegExp(`^${Un}$`);function Gn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kn(e){return RegExp(`^${Gn(e)}$`)}function qn(e){let t=Gn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Un}T(?:${r})$`)}const Jn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yn=/^-?\d+$/,Xn=/^-?\d+(?:\.\d+)?$/,Zn=/^(?:true|false)$/i,Qn=/^null$/i,$n=/^[^A-Z]*$/,er=/^[^a-z]*$/,L=T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tr={number:`number`,bigint:`bigint`,object:`date`},nr=T(`$ZodCheckLessThan`,(e,t)=>{L.init(e,t);let n=tr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rr=T(`$ZodCheckGreaterThan`,(e,t)=>{L.init(e,t);let n=tr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=T(`$ZodCheckMultipleOf`,(e,t)=>{L.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Rt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ar=T(`$ZodCheckNumberFormat`,(e,t)=>{L.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Jt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),or=T(`$ZodCheckMaxLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!It(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=rn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sr=T(`$ZodCheckMinLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!It(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=rn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cr=T(`$ZodCheckLengthEquals`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!It(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=rn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),lr=T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;L.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ur=T(`$ZodCheckRegex`,(e,t)=>{lr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dr=T(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$n,lr.init(e,t)}),fr=T(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=er,lr.init(e,t)}),pr=T(`$ZodCheckIncludes`,(e,t)=>{L.init(e,t);let n=j(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),mr=T(`$ZodCheckStartsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`^${j(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),hr=T(`$ZodCheckEndsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`.*${j(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),gr=T(`$ZodCheckOverwrite`,(e,t)=>{L.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var _r=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
2
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
3
  `))}};const vr={major:4,minor:3,patch:6},R=T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=P(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new At;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=P(e,t))});else{if(e.issues.length===t)continue;r||=P(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(P(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new At;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new At;return o.then(e=>t(e,r,a))}return t(o,r,a)}}D(e,`~standard`,()=>({validate:t=>{try{let n=mn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return gn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),yr=T(`$ZodString`,(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),z=T(`$ZodStringFormat`,(e,t)=>{lr.init(e,t),yr.init(e,t)}),br=T(`$ZodGUID`,(e,t)=>{t.pattern??=Mn,z.init(e,t)}),xr=T(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Nn(e)}else t.pattern??=Nn();z.init(e,t)}),Sr=T(`$ZodEmail`,(e,t)=>{t.pattern??=Pn,z.init(e,t)}),Cr=T(`$ZodURL`,(e,t)=>{z.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),wr=T(`$ZodEmoji`,(e,t)=>{t.pattern??=Fn(),z.init(e,t)}),Tr=T(`$ZodNanoID`,(e,t)=>{t.pattern??=An,z.init(e,t)}),Er=T(`$ZodCUID`,(e,t)=>{t.pattern??=Tn,z.init(e,t)}),Dr=T(`$ZodCUID2`,(e,t)=>{t.pattern??=En,z.init(e,t)}),Or=T(`$ZodULID`,(e,t)=>{t.pattern??=Dn,z.init(e,t)}),kr=T(`$ZodXID`,(e,t)=>{t.pattern??=On,z.init(e,t)}),Ar=T(`$ZodKSUID`,(e,t)=>{t.pattern??=kn,z.init(e,t)}),jr=T(`$ZodISODateTime`,(e,t)=>{t.pattern??=qn(t),z.init(e,t)}),Mr=T(`$ZodISODate`,(e,t)=>{t.pattern??=Wn,z.init(e,t)}),Nr=T(`$ZodISOTime`,(e,t)=>{t.pattern??=Kn(t),z.init(e,t)}),Pr=T(`$ZodISODuration`,(e,t)=>{t.pattern??=jn,z.init(e,t)}),Fr=T(`$ZodIPv4`,(e,t)=>{t.pattern??=In,z.init(e,t),e._zod.bag.format=`ipv4`}),Ir=T(`$ZodIPv6`,(e,t)=>{t.pattern??=Ln,z.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Lr=T(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rn,z.init(e,t)}),Rr=T(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zn,z.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function zr(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Br=T(`$ZodBase64`,(e,t)=>{t.pattern??=Bn,z.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{zr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Vr(e){if(!Vn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return zr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Hr=T(`$ZodBase64URL`,(e,t)=>{t.pattern??=Vn,z.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Vr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ur=T(`$ZodE164`,(e,t)=>{t.pattern??=Hn,z.init(e,t)});function Wr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Gr=T(`$ZodJWT`,(e,t)=>{z.init(e,t),e._zod.check=n=>{Wr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Kr=T(`$ZodNumber`,(e,t)=>{R.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),qr=T(`$ZodNumberFormat`,(e,t)=>{ar.init(e,t),Kr.init(e,t)}),Jr=T(`$ZodBoolean`,(e,t)=>{R.init(e,t),e._zod.pattern=Zn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Yr=T(`$ZodNull`,(e,t)=>{R.init(e,t),e._zod.pattern=Qn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Xr=T(`$ZodUnknown`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),Zr=T(`$ZodNever`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Qr(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}const $r=T(`$ZodArray`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Qr(t,n,e))):Qr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ei(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...F(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ti(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=qt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ni(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ei(e,n,i,t,u))):ei(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const ri=T(`$ZodObject`,(e,t)=>{if(R.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Ft(()=>ti(t));D(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Ut,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>ei(n,t,e,s,r))):ei(i,t,e,s,r)}return i?ni(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ii=T(`$ZodObjectJIT`,(e,t)=>{ri.init(e,t);let n=e._zod.parse,r=Ft(()=>ti(t)),i=e=>{let t=new _r([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Bt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Bt(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
4
4
  if (${n}.issues.length) {
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,n as r,t as i}from"./status-B0HhS6E_-Bzj2KB_H.js";import{r as a,t as o}from"./runtime_auth_helpers-etyYdhk_-CPOCmDQP.js";const s=async e=>{await new Promise(t=>{setTimeout(t,e)})},c=t=>{switch(t){case r.GITHUB:return e.GITHUB;case r.GOOGLE:return e.GOOGLE;case r.SLACK:return e.SLACK;case r.GOOGLE_WORKSPACE:return e.GOOGLE_WORKSPACE;default:throw Error(`EXTERNAL_AUTH_PROVIDER_REQUIRED`)}},l=e=>e===r.GOOGLE_WORKSPACE?n.SSO:n.OAUTH,u=(e,t)=>{switch(t){case r.GITHUB:if(!e.github)throw Error(`GITHUB_LOGIN_ADAPTER_REQUIRED`);return e.github;case r.GOOGLE:if(!e.google)throw Error(`GOOGLE_LOGIN_ADAPTER_REQUIRED`);return e.google;case r.SLACK:if(!e.slack)throw Error(`SLACK_LOGIN_ADAPTER_REQUIRED`);return e.slack;case r.GOOGLE_WORKSPACE:if(!e.googleWorkspace)throw Error(`GOOGLE_WORKSPACE_LOGIN_ADAPTER_REQUIRED`);return e.googleWorkspace;case r.APPLE_NATIVE:if(!e.appleNative)throw Error(`APPLE_NATIVE_LOGIN_ADAPTER_REQUIRED`);return e.appleNative;default:throw Error(`UNSUPPORTED_AUTH_PROVIDER`)}},d=e=>`exchangeForToken`in e,f=e=>{if(e)return{fetchImpl:e}},p=e=>({startLogin:async(n,p)=>{let m=e.useLoginCycleStore.getState();if(n===r.EMAIL){let n=p;m.patchState({email:n.email,errorMessage:null,pendingExternalAuth:null,status:n.code?t.FINALIZING_LOGIN:t.EMAIL_REQUESTING_CODE});try{if(!n.code)return await o(e.apiBaseUrl,n.email,f(e.httpFetch)),m.patchState({status:t.EMAIL_AWAITING_CODE}),{ok:!0};let r=await a(e.apiBaseUrl,n.email,n.code,n.preferredLanguage,f(e.httpFetch));return m.reset(),{ok:!0,token:r.token}}catch(e){return m.patchState({errorMessage:e instanceof Error?e.message:`EMAIL_LOGIN_FAILED`,status:t.ERROR}),{ok:!1}}}let h=u(e.providers,n);m.patchState({errorMessage:null,pendingExternalAuth:null,status:t.EXTERNAL_AUTH_STARTING});try{let r=p;if(d(h)){m.patchState({status:t.FINALIZING_LOGIN});let n=await h.exchangeForToken(e.apiBaseUrl,r,f(e.httpFetch));return m.reset(),{ok:!0,token:n.token}}let a=await h.startLogin(e.apiBaseUrl,{preferredLanguage:r.preferredLanguage},f(e.httpFetch)),o={kind:l(n),provider:c(n),state:a.state};for(m.patchState({pendingExternalAuth:o,status:t.EXTERNAL_AUTH_WAITING}),await e.hooks.openExternalUrl(a.authorizationUrl);;){let n=await h.requestCompletion(e.apiBaseUrl,{state:o.state},f(e.httpFetch));if(n.status===i.PENDING){await s(500);continue}if(n.status===i.EXPIRED)return m.patchState({errorMessage:`Authentication timed out`,pendingExternalAuth:null,status:t.ERROR}),{ok:!1};if(n.status===i.ERROR){let e=typeof n.reason==`string`?n.reason:`Authentication failed`;return m.patchState({errorMessage:e,pendingExternalAuth:null,status:t.ERROR}),{ok:!1}}return n.token?(m.patchState({status:t.FINALIZING_LOGIN}),m.reset(),{ok:!0,token:n.token}):(m.patchState({errorMessage:`Authentication could not be completed`,pendingExternalAuth:null,status:t.ERROR}),{ok:!1})}}catch(e){return m.patchState({errorMessage:e instanceof Error?e.message:`EXTERNAL_LOGIN_FAILED`,pendingExternalAuth:null,status:t.ERROR}),{ok:!1}}},reset:()=>{e.useLoginCycleStore.getState().reset()}});export{p as createLoginCycle};
1
+ import{a as e,c as t,i as n,n as r,t as i}from"./status-B0HhS6E_-Bzj2KB_H.js";import{r as a,t as o}from"./runtime_auth_helpers-etyYdhk_-C1ZUGu8v.js";const s=async e=>{await new Promise(t=>{setTimeout(t,e)})},c=t=>{switch(t){case r.GITHUB:return e.GITHUB;case r.GOOGLE:return e.GOOGLE;case r.SLACK:return e.SLACK;case r.GOOGLE_WORKSPACE:return e.GOOGLE_WORKSPACE;default:throw Error(`EXTERNAL_AUTH_PROVIDER_REQUIRED`)}},l=e=>e===r.GOOGLE_WORKSPACE?n.SSO:n.OAUTH,u=(e,t)=>{switch(t){case r.GITHUB:if(!e.github)throw Error(`GITHUB_LOGIN_ADAPTER_REQUIRED`);return e.github;case r.GOOGLE:if(!e.google)throw Error(`GOOGLE_LOGIN_ADAPTER_REQUIRED`);return e.google;case r.SLACK:if(!e.slack)throw Error(`SLACK_LOGIN_ADAPTER_REQUIRED`);return e.slack;case r.GOOGLE_WORKSPACE:if(!e.googleWorkspace)throw Error(`GOOGLE_WORKSPACE_LOGIN_ADAPTER_REQUIRED`);return e.googleWorkspace;case r.APPLE_NATIVE:if(!e.appleNative)throw Error(`APPLE_NATIVE_LOGIN_ADAPTER_REQUIRED`);return e.appleNative;default:throw Error(`UNSUPPORTED_AUTH_PROVIDER`)}},d=e=>`exchangeForToken`in e,f=e=>{if(e)return{fetchImpl:e}},p=e=>({startLogin:async(n,p)=>{let m=e.useLoginCycleStore.getState();if(n===r.EMAIL){let n=p;m.patchState({email:n.email,errorMessage:null,pendingExternalAuth:null,status:n.code?t.FINALIZING_LOGIN:t.EMAIL_REQUESTING_CODE});try{if(!n.code)return await o(e.apiBaseUrl,n.email,f(e.httpFetch)),m.patchState({status:t.EMAIL_AWAITING_CODE}),{ok:!0};let r=await a(e.apiBaseUrl,n.email,n.code,n.preferredLanguage,f(e.httpFetch));return m.reset(),{ok:!0,token:r.token}}catch(e){return m.patchState({errorMessage:e instanceof Error?e.message:`EMAIL_LOGIN_FAILED`,status:t.ERROR}),{ok:!1}}}let h=u(e.providers,n);m.patchState({errorMessage:null,pendingExternalAuth:null,status:t.EXTERNAL_AUTH_STARTING});try{let r=p;if(d(h)){m.patchState({status:t.FINALIZING_LOGIN});let n=await h.exchangeForToken(e.apiBaseUrl,r,f(e.httpFetch));return m.reset(),{ok:!0,token:n.token}}let a=await h.startLogin(e.apiBaseUrl,{preferredLanguage:r.preferredLanguage},f(e.httpFetch)),o={kind:l(n),provider:c(n),state:a.state};for(m.patchState({pendingExternalAuth:o,status:t.EXTERNAL_AUTH_WAITING}),await e.hooks.openExternalUrl(a.authorizationUrl);;){let n=await h.requestCompletion(e.apiBaseUrl,{state:o.state},f(e.httpFetch));if(n.status===i.PENDING){await s(500);continue}if(n.status===i.EXPIRED)return m.patchState({errorMessage:`Authentication timed out`,pendingExternalAuth:null,status:t.ERROR}),{ok:!1};if(n.status===i.ERROR){let e=typeof n.reason==`string`?n.reason:`Authentication failed`;return m.patchState({errorMessage:e,pendingExternalAuth:null,status:t.ERROR}),{ok:!1}}return n.token?(m.patchState({status:t.FINALIZING_LOGIN}),m.reset(),{ok:!0,token:n.token}):(m.patchState({errorMessage:`Authentication could not be completed`,pendingExternalAuth:null,status:t.ERROR}),{ok:!1})}}catch(e){return m.patchState({errorMessage:e instanceof Error?e.message:`EXTERNAL_LOGIN_FAILED`,pendingExternalAuth:null,status:t.ERROR}),{ok:!1}}},reset:()=>{e.useLoginCycleStore.getState().reset()}});export{p as createLoginCycle};
@@ -1 +1 @@
1
- import{f as e,l as t,o as n,p as r}from"./dist-BdeYED-l.js";const i=e=>({token:e.token,expiresAt:e.session.expiresAt,updatedAt:e.session.updatedAt,userId:e.user.id,email:e.user.email,name:e.user.name,avatarUrl:e.user.image??``,onboardingCompleted:e.onboardingCompleted}),a=async(e,r,a)=>{let o=await t(e,{token:r},a);if(o.status===n.UNAUTHORIZED)return{status:n.UNAUTHORIZED,session:null};if(!o.session)throw Error(`GET_SESSION_BODY_REQUIRED`);return{status:n.OK,session:i(o.session)}},o=async(t,n,r)=>{await e(t,{email:n},r)},s=async(e,t,i,o,s)=>{let c=await a(e,(await r(e,{email:t,otp:i,preferredLanguage:o},s)).token,s);if(c.status!==n.OK||!c.session)throw Error(`Failed to load authenticated session`);return c.session};export{a as n,s as r,o as t};
1
+ import{f as e,l as t,o as n,p as r}from"./dist-D-Wi6B-S.js";const i=e=>({token:e.token,expiresAt:e.session.expiresAt,updatedAt:e.session.updatedAt,userId:e.user.id,email:e.user.email,name:e.user.name,avatarUrl:e.user.image??``,onboardingCompleted:e.onboardingCompleted}),a=async(e,r,a)=>{let o=await t(e,{token:r},a);if(o.status===n.UNAUTHORIZED)return{status:n.UNAUTHORIZED,session:null};if(!o.session)throw Error(`GET_SESSION_BODY_REQUIRED`);return{status:n.OK,session:i(o.session)}},o=async(t,n,r)=>{await e(t,{email:n},r)},s=async(e,t,i,o,s)=>{let c=await a(e,(await r(e,{email:t,otp:i,preferredLanguage:o},s)).token,s);if(c.status!==n.OK||!c.session)throw Error(`Failed to load authenticated session`);return c.session};export{a as n,s as r,o as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./runtime_auth_helpers-etyYdhk_-C1ZUGu8v.js";export{e as resolveSessionFromToken};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "echo-cli",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "private": true,
6
6
  "files": [
7
7
  ".env.example",
@@ -24,6 +24,7 @@
24
24
  "test": "vitest run"
25
25
  },
26
26
  "dependencies": {
27
+ "@echo/codex-sdk-ext": "workspace:*",
27
28
  "@echo/entities": "workspace:*",
28
29
  "@echo/frontend-observability": "workspace:*",
29
30
  "@echo/frontend-types": "workspace:*",
@@ -1 +0,0 @@
1
- import{n as e}from"./runtime_auth_helpers-etyYdhk_-CPOCmDQP.js";export{e as resolveSessionFromToken};