import { a as e, r as t, t as n } from "./dist-DCjaNViz.js";
import { o as r, t as i } from "./dist-D-6_qntS.js";
import { t as a } from "./dist-BSqU5QJM.js";
import { t as o } from "./dist-o21Z8vCD.js";
import { n as s, t as c } from "./utils-CHlhTiFC.js";
import { t as l } from "./dist-C2Jrcfwk.js";
import { t as u } from "./createLucideIcon-CC8mnBIB.js";
import { t as d } from "./dist-CGH4Pssf.js";
import { t as f } from "./dist-CMeIjpjM.js";
import { t as p } from "./label-BSFReMzI.js";
import { n as m, r as h, t as g } from "./dist-DmFwV39u.js";
import * as _ from "react";
import v from "react";
import { jsx as y, jsxs as b } from "react/jsx-runtime";
var x = u("circle", [["circle", {
	cx: "12",
	cy: "12",
	r: "10",
	key: "1mglay"
}]]), S = "Radio", [C, w] = e(S), [T, E] = C(S), D = _.forwardRef((e, n) => {
	let { __scopeRadio: a, name: o, checked: s = !1, required: c, disabled: l, value: u = "on", onCheck: d, form: f, ...p } = e, [m, h] = _.useState(null), g = r(n, (e) => h(e)), v = _.useRef(!1), x = m ? f || !!m.closest("form") : !0;
	return /* @__PURE__ */ b(T, {
		scope: a,
		checked: s,
		disabled: l,
		children: [/* @__PURE__ */ y(i.button, {
			type: "button",
			role: "radio",
			"aria-checked": s,
			"data-state": M(s),
			"data-disabled": l ? "" : void 0,
			disabled: l,
			value: u,
			...p,
			ref: g,
			onClick: t(e.onClick, (e) => {
				s || d?.(), x && (v.current = e.isPropagationStopped(), v.current || e.stopPropagation());
			})
		}), x && /* @__PURE__ */ y(j, {
			control: m,
			bubbles: !v.current,
			name: o,
			value: u,
			checked: s,
			required: c,
			disabled: l,
			form: f,
			style: { transform: "translateX(-100%)" }
		})]
	});
});
D.displayName = S;
var O = "RadioIndicator", k = _.forwardRef((e, t) => {
	let { __scopeRadio: n, forceMount: r, ...o } = e, s = E(O, n);
	return /* @__PURE__ */ y(a, {
		present: r || s.checked,
		children: /* @__PURE__ */ y(i.span, {
			"data-state": M(s.checked),
			"data-disabled": s.disabled ? "" : void 0,
			...o,
			ref: t
		})
	});
});
k.displayName = O;
var A = "RadioBubbleInput", j = _.forwardRef(({ __scopeRadio: e, control: t, checked: n, bubbles: a = !0, ...o }, s) => {
	let c = _.useRef(null), l = r(c, s), u = d(n), p = f(t);
	return _.useEffect(() => {
		let e = c.current;
		if (!e) return;
		let t = window.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(t, "checked").set;
		if (u !== n && r) {
			let t = new Event("click", { bubbles: a });
			r.call(e, n), e.dispatchEvent(t);
		}
	}, [
		u,
		n,
		a
	]), /* @__PURE__ */ y(i.input, {
		type: "radio",
		"aria-hidden": !0,
		defaultChecked: n,
		...o,
		tabIndex: -1,
		ref: l,
		style: {
			...o.style,
			...p,
			position: "absolute",
			pointerEvents: "none",
			opacity: 0,
			margin: 0
		}
	});
});
j.displayName = A;
function M(e) {
	return e ? "checked" : "unchecked";
}
var N = [
	"ArrowUp",
	"ArrowDown",
	"ArrowLeft",
	"ArrowRight"
], P = "RadioGroup", [F, I] = e(P, [h, w]), L = h(), R = w(), [z, B] = F(P), V = _.forwardRef((e, t) => {
	let { __scopeRadioGroup: r, name: a, defaultValue: s, value: c, required: l = !1, disabled: u = !1, orientation: d, dir: f, loop: p = !0, onValueChange: h, ...g } = e, _ = L(r), v = o(f), [b, x] = n({
		prop: c,
		defaultProp: s ?? null,
		onChange: h,
		caller: P
	});
	return /* @__PURE__ */ y(z, {
		scope: r,
		name: a,
		required: l,
		disabled: u,
		value: b,
		onValueChange: x,
		children: /* @__PURE__ */ y(m, {
			asChild: !0,
			..._,
			orientation: d,
			dir: v,
			loop: p,
			children: /* @__PURE__ */ y(i.div, {
				role: "radiogroup",
				"aria-required": l,
				"aria-orientation": d,
				"data-disabled": u ? "" : void 0,
				dir: v,
				...g,
				ref: t
			})
		})
	});
});
V.displayName = P;
var H = "RadioGroupItem", U = _.forwardRef((e, n) => {
	let { __scopeRadioGroup: i, disabled: a, ...o } = e, s = B(H, i), c = s.disabled || a, l = L(i), u = R(i), d = _.useRef(null), f = r(n, d), p = s.value === o.value, m = _.useRef(!1);
	return _.useEffect(() => {
		let e = (e) => {
			N.includes(e.key) && (m.current = !0);
		}, t = () => m.current = !1;
		return document.addEventListener("keydown", e), document.addEventListener("keyup", t), () => {
			document.removeEventListener("keydown", e), document.removeEventListener("keyup", t);
		};
	}, []), /* @__PURE__ */ y(g, {
		asChild: !0,
		...l,
		focusable: !c,
		active: p,
		children: /* @__PURE__ */ y(D, {
			disabled: c,
			required: s.required,
			checked: p,
			...u,
			...o,
			name: s.name,
			ref: f,
			onCheck: () => s.onValueChange(o.value),
			onKeyDown: t((e) => {
				e.key === "Enter" && e.preventDefault();
			}),
			onFocus: t(o.onFocus, () => {
				m.current && d.current?.click();
			})
		})
	});
});
U.displayName = H;
var W = "RadioGroupIndicator", G = _.forwardRef((e, t) => {
	let { __scopeRadioGroup: n, ...r } = e;
	return /* @__PURE__ */ y(k, {
		...R(n),
		...r,
		ref: t
	});
});
G.displayName = W;
var K = V, q = U, J = G, Y = l("aspect-square h-4 w-4 bg-primary-white dark:bg-primary-gray-650 rounded-full text-primary-gray-700 dark:text-primary-white shadow-sm focus:outline-hidden focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50", {
	variants: {
		color: {
			blue: "border-primary-blue-600 hover:bg-primary-blue-100 dark:border-primary-blue-400 dark:hover:bg-primary-blue-200",
			red: "border-accent-dark-red hover:bg-accent-light-red dark:border-accent-red dark:hover:bg-accent-light-red",
			black: "border-primary-gray-700 hover:bg-primary-gray-400 dark:border-primary-gray-100 dark:hover:bg-primary-gray-550",
			custom: "border-custom-color-600 hover:bg-custom-color-100 dark:border-custom-color-400 dark:hover:bg-custom-color-200"
		},
		variant: {
			light: "border",
			normal: "border-2"
		}
	},
	defaultVariants: {
		color: "red",
		variant: "normal"
	}
}), X = l("stroke-0", {
	variants: {
		color: {
			blue: "fill-primary-blue-600 dark:fill-primary-blue-400",
			red: "fill-accent-dark-red dark:fill-accent-red",
			black: "fill-primary-gray-700 dark:fill-primary-gray-100",
			custom: "fill-custom-color-600 dark:fill-custom-color-400"
		},
		variant: {
			light: "h-1.5 w-1.5",
			normal: "h-2.5 w-2.5"
		}
	},
	defaultVariants: {
		color: "red",
		variant: "normal"
	}
}), Z = v.createContext({
	color: null,
	variant: null
}), Q = v.forwardRef(({ className: e, color: t, variant: n, ...r }, i) => {
	let a = v.useMemo(() => ({
		color: t,
		variant: n
	}), [t, n]);
	return /* @__PURE__ */ y(Z.Provider, {
		value: a,
		children: /* @__PURE__ */ y(K, {
			...r,
			className: c("flex gap-x-4 gap-y-2 flex-row flex-wrap rtl:[direction:rtl]", e),
			ref: i
		})
	});
});
Q.displayName = K.displayName;
var $ = v.forwardRef(({ className: e, radioClassName: t, labelClassName: n, label: r, ...i }, a) => {
	let o = i.id || s(), { color: l, variant: u } = v.useContext(Z);
	return /* @__PURE__ */ b("div", {
		className: c("flex flex-row gap-2 items-center", e),
		children: [/* @__PURE__ */ y(q, {
			...i,
			ref: a,
			className: c(Y({
				color: l,
				variant: u
			}), t),
			id: o,
			children: /* @__PURE__ */ y(J, {
				className: "flex items-center justify-center",
				children: /* @__PURE__ */ y(x, { className: X({
					color: l,
					variant: u
				}) })
			})
		}), /* @__PURE__ */ y(p, {
			className: c("mt-0.5 text-base!", n),
			htmlFor: o,
			children: r
		})]
	});
});
$.displayName = q.displayName;
//#endregion
export { $ as n, Q as t };

//# sourceMappingURL=radio-group-DbtO02jf.js.map