@lattice-php/lattice 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/appearance/index.d.ts +6 -0
  2. package/dist/appearance/index.js +11 -2
  3. package/dist/appearance/index.js.map +1 -1
  4. package/dist/create-app.d.ts +6 -3
  5. package/dist/create-app.js +13 -5
  6. package/dist/create-app.js.map +1 -1
  7. package/dist/form/components/fields/use-flip-reorder.js +3 -2
  8. package/dist/form/components/fields/use-flip-reorder.js.map +1 -1
  9. package/dist/form/components/fields/use-row-collection.js +3 -2
  10. package/dist/form/components/fields/use-row-collection.js.map +1 -1
  11. package/dist/form/hooks/use-form-resolver.js +3 -2
  12. package/dist/form/hooks/use-form-resolver.js.map +1 -1
  13. package/dist/i18n/instance.d.ts +8 -0
  14. package/dist/i18n/instance.js +17 -1
  15. package/dist/i18n/instance.js.map +1 -1
  16. package/dist/lib/use-layout-effect.d.ts +6 -0
  17. package/dist/lib/use-layout-effect.js +11 -0
  18. package/dist/lib/use-layout-effect.js.map +1 -0
  19. package/dist/ssr.d.ts +20 -0
  20. package/dist/ssr.js +32 -0
  21. package/dist/ssr.js.map +1 -0
  22. package/dist/vite.js +2 -5
  23. package/dist/vite.js.map +1 -1
  24. package/dist-standalone/chunks/{icon-button-CEwL9uXW.js → icon-button-D4DKcnhp.js} +1 -1
  25. package/dist-standalone/chunks/instance-BQeVkUpw.js +1 -0
  26. package/dist-standalone/chunks/page-props-BA5zqTIT.js +1 -0
  27. package/dist-standalone/chunks/{rich-editor-field-DVvEzA3W.js → rich-editor-field-BeeSr2Zx.js} +1 -1
  28. package/dist-standalone/chunks/{subscriptions-HzwKFUPT.js → subscriptions-Cwd1jFs5.js} +1 -1
  29. package/dist-standalone/lattice.css +1 -1
  30. package/dist-standalone/lattice.js +4 -4
  31. package/dist-standalone/manifest.json +7 -7
  32. package/package.json +9 -1
  33. package/dist-standalone/chunks/instance-B-C4sgf4.js +0 -1
  34. package/dist-standalone/chunks/page-props-nxR5n6k4.js +0 -1
