@intlayer/core 7.5.9 → 7.5.10

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 (36) hide show
  1. package/README.md +9 -2
  2. package/dist/cjs/interpreter/getIntlayer.cjs +22 -10
  3. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  4. package/dist/cjs/localization/getLocale.cjs +3 -4
  5. package/dist/cjs/localization/getLocale.cjs.map +1 -1
  6. package/dist/esm/interpreter/getIntlayer.mjs +22 -10
  7. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  8. package/dist/esm/localization/getLocale.mjs +1 -2
  9. package/dist/esm/localization/getLocale.mjs.map +1 -1
  10. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +8 -8
  11. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
  12. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +8 -8
  13. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
  14. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +8 -8
  15. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +2 -2
  16. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -1
  17. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  18. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  19. package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
  20. package/package.json +6 -6
  21. package/dist/cjs/dist/esm/getStorageAttributes.cjs +0 -134
  22. package/dist/cjs/dist/esm/getStorageAttributes.cjs.map +0 -1
  23. package/dist/cjs/dist/esm/localization/localeResolver.cjs +0 -28
  24. package/dist/cjs/dist/esm/localization/localeResolver.cjs.map +0 -1
  25. package/dist/cjs/dist/esm/utils/getCookie.cjs +0 -32
  26. package/dist/cjs/dist/esm/utils/getCookie.cjs.map +0 -1
  27. package/dist/cjs/dist/esm/utils/localeStorage.cjs +0 -61
  28. package/dist/cjs/dist/esm/utils/localeStorage.cjs.map +0 -1
  29. package/dist/esm/dist/esm/getStorageAttributes.mjs +0 -133
  30. package/dist/esm/dist/esm/getStorageAttributes.mjs.map +0 -1
  31. package/dist/esm/dist/esm/localization/localeResolver.mjs +0 -26
  32. package/dist/esm/dist/esm/localization/localeResolver.mjs.map +0 -1
  33. package/dist/esm/dist/esm/utils/getCookie.mjs +0 -31
  34. package/dist/esm/dist/esm/utils/getCookie.mjs.map +0 -1
  35. package/dist/esm/dist/esm/utils/localeStorage.mjs +0 -59
  36. package/dist/esm/dist/esm/utils/localeStorage.mjs.map +0 -1
package/README.md CHANGED
@@ -5,8 +5,11 @@
5
5
  </p>
6
6
 
7
7
  <h1 align="center">
8
- <strong> Intlayer : an Open-source, per-component i18n toolkit with AI-powered translation & CMS.</strong>
8
+ <strong>Per-component i18n</strong>
9
9
  </h1>
10
+ <h2 align="center">
11
+ <strong>AI-powered translation. Visual Editor. Multilingual CMS.</strong>
12
+ </h2>
10
13
 
11
14
  <br />
12
15
 
@@ -24,6 +27,8 @@
24
27
  <a href="https://github.com/aymericzip/intlayer/blob/main/LICENSE" target="_blank" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/github/license/aymericzip/intlayer?style=for-the-badge&labelColor=000000&color=FFFFFF&logoColor=000000&cacheSeconds=86400" alt="license"/></a>
25
28
  <a href="https://github.com/aymericzip/intlayer/commits/main" target="_blank" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/github/last-commit/aymericzip/intlayer?style=for-the-badge&labelColor=000000&color=FFFFFF&logoColor=000000&cacheSeconds=86400" alt="last commit"/>
26
29
  </a>
30
+ <a href="https://www.bountyhub.dev/en/bounty/view/a2f24259-80ae-4a19-82e7-288718fba449/adapt-markdown-parser-in-a-custom-packages" target="_blank" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/badge/Bounties-on%20BountyHub-yellow?style=for-the-badge&labelColor=000000&color=FFFFFF&logoColor=000000&cacheSeconds=86400" alt="Bounties on BountyHub"/>
31
+ </a>
27
32
  </p>
28
33
 
