"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializerTokens = void 0;
const nodes_1 = require("../../../../utils/nodes.js");
const placeholder_1 = require("../../../../utils/placeholder.js");
const const_1 = require("./const.js");
exports.serializerTokens = {
    [const_1.TabsNode.Tab]: (state, node) => {
        state.renderInline(node);
    },
    [const_1.TabsNode.TabPanel]: (state, node) => {
        state.renderContent(node);
    },
    [const_1.TabsNode.Tabs]: (state, node) => {
        state.write('{% list tabs %}');
        state.write('\n');
        state.write('\n');
        const children = [];
        node.content.forEach((a) => {
            children.push(a);
        });
        const tabList = children[0].content;
        tabList.forEach((tab, _, i) => {
            state.write('- ' + (tab.textContent || (0, placeholder_1.getPlaceholderContent)(tab)));
            state.write('\n');
            state.write('\n');
            if (children[i + 1])
                state.renderList(children[i + 1], '  ', () => '  ');
        });
        state.write('{% endlist %}');
        state.closeBlock(node);
    },
    [const_1.TabsNode.TabsList]: (state, node) => {
        state.renderList(node, '  ', () => (node.attrs.bullet || '-') + ' ');
    },
    [const_1.TabsNode.RadioTabs]: (state, node) => {
        state.write('{% list tabs radio %}');
        state.write('\n');
        state.write('\n');
        const children = (0, nodes_1.getChildrenOfNode)(node);
        for (let i = 0; i < children.length; i++) {
            const child = children[i];
            if (child.node.type.name !== const_1.TabsNode.RadioTab)
                continue;
            state.write('- ' + (child.node.textContent || (0, placeholder_1.getPlaceholderContent)(child.node.lastChild)));
            state.write('\n');
            state.write('\n');
            const nextChild = children[i + 1];
            if (nextChild.node.type.name !== const_1.TabsNode.TabPanel)
                continue;
            state.renderList(nextChild.node, '  ', () => '  ');
        }
        state.write('{% endlist %}');
        state.closeBlock(node);
    },
    [const_1.TabsNode.RadioTab]: (state, node) => {
        state.renderInline(node);
    },
    [const_1.TabsNode.RadioTabInput]: () => { },
    [const_1.TabsNode.RadioTabLabel]: (state, node) => {
        state.renderInline(node);
    },
};
//# sourceMappingURL=serializer.js.map