@@ -1,23 +1,23 @@
1
1
  {
2
- "version": "0.32.0",
2
+ "version": "0.33.0",
3
3
  "files": {
4
- "lattice.js": "7a2be0ec5bb4",
4
+ "lattice.js": "a88bb1274e33",
5
5
  "chunks/chart-view-WqyMTZiX.js": "24a0fa215276",
6
6
  "chunks/date-picker-field-CCnkf4SC.js": "4d5eff85925f",
7
7
  "chunks/dist-CK9gk4iB.js": "fcd98bf4a897",
8
8
  "chunks/dist-DqlcM-vw.js": "574d76694c7a",
9
- "chunks/icon-button-CEwL9uXW.js": "6a17e2bdec95",
10
- "chunks/instance-B-C4sgf4.js": "1798ce635b33",
9
+ "chunks/icon-button-D4DKcnhp.js": "24c61d0b24b4",
10
+ "chunks/instance-BQeVkUpw.js": "87132e275d67",
11
11
  "chunks/jsx-runtime-CN5ucv1d.js": "dad8b788d0f0",
12
12
  "chunks/locale-CgtcxthU.js": "d6510680ac4d",
13
13
  "chunks/materialize-CWqnSEHR.js": "cb96c5b9d4c0",
14
14
  "chunks/notifications-echo-uU87iJAV.js": "5cf6365d2f9d",
15
15
  "chunks/number-BvVKQqOG.js": "e94a1245aea2",
16
- "chunks/page-props-nxR5n6k4.js": "8bae86628e23",
16
+ "chunks/page-props-BA5zqTIT.js": "f2461b38c425",
17
17
  "chunks/react-SIfiwpqq.js": "160d3a8e9743",
18
- "chunks/rich-editor-field-DVvEzA3W.js": "85129640f020",
18
+ "chunks/rich-editor-field-BeeSr2Zx.js": "3773a57e886e",
19
19
  "chunks/shared-props-B_wT1GcG.js": "2e11a719edd0",
20
- "chunks/subscriptions-HzwKFUPT.js": "d5bd1f6fcff8",
20
+ "chunks/subscriptions-Cwd1jFs5.js": "1971261e663b",
21
21
  "chunks/test-id-Dh3L6Gfh.js": "7958de4f0270",
22
22
  "chunks/time-picker-DSs9fDWe.js": "9b92e1560037",
23
23
  "chunks/timezone-BORzyZp2.js": "908c1ebd3d64",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lattice-php/lattice",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Server-driven React components for Laravel and Inertia.",
5
5
  "license": "MIT",
6
6
  "author": "Manuel Christlieb <manuel@christlieb.eu>",
@@ -138,6 +138,10 @@
138
138
  "types": "./dist/lib/use-debounced-callback.d.ts",
139
139
  "import": "./dist/lib/use-debounced-callback.js"
140
140
  },
141
+ "./lib/use-layout-effect": {
142
+ "types": "./dist/lib/use-layout-effect.d.ts",
143
+ "import": "./dist/lib/use-layout-effect.js"
144
+ },
141
145
  "./lib/utils": {
142
146
  "types": "./dist/lib/utils.d.ts",
143
147
  "import": "./dist/lib/utils.js"
@@ -162,6 +166,10 @@
162
166
  "types": "./dist/remote/index.d.ts",
163
167
  "import": "./dist/remote/index.js"
164
168
  },
169
+ "./ssr": {
170
+ "types": "./dist/ssr.d.ts",
171
+ "import": "./dist/ssr.js"
172
+ },
165
173
  "./table": {
166
174
  "types": "./dist/table/index.d.ts",
167
175
  "import": "./dist/table/index.js"
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{a as n,i as r,t as i}from"./locale-CgtcxthU.js";import{a,s as o,t as s}from"./timezone-BORzyZp2.js";var c=e=>typeof e==`string`,l=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},u=e=>e==null?``:String(e),d=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},f=/###/g,p=e=>e&&e.includes(`###`)?e.replace(f,`.`):e,m=e=>!e||c(e),h=(e,t,n)=>{let r=c(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(m(e))return{};let t=p(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return m(e)?{}:{obj:e,k:p(r[i])}},g=(e,t,n)=>{let{obj:r,k:i}=h(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=h(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=h(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},_=(e,t,n,r)=>{let{obj:i,k:a}=h(e,t,Object);i[a]=i[a]||[],i[a].push(n)},v=(e,t)=>{let{obj:n,k:r}=h(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},y=(e,t,n)=>{let r=v(e,n);return r===void 0?v(t,n):r},b=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?c(e[r])||e[r]instanceof String||c(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):b(e[r],t[r],n):e[r]=t[r]);return e},x=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),S={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},C=e=>c(e)?e.replace(/[&<>"'\/]/g,e=>S[e]):e,w=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}},T=[` `,`,`,`?`,`!`,`;`],E=new w(20),D=(e,t,n)=>{t||=``,n||=``;let r=T.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=E.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},O=(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`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},k=e=>e?.replace(/_/g,`-`),ee={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)}},A=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ee,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,t,n,r){return r&&!this.debug?null:(e=e.map(e=>c(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),c(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](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)}},j=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)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}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(e,...t)})}},M=class extends j{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.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):c(n)&&i?o.push(...n.split(i)):o.push(n)));let s=v(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!c(n)?s:O(this.data?.[e]?.[t],n,i)}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.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),g(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(c(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=v(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?b(s,n,i):s={...s,...n},g(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}},N={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}},P=Symbol(`i18next/PATH_KEY`);function te(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===P?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function F(e,t){let{[P]:n}=e(te()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var I=e=>!c(e)&&typeof e!=`boolean`&&typeof e!=`number`,ne=class e extends j{constructor(e,t={}){super(),d([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=A.create(`translator`),this.checkedLoadedFor={}}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=I(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!D(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:c(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:c(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=F(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?F(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:l}=this.extractFromKey(t[t.length-1],i),u=l[l.length-1],d=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;d===void 0&&(d=`:`);let f=i.lng||this.language,p=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()===`cimode`)return p?a?{res:`${u}${d}${s}`,usedKey:s,exactUsedKey:s,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${d}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:s;let m=this.resolve(t,i),h=m?.res,g=m?.usedKey||s,_=m?.exactUsedKey||s,v=[`[object Number]`,`[object Function]`,`[object RegExp]`],y=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x=i.count!==void 0&&!c(i.count),S=e.hasDefaultValue(i),C=x?this.pluralResolver.getSuffix(f,i.count,i):``,w=i.ordinal&&x?this.pluralResolver.getSuffix(f,i.count,{ordinal:!1}):``,T=x&&!i.ordinal&&i.count===0,E=T&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${C}`]||i[`defaultValue${w}`]||i.defaultValue,D=h;b&&!h&&S&&(D=E);let O=I(D),k=Object.prototype.toString.apply(D);if(b&&D&&O&&!v.includes(k)&&!(c(y)&&Array.isArray(D))){if(!i.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(g,D,{...i,ns:l}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(m.res=e,m.usedParams=this.getUsedParamsDetails(i),m):e}if(o){let e=Array.isArray(D),t=e?[]:{},n=e?_:g;for(let e in D)if(Object.prototype.hasOwnProperty.call(D,e)){let r=`${n}${o}${e}`;t[e]=S&&!h?this.translate(r,{...i,defaultValue:I(E)?E[e]:void 0,joinArrays:!1,ns:l}):this.translate(r,{...i,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=D[e])}h=t}}else if(b&&c(y)&&Array.isArray(h))h=h.join(y),h&&=this.extendTranslation(h,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(h)&&S&&(e=!0,h=E),this.isValidLookup(h)||(n=!0,h=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:h,c=S&&E!==h&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,f,u,x&&!c?`${s}${this.pluralResolver.getSuffix(f,i.count,i)}`:s,c?E:h),o){let e=this.resolve(s,{...i,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,i.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(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=S&&n!==h?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,r,c,i),this.emit(`missingKey`,e,u,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);T&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||E)})}):n(e,s,E))}h=this.extendTranslation(h,t,i,m,r),n&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${u}${d}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${s}`:s,e?h:void 0,i))}return a?(m.res=h,m.usedParams=this.getUsedParamsDetails(i),m):h}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=c(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!c(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=c(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=N.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return c(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?F(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),l=s.key;r=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=t.count!==void 0&&!c(t.count),f=d&&!t.ordinal&&t.count===0,p=t.context!==void 0&&(c(t.context)||typeof t.context==`number`)&&t.context!==``,m=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${m.join(`, `)}" won't get resolved as namespace "${o}" 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(r=>{if(this.isValidLookup(n))return;a=r;let o=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,l,r,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&e.startsWith(i)&&o.push(l+e.replace(i,this.options.pluralSeparator)),o.push(l+e),f&&o.push(l+n)),p){let r=`${l}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),d&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),f&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}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 t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!c(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},L=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=A.create(`languageUtils`)}getScriptPartFromCode(e){if(e=k(e),!e||!e.includes(`-`))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=k(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(c(e)&&e.includes(`-`)){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.includes(e)}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=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),c(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return c(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):c(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},R={zero:0,one:1,two:2,few:3,many:4,other:5},z={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},re=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=A.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=k(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!`),z;if(!e.match(/-|_/))return z;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)=>R[e]-R[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))}},B=(e,t,n,r=`.`,i=!0)=>{let a=y(e,t,n);return!a&&i&&c(n)&&(a=O(e,n,r),a===void 0&&(a=O(t,n,r))),a},ie=e=>e.replace(/\$/g,`$$$$`),V=class{constructor(e={}){this.logger=A.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:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?C:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?x(i):a||`{{`,this.suffix=o?x(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?x(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?x(l):``,this.nestingPrefix=d?x(d):f||x(`$t(`),this.nestingSuffix=p?x(p):m||x(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,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,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(!e.includes(this.formatSeparator)){let i=B(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(B(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=l(n),a===void 0)if(typeof d==`function`){let t=d(e,i,r);a=c(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!c(a)&&!this.useRawValueToEscape&&(a=u(a));let s=t.safeValue(a);if(e=e.replace(i[0],ie(s)),f?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${x(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!c(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let l=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(l!==-1&&(s=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!c(i))return i;c(i)||(i=u(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},ae=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?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}},H=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(k(r),i),t[o]=s),s(n)}},oe=e=>(t,n,r)=>e(k(n),r)(t),se=class{constructor(e={}){this.logger=A.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?H:oe;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()]=H(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ae(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}return this.logger.warn(`there was no format function for ${i}`),e},e)}},ce=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},le=class extends j{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=A.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=>{_(n.loaded,[i],a),ce(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(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,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();c(e)&&(e=this.languageUtils.toResolveHierarchy(e)),c(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.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)}}},U=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,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 t={};if(typeof e[1]==`object`&&(t=e[1]),c(e[1])&&(t.defaultValue=e[1]),c(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),W=e=>(c(e.ns)&&(e.ns=[e.ns]),c(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),c(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),G=()=>{},ue=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},K=class e extends j{constructor(e={},t){if(super(),this.options=W(e),this.services={},this.logger=A,this.modules={external:[]},ue(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(c(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=U();this.options={...n,...this.options,...W(e)},this.options.interpolation={...n.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=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?A.init(r(this.modules.logger),this.options):A.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:se;let t=new L(this.options);this.store=new M(this.options.resources,this.options);let n=this.services;n.logger=A,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new re(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new V(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new le(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new ne(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,t||=G,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 i=l(),a=()=>{let e=(e,n)=>{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),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=G){let n=t,r=c(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):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),n(e)})}else n(null)}reloadResources(e,t,n){let r=l();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=G,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}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`&&N.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`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=l();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=c(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(c(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=F(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=F(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=F(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return c(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}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,t){let n=l();return this.options.ns?(c(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=l();c(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),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 L(U());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||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=G){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 M(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={...U().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new V(n)}return a.translator=new ne(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();K.createInstance,K.dir,K.init,K.loadResources,K.reloadResources,K.use,K.changeLanguage,K.getFixedT,K.t,K.exists,K.setDefaultNamespace,K.hasLoadedNamespace,K.loadNamespaces,K.loadLanguages;var q=e(t(),1);function de(e){e.services.formatter?.add(`datetime`,(e,t,n)=>{let r=a(e);return r?new Intl.DateTimeFormat(t,{timeZone:s(),...n}).format(r):String(e??``)})}var J=`lattice`,Y=K.createInstance(),X,Z=0;function fe(e){let t=()=>{Z+=1,e()};return Y.on(`initialized`,t),Y.on(`loaded`,t),Y.on(`languageChanged`,t),Y.store?.on(`added`,t),Y.store?.on(`removed`,t),()=>{Y.off(`initialized`,t),Y.off(`loaded`,t),Y.off(`languageChanged`,t),Y.store?.off(`added`,t),Y.store?.off(`removed`,t)}}function Q(){return Z}function $(e){if(!X){let t={lng:i(),fallbackLng:`en`,ns:[J],defaultNS:J,interpolation:{escapeValue:!1}};X=Y.init(e?e(t):t),de(Y)}return X}r(e=>{$().then(()=>{Y.language!==e&&Y.changeLanguage(e)})});async function pe(e){let t=e.filter(e=>e!==i());t.length!==0&&(await $(),await Y.loadLanguages([...t]))}function me(e){$(),(0,q.useSyncExternalStore)(fe,Q,Q);let{locales:t}=o(),{locale:r,setLocale:i}=n();return{t:(0,q.useCallback)((t,n=t,r={})=>he(e,t,n,r),[e]),i18n:Y,locale:r,locales:t,ready:Y.isInitialized,setLocale:i}}function he(e,t,n,r){return $(),!Y.isInitialized||!Y.hasLoadedNamespace(e)?Y.t(t,n,{ns:e,...r,saveMissing:!1}):Y.t(t,n,{ns:e,...r})}export{he as a,pe as i,$ as n,me as o,Y as r,J as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./locale-CgtcxthU.js";import{i as t,n,r}from"./instance-B-C4sgf4.js";import{o as i}from"./timezone-BORzyZp2.js";import{t as a}from"./shared-props-B_wT1GcG.js";var o=[];o.forEach,o.slice;var s=[`__proto__`,`constructor`,`prototype`];function c(e){return!(typeof e!=`string`||e.length===0||e.length>128||s.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function l(e){return!(!c(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function u(e){return c(e)}var d={lng:l,ns:u};function f(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function p(e){if(typeof e!=`string`||e.length===0)return e;try{let t=new URL(e);return t.username||t.password?(t.username=``,t.password=``,t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,`$1`)}}function m(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function h(e){return!!e&&typeof e.then==`function`}function g(e){return h(e)?e:Promise.resolve(e)}var _=/\{\{(.+?)\}\}/g;function v(e,t){let n=!1,r=e.replace(_,(e,r)=>{let i=r.trim();if(s.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=d[i]||l,c=String(a).split(`+`);for(let t of c)if(!o(t))return n=!0,e;return c.join(`+`)});return n?null:r}var y=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,b;typeof fetch==`function`?b=fetch:y&&typeof y.fetch==`function`&&(b=y.fetch);var x=m()&&y?y.XMLHttpRequest:void 0,S=typeof ActiveXObject==`function`&&y?y.ActiveXObject:void 0,C=[`__proto__`,`constructor`,`prototype`],w=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))C.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},T=(e,t,n,r)=>{let i=e=>{if(!e.ok)return n(e.statusText||`Error`,{status:e.status});e.text().then(t=>{n(null,{status:e.status,data:t})}).catch(n)};if(r){let a=r(e,t);if(a instanceof Promise){a.then(i).catch(n);return}}typeof fetch==`function`?fetch(e,t).then(i).catch(n):b(e,t).then(i).catch(n)},E=(e,t,n,r)=>{e.queryStringParams&&(t=w(t,e.queryStringParams));let i={...typeof e.customHeaders==`function`?e.customHeaders():e.customHeaders};typeof window>`u`&&typeof global<`u`&&global.process!==void 0&&global.process.versions&&global.process.versions.node&&(i[`User-Agent`]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(i[`Content-Type`]=`application/json`);let a=typeof e.requestOptions==`function`?e.requestOptions(n):e.requestOptions,o={method:n?`POST`:`GET`,body:n?e.stringify(n):void 0,headers:i,...e._omitFetchOptions?{}:a},s=typeof e.alternateFetch==`function`&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{T(t,o,r,s)}catch(n){if(!a||Object.keys(a).length===0||!n.message||n.message.indexOf(`not implemented`)<0)return r(n);try{Object.keys(a).forEach(e=>{delete o[e]}),T(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},D=(e,t,n,r)=>{n&&typeof n==`object`&&(n=w(``,n).slice(1)),e.queryStringParams&&(t=w(t,e.queryStringParams));try{let i=x?new x:new S(`MSXML2.XMLHTTP.3.0`);i.open(n?`POST`:`GET`,t,1),e.crossDomain||i.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`),i.withCredentials=!!e.withCredentials,n&&i.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),i.overrideMimeType&&i.overrideMimeType(`application/json`);let a=e.customHeaders;if(a=typeof a==`function`?a():a,a)for(let e of Object.keys(a))C.indexOf(e)>-1||i.setRequestHeader(e,a[e]);i.onreadystatechange=()=>{i.readyState>3&&r(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(e){console&&console.log(e)}},O=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),b&&t.indexOf(`file:`)!==0)return E(e,t,n,r);if(m()||typeof ActiveXObject==`function`)return D(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},k=()=>({loadPath:`/locales/{{lng}}/{{ns}}.json`,addPath:`/locales/add/{{lng}}/{{ns}}`,parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||``}),parseLoadPayload:(e,t)=>void 0,request:O,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),A=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type=`backend`,this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...k(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){let e=setInterval(()=>this.reload(),this.options.reloadInterval);typeof e==`object`&&typeof e.unref==`function`&&e.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,i){let a=this.options.loadPath;typeof this.options.loadPath==`function`&&(a=this.options.loadPath(e,n)),a=g(a),a.then(a=>{if(!a)return i(null,{});let o=v(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(f).join(`, `),r=n.map(f).join(`, `);return i(Error(`i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[`+t+`] namespaces=[`+r+`]`),!1)}this.loadUrl(o,i,t,r)})}loadUrl(e,t,n,r){let i=typeof n==`string`?[n]:n,a=typeof r==`string`?[r]:r,o=this.options.parseLoadPayload(i,a),s=f(p(e));this.options.request(this.options,e,o,(e,i)=>{if(i&&(i.status>=500&&i.status<600||!i.status))return t(`failed loading `+s+`; status code: `+i.status,!0);if(i&&i.status>=400&&i.status<500)return t(`failed loading `+s+`; status code: `+i.status,!1);if(!i&&e&&e.message){let n=e.message.toLowerCase();if([`failed`,`fetch`,`network`,`load`].find(e=>n.indexOf(e)>-1))return t(`failed loading `+s+`: `+f(e.message),!0)}if(e)return t(e,!1);let a,o;try{a=typeof i.data==`string`?this.options.parse(i.data,n,r):i.data}catch{o=`failed parsing `+s+` to json`}if(o)return t(o,!1);t(null,a)})}create(e,t,n,r,i){if(!this.options.addPath)return;typeof e==`string`&&(e=[e]);let a=this.options.parsePayload(t,n,r),o=0,s=[],c=[];e.forEach(n=>{let r=this.options.addPath;typeof this.options.addPath==`function`&&(r=this.options.addPath(n,t));let l=v(r,{lng:n,ns:t});if(l==null){o+=1,i&&o===e.length&&i(s,c);return}this.options.request(this.options,l,a,(t,n)=>{o+=1,s.push(t),c.push(n),o===e.length&&typeof i==`function`&&i(s,c)})})}reload(){let{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()===`cimode`)return;let i=[],a=e=>{t.toResolveHierarchy(e).forEach(e=>{i.indexOf(e)<0&&i.push(e)})};a(r),this.allOptions.preload&&this.allOptions.preload.forEach(e=>a(e)),i.forEach(t=>{this.allOptions.ns.forEach(r=>{e.read(t,r,`read`,null,null,(i,a)=>{i&&n.warn(`loading namespace ${r} for language ${t} failed`,i),!i&&a&&n.log(`loaded namespace ${r} for language ${t}`,a),e.loaded(`${t}|${r}`,i,a)})})})}};A.type=`backend`;var j=`/locales/{{lng}}/{{ns}}.json`,M=`/locales/add/{{lng}}/{{ns}}`;async function N(e,r={}){if(i(e),!e?.enabled){await n(e=>({...e,ns:r.namespaces??e.ns}));return}await P({saveMissing:e.saveMissing,namespaces:r.namespaces}),t(e.preloadLocales)}async function P(t={}){let{namespaces:i,loadPath:a=j,addPath:o=M,saveMissing:s=!1,customHeaders:c}=t,l=()=>({...e(),...c?.()});r.use(A),await n(e=>({...e,ns:i??e.ns,partialBundledLanguages:!0,saveMissing:s,backend:{loadPath:a,addPath:o,customHeaders:l,withCredentials:!0}}))}function F(e,t={}){return N(a(e),t)}export{F as configureI18nFromPageProps};