"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.syncListMarkerFormatStyle = syncListMarkerFormatStyle;
const list_1 = require("@lexical/list");
const selection_1 = require("@lexical/selection");
const utils_1 = require("@lexical/utils");
const lexical_1 = require("lexical");
function isInsideListItem(node) {
    return (0, list_1.$isListItemNode)(node) || (0, utils_1.$findMatchingParent)(node, (parent) => (0, list_1.$isListItemNode)(parent)) !== null;
}
function syncListMarkerFormatStyle(editor, patch) {
    editor.update(() => {
        const selection = (0, lexical_1.$getSelection)();
        if (!(0, lexical_1.$isRangeSelection)(selection)) {
            return;
        }
        const nodes = selection.getNodes();
        const isListSelection = nodes.length > 0
            ? nodes.some((node) => isInsideListItem(node))
            : isInsideListItem(selection.anchor.getNode()) || isInsideListItem(selection.focus.getNode());
        if (!isListSelection) {
            return;
        }
        (0, selection_1.$patchStyleText)(selection, patch);
    });
}
//# sourceMappingURL=list-marker-format.js.map