import { jsx, jsxs } from 'react/jsx-runtime';
import { c as cn } from '../utils-BJnb9o5c.js';
import * as React from 'react';
import { u as useDialogRootContext, h as DialogStore, i as useDialogRoot, I as IsDrawerContext, j as DialogRootContext, a as DialogClose, D as DialogPopup, f as DialogDescription, c as DialogBackdrop, b as DialogPortal, e as DialogTitle, g as DialogTrigger } from '../DialogTrigger-a3diAOif.js';
import { C as CommonPopupDataAttributes, t as transitionStatusMapping, p as popupStateMapping } from '../useOpenInteractionType-CVfxIsuz.js';
import { B as Button } from '../button-CePY5zne.js';
import 'react-dom';
import '../floating-ui.utils.dom-Bw_Rc4bg.js';
import '../index-DZXbzIgC.js';
import '../index-CSMSzzKM.js';
import '../with-selector-Dv0G_V_o.js';
import '../index-Bo3AAQJp.js';
import '../index-CfriMyrd.js';
import '../index-BtkPdosV.js';

(function (DialogViewportDataAttributes) {
  /**
   * Present when the dialog is open.
   */
  DialogViewportDataAttributes[DialogViewportDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
  /**
   * Present when the dialog is closed.
   */
  DialogViewportDataAttributes[DialogViewportDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
  /**
   * Present when the dialog is animating in.
   */
  DialogViewportDataAttributes[DialogViewportDataAttributes["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
  /**
   * Present when the dialog is animating out.
   */
  DialogViewportDataAttributes[DialogViewportDataAttributes["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
  /**
   * Present when the dialog is nested within another dialog.
   */
  DialogViewportDataAttributes["nested"] = "data-nested";
  /**
   * Present when the dialog has other open dialogs nested within it.
   */
  DialogViewportDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
  return DialogViewportDataAttributes;
})({});

({
  ...popupStateMapping,
  ...transitionStatusMapping});

/**
 * Groups all parts of the alert dialog.
 * Doesn't render its own HTML element.
 *
 * Documentation: [Base UI Alert Dialog](https://base-ui.com/react/components/alert-dialog)
 */
function AlertDialogRoot(props) {
  const {
    children,
    open: openProp,
    defaultOpen = false,
    onOpenChange,
    onOpenChangeComplete,
    actionsRef,
    handle,
    triggerId: triggerIdProp,
    defaultTriggerId: defaultTriggerIdProp = null
  } = props;
  const parentDialogRootContext = useDialogRootContext(true);
  const nested = Boolean(parentDialogRootContext);
  const store = DialogStore.useStore(handle?.store, {
    open: defaultOpen,
    openProp,
    activeTriggerId: defaultTriggerIdProp,
    triggerIdProp,
    modal: true,
    disablePointerDismissal: true,
    nested,
    role: 'alertdialog'
  });
  store.useControlledProp('openProp', openProp);
  store.useControlledProp('triggerIdProp', triggerIdProp);
  store.useSyncedValue('nested', nested);
  store.useContextCallback('onOpenChange', onOpenChange);
  store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);
  const payload = store.useState('payload');
  useDialogRoot({
    store,
    actionsRef,
    parentContext: parentDialogRootContext?.store.context,
    isDrawer: false});
  const contextValue = React.useMemo(() => ({
    store
  }), [store]);
  return /*#__PURE__*/jsx(IsDrawerContext.Provider, {
    value: false,
    children: /*#__PURE__*/jsx(DialogRootContext.Provider, {
      value: contextValue,
      children: typeof children === 'function' ? children({
        payload
      }) : children
    })
  });
}

function AlertDialog$1({ ...props }) {
  return /* @__PURE__ */ jsx(AlertDialogRoot, { "data-slot": "alert-dialog", ...props });
}
function AlertDialogTrigger$1({ ...props }) {
  return /* @__PURE__ */ jsx(DialogTrigger, { "data-slot": "alert-dialog-trigger", ...props });
}
function AlertDialogPortal$1({ ...props }) {
  return /* @__PURE__ */ jsx(DialogPortal, { "data-slot": "alert-dialog-portal", ...props });
}
function AlertDialogOverlay$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    DialogBackdrop,
    {
      "data-slot": "alert-dialog-overlay",
      className: cn(
        "fixed inset-0 isolate z-50 bg-black/50 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
        className
      ),
      ...props
    }
  );
}
function AlertDialogContent$1({
  className,
  size = "default",
  ...props
}) {
  return /* @__PURE__ */ jsxs(AlertDialogPortal$1, { children: [
    /* @__PURE__ */ jsx(AlertDialogOverlay$1, { forceRender: true }),
    /* @__PURE__ */ jsx(
      DialogPopup,
      {
        "data-slot": "alert-dialog-content",
        "data-size": size,
        className: cn(
          "group/alert-dialog-content fixed top-1/2 start-1/2 z-50 grid w-full -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
          className
        ),
        ...props
      }
    )
  ] });
}
function AlertDialogHeader$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    "div",
    {
      "data-slot": "alert-dialog-header",
      className: cn(
        "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-start sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
        className
      ),
      ...props
    }
  );
}
function AlertDialogFooter$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    "div",
    {
      "data-slot": "alert-dialog-footer",
      className: cn(
        "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
        className
      ),
      ...props
    }
  );
}
function AlertDialogMedia$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    "div",
    {
      "data-slot": "alert-dialog-media",
      className: cn(
        "mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
        className
      ),
      ...props
    }
  );
}
function AlertDialogTitle$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    DialogTitle,
    {
      "data-slot": "alert-dialog-title",
      className: cn(
        "text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
        className
      ),
      ...props
    }
  );
}
function AlertDialogDescription$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    DialogDescription,
    {
      "data-slot": "alert-dialog-description",
      className: cn(
        "text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
        className
      ),
      ...props
    }
  );
}
function AlertDialogAction$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    Button,
    {
      "data-slot": "alert-dialog-action",
      className: cn(className),
      ...props
    }
  );
}
function AlertDialogCancel$1({
  className,
  variant = "outline",
  size = "default",
  ...props
}) {
  return /* @__PURE__ */ jsx(
    DialogClose,
    {
      "data-slot": "alert-dialog-cancel",
      className: cn(className),
      render: /* @__PURE__ */ jsx(Button, { variant, size }),
      ...props
    }
  );
}

