"use client";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { Button } from "@open-mercato/ui/primitives/button";
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle
} from "@open-mercato/ui/primitives/dialog";
function MessageDetailDialogs(props) {
  const t = useT();
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      Dialog,
      {
        open: Boolean(props.pendingActionConfirmation),
        onOpenChange: (open) => {
          if (!open) props.setPendingActionConfirmation(null);
        },
        children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", onKeyDown: props.handleActionConfirmDialogKeyDown, children: [
          /* @__PURE__ */ jsxs(DialogHeader, { children: [
            /* @__PURE__ */ jsx(DialogTitle, { children: t("messages.confirm.actionTitle", "Confirm action") }),
            /* @__PURE__ */ jsx(DialogDescription, { children: props.pendingActionConfirmation?.action.confirmMessage || t("messages.confirm.action", "Are you sure you want to continue?") })
          ] }),
          /* @__PURE__ */ jsxs(DialogFooter, { children: [
            /* @__PURE__ */ jsx(
              Button,
              {
                type: "button",
                variant: "outline",
                onClick: () => props.setPendingActionConfirmation(null),
                disabled: props.executingActionId !== null,
                children: t("common.cancel", "Cancel")
              }
            ),
            /* @__PURE__ */ jsx(
              Button,
              {
                type: "button",
                variant: props.pendingActionConfirmation?.action.variant === "destructive" ? "destructive" : "default",
                onClick: () => void props.handleConfirmPendingAction(),
                disabled: props.executingActionId !== null,
                children: props.executingActionId === props.pendingActionConfirmation?.action.id ? t("messages.actions.executing", "Executing...") : t(
                  props.pendingActionConfirmation?.action.labelKey || props.pendingActionConfirmation?.action.label || "messages.confirm.actionConfirm",
                  props.pendingActionConfirmation?.action.label || t("messages.confirm.actionConfirm", "Confirm")
                )
              }
            )
          ] })
        ] })
      }
    ),
    /* @__PURE__ */ jsx(
      Dialog,
      {
        open: props.deleteConfirmationOpen,
        onOpenChange: props.setDeleteConfirmationOpen,
        children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", onKeyDown: props.handleDeleteDialogKeyDown, children: [
          /* @__PURE__ */ jsxs(DialogHeader, { children: [
            /* @__PURE__ */ jsx(DialogTitle, { children: t("messages.confirm.deleteTitle", "Delete message") }),
            /* @__PURE__ */ jsx(DialogDescription, { children: t("messages.confirm.delete", "Delete this message from your view?") })
          ] }),
          /* @__PURE__ */ jsxs(DialogFooter, { children: [
            /* @__PURE__ */ jsx(
              Button,
              {
                type: "button",
                variant: "outline",
                onClick: () => props.setDeleteConfirmationOpen(false),
                disabled: props.updatingState,
                children: t("common.cancel", "Cancel")
              }
            ),
            /* @__PURE__ */ jsx(
              Button,
              {
                type: "button",
                variant: "destructive",
                onClick: () => void props.handleDelete(),
                disabled: props.updatingState,
                children: t("messages.actions.delete", "Delete")
              }
            )
          ] })
        ] })
      }
    )
  ] });
}
export {
  MessageDetailDialogs
};
//# sourceMappingURL=dialogs.js.map
