import { jsx as r } from "../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useEffect as f } from "../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { popoverUtil as l } from "../Popover/utils/popoverUtil.js";
import d from "../Modal/ModalContent/ModalContent.js";
import e from "../../../core/Context/preact/useCoreContext.js";
import u from "../Modal/Modal.js";
const z = ({
  children: m,
  className: n,
  ariaLabelKey: s,
  selectedDetail: o,
  resetDetails: a,
  dataCustomization: p
}) => {
  const { i18n: i } = e(), t = !!o;
  return f(() => {
    t && l.closeAll();
  }, [t]), /* @__PURE__ */ r("div", { className: n, children: [
    m,
    o && /* @__PURE__ */ r(
      u,
      {
        title: o?.title ? i.get(o.title) : void 0,
        isOpen: !!o,
        "aria-label": i.get(s),
        onClose: a,
        isDismissible: !0,
        headerWithBorder: !1,
        size: o?.modalSize ?? "large",
        children: o && /* @__PURE__ */ r(d, { dataCustomization: { details: p }, ...o?.selection })
      }
    )
  ] });
};
export {
  z as DataDetailsModal
};
