import { findChildren, findChildrenByType, findParentNodeOfType, hasParentNodeOfType,
// @ts-ignore // TODO: fix cjs build
 } from 'prosemirror-utils';
import { TableNode } from "./const.js";
export const isIntoTable = (state) => hasParentNodeOfType(state.schema.nodes[TableNode.Table])(state.selection);
export const findParentTable = (state) => findParentNodeOfType(state.schema.nodes[TableNode.Table])(state.selection);
export const findParentBody = (state) => findParentNodeOfType(state.schema.nodes[TableNode.Body])(state.selection);
export const findParentRow = (state) => findParentNodeOfType(state.schema.nodes[TableNode.Row])(state.selection);
export const findParentCell = (state) => findParentNodeOfType([
    state.schema.nodes[TableNode.HeaderCell],
    state.schema.nodes[TableNode.DataCell],
])(state.selection);
export const findTableRows = (table, schema) => findChildrenByType(table, schema.nodes[TableNode.Row]);
export const findTableCells = (table, schema) => findChildren(table, (node) => [schema.nodes[TableNode.HeaderCell].name, schema.nodes[TableNode.DataCell].name].includes(node.type.name));
//# sourceMappingURL=helpers.js.map
