import { n as e } from "./popover-xJJqy1v6.js";
import { Text as t } from "../text/index.js";
import { n } from "./flex-DYZ0IbU6.js";
import { PolymorphicComponent as r } from "../polymorphic/index.js";
import { Suspense as i, forwardRef as a, useCallback as o, useEffect as s, useRef as c, useState as l, useSyncExternalStore as u } from "react";
import { cn as d } from "@ryuzaki13/react-foundation-lib/utils";
import { CheckCheckIcon as f, ChevronLeftIcon as p, ChevronRightIcon as m, CircleAlertIcon as h, CircleCheckIcon as g, CircleXIcon as _, CopyIcon as v, InfoIcon as y } from "lucide-react";
import { jsx as b, jsxs as x } from "react/jsx-runtime";
import { useCopyElementTextWithFeedback as S } from "@ryuzaki13/react-foundation-lib/copy";
import { useLazyComponent as C } from "@ryuzaki13/react-foundation-lib/hooks";
var w = {
	logo: "l9LG-r",
	segment: "u4bkNy",
	pulseSteps: "S-r8hY"
};
//#endregion
//#region src/misc/AnimatedLogo.tsx
function T({ children: e, className: t, ...n }) {
	return /* @__PURE__ */ b("div", {
		...n,
		className: d(w.logo, t),
		children: e
	});
}
//#endregion
//#region src/misc/AnimatedLogoSegment.tsx
function E({ children: e, className: t, order: n, style: r, ...i }) {
	return /* @__PURE__ */ b("g", {
		...i,
		className: d(w.segment, t),
		style: {
			...r,
			animationDelay: `${n * 200}ms`
		},
		children: e
	});
}
//#endregion
//#region src/misc/CopyTextWrapper.tsx
var D = ({ children: t, position: n = "top", showOnHover: r = !0, className: i }) => {
	let { containerRef: a, copyElementText: o, isCopied: s } = S();
	return /* @__PURE__ */ x("span", {
		ref: a,
		className: i,
		children: [t, /* @__PURE__ */ b(e, {
			openOnHover: r,
			placement: n,
			content: s ? "Скопировано!" : "Копировать текст",
			children: /* @__PURE__ */ b("button", {
				onClick: o,
				"aria-label": s ? "Скопировано!" : "Копировать текст",
				children: s ? /* @__PURE__ */ b(f, { className: "block statusSuccess" }) : /* @__PURE__ */ b(v, { className: "block statusInfo" })
			})
		})]
	});
}, O = { wrapper: "_0wk7Sq" };
//#endregion
//#region src/misc/IconWrapper.tsx
function k({ className: e, children: t }) {
	return /* @__PURE__ */ b("div", {
		className: d(O.wrapper, e),
		children: t
	});
}
var A = { componentLoader: "qgIKVo" }, j = ({ className: e, children: r, color: i = "muted", minHeight: a, uppercase: o = !0 }) => /* @__PURE__ */ b(n, {
	className: d("paddingMd textCenter", e),
	minHeight: a,
	children: /* @__PURE__ */ b(t, {
		as: "div",
		weight: "bold",
		color: i,
		uppercase: o,
		children: r
	})
});
//#endregion
//#region src/misc/LoadingMessage.tsx
function M({ className: e, logo: t, text: n }) {
	return /* @__PURE__ */ x(j, {
		className: d(A.componentLoader, t ? void 0 : "skeletonLine", e),
		children: [t, n || "Загрузка..."]
	});
}
//#endregion
//#region src/misc/LazyDynamicComponent.tsx
var N = (e) => (e(), () => void 0), P = () => !0, F = () => !1;
function I({ fallback: e, importFunc: t, componentName: n, clientOnly: r = !1, cacheKey: a, props: o }) {
	let s = C(t, n, a), c = u(N, P, F), l = e ?? /* @__PURE__ */ b(M, { text: "Ожидание компонента..." });
	return r && !c ? l : /* @__PURE__ */ b(i, {
		fallback: l,
		children: /* @__PURE__ */ b(s, { ...o ?? {} })
	});
}
//#endregion
//#region src/misc/SkeletonLine.tsx
var L = ({ as: e, className: t, ...n }) => /* @__PURE__ */ b(r, {
	as: e || "div",
	className: d("skeletonLine colorTransparent radiusSm", t),
	...n
});
//#endregion
//#region src/misc/LazyValue.tsx
function R({ value: e, isLoading: t }) {
	return t ? /* @__PURE__ */ b(L, { children: "Загрузка..." }) : e ?? "-";
}
//#endregion
//#region src/misc/NoData.tsx
var z = ({ className: e, text: t, minHeight: n = "5em" }) => /* @__PURE__ */ b(j, {
	className: e,
	color: "muted",
	minHeight: n,
	children: t || "Нет данных"
}), B = ({ className: e, isError: t, children: n }) => /* @__PURE__ */ b(j, {
	className: e,
	color: t ? "error" : "secondary",
	children: n
}), V = {
	oneStepScroller: "_7xUQBN",
	ossViewport: "AonLqg",
	ossScroller: "j-5yFn",
	ossButton: "pOIq63"
}, H = 1;
function U(e) {
	return Math.max(0, e.scrollWidth - e.clientWidth);
}
var W = ({ children: e, className: t, itemSelector: n, scrollPadding: r = 6, smooth: i = !0 }) => {
	let a = c(null), u = c(null), [f, h] = l(!1), [g, _] = l(!1), v = o(() => {
		let e = a.current;
		return e ? n ? Array.from(e.querySelectorAll(n)) : Array.from(e.children).filter((e) => e instanceof HTMLElement) : [];
	}, [n]), y = o((e) => {
		let t = a.current;
		if (!t) return null;
		if (n) {
			let r = e.closest(n);
			return r && t.contains(r) ? r : null;
		}
		let r = e;
		for (; r && r.parentElement && r.parentElement !== t;) r = r.parentElement;
		return r && r.parentElement === t ? r : null;
	}, [n]), S = o(() => {
		let e = a.current;
		if (!e) {
			h(!1), _(!1);
			return;
		}
		let t = Math.max(0, e.scrollWidth - e.clientWidth), n = Math.max(0, Math.min(e.scrollLeft, t)), r = n > H, i = n < t - H;
		h((e) => e === r ? e : r), _((e) => e === i ? e : i);
	}, []), C = o(() => {
		u.current === null && (u.current = requestAnimationFrame(() => {
			u.current = null, S();
		}));
	}, [S]), w = o((e) => {
		let t = a.current;
		if (!t) return;
		let n = v()[0];
		if (!n) return;
		let r = n.getBoundingClientRect().width;
		if (!r) return;
		let o = Math.round(e * r), s = Math.max(0, t.scrollWidth - t.clientWidth), c = Math.max(0, Math.min(t.scrollLeft + o, s));
		t.scrollTo({
			left: c,
			behavior: i ? "smooth" : "auto"
		});
	}, [v, i]), T = o((e) => {
		let t = a.current;
		if (!t) return;
		let n = t.getBoundingClientRect(), o = e.getBoundingClientRect(), s = o.left - n.left + t.scrollLeft, c = s + o.width, l = t.scrollLeft, u = t.scrollLeft + t.clientWidth;
		if (s >= l + H && c <= u - H) return;
		let d = t.scrollLeft;
		s < l ? d = Math.max(0, s - r) : c > u && (d = Math.min(U(t), c - t.clientWidth + r)), t.scrollTo({
			left: Math.round(d),
			behavior: i ? "smooth" : "auto"
		});
	}, [r, i]);
	s(() => {
		let e = a.current;
		if (!e) return;
		let t = (e) => {
			let t = e.target;
			if (!(t instanceof HTMLElement)) return;
			let n = y(t);
			n && T(n);
		};
		return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
	}, [T, y]), s(() => {
		let e = a.current;
		if (!e) return;
		let t = () => C();
		e.addEventListener("scroll", t, { passive: !0 });
		let n = null;
		typeof ResizeObserver < "u" && (n = new ResizeObserver(C), n.observe(e));
		let r = null;
		return typeof MutationObserver < "u" && (r = new MutationObserver(C), r.observe(e, {
			childList: !0,
			subtree: !1
		})), C(), () => {
			e.removeEventListener("scroll", t), n?.disconnect(), r?.disconnect(), u.current !== null && (cancelAnimationFrame(u.current), u.current = null);
		};
	}, [C]), s(() => {
		C();
	}, [e, C]);
	let E = () => w(-1), D = () => w(1), O = (e) => {
		e.key === "ArrowLeft" ? (e.preventDefault(), E()) : e.key === "ArrowRight" && (e.preventDefault(), D());
	}, k = f || g;
	return /* @__PURE__ */ x("div", {
		className: d(V.oneStepScroller, t),
		style: { position: "relative" },
		children: [
			k && /* @__PURE__ */ b("button", {
				type: "button",
				"aria-label": "Прокрутить шаг влево",
				className: V.ossButton,
				onClick: E,
				disabled: !f,
				children: /* @__PURE__ */ b(p, {})
			}),
			/* @__PURE__ */ b("div", {
				className: V.ossViewport,
				onKeyDown: O,
				role: "group",
				"aria-label": "Элементы прокрутки",
				children: /* @__PURE__ */ b("div", {
					className: V.ossScroller,
					ref: a,
					"aria-live": "polite",
					children: e
				})
			}),
			k && /* @__PURE__ */ b("button", {
				type: "button",
				"aria-label": "Прокрутить шаг вправо",
				className: V.ossButton,
				onClick: D,
				disabled: !g,
				children: /* @__PURE__ */ b(m, {})
			})
		]
	});
}, G = a(({ children: e, height: t, stable: n, overscroll: r, className: i }, a) => /* @__PURE__ */ b("div", {
	ref: a,
	className: d("scrollable", n && "stable", r && "overscroll", i),
	style: { height: t },
	children: e
}));
a(({ blockClassName: e, ...t }, n) => /* @__PURE__ */ b("div", {
	className: d(e, "overflowHidden w100 h100"),
	children: /* @__PURE__ */ b(G, {
		ref: n,
		...t
	})
}));
var K = {
	stateWrapper: "UMTbLD",
	status: "cz57Fx",
	information: "oPzAxu",
	success: "MBu26r",
	warning: "_03z-1l",
	error: "_0RqsqJ",
	state: "mXkUoM"
}, q = ({ state: e = "none", text: t, className: n }) => /* @__PURE__ */ x("div", {
	className: d("flexCenter gapSm", n),
	children: [(() => {
		switch (e) {
			case "error": return /* @__PURE__ */ b(Y, {});
			case "warning": return /* @__PURE__ */ b(X, {});
			case "success": return /* @__PURE__ */ b(Z, {});
			case "information": return /* @__PURE__ */ b(Q, {});
			default: return null;
		}
	})(), t]
}), J = ({ state: e }) => {
	switch (e) {
		case "error": return /* @__PURE__ */ b(Y, {});
		case "warning": return /* @__PURE__ */ b(X, {});
		case "success": return /* @__PURE__ */ b(Z, {});
		case "information": return /* @__PURE__ */ b(Q, {});
		default: return null;
	}
}, Y = () => /* @__PURE__ */ b(_, { className: d(K.state, K.error) }), X = () => /* @__PURE__ */ b(h, { className: d(K.state, K.warning) }), Z = () => /* @__PURE__ */ b(g, { className: d(K.state, K.success) }), Q = () => /* @__PURE__ */ b(y, { className: d(K.state, K.information) });
//#endregion
//#region src/misc/StateWrapper.tsx
function $({ as: e, state: t, className: n, ...i }) {
	let a = t?.toLowerCase() ?? "none", o = K[a], s = a && a !== "none";
	return /* @__PURE__ */ b(r, {
		as: e || "div",
		className: d(K.stateWrapper, s && K.status, o, n),
		...i
	});
}
//#endregion
export { k as _, q as a, T as b, G as c, z as d, R as f, j as g, M as h, J as i, W as l, I as m, Y as n, Z as o, L as p, Q as r, X as s, $ as t, B as u, D as v, E as y };

//# sourceMappingURL=misc-DIF5h9ba.js.map