"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parserTokens = void 0;
const const_1 = require("./const.js");
const getAttrs = (tok) => {
    const nodeAttrs = tok.attrs ? Object.fromEntries(tok.attrs) : {};
    nodeAttrs[const_1.CutAttr.Markup] = tok.markup;
    return nodeAttrs;
};
exports.parserTokens = {
    [const_1.CutNode.Cut]: { name: const_1.CutNode.Cut, type: 'block', getAttrs },
    [const_1.CutNode.CutTitle]: {
        name: const_1.CutNode.CutTitle,
        type: 'block',
        getAttrs: (token, tokens, index) => {
            let dataLine = token.attrGet('data-line');
            if (!dataLine) {
                const prevToken = tokens[index - 1];
                if (prevToken?.type === 'yfm_cut_open') {
                    dataLine = prevToken.attrGet('data-line');
                }
            }
            return { [const_1.CutAttr.Line]: dataLine };
        },
    },
    [const_1.CutNode.CutContent]: { name: const_1.CutNode.CutContent, type: 'block' },
};
//# sourceMappingURL=parser.js.map
