{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import { editor, internationalization } from '@intlayer/config/built';\nimport {\n  conditionPlugin,\n  type DeepTransformContent as DeepTransformContentCore,\n  enumerationPlugin,\n  fallbackPlugin,\n  filePlugin,\n  genderPlugin,\n  type IInterpreterPluginState as IInterpreterPluginStateCore,\n  isInterpolableWrapperNode,\n  nestedPlugin,\n  type Plugins,\n  pluralPlugin,\n  resolveInsertedSelector,\n  resolveInterpreterLocale,\n  selectPlugin,\n  splitInsertionTemplate,\n  transformInterpolableNode,\n  translationPlugin,\n} from '@intlayer/core/interpreter';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type {\n  HTMLContent,\n  InsertionContent,\n  MarkdownContent,\n} from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n  DeclaredLocales,\n  LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { NodeType } from '@intlayer/types/nodeType';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { createElement, type FC, Fragment, type ReactNode } from 'react';\nimport { reportExposure } from './analytics/exposureSink';\nimport { useLoadDynamic } from './client/useLoadDynamic';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/HTMLComponentTypes';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\nconst markdownRendererModulePromise =\n  process.env.INTLAYER_NODE_TYPE_MARKDOWN !== 'false'\n    ? import('./markdown/MarkdownRendererPlugin').then(\n        (m) => m.MarkdownRendererPlugin\n      )\n    : null;\n\nconst htmlRendererModulePromise =\n  process.env.INTLAYER_NODE_TYPE_HTML !== 'false'\n    ? import('./html/HTMLRendererPlugin').then((m) => m.HTMLRendererPlugin)\n    : null;\n\n// These preloads are read later by `useLoadDynamic`, so the rejection must stay\n// on the promise: a `.catch()` chained into it would resolve with `undefined`\n// and be mistaken for a loaded module. Handle it on the side instead, so an\n// aborted chunk load never escapes as an unhandled rejection.\nmarkdownRendererModulePromise?.catch(() => {});\nhtmlRendererModulePromise?.catch(() => {});\n\n/** ---------------------------------------------\n *  INTLAYER NODE PLUGIN\n *  --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n  ? IntlayerNode<T>\n  : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n  id: 'intlayer-node-plugin',\n  canHandle: (node) =>\n    typeof node === 'bigint' ||\n    typeof node === 'string' ||\n    typeof node === 'number',\n  transform: (_node, props) => {\n    // Node-level analytics: record which content is resolved for display.\n    // No-op (and dead-code-eliminated) when analytics is disabled.\n    if (process.env.INTLAYER_ANALYTICS_ENABLED !== 'false') {\n      reportExposure({\n        dictionaryKey: props.dictionaryKey,\n        keyPath: props.keyPath,\n        locale: props.locale,\n        nodeType: 'text',\n      });\n    }\n\n    // Props are only forwarded to the editor selector: copying them for every\n    // leaf would cost an allocation per rendered string\n    if (process.env.INTLAYER_EDITOR_ENABLED !== 'false' && editor.enabled) {\n      const {\n        plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n        ...rest\n      } = props;\n\n      return renderIntlayerNode({\n        value: rest.children,\n        children: <ContentSelector {...rest}>{rest.children}</ContentSelector>,\n      });\n    }\n\n    return renderIntlayerNode({\n      value: props.children,\n      children: props.children,\n    });\n  },\n};\n\n/** ---------------------------------------------\n *  REACT NODE PLUGIN\n *  --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n  props: any;\n  key: any;\n}\n  ? ReactNode\n  : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins =\n  process.env.INTLAYER_NODE_TYPE_REACT_NODE === 'false'\n    ? fallbackPlugin\n    : {\n        id: 'react-node-plugin',\n        canHandle: (node) =>\n          typeof node === 'object' &&\n          typeof node?.props !== 'undefined' &&\n          typeof node.key !== 'undefined',\n\n        transform: (\n          node,\n          {\n            plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n            ...rest\n          }\n        ) => {\n          if (process.env.INTLAYER_ANALYTICS_ENABLED !== 'false') {\n            reportExposure({\n              dictionaryKey: rest.dictionaryKey,\n              keyPath: rest.keyPath,\n              locale: rest.locale,\n              nodeType: 'react-node',\n            });\n          }\n\n          return renderIntlayerNode({\n            ...rest,\n            value: '[[react-element]]',\n            children:\n              process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n              editor.enabled ? (\n                <ContentSelector {...rest}>\n                  {renderReactElement(node)}\n                </ContentSelector>\n              ) : (\n                renderReactElement(node)\n              ),\n          });\n        },\n      };\n\n/** ---------------------------------------------\n *  INSERTION PLUGIN\n *  --------------------------------------------- */\n\nexport type InsertionCond<T> = T extends {\n  nodeType: NodeType | string;\n  [NodeTypes.INSERTION]: infer I;\n  fields: readonly string[];\n}\n  ? <V extends { [K in T['fields'][number]]: ReactNode }>(\n      values: V\n    ) => I extends string\n      ? V[keyof V] extends string | number\n        ? IntlayerNode<string>\n        : IntlayerNode<ReactNode>\n      : DeepTransformContent<I>\n  : never;\n\n/**\n * Split insertion string and join with React nodes using shared core logic\n */\nconst splitAndJoinInsertion = (\n  template: string,\n  values: Record<string, string | number | ReactNode>\n): ReactNode => {\n  const result = splitInsertionTemplate(template, values);\n\n  if (result.isSimple) {\n    // Simple string replacement\n    return result.parts as string;\n  }\n\n  // Return as Fragment with proper keys\n  return createElement(\n    Fragment,\n    null,\n    ...(result.parts as any[]).map((part, index) =>\n      createElement(Fragment, { key: index }, part)\n    )\n  );\n};\n\n/** Insertion plugin for React. Handles component/node insertion. */\nexport const insertionPlugin: Plugins =\n  process.env.INTLAYER_NODE_TYPE_INSERTION === 'false'\n    ? fallbackPlugin\n    : {\n        id: 'insertion-plugin',\n        canHandle: (node) =>\n          typeof node === 'object' && node?.nodeType === NodeTypes.INSERTION,\n        transform: (node: InsertionContent, props, deepTransformNode) => {\n          const newKeyPath: KeyPath[] = [\n            ...props.keyPath,\n            {\n              type: NodeTypes.INSERTION,\n            },\n          ];\n\n          const children = node[NodeTypes.INSERTION];\n\n          /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n          const insertionStringPlugin: Plugins = {\n            id: 'insertion-string-plugin',\n            canHandle: (node) =>\n              typeof node === 'string' || isInterpolableWrapperNode(node),\n            transform: (node, subProps, deepTransformNode) => {\n              // `html()`/`markdown()` nodes carry their `{{ … }}` placeholders\n              // inside a raw string. Interpolate into that string, then re-run\n              // the transform so the html/markdown renderer applies afterwards.\n              // React nodes cannot be injected into a raw markup string, so\n              // string interpolation (not `splitAndJoinInsertion`) is used here.\n              if (isInterpolableWrapperNode(node)) {\n                return (values: {\n                  [K in InsertionContent['fields'][number]]: string | number;\n                }) =>\n                  transformInterpolableNode(\n                    node,\n                    values,\n                    subProps,\n                    props.plugins,\n                    deepTransformNode\n                  );\n              }\n\n              const transformedResult = deepTransformNode(node, {\n                ...subProps,\n                children: node,\n                plugins: (props.plugins ?? ([] as Plugins[])).filter(\n                    (plugin) => plugin.id !== 'intlayer-node-plugin'\n                  ),\n              });\n\n              return (values: {\n                [K in InsertionContent['fields'][number]]:\n                  | string\n                  | number\n                  | ReactNode;\n              }) => {\n                const result = splitAndJoinInsertion(transformedResult, values);\n\n                return deepTransformNode(result, {\n                  ...subProps,\n                  plugins: props.plugins,\n                  children: result,\n                });\n              };\n            },\n          };\n\n          const result = deepTransformNode(children, {\n            ...props,\n            children,\n            keyPath: newKeyPath,\n            plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n          });\n\n          return resolveInsertedSelector(children, result);\n        },\n      };\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n  ? IntlayerNode<\n      string,\n      {\n        metadata: DeepTransformContent<string>;\n        use: (components: HTMLComponents<'permissive', {}>) => ReactNode;\n      }\n    >\n  : never;\n\nconst MarkdownSuspenseRenderer: FC<Record<string, any>> = ({\n  children,\n  ...props\n}) => {\n  const MarkdownRendererPlugin = useLoadDynamic(\n    'markdown-renderer-plugin',\n    markdownRendererModulePromise!\n  );\n  return createElement(MarkdownRendererPlugin as any, { ...props, children });\n};\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins =\n  process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n    ? fallbackPlugin\n    : {\n        id: 'markdown-string-plugin',\n        canHandle: (node) => typeof node === 'string',\n        transform: (node: string, props, deepTransformNode) => {\n          const {\n            plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n            ...rest\n          } = props;\n\n          const metadata = getMarkdownMetadata(node) ?? {};\n\n          const metadataPlugins: Plugins = {\n            id: 'markdown-metadata-plugin',\n            canHandle: (metadataNode) =>\n              typeof metadataNode === 'string' ||\n              typeof metadataNode === 'number' ||\n              typeof metadataNode === 'boolean' ||\n              !metadataNode,\n            transform: (metadataNode, props) =>\n              renderIntlayerNode({\n                ...props,\n                value: metadataNode,\n                children:\n                  process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n                  editor.enabled ? (\n                    <ContentSelector {...rest}>{node}</ContentSelector>\n                  ) : (\n                    node\n                  ),\n              }),\n          };\n\n          // Transform metadata while keeping the same structure\n          const metadataNodes = deepTransformNode(metadata, {\n            plugins: [metadataPlugins],\n            dictionaryKey: rest.dictionaryKey,\n            keyPath: [],\n          });\n\n          const render = (components?: HTMLComponents) =>\n            renderIntlayerNode({\n              ...props,\n              value: node,\n              children:\n                process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n                editor.enabled ? (\n                  <ContentSelector {...rest}>\n                    <MarkdownSuspenseRenderer {...rest} components={components}>\n                      {node}\n                    </MarkdownSuspenseRenderer>\n                  </ContentSelector>\n                ) : (\n                  <MarkdownSuspenseRenderer {...rest} components={components}>\n                    {node}\n                  </MarkdownSuspenseRenderer>\n                ),\n              additionalProps: {\n                metadata: metadataNodes,\n                use: render,\n              },\n            });\n\n          return render();\n        },\n      };\n\nexport type MarkdownCond<T> = T extends {\n  nodeType: NodeType | string;\n  [NodeTypes.MARKDOWN]: infer M;\n  tags?: infer U;\n  metadata?: infer V;\n}\n  ? IntlayerNode<\n      M,\n      {\n        use: (components?: HTMLComponents<'permissive', U>) => ReactNode;\n        metadata: DeepTransformContent<V>;\n      }\n    >\n  : never;\n\nexport const markdownPlugin: Plugins =\n  process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n    ? fallbackPlugin\n    : {\n        id: 'markdown-plugin',\n        canHandle: (node) =>\n          typeof node === 'object' && node?.nodeType === NodeTypes.MARKDOWN,\n        transform: (node: MarkdownContent, props, deepTransformNode) => {\n          const newKeyPath: KeyPath[] = [\n            ...props.keyPath,\n            {\n              type: NodeTypes.MARKDOWN,\n            },\n          ];\n\n          const children = node[NodeTypes.MARKDOWN];\n\n          return deepTransformNode(children, {\n            ...props,\n            children,\n            keyPath: newKeyPath,\n            plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n          });\n        },\n      };\n\n/** ---------------------------------------------\n *  HTML PLUGIN\n *  --------------------------------------------- */\n\n/**\n * HTML conditional type that enforces:\n * - All components (Standard or Custom) are OPTIONAL in the `use()` method.\n * - Custom components props are strictly inferred from the dictionary definition.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T> = T extends {\n  nodeType: NodeType | string;\n  [NodeTypes.HTML]: infer I;\n  tags?: infer U;\n}\n  ? IntlayerNode<\n      I,\n      {\n        use: (components?: HTMLComponents<'permissive', U>) => ReactNode;\n      }\n    >\n  : never;\n\nconst HTMLSuspenseRenderer: FC<Record<string, any>> = (props) => {\n  const HTMLRendererPlugin = useLoadDynamic(\n    'html-renderer-plugin',\n    htmlRendererModulePromise!\n  );\n  return createElement(HTMLRendererPlugin as any, props);\n};\n\n/** HTML plugin. Replaces node with a function that takes components => ReactNode. */\nexport const htmlPlugin: Plugins =\n  process.env.INTLAYER_NODE_TYPE_HTML === 'false'\n    ? fallbackPlugin\n    : {\n        id: 'html-plugin',\n        canHandle: (node) =>\n          typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n\n        transform: (node: HTMLContent<string>, props) => {\n          const html = node[NodeTypes.HTML];\n          const { plugins, ...rest } = props;\n\n          // Type-safe render function that accepts properly typed components\n          const render = (userComponents?: HTMLComponents): ReactNode =>\n            renderIntlayerNode({\n              ...rest,\n              value: html,\n              children:\n                process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n                editor.enabled ? (\n                  <ContentSelector {...rest}>\n                    <HTMLSuspenseRenderer\n                      {...rest}\n                      html={html}\n                      userComponents={userComponents}\n                    />\n                  </ContentSelector>\n                ) : (\n                  <HTMLSuspenseRenderer\n                    {...rest}\n                    html={html}\n                    userComponents={userComponents}\n                  />\n                ),\n              additionalProps: { use: render },\n            });\n\n          return render();\n        },\n      };\n\n/** ---------------------------------------------\n *  PLUGINS RESULT\n *  --------------------------------------------- */\n\nexport type IInterpreterPluginReact<T, _S, _L extends LocalesValues> = {\n  reactNode: ReactNodeCond<T>;\n  reactIntlayerNode: IntlayerNodeCond<T>;\n  reactInsertion: InsertionCond<T>;\n  reactMarkdown: MarkdownCond<T>;\n  reactHtml: HTMLPluginCond<T>;\n};\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n  IInterpreterPluginStateCore,\n  'insertion' // Remove insertion type from core package\n> & {\n  reactNode: true;\n  reactIntlayerNode: true;\n  reactMarkdown: true;\n  reactHtml: true;\n  reactInsertion: true;\n};\n\nexport type DeepTransformContent<\n  T,\n  L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\nconst pluginsCache = new Map<string, Plugins[]>();\n\n/**\n * Get the plugins array for React content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n  locale?: LocalesValues,\n  fallback: boolean = true\n): Plugins[] => {\n  const currentLocale = resolveInterpreterLocale(locale);\n  const cacheKey = `${currentLocale}_${fallback}`;\n\n  if (pluginsCache.has(cacheKey)) {\n    return pluginsCache.get(cacheKey)!;\n  }\n\n  const plugins = [\n    // First: most nodes are plain strings, which every other plugin rejects\n    intlayerNodePlugins,\n    // Env var allows the bundler to to remove the plugin if not used to make the bundle smaller\n    translationPlugin(\n      currentLocale,\n      fallback ? internationalization.defaultLocale : undefined\n    ),\n    enumerationPlugin,\n    pluralPlugin(currentLocale),\n    conditionPlugin,\n    nestedPlugin(currentLocale),\n\n    filePlugin,\n    genderPlugin,\n    selectPlugin,\n    // Always include: handle React elements\n    reactNodePlugins,\n    insertionPlugin,\n    markdownPlugin,\n    htmlPlugin,\n  ] as Plugins[];\n\n  // Plugins disabled at build time never match: skip them on every node\n  const enabledPlugins = plugins.filter((plugin) => plugin !== fallbackPlugin);\n\n  pluginsCache.set(cacheKey, enabledPlugins);\n\n  return enabledPlugins;\n};\n"],"mappings":";;;;;;;;;;;;;AAyCA,MAAM,gCACJ,QAAQ,IAAI,gCAAgC,UACxC,OAAO,wCAAoC,CAAC,MACzC,MAAM,EAAE,sBACX,IACA;AAEN,MAAM,4BACJ,QAAQ,IAAI,4BAA4B,UACpC,OAAO,gCAA4B,CAAC,MAAM,MAAM,EAAE,kBAAkB,IACpE;AAMN,+BAA+B,YAAY,CAAC,CAAC;AAC7C,2BAA2B,YAAY,CAAC,CAAC;;AAWzC,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YAAY,OAAO,UAAU;EAG3B,IAAI,QAAQ,IAAI,+BAA+B,SAC7C,eAAe;GACb,eAAe,MAAM;GACrB,SAAS,MAAM;GACf,QAAQ,MAAM;GACd,UAAU;EACZ,CAAC;EAKH,IAAI,QAAQ,IAAI,4BAA4B,WAA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