import { jsx as d } from "../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useDataGridContext as o } from "./hooks/useDataGridContext.js";
import { isValidElement as c, cloneElement as m } from "../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
import { useCallback as f } from "../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import g from "classnames";
function y({
  children: e,
  column: t,
  position: r,
  ...i
}) {
  const { registerCells: a } = o(), n = f(
    (l) => {
      if (!l) return;
      const { width: s } = l.getBoundingClientRect();
      a({ column: t, width: s });
    },
    [t, a]
  );
  return /* @__PURE__ */ d(
    "div",
    {
      role: "cell",
      "data-testid": t,
      className: g("adyen-pe-data-grid__cell", {
        "adyen-pe-data-grid__cell--right": r === "right",
        "adyen-pe-data-grid__cell--center": r === "center"
      }),
      ...i,
      children: e && c(e) ? m(e, {
        ref: n,
        style: { width: "min-content" }
      }) : null
    }
  );
}
export {
  y as default
};
