@langgenius/nodwork-darwin-arm64 0.0.4 → 0.0.5

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.
@@ -0,0 +1,39 @@
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=[` `,`,`,`?`,`!`,`;`],g=new te(20),re=(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=g.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},_=(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},v=e=>e?.replace(/_/g,`-`),ie={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 y=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ie,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)}},ae=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])})}},b=class extends ae{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:_(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}},x={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 oe=Symbol(`i18next/PATH_KEY`);function se(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===oe?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function S(e,t){let{[oe]:n}=e(se()),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 ce={},le=e=>!t(e)&&typeof e!=`boolean`&&typeof e!=`number`;var ue=class e extends ae{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=y.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=le(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&&!re(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=S(n,{...this.options,...a})),Array.isArray(n)||(n=[String(n)]),n=n.map(e=>typeof e==`function`?S(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]`],g=a.joinArrays===void 0?this.options.joinArrays:a.joinArrays,re=!this.i18nFormat||this.i18nFormat.handleAsObject,_=a.count!==void 0&&!t(a.count),v=e.hasDefaultValue(a),ie=_?this.pluralResolver.getSuffix(f,a.count,a):``,y=a.ordinal&&_?this.pluralResolver.getSuffix(f,a.count,{ordinal:!1}):``,ae=_&&!a.ordinal&&a.count===0,b=ae&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${ie}`]||a[`defaultValue${y}`]||a.defaultValue,x=h;re&&!h&&v&&(x=b);let oe=le(x),se=Object.prototype.toString.apply(x);if(re&&x&&oe&&ne.indexOf(se)<0&&!(t(g)&&Array.isArray(x))){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,x,{...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(x),t=e?[]:{},n=e?te:ee;for(let e in x)if(Object.prototype.hasOwnProperty.call(x,e)){let r=`${n}${s}${e}`;v&&!h?t[e]=this.translate(r,{...a,defaultValue:le(b)?b[e]:void 0,joinArrays:!1,ns:l}):t[e]=this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=x[e])}h=t}}else if(re&&t(g)&&Array.isArray(h))h=h.join(g),h&&=this.extendTranslation(h,n,a,i);else{let e=!1,t=!1;!this.isValidLookup(h)&&v&&(e=!0,h=b),this.isValidLookup(h)||(t=!0,h=c);let r=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&t?void 0:h,o=v&&b!==h&&this.options.updateMissing;if(t||e||o){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,c,o?b: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=v&&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&&_?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,a);ae&&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}`]||b)})}):n(e,c,b))}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=x.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`?S(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,!ce[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(ce[`${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}},de=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=y.create(`languageUtils`)}getScriptPartFromCode(e){if(e=v(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=v(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 fe={zero:0,one:1,two:2,few:3,many:4,other:5},pe={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})};var me=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=y.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=v(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!`),pe;if(!e.match(/-|_/))return pe;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)=>fe[e]-fe[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 he=(e,n,r,i=`.`,a=!0)=>{let o=f(e,n,r);return!o&&a&&t(r)&&(o=_(e,r,i),o===void 0&&(o=_(n,r,i))),o},ge=e=>e.replace(/\$/g,`$$$$`);var _e=class{constructor(e={}){this.logger=y.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:g}=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=g===void 0?!1:g,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=he(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(he(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=>ge(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?ge(this.escape(e)):ge(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 ve=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}},ye=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(v(r),i),t[o]=s),s(n)}},be=e=>(t,n,r)=>e(v(n),r)(t);var xe=class{constructor(e={}){this.logger=y.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?ye:be;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()]=ye(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}=ve(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 Se=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};var Ce=class extends ae{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=y.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),Se(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 we=()=>({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}),Te=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),Ee=()=>{},De=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Oe=`__i18next_supportNoticeShown`,ke=()=>!!(typeof globalThis<`u`&&globalThis[Oe]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env&&process.env.NODE_ENV===`production`),Ae=()=>{typeof globalThis<`u`&&(globalThis[Oe]=!0)},je=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)),C=class e extends ae{constructor(e={},t){if(super(),this.options=Te(e),this.services={},this.logger=y,this.modules={external:[]},De(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=we();this.options={...i,...this.options,...Te(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&&!je(this)&&!ke()&&(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 💙`),Ae());let a=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?y.init(a(this.modules.logger),this.options):y.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:xe;let t=new de(this.options);this.store=new b(this.options.resources,this.options);let n=this.services;n.logger=y,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new me(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 _e(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Ce(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 ue(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||=Ee,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=Ee){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||=Ee,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`&&x.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=S(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=S(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=S(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 de(we());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=Ee){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 b(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={...we().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new _e(n)}return a.translator=new ue(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();C.createInstance,C.dir,C.init,C.loadResources,C.reloadResources,C.use,C.changeLanguage,C.getFixedT,C.t,C.exists,C.setDefaultNamespace,C.hasLoadedNamespace,C.loadNamespaces,C.loadLanguages;const Me=[`en`,`zh-Hans`],Ne=/^zh(?:[-_]|$)/i,Pe=e=>Me.includes(e),Fe=e=>{if(!e)return null;let t=e.trim();return t?Pe(t)?t:Ne.test(t)?`zh-Hans`:t.toLowerCase().startsWith(`en`)?`en`:null:null},Ie=e=>{for(let t of e){let e=Fe(t);if(e)return e}return`en`};new Set(Me);const Le={finish:()=>{}},Re=()=>({setContext:()=>{},setFingerprint:()=>{},setLevel:()=>{},setTag:()=>{},setUser:()=>{}}),ze=()=>({addBreadcrumb:e=>{},captureException:e=>{},destroy:async()=>{},enabled:!1,flush:async()=>!0,init:async()=>{},startInactiveSpan:e=>Le,withScope:e=>e(Re())}),Be=e=>{if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t},Ve=e=>typeof e==`string`?e:String(e),He=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},Ue=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}}},We=(e,t,n)=>{let r=He(n);if(Object.keys(r).length===0){delete e.contexts[t];return}e.contexts[t]=r},Ge=(e,t)=>{delete e.contexts[t]},Ke=(e,t,n)=>{if(n==null||n===``){delete e.tags[t];return}e.tags[t]=Ve(n)},qe=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Je=/^[a-f0-9]{16,}$/i,Ye=/^\d{4,}$/,Xe=new Set([`access_token`,`code`,`jwt`,`refresh_token`,`session`,`signature`,`state`,`token`]),Ze=new Set([`authorization`,`cookie`,`set-auth-token`,`set-cookie`,`x-api-key`,`x-auth-token`,`x-csrf-token`]),Qe=e=>e&&(qe.test(e)?`:uuid`:Ye.test(e)?`:id`:Je.test(e)?`:hash`:e),$e=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`forEach`in e&&typeof e.forEach==`function`,et=e=>{if(!e)return[];if($e(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)]])},tt=e=>{let t={};for(let[n,r]of et(e)){let e=n.toLowerCase();Ze.has(e)||(t[e]=r)}return t},nt=e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``,t.pathname=t.pathname.split(`/`).map(Qe).join(`/`);let n=new URLSearchParams;return t.searchParams.forEach((e,t)=>{Xe.has(t.toLowerCase())||n.append(t,e)}),t.search=n.toString(),t.toString()}catch{let[t]=e.split(`?`);return t??e}},rt=(e,t=512)=>e.length<=t?e:`${e.slice(0,t)}…`,it=e=>e<=0?!1:e>=1?!0:Math.random()<e,at=e=>e.errorClass===`user_facing`?`warning`:`error`,ot=e=>{switch(e){case`ok`:return`ok`;case`timeout`:return`deadline_exceeded`;case`send_failed`:return`internal_error`;default:return`internal_error`}},w=e=>e instanceof Error?e:Error(rt(typeof e==`string`?e:`Unknown frontend stability error`)),st=e=>e??`info`,ct=(e,t)=>{let n=e.flushTimeoutMs??1500,r=Ue(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=Be({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`&&!it(.2)||t.addBreadcrumb({...e,level:st(e.level)}))},captureException:(e,n)=>{t.enabled&&i(n,()=>{t.captureException(w(e))})},clearScopeContext:e=>{Ge(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:ot(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(w(a))})}}}}),createNetworkPort:()=>({onHeartbeatTimeout:({error:e,intervalMs:n})=>{i({contexts:{network:{intervalMs:n}},level:`warning`,tags:{transport_phase:`heartbeat_timeout`}},()=>{t.captureException(w(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:ot(a.status)}),a.status!==`ok`&&i({contexts:{rpc:{channel:e,code:a.code,domain:a.domain,errorClass:a.errorClass,timeoutMs:n}},level:at(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(w(a.error))})}}},onTransportError:({error:e,phase:n})=>{i({contexts:{transport:{phase:n}},level:`error`,tags:{transport_phase:n}},()=>{t.captureException(w(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:ot(a)}),a===`error`&&i({contexts:{transport:{kind:e}},level:`error`,tags:{ws_kind:e,ws_result:a}},()=>{t.captureException(w(r))})}}},onWsEvent:({channel:e})=>{it(.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)=>{We(r,e,t)},setTag:(e,t)=>{Ke(r,e,t)},setUser:e=>{r.user=e},startSpan:a}},lt=e=>e.length===0?[ze()]:e,ut=e=>{let t=lt(e);return t.find(e=>e.enabled)??t[0]??ze()},dt=e=>{let t=lt(e),n=ut(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 ze().startInactiveSpan(e)}},withScope:e=>{let t=e;try{return n.withScope(t)}catch{return ze().withScope(t)}}}};let ft=function(e){return e.NOOP=`noop`,e.POSTHOG_BROWSER=`posthog-browser`,e.POSTHOG_REACT_NATIVE=`posthog-react-native`,e.SENTRY=`sentry`,e}({});const pt=new Set(Object.values(ft)),mt=(e,t=[ft.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(!pt.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:[]}},ht=e=>{let t={};for(let[n,r]of Object.entries(e))r==null||r===``||(t[n]=r);return t},gt=e=>Object.keys(e).length>0,_t=(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=ht({deviceCode:t.deviceCode,environmentId:t.environmentId,memberId:t.memberId,pipelineId:t.pipelineId,taskId:t.taskId,workspaceId:t.workspaceId});gt(n)?e.setScopeContext(`echo`,n):e.clearScopeContext(`echo`);let r=ht({authPhase:t.authPhase,commandName:t.commandName,cwd:t.cwd,interactive:t.interactive,routeTemplate:t.routeTemplate,routeView:t.routeView,screen:t.screen});gt(r)?e.setScopeContext(`surface`,r):e.clearScopeContext(`surface`)},vt={finish:()=>{}},yt={finish:()=>{}},bt={finish:()=>{}},xt=()=>({onHeartbeatTimeout:()=>{},onRpcStart:()=>vt,onTransportError:()=>{},onWsConnectStart:()=>yt,onWsEvent:()=>{},onWsStatusChange:()=>{}}),St=()=>({onRequestStart:()=>bt}),Ct=/^[^@]+@([^+]+)(?:\+.+)?$/,wt=e=>{if(!e)return;let t=Ct.exec(e.trim())?.[1]?.trim();if(t)return t},Tt=/\/+$/,T=e=>e.replace(Tt,``),Et=e=>e instanceof Request?e.url:e instanceof URL?e.toString():e,Dt=(e,t)=>t?.method?t.method:e instanceof Request?e.method:`GET`,Ot=(e={})=>{let t=e.fetchImpl??fetch,n=e.observability??St(),r=e.kind??`http`;return async(e,i)=>{let a=nt(Et(e)),o=Dt(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 E(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 kt=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},At=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const jt={};function D(e){return e&&Object.assign(jt,e),jt}function Mt(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 Nt(e,t){return typeof t==`bigint`?t.toString():t}function Pt(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Ft(e){return e==null}function It(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Lt(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 Rt=Symbol(`evaluating`);function O(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Rt)return r===void 0&&(r=Rt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function k(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function A(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function zt(e){return JSON.stringify(e)}function Bt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Vt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ht(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ut=Pt(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function j(e){if(Ht(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ht(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Wt(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}const Gt=new Set([`string`,`number`,`symbol`]);function Kt(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,A(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 k(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,A(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 k(this,`shape`,r),r},checks:[]}))}function Zt(e,t){if(!j(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,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return k(this,`shape`,n),n}}))}function Qt(e,t){if(!j(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return M(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return k(this,`shape`,n),n}}))}function $t(e,t){return M(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return k(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,A(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 k(this,`shape`,i),i},checks:[]}))}function tn(e,t,n){return M(t,A(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 k(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,Nt,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},sn=E(`$ZodError`,on),cn=E(`$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 kt;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,D())));throw Vt(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,D())));throw Vt(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 kt;return a.issues.length?{success:!1,error:new(e??sn)(a.issues.map(e=>I(e,i,D())))}:{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,D())))}:{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=E(`$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=E(`$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=E(`$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=E(`$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):Lt(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=E(`$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=E(`$ZodCheckMaxLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ft(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=E(`$ZodCheckMinLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ft(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=E(`$ZodCheckLengthEquals`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ft(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=E(`$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=E(`$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=E(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$n,lr.init(e,t)}),fr=E(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=er,lr.init(e,t)}),pr=E(`$ZodCheckIncludes`,(e,t)=>{L.init(e,t);let n=Kt(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=E(`$ZodCheckStartsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`^${Kt(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=E(`$ZodCheckEndsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`.*${Kt(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=E(`$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
+ `).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
+ `))}};const vr={major:4,minor:3,patch:6},R=E(`$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 kt;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 kt;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 kt;return o.then(e=>t(e,r,a))}return t(o,r,a)}}O(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=E(`$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=E(`$ZodStringFormat`,(e,t)=>{lr.init(e,t),yr.init(e,t)}),br=E(`$ZodGUID`,(e,t)=>{t.pattern??=Mn,z.init(e,t)}),xr=E(`$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=E(`$ZodEmail`,(e,t)=>{t.pattern??=Pn,z.init(e,t)}),Cr=E(`$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=E(`$ZodEmoji`,(e,t)=>{t.pattern??=Fn(),z.init(e,t)}),Tr=E(`$ZodNanoID`,(e,t)=>{t.pattern??=An,z.init(e,t)}),Er=E(`$ZodCUID`,(e,t)=>{t.pattern??=Tn,z.init(e,t)}),Dr=E(`$ZodCUID2`,(e,t)=>{t.pattern??=En,z.init(e,t)}),Or=E(`$ZodULID`,(e,t)=>{t.pattern??=Dn,z.init(e,t)}),kr=E(`$ZodXID`,(e,t)=>{t.pattern??=On,z.init(e,t)}),Ar=E(`$ZodKSUID`,(e,t)=>{t.pattern??=kn,z.init(e,t)}),jr=E(`$ZodISODateTime`,(e,t)=>{t.pattern??=qn(t),z.init(e,t)}),Mr=E(`$ZodISODate`,(e,t)=>{t.pattern??=Wn,z.init(e,t)}),Nr=E(`$ZodISOTime`,(e,t)=>{t.pattern??=Kn(t),z.init(e,t)}),Pr=E(`$ZodISODuration`,(e,t)=>{t.pattern??=jn,z.init(e,t)}),Fr=E(`$ZodIPv4`,(e,t)=>{t.pattern??=In,z.init(e,t),e._zod.bag.format=`ipv4`}),Ir=E(`$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=E(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rn,z.init(e,t)}),Rr=E(`$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=E(`$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=E(`$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=E(`$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=E(`$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=E(`$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=E(`$ZodNumberFormat`,(e,t)=>{ar.init(e,t),Kr.init(e,t)}),Jr=E(`$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=E(`$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=E(`$ZodUnknown`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),Zr=E(`$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=E(`$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=E(`$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=Pt(()=>ti(t));O(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=Ht,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=E(`$ZodObjectJIT`,(e,t)=>{ri.init(e,t);let n=e._zod.parse,r=Pt(()=>ti(t)),i=e=>{let t=new _r([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=zt(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=zt(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
4
+ if (${n}.issues.length) {
5
+ if (${o} in input) {
6
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${n}.value === undefined) {
14
+ if (${o} in input) {
15
+ newResult[${o}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${o}] = ${n}.value;
19
+ }
20
+
21
+ `):t.write(`
22
+ if (${n}.issues.length) {
23
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
26
+ })));
27
+ }
28
+
29
+ if (${n}.value === undefined) {
30
+ if (${o} in input) {
31
+ newResult[${o}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${o}] = ${n}.value;
35
+ }
36
+
37
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ht,s=!jt.jitless,c=s&&Ut.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ni([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function ai(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!P(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>I(e,r,D())))}),t)}const oi=E(`$ZodUnion`,(e,t)=>{R.init(e,t),O(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),O(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),O(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),O(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>It(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>ai(t,i,e,a)):ai(s,i,e,a)}}),si=E(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,oi.init(e,t);let n=e._zod.parse;O(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Pt(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Ht(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),ci=E(`$ZodIntersection`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ui(e,t,n)):ui(e,i,a)}});function li(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(j(e)&&j(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=li(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=li(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ui(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),P(e))return e;let o=li(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const di=E(`$ZodRecord`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!j(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...F(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...F(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Xn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>I(e,r,D())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...F(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...F(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),fi=E(`$ZodEnum`,(e,t)=>{R.init(e,t);let n=Mt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Gt.has(typeof e)).map(e=>typeof e==`string`?Kt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),pi=E(`$ZodLiteral`,(e,t)=>{if(R.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Kt(e):e?Kt(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),mi=E(`$ZodTransform`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new At(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new kt;return n.value=i,n}});function hi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const gi=E(`$ZodOptional`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),O(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${It(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>hi(t,e.value)):hi(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),_i=E(`$ZodExactOptional`,(e,t)=>{gi.init(e,t),O(e._zod,`values`,()=>t.innerType._zod.values),O(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),vi=E(`$ZodNullable`,(e,t)=>{R.init(e,t),O(e._zod,`optin`,()=>t.innerType._zod.optin),O(e._zod,`optout`,()=>t.innerType._zod.optout),O(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${It(e.source)}|null)$`):void 0}),O(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),yi=E(`$ZodDefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>bi(e,t)):bi(r,t)}});function bi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const xi=E(`$ZodPrefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Si=E(`$ZodNonOptional`,(e,t)=>{R.init(e,t),O(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ci(t,e)):Ci(i,e)}});function Ci(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const wi=E(`$ZodCatch`,(e,t)=>{R.init(e,t),O(e._zod,`optin`,()=>t.innerType._zod.optin),O(e._zod,`optout`,()=>t.innerType._zod.optout),O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,D()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,D()))},input:e.value}),e.issues=[]),e)}}),Ti=E(`$ZodPipe`,(e,t)=>{R.init(e,t),O(e._zod,`values`,()=>t.in._zod.values),O(e._zod,`optin`,()=>t.in._zod.optin),O(e._zod,`optout`,()=>t.out._zod.optout),O(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ei(e,t.in,n)):Ei(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ei(e,t.out,n)):Ei(r,t.out,n)}});function Ei(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Di=E(`$ZodReadonly`,(e,t)=>{R.init(e,t),O(e._zod,`propValues`,()=>t.innerType._zod.propValues),O(e._zod,`values`,()=>t.innerType._zod.values),O(e._zod,`optin`,()=>t.innerType?._zod?.optin),O(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Oi):Oi(r)}});function Oi(e){return e.value=Object.freeze(e.value),e}const ki=E(`$ZodLazy`,(e,t)=>{R.init(e,t),O(e._zod,`innerType`,()=>t.getter()),O(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),O(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),O(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),O(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ai=E(`$ZodCustom`,(e,t)=>{L.init(e,t),R.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ji(t,n,r,e));ji(i,n,r,e)}});function ji(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(an(e))}}var Mi,Ni=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Pi(){return new Ni}(Mi=globalThis).__zod_globalRegistry??(Mi.__zod_globalRegistry=Pi());const Fi=globalThis.__zod_globalRegistry;function Ii(e,t){return new e({type:`string`,...N(t)})}function Li(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function Ri(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function Ui(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function Wi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function Gi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function Ki(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function qi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function Ji(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function Yi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function Xi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function Zi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function Qi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function $i(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function ea(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function ta(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function na(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function ra(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function ia(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function aa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function oa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function sa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function ca(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function la(e,t){return new e({type:`number`,checks:[],...N(t)})}function ua(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...N(t)})}function da(e,t){return new e({type:`boolean`,...N(t)})}function fa(e,t){return new e({type:`null`,...N(t)})}function pa(e){return new e({type:`unknown`})}function ma(e,t){return new e({type:`never`,...N(t)})}function ha(e,t){return new nr({check:`less_than`,...N(t),value:e,inclusive:!1})}function ga(e,t){return new nr({check:`less_than`,...N(t),value:e,inclusive:!0})}function _a(e,t){return new rr({check:`greater_than`,...N(t),value:e,inclusive:!1})}function va(e,t){return new rr({check:`greater_than`,...N(t),value:e,inclusive:!0})}function ya(e,t){return new ir({check:`multiple_of`,...N(t),value:e})}function ba(e,t){return new or({check:`max_length`,...N(t),maximum:e})}function xa(e,t){return new sr({check:`min_length`,...N(t),minimum:e})}function Sa(e,t){return new cr({check:`length_equals`,...N(t),length:e})}function Ca(e,t){return new ur({check:`string_format`,format:`regex`,...N(t),pattern:e})}function wa(e){return new dr({check:`string_format`,format:`lowercase`,...N(e)})}function Ta(e){return new fr({check:`string_format`,format:`uppercase`,...N(e)})}function Ea(e,t){return new pr({check:`string_format`,format:`includes`,...N(t),includes:e})}function Da(e,t){return new mr({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function Oa(e,t){return new hr({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function B(e){return new gr({check:`overwrite`,tx:e})}function ka(e){return B(t=>t.normalize(e))}function Aa(){return B(e=>e.trim())}function ja(){return B(e=>e.toLowerCase())}function Ma(){return B(e=>e.toUpperCase())}function Na(){return B(e=>Bt(e))}function Pa(e,t,n){return new e({type:`array`,element:t,...N(n)})}function Fa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function Ia(e){let t=La(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(an(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(an(r))}},e(n.value,n)));return t}function La(e,t){let n=new L({check:`custom`,...N(t)});return n._zod.check=e,n}function Ra(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Fi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function V(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,V(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&H(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
38
+
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ba(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Ha(t,`input`,e.processors),output:Ha(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function H(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return H(r.element,n);if(r.type===`set`)return H(r.valueType,n);if(r.type===`lazy`)return H(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return H(r.innerType,n);if(r.type===`intersection`)return H(r.left,n)||H(r.right,n);if(r.type===`record`||r.type===`map`)return H(r.keyType,n)||H(r.valueType,n);if(r.type===`pipe`)return H(r.in,n)||H(r.out,n);if(r.type===`object`){for(let e in r.shape)if(H(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(H(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(H(e,n))return!0;return!!(r.rest&&H(r.rest,n))}return!1}const Va=(e,t={})=>n=>{let r=Ra({...n,processors:t});return V(e,r),za(r,e),Ba(r,e)},Ha=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ra({...i??{},target:a,io:t,processors:n});return V(e,o),za(o,e),Ba(o,e)},Ua={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Wa=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ua[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ga=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Ka=(e,t,n,r)=>{n.type=`boolean`},qa=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ja=(e,t,n,r)=>{n.not={}},Ya=(e,t,n,r)=>{let i=e._zod.def,a=Mt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xa=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Za=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Qa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},$a=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=V(a.element,t,{...r,path:[...r.path,`items`]})},eo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=V(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=V(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},to=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>V(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},no=(e,t,n,r)=>{let i=e._zod.def,a=V(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=V(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ro=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=V(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=V(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=V(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},io=(e,t,n,r)=>{let i=e._zod.def,a=V(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ao=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},oo=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},so=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},co=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},lo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;V(a,t,r);let o=t.seen.get(e);o.ref=a},uo=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fo=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},po=(e,t,n,r)=>{let i=e._zod.innerType;V(i,t,r);let a=t.seen.get(e);a.ref=i},mo=E(`ZodISODateTime`,(e,t)=>{jr.init(e,t),K.init(e,t)});function ho(e){return aa(mo,e)}const go=E(`ZodISODate`,(e,t)=>{Mr.init(e,t),K.init(e,t)});function _o(e){return oa(go,e)}const vo=E(`ZodISOTime`,(e,t)=>{Nr.init(e,t),K.init(e,t)});function yo(e){return sa(vo,e)}const bo=E(`ZodISODuration`,(e,t)=>{Pr.init(e,t),K.init(e,t)});function xo(e){return ca(bo,e)}const So=(e,t)=>{sn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>un(e,t)},flatten:{value:t=>ln(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Nt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Nt,2)}},isEmpty:{get(){return e.issues.length===0}}})};E(`ZodError`,So);const U=E(`ZodError`,So,{Parent:Error}),Co=dn(U),wo=fn(U),To=pn(U),Eo=hn(U),Do=_n(U),Oo=vn(U),ko=yn(U),Ao=bn(U),jo=xn(U),Mo=Sn(U),No=Cn(U),Po=wn(U),W=E(`ZodType`,(e,t)=>(R.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ha(e,`input`),output:Ha(e,`output`)}}),e.toJSONSchema=Va(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(A(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>M(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Co(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>To(e,t,n),e.parseAsync=async(t,n)=>wo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Eo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Do(e,t,n),e.decode=(t,n)=>Oo(e,t,n),e.encodeAsync=async(t,n)=>ko(e,t,n),e.decodeAsync=async(t,n)=>Ao(e,t,n),e.safeEncode=(t,n)=>jo(e,t,n),e.safeDecode=(t,n)=>Mo(e,t,n),e.safeEncodeAsync=async(t,n)=>No(e,t,n),e.safeDecodeAsync=async(t,n)=>Po(e,t,n),e.refine=(t,n)=>e.check(Zs(t,n)),e.superRefine=t=>e.check(Qs(t)),e.overwrite=t=>e.check(B(t)),e.optional=()=>js(e),e.exactOptional=()=>Ns(e),e.nullable=()=>Fs(e),e.nullish=()=>js(Fs(e)),e.nonoptional=t=>Vs(e,t),e.array=()=>hs(e),e.or=t=>vs([e,t]),e.and=t=>Ss(e,t),e.transform=t=>Gs(e,ks(t)),e.default=t=>Ls(e,t),e.prefault=t=>zs(e,t),e.catch=t=>Us(e,t),e.pipe=t=>Gs(e,t),e.readonly=()=>qs(e),e.describe=t=>{let n=e.clone();return Fi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Fi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Fi.get(e);let n=e.clone();return Fi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Fo=E(`_ZodString`,(e,t)=>{yr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ca(...t)),e.includes=(...t)=>e.check(Ea(...t)),e.startsWith=(...t)=>e.check(Da(...t)),e.endsWith=(...t)=>e.check(Oa(...t)),e.min=(...t)=>e.check(xa(...t)),e.max=(...t)=>e.check(ba(...t)),e.length=(...t)=>e.check(Sa(...t)),e.nonempty=(...t)=>e.check(xa(1,...t)),e.lowercase=t=>e.check(wa(t)),e.uppercase=t=>e.check(Ta(t)),e.trim=()=>e.check(Aa()),e.normalize=(...t)=>e.check(ka(...t)),e.toLowerCase=()=>e.check(ja()),e.toUpperCase=()=>e.check(Ma()),e.slugify=()=>e.check(Na())}),Io=E(`ZodString`,(e,t)=>{yr.init(e,t),Fo.init(e,t),e.email=t=>e.check(Li(Lo,t)),e.url=t=>e.check(Ui(Bo,t)),e.jwt=t=>e.check(ia(ts,t)),e.emoji=t=>e.check(Wi(Vo,t)),e.guid=t=>e.check(Ri(Ro,t)),e.uuid=t=>e.check(zi(zo,t)),e.uuidv4=t=>e.check(Bi(zo,t)),e.uuidv6=t=>e.check(Vi(zo,t)),e.uuidv7=t=>e.check(Hi(zo,t)),e.nanoid=t=>e.check(Gi(Ho,t)),e.guid=t=>e.check(Ri(Ro,t)),e.cuid=t=>e.check(Ki(Uo,t)),e.cuid2=t=>e.check(qi(Wo,t)),e.ulid=t=>e.check(Ji(Go,t)),e.base64=t=>e.check(ta(Qo,t)),e.base64url=t=>e.check(na($o,t)),e.xid=t=>e.check(Yi(Ko,t)),e.ksuid=t=>e.check(Xi(qo,t)),e.ipv4=t=>e.check(Zi(Jo,t)),e.ipv6=t=>e.check(Qi(Yo,t)),e.cidrv4=t=>e.check($i(Xo,t)),e.cidrv6=t=>e.check(ea(Zo,t)),e.e164=t=>e.check(ra(es,t)),e.datetime=t=>e.check(ho(t)),e.date=t=>e.check(_o(t)),e.time=t=>e.check(yo(t)),e.duration=t=>e.check(xo(t))});function G(e){return Ii(Io,e)}const K=E(`ZodStringFormat`,(e,t)=>{z.init(e,t),Fo.init(e,t)}),Lo=E(`ZodEmail`,(e,t)=>{Sr.init(e,t),K.init(e,t)}),Ro=E(`ZodGUID`,(e,t)=>{br.init(e,t),K.init(e,t)}),zo=E(`ZodUUID`,(e,t)=>{xr.init(e,t),K.init(e,t)}),Bo=E(`ZodURL`,(e,t)=>{Cr.init(e,t),K.init(e,t)}),Vo=E(`ZodEmoji`,(e,t)=>{wr.init(e,t),K.init(e,t)}),Ho=E(`ZodNanoID`,(e,t)=>{Tr.init(e,t),K.init(e,t)}),Uo=E(`ZodCUID`,(e,t)=>{Er.init(e,t),K.init(e,t)}),Wo=E(`ZodCUID2`,(e,t)=>{Dr.init(e,t),K.init(e,t)}),Go=E(`ZodULID`,(e,t)=>{Or.init(e,t),K.init(e,t)}),Ko=E(`ZodXID`,(e,t)=>{kr.init(e,t),K.init(e,t)}),qo=E(`ZodKSUID`,(e,t)=>{Ar.init(e,t),K.init(e,t)}),Jo=E(`ZodIPv4`,(e,t)=>{Fr.init(e,t),K.init(e,t)}),Yo=E(`ZodIPv6`,(e,t)=>{Ir.init(e,t),K.init(e,t)}),Xo=E(`ZodCIDRv4`,(e,t)=>{Lr.init(e,t),K.init(e,t)}),Zo=E(`ZodCIDRv6`,(e,t)=>{Rr.init(e,t),K.init(e,t)}),Qo=E(`ZodBase64`,(e,t)=>{Br.init(e,t),K.init(e,t)}),$o=E(`ZodBase64URL`,(e,t)=>{Hr.init(e,t),K.init(e,t)}),es=E(`ZodE164`,(e,t)=>{Ur.init(e,t),K.init(e,t)}),ts=E(`ZodJWT`,(e,t)=>{Gr.init(e,t),K.init(e,t)}),ns=E(`ZodNumber`,(e,t)=>{Kr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r),e.gt=(t,n)=>e.check(_a(t,n)),e.gte=(t,n)=>e.check(va(t,n)),e.min=(t,n)=>e.check(va(t,n)),e.lt=(t,n)=>e.check(ha(t,n)),e.lte=(t,n)=>e.check(ga(t,n)),e.max=(t,n)=>e.check(ga(t,n)),e.int=t=>e.check(as(t)),e.safe=t=>e.check(as(t)),e.positive=t=>e.check(_a(0,t)),e.nonnegative=t=>e.check(va(0,t)),e.negative=t=>e.check(ha(0,t)),e.nonpositive=t=>e.check(ga(0,t)),e.multipleOf=(t,n)=>e.check(ya(t,n)),e.step=(t,n)=>e.check(ya(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function rs(e){return la(ns,e)}const is=E(`ZodNumberFormat`,(e,t)=>{qr.init(e,t),ns.init(e,t)});function as(e){return ua(is,e)}const os=E(`ZodBoolean`,(e,t)=>{Jr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r)});function ss(e){return da(os,e)}const cs=E(`ZodNull`,(e,t)=>{Yr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r)});function ls(e){return fa(cs,e)}const us=E(`ZodUnknown`,(e,t)=>{Xr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ds(){return pa(us)}const fs=E(`ZodNever`,(e,t)=>{Zr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r)});function ps(e){return ma(fs,e)}const ms=E(`ZodArray`,(e,t)=>{$r.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(xa(t,n)),e.nonempty=t=>e.check(xa(1,t)),e.max=(t,n)=>e.check(ba(t,n)),e.length=(t,n)=>e.check(Sa(t,n)),e.unwrap=()=>e.element});function hs(e,t){return Pa(ms,e,t)}const gs=E(`ZodObject`,(e,t)=>{ii.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),O(e,`shape`,()=>t.shape),e.keyof=()=>Es(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ds()}),e.loose=()=>e.clone({...e._zod.def,catchall:ds()}),e.strict=()=>e.clone({...e._zod.def,catchall:ps()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Zt(e,t),e.safeExtend=t=>Qt(e,t),e.merge=t=>$t(e,t),e.pick=t=>Yt(e,t),e.omit=t=>Xt(e,t),e.partial=(...t)=>en(As,e,t[0]),e.required=(...t)=>tn(Bs,e,t[0])});function q(e,t){return new gs({type:`object`,shape:e??{},...N(t)})}const _s=E(`ZodUnion`,(e,t)=>{oi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.options=t.options});function vs(e,t){return new _s({type:`union`,options:e,...N(t)})}const ys=E(`ZodDiscriminatedUnion`,(e,t)=>{_s.init(e,t),si.init(e,t)});function bs(e,t,n){return new ys({type:`union`,options:t,discriminator:e,...N(n)})}const xs=E(`ZodIntersection`,(e,t)=>{ci.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function Ss(e,t){return new xs({type:`intersection`,left:e,right:t})}const Cs=E(`ZodRecord`,(e,t)=>{di.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ws(e,t,n){return new Cs({type:`record`,keyType:e,valueType:t,...N(n)})}const Ts=E(`ZodEnum`,(e,t)=>{fi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ts({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ts({...t,checks:[],...N(r),entries:i})}});function Es(e,t){return new Ts({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}const Ds=E(`ZodLiteral`,(e,t)=>{pi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new Ds({type:`literal`,values:Array.isArray(e)?e:[e],...N(t)})}const Os=E(`ZodTransform`,(e,t)=>{mi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new At(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(an(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(an(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ks(e){return new Os({type:`transform`,transform:e})}const As=E(`ZodOptional`,(e,t)=>{gi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function js(e){return new As({type:`optional`,innerType:e})}const Ms=E(`ZodExactOptional`,(e,t)=>{_i.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ns(e){return new Ms({type:`optional`,innerType:e})}const Ps=E(`ZodNullable`,(e,t)=>{vi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e){return new Ps({type:`nullable`,innerType:e})}const Is=E(`ZodDefault`,(e,t)=>{yi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ls(e,t){return new Is({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Wt(t)}})}const Rs=E(`ZodPrefault`,(e,t)=>{xi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zs(e,t){return new Rs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Wt(t)}})}const Bs=E(`ZodNonOptional`,(e,t)=>{Si.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vs(e,t){return new Bs({type:`nonoptional`,innerType:e,...N(t)})}const Hs=E(`ZodCatch`,(e,t)=>{wi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Us(e,t){return new Hs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Ws=E(`ZodPipe`,(e,t)=>{Ti.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.in=t.in,e.out=t.out});function Gs(e,t){return new Ws({type:`pipe`,in:e,out:t})}const Ks=E(`ZodReadonly`,(e,t)=>{Di.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qs(e){return new Ks({type:`readonly`,innerType:e})}const Js=E(`ZodLazy`,(e,t)=>{ki.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Ys(e){return new Js({type:`lazy`,getter:e})}const Xs=E(`ZodCustom`,(e,t)=>{Ai.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r)});function Zs(e,t={}){return Fa(Xs,e,t)}function Qs(e){return Ia(e)}q({identityToken:G().trim().min(1),nonce:G().trim().optional().nullable(),email:G().trim().email().optional().nullable(),name:q({firstName:G().trim().optional().nullable(),lastName:G().trim().optional().nullable()}).optional().nullable(),preferredLanguage:Es(Me)}),q({isAvailable:ss()});const $s=Ys(()=>vs([G(),rs(),ss(),ls(),hs($s),ws(G(),$s)])),ec=q({error:G().trim().min(1),details:ws(G(),$s)}),tc=q({expiresAt:G().datetime(),updatedAt:G().datetime()}),nc=q({id:G().trim().min(1),email:G().trim().email(),name:G(),image:G().nullable()}),rc=q({token:G().trim().min(1),onboardingCompleted:ss(),session:tc,user:nc}),ic=q({token:G().trim().min(1)});q({token:G().trim().min(1)});const Y={PENDING:`pending`,COMPLETED:`completed`,EXPIRED:`expired`,ERROR:`error`};Y.COMPLETED,Y.EXPIRED,Y.ERROR;const ac={BROWSER_PAGE:`browser_page`,DEEP_LINK:`deep_link`},oc={GITHUB:`github`,GOOGLE:`google`,SLACK:`slack`},sc={GOOGLE_WORKSPACE:`google-workspace`},cc=Es([ac.BROWSER_PAGE,ac.DEEP_LINK]),lc=Es([oc.GITHUB,oc.GOOGLE,oc.SLACK]),uc=Es([sc.GOOGLE_WORKSPACE]);q({returnMode:cc,preferredLanguage:Es(Me)});const dc=q({authorizationUrl:G().trim().min(1),expiresAt:G().datetime(),state:G().trim().min(1)}),fc=dc.extend({provider:lc}),pc=dc.extend({provider:uc}),mc=q({state:G().trim().min(1)}),hc=mc.extend({expiresAt:G().datetime(),name:G(),token:G().trim().min(1),userId:G().trim().min(1),avatarUrl:G()}),gc=mc.extend({reason:G().trim().min(1),status:J(Y.ERROR)}),_c=bs(`status`,[mc.extend({provider:lc,status:J(Y.PENDING)}),hc.extend({provider:lc,status:J(Y.COMPLETED)}),mc.extend({provider:lc,status:J(Y.EXPIRED)}),gc.extend({provider:lc})]),vc=bs(`status`,[mc.extend({provider:uc,status:J(Y.PENDING)}),hc.extend({provider:uc,status:J(Y.COMPLETED)}),mc.extend({provider:uc,status:J(Y.EXPIRED)}),gc.extend({provider:uc})]);var yc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.USE_PROXY=e.UNSUPPORTED_MEDIA_TYPE=e.UNPROCESSABLE_ENTITY=e.UNAUTHORIZED=e.TOO_MANY_REQUESTS=e.TEMPORARY_REDIRECT=e.SWITCHING_PROTOCOLS=e.SERVICE_UNAVAILABLE=e.SEE_OTHER=e.RESET_CONTENT=e.REQUESTED_RANGE_NOT_SATISFIABLE=e.REQUEST_URI_TOO_LONG=e.REQUEST_TOO_LONG=e.REQUEST_TIMEOUT=e.REQUEST_HEADER_FIELDS_TOO_LARGE=e.PROXY_AUTHENTICATION_REQUIRED=e.PROCESSING=e.PRECONDITION_REQUIRED=e.PRECONDITION_FAILED=e.PERMANENT_REDIRECT=e.PAYMENT_REQUIRED=e.PARTIAL_CONTENT=e.OK=e.NOT_MODIFIED=e.NOT_IMPLEMENTED=e.NOT_FOUND=e.NOT_ACCEPTABLE=e.NON_AUTHORITATIVE_INFORMATION=e.NO_CONTENT=e.NETWORK_AUTHENTICATION_REQUIRED=e.MULTIPLE_CHOICES=e.MULTI_STATUS=e.MOVED_TEMPORARILY=e.MOVED_PERMANENTLY=e.METHOD_NOT_ALLOWED=e.METHOD_FAILURE=e.LOCKED=e.LENGTH_REQUIRED=e.INTERNAL_SERVER_ERROR=e.INSUFFICIENT_STORAGE=e.INSUFFICIENT_SPACE_ON_RESOURCE=e.IM_A_TEAPOT=e.HTTP_VERSION_NOT_SUPPORTED=e.GONE=e.GATEWAY_TIMEOUT=e.FORBIDDEN=e.FAILED_DEPENDENCY=e.EXPECTATION_FAILED=e.CREATED=e.CONTINUE=e.CONFLICT=e.BAD_REQUEST=e.BAD_GATEWAY=e.ACCEPTED=void 0,e.ACCEPTED=202,e.BAD_GATEWAY=502,e.BAD_REQUEST=400,e.CONFLICT=409,e.CONTINUE=100,e.CREATED=201,e.EXPECTATION_FAILED=417,e.FAILED_DEPENDENCY=424,e.FORBIDDEN=403,e.GATEWAY_TIMEOUT=504,e.GONE=410,e.HTTP_VERSION_NOT_SUPPORTED=505,e.IM_A_TEAPOT=418,e.INSUFFICIENT_SPACE_ON_RESOURCE=419,e.INSUFFICIENT_STORAGE=507,e.INTERNAL_SERVER_ERROR=500,e.LENGTH_REQUIRED=411,e.LOCKED=423,e.METHOD_FAILURE=420,e.METHOD_NOT_ALLOWED=405,e.MOVED_PERMANENTLY=301,e.MOVED_TEMPORARILY=302,e.MULTI_STATUS=207,e.MULTIPLE_CHOICES=300,e.NETWORK_AUTHENTICATION_REQUIRED=511,e.NO_CONTENT=204,e.NON_AUTHORITATIVE_INFORMATION=203,e.NOT_ACCEPTABLE=406,e.NOT_FOUND=404,e.NOT_IMPLEMENTED=501,e.NOT_MODIFIED=304,e.OK=200,e.PARTIAL_CONTENT=206,e.PAYMENT_REQUIRED=402,e.PERMANENT_REDIRECT=308,e.PRECONDITION_FAILED=412,e.PRECONDITION_REQUIRED=428,e.PROCESSING=102,e.PROXY_AUTHENTICATION_REQUIRED=407,e.REQUEST_HEADER_FIELDS_TOO_LARGE=431,e.REQUEST_TIMEOUT=408,e.REQUEST_TOO_LONG=413,e.REQUEST_URI_TOO_LONG=414,e.REQUESTED_RANGE_NOT_SATISFIABLE=416,e.RESET_CONTENT=205,e.SEE_OTHER=303,e.SERVICE_UNAVAILABLE=503,e.SWITCHING_PROTOCOLS=101,e.TEMPORARY_REDIRECT=307,e.TOO_MANY_REQUESTS=429,e.UNAUTHORIZED=401,e.UNPROCESSABLE_ENTITY=422,e.UNSUPPORTED_MEDIA_TYPE=415,e.USE_PROXY=305,e.default={ACCEPTED:e.ACCEPTED,BAD_GATEWAY:e.BAD_GATEWAY,BAD_REQUEST:e.BAD_REQUEST,CONFLICT:e.CONFLICT,CONTINUE:e.CONTINUE,CREATED:e.CREATED,EXPECTATION_FAILED:e.EXPECTATION_FAILED,FORBIDDEN:e.FORBIDDEN,GATEWAY_TIMEOUT:e.GATEWAY_TIMEOUT,GONE:e.GONE,HTTP_VERSION_NOT_SUPPORTED:e.HTTP_VERSION_NOT_SUPPORTED,IM_A_TEAPOT:e.IM_A_TEAPOT,INSUFFICIENT_SPACE_ON_RESOURCE:e.INSUFFICIENT_SPACE_ON_RESOURCE,INSUFFICIENT_STORAGE:e.INSUFFICIENT_STORAGE,INTERNAL_SERVER_ERROR:e.INTERNAL_SERVER_ERROR,LENGTH_REQUIRED:e.LENGTH_REQUIRED,LOCKED:e.LOCKED,METHOD_FAILURE:e.METHOD_FAILURE,METHOD_NOT_ALLOWED:e.METHOD_NOT_ALLOWED,MOVED_PERMANENTLY:e.MOVED_PERMANENTLY,MOVED_TEMPORARILY:e.MOVED_TEMPORARILY,MULTI_STATUS:e.MULTI_STATUS,MULTIPLE_CHOICES:e.MULTIPLE_CHOICES,NETWORK_AUTHENTICATION_REQUIRED:e.NETWORK_AUTHENTICATION_REQUIRED,NO_CONTENT:e.NO_CONTENT,NON_AUTHORITATIVE_INFORMATION:e.NON_AUTHORITATIVE_INFORMATION,NOT_ACCEPTABLE:e.NOT_ACCEPTABLE,NOT_FOUND:e.NOT_FOUND,NOT_IMPLEMENTED:e.NOT_IMPLEMENTED,NOT_MODIFIED:e.NOT_MODIFIED,OK:e.OK,PARTIAL_CONTENT:e.PARTIAL_CONTENT,PAYMENT_REQUIRED:e.PAYMENT_REQUIRED,PERMANENT_REDIRECT:e.PERMANENT_REDIRECT,PRECONDITION_FAILED:e.PRECONDITION_FAILED,PRECONDITION_REQUIRED:e.PRECONDITION_REQUIRED,PROCESSING:e.PROCESSING,PROXY_AUTHENTICATION_REQUIRED:e.PROXY_AUTHENTICATION_REQUIRED,REQUEST_HEADER_FIELDS_TOO_LARGE:e.REQUEST_HEADER_FIELDS_TOO_LARGE,REQUEST_TIMEOUT:e.REQUEST_TIMEOUT,REQUEST_TOO_LONG:e.REQUEST_TOO_LONG,REQUEST_URI_TOO_LONG:e.REQUEST_URI_TOO_LONG,REQUESTED_RANGE_NOT_SATISFIABLE:e.REQUESTED_RANGE_NOT_SATISFIABLE,RESET_CONTENT:e.RESET_CONTENT,SEE_OTHER:e.SEE_OTHER,SERVICE_UNAVAILABLE:e.SERVICE_UNAVAILABLE,SWITCHING_PROTOCOLS:e.SWITCHING_PROTOCOLS,TEMPORARY_REDIRECT:e.TEMPORARY_REDIRECT,TOO_MANY_REQUESTS:e.TOO_MANY_REQUESTS,UNAUTHORIZED:e.UNAUTHORIZED,UNPROCESSABLE_ENTITY:e.UNPROCESSABLE_ENTITY,UNSUPPORTED_MEDIA_TYPE:e.UNSUPPORTED_MEDIA_TYPE,USE_PROXY:e.USE_PROXY}})),bc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reasonPhraseToStatusCode=e.statusCodeToReasonPhrase=void 0,e.statusCodeToReasonPhrase={202:`Accepted`,502:`Bad Gateway`,400:`Bad Request`,409:`Conflict`,100:`Continue`,201:`Created`,417:`Expectation Failed`,424:`Failed Dependency`,403:`Forbidden`,504:`Gateway Timeout`,410:`Gone`,505:`HTTP Version Not Supported`,418:`I'm a teapot`,419:`Insufficient Space on Resource`,507:`Insufficient Storage`,500:`Internal Server Error`,411:`Length Required`,423:`Locked`,420:`Method Failure`,405:`Method Not Allowed`,301:`Moved Permanently`,302:`Moved Temporarily`,207:`Multi-Status`,300:`Multiple Choices`,511:`Network Authentication Required`,204:`No Content`,203:`Non Authoritative Information`,406:`Not Acceptable`,404:`Not Found`,501:`Not Implemented`,304:`Not Modified`,200:`OK`,206:`Partial Content`,402:`Payment Required`,308:`Permanent Redirect`,412:`Precondition Failed`,428:`Precondition Required`,102:`Processing`,103:`Early Hints`,426:`Upgrade Required`,407:`Proxy Authentication Required`,431:`Request Header Fields Too Large`,408:`Request Timeout`,413:`Request Entity Too Large`,414:`Request-URI Too Long`,416:`Requested Range Not Satisfiable`,205:`Reset Content`,303:`See Other`,503:`Service Unavailable`,101:`Switching Protocols`,307:`Temporary Redirect`,429:`Too Many Requests`,401:`Unauthorized`,451:`Unavailable For Legal Reasons`,422:`Unprocessable Entity`,415:`Unsupported Media Type`,305:`Use Proxy`,421:`Misdirected Request`},e.reasonPhraseToStatusCode={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421}})),xc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStatusText=e.getStatusCode=e.getReasonPhrase=void 0;var t=bc();function n(e){var n=t.statusCodeToReasonPhrase[e.toString()];if(!n)throw Error(`Status code does not exist: `+e);return n}e.getReasonPhrase=n;function r(e){var n=t.reasonPhraseToStatusCode[e];if(!n)throw Error(`Reason phrase does not exist: `+e);return n}e.getStatusCode=r,e.getStatusText=n})),Sc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatusCodes=void 0,(function(e){e[e.CONTINUE=100]=`CONTINUE`,e[e.SWITCHING_PROTOCOLS=101]=`SWITCHING_PROTOCOLS`,e[e.PROCESSING=102]=`PROCESSING`,e[e.EARLY_HINTS=103]=`EARLY_HINTS`,e[e.OK=200]=`OK`,e[e.CREATED=201]=`CREATED`,e[e.ACCEPTED=202]=`ACCEPTED`,e[e.NON_AUTHORITATIVE_INFORMATION=203]=`NON_AUTHORITATIVE_INFORMATION`,e[e.NO_CONTENT=204]=`NO_CONTENT`,e[e.RESET_CONTENT=205]=`RESET_CONTENT`,e[e.PARTIAL_CONTENT=206]=`PARTIAL_CONTENT`,e[e.MULTI_STATUS=207]=`MULTI_STATUS`,e[e.MULTIPLE_CHOICES=300]=`MULTIPLE_CHOICES`,e[e.MOVED_PERMANENTLY=301]=`MOVED_PERMANENTLY`,e[e.MOVED_TEMPORARILY=302]=`MOVED_TEMPORARILY`,e[e.SEE_OTHER=303]=`SEE_OTHER`,e[e.NOT_MODIFIED=304]=`NOT_MODIFIED`,e[e.USE_PROXY=305]=`USE_PROXY`,e[e.TEMPORARY_REDIRECT=307]=`TEMPORARY_REDIRECT`,e[e.PERMANENT_REDIRECT=308]=`PERMANENT_REDIRECT`,e[e.BAD_REQUEST=400]=`BAD_REQUEST`,e[e.UNAUTHORIZED=401]=`UNAUTHORIZED`,e[e.PAYMENT_REQUIRED=402]=`PAYMENT_REQUIRED`,e[e.FORBIDDEN=403]=`FORBIDDEN`,e[e.NOT_FOUND=404]=`NOT_FOUND`,e[e.METHOD_NOT_ALLOWED=405]=`METHOD_NOT_ALLOWED`,e[e.NOT_ACCEPTABLE=406]=`NOT_ACCEPTABLE`,e[e.PROXY_AUTHENTICATION_REQUIRED=407]=`PROXY_AUTHENTICATION_REQUIRED`,e[e.REQUEST_TIMEOUT=408]=`REQUEST_TIMEOUT`,e[e.CONFLICT=409]=`CONFLICT`,e[e.GONE=410]=`GONE`,e[e.LENGTH_REQUIRED=411]=`LENGTH_REQUIRED`,e[e.PRECONDITION_FAILED=412]=`PRECONDITION_FAILED`,e[e.REQUEST_TOO_LONG=413]=`REQUEST_TOO_LONG`,e[e.REQUEST_URI_TOO_LONG=414]=`REQUEST_URI_TOO_LONG`,e[e.UNSUPPORTED_MEDIA_TYPE=415]=`UNSUPPORTED_MEDIA_TYPE`,e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]=`REQUESTED_RANGE_NOT_SATISFIABLE`,e[e.EXPECTATION_FAILED=417]=`EXPECTATION_FAILED`,e[e.IM_A_TEAPOT=418]=`IM_A_TEAPOT`,e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]=`INSUFFICIENT_SPACE_ON_RESOURCE`,e[e.METHOD_FAILURE=420]=`METHOD_FAILURE`,e[e.MISDIRECTED_REQUEST=421]=`MISDIRECTED_REQUEST`,e[e.UNPROCESSABLE_ENTITY=422]=`UNPROCESSABLE_ENTITY`,e[e.LOCKED=423]=`LOCKED`,e[e.FAILED_DEPENDENCY=424]=`FAILED_DEPENDENCY`,e[e.UPGRADE_REQUIRED=426]=`UPGRADE_REQUIRED`,e[e.PRECONDITION_REQUIRED=428]=`PRECONDITION_REQUIRED`,e[e.TOO_MANY_REQUESTS=429]=`TOO_MANY_REQUESTS`,e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]=`REQUEST_HEADER_FIELDS_TOO_LARGE`,e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]=`UNAVAILABLE_FOR_LEGAL_REASONS`,e[e.INTERNAL_SERVER_ERROR=500]=`INTERNAL_SERVER_ERROR`,e[e.NOT_IMPLEMENTED=501]=`NOT_IMPLEMENTED`,e[e.BAD_GATEWAY=502]=`BAD_GATEWAY`,e[e.SERVICE_UNAVAILABLE=503]=`SERVICE_UNAVAILABLE`,e[e.GATEWAY_TIMEOUT=504]=`GATEWAY_TIMEOUT`,e[e.HTTP_VERSION_NOT_SUPPORTED=505]=`HTTP_VERSION_NOT_SUPPORTED`,e[e.INSUFFICIENT_STORAGE=507]=`INSUFFICIENT_STORAGE`,e[e.NETWORK_AUTHENTICATION_REQUIRED=511]=`NETWORK_AUTHENTICATION_REQUIRED`})(e.StatusCodes||={})})),Cc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReasonPhrases=void 0,(function(e){e.ACCEPTED=`Accepted`,e.BAD_GATEWAY=`Bad Gateway`,e.BAD_REQUEST=`Bad Request`,e.CONFLICT=`Conflict`,e.CONTINUE=`Continue`,e.CREATED=`Created`,e.EXPECTATION_FAILED=`Expectation Failed`,e.FAILED_DEPENDENCY=`Failed Dependency`,e.FORBIDDEN=`Forbidden`,e.GATEWAY_TIMEOUT=`Gateway Timeout`,e.GONE=`Gone`,e.HTTP_VERSION_NOT_SUPPORTED=`HTTP Version Not Supported`,e.IM_A_TEAPOT=`I'm a teapot`,e.INSUFFICIENT_SPACE_ON_RESOURCE=`Insufficient Space on Resource`,e.INSUFFICIENT_STORAGE=`Insufficient Storage`,e.INTERNAL_SERVER_ERROR=`Internal Server Error`,e.LENGTH_REQUIRED=`Length Required`,e.LOCKED=`Locked`,e.METHOD_FAILURE=`Method Failure`,e.METHOD_NOT_ALLOWED=`Method Not Allowed`,e.MOVED_PERMANENTLY=`Moved Permanently`,e.MOVED_TEMPORARILY=`Moved Temporarily`,e.MULTI_STATUS=`Multi-Status`,e.MULTIPLE_CHOICES=`Multiple Choices`,e.NETWORK_AUTHENTICATION_REQUIRED=`Network Authentication Required`,e.NO_CONTENT=`No Content`,e.NON_AUTHORITATIVE_INFORMATION=`Non Authoritative Information`,e.NOT_ACCEPTABLE=`Not Acceptable`,e.NOT_FOUND=`Not Found`,e.NOT_IMPLEMENTED=`Not Implemented`,e.NOT_MODIFIED=`Not Modified`,e.OK=`OK`,e.PARTIAL_CONTENT=`Partial Content`,e.PAYMENT_REQUIRED=`Payment Required`,e.PERMANENT_REDIRECT=`Permanent Redirect`,e.PRECONDITION_FAILED=`Precondition Failed`,e.PRECONDITION_REQUIRED=`Precondition Required`,e.PROCESSING=`Processing`,e.EARLY_HINTS=`Early Hints`,e.UPGRADE_REQUIRED=`Upgrade Required`,e.PROXY_AUTHENTICATION_REQUIRED=`Proxy Authentication Required`,e.REQUEST_HEADER_FIELDS_TOO_LARGE=`Request Header Fields Too Large`,e.REQUEST_TIMEOUT=`Request Timeout`,e.REQUEST_TOO_LONG=`Request Entity Too Large`,e.REQUEST_URI_TOO_LONG=`Request-URI Too Long`,e.REQUESTED_RANGE_NOT_SATISFIABLE=`Requested Range Not Satisfiable`,e.RESET_CONTENT=`Reset Content`,e.SEE_OTHER=`See Other`,e.SERVICE_UNAVAILABLE=`Service Unavailable`,e.SWITCHING_PROTOCOLS=`Switching Protocols`,e.TEMPORARY_REDIRECT=`Temporary Redirect`,e.TOO_MANY_REQUESTS=`Too Many Requests`,e.UNAUTHORIZED=`Unauthorized`,e.UNAVAILABLE_FOR_LEGAL_REASONS=`Unavailable For Legal Reasons`,e.UNPROCESSABLE_ENTITY=`Unprocessable Entity`,e.UNSUPPORTED_MEDIA_TYPE=`Unsupported Media Type`,e.USE_PROXY=`Use Proxy`,e.MISDIRECTED_REQUEST=`Misdirected Request`})(e.ReasonPhrases||={})})),X=e((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__exportStar||function(e,t){for(var r in e)r!==`default`&&!t.hasOwnProperty(r)&&n(t,e,r)},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0});var a=i(yc()),o=xc(),s=xc();Object.defineProperty(e,`getStatusCode`,{enumerable:!0,get:function(){return s.getStatusCode}}),Object.defineProperty(e,`getReasonPhrase`,{enumerable:!0,get:function(){return s.getReasonPhrase}}),Object.defineProperty(e,`getStatusText`,{enumerable:!0,get:function(){return s.getStatusText}});var c=Sc();Object.defineProperty(e,`StatusCodes`,{enumerable:!0,get:function(){return c.StatusCodes}});var l=Cc();Object.defineProperty(e,`ReasonPhrases`,{enumerable:!0,get:function(){return l.ReasonPhrases}}),r(yc(),e),e.default=t(t({},a.default),{getStatusCode:o.getStatusCode,getStatusText:o.getStatusText})}))();const Z=(e,t)=>{let n=JSON.parse(e),r=t.safeParse(n);if(!r.success)throw r.error;return r.data};let wc=function(e){return e.OK=`ok`,e.UNAUTHORIZED=`unauthorized`,e}({});const Tc=q({success:ss()}),Ec=q({token:G().trim().min(1),userId:G().trim().min(1),email:G().trim().email(),expiresAt:G().datetime(),updatedAt:G().datetime(),name:G(),avatarUrl:G()}),Dc=q({ok:J(!0),revokedAt:G().datetime(),sessionId:G().trim().min(1)}),Q=async(e,t)=>{let n=Z(await e.text(),ec);throw Error(n.error)},Oc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/email-otp/send-verification-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email})});return r.status===X.StatusCodes.NO_CONTENT?{success:!0}:r.status===X.StatusCodes.OK?Z(await r.text(),Tc):await Q(r,`Failed to request sign-in code`)},kc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/sign-in/email-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email,otp:t.otp,preferredLanguage:t.preferredLanguage})});return r.status===X.StatusCodes.OK?Z(await r.text(),ic):await Q(r,`Failed to verify sign-in code`)},Ac=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/oauth/${encodeURIComponent(t.provider)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({returnMode:t.returnMode,preferredLanguage:t.preferredLanguage})});return r.status===X.StatusCodes.OK?Z(await r.text(),fc):await Q(r,`Failed to start external OAuth login`)},jc=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/oauth/${encodeURIComponent(t.provider)}/completion`,T(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===X.StatusCodes.OK?Z(await a.text(),_c):await Q(a,`Failed to load external OAuth completion state`)},Mc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/sso/${encodeURIComponent(t.provider)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({returnMode:t.returnMode,preferredLanguage:t.preferredLanguage})});return r.status===X.StatusCodes.OK?Z(await r.text(),pc):await Q(r,`Failed to start external SSO login`)},Nc=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/sso/${encodeURIComponent(t.provider)}/completion`,T(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===X.StatusCodes.OK?Z(await a.text(),vc):await Q(a,`Failed to load external SSO completion state`)},Pc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/cli-session/exchange`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return r.status===X.StatusCodes.OK?Z(await r.text(),Ec):await Q(r,`Failed to create CLI session`)},Fc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/cli-session/logout`,{method:`POST`,headers:{authorization:`Bearer ${t.token}`}});if(r.status===X.StatusCodes.UNAUTHORIZED)throw Error(`Stored auth is invalid or expired`);return r.status===X.StatusCodes.OK?Z(await r.text(),Dc):await Q(r,`Failed to revoke CLI session`)},Ic=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/get-session`,T(e));i.searchParams.set(`disableCookieCache`,`true`),t.disableRefresh&&i.searchParams.set(`disableRefresh`,`true`);let a=await r(i,{method:`GET`,headers:{authorization:`Bearer ${t.token}`}});return a.status===X.StatusCodes.OK?{status:wc.OK,session:Z(await a.text(),rc),error:null}:a.status===X.StatusCodes.UNAUTHORIZED?{status:wc.UNAUTHORIZED,session:null,error:Z(await a.text(),ec)}:await Q(a,`Failed to refresh session`)};var Lc=class extends Error{constructor(e,t){super(e),this.name=`HttpClientResponseError`,this.status=t.status,this.statusText=t.statusText,this.bodyText=t.bodyText,t.cause!==void 0&&(this.cause=t.cause)}};const Rc=async e=>{try{return await e.clone().text()}catch{return}},zc=async(e,t=`HTTP request failed`)=>{if(e.ok)return;let n=await Rc(e);throw new Lc(t,{status:e.status,statusText:e.statusText,bodyText:n})},Bc=/^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,Vc=/^\d+$/;let Hc=function(e){return e[e.V1=1]=`V1`,e}({}),Uc=function(e){return e.CLI=`cli`,e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.BROWSER_USE=`browser-use`,e}({}),Wc=function(e){return e.STABLE=`stable`,e.BETA=`beta`,e.PREVIEW=`preview`,e}({}),Gc=function(e){return e.UP_TO_DATE=`up_to_date`,e.UPDATE_AVAILABLE=`update_available`,e.UPDATE_REQUIRED=`update_required`,e}({}),Kc=function(e){return e.COMMAND=`command`,e.DOWNLOAD=`download`,e.STORE=`store`,e.DOCS=`docs`,e}({}),qc=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.WIN_X64=`win-x64`,e}({}),Jc=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.LINUX_X64=`linux-x64`,e.LINUX_ARM64=`linux-arm64`,e}({}),Yc=function(e){return e.IOS=`ios`,e.ANDROID=`android`,e}({}),Xc=function(e){return e.CHROME=`chrome`,e}({});const Zc=new Set(Object.values(Uc)),Qc=new Set(Object.values(Wc)),$c=new Set(Object.values(Kc)),el=Object.values(qc),tl=Object.values(Jc),nl=Object.values(Yc),rl=Object.values(Xc),il={[Uc.CLI]:tl,[Uc.DESKTOP]:el,[Uc.MOBILE]:nl,[Uc.BROWSER_USE]:rl},al=e=>typeof e==`object`&&!!e,$=(e,t)=>{if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string`);return e.trim()},ol=(e,t)=>{if(e!=null){if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string when provided`);return e.trim()}},sl=(e,t)=>{if(e!=null){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`Release manifest ${t} must be a finite number when provided`);return e}},cl=(e,t)=>{let n=sl(e,t);if(n!=null){if(!Number.isInteger(n)||n<0)throw Error(`Release manifest ${t} must be a non-negative integer when provided`);return n}},ll=(e,t)=>{let n=Vc.test(e),r=Vc.test(t);return n&&r?Number(e)-Number(t):n?-1:r?1:e.localeCompare(t)},ul=e=>{let t=e.trim().match(Bc);if(!t)throw Error(`Invalid release version: ${e}`);return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:t[4]?t[4].split(`.`):[]}},dl=e=>Zc.has(e),fl=e=>Qc.has(e),pl=e=>$c.has(e),ml=(e,t)=>il[e].includes(t),hl=(e,t)=>{let n=ul(e),r=ul(t);if(n.major!==r.major)return n.major-r.major;if(n.minor!==r.minor)return n.minor-r.minor;if(n.patch!==r.patch)return n.patch-r.patch;let i=n.prerelease.length>0,a=r.prerelease.length>0;if(!i&&!a)return 0;if(!i)return 1;if(!a)return-1;let o=Math.max(n.prerelease.length,r.prerelease.length);for(let e=0;e<o;e+=1){let t=n.prerelease[e],i=r.prerelease[e];if(t==null)return-1;if(i==null)return 1;let a=ll(t,i);if(a!==0)return a}return 0},gl=(e,t)=>hl(t,e.minimumSupportedVersion)<0?Gc.UPDATE_REQUIRED:hl(t,e.latestVersion)<0?Gc.UPDATE_AVAILABLE:Gc.UP_TO_DATE,_l=e=>{if(!ml(e.product,e.platform))throw Error(`Unsupported release platform '${e.platform}' for product '${e.product}'`);return`v1/releases/${e.product}/${e.channel}/${e.platform}.json`},vl=e=>{if(!al(e))throw TypeError(`Release manifest must be an object`);let t=e.schemaVersion;if(t!==Hc.V1)throw Error(`Unsupported release manifest schema version: ${String(t)}`);let n=$(e.product,`product`);if(!dl(n))throw Error(`Unsupported release product: ${n}`);let r=$(e.channel,`channel`);if(!fl(r))throw Error(`Unsupported release channel: ${r}`);let i=$(e.platform,`platform`);if(!ml(n,i))throw Error(`Unsupported release platform '${i}' for product '${n}'`);let a=i,o=e.actions;if(!Array.isArray(o))throw TypeError(`Release manifest actions must be an array`);let s=o.map((e,t)=>{if(!al(e))throw TypeError(`Release manifest actions[${t}] must be an object`);let n=$(e.kind,`actions[${t}].kind`);if(!pl(n))throw Error(`Unsupported release action kind: ${n}`);return{kind:n,label:$(e.label,`actions[${t}].label`),url:ol(e.url,`actions[${t}].url`),command:ol(e.command,`actions[${t}].command`),sha256:ol(e.sha256,`actions[${t}].sha256`),size:cl(e.size,`actions[${t}].size`)}}),c=sl(e.rolloutPercentage,`rolloutPercentage`);if(c!=null&&(!Number.isInteger(c)||c<0||c>100))throw Error(`Release manifest rolloutPercentage must be an integer between 0 and 100`);return{schemaVersion:Hc.V1,product:n,channel:r,platform:a,latestVersion:$(e.latestVersion,`latestVersion`),minimumSupportedVersion:$(e.minimumSupportedVersion,`minimumSupportedVersion`),publishedAt:$(e.publishedAt,`publishedAt`),releaseNotesUrl:ol(e.releaseNotesUrl,`releaseNotesUrl`),message:ol(e.message,`message`),rolloutPercentage:c,actions:s}},yl=new Set([`localhost`,`127.0.0.1`,`::1`]),bl=e=>yl.has(e),xl=e=>{let t=T(e.trim()),n=new URL(t);if(n.protocol===`https:`||n.protocol===`http:`&&bl(n.hostname))return T(n.toString());throw Error(`Updates base URL must use https or localhost http: ${e}`)},Sl=e=>`${xl(e.baseUrl)}/${_l({product:e.product,channel:e.channel,platform:e.platform})}`,Cl=async e=>e.json(),wl=async e=>{let t=new AbortController,n=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n=await e.fetchImpl(e.url,{method:`GET`,signal:t.signal,headers:{accept:`application/json`}});return await zc(n,`Release manifest request failed`),vl(await Cl(n))}finally{clearTimeout(n)}},Tl=async e=>{let t=e.fetch??fetch,n=await wl({url:Sl({baseUrl:e.baseUrl,product:e.product,channel:e.channel,platform:e.platform}),fetchImpl:t,timeoutMs:e.timeoutMs??5e3});return{availability:gl(n,e.currentVersion),manifest:n}};export{Ie as A,ct as C,Be as D,nt as E,ze as O,wt as S,rt as T,ft as _,Gc as a,xt as b,jc as c,Fc as d,Oc as f,Ot as g,Mc as h,Uc as i,Me as k,Ic as l,Ac as m,Jc as n,wc as o,kc as p,Wc as r,Pc as s,Tl as t,Nc as u,_t as v,tt as w,mt as x,dt as y};
@@ -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_-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
+ 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_-CGPWxqBd.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};
@@ -0,0 +1 @@
1
+ import{n as e}from"./runtime_auth_helpers-etyYdhk_-CGPWxqBd.js";export{e as resolveSessionFromToken};
@@ -1 +1 @@
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};
1
+ import{f as e,l as t,o as n,p as r}from"./dist-CBEQIXzT.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,7 +1,7 @@
1
1
  {
2
2
  "name": "echo-cli",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "private": true,
6
6
  "files": [
7
7
  ".env.example",
@@ -34,7 +34,6 @@
34
34
  "@echo/network-core": "workspace:*",
35
35
  "@echo/observability-otel-node": "workspace:*",
36
36
  "@echo/pty-core": "workspace:*",
37
- "@echo/reviews-core": "workspace:*",
38
37
  "@opentelemetry/instrumentation-http": "catalog:",
39
38
  "@opentelemetry/instrumentation-undici": "catalog:",
40
39
  "cac": "catalog:",