import { jsxs as m, Fragment as u, jsx as r } from "react/jsx-runtime";
import { useState as c } from "react";
import { useLoadFrmType as d } from "./hooks/useLoadFiles.js";
import { u as f } from "./useQuery-n4ls1rLk.js";
import i from "./components/AlertDialog/index.js";
import a from "./components/Buttons/index.js";
import { BasicFormProvider as v } from "./components/FormProvider.js";
import l from "./composables/FormInputs.js";
import { formClient as x } from "./config/index.js";
import "./index.esm-Jcyi89ZF.js";
import "./_commonjsHelpers-2ufMB8rV.js";
import "./context/generalContext/index.js";
import "./context/index.js";
import "react-dom";
import "./components/Icons.js";
import "./utils/functions.js";
import "./clsx-7d8NmkQq.js";
import "./utils/components/RenderIf.js";
import "./components/AlertDialog/variants.js";
import "./index-xVF7D3FM.js";
import "./index.esm-BQxOvVZs.js";
import "./components/Buttons/variants.js";
import "./composables/Modal.js";
import "./hooks/useAnimatePresence.js";
import "./SVGVisualElement-aqO4D4Z5.js";
import "./use-unmount-effect-Wy5iLAex.js";
import "./index-T7wQHOux.js";
import "./LayoutGroupContext-3euHzeKi.js";
import "./feature/govco/FormModal.js";
import "./feature/RenderFeatureComponents.js";
import "./index-20bzTFSx.js";
import "./utils/components/RenderEach.js";
import "./components/Inputs/variants.js";
import "./motion-dVICNqWI.js";
import "./axios-f2q_J-wz.js";
const Z = () => {
  const [n, e] = c(!1), { configFrm: o } = d(), s = f(), p = async (t) => {
    await x.put("frmtype", {
      id: "42404B79-6BA6-EE11-B9E7-C87F5406F554",
      name: "formulario test",
      description: "este es un formulario",
      jsx: t.jsx,
      functions: t.functions || "5971536A-6BA6-EE11-B9E7-C87F5406F554"
    }), s.invalidateQueries({ queryKey: ["frmtype"] }), e(!1);
  };
  return o ? /* @__PURE__ */ m(u, { children: [
    /* @__PURE__ */ r("div", { className: "_flex", children: /* @__PURE__ */ r(a.Button, { onClick: () => e(!n), children: "Editar Formulario" }) }),
    /* @__PURE__ */ r(i.AlertDialog, { open: n, children: /* @__PURE__ */ m(i.AlertDialogContent, { variant: { variant: "govco" }, children: [
      /* @__PURE__ */ r(i.AlertDialogHeader, { variants: { variant: "govco" }, closeModal: () => e(!1), children: "Editar formulario" }),
      /* @__PURE__ */ m(
        v,
        {
          className: "_px-2",
          submit: (t) => p(t),
          defaultValue: { jsx: o == null ? void 0 : o.jsx, functions: o == null ? void 0 : o.functions },
          children: [
            /* @__PURE__ */ r(
              l.InputFormCntx,
              {
                currentId: "functions",
                label: "GUID de los esquemas (validación, formulas, etc.)",
                placeholder: "ej: 5971536A-6BA6-EE11-B9E7-C87F5406F554"
              }
            ),
            /* @__PURE__ */ r(l.TextAreaFormCntx, { currentId: "jsx", inputProps: { rows: 15, style: { resize: "none" } }, label: "Plantilla del formulario" }),
            /* @__PURE__ */ r(i.AlertDialogFooter, { variants: { variant: "govco" }, children: /* @__PURE__ */ r(a.FormButton, { children: "Editar" }) })
          ]
        }
      )
    ] }) })
  ] }) : "loading...";
};
export {
  Z as ConfigForm
};
