copper-ui
Version:
Modern React UI components library with TypeScript support, built on top of Ant Design
1,446 lines • 148 kB
JavaScript
import * as U from "react";
import { createContext as Ot, useContext as Lt, useState as F, useCallback as Z, useEffect as oe, useMemo as Y, isValidElement as Ue, Fragment as Rt, useRef as se, useLayoutEffect as un, memo as Ke } from "react";
import { jsx as r, jsxs as b, Fragment as L } from "react/jsx-runtime";
import { clsx as dn } from "clsx";
import { Tooltip as H, Popover as ne, Button as V, theme as B, Spin as fn, Typography as j, Tag as Ft, Radio as rt, DatePicker as Bt, Input as Ne, InputNumber as lt, Select as Wt, Checkbox as hn, Flex as Fe, Empty as ke, Pagination as $t, ConfigProvider as mn, Form as Be, Popconfirm as pn, Badge as ge, Timeline as gn } from "antd";
import { CustomerServiceOutlined as vn, AppstoreOutlined as Et, LoadingOutlined as yn, CloseOutlined as bn, CloseCircleFilled as _n, SearchOutlined as wn, CheckOutlined as Nn, QuestionCircleOutlined as kn, FilterFilled as xn, CaretUpOutlined as Sn, CaretDownOutlined as Tn, InfoCircleOutlined as Cn, EyeOutlined as Pn, EyeInvisibleOutlined as An, SettingOutlined as Mn, PlusOutlined as In, ArrowRightOutlined as Dn } from "@ant-design/icons";
import { createParser as Te, parseAsString as Q, parseAsArrayOf as We, parseAsBoolean as On, useQueryState as it, parseAsInteger as at, useQueryStates as Ln } from "nuqs";
import X from "dayjs";
import { format as Ye } from "date-fns";
import { flexRender as ct, useReactTable as Rn, getExpandedRowModel as Fn, getCoreRowModel as Bn } from "@tanstack/react-table";
const Yt = Ot(null);
function Ce() {
return Lt(Yt);
}
function re() {
const e = Ce();
if (!e)
throw new Error("useAppShell must be used inside AppShellProvider");
return e;
}
function w(...e) {
return dn(e);
}
const zt = "223px", Gt = "64px", Wn = "b";
function $n(e) {
return e ? "expanded" : "collapsed";
}
function En({
defaultOpen: e,
persistenceAdapter: t
}) {
var l;
const n = (l = t == null ? void 0 : t.read) == null ? void 0 : l.call(t);
return typeof n == "boolean" ? n : e ?? !0;
}
function Yn({
sidebarWidth: e,
width: t = zt,
collapsedWidth: n = Gt,
style: l
}) {
return {
"--cu-sidebar-width": e ?? t,
"--cu-sidebar-collapsed-width": n,
...l
};
}
function xi({
children: e,
defaultOpen: t,
open: n,
onOpenChange: l,
keyboardShortcut: i = Wn,
sidebarWidth: o,
width: c,
collapsedWidth: a = Gt,
persistenceAdapter: s,
className: f,
style: u,
...d
}) {
const [h, p] = F(
() => En({ defaultOpen: t, persistenceAdapter: s })
), g = n ?? h, y = $n(g), v = n !== void 0, m = o ?? c ?? zt, _ = Z(
(M) => {
var x;
const D = typeof M == "function" ? M(g) : M;
v || p(D), (x = s == null ? void 0 : s.write) == null || x.call(s, D), l == null || l(D);
},
[v, l, g, s]
), N = Z(() => {
_((M) => !M);
}, [_]);
oe(() => {
if (!i)
return;
const M = i.toLowerCase(), D = (x) => {
(x.metaKey || x.ctrlKey) && x.key.toLowerCase() === M && (x.preventDefault(), N());
};
return window.addEventListener("keydown", D), () => window.removeEventListener("keydown", D);
}, [i, N]);
const C = Y(
() => ({
open: g,
state: y,
width: m,
collapsedWidth: a,
setOpen: _,
toggleOpen: N
}),
[a, g, m, _, y, N]
);
return /* @__PURE__ */ r(Yt.Provider, { value: C, children: /* @__PURE__ */ r(
"div",
{
...d,
"data-cu-app-shell-provider": "",
"data-state": y,
"data-open": g,
className: w("cu-app-shell-provider", f),
style: Yn({ sidebarWidth: o, width: c, collapsedWidth: a, style: u }),
children: e
}
) });
}
function zn({
className: e,
onClick: t,
type: n = "button",
"aria-label": l = "Toggle sidebar",
...i
}) {
const { state: o, toggleOpen: c } = re();
return /* @__PURE__ */ r(
"button",
{
...i,
type: n,
"aria-label": l,
"data-cu-sidebar-rail": "",
"data-state": o,
className: w("cu-sidebar-rail", e),
onClick: (a) => {
t == null || t(a), a.defaultPrevented || c();
}
}
);
}
function Si({ sidebar: e, side: t = "left", className: n, style: l, children: i, ...o }) {
const { open: c, state: a } = re(), s = c ? "var(--cu-sidebar-width)" : "var(--cu-sidebar-collapsed-width)", f = e ? /* @__PURE__ */ r(
"div",
{
"aria-hidden": "true",
"data-cu-app-shell-gap": "",
className: "cu-app-shell__gap",
style: { width: s, transitionDuration: "var(--cu-sidebar-transition-duration, 200ms)" }
}
) : null, u = e ? /* @__PURE__ */ b(
"aside",
{
"data-cu-app-shell-sidebar": "",
"data-state": a,
"data-side": t,
className: "cu-app-shell__sidebar",
style: { width: s, transitionDuration: "var(--cu-sidebar-transition-duration, 200ms)" },
children: [
e,
/* @__PURE__ */ r(zn, { "aria-label": "Toggle sidebar" })
]
}
) : null;
return /* @__PURE__ */ b(
"div",
{
...o,
"data-state": a,
"data-side": t,
className: w("cu-app-shell", n),
style: l,
children: [
f,
u,
i
]
}
);
}
function Ti({ className: e, ...t }) {
const n = Ce();
return /* @__PURE__ */ r(
"main",
{
"data-state": n == null ? void 0 : n.state,
className: w("cu-sidebar-inset", e),
...t
}
);
}
function jt(e, t = {}) {
const { context: n, guard: l } = t, i = (o, c, a, s) => {
var g;
const f = [...s, o.id], u = ((g = o.children) == null ? void 0 : g.map((y) => i(y, c + 1, o.id, f)).filter((y) => y !== null)) ?? [], d = l ? l({
item: o,
context: n,
depth: c,
parentId: a,
parentIds: s
}) : !0, h = u.length > 0, p = !!o.href;
return !d && !h || !p && !h ? null : {
...o,
children: h ? u : void 0
};
};
return e.map((o) => i(o, 0, null, [])).filter((o) => o !== null);
}
function Gn(e) {
const t = [], n = (l, i, o, c) => {
var a;
t.push({
item: l,
depth: i,
parentId: o,
parentIds: c
}), (a = l.children) == null || a.forEach((s) => {
n(s, i + 1, l.id, [...c, l.id]);
});
};
return e.forEach((l) => n(l, 0, null, [])), t;
}
function jn(e, t, n) {
return e.href ? typeof e.match == "function" ? e.match({ pathname: t, item: e, context: n }) ? "custom" : null : e.match === "prefix" ? t.startsWith(e.href) ? "prefix" : null : t === e.href ? "exact" : null : null;
}
function ot(e) {
return e === "exact" ? 3 : e === "custom" ? 2 : e === "prefix" ? 1 : 0;
}
function Vt(e, t, n = {}) {
const l = jt(e, n), i = Gn(l), o = i.map((u) => ({
...u,
matchedBy: jn(u.item, t, n.context)
})).filter((u) => u.matchedBy !== null), c = [...o].sort((u, d) => d.depth !== u.depth ? d.depth - u.depth : ot(d.matchedBy) - ot(u.matchedBy))[0] ?? null, a = o.map((u) => u.item.id), s = Array.from(
new Set(o.flatMap((u) => u.parentIds))
), f = i.reduce((u, d) => {
const h = o.find((g) => g.item.id === d.item.id), p = d.item.id;
return u[p] = {
...d,
id: p,
isActive: a.includes(p),
isAncestorActive: s.includes(p),
matchedBy: (h == null ? void 0 : h.matchedBy) ?? null
}, u;
}, {});
return {
activeItemId: (c == null ? void 0 : c.item.id) ?? null,
activeItemIds: a,
ancestorItemIds: s,
expandedItemIds: s,
itemsById: f
};
}
function Ci(e, t = {}) {
const n = [], l = /* @__PURE__ */ new Set(), i = (o, c) => {
var a;
o.id ? l.has(o.id) ? n.push({
code: "duplicate-id",
itemId: o.id,
message: `Duplicate navigation item id "${o.id}"`,
parentIds: c
}) : l.add(o.id) : n.push({
code: "missing-id",
itemId: "",
message: "Navigation item is missing an id",
parentIds: c
}), (a = o.children) == null || a.forEach((s) => i(s, [...c, o.id]));
};
if (e.forEach((o) => i(o, [])), n.length > 0 && t.throwOnError)
throw new Error(n.map((o) => o.message).join("; "));
return {
valid: n.length === 0,
issues: n
};
}
function Vn() {
return /* @__PURE__ */ b("div", { className: "cu-sidebar-collapse-shortcut", children: [
/* @__PURE__ */ r("span", { className: "cu-sidebar-collapse-shortcut__key", children: "ctrl" }),
/* @__PURE__ */ r("span", { className: "cu-sidebar-collapse-shortcut__plus", children: "+" }),
/* @__PURE__ */ r("span", { className: "cu-sidebar-collapse-shortcut__key", children: "b" })
] });
}
function Hn() {
return /* @__PURE__ */ r("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", children: /* @__PURE__ */ r(
"path",
{
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "2",
d: "m11.25 4.5 7.5 7.5-7.5 7.5m-6-15 7.5 7.5-7.5 7.5"
}
) });
}
function Un() {
return /* @__PURE__ */ b(L, { children: [
"Свернуть",
/* @__PURE__ */ r("br", {}),
"боковое меню"
] });
}
function Kn({
label: e = /* @__PURE__ */ r(Un, {}),
tooltip: t = /* @__PURE__ */ r(Vn, {}),
className: n,
onClick: l,
...i
}) {
const { open: o, toggleOpen: c } = re(), a = /* @__PURE__ */ b(
"button",
{
type: "button",
"data-open": o,
className: w("cu-sidebar-collapse-button", n),
onClick: (s) => {
l == null || l(s), s.defaultPrevented || c();
},
...i,
children: [
/* @__PURE__ */ r("div", { className: "cu-sidebar-collapse-button__icon-wrap", children: /* @__PURE__ */ r("span", { className: "cu-sidebar-collapse-button__icon", children: /* @__PURE__ */ r(Hn, {}) }) }),
o ? /* @__PURE__ */ r("span", { className: "cu-sidebar-collapse-button__label", children: e }) : null
]
}
);
return t ? /* @__PURE__ */ r(H, { title: t, placement: "top", children: a }) : a;
}
function Qn({ className: e, ...t }) {
return /* @__PURE__ */ r(
"div",
{
"data-cu-sidebar-content": "",
className: w("cu-sidebar-content", e),
...t
}
);
}
function Zn({ className: e, ...t }) {
return /* @__PURE__ */ r("div", { "data-cu-sidebar-footer": "", className: w("cu-sidebar-footer", e), ...t });
}
function Jn({ className: e, ...t }) {
return /* @__PURE__ */ r("div", { "data-cu-sidebar-header": "", className: w("cu-sidebar-header", e), ...t });
}
function st({ className: e, ...t }) {
return /* @__PURE__ */ r(
"div",
{
role: "separator",
className: w("cu-sidebar-separator", e),
...t
}
);
}
function Xn() {
return /* @__PURE__ */ r("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", children: /* @__PURE__ */ r(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M10.7 7.29a.98.98 0 0 0-1.41 0c-.4.39-.4 1.02 0 1.41l3.29 3.29-3.29 3.29c-.4.4-.4 1.02 0 1.41.39.4 1.02.4 1.41 0l4-3.99c.2-.2.3-.43.3-.71s-.1-.51-.3-.71z",
clipRule: "evenodd"
}
) });
}
function qn() {
return /* @__PURE__ */ r("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "4", fill: "none", viewBox: "0 0 4 4", children: /* @__PURE__ */ r("circle", { cx: "2", cy: "2", r: "2", fill: "currentColor" }) });
}
function er(e) {
return typeof e.label == "string" && e.label.length > 0 ? e.label.slice(0, 1).toUpperCase() : "•";
}
function tr(e) {
return typeof e == "object" && e !== null && !Array.isArray(e) && !Ue(e) && "value" in e;
}
function ut(e) {
return e == null || e === !1 || e === "" || e === 0 || e === "0";
}
function nr(e = "neutral") {
return e === "attention" || e === "danger" ? "cu-nav-badge--danger" : e === "warning" ? "cu-nav-badge--warning" : e === "success" ? "cu-nav-badge--success" : "cu-nav-badge--neutral";
}
function ze(e) {
return tr(e) ? (e.hideWhenZero ?? !0) && ut(e.value) ? null : /* @__PURE__ */ r(
"span",
{
"aria-label": e.ariaLabel ?? e.label,
title: e.label,
className: w("cu-nav-badge", nr(e.tone)),
children: e.value
}
) : ut(e) ? null : e;
}
function rr({
item: e,
depth: t,
hasChildren: n,
isActive: l,
isAncestorActive: i,
open: o,
expanded: c
}) {
const a = t === 0, s = t > 0, f = !e.icon && a, u = ze(e.badge);
return /* @__PURE__ */ b(
"div",
{
className: w(
"cu-primary-nav-item",
a && "cu-primary-nav-item--root",
s && "cu-primary-nav-item--child",
l && "cu-primary-nav-item--active",
i && "cu-primary-nav-item--ancestor"
),
children: [
e.icon ? /* @__PURE__ */ r(
"span",
{
className: w(
"cu-primary-nav-item__icon",
a ? "cu-primary-nav-item__icon--root" : "cu-primary-nav-item__icon--child"
),
children: e.icon
}
) : f ? /* @__PURE__ */ r("span", { className: "cu-primary-nav-item__fallback", children: er(e) }) : null,
o && /* @__PURE__ */ b(L, { children: [
/* @__PURE__ */ r("span", { className: "cu-primary-nav-item__label", children: e.label }),
u ? /* @__PURE__ */ r("span", { className: "cu-primary-nav-item__badge", children: u }) : null,
n ? /* @__PURE__ */ r(
"span",
{
"aria-hidden": "true",
className: "cu-primary-nav-item__chevron",
"data-expanded": c,
children: /* @__PURE__ */ r(Xn, {})
}
) : null
] }),
!o && n ? /* @__PURE__ */ r(
"span",
{
"aria-hidden": "true",
className: "cu-primary-nav-item__corner",
children: /* @__PURE__ */ r(qn, {})
}
) : null
]
}
);
}
function lr({
item: e,
renderLink: t,
itemState: n
}) {
var c;
const l = (a) => ({
marginInlineStart: `${Math.min(Math.max(a - 1, 0), 9) * 16}px`
}), i = (a, s) => a.map((f) => {
var m;
const u = !!((m = f.children) != null && m.length), d = (n == null ? void 0 : n.id) === f.id, h = (n == null ? void 0 : n.parentIds.includes(f.id)) ?? !1, p = ze(f.badge), g = w(
"cu-primary-nav-overlay__row",
(d || h) && "cu-primary-nav-overlay__row--active"
), y = l(s), v = /* @__PURE__ */ b(L, { children: [
/* @__PURE__ */ r("span", { className: "cu-primary-nav-overlay__label", children: f.label }),
p ? /* @__PURE__ */ r("span", { className: "cu-primary-nav-overlay__badge", children: p }) : null
] });
return u ? /* @__PURE__ */ b("div", { className: "cu-primary-nav-overlay__group", children: [
/* @__PURE__ */ r("div", { style: y, className: w(g, "cu-primary-nav-overlay__row--group"), children: v }),
/* @__PURE__ */ r("div", { className: "cu-primary-nav-overlay__list", children: i(f.children ?? [], s + 1) })
] }, f.id) : /* @__PURE__ */ r(Rt, { children: t({
href: f.href ?? "#",
itemId: f.id,
depth: s,
disabled: f.disabled,
isActive: d,
isAncestorActive: !1,
children: /* @__PURE__ */ r(
"div",
{
style: y,
className: w(g, "cu-primary-nav-overlay__row--link"),
children: v
}
)
}) }, f.id);
});
if (!((c = e.children) != null && c.length))
return e.tooltip ?? e.label;
const o = ze(e.badge);
return /* @__PURE__ */ b("div", { className: "cu-primary-nav-overlay", children: [
/* @__PURE__ */ b("div", { className: "cu-primary-nav-overlay__header", children: [
/* @__PURE__ */ r("span", { className: "cu-primary-nav-overlay__label", children: e.label }),
o ? /* @__PURE__ */ r("span", { className: "cu-primary-nav-overlay__badge", children: o }) : null
] }),
/* @__PURE__ */ r("div", { className: "cu-primary-nav-overlay__separator" }),
/* @__PURE__ */ r("div", { className: "cu-primary-nav-overlay__list", children: i(e.children, 1) })
] });
}
function ir({
item: e,
depth: t,
open: n,
expanded: l,
itemState: i,
renderLink: o,
renderItemContent: c,
onToggle: a
}) {
var y;
const s = !!((y = e.children) != null && y.length), f = (i == null ? void 0 : i.isActive) ?? !1, u = (i == null ? void 0 : i.isAncestorActive) ?? !1, d = (c == null ? void 0 : c({
item: e,
depth: t,
hasChildren: s,
isActive: f,
isAncestorActive: u,
open: n,
expanded: l
})) ?? /* @__PURE__ */ r(
rr,
{
item: e,
depth: t,
hasChildren: s,
isActive: f,
isAncestorActive: u,
open: n,
expanded: l
}
), h = w(
"cu-primary-nav__trigger",
t === 0 && "cu-primary-nav__trigger--root",
t > 0 && "cu-primary-nav__trigger--child"
);
if (n && s)
return /* @__PURE__ */ r(
"button",
{
type: "button",
"data-cu-primary-nav-item": e.id,
"aria-expanded": l,
className: h,
onClick: () => a(e.id),
children: d
}
);
if (n)
return o({
href: e.href ?? "#",
itemId: e.id,
depth: t,
disabled: e.disabled,
isActive: f,
isAncestorActive: u,
children: /* @__PURE__ */ r("div", { "data-cu-primary-nav-item": e.id, className: h, children: d })
});
const p = /* @__PURE__ */ r(lr, { item: e, renderLink: o, itemState: i });
return s ? /* @__PURE__ */ r(ne, { placement: "rightTop", content: p, trigger: "hover", children: /* @__PURE__ */ r(
"button",
{
type: "button",
"data-cu-primary-nav-item": e.id,
"aria-expanded": l,
className: h,
onClick: () => a(e.id),
children: d
}
) }) : /* @__PURE__ */ r(H, { placement: "right", title: p, children: /* @__PURE__ */ r("div", { children: o({
href: e.href ?? "#",
itemId: e.id,
depth: t,
disabled: e.disabled,
isActive: f,
isAncestorActive: u,
children: /* @__PURE__ */ r("div", { "data-cu-primary-nav-item": e.id, className: h, children: d })
}) }) });
}
function ar(e, t) {
return t ? Vt(e, t).expandedItemIds : [];
}
function cr({
items: e,
pathname: t = "",
context: n,
guard: l,
renderLink: i,
renderItemContent: o,
renderChildren: c,
expandedItemIds: a,
defaultExpandedItemIds: s,
expandActiveAncestors: f = !0,
mountCollapsedBranches: u = !0,
onExpandedItemIdsChange: d,
className: h,
...p
}) {
const g = Ce(), [y, v] = F(() => {
const x = f ? ar(e, t) : [];
return Array.from(/* @__PURE__ */ new Set([...s ?? [], ...x]));
}), m = jt(e, { context: n, guard: l }), _ = Vt(m, t, { context: n, guard: l }), N = (g == null ? void 0 : g.open) ?? !0, C = a ?? y, M = (x) => {
const S = C.includes(x) ? C.filter((T) => T !== x) : [...C, x];
a === void 0 && v(S), d == null || d(S);
}, D = (x, S) => x.map((T) => {
var P;
const O = _.itemsById[T.id], R = C.includes(T.id) || f && _.expandedItemIds.includes(T.id), k = !!((P = T.children) != null && P.length), I = k && N && (R || u) ? /* @__PURE__ */ r(
"div",
{
"data-cu-primary-nav-children": "",
"data-state": R ? "open" : "closed",
"aria-hidden": !R,
className: "cu-primary-nav__children",
children: /* @__PURE__ */ r("div", { className: "cu-primary-nav__children-inner", children: D(T.children ?? [], S + 1) })
}
) : null;
return /* @__PURE__ */ b("div", { "data-cu-primary-nav-branch": T.id, className: "cu-primary-nav__branch", children: [
/* @__PURE__ */ r(
ir,
{
item: T,
depth: S,
open: N,
expanded: R,
itemState: O,
renderLink: i,
renderItemContent: o,
onToggle: M
}
),
k && I ? (c == null ? void 0 : c({
item: T,
depth: S,
children: I
})) ?? I : null
] }, T.id);
});
return /* @__PURE__ */ r(
"div",
{
...p,
"data-cu-primary-navigation-tree": "",
"data-cu-primary-nav": "",
"data-state": N ? "expanded" : "collapsed",
className: w("cu-primary-nav", h),
children: D(m, 0)
}
);
}
const Ht = "var(--cu-color-neutral-0)", or = "var(--cu-color-neutral-40)", dt = "var(--cu-color-blue-50)", ft = "var(--cu-color-red-50)", ht = "var(--cu-color-green-50)", sr = (e) => /* @__PURE__ */ b("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", ...e, children: [
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ r("clipPath", { id: "workspace-chevron-right-a", children: /* @__PURE__ */ r("path", { fill: Ht, fillOpacity: "0", d: "M0 0h24v24H0z" }) }) }),
/* @__PURE__ */ r("g", { clipPath: "url(#workspace-chevron-right-a)", children: /* @__PURE__ */ r(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M10.7 7.29a.98.98 0 0 0-1.41 0c-.4.39-.4 1.02 0 1.41l3.29 3.29-3.29 3.29c-.4.4-.4 1.02 0 1.41.39.4 1.02.4 1.41 0l4-3.99c.2-.2.3-.43.3-.71s-.1-.51-.3-.71z"
}
) })
] }), ur = (e) => /* @__PURE__ */ b("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", ...e, children: [
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ r("clipPath", { id: "workspace-overflow-list-a", children: /* @__PURE__ */ r("path", { fill: Ht, fillOpacity: "0", d: "M0 0h24v24H0z" }) }) }),
/* @__PURE__ */ r("g", { clipPath: "url(#workspace-overflow-list-a)", children: /* @__PURE__ */ r(
"path",
{
stroke: "currentColor",
strokeLinejoin: "round",
strokeWidth: "2",
d: "M11 18c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm-6 0c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm6-6c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm-6 0c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm6-6c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1ZM5 6c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm12 12c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm0-6c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Zm0-6c0-.56.44-1 1-1 .55 0 1 .44 1 1 0 .55-.45 1-1 1-.56 0-1-.45-1-1Z"
}
) })
] }), dr = (e) => /* @__PURE__ */ r("svg", { width: "6", height: "6", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e, children: /* @__PURE__ */ r(
"path",
{
d: "M5 1L5 5L1 5",
stroke: or,
strokeOpacity: "1",
strokeWidth: "2",
strokeLinejoin: "round",
strokeLinecap: "round"
}
) }), fr = (e) => /* @__PURE__ */ b("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 32 32", ...e, children: [
/* @__PURE__ */ r(
"path",
{
fill: dt,
d: "M6.905 17.857c-1.052-1.026-.987-2.752.146-3.857l9.23-9c1.134-1.105 2.905-1.169 3.957-.143l2.857 2.786c1.052 1.026.986 2.752-.147 3.857l-9.23 9c-1.133 1.105-2.904 1.169-3.956.143z",
opacity: ".8"
}
),
/* @__PURE__ */ r(
"path",
{
fill: dt,
d: "M9.762 11.357c1.052-1.025 2.823-.962 3.956.143l9.23 9c1.133 1.105 1.2 2.831.147 3.857l-2.857 2.786c-1.052 1.026-2.823.962-3.956-.143l-9.23-9c-1.133-1.105-1.199-2.831-.147-3.857z",
opacity: ".4"
}
)
] }), hr = (e) => /* @__PURE__ */ b("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", ...e, children: [
/* @__PURE__ */ r(
"path",
{
fill: ft,
d: "M5.179 13.393c-.79-.77-.74-2.065.11-2.893l6.922-6.75c.85-.828 2.178-.876 2.967-.107l2.143 2.09c.789.768.74 2.064-.11 2.892l-6.923 6.75c-.85.828-2.178.876-2.967.107z",
opacity: ".8"
}
),
/* @__PURE__ */ r(
"path",
{
fill: ft,
d: "M7.322 8.518c.789-.77 2.117-.721 2.967.107l6.923 6.75c.85.828.898 2.124.11 2.893l-2.143 2.09c-.79.768-2.118.72-2.967-.108L5.289 13.5c-.85-.828-.899-2.124-.11-2.893z",
opacity: ".4"
}
)
] }), mr = (e) => /* @__PURE__ */ b("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", ...e, children: [
/* @__PURE__ */ r(
"path",
{
fill: ht,
d: "M5.179 13.393c-.79-.77-.74-2.065.11-2.893l6.922-6.75c.85-.828 2.178-.876 2.967-.107l2.143 2.09c.789.768.74 2.064-.11 2.892l-6.923 6.75c-.85.828-2.178.876-2.967.107z",
opacity: ".8"
}
),
/* @__PURE__ */ r(
"path",
{
fill: ht,
d: "M7.322 8.518c.789-.77 2.117-.721 2.967.107l6.923 6.75c.85.828.898 2.124.11 2.893l-2.143 2.09c-.79.768-2.118.72-2.967-.108L5.289 13.5c-.85-.828-.899-2.124-.11-2.893z",
opacity: ".4"
}
)
] }), pr = {
dev: hr,
prod: fr,
test: mr
};
function gr({
env: e = "prod",
logo: t,
brandName: n = "Workspace",
versionSlot: l,
buildDate: i
}) {
const { open: o } = re(), c = pr[e];
return /* @__PURE__ */ b("div", { className: "cu-workspace-logo", children: [
/* @__PURE__ */ b("div", { className: "cu-workspace-logo__mark", children: [
t ?? /* @__PURE__ */ r(c, { className: "cu-workspace-logo__default-icon", width: "44px", height: "44px" }),
e !== "prod" ? /* @__PURE__ */ b("div", { className: "cu-workspace-logo__env", children: [
"[",
e,
"]"
] }) : null
] }),
o ? /* @__PURE__ */ b("div", { className: "cu-workspace-logo__body", children: [
/* @__PURE__ */ r("span", { className: "cu-workspace-logo__brand", children: n }),
l ? /* @__PURE__ */ r("span", { className: "cu-workspace-logo__version", children: l }) : null,
e !== "prod" && i ? /* @__PURE__ */ r("span", { className: "cu-workspace-logo__build-date", children: i }) : null
] }) : null
] });
}
function vr({
label: e = "Техподдержка",
icon: t,
onClick: n,
disabled: l,
ariaLabel: i
}) {
const { open: o } = re();
return /* @__PURE__ */ b(
"button",
{
type: "button",
"aria-label": i,
disabled: l,
className: "cu-workspace-support-button",
onClick: n,
children: [
/* @__PURE__ */ r("span", { className: "cu-workspace-support-button__icon", children: t ?? /* @__PURE__ */ r(vn, {}) }),
o ? /* @__PURE__ */ r("span", { className: "cu-workspace-support-button__label", children: e }) : null
]
}
);
}
function yr({
name: e,
email: t,
avatar: n,
unreadIndicator: l,
menuItems: i,
renderMenuLink: o,
menuOpen: c,
onMenuOpenChange: a
}) {
const { open: s } = re(), [f, u] = F(!1), d = c ?? f, h = (y) => {
c === void 0 && u(y), a == null || a(y);
}, p = i != null && i.length ? /* @__PURE__ */ r(
br,
{
items: i,
renderMenuLink: o,
closeMenu: () => h(!1)
}
) : null, g = /* @__PURE__ */ b(
"button",
{
type: "button",
"aria-haspopup": p ? "menu" : void 0,
"aria-expanded": p ? d : void 0,
className: "cu-workspace-user-button",
children: [
/* @__PURE__ */ b("div", { className: "cu-workspace-user-button__avatar", children: [
l ? /* @__PURE__ */ r("span", { className: "cu-workspace-user-button__unread", children: l }) : null,
n
] }),
s ? /* @__PURE__ */ b("div", { className: "cu-workspace-user-button__body", children: [
/* @__PURE__ */ r("span", { className: "cu-workspace-user-button__name", children: e }),
t ? /* @__PURE__ */ r("span", { className: "cu-workspace-user-button__email", children: t }) : null
] }) : null
]
}
);
return p ? /* @__PURE__ */ r(
ne,
{
open: d,
onOpenChange: h,
trigger: "click",
placement: "rightBottom",
content: p,
classNames: { root: "cu-workspace-user-popover" },
arrow: !0,
children: g
}
) : g;
}
function br({
items: e,
renderMenuLink: t,
closeMenu: n
}) {
return /* @__PURE__ */ r(
"div",
{
className: "cu-workspace-user-menu",
role: "menu",
"aria-label": "Меню пользователя",
children: /* @__PURE__ */ r("div", { className: "cu-workspace-user-menu__list", children: e.map((l) => /* @__PURE__ */ r(
_r,
{
item: l,
renderMenuLink: t,
closeMenu: n
},
l.id
)) })
}
);
}
function _r({
item: e,
renderMenuLink: t,
closeMenu: n
}) {
const l = w(
"cu-workspace-user-menu__item",
e.disabled && "cu-workspace-user-menu__item--disabled"
), i = /* @__PURE__ */ b(L, { children: [
/* @__PURE__ */ b("span", { className: "cu-workspace-user-menu__item-main", children: [
e.icon ? /* @__PURE__ */ r("span", { className: "cu-workspace-user-menu__item-icon", children: e.icon }) : null,
/* @__PURE__ */ r("span", { className: "cu-workspace-user-menu__item-label", children: e.label })
] }),
e.trailingIcon ? /* @__PURE__ */ r("span", { className: "cu-workspace-user-menu__item-trailing", children: e.trailingIcon }) : null
] }), o = (c) => {
var a;
if (e.disabled) {
c.preventDefault(), c.stopPropagation();
return;
}
(a = e.onSelect) == null || a.call(e, c), c.defaultPrevented || n == null || n();
};
return e.href && t ? t({
item: e,
className: l,
children: i,
href: e.href,
role: "menuitem",
ariaDisabled: e.disabled || void 0,
disabled: e.disabled,
onClick: o
}) : e.href ? /* @__PURE__ */ r(
"a",
{
href: e.href,
className: l,
role: "menuitem",
"aria-disabled": e.disabled || void 0,
onClick: o,
children: i
}
) : /* @__PURE__ */ r("button", { type: "button", className: l, role: "menuitem", disabled: e.disabled, onClick: o, children: i });
}
function wr(e) {
return typeof e == "object" && e !== null && !Array.isArray(e) && !Ue(e) && "value" in e;
}
function mt(e) {
return e == null || e === !1 || e === "" || e === 0 || e === "0";
}
function Nr(e = "neutral") {
return e === "attention" || e === "danger" ? "cu-nav-badge--danger" : e === "warning" ? "cu-nav-badge--warning" : e === "success" ? "cu-nav-badge--success" : "cu-nav-badge--neutral";
}
function kr(e) {
return typeof e.label == "string" && e.label.length > 0 ? e.label.slice(0, 1).toUpperCase() : "•";
}
function xr(e) {
return wr(e) ? (e.hideWhenZero ?? !0) && mt(e.value) ? null : /* @__PURE__ */ r(
"span",
{
"aria-label": e.ariaLabel ?? e.label,
title: e.label,
className: w("cu-nav-badge", Nr(e.tone)),
children: e.value
}
) : mt(e) ? null : /* @__PURE__ */ r("span", { className: "cu-workspace-nav-item__badge-custom", children: e });
}
function Sr(e) {
return typeof e == "object" && e !== null && !Array.isArray(e) && !Ue(e);
}
function Tr({
item: e,
depth: t,
hasChildren: n,
isActive: l,
isAncestorActive: i,
expanded: o
}) {
const c = Ce(), a = (c == null ? void 0 : c.open) ?? !0, s = t === 0, f = e.icon != null, u = n && (l || i), d = s && n && !a, h = a ? xr(e.badge) : null, p = a && !s ? {
marginInlineStart: `${Math.min(t, 10) * 12}px`
} : void 0;
return /* @__PURE__ */ b(
"div",
{
style: p,
className: w(
"cu-workspace-nav-item",
a ? "cu-workspace-nav-item--open" : "cu-workspace-nav-item--collapsed",
s ? "cu-workspace-nav-item--root" : "cu-workspace-nav-item--child",
f ? "cu-workspace-nav-item--has-icon" : "cu-workspace-nav-item--no-icon",
s && u && "cu-workspace-nav-item--highlighted",
!s && l && "cu-workspace-nav-item--active"
),
children: [
f || !a ? /* @__PURE__ */ b("div", { className: "cu-workspace-nav-item__icon-wrap", children: [
/* @__PURE__ */ r(
"span",
{
className: w(
"cu-workspace-nav-item__icon",
s ? "cu-workspace-nav-item__icon--root" : "cu-workspace-nav-item__icon--child",
!f && "cu-workspace-nav-item__fallback"
),
children: e.icon ?? kr(e)
}
),
d ? /* @__PURE__ */ r("span", { className: "cu-workspace-nav-item__corner", children: /* @__PURE__ */ r(dr, { "aria-hidden": "true" }) }) : null
] }) : null,
a ? /* @__PURE__ */ r("span", { className: "cu-workspace-nav-item__label", children: e.label }) : null,
a ? /* @__PURE__ */ r("span", { className: "cu-workspace-nav-item__badge", children: h }) : null,
a ? /* @__PURE__ */ r(
"span",
{
"aria-hidden": "true",
className: w(
"cu-workspace-nav-item__chevron",
!n && "cu-workspace-nav-item__chevron--empty"
),
"data-expanded": o,
children: n ? /* @__PURE__ */ r(sr, {}) : null
}
) : null
]
}
);
}
function Pi({
logo: e,
support: t,
user: n,
...l
}) {
const i = { ...l }, o = i.mountCollapsedBranches ?? !0;
delete i.collapseButton, delete i.expandActiveAncestors, delete i.footerSlot, delete i.headerSlot, delete i.logoSlot, delete i.renderChildren, delete i.renderItemContent, delete i.supportSlot, delete i.userSlot;
const c = t ? Sr(t) ? /* @__PURE__ */ r(vr, { ...t }) : t : null, a = n ? /* @__PURE__ */ r(yr, { ...n }) : null, s = /* @__PURE__ */ r(Kn, {});
return /* @__PURE__ */ b(L, { children: [
/* @__PURE__ */ r(Jn, { children: e ? /* @__PURE__ */ r(gr, { ...e }) : null }),
/* @__PURE__ */ r(Qn, { children: /* @__PURE__ */ r(
cr,
{
...i,
expandActiveAncestors: !1,
mountCollapsedBranches: o,
renderItemContent: (f) => /* @__PURE__ */ r(Tr, { ...f })
}
) }),
/* @__PURE__ */ b(Zn, { children: [
c,
c ? /* @__PURE__ */ r(st, {}) : null,
s,
a || c ? /* @__PURE__ */ r(st, {}) : null,
a
] })
] });
}
const Cr = 1;
function Pr(e, t, n = 0, l = Cr) {
if (t <= 0)
return 0;
let i = 0;
for (let o = 0; o < e.length; o += 1) {
const a = (e[o] ?? 0) + (o > 0 ? n : 0);
if (i + a > t + l)
return o;
i += a;
}
return e.length;
}
function Ut(e) {
const t = se(null), n = se([]), [l, i] = F(e);
return un(() => {
var f;
const o = () => {
const u = t.current;
if (!u) {
i(e);
return;
}
const d = Array.from(u.children).slice(0, e), h = u.clientWidth;
if (h <= 0) {
i(e);
return;
}
const p = [...n.current];
d.forEach((m, _) => {
const N = m.offsetWidth || m.getBoundingClientRect().width;
N > 0 && (p[_] = N);
});
const g = p.slice(0, e);
if (n.current = g, g.length < e || g.some((m) => !Number.isFinite(m) || m <= 0)) {
i(e);
return;
}
const y = Number.parseFloat(
window.getComputedStyle(u).columnGap || window.getComputedStyle(u).gap || "0"
), v = Pr(g, h, Number.isNaN(y) ? 0 : y);
i(v);
};
o();
const c = window.requestAnimationFrame(() => {
window.requestAnimationFrame(o);
}), a = window.setTimeout(o, 120);
"fonts" in document && document.fonts.ready.then(o).catch(() => {
});
const s = new ResizeObserver(o);
return t.current && s.observe(t.current), Array.from(((f = t.current) == null ? void 0 : f.children) ?? []).forEach((u) => {
u && s.observe(u);
}), window.addEventListener("resize", o), () => {
window.cancelAnimationFrame(c), window.clearTimeout(a), s.disconnect(), window.removeEventListener("resize", o);
};
}, [e]), {
containerRef: t,
firstHiddenIndex: l,
hasOverflow: l < e,
setItemRef: (o) => (c) => {
}
};
}
function ve({ item: e, isActive: t, orientation: n, renderLink: l }) {
const i = /* @__PURE__ */ r(
"span",
{
className: w(
"cu-local-navigation-link",
n === "vertical" && "cu-local-navigation-link--vertical",
n === "horizontal" && "cu-local-navigation-link--horizontal",
t && "cu-local-navigation-link--active",
e.disabled && "cu-local-navigation-link--disabled"
),
children: e.label
}
);
return e.disabled ? i : l({
href: e.href,
itemId: e.id,
depth: 0,
disabled: e.disabled,
isActive: t,
isAncestorActive: !1,
children: i
});
}
function ye(e, t) {
return typeof e.match == "function" ? e.match(t, e.href) : e.match === "prefix" ? t.startsWith(e.href) : t === e.href;
}
function Ai({
header: e,
items: t,
pathname: n = "",
actionSlot: l,
overflowTriggerSlot: i,
renderLink: o,
sticky: c = !1,
orientation: a = "vertical",
className: s,
...f
}) {
const u = a === "horizontal", { containerRef: d, firstHiddenIndex: h, hasOverflow: p, setItemRef: g } = Ut(
u ? t.length : 0
), y = u && p ? t.slice(0, h) : t, v = u && p ? t.slice(h) : [], m = /* @__PURE__ */ r(V, { size: "small", "aria-label": "Show overflow local navigation items", icon: /* @__PURE__ */ r(Et, {}) });
return /* @__PURE__ */ b(
"nav",
{
...f,
"aria-label": "Local navigation",
"data-orientation": a,
className: w(
"cu-local-navigation",
a === "vertical" && "cu-local-navigation--vertical",
a === "horizontal" && "cu-local-navigation--horizontal",
c && "cu-local-navigation--sticky",
s
),
children: [
e ? /* @__PURE__ */ r(
"div",
{
className: w(
"cu-local-navigation__header",
a === "vertical" && "cu-local-navigation__header--vertical"
),
children: /* @__PURE__ */ r(
ve,
{
item: e,
isActive: ye(e, n),
orientation: a,
renderLink: o
}
)
}
) : null,
u ? /* @__PURE__ */ b("div", { className: "cu-local-navigation__bar", children: [
/* @__PURE__ */ r("ul", { ref: d, className: "cu-local-navigation__list", children: y.map((_, N) => /* @__PURE__ */ r("li", { ref: g(N), className: "cu-local-navigation__item", children: /* @__PURE__ */ r(
ve,
{
item: _,
isActive: ye(_, n),
orientation: a,
renderLink: o
}
) }, _.id)) }),
/* @__PURE__ */ r("div", { className: w("cu-local-navigation__overflow", !p && "cu-local-navigation__overflow--hidden"), children: /* @__PURE__ */ r(
ne,
{
trigger: "click",
placement: "bottomRight",
content: /* @__PURE__ */ r("div", { className: "cu-local-navigation__overflow-panel", children: /* @__PURE__ */ r("ul", { className: "cu-local-navigation__overflow-list", children: v.map((_) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
ve,
{
item: _,
isActive: ye(_, n),
orientation: "vertical",
renderLink: o
}
) }, _.id)) }) }),
children: /* @__PURE__ */ r("div", { className: "cu-local-navigation__overflow-trigger", children: i ?? m })
}
) }),
l ? /* @__PURE__ */ r("div", { className: "cu-local-navigation__action", children: l }) : null
] }) : /* @__PURE__ */ b(L, { children: [
/* @__PURE__ */ r("ul", { className: "cu-local-navigation__list", children: t.map((_) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
ve,
{
item: _,
isActive: ye(_, n),
orientation: a,
renderLink: o
}
) }, _.id)) }),
l ? /* @__PURE__ */ r("div", { className: "cu-local-navigation__action", children: l }) : null
] })
]
}
);
}
function $e({ item: e, isActive: t, renderLink: n, className: l }) {
const i = /* @__PURE__ */ r(
"span",
{
className: w(
"cu-section-shell-link",
t && "cu-section-shell-link--active",
e.disabled && "cu-section-shell-link--disabled",
l
),
children: e.label
}
);
return e.disabled ? i : n({
href: e.href,
itemId: e.id,
depth: 0,
disabled: e.disabled,
isActive: t,
isAncestorActive: !1,
children: i
});
}
function pt(e, t) {
return typeof e.match == "function" ? e.match(t, e.href) : e.match === "prefix" ? t.startsWith(e.href) : t === e.href;
}
function Ar({
header: e,
items: t,
pathname: n = "",
actionSlot: l,
overflowTriggerSlot: i,
renderLink: o,
sticky: c = !0,
className: a,
...s
}) {
const { containerRef: f, firstHiddenIndex: u, hasOverflow: d, setItemRef: h } = Ut(t.length), p = d ? t.slice(0, u) : t, g = d ? t.slice(u) : [], y = /* @__PURE__ */ r(V, { size: "small", "aria-label": "Show overflow navigation items", icon: /* @__PURE__ */ r(Et, {}) });
return /* @__PURE__ */ r(
"div",
{
...s,
className: w("cu-section-shell", c && "cu-section-shell--sticky", a),
children: /* @__PURE__ */ b("div", { className: "cu-section-shell__inner", children: [
e ? /* @__PURE__ */ r(
$e,
{
item: e,
isActive: !1,
renderLink: o,
className: "cu-section-shell-link--header"
}
) : null,
e && t.length > 0 ? /* @__PURE__ */ r("div", { className: "cu-section-shell__separator" }) : null,
/* @__PURE__ */ r("ul", { ref: f, className: "cu-section-shell__list", children: p.map((v, m) => /* @__PURE__ */ r("li", { ref: h(m), className: "cu-section-shell__item", children: /* @__PURE__ */ r($e, { item: v, isActive: pt(v, n), renderLink: o }) }, v.id)) }),
/* @__PURE__ */ r("div", { className: w("cu-section-shell__overflow", !d && "cu-section-shell__overflow--hidden"), children: /* @__PURE__ */ r(
ne,
{
trigger: "click",
placement: "bottomRight",
content: /* @__PURE__ */ r("div", { className: "cu-section-shell__overflow-panel", children: /* @__PURE__ */ r("ul", { className: "cu-section-shell__overflow-list", children: g.map((v) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
$e,
{
item: v,
isActive: pt(v, n),
renderLink: o
}
) }, v.id)) }) }),
children: /* @__PURE__ */ r("div", { className: "cu-section-shell__overflow-trigger", children: i ?? y })
}
) }),
l ? /* @__PURE__ */ r("div", { className: "cu-section-shell__action", children: l }) : null
] })
}
);
}
function Mi(e) {
return /* @__PURE__ */ r(
Ar,
{
...e,
overflowTriggerSlot: /* @__PURE__ */ r(
V,
{
size: "small",
"aria-label": "Show overflow navigation items",
icon: /* @__PURE__ */ r(ur, { "aria-hidden": "true" })
}
)
}
);
}
const W = ({ when: e, children: t, elseComponent: n }) => e ? t : n || null, Mr = {
headingText: {
default: "cu-list-item__text--heading-default",
small: "cu-list-item__text--heading-small"
},
baseText: {
default: "cu-list-item__text--base-default",
small: "cu-list-item__text--base-small"
},
helperText: {
default: "cu-list-item__text--helper-default",
small: "cu-list-item__text--helper-small"
}
}, Kt = (e) => {
const { token: t } = B.useToken(), {
size: n = "default",
order: l = ["baseText", "headingText", "helperText"],
disabled: i,
prefix: o,
suffix: c,
className: a,
skeletonClassName: s,
isLoading: f,
isCenter: u,
style: d,
// Do not touch this props
// eslint-disable-next-line @typescript-eslint/no-unused-vars
headingText: h,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
baseText: p,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
helperText: g,
//
...y
} = e, v = u ?? l.map((m) => e[m]).filter((m) => !m).length > 1;
return f ? /* @__PURE__ */ r(
"div",
{
className: w("cu-list-item-skeleton", s),
style: { backgroundColor: t.colorFillSecondary }
}
) : /* @__PURE__ */ b(
"div",
{
...y,
className: w(
"cu-list-item",
!i && "cu-list-item--interactive",
v && "cu-list-item--center",
a
),
style: {
"--cu-hover-bg": t.colorBgTextHover,
"--cu-active-bg": t.colorFillSecondary,
...d
},
children: [
o && /* @__PURE__ */ r("div", { className: w("cu-list-item__prefix", v && "cu-list-item__slot--center"), children: o }),
/* @__PURE__ */ r("div", { className: "cu-list-item__content", children: l.map((m) => /* @__PURE__ */ r(
"div",
{
style: { color: t.colorText },
className: w("cu-list-item__text", Mr[m][n]),
children: e[m]
},
m
)) }),
c && /* @__PURE__ */ r("div", { className: w("cu-list-item__suffix", v && "cu-list-item__slot--center"), children: c })
]
}
);
}, Ge = ({
children: e,
className: t,
disabled: n
}) => {
const [l, i] = F(!1), o = se(null);
return /* @__PURE__ */ r(H, { title: e, placement: "bottomLeft", open: l, onOpenChange: (a) => {
var u, d;
if (a && n)
return;
const s = (u = o.current) == null ? void 0 : u.clientWidth, f = (d = o.current) == null ? void 0 : d.scrollWidth;
s && f && s < f && i(a);
}, children: /* @__PURE__ */ r("p", { ref: o, className: w("cu-text-container", t), children: e }) });
}, Ir = (e) => {
var t, n;
return /* @__PURE__ */ b("div", { className: "cu-select-company-group-details", children: [
/* @__PURE__ */ b("div", { className: "cu-select-company-group-details__title", children: [
"ГК «",
e == null ? void 0 : e.name,
"»"
] }),
/* @__PURE__ */ b("div", { className: "cu-select-company-group-details__companies", children: [
/* @__PURE__ */ r("span", { className: "cu-select-company-group-details__label", children: "Топ 3 компании:" }),
/* @__PURE__ */ r(Ge, { children: /* @__PURE__ */ r(W, { when: Array.isArray(e == null ? void 0 : e.companies) && ((t = e == null ? void 0 : e.companies) == null ? void 0 : t.length) > 0, elseComponent: "-", children: (n = e == null ? void 0 : e.companies) == null ? void 0 : n.map((l, i) => i < 3 ? `${l == null ? void 0 : l.opfShort} «${l == null ? void 0 : l.fullName}»${i < 2 ? ", " : ""}` : null) }) })
] })
] });
}, Ii = ({
option: e,
isSelected: t,
handleSelect: n,
fullOption: l
}) => {
const { token: i } = B.useToken(), o = Ir(l);
return /* @__PURE__ */ r("div", { className: "cu-select-company-option cu-select-company-option--group", children: /* @__PURE__ */ r(
Kt,
{
onClick: () => n(e.value),
disabled: !0,
className: "cu-select-company-option__item",
style: t ? { backgroundColor: i.colorFillSecondary } : void 0,
isCenter: !1,
order: ["headingText", "baseText", "helperText"],
headingText: o
}
) });
}, gt = {
DPGS: "rating?.pgsRating",
ИНН: "inn",
КПП: "kpp",
Город: "city",
Руководитель: "managerFIO",
ОГРН: "ogrn"
}, Dr = ["DPGS", "ИНН", "Руководитель"], Or = (e) => Object.fromEntries(
e ? Object.entries(gt).filter(([t]) => e.includes(t)) : Object.entries(gt).filter(
([t]) => Dr.includes(t)
)
), Lr = (e, t) => {
var n;
return /* @__PURE__ */ b("div", { className: "cu-select-company-details", children: [
/* @__PURE__ */ r("div", { className: "cu-select-company-details__title", children: `${e == null ? void 0 : e.opfShort} «${e == null ? void 0 : e.fullName}»` }),
/* @__PURE__ */ b("div", { className: "cu-select-company-details__meta", children: [
/* @__PURE__ */ r("div", { className: "cu-select-company-details__fields", children: (n = Object.entries(t)) == null ? void 0 : n.map(([l, i], o) => {
var a;
const c = i === "rating?.pgsRating" ? (a = e == null ? void 0 : e.rating) == null ? void 0 : a.pgsRating : e == null ? void 0 : e[i];
return /* @__PURE__ */ b("div", { className: "cu-select-company-details__field", children: [
/* @__PURE__ */ b("span", { className: "cu-select-company-details__label", children: [
l,
":"
] }),
/* @__PURE__ */ r(Ge, { className: "cu-select-company-details__value", children: c ?? "-" })
] }, o);
}) }),
(e == null ? void 0 : e.address) && /* @__PURE__ */ b("div", { className: "cu-select-company-details__field cu-select-company-details__field--address", children: [
/* @__PURE__ */ r("span", { className: "cu-select-company-details__label", children: "Адрес:" }),
/* @__PURE__ */ r(Ge, { className: "cu-select-company-details__value", children: typeof (e == null ? void 0 : e.address) == "string" ? e == null ? void 0 : e.address : (e == null ? void 0 : e.address.value) ?? "-" })
] })
] })
] });
}, Di = ({
option: e,
isSelected: t,
handleSelect: n,
fullOption: l,
optionalFields: i
}) => {
const { token: o } = B.useToken(), c = Or(i), a = Lr(l, c);
return a ? /* @__PURE__ */ r("div", { className: "cu-select-company-option", children: /* @__PURE__ */ r(
Kt,
{
onClick: () => n(e.value),
disabled: !0,
className: "cu-select-company-option__item",
style: t ? { backgroundColor: o.colorFillSecondary } : void 0,
isCenter: !1,
order: ["headingText", "baseText", "helperText"],
headingText: a
}
) }) : null;
}, Oi = (e) => {
const { isLoading: t = !1 } = e;
return /* @__PURE__ */ r("div", { className: "cu-select-not-found", children: t ? /* @__PURE__ */ r(
fn,
{
className: "cu-select-not-found__spinner",
indicator: /* @__PURE__ */ r(yn, { spin: !0 }),
size: "large"
}
) : "Нет результатов или запрос ещё не введён" });
}, Li = (e) => {
const { subTitle: t } = e;
return /* @__P