import { jsx as o, jsxs as h } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as D, useEnvironment as M } from "@m4l/core";
import { useIsMobile as I } from "@m4l/graphics";
import { useCallback as S } from "react";
import { useModal as g } from "../../../../../../hooks/useModal/index.js";
import { ContentModalSettingStyled as x, DataGridRootStyled as b } from "../../../../slots/DataGridSlot.js";
import { pathIcons as v } from "../../../../icons.js";
import { DICTIONARY as y } from "../../../../dictionary.js";
import { CardDetails as A } from "../../subcomponents/CardDetails/CardDetails.js";
import { ActionsContainer as w } from "../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
import { useDataGrid as O } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
import { WindowBase as T } from "../../../../../WindowBase/WindowBase.js";
import { ActionCancel as _ } from "../../../../../CommonActions/components/ActionCancel/ActionCancel.js";
const q = ({
  columns: i,
  onRowsChange: n,
  rows: t
}) => {
  const { getConfigColumns: r, size: l } = O(), { openModal: a, closeModal: e } = g(), { getLabel: s } = D(), { host_static_assets: m, environment_assets: d } = M(), c = I();
  return S(
    (p) => {
      const f = r("cards"), u = t.findIndex((C) => C === p);
      a({
        initialWidth: 500,
        initialHeight: 680,
        fullScreen: c,
        window: /* @__PURE__ */ o(
          T,
          {
            title: s(y.DETAILS),
            iconUrl: `${m}/${d}/${v.info}`,
            onClose: e,
            className: "detail-modal",
            variant: "outlined",
            emergeType: "modal",
            children: /* @__PURE__ */ h(x, { ownerState: {}, children: [
              /* @__PURE__ */ o(b, { ownerState: {}, children: /* @__PURE__ */ o(
                A,
                {
                  row: p,
                  rows: t,
                  rowIndex: u,
                  columns: i,
                  viewColumnsConfig: f,
                  onRowsChange: n,
                  size: l || "medium"
                }
              ) }),
              /* @__PURE__ */ o(w, { children: /* @__PURE__ */ o(_, { onClick: e }) })
            ] })
          }
        )
      });
    },
    [
      i,
      t,
      n,
      l,
      r,
      a,
      e,
      s,
      m,
      d,
      c
    ]
  );
};
export {
  q as useModalDetail
};
