@coolms/ui-react 0.1.0-alpha.2 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,56 +1,56 @@
1
- import { jsx as t, jsxs as v, Fragment as S } from "react/jsx-runtime";
2
- import { useId as A, useState as k, useRef as w, useEffect as x, useLayoutEffect as B, useCallback as K } from "react";
3
- import { createPortal as C } from "react-dom";
4
- function _(...e) {
5
- return e.filter(Boolean).join(" ");
1
+ import { jsx as e, jsxs as r, Fragment as b } from "react/jsx-runtime";
2
+ import { useId as A, useState as M, useRef as x, useEffect as D, useLayoutEffect as F, useCallback as H } from "react";
3
+ import { createPortal as Z } from "react-dom";
4
+ function g(...l) {
5
+ return l.filter(Boolean).join(" ");
6
6
  }
7
- function N({ name: e }) {
7
+ function k({ name: l }) {
8
8
  const n = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
9
- switch (e) {
9
+ switch (l) {
10
10
  case "lock":
11
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M5 7V5a3 3 0 1 1 6 0v2h.5A1.5 1.5 0 0 1 13 8.5v5A1.5 1.5 0 0 1 11.5 15h-7A1.5 1.5 0 0 1 3 13.5v-5A1.5 1.5 0 0 1 4.5 7H5Zm1.5 0h3V5a1.5 1.5 0 0 0-3 0v2Z" }) });
11
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M5 7V5a3 3 0 1 1 6 0v2h.5A1.5 1.5 0 0 1 13 8.5v5A1.5 1.5 0 0 1 11.5 15h-7A1.5 1.5 0 0 1 3 13.5v-5A1.5 1.5 0 0 1 4.5 7H5Zm1.5 0h3V5a1.5 1.5 0 0 0-3 0v2Z" }) });
12
12
  case "spinner":
13
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph cms-spinner", children: /* @__PURE__ */ t("circle", { cx: "8", cy: "8", r: "6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "28", strokeDashoffset: "10" }) });
13
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph cms-spinner", children: /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "28", strokeDashoffset: "10" }) });
14
14
  case "back":
15
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M10.7 2.3a1 1 0 0 1 0 1.4L6.4 8l4.3 4.3a1 1 0 0 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 0Z" }) });
15
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M10.7 2.3a1 1 0 0 1 0 1.4L6.4 8l4.3 4.3a1 1 0 0 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 0Z" }) });
16
16
  case "close":
17
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M3.3 3.3a1 1 0 0 1 1.4 0L8 6.6l3.3-3.3a1 1 0 1 1 1.4 1.4L9.4 8l3.3 3.3a1 1 0 0 1-1.4 1.4L8 9.4l-3.3 3.3a1 1 0 0 1-1.4-1.4L6.6 8 3.3 4.7a1 1 0 0 1 0-1.4Z" }) });
17
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M3.3 3.3a1 1 0 0 1 1.4 0L8 6.6l3.3-3.3a1 1 0 1 1 1.4 1.4L9.4 8l3.3 3.3a1 1 0 0 1-1.4 1.4L8 9.4l-3.3 3.3a1 1 0 0 1-1.4-1.4L6.6 8 3.3 4.7a1 1 0 0 1 0-1.4Z" }) });
18
18
  case "warning":
19
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M8.9 1.5a1 1 0 0 0-1.8 0l-6 11A1 1 0 0 0 2 14h12a1 1 0 0 0 .9-1.5l-6-11ZM8 5a1 1 0 0 1 1 1v3a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1Zm0 7.5A1 1 0 1 1 8 10.5a1 1 0 0 1 0 2Z" }) });
19
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8.9 1.5a1 1 0 0 0-1.8 0l-6 11A1 1 0 0 0 2 14h12a1 1 0 0 0 .9-1.5l-6-11ZM8 5a1 1 0 0 1 1 1v3a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1Zm0 7.5A1 1 0 1 1 8 10.5a1 1 0 0 1 0 2Z" }) });
20
20
  case "check":
21
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M13.7 4.3a1 1 0 0 1 0 1.4l-6 6a1 1 0 0 1-1.4 0l-3-3a1 1 0 1 1 1.4-1.4L7 9.6l5.3-5.3a1 1 0 0 1 1.4 0Z" }) });
21
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M13.7 4.3a1 1 0 0 1 0 1.4l-6 6a1 1 0 0 1-1.4 0l-3-3a1 1 0 1 1 1.4-1.4L7 9.6l5.3-5.3a1 1 0 0 1 1.4 0Z" }) });
22
22
  case "info":
23
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
23
+ return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
24
24
  }
25
25
  }
