// import-build-catalog.ts — engine ExportedBuildCatalog → schema BuildCatalogDefinition
export function importBuildCatalog(exported) {
    const fidelity = [];
    if (!exported)
        return { catalog: undefined, fidelity };
    const packId = exported.packId;
    if (packId !== undefined && packId !== null && packId !== '') {
        fidelity.push({
            level: 'dropped', domain: 'builds', severity: 'info',
            fieldPath: 'packId',
            message: `Build catalog packId '${String(packId)}' stripped (editor-only field)`,
            reason: 'pack-id-stripped',
        });
    }
    return {
        catalog: {
            statBudget: exported.statBudget,
            maxTraits: exported.maxTraits,
            requiredFlaws: exported.requiredFlaws,
            archetypes: exported.archetypes.map((a) => ({ ...a, statPriorities: { ...a.statPriorities }, startingTags: [...a.startingTags] })),
            backgrounds: exported.backgrounds.map((b) => ({ ...b, statModifiers: { ...b.statModifiers }, startingTags: [...b.startingTags] })),
            traits: exported.traits.map((t) => ({ ...t, effects: t.effects.map((e) => ({ ...e })) })),
            disciplines: exported.disciplines.map((d) => ({ ...d, passive: { ...d.passive }, drawback: { ...d.drawback } })),
            crossTitles: exported.crossTitles.map((ct) => ({ ...ct, tags: [...ct.tags] })),
            entanglements: exported.entanglements.map((e) => ({ ...e, effects: e.effects.map((ef) => ({ ...ef })) })),
        },
        fidelity,
    };
}
//# sourceMappingURL=import-build-catalog.js.map