"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextMerge = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const DataTestData_1 = require("@appglue/common/dist/Common/Data/DataTestData");
const TextMergeConfiguration_1 = require("@appglue/common/dist/TextMerge/TextMergeConfiguration");
const TextMergeBuilder_1 = require("../TextMergeBuilder");
const TextMergeConstants_1 = require("@appglue/common/dist/TextMerge/TextMergeConstants");
const StoryData_1 = require("../../CommonUI/StoryBook/StoryData");
exports.TextMerge = [
    new StoryData_1.StoryNode(() => {
        let definition = new TextMergeConfiguration_1.TextMergeConfiguration();
        definition.inputData = (0, DataTestData_1.getMergeEditorDataDefinition)();
        return (0, jsx_runtime_1.jsx)(TextMergeBuilder_1.TextMergeBuilder, { definition: definition, onChange: () => { } });
    }, "Shared", "Text Merge", "Empty"),
    new StoryData_1.StoryNode(() => {
        let value = {
            blocks: [
                {
                    key: "558fp",
                    text: "Welcome   to my  ",
                    type: "unstyled",
                    depth: 0,
                    inlineStyleRanges: [],
                    entityRanges: [
                        { offset: 8, length: 1, key: 0 },
                        { offset: 16, length: 1, key: 1 },
                    ],
                    data: {},
                },
            ],
            entityMap: {
                "0": {
                    type: TextMergeConstants_1.TextMergeConstants.MERGE_TEXT_ENTITY_TYPE,
                    mutability: "IMMUTABLE",
                    data: {
                        fieldpath: "name",
                        field: {
                            type: "string",
                            name: "name",
                            list: false,
                            valueIsDefault: false,
                            validValues: [],
                        },
                    },
                },
                "1": {
                    type: TextMergeConstants_1.TextMergeConstants.MERGE_TEXT_ENTITY_TYPE,
                    mutability: "IMMUTABLE",
                    data: {
                        fieldpath: "job",
                        field: {
                            type: "string",
                            name: "job",
                            list: false,
                            valueIsDefault: false,
                            validValues: [],
                        },
                    },
                },
            },
        };
        let definition = new TextMergeConfiguration_1.TextMergeConfiguration();
        definition.inputData = (0, DataTestData_1.getMergeEditorDataDefinition)();
        definition.setValue(value);
        return (0, jsx_runtime_1.jsx)(TextMergeBuilder_1.TextMergeBuilder, { definition: definition, value: value, onChange: () => { } });
    }, "Shared", "Text Merge", "Not Empty"),
    new StoryData_1.StoryNode(() => {
        let value = {
            blocks: [
                {
                    key: "558fp",
                    text: "Welcome   to my  ",
                    type: "unstyled",
                    depth: 0,
                    inlineStyleRanges: [],
                    entityRanges: [
                        { offset: 8, length: 1, key: 0 },
                        { offset: 16, length: 1, key: 1 },
                    ],
                    data: {},
                },
            ],
            entityMap: {
                "0": {
                    type: TextMergeConstants_1.TextMergeConstants.MERGE_TEXT_ENTITY_TYPE,
                    mutability: "IMMUTABLE",
                    data: {
                        fieldpath: "name",
                        field: {
                            type: "string",
                            name: "name",
                            list: false,
                            valueIsDefault: false,
                            validValues: [],
                        },
                    },
                },
                "1": {
                    type: TextMergeConstants_1.TextMergeConstants.MERGE_TEXT_ENTITY_TYPE,
                    mutability: "IMMUTABLE",
                    data: {
                        fieldpath: "job",
                        field: {
                            type: "string",
                            name: "job",
                            list: false,
                            valueIsDefault: false,
                            validValues: [],
                        },
                    },
                },
            },
        };
        let definition = new TextMergeConfiguration_1.TextMergeConfiguration();
        definition.inputData = (0, DataTestData_1.getEmptyDataDefinition)();
        return (0, jsx_runtime_1.jsx)(TextMergeBuilder_1.TextMergeBuilder, { definition: definition, value: value, onChange: () => { } });
    }, "Shared", "Text Merge", "Invalid Field"),
    new StoryData_1.StoryNode(() => {
        let definition = new TextMergeConfiguration_1.TextMergeConfiguration();
        definition.inputData = (0, DataTestData_1.getMergeEditorDataDefinition)();
        definition.setValue('<p>Welcome <xfield style="">name</xfield> to my <xfield style="">title</xfield></p>');
        return (0, jsx_runtime_1.jsx)(TextMergeBuilder_1.TextMergeBuilder, { definition: definition, onChange: () => { } });
    }, "Shared", "Text Merge", "From HTML"),
];
//# sourceMappingURL=TextMergeBuilder-stories.js.map