import { jsxs as l, jsx as e } from "react/jsx-runtime";
import { pb3 as y } from "./index-general.module.js";
import { classNames as M } from "./index-classNames.js";
import { IconNames as I } from "./index-IconNames.js";
import { Modal as N } from "./index-Modal.js";
import { ModalBody as k } from "./index-ModalBody.js";
import { ModalFooter as C } from "./index-ModalFooter.js";
import { ModalHeader as F } from "./index-ModalHeader.js";
import { Text as n, TextTypes as c } from "./index-Text.js";
import { useState as L, useEffect as O } from "react";
import S from "./index-BigAssEditModal.module.scss.js";
const G = (m) => {
  const {
    testId: d,
    title: f,
    description: p,
    children: v,
    saveCallback: t,
    cancelCallback: o,
    savable: b,
    close: s,
    closeOnSave: g = !0,
    savingInProgress: a,
    bodyClassName: u
  } = m, [i, r] = L(!1);
  O(() => {
    i && !a && (r(!1), g && s({
      isOk: !0
    }));
  }, [a]);
  const x = () => {
    r(!0), t && t();
  }, h = () => {
    o && o(), s({
      isOk: !1
    });
  };
  return l(N, {
    testId: d,
    fullscreen: !0,
    children: [l(F, {
      children: [e(n, {
        type: c.heading1,
        className: y,
        children: f
      }), e(n, {
        type: c.textIntro,
        children: p
      })]
    }), e(k, {
      className: M(S.body, u),
      children: v
    }), e(C, {
      buttonsPosition: "between",
      positive: {
        cta: x,
        text: "Save",
        icon: I.save,
        isLoading: i,
        disabled: !b
      },
      negative: {
        cta: h,
        text: "Cancel"
      }
    })]
  });
};
export {
  G as BigAssEditModal
};
