"use client";
import { t as e } from "./useIsoLayoutEffect-CKOv1bV_.js";
import { t, u as n } from "./useRenderElement-CmuWsiNa.js";
import { t as r } from "./useBaseUiId-DOm5ACje.js";
import { t as i } from "./useValueAsRef-CCU3eUYq.js";
import { cn as a } from "./lib/utils.js";
import { t as o } from "./visuallyHidden-CEAV1xeA.js";
import { r as s, t as c } from "./valueToPercent-9aZaNeTG.js";
import * as l from "react";
import { jsx as u, jsxs as d } from "react/jsx-runtime";
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/utils/useRegisteredLabelId.js
function f(t, n) {
	let i = r(t);
	return e(() => (n(i), () => {
		n(void 0);
	}), [i, n]), i;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/root/ProgressRootContext.js
var p = /*#__PURE__*/ l.createContext(void 0);
process.env.NODE_ENV !== "production" && (p.displayName = "ProgressRootContext");
function m() {
	let e = l.useContext(p);
	if (e === void 0) throw Error(process.env.NODE_ENV === "production" ? n(51) : "Base UI: ProgressRootContext is missing. Progress parts must be placed within <Progress.Root>.");
	return e;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/root/ProgressRootDataAttributes.js
var h = /*#__PURE__*/ function(e) {
	return e.complete = "data-complete", e.indeterminate = "data-indeterminate", e.progressing = "data-progressing", e;
}({}), g = { status(e) {
	return e === "progressing" ? { [h.progressing]: "" } : e === "complete" ? { [h.complete]: "" } : e === "indeterminate" ? { [h.indeterminate]: "" } : null;
} };
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/root/ProgressRoot.js
function _(e, t) {
	return t == null ? "indeterminate progress" : e || `${t}%`;
}
var v = /*#__PURE__*/ l.forwardRef(function(e, n) {
	let { format: r, getAriaValueText: a = _, locale: c, max: f = 100, min: m = 0, value: h, render: v, className: y, children: b, style: x, ...S } = e, [C, w] = l.useState(), T = i(r), E = "indeterminate";
	Number.isFinite(h) && (E = h === f ? "complete" : "progressing");
	let D = s(h, c, T.current), O = l.useMemo(() => ({ status: E }), [E]), k = {
		"aria-labelledby": C,
		"aria-valuemax": f,
		"aria-valuemin": m,
		"aria-valuenow": h ?? void 0,
		"aria-valuetext": a(D, h),
		role: "progressbar",
		children: /*#__PURE__*/ d(l.Fragment, { children: [b, /*#__PURE__*/ u("span", {
			role: "presentation",
			style: o,
			children: "x"
		})] })
	}, A = l.useMemo(() => ({
		formattedValue: D,
		max: f,
		min: m,
		setLabelId: w,
		state: O,
		status: E,
		value: h
	}), [
		D,
		f,
		m,
		w,
		O,
		E,
		h
	]), j = t("div", e, {
		state: O,
		ref: n,
		props: [k, S],
		stateAttributesMapping: g
	});
	return /*#__PURE__*/ u(p.Provider, {
		value: A,
		children: j
	});
});
process.env.NODE_ENV !== "production" && (v.displayName = "ProgressRoot");
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/track/ProgressTrack.js
var y = /*#__PURE__*/ l.forwardRef(function(e, n) {
	let { render: r, className: i, style: a, ...o } = e, { state: s } = m();
	return t("div", e, {
		state: s,
		ref: n,
		props: o,
		stateAttributesMapping: g
	});
});
process.env.NODE_ENV !== "production" && (y.displayName = "ProgressTrack");
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/indicator/ProgressIndicator.js
var b = /*#__PURE__*/ l.forwardRef(function(e, n) {
	let { render: r, className: i, style: a, ...o } = e, { max: s, min: l, value: u, state: d } = m(), f = Number.isFinite(u) && u !== null ? c(u, l, s) : null;
	return t("div", e, {
		state: d,
		ref: n,
		props: [{ style: f == null ? {} : {
			insetInlineStart: 0,
			height: "inherit",
			width: `${f}%`
		} }, o],
		stateAttributesMapping: g
	});
});
process.env.NODE_ENV !== "production" && (b.displayName = "ProgressIndicator");
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/value/ProgressValue.js
var x = /*#__PURE__*/ l.forwardRef(function(e, n) {
	let { className: r, render: i, children: a, style: o, ...s } = e, { value: c, formattedValue: l, state: u } = m();
	return t("span", e, {
		state: u,
		ref: n,
		props: [{
			"aria-hidden": !0,
			children: typeof a == "function" ? a(c == null ? "indeterminate" : l, c) : c == null ? null : l
		}, s],
		stateAttributesMapping: g
	});
});
process.env.NODE_ENV !== "production" && (x.displayName = "ProgressValue");
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/progress/label/ProgressLabel.js
var S = /*#__PURE__*/ l.forwardRef(function(e, n) {
	let { render: r, className: i, style: a, id: o, ...s } = e, { setLabelId: c, state: l } = m();
	return t("span", e, {
		state: l,
		ref: n,
		props: [{
			id: f(o, c),
			role: "presentation"
		}, s],
		stateAttributesMapping: g
	});
});
process.env.NODE_ENV !== "production" && (S.displayName = "ProgressLabel");
//#endregion
//#region lib/components/ui/atoms/progress.tsx
function C({ className: e, children: t, value: n, ...r }) {
	return /* @__PURE__ */ d(v, {
		className: a("flex flex-wrap gap-3", e),
		"data-slot": "progress",
		value: n,
		...r,
		children: [t, /* @__PURE__ */ u(w, { children: /* @__PURE__ */ u(T, {}) })]
	});
}
function w({ className: e, ...t }) {
	return /* @__PURE__ */ u(y, {
		className: a("relative flex h-1.5 w-full items-center overflow-x-hidden rounded-full bg-muted", e),
		"data-slot": "progress-track",
		...t
	});
}
function T({ className: e, ...t }) {
	return /* @__PURE__ */ u(b, {
		className: a("h-full bg-primary transition-all", e),
		"data-slot": "progress-indicator",
		...t
	});
}
function E({ className: e, ...t }) {
	return /* @__PURE__ */ u(S, {
		className: a("font-medium text-sm", e),
		"data-slot": "progress-label",
		...t
	});
}
function D({ className: e, ...t }) {
	return /* @__PURE__ */ u(x, {
		className: a("ml-auto text-muted-foreground text-sm tabular-nums", e),
		"data-slot": "progress-value",
		...t
	});
}
//#endregion
export { D as a, w as i, T as n, E as r, C as t };
