"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.YfmCutSpecs = exports.cutContentType = exports.cutTitleType = exports.cutType = exports.CutNode = exports.CutAttr = void 0;
const cut_extension_1 = require("@diplodoc/cut-extension");
const const_1 = require("./const.js");
const parser_1 = require("./parser.js");
const schema_1 = require("./schema.js");
const serializer_1 = require("./serializer.js");
var const_2 = require("./const.js");
Object.defineProperty(exports, "CutAttr", { enumerable: true, get: function () { return const_2.CutAttr; } });
Object.defineProperty(exports, "CutNode", { enumerable: true, get: function () { return const_2.CutNode; } });
Object.defineProperty(exports, "cutType", { enumerable: true, get: function () { return const_2.cutType; } });
Object.defineProperty(exports, "cutTitleType", { enumerable: true, get: function () { return const_2.cutTitleType; } });
Object.defineProperty(exports, "cutContentType", { enumerable: true, get: function () { return const_2.cutContentType; } });
const YfmCutSpecs = (builder, opts) => {
    const schemaSpecs = (0, schema_1.getSchemaSpecs)(opts, builder.context.get('placeholder'));
    const directiveSyntax = builder.context.get('directiveSyntax');
    const serializerTokens = (0, serializer_1.getSerializerTokens)({ directiveSyntax });
    builder
        .configureMd((md) => md.use((0, cut_extension_1.transform)({
        bundle: false,
        directiveSyntax: directiveSyntax?.mdPluginValueFor('yfmCut'),
    })))
        .addNode(const_1.CutNode.Cut, () => ({
        spec: schemaSpecs[const_1.CutNode.Cut],
        toMd: serializerTokens[const_1.CutNode.Cut],
        fromMd: {
            tokenSpec: parser_1.parserTokens[const_1.CutNode.Cut],
        },
        view: opts.cutView,
    }))
        .addNode(const_1.CutNode.CutTitle, () => ({
        spec: schemaSpecs[const_1.CutNode.CutTitle],
        toMd: serializerTokens[const_1.CutNode.CutTitle],
        fromMd: {
            tokenSpec: parser_1.parserTokens[const_1.CutNode.CutTitle],
        },
        view: opts.cutTitleView,
    }))
        .addNode(const_1.CutNode.CutContent, () => ({
        spec: schemaSpecs[const_1.CutNode.CutContent],
        toMd: serializerTokens[const_1.CutNode.CutContent],
        fromMd: {
            tokenSpec: parser_1.parserTokens[const_1.CutNode.CutContent],
        },
        view: opts.cutContentView,
    }));
};
exports.YfmCutSpecs = YfmCutSpecs;
//# sourceMappingURL=index.js.map
