'use client';

// src/components/Toast/Toast.tsx
import React2 from "react";
import { cn as cn15 } from "@paalan/react-shared/lib";

// src/base/Box/Box.tsx
import { StyledComponent, WithStyledComponent } from "@paalan/react-shared/system";
import { forwardRef } from "@paalan/react-shared/utils";
import { jsx } from "react/jsx-runtime";
var Box = forwardRef((props, ref) => {
  return /* @__PURE__ */ jsx(StyledComponent, { ...props, ref });
});
Box.withComponent = WithStyledComponent;

// src/base/Center/Center.tsx
import { cn } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef2 } from "@paalan/react-shared/utils";
import { jsx as jsx2 } from "react/jsx-runtime";
var Center = forwardRef2((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx2(Box, { className: cn("flex items-center justify-center", className), ...restProps, ref, children });
});

// src/base/Container/Container.tsx
import { cn as cn2 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef3 } from "@paalan/react-shared/utils";
import { jsx as jsx3 } from "react/jsx-runtime";
var Container = forwardRef3((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx3(Box, { className: cn2("container", className), ...restProps, ref, children });
});

// src/base/Flex/Flex.tsx
import { cn as cn3 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef4 } from "@paalan/react-shared/utils";
import { jsx as jsx4 } from "react/jsx-runtime";
var Flex = forwardRef4((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx4(Box, { className: cn3("flex", className), ...restProps, ref, children });
});

// src/base/Grid/Grid.tsx
import { cn as cn4 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef5 } from "@paalan/react-shared/utils";
import { jsx as jsx5 } from "react/jsx-runtime";
var Grid = forwardRef5((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx5(Box, { className: cn4("grid", className), ...restProps, ref, children });
});
var GridItem = forwardRef5((props, ref) => {
  const { children, ...restProps } = props;
  return /* @__PURE__ */ jsx5(Box, { ...restProps, ref, children });
});

// src/base/HStack/HStack.tsx
import { cn as cn5 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef6 } from "@paalan/react-shared/utils";
import { jsx as jsx6 } from "react/jsx-runtime";
var HStack = forwardRef6((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx6(Box, { className: cn5("flex flex-row items-center gap-2", className), ...restProps, ref, children });
});

// src/base/Heading/Heading.tsx
import { cn as cn6 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef7 } from "@paalan/react-shared/utils";
import { jsx as jsx7 } from "react/jsx-runtime";
var headingSizes = {
  h1: "text-3xl font-bold",
  h2: "text-2xl font-bold",
  h3: "text-xl font-semibold",
  h4: "text-lg font-semibold",
  h5: "text-base font-semibold",
  h6: "text-sm font-semibold"
};
var Heading = forwardRef7((props, ref) => {
  const { children, as: headTag = "h1", className, ...restProps } = props;
  const size = headingSizes[headTag];
  return /* @__PURE__ */ jsx7(Box, { as: headTag, ...restProps, ref, className: cn6(size, className), children });
});

// src/base/Paper/Paper.tsx
import { cn as cn7 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef8 } from "@paalan/react-shared/utils";
import { cva } from "class-variance-authority";
import { jsx as jsx8 } from "react/jsx-runtime";
var paperVariants = cva("bg-background text-foreground", {
  variants: {
    shadow: {
      default: "shadow",
      sm: "shadow-sm",
      md: "shadow-md",
      lg: "shadow-lg",
      xl: "shadow-xl",
      "2xl": "shadow-2xl",
      inner: "shadow-inner",
      none: "shadow-none"
    }
  },
  defaultVariants: {
    shadow: "default"
  }
});
var Paper = forwardRef8(
  ({ withBorder, shadow, className, ...props }, ref) => {
    return /* @__PURE__ */ jsx8(
      Box,
      {
        ref,
        className: cn7(paperVariants({ shadow }), withBorder ? "border border-border" : "", className),
        ...props
      }
    );
  }
);