29
34
  ![Watch the video](https://github.com/aymericzip/intlayer/blob/main/docs/assets/demo_video.gif)
@@ -46,7 +51,7 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
46
51
  | Feature | Description |
47
52
  | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48
53
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
49
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.png?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
50
55
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
51
56
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
52
57
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
@@ -268,6 +273,8 @@ You can also follow us on :
268
273
 
269
274
  For more detailed guidelines on contributing to this project, please refer to the [`CONTRIBUTING.md`](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md) file. It contains essential information on our development process, commit message conventions, and release procedures. Your contributions are valuable to us, and we appreciate your efforts in making this project better!
270
275
 
276
+ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https://gitlab.com/ay.pineau/intlayer), or [Bitbucket](https://bitbucket.org/intlayer/intlayer/).
277
+
271
278
  ### Thank You for the Support
272
279
 
273
280
  If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
@@ -6,18 +6,30 @@ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built
6
6
  let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
7
7
 
8
8
  //#region src/interpreter/getIntlayer.ts
9
+ /**
10
+ * Creates a Recursive Proxy that returns the path of the accessed key
11
+ * stringified. This prevents the app from crashing on undefined access.
12
+ */
13
+ const createSafeFallback = (path = "") => {
14
+ return new Proxy(() => path, {
15
+ get: (_target, prop) => {
16
+ if (prop === "toJSON" || prop === Symbol.toPrimitive || prop === "toString") return () => path;
17
+ if (prop === "then") return;
18
+ return createSafeFallback(path ? `${path}.${String(prop)}` : String(prop));
19
+ },
20
+ apply: () => {
21
+ return path;
22
+ }
23
+ });
24
+ };
9
25
  const getIntlayer = (key, locale, plugins) => {
10
- const dictionaries = (0, _intlayer_dictionaries_entry.getDictionaries)();
11
- const dictionary = dictionaries[key];
26
+ const dictionary = (0, _intlayer_dictionaries_entry.getDictionaries)()[key];
12
27
  if (!dictionary) {
13
- if (_intlayer_config_built.default.build.optimize === true || _intlayer_config_built.default.build.optimize === void 0 && process.env.NODE_ENV === "production") {
14
- (0, _intlayer_config_client.getAppLogger)(_intlayer_config_built.default)("Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the traversePattern to include the current component.", {
15
- level: "error",
16
- isVerbose: true
17
- });
18
- throw new Error(`Dictionary ${key} not found - Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the 'traversePattern' to include the current component.`, dictionaries);
19
- }
20
- throw new Error(`Dictionary ${key} not found`, dictionaries);
28
+ (0, _intlayer_config_client.getAppLogger)(_intlayer_config_built.default)(`Dictionary "${key}" was not found. Using fallback proxy.`, {
29
+ level: "warn",
30
+ isVerbose: true
31
+ });
32
+ if (process.env.NODE_ENV === "development") return createSafeFallback(key);
21
33
  }
22
34
  return require_interpreter_getDictionary.getDictionary(dictionary, locale, plugins);
23
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.cjs","names":["configuration","getDictionary"],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<\n DictionaryRegistryContent<T>,\n IInterpreterPluginState,\n L\n> => {\n const dictionaries = getDictionaries();\n const dictionary = dictionaries[key as T] as DictionaryRegistryElement<T>;\n\n if (!dictionary) {\n if (\n configuration.build.optimize === true ||\n (configuration.build.optimize === undefined &&\n process.env.NODE_ENV === 'production')\n ) {\n const logger = getAppLogger(configuration);\n\n logger(\n 'Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the traversePattern to include the current component.',\n {\n level: 'error',\n isVerbose: true,\n }\n );\n throw new Error(\n `Dictionary ${key as string} not found - Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the 'traversePattern' to include the current component.`,\n dictionaries\n );\n }\n throw new Error(`Dictionary ${key as string} not found`, dictionaries);\n }\n\n return getDictionary<DictionaryRegistryElement<T>, L>(\n dictionary,\n locale,\n plugins\n );\n};\n"],"mappings":";;;;;;;;AAiBA,MAAa,eAIX,KACA,QACA,YAKG;CACH,MAAM,kEAAgC;CACtC,MAAM,aAAa,aAAa;AAEhC,KAAI,CAAC,YAAY;AACf,MACEA,+BAAc,MAAM,aAAa,QAChCA,+BAAc,MAAM,aAAa,UAChC,QAAQ,IAAI,aAAa,cAC3B;AAGA,6CAF4BA,+BAAc,CAGxC,8KACA;IACE,OAAO;IACP,WAAW;IACZ,CACF;AACD,SAAM,IAAI,MACR,cAAc,IAAc,4LAC5B,aACD;;AAEH,QAAM,IAAI,MAAM,cAAc,IAAc,aAAa,aAAa;;AAGxE,QAAOC,gDACL,YACA,QACA,QACD"}
1
+ {"version":3,"file":"getIntlayer.cjs","names":["configuration","getDictionary"],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["// packages/@intlayer/core/src/interpreter/getIntlayer.ts\n\nimport configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\n/**\n * Creates a Recursive Proxy that returns the path of the accessed key\n * stringified. This prevents the app from crashing on undefined access.\n */\nconst createSafeFallback = (path = ''): any => {\n return new Proxy(\n // Target is a function so it can be called if the dictionary expects a function\n () => path,\n {\n get: (_target, prop) => {\n // Handle common object methods to prevent infinite recursion or weird behavior\n if (\n prop === 'toJSON' ||\n prop === Symbol.toPrimitive ||\n prop === 'toString'\n ) {\n return () => path;\n }\n if (prop === 'then') {\n return undefined; // Prevent it from being treated as a Promise\n }\n\n // Recursively build the path (e.g., \"myDictionary.home.title\")\n const nextPath = path ? `${path}.${String(prop)}` : String(prop);\n return createSafeFallback(nextPath);\n },\n // If the code tries to execute the missing key as a function: t.title()\n apply: () => {\n return path;\n },\n }\n );\n};\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<\n DictionaryRegistryContent<T>,\n IInterpreterPluginState,\n L\n> => {\n const dictionaries = getDictionaries();\n const dictionary = dictionaries[key as T] as DictionaryRegistryElement<T>;\n\n if (!dictionary) {\n // Log a warning instead of throwing (so developers know it's missing)\n const logger = getAppLogger(configuration);\n logger(\n `Dictionary \"${key as string}\" was not found. Using fallback proxy.`,\n {\n level: 'warn',\n isVerbose: true,\n }\n );\n\n if (process.env.NODE_ENV === 'development') {\n // Return the Safe Proxy\n // We initialize it with the dictionary key name so the UI shows \"my-dictionary.someKey\"\n return createSafeFallback(key as string);\n }\n }\n\n return getDictionary<DictionaryRegistryElement<T>, L>(\n dictionary,\n locale,\n plugins\n );\n};\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,sBAAsB,OAAO,OAAY;AAC7C,QAAO,IAAI,YAEH,MACN;EACE,MAAM,SAAS,SAAS;AAEtB,OACE,SAAS,YACT,SAAS,OAAO,eAChB,SAAS,WAET,cAAa;AAEf,OAAI,SAAS,OACX;AAKF,UAAO,mBADU,OAAO,GAAG,KAAK,GAAG,OAAO,KAAK,KAAK,OAAO,KAAK,CAC7B;;EAGrC,aAAa;AACX,UAAO;;EAEV,CACF;;AAGH,MAAa,eAIX,KACA,QACA,YAKG;CAEH,MAAM,gEADgC,CACN;AAEhC,KAAI,CAAC,YAAY;AAGf,4CAD4BA,+BAAc,CAExC,eAAe,IAAc,yCAC7B;GACE,OAAO;GACP,WAAW;GACZ,CACF;AAED,MAAI,QAAQ,IAAI,aAAa,cAG3B,QAAO,mBAAmB,IAAc;;AAI5C,QAAOC,gDACL,YACA,QACA,QACD"}
@@ -1,23 +1,22 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_localeResolver = require('../dist/esm/localization/localeResolver.cjs');
3
- const require_localeStorage = require('../dist/esm/utils/localeStorage.cjs');
4
2
  const require_localization_localeDetector = require('./localeDetector.cjs');
5
3
  let _intlayer_config_client = require("@intlayer/config/client");
6
4
  let _intlayer_config_built = require("@intlayer/config/built");
7
5
  _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
6
+ let _intlayer_core = require("@intlayer/core");
8
7
 
9
8
  //#region src/localization/getLocale.ts
10
9
  const getLocale = async (ctx = {}) => {
11
10
  const defaultLocale = _intlayer_config_built.default?.internationalization?.defaultLocale ?? _intlayer_config_client.DefaultValues.Internationalization.DEFAULT_LOCALE;
12
11
  const availableLocales = _intlayer_config_built.default?.internationalization?.locales ?? _intlayer_config_client.DefaultValues.Internationalization.LOCALES;
13
- const storedLocale = require_localeStorage.getLocaleFromStorage({
12
+ const storedLocale = (0, _intlayer_core.getLocaleFromStorage)({
14
13
  getCookie: ctx.getCookie,
15
14
  getHeader: ctx.getHeader
16
15
  });
17
16
  if (storedLocale) return storedLocale;
18
17
  const acceptLanguageHeader = ctx.getHeader?.("accept-language");
19
18
  if (!acceptLanguageHeader) return defaultLocale;
20
- const userFallbackLocale = require_localeResolver.localeResolver(require_localization_localeDetector.getPreferredLanguages(acceptLanguageHeader, availableLocales), availableLocales, defaultLocale);
19
+ const userFallbackLocale = (0, _intlayer_core.localeResolver)(require_localization_localeDetector.getPreferredLanguages(acceptLanguageHeader, availableLocales), availableLocales, defaultLocale);
21
20
  if (userFallbackLocale) return userFallbackLocale;
22
21
  return defaultLocale;
23
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getLocale.cjs","names":["configuration","DefaultValues","getLocaleFromStorage","localeResolver","getPreferredLanguages"],"sources":["../../../src/localization/getLocale.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { DefaultValues } from '@intlayer/config/client';\nimport { getLocaleFromStorage, localeResolver } from '@intlayer/core';\nimport type { Locale } from '@intlayer/types';\nimport { getPreferredLanguages } from './localeDetector';\n\nexport type RequestContext = {\n getHeader?: (name: string) => string | null | undefined;\n getCookie?: (name: string) => string | null | undefined;\n};\n\nexport const getLocale = async (ctx: RequestContext = {}): Promise<Locale> => {\n const defaultLocale =\n configuration?.internationalization?.defaultLocale ??\n DefaultValues.Internationalization.DEFAULT_LOCALE;\n const availableLocales =\n configuration?.internationalization?.locales ??\n DefaultValues.Internationalization.LOCALES;\n\n // Try locale from storage (cookie or header)\n const storedLocale = getLocaleFromStorage({\n getCookie: ctx.getCookie,\n getHeader: ctx.getHeader,\n });\n\n if (storedLocale) {\n return storedLocale;\n }\n\n // Fallback to Accept-Language negotiation\n const acceptLanguageHeader = ctx.getHeader?.('accept-language');\n\n if (!acceptLanguageHeader) {\n return defaultLocale;\n }\n\n const preferredLocaleStrings = getPreferredLanguages(\n acceptLanguageHeader,\n availableLocales\n );\n\n const userFallbackLocale = localeResolver(\n preferredLocaleStrings,\n availableLocales,\n defaultLocale\n );\n\n if (userFallbackLocale) {\n return userFallbackLocale;\n }\n\n // Default locale\n return defaultLocale;\n};\n"],"mappings":";;;;;;;;;AAWA,MAAa,YAAY,OAAO,MAAsB,EAAE,KAAsB;CAC5E,MAAM,gBACJA,gCAAe,sBAAsB,iBACrCC,sCAAc,qBAAqB;CACrC,MAAM,mBACJD,gCAAe,sBAAsB,WACrCC,sCAAc,qBAAqB;CAGrC,MAAM,eAAeC,2CAAqB;EACxC,WAAW,IAAI;EACf,WAAW,IAAI;EAChB,CAAC;AAEF,KAAI,aACF,QAAO;CAIT,MAAM,uBAAuB,IAAI,YAAY,kBAAkB;AAE/D,KAAI,CAAC,qBACH,QAAO;CAQT,MAAM,qBAAqBC,sCALIC,0DAC7B,sBACA,iBACD,EAIC,kBACA,cACD;AAED,KAAI,mBACF,QAAO;AAIT,QAAO"}
1
+ {"version":3,"file":"getLocale.cjs","names":["configuration","DefaultValues","getPreferredLanguages"],"sources":["../../../src/localization/getLocale.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { DefaultValues } from '@intlayer/config/client';\nimport { getLocaleFromStorage, localeResolver } from '@intlayer/core';\nimport type { Locale } from '@intlayer/types';\nimport { getPreferredLanguages } from './localeDetector';\n\nexport type RequestContext = {\n getHeader?: (name: string) => string | null | undefined;\n getCookie?: (name: string) => string | null | undefined;\n};\n\nexport const getLocale = async (ctx: RequestContext = {}): Promise<Locale> => {\n const defaultLocale =\n configuration?.internationalization?.defaultLocale ??\n DefaultValues.Internationalization.DEFAULT_LOCALE;\n const availableLocales =\n configuration?.internationalization?.locales ??\n DefaultValues.Internationalization.LOCALES;\n\n // Try locale from storage (cookie or header)\n const storedLocale = getLocaleFromStorage({\n getCookie: ctx.getCookie,\n getHeader: ctx.getHeader,\n });\n\n if (storedLocale) {\n return storedLocale;\n }\n\n // Fallback to Accept-Language negotiation\n const acceptLanguageHeader = ctx.getHeader?.('accept-language');\n\n if (!acceptLanguageHeader) {\n return defaultLocale;\n }\n\n const preferredLocaleStrings = getPreferredLanguages(\n acceptLanguageHeader,\n availableLocales\n );\n\n const userFallbackLocale = localeResolver(\n preferredLocaleStrings,\n availableLocales,\n defaultLocale\n );\n\n if (userFallbackLocale) {\n return userFallbackLocale;\n }\n\n // Default locale\n return defaultLocale;\n};\n"],"mappings":";;;;;;;;AAWA,MAAa,YAAY,OAAO,MAAsB,EAAE,KAAsB;CAC5E,MAAM,gBACJA,gCAAe,sBAAsB,iBACrCC,sCAAc,qBAAqB;CACrC,MAAM,mBACJD,gCAAe,sBAAsB,WACrCC,sCAAc,qBAAqB;CAGrC,MAAM,wDAAoC;EACxC,WAAW,IAAI;EACf,WAAW,IAAI;EAChB,CAAC;AAEF,KAAI,aACF,QAAO;CAIT,MAAM,uBAAuB,IAAI,YAAY,kBAAkB;AAE/D,KAAI,CAAC,qBACH,QAAO;CAQT,MAAM,wDALyBC,0DAC7B,sBACA,iBACD,EAIC,kBACA,cACD;AAED,KAAI,mBACF,QAAO;AAIT,QAAO"}
@@ -4,18 +4,30 @@ import configuration from "@intlayer/config/built";
4
4
  import { getDictionaries } from "@intlayer/dictionaries-entry";
5
5
 
6
6
  //#region src/interpreter/getIntlayer.ts
7
+ /**
8
+ * Creates a Recursive Proxy that returns the path of the accessed key
9
+ * stringified. This prevents the app from crashing on undefined access.
10
+ */
11
+ const createSafeFallback = (path = "") => {
12
+ return new Proxy(() => path, {
13
+ get: (_target, prop) => {
14
+ if (prop === "toJSON" || prop === Symbol.toPrimitive || prop === "toString") return () => path;
15
+ if (prop === "then") return;
16
+ return createSafeFallback(path ? `${path}.${String(prop)}` : String(prop));
17
+ },
18
+ apply: () => {
19
+ return path;
20
+ }
21
+ });
22
+ };
7
23
  const getIntlayer = (key, locale, plugins) => {
8
- const dictionaries = getDictionaries();
9
- const dictionary = dictionaries[key];
24
+ const dictionary = getDictionaries()[key];
10
25
  if (!dictionary) {
11
- if (configuration.build.optimize === true || configuration.build.optimize === void 0 && false) {
12
- getAppLogger(configuration)("Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the traversePattern to include the current component.", {
13
- level: "error",
14
- isVerbose: true
15
- });
16
- throw new Error(`Dictionary ${key} not found - Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the 'traversePattern' to include the current component.`, dictionaries);
17
- }
18
- throw new Error(`Dictionary ${key} not found`, dictionaries);
26
+ getAppLogger(configuration)(`Dictionary "${key}" was not found. Using fallback proxy.`, {
27
+ level: "warn",
28
+ isVerbose: true
29
+ });
30
+ return createSafeFallback(key);
19
31
  }
20
32
  return getDictionary(dictionary, locale, plugins);
21
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.mjs","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<\n DictionaryRegistryContent<T>,\n IInterpreterPluginState,\n L\n> => {\n const dictionaries = getDictionaries();\n const dictionary = dictionaries[key as T] as DictionaryRegistryElement<T>;\n\n if (!dictionary) {\n if (\n configuration.build.optimize === true ||\n (configuration.build.optimize === undefined &&\n process.env.NODE_ENV === 'production')\n ) {\n const logger = getAppLogger(configuration);\n\n logger(\n 'Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the traversePattern to include the current component.',\n {\n level: 'error',\n isVerbose: true,\n }\n );\n throw new Error(\n `Dictionary ${key as string} not found - Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the 'traversePattern' to include the current component.`,\n dictionaries\n );\n }\n throw new Error(`Dictionary ${key as string} not found`, dictionaries);\n }\n\n return getDictionary<DictionaryRegistryElement<T>, L>(\n dictionary,\n locale,\n plugins\n );\n};\n"],"mappings":";;;;;;AAiBA,MAAa,eAIX,KACA,QACA,YAKG;CACH,MAAM,eAAe,iBAAiB;CACtC,MAAM,aAAa,aAAa;AAEhC,KAAI,CAAC,YAAY;AACf,MACE,cAAc,MAAM,aAAa,QAChC,cAAc,MAAM,aAAa,UAChC,OACF;AAGA,GAFe,aAAa,cAAc,CAGxC,8KACA;IACE,OAAO;IACP,WAAW;IACZ,CACF;AACD,SAAM,IAAI,MACR,cAAc,IAAc,4LAC5B,aACD;;AAEH,QAAM,IAAI,MAAM,cAAc,IAAc,aAAa,aAAa;;AAGxE,QAAO,cACL,YACA,QACA,QACD"}
1
+ {"version":3,"file":"getIntlayer.mjs","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["// packages/@intlayer/core/src/interpreter/getIntlayer.ts\n\nimport configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\n/**\n * Creates a Recursive Proxy that returns the path of the accessed key\n * stringified. This prevents the app from crashing on undefined access.\n */\nconst createSafeFallback = (path = ''): any => {\n return new Proxy(\n // Target is a function so it can be called if the dictionary expects a function\n () => path,\n {\n get: (_target, prop) => {\n // Handle common object methods to prevent infinite recursion or weird behavior\n if (\n prop === 'toJSON' ||\n prop === Symbol.toPrimitive ||\n prop === 'toString'\n ) {\n return () => path;\n }\n if (prop === 'then') {\n return undefined; // Prevent it from being treated as a Promise\n }\n\n // Recursively build the path (e.g., \"myDictionary.home.title\")\n const nextPath = path ? `${path}.${String(prop)}` : String(prop);\n return createSafeFallback(nextPath);\n },\n // If the code tries to execute the missing key as a function: t.title()\n apply: () => {\n return path;\n },\n }\n );\n};\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<\n DictionaryRegistryContent<T>,\n IInterpreterPluginState,\n L\n> => {\n const dictionaries = getDictionaries();\n const dictionary = dictionaries[key as T] as DictionaryRegistryElement<T>;\n\n if (!dictionary) {\n // Log a warning instead of throwing (so developers know it's missing)\n const logger = getAppLogger(configuration);\n logger(\n `Dictionary \"${key as string}\" was not found. Using fallback proxy.`,\n {\n level: 'warn',\n isVerbose: true,\n }\n );\n\n if (process.env.NODE_ENV === 'development') {\n // Return the Safe Proxy\n // We initialize it with the dictionary key name so the UI shows \"my-dictionary.someKey\"\n return createSafeFallback(key as string);\n }\n }\n\n return getDictionary<DictionaryRegistryElement<T>, L>(\n dictionary,\n locale,\n plugins\n );\n};\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,sBAAsB,OAAO,OAAY;AAC7C,QAAO,IAAI,YAEH,MACN;EACE,MAAM,SAAS,SAAS;AAEtB,OACE,SAAS,YACT,SAAS,OAAO,eAChB,SAAS,WAET,cAAa;AAEf,OAAI,SAAS,OACX;AAKF,UAAO,mBADU,OAAO,GAAG,KAAK,GAAG,OAAO,KAAK,KAAK,OAAO,KAAK,CAC7B;;EAGrC,aAAa;AACX,UAAO;;EAEV,CACF;;AAGH,MAAa,eAIX,KACA,QACA,YAKG;CAEH,MAAM,aADe,iBAAiB,CACN;AAEhC,KAAI,CAAC,YAAY;AAGf,EADe,aAAa,cAAc,CAExC,eAAe,IAAc,yCAC7B;GACE,OAAO;GACP,WAAW;GACZ,CACF;AAKC,SAAO,mBAAmB,IAAc;;AAI5C,QAAO,cACL,YACA,QACA,QACD"}
@@ -1,8 +1,7 @@
1
- import { localeResolver } from "../dist/esm/localization/localeResolver.mjs";
2
- import { getLocaleFromStorage } from "../dist/esm/utils/localeStorage.mjs";
3
1
  import { getPreferredLanguages } from "./localeDetector.mjs";
4
2
  import { DefaultValues } from "@intlayer/config/client";
5
3
  import configuration from "@intlayer/config/built";
4
+ import { getLocaleFromStorage, localeResolver } from "@intlayer/core";
6
5
 
7
6
  //#region src/localization/getLocale.ts
8
7
  const getLocale = async (ctx = {}) => {
@@ -1 +1 @@
1
- {"version":3,"file":"getLocale.mjs","names":[],"sources":["../../../src/localization/getLocale.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { DefaultValues } from '@intlayer/config/client';\nimport { getLocaleFromStorage, localeResolver } from '@intlayer/core';\nimport type { Locale } from '@intlayer/types';\nimport { getPreferredLanguages } from './localeDetector';\n\nexport type RequestContext = {\n getHeader?: (name: string) => string | null | undefined;\n getCookie?: (name: string) => string | null | undefined;\n};\n\nexport const getLocale = async (ctx: RequestContext = {}): Promise<Locale> => {\n const defaultLocale =\n configuration?.internationalization?.defaultLocale ??\n DefaultValues.Internationalization.DEFAULT_LOCALE;\n const availableLocales =\n configuration?.internationalization?.locales ??\n DefaultValues.Internationalization.LOCALES;\n\n // Try locale from storage (cookie or header)\n const storedLocale = getLocaleFromStorage({\n getCookie: ctx.getCookie,\n getHeader: ctx.getHeader,\n });\n\n if (storedLocale) {\n return storedLocale;\n }\n\n // Fallback to Accept-Language negotiation\n const acceptLanguageHeader = ctx.getHeader?.('accept-language');\n\n if (!acceptLanguageHeader) {\n return defaultLocale;\n }\n\n const preferredLocaleStrings = getPreferredLanguages(\n acceptLanguageHeader,\n availableLocales\n );\n\n const userFallbackLocale = localeResolver(\n preferredLocaleStrings,\n availableLocales,\n defaultLocale\n );\n\n if (userFallbackLocale) {\n return userFallbackLocale;\n }\n\n // Default locale\n return defaultLocale;\n};\n"],"mappings":";;;;;;;AAWA,MAAa,YAAY,OAAO,MAAsB,EAAE,KAAsB;CAC5E,MAAM,gBACJ,eAAe,sBAAsB,iBACrC,cAAc,qBAAqB;CACrC,MAAM,mBACJ,eAAe,sBAAsB,WACrC,cAAc,qBAAqB;CAGrC,MAAM,eAAe,qBAAqB;EACxC,WAAW,IAAI;EACf,WAAW,IAAI;EAChB,CAAC;AAEF,KAAI,aACF,QAAO;CAIT,MAAM,uBAAuB,IAAI,YAAY,kBAAkB;AAE/D,KAAI,CAAC,qBACH,QAAO;CAQT,MAAM,qBAAqB,eALI,sBAC7B,sBACA,iBACD,EAIC,kBACA,cACD;AAED,KAAI,mBACF,QAAO;AAIT,QAAO"}
1
+ {"version":3,"file":"getLocale.mjs","names":[],"sources":["../../../src/localization/getLocale.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { DefaultValues } from '@intlayer/config/client';\nimport { getLocaleFromStorage, localeResolver } from '@intlayer/core';\nimport type { Locale } from '@intlayer/types';\nimport { getPreferredLanguages } from './localeDetector';\n\nexport type RequestContext = {\n getHeader?: (name: string) => string | null | undefined;\n getCookie?: (name: string) => string | null | undefined;\n};\n\nexport const getLocale = async (ctx: RequestContext = {}): Promise<Locale> => {\n const defaultLocale =\n configuration?.internationalization?.defaultLocale ??\n DefaultValues.Internationalization.DEFAULT_LOCALE;\n const availableLocales =\n configuration?.internationalization?.locales ??\n DefaultValues.Internationalization.LOCALES;\n\n // Try locale from storage (cookie or header)\n const storedLocale = getLocaleFromStorage({\n getCookie: ctx.getCookie,\n getHeader: ctx.getHeader,\n });\n\n if (storedLocale) {\n return storedLocale;\n }\n\n // Fallback to Accept-Language negotiation\n const acceptLanguageHeader = ctx.getHeader?.('accept-language');\n\n if (!acceptLanguageHeader) {\n return defaultLocale;\n }\n\n const preferredLocaleStrings = getPreferredLanguages(\n acceptLanguageHeader,\n availableLocales\n );\n\n const userFallbackLocale = localeResolver(\n preferredLocaleStrings,\n availableLocales,\n defaultLocale\n );\n\n if (userFallbackLocale) {\n return userFallbackLocale;\n }\n\n // Default locale\n return defaultLocale;\n};\n"],"mappings":";;;;;;AAWA,MAAa,YAAY,OAAO,MAAsB,EAAE,KAAsB;CAC5E,MAAM,gBACJ,eAAe,sBAAsB,iBACrC,cAAc,qBAAqB;CACrC,MAAM,mBACJ,eAAe,sBAAsB,WACrC,cAAc,qBAAqB;CAGrC,MAAM,eAAe,qBAAqB;EACxC,WAAW,IAAI;EACf,WAAW,IAAI;EAChB,CAAC;AAEF,KAAI,aACF,QAAO;CAIT,MAAM,uBAAuB,IAAI,YAAY,kBAAkB;AAE/D,KAAI,CAAC,qBACH,QAAO;CAQT,MAAM,qBAAqB,eALI,sBAC7B,sBACA,iBACD,EAIC,kBACA,cACD;AAED,KAAI,mBACF,QAAO;AAIT,QAAO"}
@@ -1,6 +1,6 @@
1
1
  import { NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
2
2
  import "../interpreter/index.js";
3
- import * as _intlayer_types14 from "@intlayer/types";
3
+ import * as _intlayer_types0 from "@intlayer/types";
4
4
  import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
5
5
 
6
6
  //#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
@@ -24,12 +24,12 @@ declare const getFilterMissingTranslationsContent: <T extends ContentNode, L ext
24
24
  declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
25
25
  content: any;
26
26
  $schema?: string;
27
- id?: _intlayer_types14.DictionaryId;
27
+ id?: _intlayer_types0.DictionaryId;
28
28
  projectIds?: string[];
29
- localId?: _intlayer_types14.LocalDictionaryId;
30
- localIds?: _intlayer_types14.LocalDictionaryId[];
31
- format?: _intlayer_types14.DictionaryFormat;
32
- key: _intlayer_types14.DictionaryKey;
29
+ localId?: _intlayer_types0.LocalDictionaryId;
30
+ localIds?: _intlayer_types0.LocalDictionaryId[];
31
+ format?: _intlayer_types0.DictionaryFormat;
32
+ key: _intlayer_types0.DictionaryKey;
33
33
  title?: string;
34
34
  description?: string;
35
35
  versions?: string[];
@@ -37,11 +37,11 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
37
37
  filePath?: string;
38
38
  tags?: string[];
39
39
  locale?: LocalesValues;
40
- fill?: _intlayer_types14.Fill;
40
+ fill?: _intlayer_types0.Fill;
41
41
  filled?: true;
42
42
  priority?: number;
43
43
  live?: boolean;
44
- location?: _intlayer_types14.DictionaryLocation;
44
+ location?: _intlayer_types0.DictionaryLocation;
45
45
  };
46
46
  //#endregion
47
47
  export { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary };
@@ -1 +1 @@
1
- {"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAmMa,qDACI,kBACd;;AAFH;AA8LA;;;;;;;;AA0BA;;;;cA1Ba,gDACD,uBACA,gBAAgB,uBAEpB,kBACS,cACJ;cAoBA,qDACC,2BACG;;;OAAa,iBAAA,CAAA"}
1
+ {"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAmMa,qDACI,kBACd;;AAFH;AA8LA;;;;;;;;AA0BA;;;;cA1Ba,gDACD,uBACA,gBAAgB,uBAEpB,kBACS,cACJ;cAoBA,qDACC,2BACG;;;OAAa,gBAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { DeepTransformContent, NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
2
2
  import "../interpreter/index.js";
3
- import * as _intlayer_types0 from "@intlayer/types";
3
+ import * as _intlayer_types14 from "@intlayer/types";
4
4
  import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
5
5
 
6
6
  //#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts
@@ -16,12 +16,12 @@ declare const getFilterTranslationsOnlyContent: <T extends ContentNode, L extend
16
16
  declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, locale?: LocalesValues, fallback?: LocalesValues) => {
17
17
  content: any;
18
18
  $schema?: string;
19
- id?: _intlayer_types0.DictionaryId;
19
+ id?: _intlayer_types14.DictionaryId;
20
20
  projectIds?: string[];
21
- localId?: _intlayer_types0.LocalDictionaryId;
22
- localIds?: _intlayer_types0.LocalDictionaryId[];
23
- format?: _intlayer_types0.DictionaryFormat;
24
- key: _intlayer_types0.DictionaryKey;
21
+ localId?: _intlayer_types14.LocalDictionaryId;
22
+ localIds?: _intlayer_types14.LocalDictionaryId[];
23
+ format?: _intlayer_types14.DictionaryFormat;
24
+ key: _intlayer_types14.DictionaryKey;
25
25
  title?: string;
26
26
  description?: string;
27
27
  versions?: string[];
@@ -29,11 +29,11 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
29
29
  filePath?: string;
30
30
  tags?: string[];
31
31
  locale?: LocalesValues;
32
- fill?: _intlayer_types0.Fill;
32
+ fill?: _intlayer_types14.Fill;
33
33
  filled?: true;
34
34
  priority?: number;
35
35
  live?: boolean;
36
- location?: _intlayer_types0.DictionaryLocation;
36
+ location?: _intlayer_types14.DictionaryLocation;
37
37
  };
38
38
  //#endregion
39
39
  export { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary };
@@ -1 +1 @@
1
- {"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAoCa,uCACH,0BACG,kBACV;;AAHH;;;;;AAuFa,cAAA,gCAkBZ,EAAA,CAAA,UAjBW,WAiBX,EAAA,UAhBW,aAgBX,GAhB2B,eAgB3B,CAAA,CAAA,IAAA,EAdO,CAcP,EAAA,MAAA,EAbS,CAaT,EAAA,SAAA,EAZY,SAYZ,EAAA,QAAA,CAAA,EAXY,aAWZ,EAAA,GADO,oBACP,CAD4B,CAC5B,CAAA;AAjBW,cAmBC,mCAnBD,EAAA,CAAA,UAAA,EAoBE,UApBF,EAAA,MAAA,CAAA,EAqBF,aArBE,EAAA,QAAA,CAAA,EAuBC,aAvBD,EAAA,GAAA;EACA,OAAA,EAAA,GAAA;EAAgB,OAAA,CAAA,EAAA,MAAA;EAEpB,EAAA,CAAA,EAoBkB,gBAAA,CAAA,YApBlB;EACE,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,oCAAA;EACA,QAAA,CAAA,sCAAA;EAUgB,MAAA,CAAA,mCAAA;EAArB,GAAA,gCAAA;EAAoB,KAAA,CAAA,EAAA,MAAA;EAGf,WAAA,CAAA,EAAA,MAAA;EACC,QAAA,CAAA,EAAA,MAAA,EAAA;EACJ,OAAA,CAAA,EAAA,MAAA;EAEG,QAAA,CAAA,EAAA,MAAA;EAAa,IAAA,CAAA,EAAA,MAAA,EAAA"}
1
+ {"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAoCa,uCACH,0BACG,kBACV;;AAHH;;;;;AAuFa,cAAA,gCAkBZ,EAAA,CAAA,UAjBW,WAiBX,EAAA,UAhBW,aAgBX,GAhB2B,eAgB3B,CAAA,CAAA,IAAA,EAdO,CAcP,EAAA,MAAA,EAbS,CAaT,EAAA,SAAA,EAZY,SAYZ,EAAA,QAAA,CAAA,EAXY,aAWZ,EAAA,GADO,oBACP,CAD4B,CAC5B,CAAA;AAjBW,cAmBC,mCAnBD,EAAA,CAAA,UAAA,EAoBE,UApBF,EAAA,MAAA,CAAA,EAqBF,aArBE,EAAA,QAAA,CAAA,EAuBC,aAvBD,EAAA,GAAA;EACA,OAAA,EAAA,GAAA;EAAgB,OAAA,CAAA,EAAA,MAAA;EAEpB,EAAA,CAAA,EAoBkB,iBAAA,CAAA,YApBlB;EACE,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,qCAAA;EACA,QAAA,CAAA,uCAAA;EAUgB,MAAA,CAAA,oCAAA;EAArB,GAAA,iCAAA;EAAoB,KAAA,CAAA,EAAA,MAAA;EAGf,WAAA,CAAA,EAAA,MAAA;EACC,QAAA,CAAA,EAAA,MAAA,EAAA;EACJ,OAAA,CAAA,EAAA,MAAA;EAEG,QAAA,CAAA,EAAA,MAAA;EAAa,IAAA,CAAA,EAAA,MAAA,EAAA"}
@@ -1,6 +1,6 @@
1
1
  import { NodeProps } from "../interpreter/getContent/plugins.js";
2
2
  import "../interpreter/index.js";
3
- import * as _intlayer_types6 from "@intlayer/types";
3
+ import * as _intlayer_types7 from "@intlayer/types";
4
4
  import { ContentNode, Dictionary, LocalesValues } from "@intlayer/types";
5
5
 
6
6
  //#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
@@ -8,12 +8,12 @@ declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesVal
8
8
  declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
9
9
  content: any;
10
10
  $schema?: string;
11
- id?: _intlayer_types6.DictionaryId;
11
+ id?: _intlayer_types7.DictionaryId;
12
12
  projectIds?: string[];
13
- localId?: _intlayer_types6.LocalDictionaryId;
14
- localIds?: _intlayer_types6.LocalDictionaryId[];
15
- format?: _intlayer_types6.DictionaryFormat;
16
- key: _intlayer_types6.DictionaryKey;
13
+ localId?: _intlayer_types7.LocalDictionaryId;
14
+ localIds?: _intlayer_types7.LocalDictionaryId[];
15
+ format?: _intlayer_types7.DictionaryFormat;
16
+ key: _intlayer_types7.DictionaryKey;
17
17
  title?: string;
18
18
  description?: string;
19
19
  versions?: string[];
@@ -21,11 +21,11 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
21
21
  filePath?: string;
22
22
  tags?: string[];
23
23
  locale?: LocalesValues;
24
- fill?: _intlayer_types6.Fill;
24
+ fill?: _intlayer_types7.Fill;
25
25
  filled?: true;
26
26
  priority?: number;
27
27
  live?: boolean;
28
- location?: _intlayer_types6.DictionaryLocation;
28
+ location?: _intlayer_types7.DictionaryLocation;
29
29
  };
30
30
  //#endregion
31
31
  export { getFilteredLocalesContent, getFilteredLocalesDictionary };
@@ -1,4 +1,4 @@
1
- import * as _intlayer_types13 from "@intlayer/types";
1
+ import * as _intlayer_types0 from "@intlayer/types";
2
2
  import { Dictionary } from "@intlayer/types";
3
3
 
4
4
  //#region src/dictionaryManipulator/orderDictionaries.d.ts
@@ -10,7 +10,7 @@ import { Dictionary } from "@intlayer/types";
10
10
  * @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
11
11
  * @returns Ordered array of dictionaries
12
12
  */
13
- declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types13.IntlayerConfig) => Dictionary[];
13
+ declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types0.IntlayerConfig) => Dictionary[];
14
14
  //#endregion
15
15
  export { orderDictionaries };
16
16
  //# sourceMappingURL=orderDictionaries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"orderDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/orderDictionaries.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAUA;;;;AAGa,cAHA,iBAGA,EAAA,CAAA,YAAA,EAFG,UAEH,EAAA,EAAA,aAAA,CAAA,EAFa,iBAAA,CACxB,cACW,EAAA,GAAV,UAAU,EAAA"}
1
+ {"version":3,"file":"orderDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/orderDictionaries.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAUA;;;;AAGa,cAHA,iBAGA,EAAA,CAAA,YAAA,EAFG,UAEH,EAAA,EAAA,aAAA,CAAA,EAFa,gBAAA,CACxB,cACW,EAAA,GAAV,UAAU,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;AAcA;;;;;;AAIc,KAlBF,OAAA,GAkBE;EACR,EAAA,EAAA,MAAA;EAAgB,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,OAAA;EACO,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAflB,SAekB,EAAA,WAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAdO,SAcP,EAAA,GAAA,GAAA,EAAA,GAAA,GAAA;CAAE;;;;AAC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,GAgD2B,CAhD3B,GAAA,IAAA,GAAA,KAAA;;AAOV;AAOE;AAOmC,KAgCzB,oBAhCyB,CAAA,CAAA,EAAA,IAkC/B,uBAlC+B,EAAA,UAmCzB,aAnCyB,GAmCT,eAnCS,CAAA,GAoCjC,KApCiC,CAoC3B,CApC2B,CAAA,SAAA,IAAA,GAqCjC,CArCiC,GAsCjC,gBAtCiC,CAsChB,CAtCgB,EAAA,MAsCP,kBAtCO,CAsCY,CAtCZ,EAsCe,CAtCf,EAsCkB,CAtClB,CAAA,EAsCsB,CAtCtB,CAAA,SAAA,KAAA,GAwC/B,QAxC+B,CAwCtB,CAxCsB,EAwCnB,CAxCmB,EAwChB,CAxCgB,CAAA,GA0C/B,kBA1C+B,CA0CZ,CA1CY,EA0CT,CA1CS,EA0CN,CA1CM,CAAA,CAAA,MA0CG,kBA1CH,CA0CsB,CA1CtB,EA0CyB,CA1CzB,EA0C4B,CA1C5B,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":[],"mappings":";;;;;cAiBa,wBACD,0BACA,gBAAgB,sBAErB,YACI,aACC,cACT,qBACD,0BAA0B,IAC1B,yBACA"}
1
+ {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":[],"mappings":";;;;;cAqDa,wBACD,0BACA,gBAAgB,sBAErB,YACI,aACC,cACT,qBACD,0BAA0B,IAC1B,yBACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":[],"mappings":";;;KAEK,QAAA;KACA,QAAA;AAH2E,KAI3E,OAAA,GAAU,QAFF,GAEa,QAFb;AAAA,KAIR,KAAA,GAAQ,OAHA;AAAA,KAIR,WAAA,GAHO,IAGW,OAHR,EAAA;AAAmB,KAI7B,QAAA,GAFK,IAEU,OAFP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vB,eATuB;AACtB,KAUO,uBAVgB,CAAA,OAAO,CAAA,GAUY,OAVZ,CAWjC,MAXiC,CAW1B,WAX0B,EAWb,OAXa,CAAA,CAAA,GAAA;EAEvB,QAAA,CAAA,EAWC,OAXU;CACnB;AACA,KAYQ,kBAZR,CAAA,UAAA,OAAA,CAAA,GAYgD,cAZhD,CAaF,QAAA,CAAS,WAbP,EAcF,uBAdE,CAcsB,OAdtB,CAAA,CAAA;;;;;;AAMJ;;;;;;;AAMA;;;;;;AAGE;cAqBI,WAA0D,EAAA,CAAA,OAAA,CAAA,CAAA,OAAA,CAAA,EAAxB,uBAAwB,CAAA,OAAA,CAAA,EAAA,GAAQ,cAAR,CAAQ,QAAA,CAAA,WAAR,EAAQ,uBAAR,CAAQ,OAAR,CAAA,EAAA,CAAA,CAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "7.5.9",
3
+ "version": "7.5.10",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -107,11 +107,11 @@
107
107
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
108
108
  },
109
109
  "dependencies": {
110
- "@intlayer/api": "7.5.9",
111
- "@intlayer/config": "7.5.9",
112
- "@intlayer/dictionaries-entry": "7.5.9",
113
- "@intlayer/types": "7.5.9",
114
- "@intlayer/unmerged-dictionaries-entry": "7.5.9",
110
+ "@intlayer/api": "7.5.10",
111
+ "@intlayer/config": "7.5.10",
112
+ "@intlayer/dictionaries-entry": "7.5.10",
113
+ "@intlayer/types": "7.5.10",
114
+ "@intlayer/unmerged-dictionaries-entry": "7.5.10",
115
115
  "defu": "6.1.4"
116
116
  },
117
117
  "devDependencies": {
@@ -1,134 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- let _intlayer_config_client = require("@intlayer/config/client");
3
-
4
- //#region dist/esm/getStorageAttributes.mjs
5
- /**
6
- * Creates a cookie entry with default values for missing attributes
7
- */
8
- const createCookieEntry = (options) => {
9
- const { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};
10
- return {
11
- name: name ?? _intlayer_config_client.DefaultValues.Routing.COOKIE_NAME,
12
- attributes: {
13
- path,
14
- expires,
15
- domain,
16
- secure,
17
- sameSite,
18
- httpOnly
19
- }
20
- };
21
- };
22
- /**
23
- * Creates a web storage entry (localStorage or sessionStorage) with default name
24
- */
25
- const createWebStorageEntry = (options) => {
26
- const { name } = options ?? {};
27
- return { name: name ?? _intlayer_config_client.DefaultValues.Routing.LOCALE_STORAGE_NAME };
28
- };
29
- /**
30
- * Creates a header entry with default name
31
- */
32
- const createHeaderEntry = (options) => {
33
- const { name } = options ?? {};
34
- return { name: name ?? _intlayer_config_client.DefaultValues.Routing.HEADER_NAME };
35
- };
36
- /**
37
- * Determines if a storage entry is a cookie based on its properties
38
- */
39
- const isCookieEntry = (entry) => {
40
- return entry.type === "cookie" || "sameSite" in entry || "httpOnly" in entry || "secure" in entry;
41
- };
42
- /**
43
- * Determines the storage type from a string literal
44
- */
45
- const isStorageType = (value) => {
46
- return value === "cookie" || value === "localStorage" || value === "sessionStorage" || value === "header";
47
- };
48
- /**
49
- * Processes a single storage entry and returns the appropriate storage attributes
50
- */
51
- const processStorageEntry = (entry) => {
52
- if (typeof entry === "string") {
53
- if (!isStorageType(entry)) return {
54
- cookies: [],
55
- localStorage: [],
56
- sessionStorage: [],
57
- headers: []
58
- };
59
- if (entry === "cookie") return { cookies: [createCookieEntry()] };
60
- if (entry === "localStorage") return { localStorage: [createWebStorageEntry()] };
61
- if (entry === "sessionStorage") return { sessionStorage: [createWebStorageEntry()] };
62
- if (entry === "header") return { headers: [createHeaderEntry()] };
63
- }
64
- if (typeof entry === "object" && entry !== null) {
65
- const typedEntry = entry;
66
- if (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };
67
- if ("type" in typedEntry && typedEntry.type === "localStorage") {
68
- const { name: name$1, ...rest$1 } = typedEntry;
69
- return { localStorage: [createWebStorageEntry({
70
- name: name$1,
71
- ...rest$1
72
- })] };
73
- }
74
- if ("type" in typedEntry && typedEntry.type === "sessionStorage") {
75
- const { name: name$1, ...rest$1 } = typedEntry;
76
- return { sessionStorage: [createWebStorageEntry({
77
- name: name$1,
78
- ...rest$1
79
- })] };
80
- }
81
- if ("type" in typedEntry && typedEntry.type === "header") {
82
- const { name: name$1, ...rest$1 } = typedEntry;
83
- return { headers: [createHeaderEntry({
84
- name: name$1,
85
- ...rest$1
86
- })] };
87
- }
88
- const { name, ...rest } = typedEntry;
89
- return { localStorage: [createWebStorageEntry({
90
- name,
91
- ...rest
92
- })] };
93
- }
94
- return {
95
- cookies: [],
96
- localStorage: [],
97
- sessionStorage: [],
98
- headers: []
99
- };
100
- };
101
- /**
102
- * Merges multiple partial storage attributes into a single result
103
- */
104
- const mergeStorageAttributes = (accumulated, partial) => {
105
- return {
106
- cookies: [...accumulated.cookies, ...partial.cookies ?? []],
107
- localStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],
108
- sessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],
109
- headers: [...accumulated.headers, ...partial.headers ?? []]
110
- };
111
- };
112
- /**
113
- * Extracts and normalizes storage configuration into separate arrays for each storage type
114
- *
115
- * @param options - The storage configuration from IntlayerConfig
116
- * @returns An object containing arrays for cookies, localStorage, and sessionStorage
117
- */
118
- const getStorageAttributes = (options) => {
119
- const emptyResult = {
120
- cookies: [],
121
- localStorage: [],
122
- sessionStorage: [],
123
- headers: []
124
- };
125
- if (options === false || options === void 0) return emptyResult;
126
- if (Array.isArray(options)) return options.reduce((acc, entry) => {
127
- return mergeStorageAttributes(acc, processStorageEntry(entry));
128
- }, emptyResult);
129
- return mergeStorageAttributes(emptyResult, processStorageEntry(options));
130
- };
131
-
132
- //#endregion
133
- exports.getStorageAttributes = getStorageAttributes;
134
- //# sourceMappingURL=getStorageAttributes.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getStorageAttributes.cjs","names":["DefaultValues"],"sources":["../../../esm/getStorageAttributes.mjs"],"sourcesContent":["import { DefaultValues } from \"@intlayer/config/client\";\n\n//#region src/getStorageAttributes.ts\n/**\n* Creates a cookie entry with default values for missing attributes\n*/\nconst createCookieEntry = (options) => {\n\tconst { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};\n\treturn {\n\t\tname: name ?? DefaultValues.Routing.COOKIE_NAME,\n\t\tattributes: {\n\t\t\tpath,\n\t\t\texpires,\n\t\t\tdomain,\n\t\t\tsecure,\n\t\t\tsameSite,\n\t\t\thttpOnly\n\t\t}\n\t};\n};\n/**\n* Creates a web storage entry (localStorage or sessionStorage) with default name\n*/\nconst createWebStorageEntry = (options) => {\n\tconst { name } = options ?? {};\n\treturn { name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME };\n};\n/**\n* Creates a header entry with default name\n*/\nconst createHeaderEntry = (options) => {\n\tconst { name } = options ?? {};\n\treturn { name: name ?? DefaultValues.Routing.HEADER_NAME };\n};\n/**\n* Determines if a storage entry is a cookie based on its properties\n*/\nconst isCookieEntry = (entry) => {\n\treturn entry.type === \"cookie\" || \"sameSite\" in entry || \"httpOnly\" in entry || \"secure\" in entry;\n};\n/**\n* Determines the storage type from a string literal\n*/\nconst isStorageType = (value) => {\n\treturn value === \"cookie\" || value === \"localStorage\" || value === \"sessionStorage\" || value === \"header\";\n};\n/**\n* Processes a single storage entry and returns the appropriate storage attributes\n*/\nconst processStorageEntry = (entry) => {\n\tif (typeof entry === \"string\") {\n\t\tif (!isStorageType(entry)) return {\n\t\t\tcookies: [],\n\t\t\tlocalStorage: [],\n\t\t\tsessionStorage: [],\n\t\t\theaders: []\n\t\t};\n\t\tif (entry === \"cookie\") return { cookies: [createCookieEntry()] };\n\t\tif (entry === \"localStorage\") return { localStorage: [createWebStorageEntry()] };\n\t\tif (entry === \"sessionStorage\") return { sessionStorage: [createWebStorageEntry()] };\n\t\tif (entry === \"header\") return { headers: [createHeaderEntry()] };\n\t}\n\tif (typeof entry === \"object\" && entry !== null) {\n\t\tconst typedEntry = entry;\n\t\tif (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"localStorage\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { localStorage: [createWebStorageEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"sessionStorage\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { sessionStorage: [createWebStorageEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"header\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { headers: [createHeaderEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tconst { name, ...rest } = typedEntry;\n\t\treturn { localStorage: [createWebStorageEntry({\n\t\t\tname,\n\t\t\t...rest\n\t\t})] };\n\t}\n\treturn {\n\t\tcookies: [],\n\t\tlocalStorage: [],\n\t\tsessionStorage: [],\n\t\theaders: []\n\t};\n};\n/**\n* Merges multiple partial storage attributes into a single result\n*/\nconst mergeStorageAttributes = (accumulated, partial) => {\n\treturn {\n\t\tcookies: [...accumulated.cookies, ...partial.cookies ?? []],\n\t\tlocalStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],\n\t\tsessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],\n\t\theaders: [...accumulated.headers, ...partial.headers ?? []]\n\t};\n};\n/**\n* Extracts and normalizes storage configuration into separate arrays for each storage type\n*\n* @param options - The storage configuration from IntlayerConfig\n* @returns An object containing arrays for cookies, localStorage, and sessionStorage\n*/\nconst getStorageAttributes = (options) => {\n\tconst emptyResult = {\n\t\tcookies: [],\n\t\tlocalStorage: [],\n\t\tsessionStorage: [],\n\t\theaders: []\n\t};\n\tif (options === false || options === void 0) return emptyResult;\n\tif (Array.isArray(options)) return options.reduce((acc, entry) => {\n\t\treturn mergeStorageAttributes(acc, processStorageEntry(entry));\n\t}, emptyResult);\n\treturn mergeStorageAttributes(emptyResult, processStorageEntry(options));\n};\n\n//#endregion\nexport { getStorageAttributes };\n//# sourceMappingURL=getStorageAttributes.mjs.map"],"mappings":";;;;;;;AAMA,MAAM,qBAAqB,YAAY;CACtC,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aAAa,WAAW,EAAE;AACjF,QAAO;EACN,MAAM,QAAQA,sCAAc,QAAQ;EACpC,YAAY;GACX;GACA;GACA;GACA;GACA;GACA;GACA;EACD;;;;;AAKF,MAAM,yBAAyB,YAAY;CAC1C,MAAM,EAAE,SAAS,WAAW,EAAE;AAC9B,QAAO,EAAE,MAAM,QAAQA,sCAAc,QAAQ,qBAAqB;;;;;AAKnE,MAAM,qBAAqB,YAAY;CACtC,MAAM,EAAE,SAAS,WAAW,EAAE;AAC9B,QAAO,EAAE,MAAM,QAAQA,sCAAc,QAAQ,aAAa;;;;;AAK3D,MAAM,iBAAiB,UAAU;AAChC,QAAO,MAAM,SAAS,YAAY,cAAc,SAAS,cAAc,SAAS,YAAY;;;;;AAK7F,MAAM,iBAAiB,UAAU;AAChC,QAAO,UAAU,YAAY,UAAU,kBAAkB,UAAU,oBAAoB,UAAU;;;;;AAKlG,MAAM,uBAAuB,UAAU;AACtC,KAAI,OAAO,UAAU,UAAU;AAC9B,MAAI,CAAC,cAAc,MAAM,CAAE,QAAO;GACjC,SAAS,EAAE;GACX,cAAc,EAAE;GAChB,gBAAgB,EAAE;GAClB,SAAS,EAAE;GACX;AACD,MAAI,UAAU,SAAU,QAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;AACjE,MAAI,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AAQ,gBAAgB,EAAE,CAAC;EAC1E,gBAAgB,CAAC,GAAG,YAAY,gBAAgB,GAAG,QAAQ,kBAAkB,EAAE,CAAC;EAChF,SAAS,CAAC,GAAG,YAAY,SAAS,GAAG,QAAQ,WAAW,EAAE,CAAC;EAC3D;;;;;;;;AAQF,MAAM,wBAAwB,YAAY;CACzC,MAAM,cAAc;EACnB,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACX;AACD,KAAI,YAAY,SAAS,YAAY,KAAK,EAAG,QAAO;AACpD,KAAI,MAAM,QAAQ,QAAQ,CAAE,QAAO,QAAQ,QAAQ,KAAK,UAAU;AACjE,SAAO,uBAAuB,KAAK,oBAAoB,MAAM,CAAC;IAC5D,YAAY;AACf,QAAO,uBAAuB,aAAa,oBAAoB,QAAQ,CAAC"}
@@ -1,28 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- let _intlayer_config_built = require("@intlayer/config/built");
3
- _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
4
-
5
- //#region dist/esm/localization/localeResolver.mjs
6
- /**
7
- * Resolves the most specific locale from a user-provided list,
8
- * or falls back to the default locale if no match is found.
9
- */
10
- const localeResolver = (selectedLocale, locales = _intlayer_config_built.default?.internationalization?.locales, defaultLocale = _intlayer_config_built.default?.internationalization?.defaultLocale) => {
11
- const requestedLocales = [selectedLocale].flat();
12
- const normalize = (locale) => locale.trim().toLowerCase();
13
- try {
14
- for (const requested of requestedLocales) {
15
- const normalizedRequested = normalize(requested);
16
- const exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);
17
- if (exactMatch) return exactMatch;
18
- const [requestedLang] = normalizedRequested.split("-");
19
- const partialMatch = locales.find((loc) => normalize(loc).split("-")[0] === requestedLang);
20
- if (partialMatch) return partialMatch;
21
- }
22
- } catch (_error) {}
23
- return defaultLocale;
24
- };
25
-
26
- //#endregion
27
- exports.localeResolver = localeResolver;
28
- //# sourceMappingURL=localeResolver.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localeResolver.cjs","names":["configuration"],"sources":["../../../../esm/localization/localeResolver.mjs"],"sourcesContent":["import configuration from \"@intlayer/config/built\";\n\n//#region src/localization/localeResolver.ts\n/**\n* Resolves the most specific locale from a user-provided list,\n* or falls back to the default locale if no match is found.\n*/\nconst localeResolver = (selectedLocale, locales = configuration?.internationalization?.locales, defaultLocale = configuration?.internationalization?.defaultLocale) => {\n\tconst requestedLocales = [selectedLocale].flat();\n\tconst normalize = (locale) => locale.trim().toLowerCase();\n\ttry {\n\t\tfor (const requested of requestedLocales) {\n\t\t\tconst normalizedRequested = normalize(requested);\n\t\t\tconst exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);\n\t\t\tif (exactMatch) return exactMatch;\n\t\t\tconst [requestedLang] = normalizedRequested.split(\"-\");\n\t\t\tconst partialMatch = locales.find((loc) => normalize(loc).split(\"-\")[0] === requestedLang);\n\t\t\tif (partialMatch) return partialMatch;\n\t\t}\n\t} catch (_error) {}\n\treturn defaultLocale;\n};\n\n//#endregion\nexport { localeResolver };\n//# sourceMappingURL=localeResolver.mjs.map"],"mappings":";;;;;;;;;AAOA,MAAM,kBAAkB,gBAAgB,UAAUA,gCAAe,sBAAsB,SAAS,gBAAgBA,gCAAe,sBAAsB,kBAAkB;CACtK,MAAM,mBAAmB,CAAC,eAAe,CAAC,MAAM;CAChD,MAAM,aAAa,WAAW,OAAO,MAAM,CAAC,aAAa;AACzD,KAAI;AACH,OAAK,MAAM,aAAa,kBAAkB;GACzC,MAAM,sBAAsB,UAAU,UAAU;GAChD,MAAM,aAAa,QAAQ,MAAM,QAAQ,UAAU,IAAI,KAAK,oBAAoB;AAChF,OAAI,WAAY,QAAO;GACvB,MAAM,CAAC,iBAAiB,oBAAoB,MAAM,IAAI;GACtD,MAAM,eAAe,QAAQ,MAAM,QAAQ,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,cAAc;AAC1F,OAAI,aAAc,QAAO;;UAElB,QAAQ;AACjB,QAAO"}
@@ -1,32 +0,0 @@
1
-
2
- //#region dist/esm/utils/getCookie.mjs
3
- /**
4
- * Retrieves a cookie by name from a cookie string or document.cookie
5
- * @param name - The name of the cookie to retrieve
6
- * @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)
7
- * @returns The cookie value or undefined if not found
8
- */
9
- const getCookie = (name, cookieString) => {
10
- try {
11
- const str = cookieString ?? (typeof document !== "undefined" ? document.cookie : "");
12
- if (!str) return void 0;
13
- const pairs = str.split(";");
14
- for (let i = 0; i < pairs.length; i++) {
15
- const part = pairs[i].trim();
16
- if (!part) continue;
17
- const equalIndex = part.indexOf("=");
18
- if ((equalIndex >= 0 ? part.substring(0, equalIndex) : part) === name) {
19
- const rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : "";
20
- try {
21
- return decodeURIComponent(rawValue);
22
- } catch {
23
- return rawValue;
24
- }
25
- }
26
- }
27
- } catch {}
28
- };
29
-
30
- //#endregion
31
- exports.getCookie = getCookie;
32
- //# sourceMappingURL=getCookie.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCookie.cjs","names":[],"sources":["../../../../esm/utils/getCookie.mjs"],"sourcesContent":["//#region src/utils/getCookie.ts\n/**\n* Retrieves a cookie by name from a cookie string or document.cookie\n* @param name - The name of the cookie to retrieve\n* @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)\n* @returns The cookie value or undefined if not found\n*/\nconst getCookie = (name, cookieString) => {\n\ttry {\n\t\tconst str = cookieString ?? (typeof document !== \"undefined\" ? document.cookie : \"\");\n\t\tif (!str) return void 0;\n\t\tconst pairs = str.split(\";\");\n\t\tfor (let i = 0; i < pairs.length; i++) {\n\t\t\tconst part = pairs[i].trim();\n\t\t\tif (!part) continue;\n\t\t\tconst equalIndex = part.indexOf(\"=\");\n\t\t\tif ((equalIndex >= 0 ? part.substring(0, equalIndex) : part) === name) {\n\t\t\t\tconst rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : \"\";\n\t\t\t\ttry {\n\t\t\t\t\treturn decodeURIComponent(rawValue);\n\t\t\t\t} catch {\n\t\t\t\t\treturn rawValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch {}\n};\n\n//#endregion\nexport { getCookie };\n//# sourceMappingURL=getCookie.mjs.map"],"mappings":";;;;;;;;AAOA,MAAM,aAAa,MAAM,iBAAiB;AACzC,KAAI;EACH,MAAM,MAAM,iBAAiB,OAAO,aAAa,cAAc,SAAS,SAAS;AACjF,MAAI,CAAC,IAAK,QAAO,KAAK;EACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC5B,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;GACtC,MAAM,OAAO,MAAM,GAAG,MAAM;AAC5B,OAAI,CAAC,KAAM;GACX,MAAM,aAAa,KAAK,QAAQ,IAAI;AACpC,QAAK,cAAc,IAAI,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,MAAM;IACtE,MAAM,WAAW,cAAc,IAAI,KAAK,UAAU,aAAa,EAAE,GAAG;AACpE,QAAI;AACH,YAAO,mBAAmB,SAAS;YAC5B;AACP,YAAO;;;;SAIH"}
@@ -1,61 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_getStorageAttributes = require('../getStorageAttributes.cjs');
3
- const require_getCookie = require('./getCookie.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region dist/esm/utils/localeStorage.mjs
8
- /**
9
- * Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).
10
- * The function checks storage locations in order of priority as defined in the configuration.
11
- *
12
- * @returns The locale if found in any storage, or undefined if not found
13
- */
14
- const getLocaleFromStorage = (options) => {
15
- const { routing, internationalization } = _intlayer_config_built.default;
16
- const { locales } = internationalization;
17
- const { storage } = routing;
18
- if (storage === false || options?.isCookieEnabled === false) return void 0;
19
- const storageAttributes = require_getStorageAttributes.getStorageAttributes(storage);
20
- const isValidLocale = (value) => {
21
- if (!value) return false;
22
- return locales.includes(value);
23
- };
24
- const readCookie = (name) => {
25
- try {
26
- const fromOption = options?.getCookie?.(name);
27
- if (fromOption !== null && fromOption !== void 0) return fromOption;
28
- } catch {}
29
- return require_getCookie.getCookie(name);
30
- };
31
- for (let i = 0; i < storageAttributes.cookies.length; i++) {
32
- const { name } = storageAttributes.cookies[i];
33
- const value = readCookie(name);
34
- if (isValidLocale(value)) return value;
35
- }
36
- for (let i = 0; i < storageAttributes.localStorage.length; i++) {
37
- const { name } = storageAttributes.localStorage[i];
38
- try {
39
- const value = options?.getLocaleStorage?.(name);
40
- if (isValidLocale(value)) return value;
41
- } catch {}
42
- }
43
- for (let i = 0; i < storageAttributes.sessionStorage.length; i++) {
44
- const { name } = storageAttributes.sessionStorage[i];
45
- try {
46
- const value = options?.getSessionStorage?.(name);
47
- if (isValidLocale(value)) return value;
48
- } catch {}
49
- }
50
- for (let i = 0; i < storageAttributes.headers.length; i++) {
51
- const { name } = storageAttributes.headers[i];
52
- try {
53
- const value = options?.getHeader?.(name);
54
- if (isValidLocale(value)) return value;
55
- } catch {}
56
- }
57
- };
58
-
59
- //#endregion
60
- exports.getLocaleFromStorage = getLocaleFromStorage;
61
- //# sourceMappingURL=localeStorage.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localeStorage.cjs","names":["configuration","getStorageAttributes","getCookie"],"sources":["../../../../esm/utils/localeStorage.mjs"],"sourcesContent":["import { getStorageAttributes } from \"../getStorageAttributes.mjs\";\nimport { getCookie } from \"./getCookie.mjs\";\nimport configuration from \"@intlayer/config/built\";\n\n//#region src/utils/localeStorage.ts\nconst buildCookieString = (name, value, attributes) => {\n\tconst parts = [`${name}=${encodeURIComponent(value)}`];\n\tif (attributes.path) parts.push(`Path=${attributes.path}`);\n\tif (attributes.domain) parts.push(`Domain=${attributes.domain}`);\n\tif (attributes.expires instanceof Date) parts.push(`Expires=${attributes.expires.toUTCString()}`);\n\tif (attributes.secure) parts.push(\"Secure\");\n\tif (attributes.sameSite) parts.push(`SameSite=${attributes.sameSite}`);\n\treturn parts.join(\"; \");\n};\n/**\n* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function checks storage locations in order of priority as defined in the configuration.\n*\n* @returns The locale if found in any storage, or undefined if not found\n*/\nconst getLocaleFromStorage = (options) => {\n\tconst { routing, internationalization } = configuration;\n\tconst { locales } = internationalization;\n\tconst { storage } = routing;\n\tif (storage === false || options?.isCookieEnabled === false) return void 0;\n\tconst storageAttributes = getStorageAttributes(storage);\n\tconst isValidLocale = (value) => {\n\t\tif (!value) return false;\n\t\treturn locales.includes(value);\n\t};\n\tconst readCookie = (name) => {\n\t\ttry {\n\t\t\tconst fromOption = options?.getCookie?.(name);\n\t\t\tif (fromOption !== null && fromOption !== void 0) return fromOption;\n\t\t} catch {}\n\t\treturn getCookie(name);\n\t};\n\tfor (let i = 0; i < storageAttributes.cookies.length; i++) {\n\t\tconst { name } = storageAttributes.cookies[i];\n\t\tconst value = readCookie(name);\n\t\tif (isValidLocale(value)) return value;\n\t}\n\tfor (let i = 0; i < storageAttributes.localStorage.length; i++) {\n\t\tconst { name } = storageAttributes.localStorage[i];\n\t\ttry {\n\t\t\tconst value = options?.getLocaleStorage?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n\tfor (let i = 0; i < storageAttributes.sessionStorage.length; i++) {\n\t\tconst { name } = storageAttributes.sessionStorage[i];\n\t\ttry {\n\t\t\tconst value = options?.getSessionStorage?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n\tfor (let i = 0; i < storageAttributes.headers.length; i++) {\n\t\tconst { name } = storageAttributes.headers[i];\n\t\ttry {\n\t\t\tconst value = options?.getHeader?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n};\n/**\n* Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function writes to all configured storage locations according to their attributes.\n* Respects overwrite flags for localStorage and sessionStorage.\n*\n* @param locale - The locale to store\n*/\nconst setLocaleInStorage = (locale, options) => {\n\tif (configuration.routing.storage === false || options?.isCookieEnabled === false) return;\n\tconst storageAttributes = getStorageAttributes(configuration.routing.storage);\n\tfor (let i = 0; i < storageAttributes.cookies.length; i++) {\n\t\tconst { name, attributes } = storageAttributes.cookies[i];\n\t\ttry {\n\t\t\tif (options?.setCookieStore) options?.setCookieStore?.(name, locale, {\n\t\t\t\t...attributes,\n\t\t\t\texpires: attributes.expires instanceof Date ? attributes.expires.getTime() : attributes.expires\n\t\t\t});\n\t\t} catch {\n\t\t\ttry {\n\t\t\t\tif (options?.setCookieString) {\n\t\t\t\t\tconst cookieString = buildCookieString(name, locale, attributes);\n\t\t\t\t\toptions?.setCookieString?.(name, cookieString);\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\t}\n\tif (options?.setLocaleStorage) for (let i = 0; i < storageAttributes.localStorage.length; i++) {\n\t\tconst { name } = storageAttributes.localStorage[i];\n\t\ttry {\n\t\t\tif (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n\t\t\t\tif (options?.getLocaleStorage?.(name)) continue;\n\t\t\t}\n\t\t\toptions?.setLocaleStorage?.(name, locale);\n\t\t} catch {}\n\t}\n\tif (options?.setSessionStorage) for (let i = 0; i < storageAttributes.sessionStorage.length; i++) {\n\t\tconst { name } = storageAttributes.sessionStorage[i];\n\t\ttry {\n\t\t\tif (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n\t\t\t\tif (options?.getSessionStorage?.(name)) continue;\n\t\t\t}\n\t\t\toptions?.setSessionStorage?.(name, locale);\n\t\t} catch {}\n\t}\n\tif (options?.setHeader) for (let i = 0; i < storageAttributes.headers.length; i++) {\n\t\tconst { name } = storageAttributes.headers[i];\n\t\ttry {\n\t\t\toptions?.setHeader?.(name, locale);\n\t\t} catch {}\n\t}\n};\n/**\n* Utility object to get and set the locale in the storage by considering the configuration\n*\n* @property getLocale - Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function checks storage locations in order of priority as defined in the configuration.\n*\n* @property setLocale - Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function writes to all configured storage locations according to their attributes.\n* Respects overwrite flags for localStorage and sessionStorage.\n*\n* @returns The locale if found in any storage, or undefined if not found\n*/\nconst LocaleStorage = (options) => ({\n\tgetLocale: () => getLocaleFromStorage(options),\n\tsetLocale: (locale) => setLocaleInStorage(locale, options)\n});\n\n//#endregion\nexport { LocaleStorage, getLocaleFromStorage, setLocaleInStorage };\n//# sourceMappingURL=localeStorage.mjs.map"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,wBAAwB,YAAY;CACzC,MAAM,EAAE,SAAS,yBAAyBA;CAC1C,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,YAAY;AACpB,KAAI,YAAY,SAAS,SAAS,oBAAoB,MAAO,QAAO,KAAK;CACzE,MAAM,oBAAoBC,kDAAqB,QAAQ;CACvD,MAAM,iBAAiB,UAAU;AAChC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,QAAQ,SAAS,MAAM;;CAE/B,MAAM,cAAc,SAAS;AAC5B,MAAI;GACH,MAAM,aAAa,SAAS,YAAY,KAAK;AAC7C,OAAI,eAAe,QAAQ,eAAe,KAAK,EAAG,QAAO;UAClD;AACR,SAAOC,4BAAU,KAAK;;AAEvB,MAAK,IAAI,IAAI,GAAG,IAAI,kBAAkB,QAAQ,QAAQ,KAAK;EAC1D,MAAM,EAAE,SAAS,kBAAkB,QAAQ;EAC3C,MAAM,QAAQ,WAAW,KAAK;AAC9B,MAAI,cAAc,MAAM,CAAE,QAAO;;AAElC,MAAK,IAAI,IAAI,GAAG,IAAI,kBAAkB,aAAa,QAAQ,KAAK;EAC/D,MAAM,EAAE,SAAS,kBAAkB,aAAa;AAChD,MAAI;GACH,MAAM,QAAQ,SAAS,mBAAmB,KAAK;AAC/C,OAAI,cAAc,MAAM,CAAE,QAAO;UAC1B;;AAET,MAAK,IAAI,IAAI,GAAG,IAAI,kBAAkB,eAAe,QAAQ,KAAK;EACjE,MAAM,EAAE,SAAS,kBAAkB,eAAe;AAClD,MAAI;GACH,MAAM,QAAQ,SAAS,oBAAoB,KAAK;AAChD,OAAI,cAAc,MAAM,CAAE,QAAO;UAC1B;;AAET,MAAK,IAAI,IAAI,GAAG,IAAI,kBAAkB,QAAQ,QAAQ,KAAK;EAC1D,MAAM,EAAE,SAAS,kBAAkB,QAAQ;AAC3C,MAAI;GACH,MAAM,QAAQ,SAAS,YAAY,KAAK;AACxC,OAAI,cAAc,MAAM,CAAE,QAAO;UAC1B"}
@@ -1,133 +0,0 @@
1
- import { DefaultValues } from "@intlayer/config/client";
2
-
3
- //#region dist/esm/getStorageAttributes.mjs
4
- /**
5
- * Creates a cookie entry with default values for missing attributes
6
- */
7
- const createCookieEntry = (options) => {
8
- const { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};
9
- return {
10
- name: name ?? DefaultValues.Routing.COOKIE_NAME,
11
- attributes: {
12
- path,
13
- expires,
14
- domain,
15
- secure,
16
- sameSite,
17
- httpOnly
18
- }
19
- };
20
- };
21
- /**
22
- * Creates a web storage entry (localStorage or sessionStorage) with default name
23
- */
24
- const createWebStorageEntry = (options) => {
25
- const { name } = options ?? {};
26
- return { name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME };
27
- };
28
- /**
29
- * Creates a header entry with default name
30
- */
31
- const createHeaderEntry = (options) => {
32
- const { name } = options ?? {};
33
- return { name: name ?? DefaultValues.Routing.HEADER_NAME };
34
- };
35
- /**
36
- * Determines if a storage entry is a cookie based on its properties
37
- */
38
- const isCookieEntry = (entry) => {
39
- return entry.type === "cookie" || "sameSite" in entry || "httpOnly" in entry || "secure" in entry;
40
- };
41
- /**
42
- * Determines the storage type from a string literal
43
- */
44
- const isStorageType = (value) => {
45
- return value === "cookie" || value === "localStorage" || value === "sessionStorage" || value === "header";
46
- };
47
- /**
48
- * Processes a single storage entry and returns the appropriate storage attributes
49
- */
50
- const processStorageEntry = (entry) => {
51
- if (typeof entry === "string") {
52
- if (!isStorageType(entry)) return {
53
- cookies: [],
54
- localStorage: [],
55
- sessionStorage: [],
56
- headers: []
57
- };
58
- if (entry === "cookie") return { cookies: [createCookieEntry()] };
59
- if (entry === "localStorage") return { localStorage: [createWebStorageEntry()] };
60
- if (entry === "sessionStorage") return { sessionStorage: [createWebStorageEntry()] };
61
- if (entry === "header") return { headers: [createHeaderEntry()] };
62
- }
63
- if (typeof entry === "object" && entry !== null) {
64
- const typedEntry = entry;
65
- if (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };
66
- if ("type" in typedEntry && typedEntry.type === "localStorage") {
67
- const { name: name$1, ...rest$1 } = typedEntry;
68
- return { localStorage: [createWebStorageEntry({
69
- name: name$1,
70
- ...rest$1
71
- })] };
72
- }
73
- if ("type" in typedEntry && typedEntry.type === "sessionStorage") {
74
- const { name: name$1, ...rest$1 } = typedEntry;
75
- return { sessionStorage: [createWebStorageEntry({
76
- name: name$1,
77
- ...rest$1
78
- })] };
79
- }
80
- if ("type" in typedEntry && typedEntry.type === "header") {
81
- const { name: name$1, ...rest$1 } = typedEntry;
82
- return { headers: [createHeaderEntry({
83
- name: name$1,
84
- ...rest$1
85
- })] };
86
- }
87
- const { name, ...rest } = typedEntry;
88
- return { localStorage: [createWebStorageEntry({
89
- name,
90
- ...rest
91
- })] };
92
- }
93
- return {
94
- cookies: [],
95
- localStorage: [],
96
- sessionStorage: [],
97
- headers: []
98
- };
99
- };
100
- /**
101
- * Merges multiple partial storage attributes into a single result
102
- */
103
- const mergeStorageAttributes = (accumulated, partial) => {
104
- return {
105
- cookies: [...accumulated.cookies, ...partial.cookies ?? []],
106
- localStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],
107
- sessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],
108
- headers: [...accumulated.headers, ...partial.headers ?? []]
109
- };
110
- };
111
- /**
112
- * Extracts and normalizes storage configuration into separate arrays for each storage type
113
- *
114
- * @param options - The storage configuration from IntlayerConfig
115
- * @returns An object containing arrays for cookies, localStorage, and sessionStorage
116
- */
117
- const getStorageAttributes = (options) => {
118
- const emptyResult = {
119
- cookies: [],
120
- localStorage: [],
121
- sessionStorage: [],
122
- headers: []
123
- };
124
- if (options === false || options === void 0) return emptyResult;
125
- if (Array.isArray(options)) return options.reduce((acc, entry) => {
126
- return mergeStorageAttributes(acc, processStorageEntry(entry));
127
- }, emptyResult);
128
- return mergeStorageAttributes(emptyResult, processStorageEntry(options));
129
- };
130
-
131
- //#endregion
132
- export { getStorageAttributes };
133
- //# sourceMappingURL=getStorageAttributes.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getStorageAttributes.mjs","names":[],"sources":["../../getStorageAttributes.mjs"],"sourcesContent":["import { DefaultValues } from \"@intlayer/config/client\";\n\n//#region src/getStorageAttributes.ts\n/**\n* Creates a cookie entry with default values for missing attributes\n*/\nconst createCookieEntry = (options) => {\n\tconst { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};\n\treturn {\n\t\tname: name ?? DefaultValues.Routing.COOKIE_NAME,\n\t\tattributes: {\n\t\t\tpath,\n\t\t\texpires,\n\t\t\tdomain,\n\t\t\tsecure,\n\t\t\tsameSite,\n\t\t\thttpOnly\n\t\t}\n\t};\n};\n/**\n* Creates a web storage entry (localStorage or sessionStorage) with default name\n*/\nconst createWebStorageEntry = (options) => {\n\tconst { name } = options ?? {};\n\treturn { name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME };\n};\n/**\n* Creates a header entry with default name\n*/\nconst createHeaderEntry = (options) => {\n\tconst { name } = options ?? {};\n\treturn { name: name ?? DefaultValues.Routing.HEADER_NAME };\n};\n/**\n* Determines if a storage entry is a cookie based on its properties\n*/\nconst isCookieEntry = (entry) => {\n\treturn entry.type === \"cookie\" || \"sameSite\" in entry || \"httpOnly\" in entry || \"secure\" in entry;\n};\n/**\n* Determines the storage type from a string literal\n*/\nconst isStorageType = (value) => {\n\treturn value === \"cookie\" || value === \"localStorage\" || value === \"sessionStorage\" || value === \"header\";\n};\n/**\n* Processes a single storage entry and returns the appropriate storage attributes\n*/\nconst processStorageEntry = (entry) => {\n\tif (typeof entry === \"string\") {\n\t\tif (!isStorageType(entry)) return {\n\t\t\tcookies: [],\n\t\t\tlocalStorage: [],\n\t\t\tsessionStorage: [],\n\t\t\theaders: []\n\t\t};\n\t\tif (entry === \"cookie\") return { cookies: [createCookieEntry()] };\n\t\tif (entry === \"localStorage\") return { localStorage: [createWebStorageEntry()] };\n\t\tif (entry === \"sessionStorage\") return { sessionStorage: [createWebStorageEntry()] };\n\t\tif (entry === \"header\") return { headers: [createHeaderEntry()] };\n\t}\n\tif (typeof entry === \"object\" && entry !== null) {\n\t\tconst typedEntry = entry;\n\t\tif (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"localStorage\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { localStorage: [createWebStorageEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"sessionStorage\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { sessionStorage: [createWebStorageEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"header\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { headers: [createHeaderEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tconst { name, ...rest } = typedEntry;\n\t\treturn { localStorage: [createWebStorageEntry({\n\t\t\tname,\n\t\t\t...rest\n\t\t})] };\n\t}\n\treturn {\n\t\tcookies: [],\n\t\tlocalStorage: [],\n\t\tsessionStorage: [],\n\t\theaders: []\n\t};\n};\n/**\n* Merges multiple partial storage attributes into a single result\n*/\nconst mergeStorageAttributes = (accumulated, partial) => {\n\treturn {\n\t\tcookies: [...accumulated.cookies, ...partial.cookies ?? []],\n\t\tlocalStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],\n\t\tsessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],\n\t\theaders: [...accumulated.headers, ...partial.headers ?? []]\n\t};\n};\n/**\n* Extracts and normalizes storage configuration into separate arrays for each storage type\n*\n* @param options - The storage configuration from IntlayerConfig\n* @returns An object containing arrays for cookies, localStorage, and sessionStorage\n*/\nconst getStorageAttributes = (options) => {\n\tconst emptyResult = {\n\t\tcookies: [],\n\t\tlocalStorage: [],\n\t\tsessionStorage: [],\n\t\theaders: []\n\t};\n\tif (options === false || options === void 0) return emptyResult;\n\tif (Array.isArray(options)) return options.reduce((acc, entry) => {\n\t\treturn mergeStorageAttributes(acc, processStorageEntry(entry));\n\t}, emptyResult);\n\treturn mergeStorageAttributes(emptyResult, processStorageEntry(options));\n};\n\n//#endregion\nexport { getStorageAttributes };\n//# sourceMappingURL=getStorageAttributes.mjs.map"],"mappings":";;;;;;AAMA,MAAM,qBAAqB,YAAY;CACtC,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aAAa,WAAW,EAAE;AACjF,QAAO;EACN,MAAM,QAAQ,cAAc,QAAQ;EACpC,YAAY;GACX;GACA;GACA;GACA;GACA;GACA;GACA;EACD;;;;;AAKF,MAAM,yBAAyB,YAAY;CAC1C,MAAM,EAAE,SAAS,WAAW,EAAE;AAC9B,QAAO,EAAE,MAAM,QAAQ,cAAc,QAAQ,qBAAqB;;;;;AAK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H,CAAC,CAAC,EAAE;;AAEN,MAAI,UAAU,cAAc,WAAW,SAAS,UAAU;GACzD,MAAM,EAAE,MAAM,QAAQ,GAAG,WAAW;AACpC,UAAO,EAAE,SAAS,CAAC,kBAAkB;IACpC,MAAM;IACN,GAAG;IACH,CAAC,CAAC,EAAE;;EAEN,MAAM,EAAE,MAAM,GAAG,SAAS;AAC1B,SAAO,EAAE,cAAc,CAAC,sBAAsB;GAC7C;GACA,GAAG;GACH,CAAC,CAAC,EAAE;;AAEN,QAAO;EACN,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACX;;;;;AAKF,MAAM,0BAA0B,aAAa,YAAY;AACxD,QAAO;EACN,SAAS,CAAC,GAAG,YAAY,SAAS,GAAG,QAAQ,WAAW,EAAE,CAAC;EAC3D,cAAc,CAAC,GAAG,YAAY,cAAc,GAAG,QAAQ,gBAAgB,EAAE,CAAC;EAC1E,gBAAgB,CAAC,GAAG,YAAY,gBAAgB,GAAG,QAAQ,kBAAkB,EAAE,CAAC;EAChF,SAAS,CAAC,GAAG,YAAY,SAAS,GAAG,QAAQ,WAAW,EAAE,CAAC;EAC3D;;;;;;;;AAQF,MAAM,wBAAwB,YAAY;CACzC,MAAM,cAAc;EACnB,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACX;AACD,KAAI,YAAY,SAAS,YAAY,KAAK,EAAG,QAAO;AACpD,KAAI,MAAM,QAAQ,QAAQ,CAAE,QAAO,QAAQ,QAAQ,KAAK,UAAU;AACjE,SAAO,uBAAuB,KAAK,oBAAoB,MAAM,CAAC;IAC5D,YAAY;AACf,QAAO,uBAAuB,aAAa,oBAAoB,QAAQ,CAAC"}
@@ -1,26 +0,0 @@
1
- import configuration from "@intlayer/config/built";
2
-
3
- //#region dist/esm/localization/localeResolver.mjs
4
- /**
5
- * Resolves the most specific locale from a user-provided list,
6
- * or falls back to the default locale if no match is found.
7
- */
8
- const localeResolver = (selectedLocale, locales = configuration?.internationalization?.locales, defaultLocale = configuration?.internationalization?.defaultLocale) => {
9
- const requestedLocales = [selectedLocale].flat();
10
- const normalize = (locale) => locale.trim().toLowerCase();
11
- try {
12
- for (const requested of requestedLocales) {
13
- const normalizedRequested = normalize(requested);
14
- const exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);
15
- if (exactMatch) return exactMatch;
16
- const [requestedLang] = normalizedRequested.split("-");
17
- const partialMatch = locales.find((loc) => normalize(loc).split("-")[0] === requestedLang);
18
- if (partialMatch) return partialMatch;
19
- }
20
- } catch (_error) {}
21
- return defaultLocale;
22
- };
23
-
24
- //#endregion
25
- export { localeResolver };
26
- //# sourceMappingURL=localeResolver.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localeResolver.mjs","names":[],"sources":["../../../localization/localeResolver.mjs"],"sourcesContent":["import configuration from \"@intlayer/config/built\";\n\n//#region src/localization/localeResolver.ts\n/**\n* Resolves the most specific locale from a user-provided list,\n* or falls back to the default locale if no match is found.\n*/\nconst localeResolver = (selectedLocale, locales = configuration?.internationalization?.locales, defaultLocale = configuration?.internationalization?.defaultLocale) => {\n\tconst requestedLocales = [selectedLocale].flat();\n\tconst normalize = (locale) => locale.trim().toLowerCase();\n\ttry {\n\t\tfor (const requested of requestedLocales) {\n\t\t\tconst normalizedRequested = normalize(requested);\n\t\t\tconst exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);\n\t\t\tif (exactMatch) return exactMatch;\n\t\t\tconst [requestedLang] = normalizedRequested.split(\"-\");\n\t\t\tconst partialMatch = locales.find((loc) => normalize(loc).split(\"-\")[0] === requestedLang);\n\t\t\tif (partialMatch) return partialMatch;\n\t\t}\n\t} catch (_error) {}\n\treturn defaultLocale;\n};\n\n//#endregion\nexport { localeResolver };\n//# sourceMappingURL=localeResolver.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,kBAAkB,gBAAgB,UAAU,eAAe,sBAAsB,SAAS,gBAAgB,eAAe,sBAAsB,kBAAkB;CACtK,MAAM,mBAAmB,CAAC,eAAe,CAAC,MAAM;CAChD,MAAM,aAAa,WAAW,OAAO,MAAM,CAAC,aAAa;AACzD,KAAI;AACH,OAAK,MAAM,aAAa,kBAAkB;GACzC,MAAM,sBAAsB,UAAU,UAAU;GAChD,MAAM,aAAa,QAAQ,MAAM,QAAQ,UAAU,IAAI,KAAK,oBAAoB;AAChF,OAAI,WAAY,QAAO;GACvB,MAAM,CAAC,iBAAiB,oBAAoB,MAAM,IAAI;GACtD,MAAM,eAAe,QAAQ,MAAM,QAAQ,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,cAAc;AAC1F,OAAI,aAAc,QAAO;;UAElB,QAAQ;AACjB,QAAO"}
@@ -1,31 +0,0 @@
1
- //#region dist/esm/utils/getCookie.mjs
2
- /**
3
- * Retrieves a cookie by name from a cookie string or document.cookie
4
- * @param name - The name of the cookie to retrieve
5
- * @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)
6
- * @returns The cookie value or undefined if not found
7
- */
8
- const getCookie = (name, cookieString) => {
9
- try {
10
- const str = cookieString ?? (typeof document !== "undefined" ? document.cookie : "");
11
- if (!str) return void 0;
12
- const pairs = str.split(";");
13
- for (let i = 0; i < pairs.length; i++) {
14
- const part = pairs[i].trim();
15
- if (!part) continue;
16
- const equalIndex = part.indexOf("=");
17
- if ((equalIndex >= 0 ? part.substring(0, equalIndex) : part) === name) {
18
- const rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : "";
19
- try {
20
- return decodeURIComponent(rawValue);
21
- } catch {
22
- return rawValue;
23
- }
24
- }
25
- }
26
- } catch {}
27
- };
28
-
29
- //#endregion
30
- export { getCookie };
31
- //# sourceMappingURL=getCookie.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCookie.mjs","names":[],"sources":["../../../utils/getCookie.mjs"],"sourcesContent":["//#region src/utils/getCookie.ts\n/**\n* Retrieves a cookie by name from a cookie string or document.cookie\n* @param name - The name of the cookie to retrieve\n* @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)\n* @returns The cookie value or undefined if not found\n*/\nconst getCookie = (name, cookieString) => {\n\ttry {\n\t\tconst str = cookieString ?? (typeof document !== \"undefined\" ? document.cookie : \"\");\n\t\tif (!str) return void 0;\n\t\tconst pairs = str.split(\";\");\n\t\tfor (let i = 0; i < pairs.length; i++) {\n\t\t\tconst part = pairs[i].trim();\n\t\t\tif (!part) continue;\n\t\t\tconst equalIndex = part.indexOf(\"=\");\n\t\t\tif ((equalIndex >= 0 ? part.substring(0, equalIndex) : part) === name) {\n\t\t\t\tconst rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : \"\";\n\t\t\t\ttry {\n\t\t\t\t\treturn decodeURIComponent(rawValue);\n\t\t\t\t} catch {\n\t\t\t\t\treturn rawValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch {}\n};\n\n//#endregion\nexport { getCookie };\n//# sourceMappingURL=getCookie.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,aAAa,MAAM,iBAAiB;AACzC,KAAI;EACH,MAAM,MAAM,iBAAiB,OAAO,aAAa,cAAc,SAAS,SAAS;AACjF,MAAI,CAAC,IAAK,QAAO,KAAK;EACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC5B,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;GACtC,MAAM,OAAO,MAAM,GAAG,MAAM;AAC5B,OAAI,CAAC,KAAM;GACX,MAAM,aAAa,KAAK,QAAQ,IAAI;AACpC,QAAK,cAAc,IAAI,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,MAAM;IACtE,MAAM,WAAW,cAAc,IAAI,KAAK,UAAU,aAAa,EAAE,GAAG;AACpE,QAAI;AACH,YAAO,mBAAmB,SAAS;YAC5B;AACP,YAAO;;;;SAIH"}
@@ -1,59 +0,0 @@
1
- import { getStorageAttributes } from "../getStorageAttributes.mjs";
2
- import { getCookie } from "./getCookie.mjs";
3
- import configuration from "@intlayer/config/built";
4
-
5
- //#region dist/esm/utils/localeStorage.mjs
6
- /**
7
- * Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).
8
- * The function checks storage locations in order of priority as defined in the configuration.
9
- *
10
- * @returns The locale if found in any storage, or undefined if not found
11
- */
12
- const getLocaleFromStorage = (options) => {
13
- const { routing, internationalization } = configuration;
14
- const { locales } = internationalization;
15
- const { storage } = routing;
16
- if (storage === false || options?.isCookieEnabled === false) return void 0;
17
- const storageAttributes = getStorageAttributes(storage);
18
- const isValidLocale = (value) => {
19
- if (!value) return false;
20
- return locales.includes(value);
21
- };
22
- const readCookie = (name) => {
23
- try {
24
- const fromOption = options?.getCookie?.(name);
25
- if (fromOption !== null && fromOption !== void 0) return fromOption;
26
- } catch {}
27
- return getCookie(name);
28
- };
29
- for (let i = 0; i < storageAttributes.cookies.length; i++) {
30
- const { name } = storageAttributes.cookies[i];
31
- const value = readCookie(name);
32
- if (isValidLocale(value)) return value;
33
- }
34
- for (let i = 0; i < storageAttributes.localStorage.length; i++) {
35
- const { name } = storageAttributes.localStorage[i];
36
- try {
37
- const value = options?.getLocaleStorage?.(name);
38
- if (isValidLocale(value)) return value;
39
- } catch {}
40
- }
41
- for (let i = 0; i < storageAttributes.sessionStorage.length; i++) {
42
- const { name } = storageAttributes.sessionStorage[i];
43
- try {
44
- const value = options?.getSessionStorage?.(name);
45
- if (isValidLocale(value)) return value;
46
- } catch {}
47
- }
48
- for (let i = 0; i < storageAttributes.headers.length; i++) {
49
- const { name } = storageAttributes.headers[i];
50
- try {
51
- const value = options?.getHeader?.(name);
52
- if (isValidLocale(value)) return value;
53
- } catch {}
54
- }
55
- };
56
-
57
- //#endregion
58
- export { getLocaleFromStorage };
59
- //# sourceMappingURL=localeStorage.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localeStorage.mjs","names":[],"sources":["../../../utils/localeStorage.mjs"],"sourcesContent":["import { getStorageAttributes } from \"../getStorageAttributes.mjs\";\nimport { getCookie } from \"./getCookie.mjs\";\nimport configuration from \"@intlayer/config/built\";\n\n//#region src/utils/localeStorage.ts\nconst buildCookieString = (name, value, attributes) => {\n\tconst parts = [`${name}=${encodeURIComponent(value)}`];\n\tif (attributes.path) parts.push(`Path=${attributes.path}`);\n\tif (attributes.domain) parts.push(`Domain=${attributes.domain}`);\n\tif (attributes.expires instanceof Date) parts.push(`Expires=${attributes.expires.toUTCString()}`);\n\tif (attributes.secure) parts.push(\"Secure\");\n\tif (attributes.sameSite) parts.push(`SameSite=${attributes.sameSite}`);\n\treturn parts.join(\"; \");\n};\n/**\n* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function checks storage locations in order of priority as defined in the configuration.\n*\n* @returns The locale if found in any storage, or undefined if not found\n*/\nconst getLocaleFromStorage = (options) => {\n\tconst { routing, internationalization } = configuration;\n\tconst { locales } = internationalization;\n\tconst { storage } = routing;\n\tif (storage === false || options?.isCookieEnabled === false) return void 0;\n\tconst storageAttributes = getStorageAttributes(storage);\n\tconst isValidLocale = (value) => {\n\t\tif (!value) return false;\n\t\treturn locales.includes(value);\n\t};\n\tconst readCookie = (name) => {\n\t\ttry {\n\t\t\tconst fromOption = options?.getCookie?.(name);\n\t\t\tif (fromOption !== null && fromOption !== void 0) return fromOption;\n\t\t} catch {}\n\t\treturn getCookie(name);\n\t};\n\tfor (let i = 0; i < storageAttributes.cookies.length; i++) {\n\t\tconst { name } = storageAttributes.cookies[i];\n\t\tconst value = readCookie(name);\n\t\tif (isValidLocale(value)) return value;\n\t}\n\tfor (let i = 0; i < storageAttributes.localStorage.length; i++) {\n\t\tconst { name } = storageAttributes.localStorage[i];\n\t\ttry {\n\t\t\tconst value = options?.getLocaleStorage?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n\tfor (let i = 0; i < storageAttributes.sessionStorage.length; i++) {\n\t\tconst { name } = storageAttributes.sessionStorage[i];\n\t\ttry {\n\t\t\tconst value = options?.getSessionStorage?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n\tfor (let i = 0; i < storageAttributes.headers.length; i++) {\n\t\tconst { name } = storageAttributes.headers[i];\n\t\ttry {\n\t\t\tconst value = options?.getHeader?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n};\n/**\n* Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function writes to all configured storage locations according to their attributes.\n* Respects overwrite flags for localStorage and sessionStorage.\n*\n* @param locale - The locale to store\n*/\nconst setLocaleInStorage = (locale, options) => {\n\tif (configuration.routing.storage === false || options?.isCookieEnabled === false) return;\n\tconst storageAttributes = getStorageAttributes(configuration.routing.storage);\n\tfor (let i = 0; i < storageAttributes.cookies.length; i++) {\n\t\tconst { name, attributes } = storageAttributes.cookies[i];\n\t\ttry {\n\t\t\tif (options?.setCookieStore) options?.setCookieStore?.(name, locale, {\n\t\t\t\t...attributes,\n\t\t\t\texpires: attributes.expires instanceof Date ? attributes.expires.getTime() : attributes.expires\n\t\t\t});\n\t\t} catch {\n\t\t\ttry {\n\t\t\t\tif (options?.setCookieString) {\n\t\t\t\t\tconst cookieString = buildCookieString(name, locale, attributes);\n\t\t\t\t\toptions?.setCookieString?.(name, cookieString);\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\t}\n\tif (options?.setLocaleStorage) for (let i = 0; i < storageAttributes.localStorage.length; i++) {\n\t\tconst { name } = storageAttributes.localStorage[i];\n\t\ttry {\n\t\t\tif (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n\t\t\t\tif (options?.getLocaleStorage?.(name)) continue;\n\t\t\t}\n\t\t\toptions?.setLocaleStorage?.(name, locale);\n\t\t} catch {}\n\t}\n\tif (options?.setSessionStorage) for (let i = 0; i < storageAttributes.sessionStorage.length; i++) {\n\t\tconst { name } = storageAttributes.sessionStorage[i];\n\t\ttry {\n\t\t\tif (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n\t\t\t\tif (options?.getSessionStorage?.(name)) continue;\n\t\t\t}\n\t\t\toptions?.setSessionStorage?.(name, locale);\n\t\t} catch {}\n\t}\n\tif (options?.setHeader) for (let i = 0; i < storageAttributes.headers.length; i++) {\n\t\tconst { name } = storageAttributes.headers[i];\n\t\ttry {\n\t\t\toptions?.setHeader?.(name, locale);\n\t\t} catch {}\n\t}\n};\n/**\n* Utility object to get and set the locale in the storage by considering the configuration\n*\n* @property getLocale - Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function checks storage locations in order of priority as defined in the configuration.\n*\n* @property setLocale - Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function writes to all configured storage locations according to their attributes.\n* Respects overwrite flags for localStorage and sessionStorage.\n*\n* @returns The locale if found in any storage, or undefined if not found\n*/\nconst LocaleStorage = (options) => ({\n\tgetLocale: () => getLocaleFromStorage(options),\n\tsetLocale: (locale) => setLocaleInStorage(locale, options)\n});\n\n//#endregion\nexport { LocaleStorage, getLocaleFromStorage, setLocaleInStorage };\n//# sourceMappingURL=localeStorage.mjs.map"],"mappings":";;;;;;;;;;;AAoBA,MAAM,wBAAwB,YAAY;CACzC,MAAM,EAAE,SAAS,yBAAyB;CAC1C,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,YAAY;AACpB,KAAI,YAAY,SAAS,SAAS,oBAAoB,MAAO,QAAO,KAAK;CACzE,MAAM,oBAAoB,qBAAqB,QAAQ;CACvD,MAAM,iBAAiB,UAAU;AAChC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,QAAQ,SAAS,MAAM;;CAE/B,MAAM,cAAc,SAAS;AAC5B,MAAI;GACH,MAAM,aAAa,SAAS,YAAY,KAAK;AAC7C,OAAI,eAAe,QAAQ,eAAe,KAAK,EAAG,QAAO;UAClD;AACR,SAAO,UAAU,KAAK;;AAEvB,MAA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