const AlertDialog = (props) => /* @__PURE__ */ jsx(AlertDialog$1, { ...props });
const AlertDialogAction = (props) => /* @__PURE__ */ jsx(AlertDialogAction$1, { ...props });
const AlertDialogCancel = (props) => /* @__PURE__ */ jsx(AlertDialogCancel$1, { ...props });
const AlertDialogContent = (props) => /* @__PURE__ */ jsx(AlertDialogContent$1, { ...props });
const AlertDialogDescription = (props) => /* @__PURE__ */ jsx(AlertDialogDescription$1, { ...props });
const AlertDialogFooter = ({
  className,
  ...props
}) => /* @__PURE__ */ jsx(
  AlertDialogFooter$1,
  {
    className: cn("border-border", className),
    ...props
  }
);
const AlertDialogHeader = (props) => /* @__PURE__ */ jsx(AlertDialogHeader$1, { ...props });
const AlertDialogMedia = (props) => /* @__PURE__ */ jsx(AlertDialogMedia$1, { ...props });
const AlertDialogOverlay = (props) => /* @__PURE__ */ jsx(AlertDialogOverlay$1, { ...props });
const AlertDialogPortal = (props) => /* @__PURE__ */ jsx(AlertDialogPortal$1, { ...props });
const AlertDialogTitle = (props) => /* @__PURE__ */ jsx(AlertDialogTitle$1, { ...props });
const AlertDialogTrigger = (props) => /* @__PURE__ */ jsx(AlertDialogTrigger$1, { ...props });

export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
//# sourceMappingURL=AlertDialog.js.map
