{"version":3,"sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type ContentNode, NodeType } from '../types';\n\nexport const getDefaultNode = (\n  nodeType: NodeType,\n  locales: LocalesValues[],\n  content?: ContentNode\n): ContentNode => {\n  const clonedContent = structuredClone(content);\n  switch (nodeType) {\n    case NodeType.Translation:\n      return {\n        nodeType: NodeType.Translation,\n        [NodeType.Translation]: Object.assign(\n          {},\n          ...locales.map((locale) => ({\n            [locale]: structuredClone(clonedContent) ?? '',\n          }))\n        ),\n      } as ContentNode;\n\n    case NodeType.Enumeration:\n      return {\n        nodeType: NodeType.Enumeration,\n        [NodeType.Enumeration]: {\n          '1': clonedContent ?? '',\n        },\n      } as ContentNode;\n\n    case NodeType.Condition:\n      return {\n        nodeType: NodeType.Condition,\n        [NodeType.Condition]: {\n          true: clonedContent ?? '',\n          false: clonedContent ?? '',\n        },\n      } as ContentNode;\n\n    case NodeType.Insertion:\n      return {\n        nodeType: NodeType.Insertion,\n        [NodeType.Insertion]: {\n          insertion: clonedContent ?? '',\n        },\n      } as unknown as ContentNode;\n\n    case NodeType.Nested:\n      return {\n        nodeType: NodeType.Nested,\n        [NodeType.Nested]: {\n          dictionaryKey: '',\n        },\n      } as ContentNode;\n\n    case NodeType.Markdown:\n      return {\n        nodeType: NodeType.Markdown,\n        [NodeType.Markdown]: clonedContent ?? '',\n      } as ContentNode;\n\n    case NodeType.File:\n      return {\n        nodeType: NodeType.File,\n        [NodeType.File]: clonedContent ?? '',\n      } as ContentNode;\n\n    case NodeType.Object:\n      return {\n        newKey: clonedContent ?? '',\n      } as unknown as ContentNode;\n\n    case NodeType.Array:\n      return [clonedContent ?? ''] as unknown as ContentNode;\n\n    case NodeType.Text:\n      return clonedContent ?? '';\n\n    case NodeType.Number:\n      return clonedContent ?? 0;\n\n    case NodeType.Boolean:\n      return clonedContent ?? true;\n\n    default:\n      return clonedContent ?? '';\n  }\n};\n"],"mappings":";;;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