"use client";
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { Button as Button$1 } from '@base-ui/react/button';
import { XIcon, Loader2 } from 'lucide-react';
import { cva } from 'class-variance-authority';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var buttonVariants = cva(
  "group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-[var(--radius-sm)] border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap shadow-none transition-all outline-none select-none active:scale-[0.98] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground shadow-none hover:bg-[var(--primary-hover)] active:bg-[var(--primary-hover)]",
        outline: "border-border bg-background shadow-none hover:bg-muted hover:text-foreground active:bg-muted active:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 dark:active:bg-input/50",
        secondary: "border border-border bg-card font-medium text-foreground shadow-none hover:border-input-hover hover:bg-zinc-50 active:border-input-hover active:bg-zinc-100 aria-expanded:border-input-hover aria-expanded:bg-zinc-50 aria-expanded:text-foreground dark:bg-secondary dark:text-secondary-foreground dark:hover:bg-[var(--theme-background-button-secondary-hover)] dark:active:bg-[var(--theme-background-button-secondary-hover)] dark:aria-expanded:bg-[var(--theme-background-button-secondary-hover)]",
        soft: "bg-primary/10 text-primary hover:bg-primary/20 active:bg-primary/20 focus-visible:border-primary/40 focus-visible:ring-primary/20 dark:bg-primary/20 dark:hover:bg-primary/30 dark:active:bg-primary/30",
        ghost: "hover:bg-muted hover:text-foreground active:bg-muted active:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 dark:active:bg-muted/50",
        muted: "text-muted-foreground hover:bg-muted hover:text-foreground active:bg-muted active:text-foreground dark:hover:bg-muted/50 dark:active:bg-muted/50",
        destructive: "bg-destructive text-white hover:opacity-95 active:opacity-95 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive dark:text-white dark:hover:opacity-95 dark:active:opacity-95 dark:focus-visible:ring-destructive/40"
      },
      size: {
        "2xs": "h-6 gap-1 rounded-[min(var(--radius-sm),6px)] px-2.5 text-xs in-data-[slot=button-group]:rounded-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
        xs: "h-7 gap-1 rounded-[min(var(--radius-sm),7px)] px-2.5 text-xs in-data-[slot=button-group]:rounded-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
        sm: "h-8 gap-1.5 rounded-[min(var(--radius-sm),8px)] px-3 text-[0.8rem] in-data-[slot=button-group]:rounded-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3.5",
        default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
        md: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
        /** Shift 2.0 top nav: 36px height, 8px vertical / 14px horizontal padding, 14px medium text, 16px icon, 6px gap */
        header: "h-9 min-h-[36px] gap-1.5 py-2 px-3.5 text-sm font-medium has-data-[icon=inline-end]:pr-3.5 has-data-[icon=inline-start]:pl-3.5 [&_svg:not([class*='size-'])]:size-4",
        lg: "h-10 gap-1.5 px-3.5 has-data-[icon=inline-end]:pr-3.5 has-data-[icon=inline-start]:pl-3.5 [&_svg:not([class*='size-'])]:size-4",
        xl: "h-12 gap-2 px-[1.125rem] text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 [&_svg:not([class*='size-'])]:size-5",
        icon: "h-9 w-9 shrink-0 px-0.5 in-data-[slot=button-group]:rounded-[var(--radius-sm)]",
        "icon-2xs": "h-6 w-6 shrink-0 px-0.5 rounded-[min(var(--radius-sm),6px)] in-data-[slot=button-group]:rounded-sm [&_svg:not([class*='size-'])]:size-3",
        "icon-xs": "h-7 w-7 shrink-0 px-0.5 rounded-[min(var(--radius-sm),6px)] in-data-[slot=button-group]:rounded-sm [&_svg:not([class*='size-'])]:size-3",
        "icon-sm": "h-8 w-8 shrink-0 px-0.5 rounded-[min(var(--radius-sm),8px)] in-data-[slot=button-group]:rounded-sm [&_svg:not([class*='size-'])]:size-3.5",
        "icon-lg": "h-10 w-10 shrink-0 px-0.5 in-data-[slot=button-group]:rounded-[var(--radius-sm)] [&_svg:not([class*='size-'])]:size-4",
        "icon-xl": "h-12 w-12 shrink-0 px-0.5 [&_svg:not([class*='size-'])]:size-5"
      }
    },
    defaultVariants: {
      variant: "default",
      size: "default"
    }
  }
);
function Button(_a) {
  var _b = _a, {
    className,
    variant = "default",
    size = "default",
    leadingIcon,
    trailingIcon,
    badge,
    loading = false,
    children,
    disabled
  } = _b, props = __objRest(_b, [
    "className",
    "variant",
    "size",
    "leadingIcon",
    "trailingIcon",
    "badge",
    "loading",
    "children",
    "disabled"
  ]);
  const isDisabled = disabled || loading;
  return /* @__PURE__ */ jsx(
    Button$1,
    __spreadProps(__spreadValues({
      "data-slot": "button",
      "aria-busy": loading || void 0,
      disabled: isDisabled,
      className: cn(buttonVariants({ variant, size, className }))
    }, props), {
      children: loading ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin shrink-0", "aria-hidden": true }) : /* @__PURE__ */ jsxs(Fragment, { children: [
        leadingIcon ? /* @__PURE__ */ jsx("span", { "data-icon": "inline-start", className: "contents", children: leadingIcon }) : null,
        children != null && children !== "" ? /* @__PURE__ */ jsxs(Fragment, { children: [
          children,
          badge != null ? badge : null
        ] }) : null,
        trailingIcon ? /* @__PURE__ */ jsx("span", { "data-icon": "inline-end", className: "contents", children: trailingIcon }) : null
      ] })
    })
  );
}
function Dialog(_a) {
  var props = __objRest(_a, []);
  return /* @__PURE__ */ jsx(Dialog$1.Root, __spreadValues({ "data-slot": "dialog" }, props));
}
function DialogTrigger(_a) {
  var props = __objRest(_a, []);
  return /* @__PURE__ */ jsx(Dialog$1.Trigger, __spreadValues({ "data-slot": "dialog-trigger" }, props));
}
function DialogPortal(_a) {
  var props = __objRest(_a, []);
  return /* @__PURE__ */ jsx(Dialog$1.Portal, __spreadValues({ "data-slot": "dialog-portal" }, props));
}
function DialogClose(_a) {
  var props = __objRest(_a, []);
  return /* @__PURE__ */ jsx(Dialog$1.Close, __spreadValues({ "data-slot": "dialog-close" }, props));
}
function DialogOverlay(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsx(
    Dialog$1.Backdrop,
    __spreadValues({
      "data-slot": "dialog-overlay",
      className: cn(
        "fixed inset-0 isolate z-50 bg-black/10 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 DialogContent(_a) {
  var _b = _a, {
    className,
    children,
    showCloseButton = true,
    overlayClassName
  } = _b, props = __objRest(_b, [
    "className",
    "children",
    "showCloseButton",
    "overlayClassName"
  ]);
  return /* @__PURE__ */ jsxs(DialogPortal, { children: [
    /* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }),
    /* @__PURE__ */ jsxs(
      Dialog$1.Popup,
      __spreadProps(__spreadValues({
        "data-slot": "dialog-content",
        className: cn(
          "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-md border-x-[length:var(--stroke-sm)] border-border bg-background p-4 text-sm shadow-lg duration-100 outline-none 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), {
        children: [
          children,
          showCloseButton && /* @__PURE__ */ jsxs(
            Dialog$1.Close,
            {
              "data-slot": "dialog-close",
              render: /* @__PURE__ */ jsx(
                Button,
                {
                  variant: "ghost",
                  className: "absolute top-2 right-2 text-foreground hover:bg-muted/40 hover:text-foreground active:bg-muted/50 active:text-foreground",
                  size: "icon-sm"
                }
              ),
              children: [
                /* @__PURE__ */ jsx(
                  XIcon,
                  {}
                ),
                /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
              ]
            }
          )
        ]
      })
    )
  ] });
}
function DialogHeader(_a) {
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
  return /* @__PURE__ */ jsx(
    "div",
    __spreadValues({
      "data-slot": "dialog-header",
      className: cn("flex flex-col gap-2", className)
    }, props)
  );
}
function DialogFooter(_a) {
  var _b = _a, {
    className,
    showCloseButton = false,
    children
  } = _b, props = __objRest(_b, [
    "className",
    "showCloseButton",
    "children"
  ]);
  return /* @__PURE__ */ jsxs(
    "div",
    __spreadProps(__spreadValues({
      "data-slot": "dialog-footer",
      className: cn(
        "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-md border-t bg-muted/50 p-4 sm:flex-row sm:justify-end [&_button]:capitalize",
        className
      )
    }, props), {
      children: [
        children,
        showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, { render: /* @__PURE__ */ jsx(Button, { variant: "outline" }), children: "Close" })
      ]
    })
  );
}
function DialogTitle(_a) {
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
  return /* @__PURE__ */ jsx(
    Dialog$1.Title,
    __spreadValues({
      "data-slot": "dialog-title",
      className: cn("text-base font-medium leading-none capitalize", className)
    }, props)
  );
}
function DialogDescription(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsx(
    Dialog$1.Description,
    __spreadValues({
      "data-slot": "dialog-description",
      className: cn(
        "text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
        className
      )
    }, props)
  );
}

export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
//# sourceMappingURL=dialog.js.map
//# sourceMappingURL=dialog.js.map