{"version":3,"file":"getDefaultNode.mjs","names":[],"sources":["../../../src/dictionaryManipulator/getDefaultNode.ts"],"sourcesContent":["import type { ContentNode } from '@intlayer/types/dictionary';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nimport type { NodeType } from '@intlayer/types/nodeType';\nimport * as NodeTypes from '@intlayer/types/nodeType';\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 NodeTypes.TRANSLATION:\n      return {\n        nodeType: NodeTypes.TRANSLATION,\n        [NodeTypes.TRANSLATION]: Object.assign(\n          {},\n          ...locales.map((locale) => ({\n            [locale]: structuredClone(clonedContent) ?? '',\n          }))\n        ),\n      } as ContentNode;\n\n    case NodeTypes.ENUMERATION:\n      return {\n        nodeType: NodeTypes.ENUMERATION,\n        [NodeTypes.ENUMERATION]: {\n          '1': clonedContent ?? '',\n        },\n      } as ContentNode;\n\n    case NodeTypes.PLURAL:\n      return {\n        nodeType: NodeTypes.PLURAL,\n        [NodeTypes.PLURAL]: {\n          one: clonedContent ?? '',\n          other: clonedContent ?? '',\n        },\n      } as ContentNode;\n\n    case NodeTypes.CONDITION:\n      return {\n        nodeType: NodeTypes.CONDITION,\n        [NodeTypes.CONDITION]: {\n          true: clonedContent ?? '',\n          false: clonedContent ?? '',\n        },\n      } as ContentNode;\n\n    case NodeTypes.INSERTION:\n      return {\n        nodeType: NodeTypes.INSERTION,\n        [NodeTypes.INSERTION]: {\n          insertion: clonedContent ?? '',\n        },\n      } as unknown as ContentNode;\n\n    case NodeTypes.NESTED:\n      return {\n        nodeType: NodeTypes.NESTED,\n        [NodeTypes.NESTED]: {\n          dictionaryKey: '',\n        },\n      } as ContentNode;\n\n    case NodeTypes.MARKDOWN:\n      return {\n        nodeType: NodeTypes.MARKDOWN,\n        [NodeTypes.MARKDOWN]: clonedContent ?? '',\n      } as ContentNode;\n\n    case NodeTypes.HTML:\n      return {\n        nodeType: NodeTypes.HTML,\n        [NodeTypes.HTML]: clonedContent ?? '',\n        customComponents: [],\n      } as ContentNode;\n\n    case NodeTypes.FILE:\n      return {\n        nodeType: NodeTypes.FILE,\n        [NodeTypes.FILE]: clonedContent ?? '',\n      } as ContentNode;\n\n    case NodeTypes.OBJECT:\n      return {\n        newKey: clonedContent ?? '',\n      } as unknown as ContentNode;\n\n    case NodeTypes.ARRAY:\n      return [clonedContent ?? ''] as unknown as ContentNode;\n\n    case NodeTypes.TEXT:\n      return clonedContent ?? '';\n\n    case NodeTypes.NUMBER:\n      return clonedContent ?? 0;\n\n    case NodeTypes.BOOLEAN:\n      return clonedContent ?? true;\n\n    default:\n      return clonedContent ?? '';\n  }\n};\n"],"mappings":";;;AAMA,MAAa,kBACX,UACA,SACA,YACgB;CAChB,MAAM,gBAAgB,gBAAgB,QAAQ;AAC9C,SAAQ,UAAR;EACE,KAAK,UAAU,YACb,QAAO;GACL,UAAU,UAAU;IACnB,UAAU,cAAc,OAAO,OAC9B,EAAE,EACF,GAAG,QAAQ,KAAK,YAAY,GACzB,SAAS,gBAAgB,cAAc,IAAI,IAC7C,EAAE,CACJ;GACF;EAEH,KAAK,UAAU,YACb,QAAO;GACL,UAAU,UAAU;IACnB,UAAU,cAAc,EACvB,KAAK,iBAAiB,IACvB;GACF;EAEH,KAAK,UAAU,OACb,QAAO;GACL,UAAU,UAAU;IACnB,UAAU,SAAS;IAClB,KAAK,iBAAiB;IACtB,OAAO,iBAAiB;IACzB;GACF;EAEH,KAAK,UAAU,UACb,QAAO;GACL,UAAU,UAAU;IACnB,UAAU,YAAY;IACrB,MAAM,iBAAiB;IACvB,OAAO,iBAAiB;IACzB;GACF;EAEH,KAAK,UAAU,UACb,QAAO;GACL,UAAU,UAAU;IACnB,UAAU,YAAY,EACrB,WAAW,iBAAiB,IAC7B;GACF;EAEH,KAAK,UAAU,OACb,QAAO;GACL,UAAU,UAAU;IACnB,UAAU,SAAS,EAClB,eAAe,IA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