// src/base/Portal/Portal.tsx
import { forwardRef as forwardRef9, useRef, useState } from "react";
import { useIsomorphicEffect } from "@paalan/react-hooks";
import { assignRef } from "@paalan/react-shared/utils";
import { createPortal } from "react-dom";
import { Fragment, jsx as jsx9 } from "react/jsx-runtime";
var createPortalNode = (props) => {
  const node = document.createElement("div");
  node.setAttribute("data-portal", "true");
  if (typeof props.className === "string") {
    node.classList.add(...props.className.split(" "));
  }
  if (typeof props.style === "object") {
    Object.assign(node.style, props.style);
  }
  if (typeof props.id === "string") {
    node.setAttribute("id", props.id);
  }
  return node;
};
var defaultProps = {};
var Portal = forwardRef9((props, ref) => {
  const { children, target, ...others } = { ...defaultProps, ...props };
  const [mounted, setMounted] = useState(false);
  const nodeRef = useRef(null);
  useIsomorphicEffect(() => {
    setMounted(true);
    nodeRef.current = !target ? createPortalNode(others) : typeof target === "string" ? document.querySelector(target) : target;
    if (!nodeRef.current) return;
    assignRef(ref, nodeRef.current);
    if (!target && nodeRef.current) {
      document.body.appendChild(nodeRef.current);
    }
    return () => {
      if (!target && nodeRef.current) {
        document.body.removeChild(nodeRef.current);
      }
    };
  }, [target]);
  if (!mounted || !nodeRef.current) {
    return null;
  }
  return createPortal(/* @__PURE__ */ jsx9(Fragment, { children }), nodeRef.current);
});
Portal.displayName = "Portal";

// src/base/Stack/Stack.tsx
import { cn as cn8 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef10 } from "@paalan/react-shared/utils";
import { jsx as jsx10 } from "react/jsx-runtime";
var Stack = forwardRef10((props, ref) => {
  const { children, className, direction, ...restProps } = props;
  return /* @__PURE__ */ jsx10(Box, { className: cn8("flex flex-col gap-2", className), flexDirection: direction, ...restProps, ref, children });
});

// src/base/Text/Text.tsx
import { cn as cn9 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef11 } from "@paalan/react-shared/utils";
import { jsx as jsx11 } from "react/jsx-runtime";
var Text = forwardRef11((props, ref) => {
  const { children, className, as = "p", ...restProps } = props;
  return /* @__PURE__ */ jsx11(Box, { as, ref, className: cn9("", className), ...restProps, children });
});

// src/base/Typography/Typography.tsx
import { cn as cn10 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef12 } from "@paalan/react-shared/utils";
import { jsx as jsx12 } from "react/jsx-runtime";
var H1 = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "h1",
    ref,
    className: cn10("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl", className),
    ...props
  }
));
H1.displayName = "H1";
var H2 = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "h2",
    ref,
    className: cn10(
      "mt-10 scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0",
      className
    ),
    ...props
  }
));
H2.displayName = "H2";
var H3 = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "h3",
    ref,
    className: cn10("mt-8 scroll-m-20 text-2xl font-semibold tracking-tight", className),
    ...props
  }
));
H3.displayName = "H3";
var H4 = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "h4", ref, className: cn10("scroll-m-20 text-xl font-semibold tracking-tight", className), ...props }));
H4.displayName = "H4";
var H5 = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "h5", ref, className: cn10("scroll-m-20 text-lg font-semibold tracking-tight", className), ...props }));
H5.displayName = "H5";
var H6 = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "h6", ref, className: cn10("scroll-m-20 text-base font-semibold tracking-tight", className), ...props }));
H6.displayName = "H6";
var P = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "p", ref, className: cn10("leading-7 [&:not(:first-child)]:mt-4", className), ...props }));
P.displayName = "P";
var BlockQuote = forwardRef12(
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
    Box,
    {
      as: "blockquote",
      ref,
      className: cn10(
        "mt-6 border-l-2 border-slate-300 pl-6 italic text-slate-800 dark:border-slate-600 dark:text-slate-200",
        className
      ),
      ...props
    }
  )
);
BlockQuote.displayName = "BlockQuote";
var TableLayout = forwardRef12(
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "table", ref, className: cn10("w-full", className), ...props })
);
TableLayout.displayName = "Table";
var THead = forwardRef12(
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "thead", ref, className: cn10("", className), ...props })
);
THead.displayName = "THead";
var TBody = forwardRef12(
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "tbody", ref, className: cn10("", className), ...props })
);
TBody.displayName = "TBody";
var TR = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "tr",
    ref,
    className: cn10(
      "m-0 border-t border-slate-300 p-0 even:bg-slate-100 dark:border-slate-700 dark:even:bg-slate-800",
      className
    ),
    ...props
  }
));
TR.displayName = "TR";
var TD = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "td",
    ref,
    className: cn10(
      "border border-slate-200 px-4 py-2 text-left dark:border-slate-700 [&[align=center]]:text-center [&[align=right]]:text-right",
      className
    ),
    ...props
  }
));
TD.displayName = "TD";
var TH = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "th",
    ref,
    className: cn10(
      "border border-slate-200 px-4 py-2 text-left font-bold dark:border-slate-700 [&[align=center]]:text-center [&[align=right]]:text-right",
      className
    ),
    ...props
  }
));
TH.displayName = "TH";
var UL = forwardRef12(({ className, unstyled = false, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "ul",
    ref,
    className: cn10(
      {
        "m-4 list-disc [&>li]:mt-2": !unstyled
      },
      className
    ),
    ...props
  }
));
UL.displayName = "UL";
var OL = forwardRef12(({ className, unstyled = false, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "ol",
    ref,
    className: cn10(
      {
        "m-4 list-decimal [&>li]:mt-2": !unstyled
      },
      className
    ),
    ...props
  }
));
OL.displayName = "OL";
var LI = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "li", ref, className: cn10("", className), ...props }));
LI.displayName = "LI";
var Code = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
  Box,
  {
    as: "code",
    ref,
    className: cn10("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-normal", className),
    ...props
  }
));
Code.displayName = "Code";
var Lead = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "p", ref, className: cn10("text-xl text-muted-foreground", className), ...props }));
Lead.displayName = "Lead";
var Large = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "div", ref, className: cn10("text-lg font-semibold", className), ...props }));
Large.displayName = "Large";
var Small = forwardRef12(
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "small", ref, className: cn10("text-sm font-medium leading-none", className), ...props })
);
Small.displayName = "Small";
var Subtle = forwardRef12(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "p", ref, className: cn10("text-sm text-muted-foreground", className), ...props }));
Subtle.displayName = "Subtle";
var Strong = forwardRef12(
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx12(Box, { as: "strong", ref, className: cn10("font-semibold", className), ...props })
);
Strong.displayName = "Strong";

// src/base/VStack/VStack.tsx
import { cn as cn11 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef13 } from "@paalan/react-shared/utils";
import { jsx as jsx13 } from "react/jsx-runtime";
var VStack = forwardRef13((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx13(Box, { className: cn11("flex flex-col items-stretch gap-2", className), ...restProps, ref, children });
});

// src/base/Wrap/Wrap.tsx
import { cn as cn12 } from "@paalan/react-shared/lib";
import { forwardRef as forwardRef14 } from "@paalan/react-shared/utils";
import { jsx as jsx14 } from "react/jsx-runtime";
var Wrap = forwardRef14((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx14(Box, { className: cn12("flex flex-wrap gap-2", className), ...restProps, ref, children });
});
var WrapItem = forwardRef14((props, ref) => {
  const { children, className, ...restProps } = props;
  return /* @__PURE__ */ jsx14(Box, { className: cn12("flex flex-none items-start", className), ...restProps, ref, children });
});

// src/components/Toast/assets.tsx
import { ErrorIcon, InfoIcon1, SuccessIcon, WarningIcon1 } from "@paalan/react-icons";
import { jsx as jsx15 } from "react/jsx-runtime";
var bars = Array(12).fill(0);
var Loader = ({ visible }) => {
  return /* @__PURE__ */ jsx15("div", { className: "toast-loading-wrapper", "data-visible": visible, children: /* @__PURE__ */ jsx15("div", { className: "toast-spinner", children: bars.map((_, i) => /* @__PURE__ */ jsx15("div", { className: "toast-loading-bar" }, `spinner-bar-${i}`)) }) });
};
var getAsset = (type) => {
  switch (type) {
    case "success":
      return /* @__PURE__ */ jsx15(SuccessIcon, {});
    case "error":
      return /* @__PURE__ */ jsx15(ErrorIcon, {});
    case "warning":
      return /* @__PURE__ */ jsx15(WarningIcon1, {});
    case "info":
      return /* @__PURE__ */ jsx15(InfoIcon1, {});
    default:
      return null;
  }
};

