"use client";
import { cn } from "../../lib/utils.js";
import { Button } from "./button.js";
import "./input.js";
import { Textarea } from "./textarea.js";
import { c } from "react/compiler-runtime";
import "react";
import { jsx } from "react/jsx-runtime";
import { cva } from "class-variance-authority";
function InputGroup(r) {
	let i = c(8), a, o;
	i[0] === r ? (a = i[1], o = i[2]) : ({className: a, ...o} = r, i[0] = r, i[1] = a, i[2] = o);
	let s;
	i[3] === a ? s = i[4] : (s = cn("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none", "h-9 min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]", "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", a), i[3] = a, i[4] = s);
	let l;
	return i[5] !== o || i[6] !== s ? (l = /* @__PURE__ */ jsx("div", {
		"data-slot": "input-group",
		role: "group",
		className: s,
		...o
	}), i[5] = o, i[6] = s, i[7] = l) : l = i[7], l;
}
var inputGroupAddonVariants = cva("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50", {
	variants: { align: {
		"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
		"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
		"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
		"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
	} },
	defaultVariants: { align: "inline-start" }
});
function InputGroupAddon(r) {
	let i = c(11), a, o, l;
	i[0] === r ? (a = i[1], o = i[2], l = i[3]) : ({className: a, align: l, ...o} = r, i[0] = r, i[1] = a, i[2] = o, i[3] = l);
	let d = l === void 0 ? "inline-start" : l, f;
	i[4] !== d || i[5] !== a ? (f = cn(inputGroupAddonVariants({ align: d }), a), i[4] = d, i[5] = a, i[6] = f) : f = i[6];
	let p;
	return i[7] !== d || i[8] !== o || i[9] !== f ? (p = /* @__PURE__ */ jsx("div", {
		role: "group",
		"data-slot": "input-group-addon",
		"data-align": d,
		className: f,
		onClick: _temp,
		...o
	}), i[7] = d, i[8] = o, i[9] = f, i[10] = p) : p = i[10], p;
}
function _temp(e) {
	e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
}
var inputGroupButtonVariants = cva("text-sm shadow-none flex gap-2 items-center", {
	variants: { size: {
		xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
		sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
		"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
		"icon-sm": "size-8 p-0 has-[>svg]:p-0"
	} },
	defaultVariants: { size: "xs" }
});
function InputGroupButton(i) {
	let a = c(15), o, s, l, u, f;
	a[0] === i ? (o = a[1], s = a[2], l = a[3], u = a[4], f = a[5]) : ({className: o, type: l, variant: u, size: f, ...s} = i, a[0] = i, a[1] = o, a[2] = s, a[3] = l, a[4] = u, a[5] = f);
	let p = l === void 0 ? "button" : l, m = u === void 0 ? "ghost" : u, h = f === void 0 ? "xs" : f, g;
	a[6] !== o || a[7] !== h ? (g = cn(inputGroupButtonVariants({ size: h }), o), a[6] = o, a[7] = h, a[8] = g) : g = a[8];
	let _;
	return a[9] !== s || a[10] !== h || a[11] !== g || a[12] !== p || a[13] !== m ? (_ = /* @__PURE__ */ jsx(Button, {
		type: p,
		"data-size": h,
		variant: m,
		className: g,
		...s
	}), a[9] = s, a[10] = h, a[11] = g, a[12] = p, a[13] = m, a[14] = _) : _ = a[14], _;
}
function InputGroupTextarea(r) {
	let a = c(8), o, s;
	a[0] === r ? (o = a[1], s = a[2]) : ({className: o, ...s} = r, a[0] = r, a[1] = o, a[2] = s);
	let l;
	a[3] === o ? l = a[4] : (l = cn("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", o), a[3] = o, a[4] = l);
	let u;
	return a[5] !== s || a[6] !== l ? (u = /* @__PURE__ */ jsx(Textarea, {
		"data-slot": "input-group-control",
		className: l,
		...s
	}), a[5] = s, a[6] = l, a[7] = u) : u = a[7], u;
}
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupTextarea };
