import { createContext, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
import { flushSync } from "react-dom";
import clsx from "clsx";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region src/utils/colSpanUtils.ts
function getColSpan(column, lastFrozenColumnIndex, args) {
const colSpan = typeof column.colSpan === "function" ? column.colSpan(args) : 1;
if (Number.isInteger(colSpan) && colSpan > 1 && (!column.frozen || column.idx + colSpan - 1 <= lastFrozenColumnIndex)) return colSpan;
return void 0;
}
//#endregion
//#region src/utils/domUtils.ts
function stopPropagation(event) {
event.stopPropagation();
}
function scrollIntoView(element, behavior = "instant") {
element?.scrollIntoView({
inline: "nearest",
block: "nearest",
behavior
});
}
//#endregion
//#region src/utils/eventUtils.ts
function createCellEvent(event) {
let defaultPrevented = false;
const cellEvent = {
...event,
preventGridDefault() {
defaultPrevented = true;
},
isGridDefaultPrevented() {
return defaultPrevented;
}
};
Object.setPrototypeOf(cellEvent, Object.getPrototypeOf(event));
return cellEvent;
}
//#endregion
//#region src/utils/keyboardUtils.ts
const nonInputKeys = new Set([
"Unidentified",
"Alt",
"AltGraph",
"CapsLock",
"Control",
"Fn",
"FnLock",
"Meta",
"NumLock",
"ScrollLock",
"Shift",
"Tab",
"ArrowDown",
"ArrowLeft",
"ArrowRight",
"ArrowUp",
"End",
"Home",
"PageDown",
"PageUp",
"Insert",
"ContextMenu",
"Escape",
"Pause",
"Play",
"PrintScreen",
"F1",
"F3",
"F4",
"F5",
"F6",
"F7",
"F8",
"F9",
"F10",
"F11",
"F12"
]);
function isCtrlKeyHeldDown(e) {
return (e.ctrlKey || e.metaKey) && e.key !== "Control";
}
const vKey = 86;
function isDefaultCellInput(event, isUserHandlingPaste) {
if (isCtrlKeyHeldDown(event) && (event.keyCode !== vKey || isUserHandlingPaste)) return false;
return !nonInputKeys.has(event.key);
}
/**
* By default, the following navigation keys are enabled while an editor is open, under specific conditions:
* - Tab:
* - The editor must be an , a