// src/components/Toast/components/ActionButton.tsx
import { cn as cn13 } from "@paalan/react-shared/lib";

// src/components/Toast/helper.ts
import React from "react";
var isValidReactNode = (value) => {
  return typeof value === "string" || React.isValidElement(value);
};

// src/components/Toast/components/ActionButton.tsx
import { jsx as jsx16 } from "react/jsx-runtime";
var ActionButton = ({ toast, deleteToast, className }) => {
  if (isValidReactNode(toast.action)) return toast.action;
  const onClick = toast.action.onClick;
  return /* @__PURE__ */ jsx16(
    "button",
    {
      "data-button": true,
      onClick: (event) => {
        onClick?.(event);
        if (event.defaultPrevented) return;
        deleteToast();
      },
      className: cn13(className, toast.action.className),
      children: toast.action.label
    }
  );
};

// src/components/Toast/components/CancelButton.tsx
import { cn as cn14 } from "@paalan/react-shared/lib";
import { jsx as jsx17 } from "react/jsx-runtime";
var CancelButton = ({ toast, dismissible, deleteToast, className }) => {
  if (isValidReactNode(toast.cancel)) return toast.cancel;
  const onClick = toast.cancel.onClick;
  return /* @__PURE__ */ jsx17(
    "button",
    {
      "data-button": true,
      "data-cancel": true,
      onClick: () => {
        if (!dismissible) return;
        deleteToast();
        onClick?.();
      },
      className: cn14(className, toast.cancel.className),
      children: toast.cancel.label
    }
  );
};

// src/components/Toast/constant.ts
var TOAST_LIFETIME = 5e3;
var GAP = 14;
var SWIPE_THRESHOLD = 20;
var TIME_BEFORE_UNMOUNT = 200;

