import { jsx as c } from "react/jsx-runtime";
import { forwardRef as p } from "react";
import { u as i, a as d } from "../../index.esm-BQxOvVZs.js";
import m from "../Icons.js";
import { useModalContext as l, useGeneralForm as f } from "../../context/generalContext/index.js";
import { cn as s } from "../../utils/functions.js";
import { ButtonVariants as _ } from "./variants.js";
import "../../context/index.js";
import "../../clsx-7d8NmkQq.js";
import "../../index-xVF7D3FM.js";
const a = p(({ className: n, type: t = "button", variant: o, ...e }, r) => /* @__PURE__ */ c("button", { type: t, className: s(_({ variant: o }), n), ref: r, ...e })), C = ({ className: n, ...t }) => {
  const {
    formState: { isValid: o, isDirty: e }
  } = i();
  return /* @__PURE__ */ c(a, { type: "submit", disabled: !o && e, className: n, ...t });
}, y = ({ className: n, targetId: t, index: o, ...e }) => {
  const { setModal: r } = l();
  return /* @__PURE__ */ c(a, { type: "button", onClick: () => {
    r({
      type: "activities",
      content: {
        activityCode: "",
        ciiu: "",
        index: o
      },
      id: t,
      componentKey: "ActivityModal"
    });
  }, className: s("_flex _justify-center _items-center !_p-2.5 _mt-6", n), ...e, children: /* @__PURE__ */ c(m.SearchIcon, { className: "_h-6 _w-6" }) });
}, b = ({ className: n, targetId: t, ...o }) => {
  const { setModal: e } = l(), r = d({ name: t });
  return /* @__PURE__ */ c(a, { type: "button", onClick: () => {
    e({
      type: "map",
      content: {
        direction: r
      },
      id: t,
      componentKey: "DirectionModal",
      className: "!_max-w-none !_w-fit !_pt-0"
    });
  }, className: s("_flex _justify-center _items-center !_p-2.5 _mt-6", n), ...o, children: /* @__PURE__ */ c(m.LocationIcon, { className: "_h-5 _w-5" }) });
}, k = ({ className: n, ...t }) => {
  const [o] = f((r) => r.cancelCallback);
  return /* @__PURE__ */ c(a, { variant: "error", type: "button", onClick: () => {
    o ? o() : window.close();
  }, className: n, ...t });
}, M = ({ className: n, ...t }) => {
  const { trigger: o } = i();
  return /* @__PURE__ */ c(a, { variant: "bordered", type: "button", onClick: () => {
    o();
  }, className: n, ...t });
}, A = {
  Button: a,
  FormButton: C,
  Activities: y,
  Maps: b,
  CancelButton: k,
  CheckFormButton: M
};
export {
  A as default
};
