import { o as x } from "./rolldown-runtime.js";
import { i as p, t as g } from "./vendor/react.js";
import { t as u } from "./dist.js";
import { t as h } from "./utils.js";
var f = /* @__PURE__ */ x(p(), 1), e = g(), y = u("flex flex-col items-center justify-center", {
  variants: { size: {
    sm: "gap-4",
    md: "gap-4",
    lg: "gap-4",
    xl: "gap-5"
  } },
  defaultVariants: { size: "sm" }
}), j = u("font-medium text-secondary-foreground text-center", {
  variants: { size: {
    sm: "text-sm leading-5",
    md: "text-sm leading-5",
    lg: "text-lg leading-7",
    xl: "text-lg leading-7"
  } },
  defaultVariants: { size: "sm" }
}), m = {
  sm: {
    dimension: 32,
    strokeWidth: 3
  },
  md: {
    dimension: 48,
    strokeWidth: 4
  },
  lg: {
    dimension: 56,
    strokeWidth: 5
  },
  xl: {
    dimension: 64,
    strokeWidth: 5
  }
};
function k({ size: a, color: t = "var(--primary)", trackColor: i = "var(--border)" }) {
  const n = m[a], s = (n.dimension - n.strokeWidth) / 2, r = 2 * Math.PI * s, o = r * 0.25;
  return /* @__PURE__ */ (0, e.jsxs)("svg", {
    width: n.dimension,
    height: n.dimension,
    viewBox: `0 0 ${n.dimension} ${n.dimension}`,
    className: "animate-spin motion-reduce:animate-none",
    style: { animationDuration: "1s" },
    "aria-hidden": "true",
    children: [/* @__PURE__ */ (0, e.jsx)("circle", {
      cx: n.dimension / 2,
      cy: n.dimension / 2,
      r: s,
      fill: "none",
      stroke: i,
      strokeWidth: n.strokeWidth,
      strokeLinecap: "round"
    }), /* @__PURE__ */ (0, e.jsx)("circle", {
      cx: n.dimension / 2,
      cy: n.dimension / 2,
      r: s,
      fill: "none",
      stroke: t,
      strokeWidth: n.strokeWidth,
      strokeLinecap: "round",
      strokeDasharray: `${o} ${r - o}`,
      strokeDashoffset: r * 0.25
    })]
  });
}
function v({ size: a, color: t = "var(--primary)" }) {
  const i = m[a], n = (i.dimension - i.strokeWidth) / 2, s = 2 * Math.PI * n, r = s * 0.7, o = f.useId();
  return /* @__PURE__ */ (0, e.jsxs)("svg", {
    width: i.dimension,
    height: i.dimension,
    viewBox: `0 0 ${i.dimension} ${i.dimension}`,
    className: "animate-spin motion-reduce:animate-none",
    style: { animationDuration: "0.8s" },
    "aria-hidden": "true",
    children: [/* @__PURE__ */ (0, e.jsx)("defs", { children: /* @__PURE__ */ (0, e.jsxs)("linearGradient", {
      id: o,
      x1: "0%",
      y1: "0%",
      x2: "100%",
      y2: "0%",
      children: [/* @__PURE__ */ (0, e.jsx)("stop", {
        offset: "0%",
        stopColor: t,
        stopOpacity: "0"
      }), /* @__PURE__ */ (0, e.jsx)("stop", {
        offset: "100%",
        stopColor: t,
        stopOpacity: "1"
      })]
    }) }), /* @__PURE__ */ (0, e.jsx)("circle", {
      cx: i.dimension / 2,
      cy: i.dimension / 2,
      r: n,
      fill: "none",
      stroke: `url(#${o})`,
      strokeWidth: i.strokeWidth,
      strokeLinecap: "round",
      strokeDasharray: `${r} ${s - r}`,
      strokeDashoffset: s * 0.25
    })]
  });
}
function W({ size: a, color: t = "var(--primary)" }) {
  const i = m[a], n = 12, s = i.strokeWidth * 0.6, r = (i.dimension - s * 2) / 2 - 2, o = i.dimension / 2;
  return /* @__PURE__ */ (0, e.jsx)("svg", {
    width: i.dimension,
    height: i.dimension,
    viewBox: `0 0 ${i.dimension} ${i.dimension}`,
    className: "animate-spin motion-reduce:animate-none",
    style: { animationDuration: "1s" },
    "aria-hidden": "true",
    children: Array.from({ length: n }).map((l, d) => {
      const c = (d * 360 / n - 90) * Math.PI / 180;
      return /* @__PURE__ */ (0, e.jsx)("circle", {
        cx: o + r * Math.cos(c),
        cy: o + r * Math.sin(c),
        r: s,
        fill: t,
        opacity: 0.15 + 0.85 * (d / (n - 1)) ** 2.5
      }, d);
    })
  });
}
function $({ size: a, color: t = "var(--primary)" }) {
  const i = m[a], n = i.dimension * 0.35;
  return /* @__PURE__ */ (0, e.jsxs)("svg", {
    width: i.dimension,
    height: i.dimension,
    viewBox: `0 0 ${i.dimension} ${i.dimension}`,
    "aria-hidden": "true",
    children: [/* @__PURE__ */ (0, e.jsx)("circle", {
      cx: i.dimension / 2,
      cy: i.dimension / 2,
      r: n,
      fill: t,
      opacity: 0.15
    }), /* @__PURE__ */ (0, e.jsx)("circle", {
      cx: i.dimension / 2,
      cy: i.dimension / 2,
      r: n * 0.6,
      fill: t,
      className: "delight-breathing"
    })]
  });
}
function I({ variant: a = "line-simple", size: t = "sm", showText: i = !1, text: n = "Loading...", color: s, trackColor: r, className: o, ...l }) {
  const d = t || "sm", c = () => {
    switch (a) {
      case "line-spinner":
        return /* @__PURE__ */ (0, e.jsx)(v, {
          size: d,
          color: s
        });
      case "dot-circle":
        return /* @__PURE__ */ (0, e.jsx)(W, {
          size: d,
          color: s
        });
      case "breathing":
        return /* @__PURE__ */ (0, e.jsx)($, {
          size: d,
          color: s
        });
      default:
        return /* @__PURE__ */ (0, e.jsx)(k, {
          size: d,
          color: s,
          trackColor: r
        });
    }
  };
  return /* @__PURE__ */ (0, e.jsxs)("output", {
    "data-slot": "loading-indicator",
    className: h(y({ size: t }), "delight-spinner-entrance", o),
    role: "status",
    "aria-live": "polite",
    "aria-busy": "true",
    ...l,
    children: [c(), i && /* @__PURE__ */ (0, e.jsxs)("p", {
      className: h(j({ size: t }), "delight-loading-text"),
      children: [n, /* @__PURE__ */ (0, e.jsx)("span", {
        className: "sr-only",
        children: " in progress"
      })]
    })]
  });
}
I.displayName = "LoadingIndicator";
export {
  I as t
};

//# sourceMappingURL=LoadingIndicator.js.map