26
26
  function E({
27
- variant: e = "secondary",
27
+ variant: l = "secondary",
28
28
  busy: n = !1,
29
- busyLabel: l,
30
- locked: a = !1,
29
+ busyLabel: a,
30
+ locked: c = !1,
31
31
  lockedReason: s,
32
32
  icon: m,
33
- disabled: i,
33
+ disabled: t,
34
34
  className: u,
35
- children: d,
36
- type: f = "button",
37
- title: r,
38
- ...o
35
+ children: h,
36
+ type: o = "button",
37
+ title: i,
38
+ ...f
39
39
  }) {
40
- const c = !!i || n;
41
- return /* @__PURE__ */ v(
40
+ const d = !!t || n;
41
+ return /* @__PURE__ */ r(
42
42
  "button",
43
43
  {
44
- ...o,
45
- type: f,
46
- className: _("cms-button", `cms-button--${e}`, n && "is-busy", a && "is-locked", u),
47
- disabled: c,
44
+ ...f,
45
+ type: o,
46
+ className: g("cms-button", `cms-button--${l}`, n && "is-busy", c && "is-locked", u),
47
+ disabled: d,
48
48
  "aria-busy": n || void 0,
49
- title: a ? s ?? r : r,
49
+ title: c ? s ?? i : i,
50
50
  children: [
51
- n ? /* @__PURE__ */ t(N, { name: "spinner" }) : a ? /* @__PURE__ */ t(N, { name: "lock" }) : m,
52
- /* @__PURE__ */ t("span", { className: "cms-button__label", children: n && l !== void 0 ? l : d }),
53
- a && s ? /* @__PURE__ */ v("span", { className: "cms-visually-hidden", children: [
51
+ n ? /* @__PURE__ */ e(k, { name: "spinner" }) : c ? /* @__PURE__ */ e(k, { name: "lock" }) : m,
52
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : h }),
53
+ c && s ? /* @__PURE__ */ r("span", { className: "cms-visually-hidden", children: [
54
54
  ", ",
55
55
  s
56
56
  ] }) : null
@@ -58,388 +58,807 @@ function E({
58
58
  }
59
59
  );
60
60
  }
61
- function L({ id: e, label: n, help: l, error: a, pinned: s, children: m }) {
62
- return /* @__PURE__ */ v("div", { className: _("cms-field", a != null && "is-invalid"), children: [
63
- /* @__PURE__ */ t("label", { className: "cms-field__label", htmlFor: e, children: n }),
61
+ function I({ id: l, label: n, help: a, error: c, pinned: s, children: m }) {
62
+ return /* @__PURE__ */ r("div", { className: g("cms-field", c != null && "is-invalid"), children: [
63
+ /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: l, children: n }),
64
64
  m,
65
- s != null ? /* @__PURE__ */ v("p", { className: "cms-field__pinned", id: `${e}-pinned`, children: [
66
- /* @__PURE__ */ t(N, { name: "lock" }),
65
+ s != null ? /* @__PURE__ */ r("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
66
+ /* @__PURE__ */ e(k, { name: "lock" }),
67
67
  " ",
68
68
  s
69
69
  ] }) : null,
70
- a != null ? /* @__PURE__ */ t("p", { className: "cms-field__error", id: `${e}-error`, role: "alert", children: a }) : null,
71
- l != null ? /* @__PURE__ */ t("p", { className: "cms-field__help", id: `${e}-help`, children: l }) : null
70
+ c != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${l}-error`, role: "alert", children: c }) : null,
71
+ a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${l}-help`, children: a }) : null
72
72
  ] });
73
73
  }
74
- function $(e, n) {
75
- const l = [n.error != null && `${e}-error`, n.pinned != null && `${e}-pinned`, n.help != null && `${e}-help`].filter(Boolean).join(" ");
76
- return l === "" ? void 0 : l;
74
+ function B(l, n) {
75
+ const a = [n.error != null && `${l}-error`, n.pinned != null && `${l}-pinned`, n.help != null && `${l}-help`].filter(Boolean).join(" ");
76
+ return a === "" ? void 0 : a;
77
77
  }
78
- function Y({ label: e, help: n, error: l, disabled: a, readOnly: s, pinned: m, value: i, onChange: u, placeholder: d, type: f = "text", name: r }) {
79
- const o = A();
80
- return /* @__PURE__ */ t(L, { id: o, label: e, help: n, error: l, pinned: m, children: /* @__PURE__ */ t(
78
+ function ne({ label: l, help: n, error: a, disabled: c, readOnly: s, pinned: m, value: t, onChange: u, placeholder: h, type: o = "text", name: i }) {
79
+ const f = A();
80
+ return /* @__PURE__ */ e(I, { id: f, label: l, help: n, error: a, pinned: m, children: /* @__PURE__ */ e(
81
81
  "input",
82
82
  {
83
- id: o,
84
- name: r,
85
- type: f,
83
+ id: f,
84
+ name: i,
85
+ type: o,
86
86
  className: "cms-input",
87
- value: i,
88
- placeholder: d,
89
- disabled: a,
87
+ value: t,
88
+ placeholder: h,
89
+ disabled: c,
90
90
  readOnly: s || m != null,
91
- "aria-invalid": l != null || void 0,
92
- "aria-describedby": $(o, { help: n, error: l, pinned: m }),
93
- onChange: (c) => u == null ? void 0 : u(c.target.value)
91
+ "aria-invalid": a != null || void 0,
92
+ "aria-describedby": B(f, { help: n, error: a, pinned: m }),
93
+ onChange: (d) => u == null ? void 0 : u(d.target.value)
94
94
  }
95
95
  ) });
96
96
  }
97
- function J({ label: e, help: n, error: l, disabled: a, readOnly: s, value: m, options: i, onChange: u, emptyText: d = "Nothing to choose from yet.", name: f }) {
98
- const r = A(), o = i.length === 0;
99
- return /* @__PURE__ */ t(L, { id: r, label: e, help: o ? d : n, error: l, children: /* @__PURE__ */ t(
97
+ function ae({ label: l, help: n, error: a, disabled: c, readOnly: s, value: m, options: t, onChange: u, emptyText: h = "Nothing to choose from yet.", name: o }) {
98
+ const i = A(), f = t.length === 0;
99
+ return /* @__PURE__ */ e(I, { id: i, label: l, help: f ? h : n, error: a, children: /* @__PURE__ */ e(
100
100
  "select",
101
101
  {
102
- id: r,
103
- name: f,
102
+ id: i,
103
+ name: o,
104
104
  className: "cms-input cms-select",
105
105
  value: m,
106
- disabled: a || o,
106
+ disabled: c || f,
107
107
  "aria-readonly": s || void 0,
108
- "aria-invalid": l != null || void 0,
109
- "aria-describedby": $(r, { help: o ? d : n, error: l }),
110
- onChange: (c) => {
111
- s || u == null || u(c.target.value);
108
+ "aria-invalid": a != null || void 0,
109
+ "aria-describedby": B(i, { help: f ? h : n, error: a }),
110
+ onChange: (d) => {
111
+ s || u == null || u(d.target.value);
112
112
  },
113
- children: i.map((c) => /* @__PURE__ */ t("option", { value: c.value, disabled: s && c.value !== m, children: c.label }, c.value))
113
+ children: t.map((d) => /* @__PURE__ */ e("option", { value: d.value, disabled: s && d.value !== m, children: d.label }, d.value))
114
114
  }
115
115
  ) });
116
116
  }
117
- function z({ label: e, checked: n, onChange: l, disabled: a, readOnly: s, help: m }) {
118
- const i = A();
119
- return /* @__PURE__ */ v("div", { className: "cms-toggle-row", children: [
120
- /* @__PURE__ */ t(
117
+ function se({ label: l, checked: n, onChange: a, disabled: c, readOnly: s, help: m }) {
118
+ const t = A();
119
+ return /* @__PURE__ */ r("div", { className: "cms-toggle-row", children: [
120
+ /* @__PURE__ */ e(
121
121
  "button",
122
122
  {
123
- id: i,
123
+ id: t,
124
124
  type: "button",
125
125
  role: "switch",
126
- className: _("cms-toggle", n && "is-on"),
126
+ className: g("cms-toggle", n && "is-on"),
127
127
  "aria-checked": n,
128
128
  "aria-readonly": s || void 0,
129
- "aria-describedby": m != null ? `${i}-help` : void 0,
130
- disabled: a,
129
+ "aria-describedby": m != null ? `${t}-help` : void 0,
130
+ disabled: c,
131
131
  onClick: () => {
132
- s || l == null || l(!n);
132
+ s || a == null || a(!n);
133
133
  },
134
- children: /* @__PURE__ */ t("span", { className: "cms-toggle__thumb" })
134
+ children: /* @__PURE__ */ e("span", { className: "cms-toggle__thumb" })
135
135
  }
136
136
  ),
137
- /* @__PURE__ */ t("label", { className: "cms-toggle__label", htmlFor: i, children: e }),
138
- m != null ? /* @__PURE__ */ t("p", { className: "cms-field__help", id: `${i}-help`, children: m }) : null
137
+ /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: t, children: l }),
138
+ m != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${t}-help`, children: m }) : null
139
139
  ] });
140
140
  }
141
- const Z = 150;
142
- function I({ open: e, title: n, onClose: l, dirty: a = !1, onDirtyClose: s, children: m, footer: i }) {
143
- const [u, d] = k(e), [f, r] = k(!1), o = w(null), c = w(null), g = A();
144
- if (x(() => {
145
- if (e) {
146
- c.current = document.activeElement, d(!0), r(!1);
141
+ const R = 150;
142
+ function z({ open: l, title: n, onClose: a, dirty: c = !1, onDirtyClose: s, children: m, footer: t }) {
143
+ const [u, h] = M(l), [o, i] = M(!1), f = x(null), d = x(null), v = A();
144
+ if (D(() => {
145
+ if (l) {
146
+ d.current = document.activeElement, h(!0), i(!1);
147
147
  return;
148
148
  }
149
149
  if (!u) return;
150
- r(!0);
151
- const h = window.setTimeout(() => {
152
- var y, b;
153
- d(!1), r(!1), (b = (y = c.current) == null ? void 0 : y.focus) == null || b.call(y);
154
- }, Z);
155
- return () => window.clearTimeout(h);
156
- }, [e, u]), x(() => {
157
- var h, y;
158
- if (e && u) {
159
- const b = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
160
- (y = ((h = o.current) == null ? void 0 : h.querySelector(`.cms-modal__body :is(${b}), .cms-modal__foot :is(${b})`)) ?? o.current) == null || y.focus();
150
+ i(!0);
151
+ const p = window.setTimeout(() => {
152
+ var N, w;
153
+ h(!1), i(!1), (w = (N = d.current) == null ? void 0 : N.focus) == null || w.call(N);
154
+ }, R);
155
+ return () => window.clearTimeout(p);
156
+ }, [l, u]), D(() => {
157
+ var p, N;
158
+ if (l && u) {
159
+ const w = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
160
+ (N = ((p = f.current) == null ? void 0 : p.querySelector(`.cms-modal__body :is(${w}), .cms-modal__foot :is(${w})`)) ?? f.current) == null || N.focus();
161
161
  }
162
- }, [e, u]), !u) return null;
163
- const p = () => {
164
- a ? s == null || s() : l();
162
+ }, [l, u]), !u) return null;
163
+ const _ = () => {
164
+ c ? s == null || s() : a();
165
165
  };
166
- return C(
167
- /* @__PURE__ */ t("div", { className: _("cms-modal-scrim", f && "is-closing"), onMouseDown: (h) => {
168
- h.target === h.currentTarget && p();
169
- }, children: /* @__PURE__ */ v(
166
+ return Z(
167
+ /* @__PURE__ */ e("div", { className: g("cms-modal-scrim", o && "is-closing"), onMouseDown: (p) => {
168
+ p.target === p.currentTarget && _();
169
+ }, children: /* @__PURE__ */ r(
170
170
  "div",
171
171
  {
172
- ref: o,
173
- className: _("cms-modal", f && "is-closing", a && "is-dirty"),
172
+ ref: f,
173
+ className: g("cms-modal", o && "is-closing", c && "is-dirty"),
174
174
  role: "dialog",
175
175
  "aria-modal": "true",
176
- "aria-labelledby": g,
176
+ "aria-labelledby": v,
177
177
  tabIndex: -1,
178
- onKeyDown: (h) => {
179
- var y;
180
- if (h.key === "Escape")
181
- h.stopPropagation(), p();
182
- else if (h.key === "Tab") {
183
- const b = (y = o.current) == null ? void 0 : y.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
184
- if (!b || b.length === 0) return;
185
- const D = b[0], M = b[b.length - 1];
186
- h.shiftKey && document.activeElement === D ? (h.preventDefault(), M.focus()) : !h.shiftKey && document.activeElement === M && (h.preventDefault(), D.focus());
178
+ onKeyDown: (p) => {
179
+ var N;
180
+ if (p.key === "Escape")
181
+ p.stopPropagation(), _();
182
+ else if (p.key === "Tab") {
183
+ const w = (N = f.current) == null ? void 0 : N.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
184
+ if (!w || w.length === 0) return;
185
+ const L = w[0], T = w[w.length - 1];
186
+ p.shiftKey && document.activeElement === L ? (p.preventDefault(), T.focus()) : !p.shiftKey && document.activeElement === T && (p.preventDefault(), L.focus());
187
187
  }
188
188
  },
189
189
  children: [
190
- /* @__PURE__ */ v("header", { className: "cms-modal__head", children: [
191
- /* @__PURE__ */ t("h2", { className: "cms-modal__title", id: g, children: n }),
192
- /* @__PURE__ */ t("button", { type: "button", className: "cms-icon-button", "aria-label": "Close", onClick: p, children: /* @__PURE__ */ t(N, { name: "close" }) })
190
+ /* @__PURE__ */ r("header", { className: "cms-modal__head", children: [
191
+ /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: v, children: n }),
192
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": "Close", onClick: _, children: /* @__PURE__ */ e(k, { name: "close" }) })
193
193
  ] }),
194
- /* @__PURE__ */ t("div", { className: "cms-modal__body", children: m }),
195
- i != null ? /* @__PURE__ */ t("footer", { className: "cms-modal__foot", children: i }) : null
194
+ /* @__PURE__ */ e("div", { className: "cms-modal__body", children: m }),
195
+ t != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: t }) : null
196
196
  ]
197
197
  }
198
198
  ) }),
199
199
  document.body
200
200
  );
201
201
  }
202
- function O({ open: e, title: n, message: l, kind: a = "default", confirmLabel: s, cancelLabel: m, onConfirm: i, onCancel: u }) {
203
- const d = a === "discard-changes";
204
- return /* @__PURE__ */ t(
205
- I,
202
+ function ce({ open: l, title: n, message: a, kind: c = "default", confirmLabel: s, cancelLabel: m, onConfirm: t, onCancel: u }) {
203
+ const h = c === "discard-changes";
204
+ return /* @__PURE__ */ e(
205
+ z,
206
206
  {
207
- open: e,
207
+ open: l,
208
208
  title: n,
209
209
  onClose: u,
210
- footer: /* @__PURE__ */ v(S, { children: [
211
- /* @__PURE__ */ t(E, { onClick: u, children: m ?? (d ? "Keep editing" : "Cancel") }),
212
- /* @__PURE__ */ t(E, { variant: a === "default" ? "primary" : "danger", onClick: i, children: s ?? (d ? "Discard changes" : "Confirm") })
210
+ footer: /* @__PURE__ */ r(b, { children: [
211
+ /* @__PURE__ */ e(E, { onClick: u, children: m ?? (h ? "Keep editing" : "Cancel") }),
212
+ /* @__PURE__ */ e(E, { variant: c === "default" ? "primary" : "danger", onClick: t, children: s ?? (h ? "Discard changes" : "Confirm") })
213
213
  ] }),
214
- children: a !== "default" ? /* @__PURE__ */ v("p", { className: "cms-confirm__warning", children: [
215
- /* @__PURE__ */ t(N, { name: "warning" }),
214
+ children: c !== "default" ? /* @__PURE__ */ r("p", { className: "cms-confirm__warning", children: [
215
+ /* @__PURE__ */ e(k, { name: "warning" }),
216
216
  " ",
217
- l
218
- ] }) : /* @__PURE__ */ t("p", { children: l })
217
+ a
218
+ ] }) : /* @__PURE__ */ e("p", { children: a })
219
219
  }
220
220
  );
221
221
  }
222
- function ee({ kind: e, message: n, action: l, onDismiss: a }) {
223
- return /* @__PURE__ */ v("div", { className: _("cms-toast", `cms-toast--${e}`), role: e === "error" ? "alert" : "status", children: [
224
- /* @__PURE__ */ t(N, { name: e === "success" ? "check" : e === "error" ? "warning" : "info" }),
225
- /* @__PURE__ */ t("span", { className: "cms-toast__message", children: n }),
226
- l ? /* @__PURE__ */ t(E, { className: "cms-toast__action", onClick: l.onAction, children: l.label }) : null,
227
- a ? /* @__PURE__ */ t("button", { type: "button", className: "cms-icon-button", "aria-label": "Dismiss", onClick: a, children: /* @__PURE__ */ t(N, { name: "close" }) }) : null
222
+ function te({ kind: l, message: n, action: a, onDismiss: c }) {
223
+ return /* @__PURE__ */ r("div", { className: g("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
224
+ /* @__PURE__ */ e(k, { name: l === "success" ? "check" : l === "error" ? "warning" : "info" }),
225
+ /* @__PURE__ */ e("span", { className: "cms-toast__message", children: n }),
226
+ a ? /* @__PURE__ */ e(E, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
227
+ c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": "Dismiss", onClick: c, children: /* @__PURE__ */ e(k, { name: "close" }) }) : null
228
228
  ] });
229
229
  }
230
- function ne({ children: e }) {
231
- return /* @__PURE__ */ t("div", { className: "cms-toast-region", children: e });
230
+ function re({ children: l }) {
231
+ return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: l });
232
232
  }
233
- function q({ what: e, layout: n = "inline" }) {
234
- return /* @__PURE__ */ v("div", { className: _("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
235
- /* @__PURE__ */ t(N, { name: "spinner" }),
236
- /* @__PURE__ */ t("span", { children: e })
233
+ function P({ what: l, layout: n = "inline" }) {
234
+ return /* @__PURE__ */ r("div", { className: g("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
235
+ /* @__PURE__ */ e(k, { name: "spinner" }),
236
+ /* @__PURE__ */ e("span", { children: l })
237
237
  ] });
238
238
  }
239
- function F({ title: e, hint: n, action: l }) {
240
- return /* @__PURE__ */ v("div", { className: "cms-empty", children: [
241
- /* @__PURE__ */ t("p", { className: "cms-empty__title", children: e }),
242
- n != null ? /* @__PURE__ */ t("p", { className: "cms-empty__hint", children: n }) : null,
243
- l != null ? /* @__PURE__ */ t("div", { className: "cms-empty__action", children: l }) : null
239
+ function V({ title: l, hint: n, action: a }) {
240
+ return /* @__PURE__ */ r("div", { className: "cms-empty", children: [
241
+ /* @__PURE__ */ e("p", { className: "cms-empty__title", children: l }),
242
+ n != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: n }) : null,
243
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: a }) : null
244
244
  ] });
245
245
  }
246
- function R({ message: e, onRetry: n }) {
247
- return /* @__PURE__ */ v("div", { className: "cms-error-banner", role: "alert", children: [
248
- /* @__PURE__ */ t(N, { name: "warning" }),
249
- /* @__PURE__ */ t("span", { className: "cms-error-banner__message", children: e }),
250
- n ? /* @__PURE__ */ t(E, { onClick: n, children: "Try again" }) : null
246
+ function j({ message: l, onRetry: n }) {
247
+ return /* @__PURE__ */ r("div", { className: "cms-error-banner", role: "alert", children: [
248
+ /* @__PURE__ */ e(k, { name: "warning" }),
249
+ /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: l }),
250
+ n ? /* @__PURE__ */ e(E, { onClick: n, children: "Try again" }) : null
251
251
  ] });
252
252
  }
253
- function te({ title: e, scope: n, actions: l, backLink: a }) {
254
- return /* @__PURE__ */ v("header", { className: "cms-page-header", children: [
255
- a ? /* @__PURE__ */ v(
253
+ function ie({ title: l, scope: n, actions: a, backLink: c }) {
254
+ return /* @__PURE__ */ r("header", { className: "cms-page-header", children: [
255
+ c ? /* @__PURE__ */ r(
256
256
  "a",
257
257
  {
258
258
  className: "cms-page-header__back",
259
- href: a.href ?? "#",
259
+ href: c.href ?? "#",
260
260
  onClick: (s) => {
261
- a.onBack && (s.preventDefault(), a.onBack());
261
+ c.onBack && (s.preventDefault(), c.onBack());
262
262
  },
263
263
  children: [
264
- /* @__PURE__ */ t(N, { name: "back" }),
264
+ /* @__PURE__ */ e(k, { name: "back" }),
265
265
  " ",
266
- a.label
266
+ c.label
267
267
  ]
268
268
  }
269
269
  ) : null,
270
- /* @__PURE__ */ v("div", { className: "cms-page-header__row", children: [
271
- /* @__PURE__ */ v("div", { className: "cms-page-header__titles", children: [
272
- /* @__PURE__ */ t("h1", { className: "cms-page-header__title", children: e }),
273
- n != null ? /* @__PURE__ */ t("p", { className: "cms-page-header__scope", children: n }) : null
270
+ /* @__PURE__ */ r("div", { className: "cms-page-header__row", children: [
271
+ /* @__PURE__ */ r("div", { className: "cms-page-header__titles", children: [
272
+ /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: l }),
273
+ n != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: n }) : null
274
274
  ] }),
275
- l != null ? /* @__PURE__ */ t("div", { className: "cms-page-header__actions", children: l }) : null
275
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-page-header__actions", children: a }) : null
276
276
  ] })
277
277
  ] });
278
278
  }
279
- function le({ tabs: e, active: n, onSelect: l, label: a }) {
280
- const s = w([]), m = (i, u) => {
281
- var o;
282
- const d = e.length - 1, f = i.key === "ArrowRight" ? u === d ? 0 : u + 1 : i.key === "ArrowLeft" ? u === 0 ? d : u - 1 : i.key === "Home" ? 0 : i.key === "End" ? d : null;
283
- if (f === null) return;
284
- i.preventDefault();
285
- const r = e[f];
286
- r && (l(r.id), (o = s.current[f]) == null || o.focus());
279
+ function oe({ tabs: l, active: n, onSelect: a, label: c }) {
280
+ const s = x([]), m = (t, u) => {
281
+ var f;
282
+ const h = l.length - 1, o = t.key === "ArrowRight" ? u === h ? 0 : u + 1 : t.key === "ArrowLeft" ? u === 0 ? h : u - 1 : t.key === "Home" ? 0 : t.key === "End" ? h : null;
283
+ if (o === null) return;
284
+ t.preventDefault();
285
+ const i = l[o];
286
+ i && (a(i.id), (f = s.current[o]) == null || f.focus());
287
287
  };
288
- return /* @__PURE__ */ t("div", { className: "cms-tabs", role: "tablist", "aria-label": a, children: e.map((i, u) => {
289
- const d = i.id === n;
290
- return /* @__PURE__ */ v(
288
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((t, u) => {
289
+ const h = t.id === n;
290
+ return /* @__PURE__ */ r(
291
291
  "button",
292
292
  {
293
- ref: (f) => {
294
- s.current[u] = f;
293
+ ref: (o) => {
294
+ s.current[u] = o;
295
295
  },
296
296
  type: "button",
297
297
  role: "tab",
298
- className: _("cms-tab", d && "is-active"),
299
- "aria-selected": d,
300
- tabIndex: d ? 0 : -1,
301
- onClick: () => l(i.id),
302
- onKeyDown: (f) => m(f, u),
298
+ className: g("cms-tab", h && "is-active"),
299
+ "aria-selected": h,
300
+ tabIndex: h ? 0 : -1,
301
+ onClick: () => a(t.id),
302
+ onKeyDown: (o) => m(o, u),
303
303
  children: [
304
- i.label,
305
- i.count !== void 0 ? /* @__PURE__ */ t("span", { className: "cms-tab__count", children: i.count }) : null
304
+ t.label,
305
+ t.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: t.count }) : null
306
306
  ]
307
307
  },
308
- i.id
308
+ t.id
309
309
  );
310
310
  }) });
311
311
  }
312
- function V(e) {
313
- var a;
314
- const n = e.trim().split(/\s+/).filter(Boolean);
315
- return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(a = n[0]) == null ? void 0 : a[0]]).filter(Boolean).join("").toUpperCase();
312
+ function q(l) {
313
+ var c;
314
+ const n = l.trim().split(/\s+/).filter(Boolean);
315
+ return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(c = n[0]) == null ? void 0 : c[0]]).filter(Boolean).join("").toUpperCase();
316
+ }
317
+ function U(l) {
318
+ let n = 0;
319
+ for (const a of l.trim().toLowerCase())
320
+ n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
321
+ return n % 6 + 1;
316
322
  }
317
- function re({ name: e, pictureUrl: n, presence: l, size: a = 32 }) {
318
- return /* @__PURE__ */ v(
323
+ function $({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
324
+ return /* @__PURE__ */ r(
319
325
  "span",
320
326
  {
321
- className: "cms-avatar",
322
- style: { width: a, height: a, fontSize: Math.round(a * 0.4) },
327
+ className: `cms-avatar cms-avatar--tint-${U(l)}`,
328
+ style: { width: c, height: c, fontSize: Math.round(c * 0.4) },
323
329
  role: "img",
324
- "aria-label": l ? `${e}, ${l}` : e,
330
+ "aria-label": a ? `${l}, ${a}` : l,
325
331
  children: [
326
- n ? /* @__PURE__ */ t("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ t("span", { "aria-hidden": "true", children: V(e) }),
327
- l ? /* @__PURE__ */ t("span", { className: _("cms-avatar__presence", `is-${l}`), "aria-hidden": "true" }) : null
332
+ n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: q(l) }),
333
+ a ? /* @__PURE__ */ e("span", { className: g("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
328
334
  ]
329
335
  }
330
336
  );
331
337
  }
332
- function ae({ label: e, rows: n, error: l, onRetry: a, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: i, selected: u, onOpen: d, onRowMenu: f }) {
333
- const r = w([]);
334
- if (l != null) return /* @__PURE__ */ t(R, { message: l, onRetry: a });
335
- if (n === null) return /* @__PURE__ */ t(q, { what: s, layout: "block" });
336
- if (n.length === 0) return /* @__PURE__ */ t(F, { title: m, hint: i });
337
- const o = (c, g, p) => {
338
- var h;
339
- if (c.key === "ArrowDown" || c.key === "ArrowUp")
340
- c.preventDefault(), (h = r.current[Math.min(n.length - 1, Math.max(0, g + (c.key === "ArrowDown" ? 1 : -1)))]) == null || h.focus();
341
- else if (c.key === "Enter")
342
- d == null || d(p);
343
- else if ((c.key === "ContextMenu" || c.shiftKey && c.key === "F10") && f) {
344
- c.preventDefault();
345
- const y = c.currentTarget.getBoundingClientRect();
346
- f(p, { x: y.left + 16, y: y.bottom });
338
+ const K = {
339
+ mail: /* @__PURE__ */ r(b, { children: [
340
+ /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
341
+ /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
342
+ ] }),
343
+ chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
344
+ phone: /* @__PURE__ */ e("path", { d: "M5 3h3l2 5-2.5 1.5a11 11 0 0 0 7 7L16 14l5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 3 5a2 2 0 0 1 2-2Z" }),
345
+ calendar: /* @__PURE__ */ r(b, { children: [
346
+ /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
347
+ /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
348
+ ] }),
349
+ file: /* @__PURE__ */ r(b, { children: [
350
+ /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
351
+ /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
352
+ ] }),
353
+ image: /* @__PURE__ */ r(b, { children: [
354
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
355
+ /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
356
+ /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
357
+ ] }),
358
+ search: /* @__PURE__ */ r(b, { children: [
359
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
360
+ /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
361
+ ] }),
362
+ bell: /* @__PURE__ */ r(b, { children: [
363
+ /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
364
+ /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
365
+ ] }),
366
+ pencil: /* @__PURE__ */ r(b, { children: [
367
+ /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
368
+ /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
369
+ ] }),
370
+ star: /* @__PURE__ */ e("path", { d: "m12 3 2.8 5.8 6.2.9-4.5 4.4 1 6.2L12 17.4l-5.5 2.9 1-6.2L3 9.7l6.2-.9Z" }),
371
+ send: /* @__PURE__ */ r(b, { children: [
372
+ /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
373
+ /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
374
+ ] }),
375
+ inbox: /* @__PURE__ */ r(b, { children: [
376
+ /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
377
+ /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
378
+ ] }),
379
+ archive: /* @__PURE__ */ r(b, { children: [
380
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
381
+ /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
382
+ ] }),
383
+ trash: /* @__PURE__ */ r(b, { children: [
384
+ /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
385
+ /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
386
+ ] }),
387
+ paperclip: /* @__PURE__ */ e("path", { d: "m20 11-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7" }),
388
+ mic: /* @__PURE__ */ r(b, { children: [
389
+ /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
390
+ /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
391
+ ] }),
392
+ speaker: /* @__PURE__ */ r(b, { children: [
393
+ /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
394
+ /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
395
+ ] }),
396
+ "user-plus": /* @__PURE__ */ r(b, { children: [
397
+ /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
398
+ /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
399
+ ] }),
400
+ "phone-off": /* @__PURE__ */ e("path", { d: "M3 14c5-5 13-5 18 0l-2 3-4-1v-3a10 10 0 0 0-6 0v3l-4 1Z" }),
401
+ video: /* @__PURE__ */ r(b, { children: [
402
+ /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
403
+ /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
404
+ ] }),
405
+ info: /* @__PURE__ */ r(b, { children: [
406
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
407
+ /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
408
+ ] }),
409
+ "chevron-down": /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }),
410
+ "chevron-left": /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }),
411
+ plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
412
+ folder: /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
413
+ check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
414
+ server: /* @__PURE__ */ r(b, { children: [
415
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
416
+ /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
417
+ /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
418
+ ] }),
419
+ reply: /* @__PURE__ */ e("path", { d: "M10 8 4 13l6 5M4 13h11a5 5 0 0 1 5 5" }),
420
+ more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" })
421
+ };
422
+ function y({ name: l, size: n = 20, label: a }) {
423
+ return /* @__PURE__ */ e(
424
+ "svg",
425
+ {
426
+ className: "cms-icon",
427
+ width: n,
428
+ height: n,
429
+ viewBox: "0 0 24 24",
430
+ fill: "none",
431
+ stroke: "currentColor",
432
+ strokeWidth: l === "more" ? 3 : 1.75,
433
+ strokeLinecap: "round",
434
+ strokeLinejoin: "round",
435
+ focusable: !1,
436
+ ...a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 },
437
+ children: K[l]
347
438
  }
439
+ );
440
+ }
441
+ const de = Object.keys(K);
442
+ function W({ count: l, label: n, max: a = 99 }) {
443
+ return l <= 0 ? null : /* @__PURE__ */ r("span", { className: "cms-badge", children: [
444
+ /* @__PURE__ */ e("span", { "aria-hidden": "true", children: l > a ? `${a}+` : l }),
445
+ /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: n })
446
+ ] });
447
+ }
448
+ function me({ product: l, mark: n, rail: a, active: c, onNavigate: s, server: m, search: t, account: u, children: h }) {
449
+ return /* @__PURE__ */ r("div", { className: "cms-shell", children: [
450
+ /* @__PURE__ */ r("nav", { className: "cms-shell__rail", "aria-label": "Sections", children: [
451
+ /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: n }),
452
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((o) => {
453
+ const i = o.id === c;
454
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ r(
455
+ "a",
456
+ {
457
+ href: o.href,
458
+ className: g("cms-shell__item", i && "is-active"),
459
+ "aria-current": i ? "page" : void 0,
460
+ title: o.label,
461
+ onClick: (f) => {
462
+ s && (f.preventDefault(), s(o.id));
463
+ },
464
+ children: [
465
+ /* @__PURE__ */ r("span", { className: "cms-shell__icon", children: [
466
+ /* @__PURE__ */ e(y, { name: o.icon, size: 22 }),
467
+ o.badge ? /* @__PURE__ */ e(W, { count: o.badge.count, label: o.badge.label }) : null
468
+ ] }),
469
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: o.label })
470
+ ]
471
+ }
472
+ ) }, o.id);
473
+ }) })
474
+ ] }),
475
+ /* @__PURE__ */ r("header", { className: "cms-shell__top", children: [
476
+ /* @__PURE__ */ e("span", { className: "cms-shell__product", children: l }),
477
+ m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: m }) : null,
478
+ t != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: t }) : null,
479
+ u != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: u }) : null
480
+ ] }),
481
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: h })
482
+ ] });
483
+ }
484
+ function ue({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
485
+ return /* @__PURE__ */ r(
486
+ "form",
487
+ {
488
+ role: "search",
489
+ className: "cms-search",
490
+ onSubmit: (m) => {
491
+ m.preventDefault(), s == null || s(a);
492
+ },
493
+ children: [
494
+ /* @__PURE__ */ e(y, { name: "search", size: 18 }),
495
+ /* @__PURE__ */ e(
496
+ "input",
497
+ {
498
+ className: "cms-search__input",
499
+ type: "search",
500
+ "aria-label": l,
501
+ placeholder: n,
502
+ value: a,
503
+ onChange: (m) => c(m.target.value)
504
+ }
505
+ )
506
+ ]
507
+ }
508
+ );
509
+ }
510
+ function he({ options: l, value: n, onChange: a, label: c }) {
511
+ const s = x([]), m = (t, u) => {
512
+ var f;
513
+ const h = l.length - 1, o = t.key === "ArrowRight" || t.key === "ArrowDown" ? u === h ? 0 : u + 1 : t.key === "ArrowLeft" || t.key === "ArrowUp" ? u === 0 ? h : u - 1 : null;
514
+ if (o === null) return;
515
+ t.preventDefault();
516
+ const i = l[o];
517
+ i && (a(i.id), (f = s.current[o]) == null || f.focus());
348
518
  };
349
- return /* @__PURE__ */ t("ul", { className: "cms-list", role: "listbox", "aria-label": e, children: n.map((c, g) => {
350
- const p = c.id === u;
351
- return /* @__PURE__ */ v(
519
+ return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((t, u) => {
520
+ const h = t.id === n;
521
+ return /* @__PURE__ */ r(
522
+ "button",
523
+ {
524
+ ref: (o) => {
525
+ s.current[u] = o;
526
+ },
527
+ type: "button",
528
+ role: "radio",
529
+ "aria-checked": h,
530
+ tabIndex: h ? 0 : -1,
531
+ className: g("cms-chip", h && "is-on"),
532
+ onClick: () => a(t.id),
533
+ onKeyDown: (o) => m(o, u),
534
+ children: [
535
+ h ? /* @__PURE__ */ e(y, { name: "check", size: 16 }) : null,
536
+ t.label
537
+ ]
538
+ },
539
+ t.id
540
+ );
541
+ }) });
542
+ }
543
+ function fe({ panes: l, active: n, back: a }) {
544
+ const c = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
545
+ return /* @__PURE__ */ e("div", { className: g("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": c, children: l.map((s, m) => /* @__PURE__ */ r("section", { className: "cms-panes__pane", "aria-label": s.label, "data-offset": c - m, children: [
546
+ m === c && a ? /* @__PURE__ */ r("a", { className: "cms-panes__back", href: a.href, children: [
547
+ /* @__PURE__ */ e(y, { name: "chevron-left", size: 18 }),
548
+ a.label
549
+ ] }) : null,
550
+ s.content
551
+ ] }, s.label)) });
552
+ }
553
+ function pe({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment: m, selected: t, onOpen: u }) {
554
+ return /* @__PURE__ */ r(
555
+ "button",
556
+ {
557
+ type: "button",
558
+ className: g("cms-mail-row", s && "is-unread", t && "is-selected"),
559
+ "aria-current": t ? "true" : void 0,
560
+ onClick: u,
561
+ children: [
562
+ /* @__PURE__ */ e($, { name: l, size: 40 }),
563
+ /* @__PURE__ */ r("span", { className: "cms-mail-row__body", children: [
564
+ /* @__PURE__ */ r("span", { className: "cms-mail-row__line", children: [
565
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: l }),
566
+ m ? /* @__PURE__ */ e(y, { name: "paperclip", size: 16, label: "Has an attachment" }) : null,
567
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: c })
568
+ ] }),
569
+ /* @__PURE__ */ r("span", { className: "cms-mail-row__line", children: [
570
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: n }),
571
+ s ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": "Unread" }) : null
572
+ ] }),
573
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: a })
574
+ ] })
575
+ ]
576
+ }
577
+ );
578
+ }
579
+ function _e({ direction: l, children: n, time: a, read: c }) {
580
+ return /* @__PURE__ */ r("div", { className: g("cms-bubble", `cms-bubble--${l}`), children: [
581
+ /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: n }),
582
+ /* @__PURE__ */ r("div", { className: "cms-bubble__meta", children: [
583
+ a,
584
+ l === "out" && c ? /* @__PURE__ */ e(b, { children: " · Read" }) : null
585
+ ] })
586
+ ] });
587
+ }
588
+ function be({ label: l, value: n, onChange: a, onSend: c, onAttach: s, placeholder: m, variant: t = "chat", sendLabel: u = "Send" }) {
589
+ const h = A(), o = n.trim() === "", i = (d) => {
590
+ d.preventDefault(), o || c();
591
+ }, f = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": "Attach a file", onClick: s, children: /* @__PURE__ */ e(y, { name: "paperclip" }) }) : null;
592
+ return /* @__PURE__ */ r("form", { className: g("cms-composer", `cms-composer--${t}`), onSubmit: i, children: [
593
+ /* @__PURE__ */ e("label", { htmlFor: h, className: t === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
594
+ t === "chat" ? f : null,
595
+ /* @__PURE__ */ e(
596
+ "textarea",
597
+ {
598
+ id: h,
599
+ className: "cms-composer__input",
600
+ rows: t === "reply" ? 3 : 1,
601
+ placeholder: m,
602
+ value: n,
603
+ onChange: (d) => a(d.target.value),
604
+ onKeyDown: (d) => {
605
+ t === "chat" && d.key === "Enter" && !d.shiftKey && (d.preventDefault(), o || c());
606
+ }
607
+ }
608
+ ),
609
+ t === "reply" ? f : null,
610
+ t === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": u, disabled: o, children: /* @__PURE__ */ e(y, { name: "send" }) }) : /* @__PURE__ */ r("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: o, children: [
611
+ u,
612
+ " ",
613
+ /* @__PURE__ */ e(y, { name: "send", size: 18 })
614
+ ] })
615
+ ] });
616
+ }
617
+ function ve({ name: l, media: n, onAccept: a, onDecline: c }) {
618
+ const s = n === "video" ? "Incoming video call" : "Incoming audio call";
619
+ return /* @__PURE__ */ r("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": `${s} from ${l}`, children: [
620
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e($, { name: l, size: 112 }) }),
621
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: l }),
622
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: s }),
623
+ /* @__PURE__ */ r("div", { className: "cms-call-incoming__actions", children: [
624
+ /* @__PURE__ */ e(C, { icon: "phone-off", label: "Decline", tone: "hang-up", onClick: c }),
625
+ /* @__PURE__ */ e(C, { icon: "phone", label: "Accept", tone: "accept", onClick: a })
626
+ ] })
627
+ ] });
628
+ }
629
+ function C({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: s }) {
630
+ return /* @__PURE__ */ r(
631
+ "button",
632
+ {
633
+ type: "button",
634
+ className: g("cms-call-button", `cms-call-button--${c}`, s && "is-pressed"),
635
+ "aria-pressed": s,
636
+ onClick: a,
637
+ children: [
638
+ /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(y, { name: l, size: 24 }) }),
639
+ /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: n })
640
+ ]
641
+ }
642
+ );
643
+ }
644
+ function ge({ name: l, duration: n, connection: a, you: c, muted: s, speaker: m, onToggleMute: t, onToggleSpeaker: u, onAddPerson: h, onChat: o, onHangUp: i }) {
645
+ return /* @__PURE__ */ r("section", { className: "cms-call-panel", "aria-label": `Call with ${l}`, children: [
646
+ /* @__PURE__ */ r("div", { className: "cms-call-panel__head", children: [
647
+ /* @__PURE__ */ e($, { name: l, size: 64 }),
648
+ /* @__PURE__ */ r("div", { className: "cms-call-panel__who", children: [
649
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: l }),
650
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": `Call time ${n}`, children: n })
651
+ ] }),
652
+ /* @__PURE__ */ e("span", { className: g("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? "Good connection" : "Poor connection" })
653
+ ] }),
654
+ /* @__PURE__ */ r("div", { className: "cms-call-panel__you", children: [
655
+ /* @__PURE__ */ e($, { name: c.name, size: 36 }),
656
+ /* @__PURE__ */ e("span", { children: "You" }),
657
+ c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": "Speaking" }) : null
658
+ ] }),
659
+ /* @__PURE__ */ r("div", { className: "cms-call-panel__controls", children: [
660
+ /* @__PURE__ */ e(C, { icon: "mic", label: s ? "Unmute" : "Mute", pressed: s, onClick: t }),
661
+ /* @__PURE__ */ e(C, { icon: "speaker", label: "Speaker", pressed: m, onClick: u }),
662
+ h ? /* @__PURE__ */ e(C, { icon: "user-plus", label: "Add person", onClick: h }) : null,
663
+ o ? /* @__PURE__ */ e(C, { icon: "chat", label: "Chat", onClick: o }) : null,
664
+ /* @__PURE__ */ e(C, { icon: "phone-off", label: "Hang up", tone: "hang-up", onClick: i })
665
+ ] })
666
+ ] });
667
+ }
668
+ function Ne({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: s, onHangUp: m }) {
669
+ return /* @__PURE__ */ r("section", { className: "cms-call-bar", "aria-label": `Call with ${l}`, children: [
670
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
671
+ /* @__PURE__ */ r("span", { className: "cms-call-bar__name", children: [
672
+ "On a call with ",
673
+ l
674
+ ] }),
675
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: n }),
676
+ /* @__PURE__ */ r("span", { className: "cms-call-bar__actions", children: [
677
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? "Unmute" : "Mute", "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(y, { name: "mic" }) }),
678
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: "Return to call" }),
679
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": "Hang up", onClick: m, children: /* @__PURE__ */ e(y, { name: "phone-off" }) })
680
+ ] })
681
+ ] });
682
+ }
683
+ function ye({ mark: l, product: n, headline: a, lead: c, features: s = [], children: m }) {
684
+ return /* @__PURE__ */ r("div", { className: "cms-signin", children: [
685
+ /* @__PURE__ */ r("aside", { className: "cms-signin__brand", children: [
686
+ /* @__PURE__ */ r("p", { className: "cms-signin__logo", children: [
687
+ /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: l }),
688
+ n
689
+ ] }),
690
+ /* @__PURE__ */ r("div", { className: "cms-signin__pitch", children: [
691
+ /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
692
+ /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: c }),
693
+ s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((t) => /* @__PURE__ */ r("li", { children: [
694
+ /* @__PURE__ */ e(y, { name: t.icon, size: 18 }),
695
+ t.label
696
+ ] }, t.label)) }) : null
697
+ ] })
698
+ ] }),
699
+ /* @__PURE__ */ e("main", { className: "cms-signin__form", children: m })
700
+ ] });
701
+ }
702
+ function we({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: s, busy: m }) {
703
+ const t = A(), [u, h] = M(""), [o, i] = M(""), [f, d] = M(!1);
704
+ return /* @__PURE__ */ r("form", { className: "cms-signin-form", onSubmit: (_) => {
705
+ _.preventDefault(), n(u, o);
706
+ }, "aria-describedby": s ? `${t}-error` : void 0, children: [
707
+ /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: "Sign in" }),
708
+ /* @__PURE__ */ r("p", { className: "cms-signin-form__server", children: [
709
+ /* @__PURE__ */ e(y, { name: "server", size: 18 }),
710
+ l
711
+ ] }),
712
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${t}-identifier`, children: "Email or username" }),
713
+ /* @__PURE__ */ e(
714
+ "input",
715
+ {
716
+ id: `${t}-identifier`,
717
+ className: "cms-field",
718
+ type: "text",
719
+ autoComplete: "username",
720
+ placeholder: "name@example.com",
721
+ value: u,
722
+ onChange: (_) => h(_.target.value),
723
+ required: !0
724
+ }
725
+ ),
726
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${t}-password`, children: "Password" }),
727
+ /* @__PURE__ */ r("span", { className: "cms-signin-form__password", children: [
728
+ /* @__PURE__ */ e(
729
+ "input",
730
+ {
731
+ id: `${t}-password`,
732
+ className: "cms-field",
733
+ type: f ? "text" : "password",
734
+ autoComplete: "current-password",
735
+ value: o,
736
+ onChange: (_) => i(_.target.value),
737
+ required: !0
738
+ }
739
+ ),
740
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": f, onClick: () => d((_) => !_), children: f ? "Hide" : "Show" })
741
+ ] }),
742
+ a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: "Forgot password?" }) : null,
743
+ s ? /* @__PURE__ */ e("p", { id: `${t}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
744
+ /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: m, "aria-busy": m || void 0, children: "Sign in" }),
745
+ c ? /* @__PURE__ */ r(b, { children: [
746
+ /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: "New here?" }) }),
747
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: "Create an account" })
748
+ ] }) : null
749
+ ] });
750
+ }
751
+ function ke({ label: l, rows: n, error: a, onRetry: c, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: t, selected: u, onOpen: h, onRowMenu: o }) {
752
+ const i = x([]);
753
+ if (a != null) return /* @__PURE__ */ e(j, { message: a, onRetry: c });
754
+ if (n === null) return /* @__PURE__ */ e(P, { what: s, layout: "block" });
755
+ if (n.length === 0) return /* @__PURE__ */ e(V, { title: m, hint: t });
756
+ const f = (d, v, _) => {
757
+ var p;
758
+ if (d.key === "ArrowDown" || d.key === "ArrowUp")
759
+ d.preventDefault(), (p = i.current[Math.min(n.length - 1, Math.max(0, v + (d.key === "ArrowDown" ? 1 : -1)))]) == null || p.focus();
760
+ else if (d.key === "Enter")
761
+ h == null || h(_);
762
+ else if ((d.key === "ContextMenu" || d.shiftKey && d.key === "F10") && o) {
763
+ d.preventDefault();
764
+ const N = d.currentTarget.getBoundingClientRect();
765
+ o(_, { x: N.left + 16, y: N.bottom });
766
+ }
767
+ };
768
+ return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((d, v) => {
769
+ const _ = d.id === u;
770
+ return /* @__PURE__ */ r(
352
771
  "li",
353
772
  {
354
- ref: (h) => {
355
- r.current[g] = h;
773
+ ref: (p) => {
774
+ i.current[v] = p;
356
775
  },
357
776
  role: "option",
358
- "aria-selected": p,
359
- tabIndex: p || u == null && g === 0 ? 0 : -1,
360
- className: _("cms-list__row", p && "is-selected"),
361
- onClick: () => d == null ? void 0 : d(c.id),
362
- onKeyDown: (h) => o(h, g, c.id),
363
- onContextMenu: f ? (h) => {
364
- h.preventDefault(), f(c.id, { x: h.clientX, y: h.clientY });
777
+ "aria-selected": _,
778
+ tabIndex: _ || u == null && v === 0 ? 0 : -1,
779
+ className: g("cms-list__row", _ && "is-selected"),
780
+ onClick: () => h == null ? void 0 : h(d.id),
781
+ onKeyDown: (p) => f(p, v, d.id),
782
+ onContextMenu: o ? (p) => {
783
+ p.preventDefault(), o(d.id, { x: p.clientX, y: p.clientY });
365
784
  } : void 0,
366
785
  children: [
367
- c.lead != null ? /* @__PURE__ */ t("span", { className: "cms-list__lead", children: c.lead }) : null,
368
- /* @__PURE__ */ v("span", { className: "cms-list__text", children: [
369
- /* @__PURE__ */ t("span", { className: "cms-list__primary", children: c.primary }),
370
- c.secondary != null ? /* @__PURE__ */ t("span", { className: "cms-list__secondary", children: c.secondary }) : null
786
+ d.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: d.lead }) : null,
787
+ /* @__PURE__ */ r("span", { className: "cms-list__text", children: [
788
+ /* @__PURE__ */ e("span", { className: "cms-list__primary", children: d.primary }),
789
+ d.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: d.secondary }) : null
371
790
  ] }),
372
- c.meta != null ? /* @__PURE__ */ t("span", { className: "cms-list__meta", children: c.meta }) : null
791
+ d.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: d.meta }) : null
373
792
  ]
374
793
  },
375
- c.id
794
+ d.id
376
795
  );
377
796
  }) });
378
797
  }
379
- function se({ at: e, items: n, onClose: l, label: a = "Actions" }) {
380
- const s = w(null), m = w(null), [i, u] = k(e), d = n.filter((r) => r.offer.offered);
381
- if (B(() => {
382
- if (!e) return;
383
- const r = s.current, o = (r == null ? void 0 : r.offsetWidth) ?? 0, c = (r == null ? void 0 : r.offsetHeight) ?? 0;
384
- u({ x: Math.max(0, Math.min(e.x, window.innerWidth - o)), y: Math.max(0, Math.min(e.y, window.innerHeight - c)) });
385
- }, [e]), x(() => {
386
- var o, c;
387
- if (!e) return;
388
- m.current = document.activeElement, (c = (o = s.current) == null ? void 0 : o.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || c.focus();
389
- const r = (g) => {
390
- var p;
391
- (p = s.current) != null && p.contains(g.target) || l();
798
+ function Me({ at: l, items: n, onClose: a, label: c = "Actions" }) {
799
+ const s = x(null), m = x(null), [t, u] = M(l), h = n.filter((i) => i.offer.offered);
800
+ if (F(() => {
801
+ if (!l) return;
802
+ const i = s.current, f = (i == null ? void 0 : i.offsetWidth) ?? 0, d = (i == null ? void 0 : i.offsetHeight) ?? 0;
803
+ u({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - d)) });
804
+ }, [l]), D(() => {
805
+ var f, d;
806
+ if (!l) return;
807
+ m.current = document.activeElement, (d = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || d.focus();
808
+ const i = (v) => {
809
+ var _;
810
+ (_ = s.current) != null && _.contains(v.target) || a();
392
811
  };
393
- return document.addEventListener("mousedown", r), () => {
394
- var g, p;
395
- document.removeEventListener("mousedown", r), (p = (g = m.current) == null ? void 0 : g.focus) == null || p.call(g);
812
+ return document.addEventListener("mousedown", i), () => {
813
+ var v, _;
814
+ document.removeEventListener("mousedown", i), (_ = (v = m.current) == null ? void 0 : v.focus) == null || _.call(v);
396
815
  };
397
- }, [e, l]), !e || d.length === 0) return null;
398
- const f = (r) => {
399
- var g, p;
400
- const o = Array.from(((g = s.current) == null ? void 0 : g.querySelectorAll('[role="menuitem"]')) ?? []), c = o.indexOf(document.activeElement);
401
- if (r.key === "Escape" || r.key === "Tab")
402
- r.preventDefault(), l();
403
- else if (r.key === "ArrowDown" || r.key === "ArrowUp") {
404
- r.preventDefault();
405
- const h = r.key === "ArrowDown" ? 1 : -1;
406
- (p = o[(c + h + o.length) % o.length]) == null || p.focus();
816
+ }, [l, a]), !l || h.length === 0) return null;
817
+ const o = (i) => {
818
+ var v, _;
819
+ const f = Array.from(((v = s.current) == null ? void 0 : v.querySelectorAll('[role="menuitem"]')) ?? []), d = f.indexOf(document.activeElement);
820
+ if (i.key === "Escape" || i.key === "Tab")
821
+ i.preventDefault(), a();
822
+ else if (i.key === "ArrowDown" || i.key === "ArrowUp") {
823
+ i.preventDefault();
824
+ const p = i.key === "ArrowDown" ? 1 : -1;
825
+ (_ = f[(d + p + f.length) % f.length]) == null || _.focus();
407
826
  }
408
827
  };
409
- return C(
410
- /* @__PURE__ */ t(
828
+ return Z(
829
+ /* @__PURE__ */ e(
411
830
  "div",
412
831
  {
413
832
  ref: s,
414
833
  className: "cms-menu",
415
834
  role: "menu",
416
- "aria-label": a,
417
- style: { left: (i ?? e).x, top: (i ?? e).y },
418
- onKeyDown: f,
419
- onContextMenu: (r) => r.preventDefault(),
420
- children: d.map((r) => {
421
- const o = r.offer.refusal !== void 0;
422
- return /* @__PURE__ */ v(
835
+ "aria-label": c,
836
+ style: { left: (t ?? l).x, top: (t ?? l).y },
837
+ onKeyDown: o,
838
+ onContextMenu: (i) => i.preventDefault(),
839
+ children: h.map((i) => {
840
+ const f = i.offer.refusal !== void 0;
841
+ return /* @__PURE__ */ r(
423
842
  "div",
424
843
  {
425
844
  role: "menuitem",
426
845
  tabIndex: -1,
427
- "aria-disabled": o || void 0,
428
- title: o ? r.offer.refusal : void 0,
429
- className: _("cms-menu__item", r.danger && "is-danger", r.offer.locked && "is-locked", o && "is-refused"),
846
+ "aria-disabled": f || void 0,
847
+ title: f ? i.offer.refusal : void 0,
848
+ className: g("cms-menu__item", i.danger && "is-danger", i.offer.locked && "is-locked", f && "is-refused"),
430
849
  onClick: () => {
431
- o || (l(), r.onSelect());
850
+ f || (a(), i.onSelect());
432
851
  },
433
- onKeyDown: (c) => {
434
- (c.key === "Enter" || c.key === " ") && !o && (c.preventDefault(), l(), r.onSelect());
852
+ onKeyDown: (d) => {
853
+ (d.key === "Enter" || d.key === " ") && !f && (d.preventDefault(), a(), i.onSelect());
435
854
  },
436
855
  children: [
437
- r.offer.locked ? /* @__PURE__ */ t(N, { name: "lock" }) : null,
438
- /* @__PURE__ */ t("span", { className: "cms-menu__label", children: r.label }),
439
- o ? /* @__PURE__ */ t("span", { className: "cms-menu__refusal", children: r.offer.refusal }) : null
856
+ i.offer.locked ? /* @__PURE__ */ e(k, { name: "lock" }) : null,
857
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: i.label }),
858
+ f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: i.offer.refusal }) : null
440
859
  ]
441
860
  },
442
- r.id
861
+ i.id
443
862
  );
444
863
  })
445
864
  }
@@ -447,13 +866,13 @@ function se({ at: e, items: n, onClose: l, label: a = "Actions" }) {
447
866
  document.body
448
867
  );
449
868
  }
450
- function j(e) {
451
- return e === "allowed" || e === "elevate" || e === "denied";
869
+ function G(l) {
870
+ return l === "allowed" || l === "elevate" || l === "denied";
452
871
  }
453
- function ce(e, n) {
454
- if (!j(e))
872
+ function xe(l, n) {
873
+ if (!G(l))
455
874
  return n.showRefused ? { offered: !0, locked: !1, refusal: "not available: the server gave an answer this app does not know", unknown: !0 } : { offered: !1, locked: !1, unknown: !0 };
456
- switch (e) {
875
+ switch (l) {
457
876
  case "allowed":
458
877
  return { offered: !0, locked: !1 };
459
878
  case "elevate":
@@ -462,92 +881,108 @@ function ce(e, n) {
462
881
  return n.showRefused ? { offered: !0, locked: !1, refusal: n.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
463
882
  }
464
883
  }
465
- function H(e, n) {
466
- if (!e) return;
467
- if (typeof e.get == "function") return e.get(n) ?? void 0;
468
- const l = e, a = Object.keys(l).find((s) => s.toLowerCase() === n.toLowerCase());
469
- return a === void 0 ? void 0 : l[a];
884
+ function X(l, n) {
885
+ if (!l) return;
886
+ if (typeof l.get == "function") return l.get(n) ?? void 0;
887
+ const a = l, c = Object.keys(a).find((s) => s.toLowerCase() === n.toLowerCase());
888
+ return c === void 0 ? void 0 : a[c];
470
889
  }
471
- function P(e) {
472
- if (e && typeof e == "object") {
473
- const n = e;
890
+ function Y(l) {
891
+ if (l && typeof l == "object") {
892
+ const n = l;
474
893
  if (typeof n.detail == "string" && n.detail !== "") return n.detail;
475
894
  if (typeof n.title == "string" && n.title !== "") return n.title;
476
895
  }
477
896
  }
478
- function ie(e, n, l, a) {
479
- if (e !== 403) return { kind: "none" };
480
- const s = P(l);
481
- return H(n, "X-Elevation-Required") !== void 0 ? a.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
482
- }
483
- const T = "coolms-kit:reread";
484
- function oe() {
485
- window.dispatchEvent(new Event(T));
486
- }
487
- function ue(e) {
488
- const [n, l] = k(void 0), [a, s] = k(void 0), [m, i] = k(!0), u = w(e);
489
- u.current = e;
490
- const d = w(0), f = K(() => {
491
- const r = ++d.current;
492
- i(!0), u.current().then(
493
- (o) => {
494
- r === d.current && (l(o), s(void 0), i(!1));
897
+ function Ce(l, n, a, c) {
898
+ if (l !== 403) return { kind: "none" };
899
+ const s = Y(a);
900
+ return X(n, "X-Elevation-Required") !== void 0 ? c.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
901
+ }
902
+ const S = "coolms-kit:reread";
903
+ function Ae() {
904
+ window.dispatchEvent(new Event(S));
905
+ }
906
+ function De(l) {
907
+ const [n, a] = M(void 0), [c, s] = M(void 0), [m, t] = M(!0), u = x(l);
908
+ u.current = l;
909
+ const h = x(0), o = H(() => {
910
+ const i = ++h.current;
911
+ t(!0), u.current().then(
912
+ (f) => {
913
+ i === h.current && (a(f), s(void 0), t(!1));
495
914
  },
496
- (o) => {
497
- r === d.current && (s(o), i(!1));
915
+ (f) => {
916
+ i === h.current && (s(f), t(!1));
498
917
  }
499
918
  );
500
919
  }, []);
501
- return x(() => {
502
- f();
503
- const r = () => f();
504
- return window.addEventListener("focus", r), window.addEventListener(T, r), () => {
505
- window.removeEventListener("focus", r), window.removeEventListener(T, r);
920
+ return D(() => {
921
+ o();
922
+ const i = () => o();
923
+ return window.addEventListener("focus", i), window.addEventListener(S, i), () => {
924
+ window.removeEventListener("focus", i), window.removeEventListener(S, i);
506
925
  };
507
- }, [f]), { value: n, error: a, loading: m, reread: f };
926
+ }, [o]), { value: n, error: c, loading: m, reread: o };
508
927
  }
509
- function de(e) {
510
- return e === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
928
+ function Ee(l) {
929
+ return l === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
511
930
  }
512
- const U = "/errors/client-update-required";
513
- function W(e, n) {
514
- const l = e.split(".").map((s) => Number.parseInt(s, 10) || 0), a = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
515
- for (let s = 0; s < Math.max(l.length, a.length); s++) {
516
- const m = l[s] ?? 0, i = a[s] ?? 0;
517
- if (m !== i) return m < i;
931
+ const Q = "/errors/client-update-required";
932
+ function J(l, n) {
933
+ const a = l.split(".").map((s) => Number.parseInt(s, 10) || 0), c = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
934
+ for (let s = 0; s < Math.max(a.length, c.length); s++) {
935
+ const m = a[s] ?? 0, t = c[s] ?? 0;
936
+ if (m !== t) return m < t;
518
937
  }
519
938
  return !1;
520
939
  }
521
- function me(e) {
522
- return e.problemType !== void 0 && e.problemType.endsWith(U) ? !0 : e.minimumVersion !== void 0 && W(e.version, e.minimumVersion);
940
+ function $e(l) {
941
+ return l.problemType !== void 0 && l.problemType.endsWith(Q) ? !0 : l.minimumVersion !== void 0 && J(l.version, l.minimumVersion);
523
942
  }
524
943
  export {
525
- re as Avatar,
944
+ me as AppShell,
945
+ $ as Avatar,
946
+ W as Badge,
526
947
  E as Button,
527
- U as CLIENT_UPDATE_REQUIRED,
528
- O as ConfirmDialog,
529
- se as ContextMenu,
530
- F as EmptyState,
531
- R as ErrorBanner,
532
- ae as List,
533
- q as Loading,
534
- Z as MODAL_CLOSE_MS,
535
- I as Modal,
536
- te as PageHeader,
537
- J as Select,
538
- le as TabStrip,
539
- Y as TextField,
540
- ee as Toast,
541
- ne as ToastRegion,
542
- z as Toggle,
543
- V as initialsOf,
544
- j as isCapability,
545
- me as needsClientUpdate,
546
- ce as offerFor,
547
- de as readConflict,
548
- ie as readRefusal,
549
- P as refusalText,
550
- oe as rereadAll,
551
- ue as useReread,
552
- W as versionBelow
948
+ Q as CLIENT_UPDATE_REQUIRED,
949
+ Ne as CallBar,
950
+ ge as CallPanel,
951
+ _e as ChatBubble,
952
+ be as Composer,
953
+ ce as ConfirmDialog,
954
+ Me as ContextMenu,
955
+ V as EmptyState,
956
+ j as ErrorBanner,
957
+ he as FilterChips,
958
+ de as ICON_NAMES,
959
+ y as Icon,
960
+ ve as IncomingCall,
961
+ ke as List,
962
+ P as Loading,
963
+ R as MODAL_CLOSE_MS,
964
+ pe as MailRow,
965
+ z as Modal,
966
+ ie as PageHeader,
967
+ ue as SearchField,
968
+ ae as Select,
969
+ we as SignInForm,
970
+ ye as SignInLayout,
971
+ fe as SplitPanes,
972
+ oe as TabStrip,
973
+ ne as TextField,
974
+ te as Toast,
975
+ re as ToastRegion,
976
+ se as Toggle,
977
+ q as initialsOf,
978
+ G as isCapability,
979
+ $e as needsClientUpdate,
980
+ xe as offerFor,
981
+ Ee as readConflict,
982
+ Ce as readRefusal,
983
+ Y as refusalText,
984
+ Ae as rereadAll,
985
+ U as tintOf,
986
+ De as useReread,
987
+ J as versionBelow
553
988
  };