"use client";
import { t as e } from "../chunks/clsx.js";
import { ElasticHeight as t } from "./ElasticHeight.js";
import { Colors as n, getBgColor as r, getBorderColor as i, getTextColor as a } from "./helpers/colors/colors.js";
import { useCountdown as o } from "./hooks/useCountdown.js";
import s from "./hooks/useResizeObserver.js";
import { useEffect as c, useId as l, useRef as u, useState as d } from "react";
import { Icon as f } from "@clubmed/trident-icons";
import { jsx as p, jsxs as m } from "react/jsx-runtime";
//#region lib/ui/AdvancedToast.tsx
var h = ({ className: h, title: g, body: _, icon: v, isVisible: y, labels: b, children: x, accentColor: S = n.orange, duration: C = 1e4, onClose: w, toastId: T, updateHeight: E, ...D }) => {
	let O = l(), [k, A] = d(!1), [j, M] = d(!1), N = u(null), { progress: P } = o({
		duration: C,
		isPaused: j,
		isVisible: y
	});
	c(() => {
		P === 100 && w?.();
	}, [P, w]);
	let F = () => M(!0), I = () => M(!1), L = () => M(!1);
	return s({
		ref: N,
		onResize: () => {
			N.current && E(T, N.current.offsetHeight);
		}
	}), /* @__PURE__ */ m("div", {
		ref: N,
		...D,
		className: e(y ? "animate-slide-right-enter" : "animate-slide-right-exit opacity-0", "relative isolate flex gap-x-20 rounded-16 bg-white p-20 text-black transition-opacity duration-300 border-1 overflow-hidden", i(S), h),
		role: "note",
		onMouseDown: F,
		onMouseUp: I,
		onMouseLeave: L,
		children: [
			/* @__PURE__ */ p(f, {
				name: v,
				width: "30px",
				className: e("flex-shrink-0 pt-4", a(S))
			}),
			/* @__PURE__ */ m("div", {
				className: "flex flex-1 flex-col gap-12 pe-24 text-b4",
				children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("p", {
					className: " font-bold",
					id: O,
					children: g
				}), /* @__PURE__ */ p("p", { children: _ })] }), x && /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("button", {
					onClick: () => A(!k),
					"aria-expanded": k,
					className: "flex w-fit items-center gap-8 text-b5 font-normal",
					type: "button",
					children: [/* @__PURE__ */ p("span", { children: b.details }), /* @__PURE__ */ p(f, {
						name: "ArrowDefaultDown",
						width: "24px",
						style: { rotate: k ? "180deg" : "0deg" },
						className: "transition-all duration-300"
					})]
				}), /* @__PURE__ */ p(t, {
					isExpanded: k,
					children: /* @__PURE__ */ p("div", {
						className: "pt-4",
						children: x
					})
				})] })]
			}),
			w && /* @__PURE__ */ p("button", {
				"aria-describedby": O,
				"aria-label": b.close,
				className: "absolute end-0 top-0 mt-20 me-13 text-black",
				onClick: w,
				type: "button",
				children: /* @__PURE__ */ p(f, {
					name: "CrossDefault",
					width: "24px"
				})
			}),
			C !== !1 && /* @__PURE__ */ p("div", {
				className: "absolute bottom-0 left-0 right-0 h-4 overflow-hidden rounded-b-16",
				children: /* @__PURE__ */ p("div", {
					className: r(S),
					style: {
						width: "100%",
						height: "100%",
						transform: `scaleX(${(100 - P) / 100})`,
						transformOrigin: "left",
						transition: "transform 16ms linear"
					}
				})
			})
		]
	});
};
//#endregion
export { h as AdvancedToast };

//# sourceMappingURL=AdvancedToast.js.map