import { o as ve } from "./rolldown-runtime.js";
import { i as ke, t as be } from "./vendor/react.js";
import { t as oe } from "./createLucideIcon.js";
import { t as we } from "./check.js";
import { t as ye } from "./x.js";
import { l as je, o as Ce, r as Ne, s as Te, t as se } from "./useRenderElement.js";
import { n as _e, t as Ie } from "./useIsoLayoutEffect.js";
import { t as Pe } from "./useButton.js";
import { t as r } from "./utils.js";
import { t as Fe } from "./useBaseUiId.js";
import { g as Re, t as Ee } from "./createBaseUIEventDetails.js";
import { n as He, t as Me } from "./visuallyHidden.js";
import { t as We } from "./useControlled.js";
import { t as Se } from "./FieldTooltip.js";
import { a as de, c as Ve, r as Be, t as Oe } from "./useRegisterFieldControl.js";
import { t as ze } from "./FormContext.js";
import { t as Ke } from "./useAriaLabelledBy.js";
import { t as qe } from "./useLabelableId.js";
import { a as De, n as Ge, o as $e, s as Je, t as Ue } from "./Field.js";
import { t as Xe } from "./useValueChanged.js";
var Ye = [["path", {
  d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
  key: "kfwtm"
}]], D = oe("moon", Ye), Qe = [
  ["circle", {
    cx: "12",
    cy: "12",
    r: "4",
    key: "4exip2"
  }],
  ["path", {
    d: "M12 2v2",
    key: "tus03m"
  }],
  ["path", {
    d: "M12 20v2",
    key: "1lh1kg"
  }],
  ["path", {
    d: "m4.93 4.93 1.41 1.41",
    key: "149t6j"
  }],
  ["path", {
    d: "m17.66 17.66 1.41 1.41",
    key: "ptbguv"
  }],
  ["path", {
    d: "M2 12h2",
    key: "1t8f8n"
  }],
  ["path", {
    d: "M20 12h2",
    key: "1q8mjw"
  }],
  ["path", {
    d: "m6.34 17.66-1.41 1.41",
    key: "1m8zz5"
  }],
  ["path", {
    d: "m19.07 4.93-1.41 1.41",
    key: "1shlcs"
  }]
], G = oe("sun", Qe), o = /* @__PURE__ */ ve(ke()), ce = /* @__PURE__ */ o.createContext(void 0);
function Ze() {
  const t = o.useContext(ce);
  if (t === void 0) throw new Error(Te(63));
  return t;
}
var re = /* @__PURE__ */ (function(t) {
  return t.checked = "data-checked", t.unchecked = "data-unchecked", t.disabled = "data-disabled", t.readonly = "data-readonly", t.required = "data-required", t.valid = "data-valid", t.invalid = "data-invalid", t.touched = "data-touched", t.dirty = "data-dirty", t.filled = "data-filled", t.focused = "data-focused", t;
})({}), le = {
  ...Ve,
  checked(t) {
    return t ? { [re.checked]: "" } : { [re.unchecked]: "" };
  }
}, e = be(), Le = /* @__PURE__ */ o.forwardRef(function(i, a) {
  const { checked: m, className: s, defaultChecked: p, "aria-labelledby": n, form: d, id: c, inputRef: _, name: O, nativeButton: I = !1, onCheckedChange: $, readOnly: f = !1, required: j = !1, disabled: B = !1, render: U, uncheckedValue: P, value: C, style: W, ...F } = i, { clearErrors: z } = ze(), { state: R, setTouched: K, setDirty: S, validityData: v, setFilled: k, setFocused: N, shouldValidateOnChange: E, validationMode: b, disabled: H, name: w, validation: h } = de(), { labelId: T } = Be(), g = H || B, M = w ?? O, q = _e($), y = o.useRef(null), Q = Ce(y, _, h.inputRef), J = o.useRef(null), Z = Fe(), L = qe({
    id: c,
    implicit: !1,
    controlRef: J
  }), X = I ? void 0 : L, [u, A] = We({
    controlled: m,
    default: !!p,
    name: "Switch",
    state: "checked"
  });
  Oe(J, {
    id: Z,
    value: u
  }), Ie(() => {
    y.current && k(y.current.checked);
  }, [y, k]), Xe(u, () => {
    z(M), S(u !== v.initialValue), k(u), E() ? h.commit(u) : h.commit(u, !0);
  });
  const { getButtonProps: ue, buttonRef: me } = Pe({
    disabled: g,
    native: I
  }), pe = Ke(n, T, y, !I, X), ge = {
    id: I ? L : Z,
    role: "switch",
    "aria-checked": u,
    "aria-readonly": f || void 0,
    "aria-required": j || void 0,
    "aria-labelledby": pe,
    onFocus() {
      g || N(!0);
    },
    onBlur() {
      const l = y.current;
      !l || g || (K(!0), N(!1), b === "onBlur" && h.commit(l.checked));
    },
    onClick(l) {
      f || g || (l.preventDefault(), y.current?.dispatchEvent(new PointerEvent("click", {
        bubbles: !0,
        shiftKey: l.shiftKey,
        ctrlKey: l.ctrlKey,
        altKey: l.altKey,
        metaKey: l.metaKey
      })));
    }
  }, xe = o.useMemo(() => je({
    checked: u,
    disabled: g,
    form: d,
    id: X,
    name: M,
    required: j,
    style: M ? He : Me,
    tabIndex: -1,
    type: "checkbox",
    "aria-hidden": !0,
    ref: Q,
    onChange(l) {
      if (l.nativeEvent.defaultPrevented) return;
      if (f) {
        l.preventDefault();
        return;
      }
      const te = l.currentTarget.checked, ae = Ee(Re, l.nativeEvent);
      q?.(te, ae), !ae.isCanceled && A(te);
    },
    onFocus() {
      J.current?.focus();
    }
  }, h.getInputValidationProps, C !== void 0 ? { value: C } : Ne), [
    u,
    g,
    d,
    Q,
    X,
    M,
    q,
    f,
    j,
    A,
    h,
    C
  ]), ee = o.useMemo(() => ({
    ...R,
    checked: u,
    disabled: g,
    readOnly: f,
    required: j
  }), [
    R,
    u,
    g,
    f,
    j
  ]), fe = se("span", i, {
    state: ee,
    ref: [
      a,
      J,
      me
    ],
    props: [
      ge,
      h.getValidationProps,
      F,
      ue
    ],
    stateAttributesMapping: le
  });
  return /* @__PURE__ */ (0, e.jsxs)(ce.Provider, {
    value: ee,
    children: [
      fe,
      !u && M && P !== void 0 && /* @__PURE__ */ (0, e.jsx)("input", {
        type: "hidden",
        form: d,
        name: M,
        value: P
      }),
      /* @__PURE__ */ (0, e.jsx)("input", {
        ...xe,
        suppressHydrationWarning: !0
      })
    ]
  });
}), Ae = /* @__PURE__ */ o.forwardRef(function(i, a) {
  const { render: m, className: s, style: p, ...n } = i, { state: d } = de(), c = Ze();
  return se("span", i, {
    state: {
      ...d,
      ...c
    },
    ref: a,
    stateAttributesMapping: le,
    props: n
  });
}), et = (0, o.createContext)(null);
function tt() {
  return (0, o.useContext)(et);
}
var ie = {
  sm: "size-2",
  md: "size-2.5",
  lg: "size-3"
}, at = {
  sm: "h-[18px] w-[32px]",
  md: "h-[22px] w-[40px]",
  lg: "h-[26px] w-[48px]"
}, rt = {
  sm: "size-[14px]",
  md: "size-[18px]",
  lg: "size-[22px]"
}, it = {
  sm: "data-checked:ltr:translate-x-[14px] data-checked:rtl:-translate-x-[14px]",
  md: "data-checked:ltr:translate-x-[18px] data-checked:rtl:-translate-x-[18px]",
  lg: "data-checked:ltr:translate-x-[22px] data-checked:rtl:-translate-x-[22px]"
}, nt = {
  sm: "h-[18px] w-[40px]",
  md: "h-[22px] w-[48px]",
  lg: "h-[26px] w-[56px]"
}, ot = {
  sm: "data-checked:ltr:translate-x-[22px] data-checked:rtl:-translate-x-[22px]",
  md: "data-checked:ltr:translate-x-[26px] data-checked:rtl:-translate-x-[26px]",
  lg: "data-checked:ltr:translate-x-[30px] data-checked:rtl:-translate-x-[30px]"
}, ne = {
  sm: "text-[8px]",
  md: "text-[10px]",
  lg: "text-xs"
}, st = {
  primary: "data-checked:bg-primary",
  secondary: "data-checked:bg-secondary",
  warning: "data-checked:bg-warning",
  info: "data-checked:bg-info",
  success: "data-checked:bg-success",
  destructive: "data-checked:bg-destructive"
}, dt = {
  primary: "data-checked:border-primary",
  secondary: "data-checked:border-secondary",
  warning: "data-checked:border-warning",
  info: "data-checked:border-info",
  success: "data-checked:border-success",
  destructive: "data-checked:border-destructive"
}, ct = {
  primary: "group-data-checked/switch:bg-primary",
  secondary: "group-data-checked/switch:bg-secondary",
  warning: "group-data-checked/switch:bg-warning",
  info: "group-data-checked/switch:bg-info",
  success: "group-data-checked/switch:bg-success",
  destructive: "group-data-checked/switch:bg-destructive"
}, lt = {
  sm: {
    gradient: {
      width: "w-[64px]",
      height: "h-6",
      indicator: "size-5",
      icon: "size-3",
      text: "text-xs",
      padding: "p-0.5",
      skeletonWidth: "w-[64px]",
      skeletonHeight: "h-6"
    },
    switch: {
      track: "w-[30px] h-4",
      indicator: "size-3.5",
      icon: "size-3.5",
      gap: "gap-1.5",
      skeletonWidth: "w-[50px]",
      skeletonHeight: "h-4"
    },
    pill: {
      width: "w-[42px]",
      height: "h-6",
      indicator: "size-5",
      icon: "size-3",
      padding: "p-0.5",
      skeletonWidth: "w-[42px]",
      skeletonHeight: "h-6"
    },
    segmented: {
      height: "h-6",
      icon: "size-3",
      text: "text-xs",
      padding: "p-1",
      gap: "gap-0.5",
      skeletonWidth: "w-[100px]",
      skeletonHeight: "h-6"
    }
  },
  md: {
    gradient: {
      width: "w-[76px]",
      height: "h-7",
      indicator: "size-6",
      icon: "size-3.5",
      text: "text-sm",
      padding: "p-0.5",
      skeletonWidth: "w-[76px]",
      skeletonHeight: "h-7"
    },
    switch: {
      track: "w-9 h-[18px]",
      indicator: "size-4",
      icon: "size-4",
      gap: "gap-2",
      skeletonWidth: "w-[58px]",
      skeletonHeight: "h-[18px]"
    },
    pill: {
      width: "w-[50px]",
      height: "h-7",
      indicator: "size-6",
      icon: "size-3.5",
      padding: "p-0.5",
      skeletonWidth: "w-[50px]",
      skeletonHeight: "h-7"
    },
    segmented: {
      height: "h-7",
      icon: "size-3.5",
      text: "text-sm",
      padding: "p-1",
      gap: "gap-1",
      skeletonWidth: "w-[120px]",
      skeletonHeight: "h-7"
    }
  },
  lg: {
    gradient: {
      width: "w-[88px]",
      height: "h-8",
      indicator: "size-7",
      icon: "size-4",
      text: "text-sm",
      padding: "p-0.5",
      skeletonWidth: "w-[88px]",
      skeletonHeight: "h-8"
    },
    switch: {
      track: "w-[42px] h-5",
      indicator: "size-[18px]",
      icon: "size-[18px]",
      gap: "gap-2.5",
      skeletonWidth: "w-[66px]",
      skeletonHeight: "h-5"
    },
    pill: {
      width: "w-[58px]",
      height: "h-8",
      indicator: "size-7",
      icon: "size-4",
      padding: "p-0.5",
      skeletonWidth: "w-[58px]",
      skeletonHeight: "h-8"
    },
    segmented: {
      height: "h-8",
      icon: "size-4",
      text: "text-sm",
      padding: "p-1",
      gap: "gap-1",
      skeletonWidth: "w-[140px]",
      skeletonHeight: "h-8"
    }
  }
}, ht = "linear-gradient(247deg, var(--theme-toggle-gradient-light-end) 10%, var(--theme-toggle-gradient-light-mid) 50%, var(--theme-toggle-gradient-light-start) 90%)", ut = "linear-gradient(264deg, var(--theme-toggle-gradient-dark-start) 3%, var(--theme-toggle-gradient-dark-mid) 60%, var(--theme-toggle-gradient-dark-end) 98%)", V = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", x = "duration-[var(--theme-toggle-transition-duration)] ease-[var(--theme-toggle-transition-easing)]";
function mt({ isLight: t, onThemeChange: i, sizes: a }) {
  return /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "switch",
    className: r("relative flex items-center rounded-full transition-all overflow-hidden", a.width, a.height, a.padding, x),
    style: { background: t ? ht : ut },
    role: "radiogroup",
    "aria-label": "Theme selector",
    children: [
      /* @__PURE__ */ (0, e.jsx)("div", {
        className: r("absolute flex items-center justify-center rounded-full bg-[var(--theme-toggle-indicator-surface)] shadow-md hover:shadow-lg active:scale-95 transition-all z-10", a.indicator, x, t ? "left-0.5" : "right-0.5"),
        children: t ? /* @__PURE__ */ (0, e.jsx)(G, { className: r(a.icon, "text-[var(--theme-toggle-icon-sun)]") }) : /* @__PURE__ */ (0, e.jsx)(D, { className: r(a.icon, "text-[var(--theme-toggle-icon-moon)]") })
      }),
      /* @__PURE__ */ (0, e.jsx)("button", {
        type: "button",
        role: "radio",
        "aria-checked": t,
        "aria-label": "Light theme",
        onClick: () => i("light"),
        className: r("flex-1 h-full rounded-full z-20", V)
      }),
      /* @__PURE__ */ (0, e.jsx)("button", {
        type: "button",
        role: "radio",
        "aria-checked": !t,
        "aria-label": "Dark theme",
        onClick: () => i("dark"),
        className: r("flex-1 h-full rounded-full z-20", V)
      }),
      /* @__PURE__ */ (0, e.jsx)("span", {
        className: r("absolute pointer-events-none font-medium text-white transition-opacity", a.text, x, t ? "right-2 opacity-100" : "right-2 opacity-0"),
        children: "Light"
      }),
      /* @__PURE__ */ (0, e.jsx)("span", {
        className: r("absolute pointer-events-none font-medium text-white transition-opacity", a.text, x, t ? "left-2 opacity-0" : "left-2 opacity-100"),
        children: "Dark"
      })
    ]
  });
}
function pt({ isLight: t, onThemeChange: i, sizes: a }) {
  return /* @__PURE__ */ (0, e.jsxs)("div", {
    className: r("flex items-center", a.gap),
    role: "radiogroup",
    "aria-label": "Theme selector",
    "data-slot": "switch",
    children: [/* @__PURE__ */ (0, e.jsx)("button", {
      type: "button",
      role: "radio",
      "aria-checked": t,
      "aria-label": `Switch to ${t ? "dark" : "light"} theme`,
      onClick: () => i(t ? "dark" : "light"),
      className: r("relative rounded-full transition-[colors,box-shadow] hover:shadow-[0_0_0_3px_var(--ring)/0.1] active:scale-[0.97]", a.track, x, V, t ? "bg-[var(--theme-toggle-track-bg)]" : "bg-[var(--primary)]"),
      children: /* @__PURE__ */ (0, e.jsx)("div", { className: r("absolute top-1/2 -translate-y-1/2 rounded-full bg-[var(--theme-toggle-indicator-surface)] shadow-md group-active:shadow-sm transition-all", a.indicator, x, t ? "left-0.5" : "right-0.5") })
    }), /* @__PURE__ */ (0, e.jsx)("div", {
      className: r(a.icon, "text-[var(--muted-foreground)]"),
      children: t ? /* @__PURE__ */ (0, e.jsx)(D, { className: "size-full" }) : /* @__PURE__ */ (0, e.jsx)(G, { className: "size-full" })
    })]
  });
}
function gt({ isLight: t, onThemeChange: i, sizes: a }) {
  return /* @__PURE__ */ (0, e.jsxs)("div", {
    className: r("relative flex items-center justify-between rounded-full bg-[var(--theme-toggle-track-bg)]", a.width, a.height, a.padding),
    role: "radiogroup",
    "aria-label": "Theme selector",
    "data-slot": "switch",
    children: [
      /* @__PURE__ */ (0, e.jsx)("button", {
        type: "button",
        role: "radio",
        "aria-checked": !t,
        "aria-label": "Dark theme",
        tabIndex: t ? 0 : -1,
        "aria-hidden": t ? void 0 : !0,
        onClick: () => i("dark"),
        className: r("z-10 flex items-center justify-center rounded-full transition-opacity", a.indicator, x, V, t ? "opacity-50" : "opacity-0"),
        children: /* @__PURE__ */ (0, e.jsx)(D, { className: r(a.icon, "text-[var(--foreground)]") })
      }),
      /* @__PURE__ */ (0, e.jsx)("button", {
        type: "button",
        role: "radio",
        "aria-checked": t,
        "aria-label": "Light theme",
        tabIndex: t ? -1 : 0,
        "aria-hidden": t ? !0 : void 0,
        onClick: () => i("light"),
        className: r("z-10 flex items-center justify-center rounded-full transition-opacity", a.indicator, x, V, t ? "opacity-0" : "opacity-50"),
        children: /* @__PURE__ */ (0, e.jsx)(G, { className: r(a.icon, "text-[var(--foreground)]") })
      }),
      /* @__PURE__ */ (0, e.jsx)("div", {
        className: r("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded-full bg-[var(--theme-toggle-indicator-surface)] shadow-md hover:shadow-lg active:scale-95 transition-all", a.indicator, x, t ? "right-0.5" : "left-0.5"),
        children: t ? /* @__PURE__ */ (0, e.jsx)(G, { className: r(a.icon, "text-[var(--theme-toggle-icon-sun)]") }) : /* @__PURE__ */ (0, e.jsx)(D, { className: r(a.icon, "text-[var(--theme-toggle-icon-moon)]") })
      })
    ]
  });
}
function xt({ isLight: t, onThemeChange: i, sizes: a }) {
  return /* @__PURE__ */ (0, e.jsxs)("div", {
    className: r("inline-flex items-center rounded bg-[var(--theme-toggle-track-bg)]", a.height, a.padding, a.gap),
    role: "radiogroup",
    "aria-label": "Theme selector",
    "data-slot": "switch",
    children: [/* @__PURE__ */ (0, e.jsxs)("button", {
      type: "button",
      role: "radio",
      "aria-checked": t,
      "aria-label": "Light theme",
      onClick: () => i("light"),
      className: r("flex items-center justify-center gap-1 rounded px-2 whitespace-nowrap transition-all", a.height, a.text, x, V, t ? "bg-[var(--theme-toggle-indicator-bg)] text-[var(--foreground)] shadow-sm" : "text-[var(--foreground)] opacity-50 hover:opacity-70 active:scale-[0.97]"),
      children: [/* @__PURE__ */ (0, e.jsx)(G, { className: a.icon }), /* @__PURE__ */ (0, e.jsx)("span", { children: "Light" })]
    }), /* @__PURE__ */ (0, e.jsxs)("button", {
      type: "button",
      role: "radio",
      "aria-checked": !t,
      "aria-label": "Dark theme",
      onClick: () => i("dark"),
      className: r("flex items-center justify-center gap-1 rounded px-2 whitespace-nowrap transition-all", a.height, a.text, x, V, t ? "text-[var(--foreground)] opacity-50 hover:opacity-70 active:scale-[0.97]" : "bg-[var(--primary)] text-[var(--primary-foreground)] shadow-sm"),
      children: [/* @__PURE__ */ (0, e.jsx)(D, { className: a.icon }), /* @__PURE__ */ (0, e.jsx)("span", { children: "Dark" })]
    })]
  });
}
var ft = {
  "theme-gradient": "gradient",
  "theme-switch": "switch",
  "theme-pill": "pill",
  "theme-segmented": "segmented"
}, he = o.forwardRef(({ variant: t, size: i = "md", label: a, orientation: m = "vertical", checked: s, onCheckedChange: p, className: n, description: d, labelPosition: c, switchStyle: _, withIcon: O, thumbIconOn: I, thumbIconOff: $, showOnOff: f, onLabel: j, offLabel: B, defaultChecked: U, ...P }, C) => {
  const W = typeof n == "function" ? void 0 : n, [F, z] = (0, o.useState)(!1);
  (0, o.useEffect)(() => {
    z(!0);
  }, []);
  const R = tt(), K = R?.theme, S = R?.setTheme, v = s !== void 0, k = v ? s ? "dark" : "light" : K ?? "light", N = o.useCallback((T) => {
    v ? p?.(T === "dark") : S && S(T);
  }, [
    v,
    p,
    S
  ]), E = ft[t], b = lt[i][E];
  if (!F && !v) return /* @__PURE__ */ (0, e.jsx)("div", {
    className: r("inline-flex", W),
    children: /* @__PURE__ */ (0, e.jsx)("div", {
      className: r("rounded-full bg-[var(--surface-1)] animate-pulse", b.skeletonWidth, b.skeletonHeight),
      role: "radiogroup",
      "aria-label": typeof a == "string" ? a : "Theme selector"
    })
  });
  const H = k === "light";
  let w;
  switch (E) {
    case "gradient":
      w = /* @__PURE__ */ (0, e.jsx)(mt, {
        isLight: H,
        onThemeChange: N,
        sizes: b
      });
      break;
    case "switch":
      w = /* @__PURE__ */ (0, e.jsx)(pt, {
        isLight: H,
        onThemeChange: N,
        sizes: b
      });
      break;
    case "pill":
      w = /* @__PURE__ */ (0, e.jsx)(gt, {
        isLight: H,
        onThemeChange: N,
        sizes: b
      });
      break;
    case "segmented":
      w = /* @__PURE__ */ (0, e.jsx)(xt, {
        isLight: H,
        onThemeChange: N,
        sizes: b
      });
      break;
  }
  const h = P;
  return a ? /* @__PURE__ */ (0, e.jsxs)("div", {
    ref: C,
    className: r("inline-flex", m === "vertical" ? "flex-col items-start gap-2" : "flex-row items-center gap-3", W),
    ...h,
    children: [/* @__PURE__ */ (0, e.jsx)("span", {
      className: "text-xs font-semibold text-[var(--muted-foreground)]",
      children: a
    }), w]
  }) : /* @__PURE__ */ (0, e.jsx)("div", {
    ref: C,
    className: W,
    ...h,
    children: w
  });
});
he.displayName = "ThemeVariantRenderer";
function vt(t) {
  return !t.startsWith("theme-");
}
var Y = o.forwardRef(({ label: t, description: i, labelPosition: a = "right", orientation: m, className: s, id: p, size: n = "md", variant: d = "primary", switchStyle: c = "solid", withIcon: _, thumbIconOn: O, thumbIconOff: I, showOnOff: $, onLabel: f, offLabel: j, checked: B, defaultChecked: U = !1, onCheckedChange: P, ...C }, W) => {
  if (!vt(d)) return /* @__PURE__ */ (0, e.jsx)(he, {
    ref: W,
    variant: d,
    size: n,
    label: t,
    orientation: m,
    checked: B,
    onCheckedChange: P,
    className: s,
    ...C
  });
  const F = d, z = o.useId(), R = p || z, [K, S] = o.useState(U), v = B !== void 0, k = v ? B : K, N = o.useCallback((y) => {
    v || S(y), P?.(y);
  }, [v, P]), E = $ || !!f || !!j, b = E ? nt : at, H = E ? ot : it, w = c === "solid" ? r("data-unchecked:bg-input dark:data-unchecked:bg-input/80 border-transparent", st[F]) : r("data-unchecked:bg-transparent data-checked:bg-transparent border-input", dt[F]), h = c === "solid" ? "bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground" : r("bg-input dark:bg-foreground", ct[F]), T = _ || O || I, g = T ? O || /* @__PURE__ */ (0, e.jsx)(we, { className: ie[n] }) : null, M = T ? I || /* @__PURE__ */ (0, e.jsx)(ye, { className: ie[n] }) : null, q = /* @__PURE__ */ (0, e.jsxs)(Le, {
    ref: W,
    id: R,
    "data-slot": "switch",
    "data-size": n,
    "data-variant": F,
    "data-style": c,
    className: r("peer group/switch relative inline-flex items-center shrink-0 rounded-full border shadow-xs", "transition-[colors,box-shadow,border-color] duration-200 ease-smooth motion-reduce:transition-none outline-none", "after:absolute after:-inset-x-3 after:-inset-y-[13px]", "data-disabled:cursor-not-allowed data-disabled:opacity-50", "not-data-disabled:hover:shadow-[0_0_0_3px_var(--ring)/0.08] not-data-disabled:active:scale-[0.97]", "motion-reduce:active:scale-100", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 aria-invalid:ring-[3px]", b[n], w, s),
    checked: k,
    onCheckedChange: N,
    ...C,
    children: [E && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [/* @__PURE__ */ (0, e.jsx)("span", {
      "aria-hidden": "true",
      className: r("absolute font-semibold transition-opacity duration-200 ease-smooth motion-reduce:transition-none", ne[n], "start-1.5", k ? "opacity-100" : "opacity-0", c === "solid" ? "text-primary-foreground" : "text-current"),
      children: f || "ON"
    }), /* @__PURE__ */ (0, e.jsx)("span", {
      "aria-hidden": "true",
      className: r("absolute font-semibold transition-opacity duration-200 ease-smooth motion-reduce:transition-none", ne[n], "end-1.5", k ? "opacity-0" : "opacity-100", c === "solid" ? "text-muted-foreground" : "text-current"),
      children: j || "OFF"
    })] }), /* @__PURE__ */ (0, e.jsx)(Ae, {
      "data-slot": "switch-thumb",
      className: r("pointer-events-none block rounded-full ring-0", "shadow-sm group-hover/switch:shadow-md group-active/switch:shadow-sm", "transition-[transform,box-shadow,background-color] duration-200 motion-reduce:transition-none", "ease-[cubic-bezier(0.34,1.56,0.64,1)]", "group-hover/switch:scale-110 group-active/switch:scale-95", "data-unchecked:translate-x-0", rt[n], H[n], h, T && "flex items-center justify-center"),
      children: T && /* @__PURE__ */ (0, e.jsx)("span", {
        "aria-hidden": "true",
        className: r("flex items-center justify-center transition-colors duration-200 ease-smooth motion-reduce:transition-none", c === "solid" ? "text-muted-foreground group-data-checked/switch:text-primary" : "text-background group-data-checked/switch:text-primary-foreground"),
        children: k ? g : M
      })
    })]
  });
  return t ? /* @__PURE__ */ (0, e.jsxs)("div", {
    className: r("flex items-center gap-3", a === "left" && "flex-row-reverse justify-end"),
    children: [q, /* @__PURE__ */ (0, e.jsxs)("div", {
      className: "flex flex-col gap-0.5",
      children: [/* @__PURE__ */ (0, e.jsx)("label", {
        htmlFor: R,
        className: "text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
        children: t
      }), i && /* @__PURE__ */ (0, e.jsx)("p", {
        className: "text-sm text-muted-foreground",
        children: i
      })]
    })]
  }) : q;
});
Y.displayName = "SwitchControl";
var kt = o.forwardRef((t, i) => {
  const { label: a, description: m, error: s, tooltip: p, required: n, labelIcon: d, fieldClassName: c, ..._ } = t;
  return s || p || n || d ? /* @__PURE__ */ (0, e.jsxs)(Ue, {
    layout: "inline",
    state: s ? "destructive" : void 0,
    disabled: _.disabled,
    className: c,
    children: [
      /* @__PURE__ */ (0, e.jsx)(Y, {
        ref: i,
        ..._
      }),
      a && /* @__PURE__ */ (0, e.jsxs)(Je, {
        required: n,
        labelIcon: d,
        children: [a, p && /* @__PURE__ */ (0, e.jsx)(Se, { content: p })]
      }),
      (s || m) && /* @__PURE__ */ (0, e.jsxs)(Ge, { children: [s && /* @__PURE__ */ (0, e.jsx)($e, { children: s }), !s && m && /* @__PURE__ */ (0, e.jsx)(De, { children: m })] })
    ]
  }) : /* @__PURE__ */ (0, e.jsx)(Y, {
    ref: i,
    label: a,
    description: m,
    ..._
  });
});
kt.displayName = "Switch";
export {
  kt as t
};

//# sourceMappingURL=Switch.js.map