{"version":3,"file":"plugins.cjs","names":["editor","renderIntlayerNode","ContentSelector","fallbackPlugin","renderPreactElement","h","Fragment","NodeTypes","isInterpolableWrapperNode","transformInterpolableNode","resolveInsertedSelector","lazy","getMarkdownMetadata","resolveInterpreterLocale","translationPlugin","internationalization","enumerationPlugin","pluralPlugin","conditionPlugin","nestedPlugin","filePlugin","genderPlugin","selectPlugin"],"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  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 { Fragment, type FunctionComponent, h, type VNode } from 'preact';\nimport { lazy } from 'preact/compat';\nimport { reportExposure } from './analytics/exposureSink';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\nconst markdownRendererModulePromise =\n  process.env.INTLAYER_NODE_TYPE_MARKDOWN !== 'false'\n    ? import('./markdown/MarkdownRendererPlugin').then((m) => ({\n        MarkdownRendererPlugin: m.MarkdownRendererPlugin,\n        MarkdownMetadataRenderer: m.MarkdownMetadataRenderer,\n      }))\n    : null;\n\nconst htmlRendererModulePromise =\n  process.env.INTLAYER_NODE_TYPE_HTML !== 'false'\n    ? import('./html/HTMLRenderer').then((m) => m.HTMLRenderer)\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: (\n          <ContentSelector {...rest} key={rest.children}>\n            {rest.children}\n          </ContentSelector>\n        ),\n      });\n    }\n\n    return renderIntlayerNode({\n      value: props.children,\n      children: props.children,\n    });\n  },\n};\n\n/** ---------------------------------------------\n * PREACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type PreactNodeCond<T> = T extends {\n  props: any;\n  key: any;\n}\n  ? VNode\n  : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const preactNodePlugins: Plugins =\n  process.env.INTLAYER_NODE_TYPE_PREACT_NODE === 'false'\n    ? fallbackPlugin\n    : {\n        id: 'preact-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: 'preact-node',\n            });\n          }\n\n          return renderIntlayerNode({\n            ...rest,\n            value: '[[preact-element]]',\n            children:\n              process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n              editor.enabled ? (\n                <ContentSelector {...rest}>\n                  {renderPreactElement(node)}\n                </ContentSelector>\n              ) : (\n                renderPreactElement(node)\n              ),\n          });\n        },\n      };\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, _S, L extends LocalesValues> = T extends {\n  nodeType: NodeType | string;\n  [NodeTypes.INSERTION]: infer I; // Accept strings OR nested nodes like enumerations\n  fields: readonly (infer F)[]; // Infer the exact string literals in the array\n}\n  ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(\n      values: V\n    ) => I extends string\n      ? V[keyof V] extends string | number\n        ? IntlayerNode<string>\n        : IntlayerNode<VNode>\n      : DeepTransformContent<I, L> // Delegate nested nodes (like enumerations) back to the core\n  : never;\n\n/**\n * Check if a value is a Preact VNode\n */\nconst isVNode = (value: any): value is VNode => {\n  return (\n    value !== null &&\n    value !== undefined &&\n    typeof value !== 'string' &&\n    typeof value !== 'number' &&\n    typeof value !== 'boolean'\n  );\n};\n\n/**\n * Split insertion string and join with Preact VNodes\n */\nconst splitAndJoinInsertion = (\n  template: string,\n  values: Record<string, string | number | VNode>\n): VNode => {\n  // Check if any value is a VNode\n  const hasVNode = Object.values(values).some(isVNode);\n\n  if (!hasVNode) {\n    // Simple string replacement\n    return template.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, key) => {\n      const trimmedKey = key.trim();\n      return (values[trimmedKey] ?? '').toString();\n    }) as any;\n  }\n\n  // Split the template by placeholders while keeping the structure\n  const parts: (string | VNode)[] = [];\n  let lastIndex = 0;\n  const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n  let match: RegExpExecArray | null = regex.exec(template);\n\n  while (match !== null) {\n    // Add text before the placeholder\n    if (match.index > lastIndex) {\n      parts.push(template.substring(lastIndex, match.index));\n    }\n\n    // Add the replaced value\n    const key = match[1]?.trim();\n    const value = key && values[key];\n    if (value !== undefined && value !== null) {\n      parts.push(typeof value === 'number' ? String(value) : value);\n    }\n\n    lastIndex = match.index + match[0].length;\n    match = regex.exec(template);\n  }\n\n  // Add remaining text\n  if (lastIndex < template.length) {\n    parts.push(template.substring(lastIndex));\n  }\n\n  // Return as Fragment\n  return h(\n    Fragment,\n    null,\n    ...parts.map((part, index) => h(Fragment, { key: index }, part))\n  );\n};\n\n/** Insertion plugin for Preact. 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              // VNodes cannot be injected into a raw markup string, so string\n              // 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                  | VNode;\n              }) => {\n                const result = splitAndJoinInsertion(transformedResult, values);\n\n                return deepTransformNode(result, {\n                  ...subProps,\n                  plugins: props.plugins,\n                  children: result as any,\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', {}>) => VNode;\n      }\n    >\n  : never;\n\n/**\n * Code-split renderers are loaded with `lazy` rather than a hand-rolled\n * suspender. A node that suspended on the hand-rolled one never recovered once\n * the chunk landed, so every markdown node present on the first paint stayed\n * blank forever; `lazy` implements the suspend/retry handshake correctly.\n */\nconst MarkdownSuspenseRenderer = lazy(() =>\n  markdownRendererModulePromise!.then((modules) => ({\n    default: modules.MarkdownRendererPlugin as FunctionComponent<\n      Record<string, any>\n    >,\n  }))\n);\n\nconst MarkdownMetadataSuspenseRenderer = lazy(() =>\n  markdownRendererModulePromise!.then((modules) => ({\n    default: modules.MarkdownMetadataRenderer as FunctionComponent<\n      Record<string, any>\n    >,\n  }))\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}>\n                      <MarkdownMetadataSuspenseRenderer\n                        {...rest}\n                        metadataKeyPath={props.keyPath}\n                      >\n                        {node}\n                      </MarkdownMetadataSuspenseRenderer>\n                    </ContentSelector>\n                  ) : (\n                    <MarkdownMetadataSuspenseRenderer\n                      {...rest}\n                      metadataKeyPath={props.keyPath}\n                    >\n                      {node}\n                    </MarkdownMetadataSuspenseRenderer>\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?: any) =>\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() as any;\n        },\n      };\n\nexport type MarkdownCond<T> = T extends {\n  nodeType: NodeType | string;\n  [NodeTypes.MARKDOWN]: infer _M;\n  metadata?: infer U;\n  tags?: infer U;\n}\n  ? {\n      use: (components?: HTMLComponents<'permissive', U>) => VNode;\n      metadata: DeepTransformContent<U>;\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\nexport type HTMLPluginCond<T> = T extends {\n  nodeType: NodeType | string;\n  [NodeTypes.HTML]: infer I;\n  tags?: infer U;\n}\n  ? {\n      use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;\n    }\n  : never;\n\nconst HTMLSuspenseRenderer = lazy(() =>\n  htmlRendererModulePromise!.then((HTMLRenderer) => ({\n    default: HTMLRenderer as FunctionComponent<Record<string, any>>,\n  }))\n);\n\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\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        transform: (node: HTMLContent<string>, props) => {\n          const html = node[NodeTypes.HTML];\n          const _tags = node.tags ?? [];\n          // `children` is dropped deliberately: `HTMLRenderer` resolves its\n          // content as `children || html`, so forwarding the raw node here would\n          // shadow the HTML string and render nothing.\n          const { plugins, children: _nodeChildren, ...rest } = props;\n\n          // Type-safe render function that accepts properly typed components\n          const render = (userComponents?: HTMLComponents): VNode =>\n            renderIntlayerNode({\n              ...rest,\n              value: html,\n              children:\n                process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n                editor.enabled\n                  ? h(\n                      ContentSelector,\n                      { ...rest },\n                      h(HTMLSuspenseRenderer, {\n                        ...rest,\n                        html,\n                        components: userComponents,\n                      })\n                    )\n                  : h(HTMLSuspenseRenderer, {\n                      ...rest,\n                      html,\n                      components: userComponents,\n                    }),\n              additionalProps: { use: render },\n            }) as any;\n\n          return render();\n        },\n      };\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {\n  preactNode: PreactNodeCond<T>;\n  preactIntlayerNode: IntlayerNodeCond<T>;\n  preactInsertion: InsertionCond<T, S, L>;\n  preactMarkdown: MarkdownCond<T>;\n  preactHtml: HTMLPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `preact-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  preactNode: true;\n  preactIntlayerNode: true;\n  preactInsertion: true;\n  preactMarkdown: true;\n  preactHtml: 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 Preact 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    translationPlugin(\n      currentLocale,\n      fallback ? internationalization.defaultLocale : undefined\n    ),\n    enumerationPlugin,\n    pluralPlugin(currentLocale),\n    conditionPlugin,\n    nestedPlugin(currentLocale),\n    filePlugin,\n    genderPlugin,\n    selectPlugin,\n    // Always include: handle plain strings/numbers and React elements\n    preactNodePlugins,\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":";;;;;;;;;;;;;;;;AAwCA,MAAM,gCACJ,QAAQ,IAAI,gCAAgC,+CACxC,0CAA4C,MAAM,OAAO;CACvD,wBAAwB,EAAE;CAC1B,0BAA0B,EAAE;AAC9B,EAAE,IACF;AAEN,MAAM,4BACJ,QAAQ,IAAI,4BAA4B,+CACpC,4BAA8B,MAAM,MAAM,EAAE,YAAY,IACxD;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,8CAAe;GACb,eAAe,MAAM;GACrB,SAAS,MAAM;GACf,QAAQ,MAAM;GACd,U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