// src/components/Toast/Toast.tsx
import { Fragment as Fragment2, jsx as jsx18, jsxs } from "react/jsx-runtime";
var Toast = (props) => {
  const {
    invert: ToasterInvert,
    toast,
    interacting,
    setHeights,
    visibleToasts,
    heights,
    index,
    toasts,
    expanded,
    removeToast,
    closeButton,
    style,
    cancelButtonClassName,
    actionButtonClassName,
    className = "",
    descriptionClassName = "",
    duration: durationFromToaster,
    position,
    loadingIcon: loadingIconProp,
    expandByDefault
  } = props;
  const [mounted, setMounted] = React2.useState(false);
  const [removed, setRemoved] = React2.useState(false);
  const [swiping, setSwiping] = React2.useState(false);
  const [swipeOut, setSwipeOut] = React2.useState(false);
  const [offsetBeforeRemove, setOffsetBeforeRemove] = React2.useState(0);
  const [initialHeight, setInitialHeight] = React2.useState(0);
  const dragStartTime = React2.useRef(null);
  const toastRef = React2.useRef(null);
  const isFront = index === 0;
  const isVisible = index + 1 <= visibleToasts;
  const toastType = toast.type;
  const dismissible = toast.dismissible !== false;
  const toastClassname = toast.className || "";
  const toastDescriptionClassname = toast.descriptionClassName || "";
  const heightIndex = React2.useMemo(
    () => heights.findIndex((height) => height.toastId === toast.id) || 0,
    [heights, toast.id]
  );
  const duration = React2.useMemo(
    () => toast.duration || durationFromToaster || TOAST_LIFETIME,
    [toast.duration, durationFromToaster]
  );
  const closeTimerStartTimeRef = React2.useRef(0);
  const offset = React2.useRef(0);
  const lastCloseTimerStartTimeRef = React2.useRef(0);
  const pointerStartRef = React2.useRef(null);
  const [y, x] = position.split("-");
  const toastsHeightBefore = React2.useMemo(() => {
    return heights.reduce((prev, curr, reducerIndex) => {
      if (reducerIndex >= heightIndex) {
        return prev;
      }
      return prev + curr.height;
    }, 0);
  }, [heights, heightIndex]);
  const invert = toast.invert || ToasterInvert;
  const disabled = toastType === "loading";
  offset.current = React2.useMemo(() => heightIndex * GAP + toastsHeightBefore, [heightIndex, toastsHeightBefore]);
  React2.useEffect(() => {
    setMounted(true);
  }, []);
  React2.useLayoutEffect(() => {
    if (!mounted) return;
    const toastNode = toastRef.current;
    if (!toastNode) return;
    const originalHeight = toastNode.style.height;
    toastNode.style.height = "auto";
    const newHeight = toastNode.getBoundingClientRect().height;
    toastNode.style.height = originalHeight;
    setInitialHeight(newHeight);
    setHeights((heights2) => {
      const alreadyExists = heights2.find((height) => height.toastId === toast.id);
      if (!alreadyExists) {
        return [{ toastId: toast.id, height: newHeight }, ...heights2];
      } else {
        return heights2.map((height) => height.toastId === toast.id ? { ...height, height: newHeight } : height);
      }
    });
  }, [mounted, toast.title, toast.description, setHeights, toast.id]);
  const deleteToast = React2.useCallback(() => {
    setRemoved(true);
    setOffsetBeforeRemove(offset.current);
    setHeights((h) => h.filter((height) => height.toastId !== toast.id));
    setTimeout(() => {
      removeToast(toast);
    }, TIME_BEFORE_UNMOUNT);
  }, [toast, removeToast, setHeights, offset]);
  React2.useEffect(() => {
    if (toast.promise && toastType === "loading" || toast.duration === Infinity) return;
    let timeoutId;
    let remainingTime = duration;
    const pauseTimer = () => {
      if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
        const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
        remainingTime = remainingTime - elapsedTime;
      }
      lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
    };
    const startTimer = () => {
      closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
      timeoutId = setTimeout(() => {
        toast.onAutoClose?.(toast);
        deleteToast();
      }, remainingTime);
    };
    if (expanded || interacting) {
      pauseTimer();
    } else {
      startTimer();
    }
    return () => clearTimeout(timeoutId);
  }, [expanded, interacting, expandByDefault, toast, duration, deleteToast, toast.promise, toastType]);
  React2.useEffect(() => {
    const toastNode = toastRef.current;
    if (toastNode) {
      const height = toastNode.getBoundingClientRect().height;
      setInitialHeight(height);
      setHeights((h) => [{ toastId: toast.id, height }, ...h]);
      return () => setHeights((h) => h.filter((height2) => height2.toastId !== toast.id));
    }
  }, [setHeights, toast.id]);
  React2.useEffect(() => {
    if (toast.delete) {
      deleteToast();
    }
  }, [deleteToast, toast.delete]);
  function getLoadingIcon() {
    if (loadingIconProp) {
      return /* @__PURE__ */ jsx18(Box, { className: "toast-loader", "data-visible": toastType === "loading", children: loadingIconProp });
    }
    return /* @__PURE__ */ jsx18(Loader, { visible: toastType === "loading" });
  }
  return /* @__PURE__ */ jsxs(
    "li",
    {
      "aria-live": toast.important ? "assertive" : "polite",
      "aria-atomic": "true",
      role: "status",
      tabIndex: 0,
      ref: toastRef,
      className: cn15(className, toastClassname),
      "data-toast-toast": "",
      "data-styled": !(toast.jsx || toast.unstyled),
      "data-mounted": mounted,
      "data-promise": Boolean(toast.promise),
      "data-removed": removed,
      "data-visible": isVisible,
      "data-y-position": y,
      "data-x-position": x,
      "data-index": index,
      "data-front": isFront,
      "data-swiping": swiping,
      "data-dismissible": dismissible,
      "data-type": toastType,
      "data-invert": invert,
      "data-swipe-out": swipeOut,
      "data-expanded": Boolean(expanded || expandByDefault && mounted),
      style: {
        "--index": index,
        "--toasts-before": index,
        "--z-index": toasts.length - index,
        "--offset": `${removed ? offsetBeforeRemove : offset.current}px`,
        "--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
        ...style,
        ...toast.style
      },
      onPointerDown: (event) => {
        if (disabled || !dismissible) return;
        dragStartTime.current = /* @__PURE__ */ new Date();
        setOffsetBeforeRemove(offset.current);
        event.target.setPointerCapture(event.pointerId);
        if (event.target.tagName === "BUTTON") return;
        setSwiping(true);
        pointerStartRef.current = { x: event.clientX, y: event.clientY };
      },
      onPointerUp: () => {
        if (swipeOut || !dismissible) return;
        pointerStartRef.current = null;
        const swipeAmount = Number(toastRef.current?.style.getPropertyValue("--swipe-amount").replace("px", "") || 0);
        const timeTaken = dragStartTime.current ? (/* @__PURE__ */ new Date()).getTime() - dragStartTime.current.getTime() : 0;
        const velocity = Math.abs(swipeAmount) / timeTaken;
        if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
          setOffsetBeforeRemove(offset.current);
          toast.onDismiss?.(toast);
          deleteToast();
          setSwipeOut(true);
          return;
        }
        toastRef.current?.style.setProperty("--swipe-amount", "0px");
        setSwiping(false);
      },
      onPointerMove: (event) => {
        if (!pointerStartRef.current || !dismissible) return;
        const yPosition = event.clientY - pointerStartRef.current.y;
        const xPosition = event.clientX - pointerStartRef.current.x;
        const clamp = y === "top" ? Math.min : Math.max;
        const clampedY = clamp(0, yPosition);
        const swipeStartThreshold = event.pointerType === "touch" ? 10 : 2;
        const isAllowedToSwipe = Math.abs(clampedY) > swipeStartThreshold;
        if (isAllowedToSwipe) {
          toastRef.current?.style.setProperty("--swipe-amount", `${yPosition}px`);
        } else if (Math.abs(xPosition) > swipeStartThreshold) {
          pointerStartRef.current = null;
        }
      },
      children: [
        closeButton && dismissible && !toast.jsx && /* @__PURE__ */ jsx18(
          "button",
          {
            "aria-label": "Close toast",
            "data-disabled": disabled,
            "data-close-button": true,
            onClick: () => {
              if (disabled) return;
              deleteToast();
              toast.onDismiss?.(toast);
            },
            children: /* @__PURE__ */ jsxs(
              "svg",
              {
                xmlns: "http://www.w3.org/2000/svg",
                width: "16",
                height: "16",
                viewBox: "0 0 24 24",
                fill: "none",
                stroke: "currentColor",
                strokeWidth: "1.5",
                strokeLinecap: "round",
                strokeLinejoin: "round",
                children: [
                  /* @__PURE__ */ jsx18("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
                  /* @__PURE__ */ jsx18("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
                ]
              }
            )
          }
        ),
        toast.jsx || React2.isValidElement(toast.title) ? toast.jsx || toast.title : /* @__PURE__ */ jsxs(Fragment2, { children: [
          toastType || toast.icon || toast.promise ? /* @__PURE__ */ jsxs("div", { "data-icon": "", children: [
            (toast.promise || toast.type === "loading") && !toast.icon ? getLoadingIcon() : null,
            toast.icon || toastType && getAsset(toastType)
          ] }) : null,
          /* @__PURE__ */ jsxs("div", { "data-content": "", children: [
            /* @__PURE__ */ jsx18("div", { "data-title": "", children: toast.title }),
            !!toast.description && /* @__PURE__ */ jsx18("div", { "data-description": "", className: cn15(descriptionClassName, toastDescriptionClassname), children: toast.description })
          ] }),
          (!!toast.cancel || !!toast.action) && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
            toast.cancel && /* @__PURE__ */ jsx18(
              CancelButton,
              {
                toast,
                dismissible,
                deleteToast,
                className: cancelButtonClassName
              }
            ),
            toast.action && /* @__PURE__ */ jsx18(ActionButton, { toast, deleteToast, className: actionButtonClassName })
          ] })
        ] })
      ]
    }
  );
};
export {
  Toast
};
