"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parserTokens = void 0;
const const_1 = require("../const.js");
exports.parserTokens = {
    [const_1.TableNode.Table]: { name: const_1.TableNode.Table, type: 'block' },
    [const_1.TableNode.Head]: { name: const_1.TableNode.Head, type: 'block' },
    [const_1.TableNode.Body]: { name: const_1.TableNode.Body, type: 'block' },
    [const_1.TableNode.Row]: { name: const_1.TableNode.Row, type: 'block' },
    [const_1.TableNode.HeaderCell]: {
        name: const_1.TableNode.HeaderCell,
        type: 'block',
        getAttrs: getTableCellAttrs,
    },
    [const_1.TableNode.DataCell]: { name: const_1.TableNode.DataCell, type: 'block', getAttrs: getTableCellAttrs },
};
function getTableCellAttrs({ attrs }) {
    const objAttrs = Object.fromEntries(attrs || []);
    let align = const_1.CellAlign.Left;
    if (objAttrs.style) {
        const styles = objAttrs.style.split(';');
        const textAlignStyle = styles.find((str) => str.startsWith('text-align:')) || '';
        [, align = const_1.CellAlign.Left] = textAlignStyle.split(':');
    }
    return { [const_1.TableAttrs.CellAlign]: align };
}
//# sourceMappingURL=parser.js.map
