"use client";
import { useIsMobile as e } from "../../hooks/use-mobile.js";
import { cn as t } from "../../lib/utils.js";
import { Button as n } from "./button.js";
import { Input as r } from "./input.js";
import { Separator as i } from "./separator.js";
import { Sheet as a, SheetContent as o, SheetDescription as s, SheetHeader as c, SheetTitle as l } from "./sheet.js";
import { Skeleton as u } from "./skeleton.js";
import { Tooltip as d, TooltipContent as f, TooltipProvider as p, TooltipTrigger as m } from "./tooltip.js";
import * as h from "react";
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
import { PanelLeftIcon as v } from "lucide-react";
import { Slot as y } from "@radix-ui/react-slot";
import { cva as b } from "class-variance-authority";
//#region src/components/ui/sidebar.tsx
var x = "16rem", S = "18rem", C = "3rem", w = "b", T = h.createContext(null);
function E() {
	let e = h.useContext(T);
	if (!e) throw Error("useSidebar must be used within a SidebarProvider.");
	return e;
}
function D({ defaultOpen: n = !0, open: r, onOpenChange: i, className: a, style: o, children: s, ...c }) {
	let l = e(), [u, d] = h.useState(!1), [f, m] = h.useState(n), _ = r ?? f, v = h.useCallback((e) => {
		let t = typeof e == "function" ? e(_) : e;
		i ? i(t) : m(t);
	}, [i, _]), y = h.useCallback(() => l ? d((e) => !e) : v((e) => !e), [
		l,
		v,
		d
	]);
	h.useEffect(() => {
		let e = (e) => {
			e.key === w && (e.metaKey || e.ctrlKey) && (e.preventDefault(), y());
		};
		return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
	}, [y]);
	let b = _ ? "expanded" : "collapsed", S = h.useMemo(() => ({
		state: b,
		open: _,
		setOpen: v,
		isMobile: l,
		openMobile: u,
		setOpenMobile: d,
		toggleSidebar: y
	}), [
		b,
		_,
		v,
		l,
		u,
		d,
		y
	]);
	return /* @__PURE__ */ g(T.Provider, {
		value: S,
		children: /* @__PURE__ */ g(p, {
			delayDuration: 0,
			children: /* @__PURE__ */ g("div", {
				"data-slot": "sidebar-wrapper",
				style: {
					"--sidebar-width": x,
					"--sidebar-width-icon": C,
					...o
				},
				className: t("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", a),
				...c,
				children: s
			})
		})
	});
}
function O({ side: e = "left", variant: n = "sidebar", collapsible: r = "offcanvas", className: i, children: u, ...d }) {
	let { isMobile: f, state: p, openMobile: m, setOpenMobile: h } = E();
	return r === "none" ? /* @__PURE__ */ g("div", {
		"data-slot": "sidebar",
		className: t("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", i),
		...d,
		children: u
	}) : f ? /* @__PURE__ */ g(a, {
		open: m,
		onOpenChange: h,
		...d,
		children: /* @__PURE__ */ _(o, {
			"data-sidebar": "sidebar",
			"data-slot": "sidebar",
			"data-mobile": "true",
			className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
			style: { "--sidebar-width": S },
			side: e,
			children: [/* @__PURE__ */ _(c, {
				className: "sr-only",
				children: [/* @__PURE__ */ g(l, { children: "Sidebar" }), /* @__PURE__ */ g(s, { children: "Displays the mobile sidebar." })]
			}), /* @__PURE__ */ g("div", {
				className: "flex h-full w-full flex-col",
				children: u
			})]
		})
	}) : /* @__PURE__ */ _("div", {
		className: "group peer text-sidebar-foreground hidden md:block",
		"data-state": p,
		"data-collapsible": p === "collapsed" ? r : "",
		"data-variant": n,
		"data-side": e,
		"data-slot": "sidebar",
		children: [/* @__PURE__ */ g("div", {
			"data-slot": "sidebar-gap",
			className: t("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", n === "floating" || n === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
		}), /* @__PURE__ */ g("div", {
			"data-slot": "sidebar-container",
			className: t("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", e === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", n === "floating" || n === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", i),
			...d,
			children: /* @__PURE__ */ g("div", {
				"data-sidebar": "sidebar",
				"data-slot": "sidebar-inner",
				className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
				children: u
			})
		})]
	});
}
function k({ className: e, onClick: r, ...i }) {
	let { toggleSidebar: a } = E();
	return /* @__PURE__ */ _(n, {
		"data-sidebar": "trigger",
		"data-slot": "sidebar-trigger",
		variant: "ghost",
		size: "icon",
		className: t("size-10 text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground", e),
		onClick: (e) => {
			r?.(e), a();
		},
		...i,
		children: [/* @__PURE__ */ g(v, { className: "size-5" }), /* @__PURE__ */ g("span", {
			className: "sr-only",
			children: "Toggle Sidebar"
		})]
	});
}
function A({ className: e, ...n }) {
	let { toggleSidebar: r } = E();
	return /* @__PURE__ */ g("button", {
		"data-sidebar": "rail",
		"data-slot": "sidebar-rail",
		"aria-label": "Toggle Sidebar",
		tabIndex: -1,
		onClick: r,
		title: "Toggle Sidebar",
		className: t("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", e),
		...n
	});
}
function j({ className: e, ...n }) {
	return /* @__PURE__ */ g("main", {
		"data-slot": "sidebar-inset",
		className: t("bg-background relative flex w-full flex-1 flex-col overflow-hidden", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", e),
		...n
	});
}
function M({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-inset",
		className: t("bg-background relative flex w-full flex-1 flex-col overflow-auto", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", e),
		...n
	});
}
function N({ className: e, ...n }) {
	return /* @__PURE__ */ g(r, {
		"data-slot": "sidebar-input",
		"data-sidebar": "input",
		className: t("bg-background h-8 w-full shadow-none", e),
		...n
	});
}
function P({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-header",
		"data-sidebar": "header",
		className: t("flex flex-col gap-2 p-1.5", e),
		...n
	});
}
function F({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-footer",
		"data-sidebar": "footer",
		className: t("flex flex-col gap-2 p-2", e),
		...n
	});
}
function I({ className: e, ...n }) {
	return /* @__PURE__ */ g(i, {
		"data-slot": "sidebar-separator",
		"data-sidebar": "separator",
		className: t("bg-sidebar-border mx-2 w-auto", e),
		...n
	});
}
function L({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-content",
		"data-sidebar": "content",
		className: t("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", e),
		...n
	});
}
function R({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-group",
		"data-sidebar": "group",
		className: t("relative flex w-full min-w-0 flex-col p-1.5", e),
		...n
	});
}
function z({ className: e, asChild: n = !1, ...r }) {
	return /* @__PURE__ */ g(n ? y : "div", {
		"data-slot": "sidebar-group-label",
		"data-sidebar": "group-label",
		className: t("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", e),
		...r
	});
}
function B({ className: e, asChild: n = !1, ...r }) {
	return /* @__PURE__ */ g(n ? y : "button", {
		"data-slot": "sidebar-group-action",
		"data-sidebar": "group-action",
		className: t("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", e),
		...r
	});
}
function V({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-group-content",
		"data-sidebar": "group-content",
		className: t("w-full text-sm", e),
		...n
	});
}
function H({ className: e, ...n }) {
	return /* @__PURE__ */ g("ul", {
		"data-slot": "sidebar-menu",
		"data-sidebar": "menu",
		className: t("flex w-full min-w-0 flex-col gap-1", e),
		...n
	});
}
function U({ className: e, ...n }) {
	return /* @__PURE__ */ g("li", {
		"data-slot": "sidebar-menu-item",
		"data-sidebar": "menu-item",
		className: t("group/menu-item relative", e),
		...n
	});
}
var W = b("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm text-muted-foreground outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-accent/50 hover:text-accent-foreground focus-visible:ring-2 active:bg-accent/50 active:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-foreground data-[active=true]:font-medium data-[active=true]:text-background data-[state=open]:hover:bg-accent/50 data-[state=open]:hover:text-accent-foreground group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-5 [&>svg]:shrink-0", {
	variants: {
		variant: {
			default: "hover:bg-accent/50 hover:text-accent-foreground",
			outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-accent/50 hover:text-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
		},
		size: {
			default: "h-10 text-sm",
			sm: "h-7 text-xs",
			lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
function G({ asChild: e = !1, isActive: n = !1, variant: r = "default", size: i = "default", tooltip: a, className: o, ...s }) {
	let c = e ? y : "button", { isMobile: l, state: u } = E(), p = /* @__PURE__ */ g(c, {
		"data-slot": "sidebar-menu-button",
		"data-sidebar": "menu-button",
		"data-size": i,
		"data-active": n,
		className: t(W({
			variant: r,
			size: i
		}), o),
		...s
	});
	return a ? (typeof a == "string" && (a = { children: a }), /* @__PURE__ */ _(d, { children: [/* @__PURE__ */ g(m, {
		asChild: !0,
		children: p
	}), /* @__PURE__ */ g(f, {
		side: "right",
		align: "center",
		hidden: u !== "collapsed" || l,
		...a
	})] })) : p;
}
function K({ asChild: e = !1, isActive: n = !1, variant: r = "default", size: i = "default", tooltip: a, className: o, ...s }) {
	let c = e ? y : "div", { isMobile: l, state: u } = E(), p = /* @__PURE__ */ g(c, {
		"data-slot": "sidebar-menu-button",
		"data-sidebar": "menu-button",
		"data-size": i,
		"data-active": n,
		className: t(W({
			variant: r,
			size: i
		}), o),
		...s
	});
	return a ? (typeof a == "string" && (a = { children: a }), /* @__PURE__ */ _(d, { children: [/* @__PURE__ */ g(m, {
		asChild: !0,
		children: p
	}), /* @__PURE__ */ g(f, {
		side: "right",
		align: "center",
		hidden: u !== "collapsed" || l,
		...a
	})] })) : p;
}
function q({ className: e, asChild: n = !1, showOnHover: r = !1, ...i }) {
	return /* @__PURE__ */ g(n ? y : "button", {
		"data-slot": "sidebar-menu-action",
		"data-sidebar": "menu-action",
		className: t("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", r && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", e),
		...i
	});
}
function J({ className: e, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "sidebar-menu-badge",
		"data-sidebar": "menu-badge",
		className: t("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", e),
		...n
	});
}
function Y({ className: e, showIcon: n = !1, ...r }) {
	let i = h.useMemo(() => `${Math.floor(Math.random() * 40) + 50}%`, []);
	return /* @__PURE__ */ _("div", {
		"data-slot": "sidebar-menu-skeleton",
		"data-sidebar": "menu-skeleton",
		className: t("flex h-8 items-center gap-2 rounded-md px-2", e),
		...r,
		children: [n && /* @__PURE__ */ g(u, {
			className: "size-4 rounded-md",
			"data-sidebar": "menu-skeleton-icon"
		}), /* @__PURE__ */ g(u, {
			className: "h-4 max-w-(--skeleton-width) flex-1",
			"data-sidebar": "menu-skeleton-text",
			style: { "--skeleton-width": i }
		})]
	});
}
function X({ className: e, ...n }) {
	return /* @__PURE__ */ g("ul", {
		"data-slot": "sidebar-menu-sub",
		"data-sidebar": "menu-sub",
		className: t("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", e),
		...n
	});
}
function Z({ className: e, ...n }) {
	return /* @__PURE__ */ g("li", {
		"data-slot": "sidebar-menu-sub-item",
		"data-sidebar": "menu-sub-item",
		className: t("group/menu-sub-item relative", e),
		...n
	});
}
function Q({ asChild: e = !1, size: n = "md", isActive: r = !1, className: i, ...a }) {
	return /* @__PURE__ */ g(e ? y : "a", {
		"data-slot": "sidebar-menu-sub-button",
		"data-sidebar": "menu-sub-button",
		"data-size": n,
		"data-active": r,
		className: t("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", n === "sm" && "text-xs", n === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", i),
		...a
	});
}
//#endregion
export { O as Sidebar, L as SidebarContent, F as SidebarFooter, R as SidebarGroup, B as SidebarGroupAction, V as SidebarGroupContent, z as SidebarGroupLabel, P as SidebarHeader, N as SidebarInput, j as SidebarInset, M as SidebarInsetDiv, H as SidebarMenu, q as SidebarMenuAction, J as SidebarMenuBadge, G as SidebarMenuButton, K as SidebarMenuDiv, U as SidebarMenuItem, Y as SidebarMenuSkeleton, X as SidebarMenuSub, Q as SidebarMenuSubButton, Z as SidebarMenuSubItem, D as SidebarProvider, A as SidebarRail, I as SidebarSeparator, k as SidebarTrigger, E as useSidebar };
