import { n as e } from "./popover-IztNF45J.js";
import { n as t } from "./flex-C7njxZ74.js";
import { Text as n } from "../text/index.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 { jsx as f, jsxs as p } from "react/jsx-runtime";
import { CheckCheckIcon as m, ChevronLeftIcon as h, ChevronRightIcon as g, CircleAlertIcon as _, CircleCheckIcon as v, CircleXIcon as y, CopyIcon as b, InfoIcon as x } from "lucide-react";
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__ */ f("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__ */ f("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__ */ p("span", {
		ref: a,
		className: i,
		children: [t, /* @__PURE__ */ f(e, {
			openOnHover: r,
			placement: n,
			content: s ? "Скопировано!" : "Копировать текст",
			children: /* @__PURE__ */ f("button", {
				onClick: o,
				"aria-label": s ? "Скопировано!" : "Копировать текст",
				children: s ? /* @__PURE__ */ f(m, { className: "block statusSuccess" }) : /* @__PURE__ */ f(b, { className: "block statusInfo" })
			})
		})]
	});
}, O = { wrapper: "_0wk7Sq" };
//#endregion
//#region src/misc/IconWrapper.tsx
function k({ className: e, children: t }) {
	return /* @__PURE__ */ f("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__ */ f(t, {
	className: d("paddingMd textCenter", e),
	minHeight: a,
	children: /* @__PURE__ */ f(n, {
		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__ */ p(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__ */ f(M, { text: "Ожидание компонента..." });
	return r && !c ? l : /* @__PURE__ */ f(i, {
		fallback: l,
		children: /* @__PURE__ */ f(s, { ...o ?? {} })
	});
}
//#endregion
//#region src/misc/SkeletonLine.tsx
var L = ({ as: e, className: t, ...n }) => /* @__PURE__ */ f(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__ */ f(L, { children: "Загрузка..." }) : e ?? "-";
}
//#endregion
//#region src/misc/NoData.tsx
var z = ({ className: e, text: t, minHeight: n = "5em" }) => /* @__PURE__ */ f(j, {
	className: e,
	color: "muted",
	minHeight: n,
	children: t || "Нет данных"
}), B = ({ className: e, isError: t, children: n }) => /* @__PURE__ */ f(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), [m, _] = l(!1), [v, y] = l(!1), b = o(() => {
		let e = a.current;
		return e ? n ? Array.from(e.querySelectorAll(n)) : Array.from(e.children).filter((e) => e instanceof HTMLElement) : [];
	}, [n]), x = 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) {
			_(!1), y(!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;
		_((e) => e === r ? e : r), y((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 = b()[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"
		});
	}, [b, 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 = x(t);
			n && T(n);
		};
		return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
	}, [T, x]), 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 = m || v;
	return /* @__PURE__ */ p("div", {
		className: d(V.oneStepScroller, t),
		style: { position: "relative" },
		children: [
			k && /* @__PURE__ */ f("button", {
				type: "button",
				"aria-label": "Прокрутить шаг влево",
				className: V.ossButton,
				onClick: E,
				disabled: !m,
				children: /* @__PURE__ */ f(h, {})
			}),
			/* @__PURE__ */ f("div", {
				className: V.ossViewport,
				onKeyDown: O,
				role: "group",
				"aria-label": "Элементы прокрутки",
				children: /* @__PURE__ */ f("div", {
					className: V.ossScroller,
					ref: a,
					"aria-live": "polite",
					children: e
				})
			}),
			k && /* @__PURE__ */ f("button", {
				type: "button",
				"aria-label": "Прокрутить шаг вправо",
				className: V.ossButton,
				onClick: D,
				disabled: !v,
				children: /* @__PURE__ */ f(g, {})
			})
		]
	});
}, G = a(({ children: e, height: t, stable: n, overscroll: r, className: i }, a) => /* @__PURE__ */ f("div", {
	ref: a,
	className: d("scrollable", n && "stable", r && "overscroll", i),
	style: { height: t },
	children: e
}));
a(({ blockClassName: e, ...t }, n) => /* @__PURE__ */ f("div", {
	className: d(e, "overflowHidden w100 h100"),
	children: /* @__PURE__ */ f(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__ */ p("div", {
	className: d("flexCenter gapSm", n),
	children: [(() => {
		switch (e) {
			case "error": return /* @__PURE__ */ f(Y, {});
			case "warning": return /* @__PURE__ */ f(X, {});
			case "success": return /* @__PURE__ */ f(Z, {});
			case "information": return /* @__PURE__ */ f(Q, {});
			default: return null;
		}
	})(), t]
}), J = ({ state: e }) => {
	switch (e) {
		case "error": return /* @__PURE__ */ f(Y, {});
		case "warning": return /* @__PURE__ */ f(X, {});
		case "success": return /* @__PURE__ */ f(Z, {});
		case "information": return /* @__PURE__ */ f(Q, {});
		default: return null;
	}
}, Y = () => /* @__PURE__ */ f(y, { className: d(K.state, K.error) }), X = () => /* @__PURE__ */ f(_, { className: d(K.state, K.warning) }), Z = () => /* @__PURE__ */ f(v, { className: d(K.state, K.success) }), Q = () => /* @__PURE__ */ f(x, { 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__ */ f(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-aGQBhywJ.js.map