@coolms/ui-react 0.1.0-alpha.30 → 0.1.0-alpha.32

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,18 +1,18 @@
1
- import { jsx as e, jsxs as i, Fragment as M } from "react/jsx-runtime";
2
- import { useId as Y, useState as E, useRef as I, useEffect as q, useCallback as _e, useMemo as Ke, useContext as Oe, createContext as Ue, useLayoutEffect as Ne } from "react";
3
- import { createPortal as Ce } from "react-dom";
4
- function de(n, l) {
1
+ import { jsx as e, jsxs as o, Fragment as E } from "react/jsx-runtime";
2
+ import { useId as Q, useState as A, useRef as O, useEffect as J, useCallback as _e, useMemo as je, useContext as qe, createContext as Ye, useLayoutEffect as ve } from "react";
3
+ import { createPortal as De } from "react-dom";
4
+ function ge(n, l) {
5
5
  const t = { ...n };
6
- for (const d of Object.keys(l ?? {})) {
7
- const c = l == null ? void 0 : l[d];
8
- c !== void 0 && (t[d] = c);
6
+ for (const i of Object.keys(l ?? {})) {
7
+ const c = l == null ? void 0 : l[i];
8
+ c !== void 0 && (t[i] = c);
9
9
  }
10
10
  return t;
11
11
  }
12
- function T(...n) {
12
+ function L(...n) {
13
13
  return n.filter(Boolean).join(" ");
14
14
  }
15
- function U({ name: n }) {
15
+ function V({ name: n }) {
16
16
  const l = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
17
17
  switch (n) {
18
18
  case "lock":
@@ -31,34 +31,34 @@ function U({ name: n }) {
31
31
  return /* @__PURE__ */ e("svg", { ...l, 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" }) });
32
32
  }
33
33
  }
34
- function te({
34
+ function ce({
35
35
  variant: n = "secondary",
36
36
  busy: l = !1,
37
37
  busyLabel: t,
38
- locked: d = !1,
38
+ locked: i = !1,
39
39
  lockedReason: c,
40
- icon: r,
41
- disabled: m,
42
- className: s,
43
- children: h,
44
- type: b = "button",
45
- title: o,
46
- ...u
40
+ icon: s,
41
+ disabled: u,
42
+ className: a,
43
+ children: m,
44
+ type: v = "button",
45
+ title: d,
46
+ ...f
47
47
  }) {
48
- const a = !!m || l;
49
- return /* @__PURE__ */ i(
48
+ const r = !!u || l;
49
+ return /* @__PURE__ */ o(
50
50
  "button",
51
51
  {
52
- ...u,
53
- type: b,
54
- className: T("cms-button", `cms-button--${n}`, l && "is-busy", d && "is-locked", s),
55
- disabled: a,
52
+ ...f,
53
+ type: v,
54
+ className: L("cms-button", `cms-button--${n}`, l && "is-busy", i && "is-locked", a),
55
+ disabled: r,
56
56
  "aria-busy": l || void 0,
57
- title: d ? c ?? o : o,
57
+ title: i ? c ?? d : d,
58
58
  children: [
59
- l ? /* @__PURE__ */ e(U, { name: "spinner" }) : d ? /* @__PURE__ */ e(U, { name: "lock" }) : r,
60
- /* @__PURE__ */ e("span", { className: "cms-button__label", children: l && t !== void 0 ? t : h }),
61
- d && c ? /* @__PURE__ */ i("span", { className: "cms-visually-hidden", children: [
59
+ l ? /* @__PURE__ */ e(V, { name: "spinner" }) : i ? /* @__PURE__ */ e(V, { name: "lock" }) : s,
60
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: l && t !== void 0 ? t : m }),
61
+ i && c ? /* @__PURE__ */ o("span", { className: "cms-visually-hidden", children: [
62
62
  ", ",
63
63
  c
64
64
  ] }) : null
@@ -66,395 +66,395 @@ function te({
66
66
  }
67
67
  );
68
68
  }
69
- function Se({ id: n, label: l, help: t, error: d, pinned: c, children: r }) {
70
- return /* @__PURE__ */ i("div", { className: T("cms-field", d != null && "is-invalid"), children: [
69
+ function Le({ id: n, label: l, help: t, error: i, pinned: c, children: s }) {
70
+ return /* @__PURE__ */ o("div", { className: L("cms-field", i != null && "is-invalid"), children: [
71
71
  /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: n, children: l }),
72
- r,
73
- c != null ? /* @__PURE__ */ i("p", { className: "cms-field__pinned", id: `${n}-pinned`, children: [
74
- /* @__PURE__ */ e(U, { name: "lock" }),
72
+ s,
73
+ c != null ? /* @__PURE__ */ o("p", { className: "cms-field__pinned", id: `${n}-pinned`, children: [
74
+ /* @__PURE__ */ e(V, { name: "lock" }),
75
75
  " ",
76
76
  c
77
77
  ] }) : null,
78
- d != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${n}-error`, role: "alert", children: d }) : null,
78
+ i != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${n}-error`, role: "alert", children: i }) : null,
79
79
  t != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${n}-help`, children: t }) : null
80
80
  ] });
81
81
  }
82
- function Ee(n, l) {
82
+ function $e(n, l) {
83
83
  const t = [l.error != null && `${n}-error`, l.pinned != null && `${n}-pinned`, l.help != null && `${n}-help`].filter(Boolean).join(" ");
84
84
  return t === "" ? void 0 : t;
85
85
  }
86
- const ze = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?$/, Ve = /^(\d{2}):(\d{2})(?::(\d{2}))?$/;
87
- function Ze(n, l, t) {
88
- const d = (r, m, s, h = 0, b = 0, o = 0) => {
89
- const u = new Date(Date.UTC(r, m - 1, s, h, b, o));
90
- return u.setUTCFullYear(r), u.getUTCFullYear() === r && u.getUTCMonth() === m - 1 && u.getUTCDate() === s && u.getUTCHours() === h && u.getUTCMinutes() === b && u.getUTCSeconds() === o ? u : null;
91
- }, c = (r) => ({ hour: Number(r[1]), minute: Number(r[2]), second: Number(r[3] ?? 0) });
86
+ const Ge = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?$/, Xe = /^(\d{2}):(\d{2})(?::(\d{2}))?$/;
87
+ function Je(n, l, t) {
88
+ const i = (s, u, a, m = 0, v = 0, d = 0) => {
89
+ const f = new Date(Date.UTC(s, u - 1, a, m, v, d));
90
+ return f.setUTCFullYear(s), f.getUTCFullYear() === s && f.getUTCMonth() === u - 1 && f.getUTCDate() === a && f.getUTCHours() === m && f.getUTCMinutes() === v && f.getUTCSeconds() === d ? f : null;
91
+ }, c = (s) => ({ hour: Number(s[1]), minute: Number(s[2]), second: Number(s[3] ?? 0) });
92
92
  try {
93
93
  if (n === "time") {
94
- const m = l.match(Ve);
95
- if (m === null) return l;
96
- const s = c(m), h = d(2e3, 1, 1, s.hour, s.minute, s.second);
97
- return h === null ? l : new Intl.DateTimeFormat(t, { timeStyle: m[3] === void 0 ? "short" : "medium", timeZone: "UTC" }).format(h);
94
+ const u = l.match(Xe);
95
+ if (u === null) return l;
96
+ const a = c(u), m = i(2e3, 1, 1, a.hour, a.minute, a.second);
97
+ return m === null ? l : new Intl.DateTimeFormat(t, { timeStyle: u[3] === void 0 ? "short" : "medium", timeZone: "UTC" }).format(m);
98
98
  }
99
- const r = l.match(ze);
100
- if (r === null) return l;
101
- if (n === "date" && r[4] === void 0) {
102
- const m = d(Number(r[1]), Number(r[2]), Number(r[3]));
103
- return m === null ? l : new Intl.DateTimeFormat(t, { dateStyle: "medium", timeZone: "UTC" }).format(m);
99
+ const s = l.match(Ge);
100
+ if (s === null) return l;
101
+ if (n === "date" && s[4] === void 0) {
102
+ const u = i(Number(s[1]), Number(s[2]), Number(s[3]));
103
+ return u === null ? l : new Intl.DateTimeFormat(t, { dateStyle: "medium", timeZone: "UTC" }).format(u);
104
104
  }
105
- if (n === "datetime-local" && r[4] !== void 0) {
106
- const m = d(Number(r[1]), Number(r[2]), Number(r[3]), Number(r[4]), Number(r[5]), Number(r[6] ?? 0));
107
- return m === null ? l : new Intl.DateTimeFormat(t, { dateStyle: "medium", timeStyle: r[6] === void 0 ? "short" : "medium", timeZone: "UTC" }).format(m);
105
+ if (n === "datetime-local" && s[4] !== void 0) {
106
+ const u = i(Number(s[1]), Number(s[2]), Number(s[3]), Number(s[4]), Number(s[5]), Number(s[6] ?? 0));
107
+ return u === null ? l : new Intl.DateTimeFormat(t, { dateStyle: "medium", timeStyle: s[6] === void 0 ? "short" : "medium", timeZone: "UTC" }).format(u);
108
108
  }
109
109
  } catch {
110
110
  return l;
111
111
  }
112
112
  return l;
113
113
  }
114
- const We = /* @__PURE__ */ new Set(["date", "time", "datetime-local"]);
115
- function Rn({ label: n, help: l, error: t, disabled: d, readOnly: c, pinned: r, value: m, onChange: s, placeholder: h, type: b = "text", name: o, locale: u, min: a, max: f, step: p, minLength: _, maxLength: N, required: y }) {
116
- const x = Y(), C = c === !0 || r != null, S = C && We.has(b), F = b === "number" && (p === "any" || typeof p == "number" && !Number.isInteger(p));
117
- return /* @__PURE__ */ e(Se, { id: x, label: n, help: l, error: t, pinned: r, children: /* @__PURE__ */ e(
114
+ const Qe = /* @__PURE__ */ new Set(["date", "time", "datetime-local"]);
115
+ function qn({ label: n, help: l, error: t, disabled: i, readOnly: c, pinned: s, value: u, onChange: a, placeholder: m, type: v = "text", name: d, locale: f, min: r, max: h, step: p, minLength: N, maxLength: k, required: y }) {
116
+ const C = Q(), M = c === !0 || s != null, _ = M && Qe.has(v), w = v === "number" && (p === "any" || typeof p == "number" && !Number.isInteger(p));
117
+ return /* @__PURE__ */ e(Le, { id: C, label: n, help: l, error: t, pinned: s, children: /* @__PURE__ */ e(
118
118
  "input",
119
119
  {
120
- id: x,
121
- name: o,
122
- type: S ? "text" : b,
120
+ id: C,
121
+ name: d,
122
+ type: _ ? "text" : v,
123
123
  className: "cms-input",
124
- value: S ? Ze(b, m, u) : m,
125
- ...S ? { "data-value": m } : {},
126
- lang: u,
127
- placeholder: h,
128
- disabled: d,
129
- readOnly: C,
124
+ value: _ ? Je(v, u, f) : u,
125
+ ..._ ? { "data-value": u } : {},
126
+ lang: f,
127
+ placeholder: m,
128
+ disabled: i,
129
+ readOnly: M,
130
130
  required: y,
131
131
  "aria-required": y || void 0,
132
- min: S ? void 0 : a,
133
- max: S ? void 0 : f,
134
- step: S ? void 0 : p,
135
- minLength: _,
136
- maxLength: N,
137
- inputMode: b === "number" ? F ? "decimal" : "numeric" : void 0,
132
+ min: _ ? void 0 : r,
133
+ max: _ ? void 0 : h,
134
+ step: _ ? void 0 : p,
135
+ minLength: N,
136
+ maxLength: k,
137
+ inputMode: v === "number" ? w ? "decimal" : "numeric" : void 0,
138
138
  "aria-invalid": t != null || void 0,
139
- "aria-describedby": Ee(x, { help: l, error: t, pinned: r }),
140
- onChange: (R) => s == null ? void 0 : s(R.target.value)
139
+ "aria-describedby": $e(C, { help: l, error: t, pinned: s }),
140
+ onChange: (T) => a == null ? void 0 : a(T.target.value)
141
141
  }
142
142
  ) });
143
143
  }
144
- function Hn({ label: n, help: l, error: t, disabled: d, readOnly: c, pinned: r, value: m, onChange: s, placeholder: h, rows: b = 4, name: o, locale: u, minLength: a, maxLength: f, required: p }) {
145
- const _ = Y();
146
- return /* @__PURE__ */ e(Se, { id: _, label: n, help: l, error: t, pinned: r, children: /* @__PURE__ */ e(
144
+ function Yn({ label: n, help: l, error: t, disabled: i, readOnly: c, pinned: s, value: u, onChange: a, placeholder: m, rows: v = 4, name: d, locale: f, minLength: r, maxLength: h, required: p }) {
145
+ const N = Q();
146
+ return /* @__PURE__ */ e(Le, { id: N, label: n, help: l, error: t, pinned: s, children: /* @__PURE__ */ e(
147
147
  "textarea",
148
148
  {
149
- id: _,
150
- name: o,
149
+ id: N,
150
+ name: d,
151
151
  className: "cms-input cms-textarea",
152
- rows: b,
153
- value: m,
154
- lang: u,
155
- placeholder: h,
156
- disabled: d,
157
- readOnly: c === !0 || r != null,
152
+ rows: v,
153
+ value: u,
154
+ lang: f,
155
+ placeholder: m,
156
+ disabled: i,
157
+ readOnly: c === !0 || s != null,
158
158
  required: p,
159
159
  "aria-required": p || void 0,
160
- minLength: a,
161
- maxLength: f,
160
+ minLength: r,
161
+ maxLength: h,
162
162
  "aria-invalid": t != null || void 0,
163
- "aria-describedby": Ee(_, { help: l, error: t, pinned: r }),
164
- onChange: (N) => s == null ? void 0 : s(N.target.value)
163
+ "aria-describedby": $e(N, { help: l, error: t, pinned: s }),
164
+ onChange: (k) => a == null ? void 0 : a(k.target.value)
165
165
  }
166
166
  ) });
167
167
  }
168
- function Kn({ label: n, help: l, error: t, disabled: d, readOnly: c, value: r, options: m, onChange: s, emptyText: h = "Nothing to choose from yet.", name: b }) {
169
- const o = Y(), u = m.length === 0;
170
- return /* @__PURE__ */ e(Se, { id: o, label: n, help: u ? h : l, error: t, children: /* @__PURE__ */ e(
168
+ function Gn({ label: n, help: l, error: t, disabled: i, readOnly: c, value: s, options: u, onChange: a, emptyText: m = "Nothing to choose from yet.", name: v }) {
169
+ const d = Q(), f = u.length === 0;
170
+ return /* @__PURE__ */ e(Le, { id: d, label: n, help: f ? m : l, error: t, children: /* @__PURE__ */ e(
171
171
  "select",
172
172
  {
173
- id: o,
174
- name: b,
173
+ id: d,
174
+ name: v,
175
175
  className: "cms-input cms-select",
176
- value: r,
177
- disabled: d || u,
176
+ value: s,
177
+ disabled: i || f,
178
178
  "aria-readonly": c || void 0,
179
179
  "aria-invalid": t != null || void 0,
180
- "aria-describedby": Ee(o, { help: u ? h : l, error: t }),
181
- onChange: (a) => {
182
- c || s == null || s(a.target.value);
180
+ "aria-describedby": $e(d, { help: f ? m : l, error: t }),
181
+ onChange: (r) => {
182
+ c || a == null || a(r.target.value);
183
183
  },
184
- children: m.map((a) => /* @__PURE__ */ e("option", { value: a.value, disabled: c && a.value !== r, children: a.label }, a.value))
184
+ children: u.map((r) => /* @__PURE__ */ e("option", { value: r.value, disabled: c && r.value !== s, children: r.label }, r.value))
185
185
  }
186
186
  ) });
187
187
  }
188
- function On({ label: n, checked: l, onChange: t, disabled: d, readOnly: c, help: r }) {
189
- const m = Y();
190
- return /* @__PURE__ */ i("div", { className: "cms-toggle-row", children: [
188
+ function Xn({ label: n, checked: l, onChange: t, disabled: i, readOnly: c, help: s }) {
189
+ const u = Q();
190
+ return /* @__PURE__ */ o("div", { className: "cms-toggle-row", children: [
191
191
  /* @__PURE__ */ e(
192
192
  "button",
193
193
  {
194
- id: m,
194
+ id: u,
195
195
  type: "button",
196
196
  role: "switch",
197
- className: T("cms-toggle", l && "is-on"),
197
+ className: L("cms-toggle", l && "is-on"),
198
198
  "aria-checked": l,
199
199
  "aria-readonly": c || void 0,
200
- "aria-describedby": r != null ? `${m}-help` : void 0,
201
- disabled: d,
200
+ "aria-describedby": s != null ? `${u}-help` : void 0,
201
+ disabled: i,
202
202
  onClick: () => {
203
203
  c || t == null || t(!l);
204
204
  },
205
205
  children: /* @__PURE__ */ e("span", { className: "cms-toggle__thumb" })
206
206
  }
207
207
  ),
208
- /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: m, children: n }),
209
- r != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${m}-help`, children: r }) : null
208
+ /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: u, children: n }),
209
+ s != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${u}-help`, children: s }) : null
210
210
  ] });
211
211
  }
212
- const je = 150;
213
- function Be({ open: n, title: l, onClose: t, dirty: d = !1, onDirtyClose: c, children: r, footer: m, closeLabel: s = "Close", initialFocus: h, className: b }) {
214
- const [o, u] = E(n), [a, f] = E(!1), p = I(null), _ = I(null), N = Y();
215
- if (q(() => {
212
+ const en = 150;
213
+ function ze({ open: n, title: l, onClose: t, dirty: i = !1, onDirtyClose: c, children: s, footer: u, closeLabel: a = "Close", initialFocus: m, className: v }) {
214
+ const [d, f] = A(n), [r, h] = A(!1), p = O(null), N = O(null), k = Q();
215
+ if (J(() => {
216
216
  if (n) {
217
- _.current = document.activeElement, u(!0), f(!1);
217
+ N.current = document.activeElement, f(!0), h(!1);
218
218
  return;
219
219
  }
220
- if (!o) return;
221
- f(!0);
222
- const x = window.setTimeout(() => {
223
- var C, S;
224
- u(!1), f(!1), (S = (C = _.current) == null ? void 0 : C.focus) == null || S.call(C);
225
- }, je);
226
- return () => window.clearTimeout(x);
227
- }, [n, o]), q(() => {
228
- var x, C;
229
- if (n && o) {
230
- const S = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
231
- (C = (h == null ? void 0 : h.current) ?? ((x = p.current) == null ? void 0 : x.querySelector(`.cms-modal__body :is(${S}), .cms-modal__foot :is(${S})`)) ?? p.current) == null || C.focus();
220
+ if (!d) return;
221
+ h(!0);
222
+ const C = window.setTimeout(() => {
223
+ var M, _;
224
+ f(!1), h(!1), (_ = (M = N.current) == null ? void 0 : M.focus) == null || _.call(M);
225
+ }, en);
226
+ return () => window.clearTimeout(C);
227
+ }, [n, d]), J(() => {
228
+ var C, M;
229
+ if (n && d) {
230
+ const _ = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
231
+ (M = (m == null ? void 0 : m.current) ?? ((C = p.current) == null ? void 0 : C.querySelector(`.cms-modal__body :is(${_}), .cms-modal__foot :is(${_})`)) ?? p.current) == null || M.focus();
232
232
  }
233
- }, [n, o, h]), !o) return null;
233
+ }, [n, d, m]), !d) return null;
234
234
  const y = () => {
235
- d ? c == null || c() : t();
235
+ i ? c == null || c() : t();
236
236
  };
237
- return Ce(
238
- /* @__PURE__ */ e("div", { className: T("cms-modal-scrim", a && "is-closing"), onMouseDown: (x) => {
239
- x.target === x.currentTarget && y();
240
- }, children: /* @__PURE__ */ i(
237
+ return De(
238
+ /* @__PURE__ */ e("div", { className: L("cms-modal-scrim", r && "is-closing"), onMouseDown: (C) => {
239
+ C.target === C.currentTarget && y();
240
+ }, children: /* @__PURE__ */ o(
241
241
  "div",
242
242
  {
243
243
  ref: p,
244
- className: T("cms-modal", b, a && "is-closing", d && "is-dirty"),
244
+ className: L("cms-modal", v, r && "is-closing", i && "is-dirty"),
245
245
  role: "dialog",
246
246
  "aria-modal": "true",
247
- "aria-labelledby": N,
247
+ "aria-labelledby": k,
248
248
  tabIndex: -1,
249
- onKeyDown: (x) => {
250
- var C;
251
- if (x.key === "Escape")
252
- x.stopPropagation(), y();
253
- else if (x.key === "Tab") {
254
- const S = (C = p.current) == null ? void 0 : C.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
255
- if (!S || S.length === 0) return;
256
- const F = S[0], R = S[S.length - 1];
257
- x.shiftKey && document.activeElement === F ? (x.preventDefault(), R.focus()) : !x.shiftKey && document.activeElement === R && (x.preventDefault(), F.focus());
249
+ onKeyDown: (C) => {
250
+ var M;
251
+ if (C.key === "Escape")
252
+ C.stopPropagation(), y();
253
+ else if (C.key === "Tab") {
254
+ const _ = (M = p.current) == null ? void 0 : M.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
255
+ if (!_ || _.length === 0) return;
256
+ const w = _[0], T = _[_.length - 1];
257
+ C.shiftKey && document.activeElement === w ? (C.preventDefault(), T.focus()) : !C.shiftKey && document.activeElement === T && (C.preventDefault(), w.focus());
258
258
  }
259
259
  },
260
260
  children: [
261
- /* @__PURE__ */ i("header", { className: "cms-modal__head", children: [
262
- /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: N, children: l }),
263
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s, onClick: y, children: /* @__PURE__ */ e(U, { name: "close" }) })
261
+ /* @__PURE__ */ o("header", { className: "cms-modal__head", children: [
262
+ /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: k, children: l }),
263
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": a, onClick: y, children: /* @__PURE__ */ e(V, { name: "close" }) })
264
264
  ] }),
265
- /* @__PURE__ */ e("div", { className: "cms-modal__body", children: r }),
266
- m != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: m }) : null
265
+ /* @__PURE__ */ e("div", { className: "cms-modal__body", children: s }),
266
+ u != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: u }) : null
267
267
  ]
268
268
  }
269
269
  ) }),
270
270
  document.body
271
271
  );
272
272
  }
273
- function Un({ open: n, title: l, message: t, kind: d = "default", confirmLabel: c, cancelLabel: r, closeLabel: m, onConfirm: s, onCancel: h }) {
274
- const b = d === "discard-changes";
273
+ function Jn({ open: n, title: l, message: t, kind: i = "default", confirmLabel: c, cancelLabel: s, closeLabel: u, onConfirm: a, onCancel: m }) {
274
+ const v = i === "discard-changes";
275
275
  return /* @__PURE__ */ e(
276
- Be,
276
+ ze,
277
277
  {
278
278
  open: n,
279
279
  title: l,
280
- onClose: h,
281
- ...m === void 0 ? {} : { closeLabel: m },
282
- footer: /* @__PURE__ */ i(M, { children: [
283
- /* @__PURE__ */ e(te, { onClick: h, children: r ?? (b ? "Keep editing" : "Cancel") }),
284
- /* @__PURE__ */ e(te, { variant: d === "default" ? "primary" : "danger", onClick: s, children: c ?? (b ? "Discard changes" : "Confirm") })
280
+ onClose: m,
281
+ ...u === void 0 ? {} : { closeLabel: u },
282
+ footer: /* @__PURE__ */ o(E, { children: [
283
+ /* @__PURE__ */ e(ce, { onClick: m, children: s ?? (v ? "Keep editing" : "Cancel") }),
284
+ /* @__PURE__ */ e(ce, { variant: i === "default" ? "primary" : "danger", onClick: a, children: c ?? (v ? "Discard changes" : "Confirm") })
285
285
  ] }),
286
- children: d !== "default" ? /* @__PURE__ */ i("p", { className: "cms-confirm__warning", children: [
287
- /* @__PURE__ */ e(U, { name: "warning" }),
286
+ children: i !== "default" ? /* @__PURE__ */ o("p", { className: "cms-confirm__warning", children: [
287
+ /* @__PURE__ */ e(V, { name: "warning" }),
288
288
  " ",
289
289
  t
290
290
  ] }) : /* @__PURE__ */ e("p", { children: t })
291
291
  }
292
292
  );
293
293
  }
294
- function zn({ kind: n, message: l, action: t, onDismiss: d, dismissLabel: c = "Dismiss" }) {
295
- return /* @__PURE__ */ i("div", { className: T("cms-toast", `cms-toast--${n}`), role: n === "error" ? "alert" : "status", children: [
296
- /* @__PURE__ */ e(U, { name: n === "success" ? "check" : n === "error" ? "warning" : "info" }),
294
+ function Qn({ kind: n, message: l, action: t, onDismiss: i, dismissLabel: c = "Dismiss" }) {
295
+ return /* @__PURE__ */ o("div", { className: L("cms-toast", `cms-toast--${n}`), role: n === "error" ? "alert" : "status", children: [
296
+ /* @__PURE__ */ e(V, { name: n === "success" ? "check" : n === "error" ? "warning" : "info" }),
297
297
  /* @__PURE__ */ e("span", { className: "cms-toast__message", children: l }),
298
- t ? /* @__PURE__ */ e(te, { className: "cms-toast__action", onClick: t.onAction, children: t.label }) : null,
299
- d ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": c, onClick: d, children: /* @__PURE__ */ e(U, { name: "close" }) }) : null
298
+ t ? /* @__PURE__ */ e(ce, { className: "cms-toast__action", onClick: t.onAction, children: t.label }) : null,
299
+ i ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": c, onClick: i, children: /* @__PURE__ */ e(V, { name: "close" }) }) : null
300
300
  ] });
301
301
  }
302
- function Vn({ children: n }) {
302
+ function el({ children: n }) {
303
303
  return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: n });
304
304
  }
305
- function qe({ what: n, layout: l = "inline" }) {
306
- return /* @__PURE__ */ i("div", { className: T("cms-loading", `cms-loading--${l}`), role: "status", "aria-live": "polite", children: [
307
- /* @__PURE__ */ e(U, { name: "spinner" }),
305
+ function nn({ what: n, layout: l = "inline" }) {
306
+ return /* @__PURE__ */ o("div", { className: L("cms-loading", `cms-loading--${l}`), role: "status", "aria-live": "polite", children: [
307
+ /* @__PURE__ */ e(V, { name: "spinner" }),
308
308
  /* @__PURE__ */ e("span", { children: n })
309
309
  ] });
310
310
  }
311
- function Ye({ title: n, hint: l, action: t }) {
312
- return /* @__PURE__ */ i("div", { className: "cms-empty", children: [
311
+ function ln({ title: n, hint: l, action: t }) {
312
+ return /* @__PURE__ */ o("div", { className: "cms-empty", children: [
313
313
  /* @__PURE__ */ e("p", { className: "cms-empty__title", children: n }),
314
314
  l != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: l }) : null,
315
315
  t != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: t }) : null
316
316
  ] });
317
317
  }
318
- function Ge({ message: n, onRetry: l, retryLabel: t = "Try again" }) {
319
- return /* @__PURE__ */ i("div", { className: "cms-error-banner", role: "alert", children: [
320
- /* @__PURE__ */ e(U, { name: "warning" }),
318
+ function tn({ message: n, onRetry: l, retryLabel: t = "Try again" }) {
319
+ return /* @__PURE__ */ o("div", { className: "cms-error-banner", role: "alert", children: [
320
+ /* @__PURE__ */ e(V, { name: "warning" }),
321
321
  /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: n }),
322
- l ? /* @__PURE__ */ e(te, { onClick: l, children: t }) : null
322
+ l ? /* @__PURE__ */ e(ce, { onClick: l, children: t }) : null
323
323
  ] });
324
324
  }
325
- const Fe = {
326
- mail: /* @__PURE__ */ i(M, { children: [
325
+ const Ke = {
326
+ mail: /* @__PURE__ */ o(E, { children: [
327
327
  /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
328
328
  /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
329
329
  ] }),
330
330
  // A gear: a ring with eight short teeth, the hole in its middle.
331
- settings: /* @__PURE__ */ i(M, { children: [
331
+ settings: /* @__PURE__ */ o(E, { children: [
332
332
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" }),
333
333
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "7" }),
334
334
  /* @__PURE__ */ e("path", { d: "M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9 7 7M17 17l2.1 2.1M4.9 19.1 7 17M17 7l2.1-2.1" })
335
335
  ] }),
336
336
  // The envelope with its flap open above it: a message read, or the message itself again.
337
- "mail-open": /* @__PURE__ */ i(M, { children: [
337
+ "mail-open": /* @__PURE__ */ o(E, { children: [
338
338
  /* @__PURE__ */ e("path", { d: "M3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9" }),
339
339
  /* @__PURE__ */ e("path", { d: "m3 10 9-6 9 6" }),
340
340
  /* @__PURE__ */ e("path", { d: "m3 10 9 6 9-6" })
341
341
  ] }),
342
342
  // A clipboard: copy what is shown.
343
- copy: /* @__PURE__ */ i(M, { children: [
343
+ copy: /* @__PURE__ */ o(E, { children: [
344
344
  /* @__PURE__ */ e("rect", { x: "6", y: "4", width: "12", height: "17", rx: "2" }),
345
345
  /* @__PURE__ */ e("path", { d: "M9 4V3h6v1" }),
346
346
  /* @__PURE__ */ e("path", { d: "M9 10h6M9 14h6M9 18h3" })
347
347
  ] }),
348
348
  chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
349
349
  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" }),
350
- calendar: /* @__PURE__ */ i(M, { children: [
350
+ calendar: /* @__PURE__ */ o(E, { children: [
351
351
  /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
352
352
  /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
353
353
  ] }),
354
- file: /* @__PURE__ */ i(M, { children: [
354
+ file: /* @__PURE__ */ o(E, { children: [
355
355
  /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
356
356
  /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
357
357
  ] }),
358
358
  // The file, with code's angle brackets in place of its lines: a message's source.
359
- "file-code": /* @__PURE__ */ i(M, { children: [
359
+ "file-code": /* @__PURE__ */ o(E, { children: [
360
360
  /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
361
361
  /* @__PURE__ */ e("path", { d: "M14 3v6h6" }),
362
362
  /* @__PURE__ */ e("path", { d: "m10 12-2 2.5 2 2.5M14 12l2 2.5-2 2.5" })
363
363
  ] }),
364
- image: /* @__PURE__ */ i(M, { children: [
364
+ image: /* @__PURE__ */ o(E, { children: [
365
365
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
366
366
  /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
367
367
  /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
368
368
  ] }),
369
- search: /* @__PURE__ */ i(M, { children: [
369
+ search: /* @__PURE__ */ o(E, { children: [
370
370
  /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
371
371
  /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
372
372
  ] }),
373
- bell: /* @__PURE__ */ i(M, { children: [
373
+ bell: /* @__PURE__ */ o(E, { children: [
374
374
  /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
375
375
  /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
376
376
  ] }),
377
- pencil: /* @__PURE__ */ i(M, { children: [
377
+ pencil: /* @__PURE__ */ o(E, { children: [
378
378
  /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
379
379
  /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
380
380
  ] }),
381
- download: /* @__PURE__ */ i(M, { children: [
381
+ download: /* @__PURE__ */ o(E, { children: [
382
382
  /* @__PURE__ */ e("path", { d: "M12 4v11" }),
383
383
  /* @__PURE__ */ e("path", { d: "m7 11 5 5 5-5" }),
384
384
  /* @__PURE__ */ e("path", { d: "M4 20h16" })
385
385
  ] }),
386
386
  // Download's arrow turned up, from the line: a file sent up.
387
- upload: /* @__PURE__ */ i(M, { children: [
387
+ upload: /* @__PURE__ */ o(E, { children: [
388
388
  /* @__PURE__ */ e("path", { d: "M12 20V9" }),
389
389
  /* @__PURE__ */ e("path", { d: "m7 13 5-5 5 5" }),
390
390
  /* @__PURE__ */ e("path", { d: "M4 4h16" })
391
391
  ] }),
392
- print: /* @__PURE__ */ i(M, { children: [
392
+ print: /* @__PURE__ */ o(E, { children: [
393
393
  /* @__PURE__ */ e("path", { d: "M7 8V4h10v4" }),
394
394
  /* @__PURE__ */ e("rect", { x: "3", y: "8", width: "18", height: "8", rx: "2" }),
395
395
  /* @__PURE__ */ e("path", { d: "M7 14h10v6H7Z" })
396
396
  ] }),
397
- "open-separately": /* @__PURE__ */ i(M, { children: [
397
+ "open-separately": /* @__PURE__ */ o(E, { children: [
398
398
  /* @__PURE__ */ e("path", { d: "M14 4h6v6" }),
399
399
  /* @__PURE__ */ e("path", { d: "m20 4-9 9" }),
400
400
  /* @__PURE__ */ e("path", { d: "M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5" })
401
401
  ] }),
402
402
  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" }),
403
- send: /* @__PURE__ */ i(M, { children: [
403
+ send: /* @__PURE__ */ o(E, { children: [
404
404
  /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
405
405
  /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
406
406
  ] }),
407
- inbox: /* @__PURE__ */ i(M, { children: [
407
+ inbox: /* @__PURE__ */ o(E, { children: [
408
408
  /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
409
409
  /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
410
410
  ] }),
411
- archive: /* @__PURE__ */ i(M, { children: [
411
+ archive: /* @__PURE__ */ o(E, { children: [
412
412
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
413
413
  /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
414
414
  ] }),
415
- trash: /* @__PURE__ */ i(M, { children: [
415
+ trash: /* @__PURE__ */ o(E, { children: [
416
416
  /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
417
417
  /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
418
418
  ] }),
419
419
  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" }),
420
- mic: /* @__PURE__ */ i(M, { children: [
420
+ mic: /* @__PURE__ */ o(E, { children: [
421
421
  /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
422
422
  /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
423
423
  ] }),
424
- speaker: /* @__PURE__ */ i(M, { children: [
424
+ speaker: /* @__PURE__ */ o(E, { children: [
425
425
  /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
426
426
  /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
427
427
  ] }),
428
- "user-plus": /* @__PURE__ */ i(M, { children: [
428
+ "user-plus": /* @__PURE__ */ o(E, { children: [
429
429
  /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
430
430
  /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
431
431
  ] }),
432
432
  // A person, nothing more: one whose account is gone.
433
- user: /* @__PURE__ */ i(M, { children: [
433
+ user: /* @__PURE__ */ o(E, { children: [
434
434
  /* @__PURE__ */ e("circle", { cx: "12", cy: "8", r: "4" }),
435
435
  /* @__PURE__ */ e("path", { d: "M4 21a8 8 0 0 1 16 0" })
436
436
  ] }),
437
437
  // A person with a tick: someone allowed.
438
- "user-check": /* @__PURE__ */ i(M, { children: [
438
+ "user-check": /* @__PURE__ */ o(E, { children: [
439
439
  /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
440
440
  /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M16 11l2 2 4-4" })
441
441
  ] }),
442
442
  // A person with a cross: someone no longer allowed.
443
- "user-x": /* @__PURE__ */ i(M, { children: [
443
+ "user-x": /* @__PURE__ */ o(E, { children: [
444
444
  /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
445
445
  /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M17 8l4 4M21 8l-4 4" })
446
446
  ] }),
447
447
  // Two people: the members of a group.
448
- users: /* @__PURE__ */ i(M, { children: [
448
+ users: /* @__PURE__ */ o(E, { children: [
449
449
  /* @__PURE__ */ e("circle", { cx: "9", cy: "8", r: "3.5" }),
450
450
  /* @__PURE__ */ e("path", { d: "M2.5 20a6.5 6.5 0 0 1 13 0M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14a6.5 6.5 0 0 1 3.5 6" })
451
451
  ] }),
452
452
  "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" }),
453
- video: /* @__PURE__ */ i(M, { children: [
453
+ video: /* @__PURE__ */ o(E, { children: [
454
454
  /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
455
455
  /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
456
456
  ] }),
457
- info: /* @__PURE__ */ i(M, { children: [
457
+ info: /* @__PURE__ */ o(E, { children: [
458
458
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
459
459
  /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
460
460
  ] }),
@@ -463,17 +463,17 @@ const Fe = {
463
463
  plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
464
464
  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" }),
465
465
  // The folder with a plus inside: a new folder.
466
- "folder-plus": /* @__PURE__ */ i(M, { children: [
466
+ "folder-plus": /* @__PURE__ */ o(E, { children: [
467
467
  /* @__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" }),
468
468
  /* @__PURE__ */ e("path", { d: "M12 10.5v6M9 13.5h6" })
469
469
  ] }),
470
470
  // The folder with a cross inside: a folder removed.
471
- "folder-x": /* @__PURE__ */ i(M, { children: [
471
+ "folder-x": /* @__PURE__ */ o(E, { children: [
472
472
  /* @__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" }),
473
473
  /* @__PURE__ */ e("path", { d: "m9.5 11 5 5M14.5 11l-5 5" })
474
474
  ] }),
475
475
  check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
476
- server: /* @__PURE__ */ i(M, { children: [
476
+ server: /* @__PURE__ */ o(E, { children: [
477
477
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
478
478
  /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
479
479
  /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
@@ -483,9 +483,11 @@ const Fe = {
483
483
  forward: /* @__PURE__ */ e("path", { d: "m14 8 6 5-6 5M20 13H9a5 5 0 0 0-5 5" }),
484
484
  refresh: /* @__PURE__ */ e("path", { d: "M20 11a8 8 0 1 0-2.3 5.7M20 5v6h-6" }),
485
485
  more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" }),
486
+ // A number sign: a channel, by its name.
487
+ hash: /* @__PURE__ */ e("path", { d: "M10 4 8 20M16 4l-2 16M5 9h15M4 15h15" }),
486
488
  important: /* @__PURE__ */ e("path", { d: "M4 6h11l5 6-5 6H4l4-6-4-6Z" })
487
489
  };
488
- function A({ name: n, size: l = 20, label: t }) {
490
+ function D({ name: n, size: l = 20, label: t }) {
489
491
  return /* @__PURE__ */ e(
490
492
  "svg",
491
493
  {
@@ -500,11 +502,11 @@ function A({ name: n, size: l = 20, label: t }) {
500
502
  strokeLinejoin: "round",
501
503
  focusable: !1,
502
504
  ...t ? { role: "img", "aria-label": t } : { "aria-hidden": !0 },
503
- children: Fe[n]
505
+ children: Ke[n]
504
506
  }
505
507
  );
506
508
  }
507
- const Zn = Object.keys(Fe), Te = {
509
+ const nl = Object.keys(Ke), Be = {
508
510
  reply: "reply",
509
511
  "reply-all": "reply",
510
512
  forward: "forward",
@@ -543,189 +545,190 @@ const Zn = Object.keys(Fe), Te = {
543
545
  "folder2-open": "folder",
544
546
  "chat-dots": "chat",
545
547
  images: "image",
546
- paperclip: "paperclip"
548
+ paperclip: "paperclip",
549
+ hash: "hash"
547
550
  };
548
- function ce(n) {
549
- return Object.prototype.hasOwnProperty.call(Te, n) ? Te[n] : null;
551
+ function me(n) {
552
+ return Object.prototype.hasOwnProperty.call(Be, n) ? Be[n] : null;
550
553
  }
551
- function Xe() {
554
+ function an() {
552
555
  try {
553
556
  return process.env.NODE_ENV !== "production";
554
557
  } catch {
555
558
  return !1;
556
559
  }
557
560
  }
558
- const Le = /* @__PURE__ */ new Set();
559
- function Je({ name: n, size: l = 18 }) {
561
+ const Re = /* @__PURE__ */ new Set();
562
+ function sn({ name: n, size: l = 18 }) {
560
563
  if (n === "") return null;
561
- const t = ce(n);
562
- return t !== null ? /* @__PURE__ */ e(A, { name: t, size: l }) : (!Le.has(n) && Xe() && (Le.add(n), console.warn(`@coolms/ui-react: no icon for the server's icon name "${n}"; its space is kept empty`)), /* @__PURE__ */ e("span", { className: "cms-icon cms-icon--blank", style: { width: l, height: l }, "aria-hidden": "true", "data-icon-name": n }));
564
+ const t = me(n);
565
+ return t !== null ? /* @__PURE__ */ e(D, { name: t, size: l }) : (!Re.has(n) && an() && (Re.add(n), console.warn(`@coolms/ui-react: no icon for the server's icon name "${n}"; its space is kept empty`)), /* @__PURE__ */ e("span", { className: "cms-icon cms-icon--blank", style: { width: l, height: l }, "aria-hidden": "true", "data-icon-name": n }));
563
566
  }
564
- const ke = 300;
565
- function Qe() {
566
- if (typeof window > "u" || typeof getComputedStyle != "function") return ke;
567
+ const Ce = 300;
568
+ function rn() {
569
+ if (typeof window > "u" || typeof getComputedStyle != "function") return Ce;
567
570
  const n = getComputedStyle(document.documentElement).getPropertyValue("--cms-state-delay").trim(), l = n.endsWith("ms") ? Number.parseFloat(n) : n.endsWith("s") ? Number.parseFloat(n) * 1e3 : Number.NaN;
568
- return Number.isFinite(l) && l >= 0 ? l : ke;
571
+ return Number.isFinite(l) && l >= 0 ? l : Ce;
569
572
  }
570
- function en() {
571
- return /* @__PURE__ */ i("svg", { className: "cms-state__spinner", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
573
+ function cn() {
574
+ return /* @__PURE__ */ o("svg", { className: "cms-state__spinner", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
572
575
  /* @__PURE__ */ e("circle", { className: "cms-state__track", cx: "12", cy: "12", r: "10", fill: "none" }),
573
576
  /* @__PURE__ */ e("circle", { className: "cms-state__arc", cx: "12", cy: "12", r: "10", fill: "none", pathLength: "100", strokeDasharray: "28 72" })
574
577
  ] });
575
578
  }
576
- function le({ kind: n, title: l, description: t, action: d, placement: c = "block", icon: r }) {
577
- const [m, s] = E(n !== "loading");
578
- return q(() => {
579
+ function ie({ kind: n, title: l, description: t, action: i, placement: c = "block", icon: s }) {
580
+ const [u, a] = A(n !== "loading");
581
+ return J(() => {
579
582
  if (n !== "loading") {
580
- s(!0);
583
+ a(!0);
581
584
  return;
582
585
  }
583
- s(!1);
584
- const h = window.setTimeout(() => s(!0), Qe());
585
- return () => window.clearTimeout(h);
586
- }, [n]), /* @__PURE__ */ i(
586
+ a(!1);
587
+ const m = window.setTimeout(() => a(!0), rn());
588
+ return () => window.clearTimeout(m);
589
+ }, [n]), /* @__PURE__ */ o(
587
590
  "div",
588
591
  {
589
- className: T("cms-state", `cms-state--${n}`, `cms-state--${c}`, !m && "is-waiting"),
592
+ className: L("cms-state", `cms-state--${n}`, `cms-state--${c}`, !u && "is-waiting"),
590
593
  role: "status",
591
594
  "aria-live": "polite",
592
595
  "data-kind": n,
593
596
  children: [
594
- n === "loading" ? /* @__PURE__ */ e(en, {}) : null,
595
- n === "error" || n === "denied" ? /* @__PURE__ */ e(U, { name: n === "error" ? "warning" : "lock" }) : null,
596
- n === "empty" && r !== void 0 && ce(r) !== null ? /* @__PURE__ */ e("span", { className: "cms-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(Je, { name: r, size: c === "page" ? 32 : 24 }) }) : null,
597
- /* @__PURE__ */ i("span", { className: "cms-state__text", children: [
597
+ n === "loading" ? /* @__PURE__ */ e(cn, {}) : null,
598
+ n === "error" || n === "denied" ? /* @__PURE__ */ e(V, { name: n === "error" ? "warning" : "lock" }) : null,
599
+ n === "empty" && s !== void 0 && me(s) !== null ? /* @__PURE__ */ e("span", { className: "cms-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(sn, { name: s, size: c === "page" ? 32 : 24 }) }) : null,
600
+ /* @__PURE__ */ o("span", { className: "cms-state__text", children: [
598
601
  /* @__PURE__ */ e("span", { className: "cms-state__title", children: l }),
599
602
  t !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-state__description", children: t }) : null
600
603
  ] }),
601
- d !== void 0 && n !== "denied" ? /* @__PURE__ */ e(te, { className: "cms-state__action", onClick: d.onAction, children: d.label }) : null
604
+ i !== void 0 && n !== "denied" ? /* @__PURE__ */ e(ce, { className: "cms-state__action", onClick: i.onAction, children: i.label }) : null
602
605
  ]
603
606
  }
604
607
  );
605
608
  }
606
- const nn = 'input, select, textarea, button:not([disabled]), iframe, [href], [tabindex]:not([tabindex="-1"])', ln = 60;
607
- function tn(n) {
609
+ const on = 'input, select, textarea, button:not([disabled]), iframe, [href], [tabindex]:not([tabindex="-1"])', dn = 60;
610
+ function un(n) {
608
611
  return n instanceof Element && n.closest('input, select, textarea, [contenteditable="true"], [data-viewer-keys]') !== null;
609
612
  }
610
- function an(n) {
613
+ function mn(n) {
611
614
  return n instanceof Element && n.closest("[data-viewer-gestures]") !== null;
612
615
  }
613
- function sn(n) {
616
+ function hn(n) {
614
617
  return n.getClientRects().length > 0;
615
618
  }
616
- function Wn(n) {
617
- const { name: l, badge: t, closeLabel: d, onClose: c, actions: r = [], moreLabel: m = "More", edit: s, editing: h, state: b, siblings: o, bar: u, thumbnails: a, strip: f, onZoom: p, children: _ } = n, N = I(null), y = I(null), x = Y(), [C, S] = E(!1), F = I(null);
618
- q(() => {
619
- var Z;
620
- const w = document.activeElement, B = document.body.style.overflow;
621
- return document.body.style.overflow = "hidden", (Z = y.current) == null || Z.focus(), () => {
622
- var z;
623
- document.body.style.overflow = B, (z = w == null ? void 0 : w.focus) == null || z.call(w);
619
+ function ll(n) {
620
+ const { name: l, badge: t, closeLabel: i, onClose: c, actions: s = [], moreLabel: u = "More", edit: a, editing: m, state: v, siblings: d, bar: f, thumbnails: r, strip: h, onZoom: p, children: N } = n, k = O(null), y = O(null), C = Q(), [M, _] = A(!1), w = O(null);
621
+ J(() => {
622
+ var z;
623
+ const x = document.activeElement, $ = document.body.style.overflow;
624
+ return document.body.style.overflow = "hidden", (z = y.current) == null || z.focus(), () => {
625
+ var W;
626
+ document.body.style.overflow = $, (W = x == null ? void 0 : x.focus) == null || W.call(x);
624
627
  };
625
628
  }, []);
626
- const R = () => {
627
- h != null && h.dirty ? h.onDirtyClose() : c();
628
- }, Q = (w) => {
629
- const B = w.touches.length === 1 ? w.touches[0] : void 0;
630
- F.current = B === void 0 || h !== void 0 || an(w.target) ? null : { x: B.clientX, y: B.clientY };
631
- }, G = (w) => {
632
- var H, W;
633
- const B = F.current, Z = w.changedTouches[0];
634
- if (F.current = null, B === null || Z === void 0) return;
635
- const z = Z.clientX - B.x;
636
- Math.abs(z) < ln || Math.abs(z) < Math.abs(Z.clientY - B.y) || (z > 0 ? (H = o == null ? void 0 : o.onPrevious) == null || H.call(o) : (W = o == null ? void 0 : o.onNext) == null || W.call(o));
629
+ const T = () => {
630
+ m != null && m.dirty ? m.onDirtyClose() : c();
631
+ }, U = (x) => {
632
+ const $ = x.touches.length === 1 ? x.touches[0] : void 0;
633
+ w.current = $ === void 0 || m !== void 0 || mn(x.target) ? null : { x: $.clientX, y: $.clientY };
634
+ }, B = (x) => {
635
+ var H, Y;
636
+ const $ = w.current, z = x.changedTouches[0];
637
+ if (w.current = null, $ === null || z === void 0) return;
638
+ const W = z.clientX - $.x;
639
+ Math.abs(W) < dn || Math.abs(W) < Math.abs(z.clientY - $.y) || (W > 0 ? (H = d == null ? void 0 : d.onPrevious) == null || H.call(d) : (Y = d == null ? void 0 : d.onNext) == null || Y.call(d));
637
640
  };
638
- return Ce(
639
- /* @__PURE__ */ i(
641
+ return De(
642
+ /* @__PURE__ */ o(
640
643
  "div",
641
644
  {
642
- ref: N,
643
- className: T("cms-viewer", h !== void 0 && "is-editing"),
645
+ ref: k,
646
+ className: L("cms-viewer", m !== void 0 && "is-editing"),
644
647
  role: "dialog",
645
648
  "aria-modal": "true",
646
- "aria-labelledby": x,
649
+ "aria-labelledby": C,
647
650
  tabIndex: -1,
648
- onKeyDown: (w) => {
649
- var B, Z, z;
650
- if (w.key === "Escape") {
651
- if (h !== void 0) return;
652
- w.stopPropagation(), C ? S(!1) : c();
653
- } else if (w.key === "Tab") {
654
- const H = Array.from(((B = N.current) == null ? void 0 : B.querySelectorAll(nn)) ?? []).filter(sn);
651
+ onKeyDown: (x) => {
652
+ var $, z, W;
653
+ if (x.key === "Escape") {
654
+ if (m !== void 0) return;
655
+ x.stopPropagation(), M ? _(!1) : c();
656
+ } else if (x.key === "Tab") {
657
+ const H = Array.from((($ = k.current) == null ? void 0 : $.querySelectorAll(on)) ?? []).filter(hn);
655
658
  if (H.length === 0) return;
656
- const W = H[0], j = H[H.length - 1];
657
- w.shiftKey && document.activeElement === W ? (w.preventDefault(), j.focus()) : !w.shiftKey && document.activeElement === j && (w.preventDefault(), W.focus());
658
- } else h === void 0 && !tn(w.target) && !w.ctrlKey && !w.metaKey && !w.altKey && (w.key === "ArrowLeft" ? (Z = o == null ? void 0 : o.onPrevious) == null || Z.call(o) : w.key === "ArrowRight" ? (z = o == null ? void 0 : o.onNext) == null || z.call(o) : w.key === "+" || w.key === "=" ? p == null || p("in") : w.key === "-" ? p == null || p("out") : w.key === "0" && (p == null || p("reset")));
659
+ const Y = H[0], X = H[H.length - 1];
660
+ x.shiftKey && document.activeElement === Y ? (x.preventDefault(), X.focus()) : !x.shiftKey && document.activeElement === X && (x.preventDefault(), Y.focus());
661
+ } else m === void 0 && !un(x.target) && !x.ctrlKey && !x.metaKey && !x.altKey && (x.key === "ArrowLeft" ? (z = d == null ? void 0 : d.onPrevious) == null || z.call(d) : x.key === "ArrowRight" ? (W = d == null ? void 0 : d.onNext) == null || W.call(d) : x.key === "+" || x.key === "=" ? p == null || p("in") : x.key === "-" ? p == null || p("out") : x.key === "0" && (p == null || p("reset")));
659
662
  },
660
663
  children: [
661
- o !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${l}, ${o.position}` }) : null,
662
- /* @__PURE__ */ i("header", { className: "cms-viewer__top", children: [
663
- /* @__PURE__ */ e("button", { ref: y, type: "button", className: "cms-viewer__icon", "aria-label": d, onClick: R, children: /* @__PURE__ */ e(U, { name: "close" }) }),
664
+ d !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${l}, ${d.position}` }) : null,
665
+ /* @__PURE__ */ o("header", { className: "cms-viewer__top", children: [
666
+ /* @__PURE__ */ e("button", { ref: y, type: "button", className: "cms-viewer__icon", "aria-label": i, onClick: T, children: /* @__PURE__ */ e(V, { name: "close" }) }),
664
667
  /* @__PURE__ */ e("span", { className: "cms-viewer__badge", children: t }),
665
- /* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: x, title: l, children: l }),
666
- o !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-viewer__position", children: o.position }) : null,
668
+ /* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: C, title: l, children: l }),
669
+ d !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-viewer__position", children: d.position }) : null,
667
670
  /* @__PURE__ */ e("span", { className: "cms-viewer__space" }),
668
- h !== void 0 ? /* @__PURE__ */ i(M, { children: [
669
- /* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: h.status }),
670
- /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: h.onDone, children: h.doneLabel })
671
- ] }) : /* @__PURE__ */ i(M, { children: [
672
- /* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: r.map((w) => /* @__PURE__ */ i("button", { type: "button", className: "cms-viewer__button", onClick: w.onSelect, children: [
673
- w.icon,
674
- w.label
675
- ] }, w.label)) }),
676
- s !== void 0 ? /* @__PURE__ */ i("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": s.label, onClick: s.onEdit, children: [
677
- s.icon,
678
- /* @__PURE__ */ e("span", { className: "cms-viewer__wide", children: s.label })
671
+ m !== void 0 ? /* @__PURE__ */ o(E, { children: [
672
+ /* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: m.status }),
673
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: m.onDone, children: m.doneLabel })
674
+ ] }) : /* @__PURE__ */ o(E, { children: [
675
+ /* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: s.map((x) => /* @__PURE__ */ o("button", { type: "button", className: "cms-viewer__button", onClick: x.onSelect, children: [
676
+ x.icon,
677
+ x.label
678
+ ] }, x.label)) }),
679
+ a !== void 0 ? /* @__PURE__ */ o("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": a.label, onClick: a.onEdit, children: [
680
+ a.icon,
681
+ /* @__PURE__ */ e("span", { className: "cms-viewer__wide", children: a.label })
679
682
  ] }) : null,
680
- r.length > 0 ? /* @__PURE__ */ i("span", { className: "cms-viewer__more", children: [
681
- /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": m, "aria-expanded": C, onClick: () => S((w) => !w), children: /* @__PURE__ */ e(A, { name: "more" }) }),
682
- C ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: r.map((w) => /* @__PURE__ */ i(
683
+ s.length > 0 ? /* @__PURE__ */ o("span", { className: "cms-viewer__more", children: [
684
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": u, "aria-expanded": M, onClick: () => _((x) => !x), children: /* @__PURE__ */ e(D, { name: "more" }) }),
685
+ M ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: s.map((x) => /* @__PURE__ */ o(
683
686
  "button",
684
687
  {
685
688
  type: "button",
686
689
  className: "cms-viewer__button",
687
690
  onClick: () => {
688
- S(!1), w.onSelect();
691
+ _(!1), x.onSelect();
689
692
  },
690
693
  children: [
691
- w.icon,
692
- w.label
694
+ x.icon,
695
+ x.label
693
696
  ]
694
697
  },
695
- w.label
698
+ x.label
696
699
  )) }) : null
697
700
  ] }) : null
698
701
  ] })
699
702
  ] }),
700
- /* @__PURE__ */ i("div", { className: "cms-viewer__body", children: [
701
- a != null && h === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: a }) : null,
702
- /* @__PURE__ */ i("div", { className: "cms-viewer__content", onTouchStart: Q, onTouchEnd: G, children: [
703
- (h == null ? void 0 : h.conflict) !== void 0 ? /* @__PURE__ */ i("div", { className: "cms-viewer__conflict", role: "alert", children: [
704
- /* @__PURE__ */ e("p", { className: "cms-viewer__conflict-text", children: h.conflict.message }),
705
- /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button", onClick: h.conflict.onOverwrite, children: h.conflict.overwriteLabel }),
706
- /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: h.conflict.onKeepBoth, children: h.conflict.keepBothLabel })
703
+ /* @__PURE__ */ o("div", { className: "cms-viewer__body", children: [
704
+ r != null && m === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: r }) : null,
705
+ /* @__PURE__ */ o("div", { className: "cms-viewer__content", onTouchStart: U, onTouchEnd: B, children: [
706
+ (m == null ? void 0 : m.conflict) !== void 0 ? /* @__PURE__ */ o("div", { className: "cms-viewer__conflict", role: "alert", children: [
707
+ /* @__PURE__ */ e("p", { className: "cms-viewer__conflict-text", children: m.conflict.message }),
708
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button", onClick: m.conflict.onOverwrite, children: m.conflict.overwriteLabel }),
709
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: m.conflict.onKeepBoth, children: m.conflict.keepBothLabel })
707
710
  ] }) : null,
708
- b === void 0 ? _ : /* @__PURE__ */ e(rn, { state: b }),
709
- h === void 0 && (o != null && o.onPrevious) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--previous", "aria-label": o.previousLabel, title: o.previousLabel, onClick: o.onPrevious, children: /* @__PURE__ */ e(U, { name: "back" }) }) : null,
710
- h === void 0 && (o != null && o.onNext) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--next", "aria-label": o.nextLabel, title: o.nextLabel, onClick: o.onNext, children: /* @__PURE__ */ e(U, { name: "back" }) }) : null,
711
- h === void 0 && o !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(o.total, 7) }, (w, B) => /* @__PURE__ */ e("i", { className: B === Math.min(o.index, 6) ? "is-current" : void 0 }, B)) }) : null
711
+ v === void 0 ? N : /* @__PURE__ */ e(fn, { state: v }),
712
+ m === void 0 && (d != null && d.onPrevious) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--previous", "aria-label": d.previousLabel, title: d.previousLabel, onClick: d.onPrevious, children: /* @__PURE__ */ e(V, { name: "back" }) }) : null,
713
+ m === void 0 && (d != null && d.onNext) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--next", "aria-label": d.nextLabel, title: d.nextLabel, onClick: d.onNext, children: /* @__PURE__ */ e(V, { name: "back" }) }) : null,
714
+ m === void 0 && d !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(d.total, 7) }, (x, $) => /* @__PURE__ */ e("i", { className: $ === Math.min(d.index, 6) ? "is-current" : void 0 }, $)) }) : null
712
715
  ] })
713
716
  ] }),
714
- h === void 0 && f != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: f }) : null,
715
- u != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: u }) : null
717
+ m === void 0 && h != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: h }) : null,
718
+ f != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: f }) : null
716
719
  ]
717
720
  }
718
721
  ),
719
722
  document.body
720
723
  );
721
724
  }
722
- function rn({ state: n }) {
725
+ function fn({ state: n }) {
723
726
  switch (n.kind) {
724
727
  case "loading":
725
- return /* @__PURE__ */ e(le, { kind: "loading", title: n.title, placement: "page" });
728
+ return /* @__PURE__ */ e(ie, { kind: "loading", title: n.title, placement: "page" });
726
729
  case "error":
727
730
  return /* @__PURE__ */ e(
728
- le,
731
+ ie,
729
732
  {
730
733
  kind: "error",
731
734
  title: n.title,
@@ -736,7 +739,7 @@ function rn({ state: n }) {
736
739
  );
737
740
  case "no-preview":
738
741
  return /* @__PURE__ */ e(
739
- le,
742
+ ie,
740
743
  {
741
744
  kind: "empty",
742
745
  title: n.title,
@@ -747,179 +750,179 @@ function rn({ state: n }) {
747
750
  );
748
751
  }
749
752
  }
750
- class cn extends Error {
753
+ class pn extends Error {
751
754
  constructor(l = "denied") {
752
755
  super(l), this.name = "FilePickerDenied";
753
756
  }
754
757
  }
755
- class on extends Error {
758
+ class bn extends Error {
756
759
  constructor(l = "restart") {
757
760
  super(l), this.name = "FilePickerRestart";
758
761
  }
759
762
  }
760
- const we = (n, l) => `${n}
761
- ${l}`, dn = (n, l) => n === "" ? l : `${n}/${l}`, un = 48;
762
- function jn(n) {
763
- var he, ne;
764
- const { open: l, spaces: t, list: d, disabledReason: c, budget: r, formatSize: m, labels: s, onConfirm: h, onCancel: b } = n, [o, u] = E(((he = t[0]) == null ? void 0 : he.id) ?? ""), [a, f] = E(""), [p, _] = E({ status: "loading" }), [N, y] = E(0), [x, C] = E(/* @__PURE__ */ new Map()), [S, F] = E(0), [R, Q] = E(!1), G = I(null), w = I(!1);
765
- q(() => {
766
- w.current = !1;
767
- }, [l, o, a]);
768
- const B = Y();
769
- q(() => {
770
- var v;
771
- l && (u(((v = t[0]) == null ? void 0 : v.id) ?? ""), f(""), C(/* @__PURE__ */ new Map()), Q(!1));
772
- }, [l]), q(() => {
773
- if (!l || o === "") return;
774
- let v = !0;
775
- return _({ status: "loading" }), F(0), d(o, a).then(
776
- (k) => v && _({ status: "ready", entries: k.entries, next: k.next ?? null, paging: !1 }),
777
- (k) => v && _({ status: k instanceof cn ? "denied" : "error" })
763
+ const Me = (n, l) => `${n}
764
+ ${l}`, _n = (n, l) => n === "" ? l : `${n}/${l}`, vn = 48;
765
+ function tl(n) {
766
+ var P, G;
767
+ const { open: l, spaces: t, list: i, disabledReason: c, budget: s, formatSize: u, labels: a, onConfirm: m, onCancel: v } = n, [d, f] = A(((P = t[0]) == null ? void 0 : P.id) ?? ""), [r, h] = A(""), [p, N] = A({ status: "loading" }), [k, y] = A(0), [C, M] = A(/* @__PURE__ */ new Map()), [_, w] = A(0), [T, U] = A(!1), B = O(null), x = O(!1);
768
+ J(() => {
769
+ x.current = !1;
770
+ }, [l, d, r]);
771
+ const $ = Q();
772
+ J(() => {
773
+ var g;
774
+ l && (f(((g = t[0]) == null ? void 0 : g.id) ?? ""), h(""), M(/* @__PURE__ */ new Map()), U(!1));
775
+ }, [l]), J(() => {
776
+ if (!l || d === "") return;
777
+ let g = !0;
778
+ return N({ status: "loading" }), w(0), i(d, r).then(
779
+ (S) => g && N({ status: "ready", entries: S.entries, next: S.next ?? null, paging: !1 }),
780
+ (S) => g && N({ status: S instanceof pn ? "denied" : "error" })
778
781
  ), () => {
779
- v = !1;
782
+ g = !1;
780
783
  };
781
- }, [l, o, a, d, N]);
782
- const Z = _e(() => {
784
+ }, [l, d, r, i, k]);
785
+ const z = _e(() => {
783
786
  if (p.status !== "ready" || p.next === null || p.paging) return;
784
- const v = p.next, k = p.entries;
785
- _({ ...p, paging: !0 }), d(o, a, v).then(
786
- ($) => {
787
- w.current = !1, _({ status: "ready", entries: [...k, ...$.entries], next: $.next ?? null, paging: !1 });
787
+ const g = p.next, S = p.entries;
788
+ N({ ...p, paging: !0 }), i(d, r, g).then(
789
+ (R) => {
790
+ x.current = !1, N({ status: "ready", entries: [...S, ...R.entries], next: R.next ?? null, paging: !1 });
788
791
  },
789
- ($) => {
790
- if (!($ instanceof on)) {
791
- _({ status: "ready", entries: k, next: v, paging: !1 });
792
+ (R) => {
793
+ if (!(R instanceof bn)) {
794
+ N({ status: "ready", entries: S, next: g, paging: !1 });
792
795
  return;
793
796
  }
794
- if (w.current) {
795
- _({ status: "error" });
797
+ if (x.current) {
798
+ N({ status: "error" });
796
799
  return;
797
800
  }
798
- w.current = !0, y((K) => K + 1);
801
+ x.current = !0, y((j) => j + 1);
799
802
  }
800
803
  );
801
- }, [p, d, o, a]), z = _e((v) => {
802
- var k;
803
- return ((k = r == null ? void 0 : r.cost) == null ? void 0 : k.call(r, v)) ?? v.size ?? 0;
804
- }, [r]), H = Ke(() => [...x.values()], [x]), W = H.reduce((v, k) => v + (k.size ?? 0), 0), j = r === void 0 ? null : r.limitBytes - r.usedBytes - H.reduce((v, k) => v + z(k), 0), ie = j !== null && j < 0, ue = (v) => {
805
- if (v.kind !== "file") return null;
806
- const k = c == null ? void 0 : c(v);
807
- return k || (j !== null && !x.has(we(o, v.id)) && z(v) > j ? s.overBudget : null);
808
- }, g = (v) => {
809
- const k = we(o, v.id);
810
- !x.has(k) && ue(v) !== null || C(($) => {
811
- const K = new Map($);
812
- return K.has(k) ? K.delete(k) : K.set(k, { ...v, space: o, path: a }), K;
804
+ }, [p, i, d, r]), W = _e((g) => {
805
+ var S;
806
+ return ((S = s == null ? void 0 : s.cost) == null ? void 0 : S.call(s, g)) ?? g.size ?? 0;
807
+ }, [s]), H = je(() => [...C.values()], [C]), Y = H.reduce((g, S) => g + (S.size ?? 0), 0), X = s === void 0 ? null : s.limitBytes - s.usedBytes - H.reduce((g, S) => g + W(S), 0), ee = X !== null && X < 0, te = (g) => {
808
+ if (g.kind !== "file") return null;
809
+ const S = c == null ? void 0 : c(g);
810
+ return S || (X !== null && !C.has(Me(d, g.id)) && W(g) > X ? a.overBudget : null);
811
+ }, q = (g) => {
812
+ const S = Me(d, g.id);
813
+ !C.has(S) && te(g) !== null || M((R) => {
814
+ const j = new Map(R);
815
+ return j.has(S) ? j.delete(S) : j.set(S, { ...g, space: d, path: r }), j;
813
816
  });
814
- }, D = (v) => f(dn(a, v.name)), V = () => f(a.includes("/") ? a.slice(0, a.lastIndexOf("/")) : ""), ee = (v) => C((k) => {
815
- const $ = new Map(k);
816
- return $.delete(v), $;
817
- }), L = p.status === "ready" ? p.entries : [], X = (v) => {
818
- const k = L[S];
819
- if (v.key === "ArrowDown" || v.key === "ArrowUp" || v.key === "Home" || v.key === "End") {
820
- v.preventDefault();
821
- const $ = L.length - 1, K = v.key === "Home" ? 0 : v.key === "End" ? $ : Math.min($, Math.max(0, S + (v.key === "ArrowDown" ? 1 : -1)));
822
- F(K), K >= $ - 1 && Z();
823
- } else v.key === "Enter" && (k == null ? void 0 : k.kind) === "folder" ? (v.preventDefault(), D(k)) : v.key === " " && (k == null ? void 0 : k.kind) === "file" ? (v.preventDefault(), g(k)) : v.key === "Backspace" && a !== "" && (v.preventDefault(), V());
824
- }, oe = a === "" ? [] : a.split("/"), ye = ((ne = t.find((v) => v.id === o)) == null ? void 0 : ne.name) ?? "", me = (v) => `${B}-entry-${String(v)}`;
825
- return /* @__PURE__ */ i(
826
- Be,
817
+ }, ae = (g) => h(_n(r, g.name)), se = () => h(r.includes("/") ? r.slice(0, r.lastIndexOf("/")) : ""), ke = (g) => M((S) => {
818
+ const R = new Map(S);
819
+ return R.delete(g), R;
820
+ }), re = p.status === "ready" ? p.entries : [], b = (g) => {
821
+ const S = re[_];
822
+ if (g.key === "ArrowDown" || g.key === "ArrowUp" || g.key === "Home" || g.key === "End") {
823
+ g.preventDefault();
824
+ const R = re.length - 1, j = g.key === "Home" ? 0 : g.key === "End" ? R : Math.min(R, Math.max(0, _ + (g.key === "ArrowDown" ? 1 : -1)));
825
+ w(j), j >= R - 1 && z();
826
+ } else g.key === "Enter" && (S == null ? void 0 : S.kind) === "folder" ? (g.preventDefault(), ae(S)) : g.key === " " && (S == null ? void 0 : S.kind) === "file" ? (g.preventDefault(), q(S)) : g.key === "Backspace" && r !== "" && (g.preventDefault(), se());
827
+ }, I = r === "" ? [] : r.split("/"), K = ((G = t.find((g) => g.id === d)) == null ? void 0 : G.name) ?? "", ne = (g) => `${$}-entry-${String(g)}`;
828
+ return /* @__PURE__ */ o(
829
+ ze,
827
830
  {
828
831
  open: l,
829
- title: s.title,
830
- onClose: b,
831
- closeLabel: s.close,
832
- initialFocus: G,
832
+ title: a.title,
833
+ onClose: v,
834
+ closeLabel: a.close,
835
+ initialFocus: B,
833
836
  className: "cms-file-picker",
834
- footer: /* @__PURE__ */ i("div", { className: "cms-file-picker__foot", children: [
835
- /* @__PURE__ */ i("div", { className: "cms-file-picker__summary", "aria-live": "polite", children: [
836
- H.length > 0 ? /* @__PURE__ */ e("span", { children: s.total(H.length, m(W)) }) : null,
837
- r !== void 0 && j !== null ? /* @__PURE__ */ e("span", { className: T(ie && "is-over"), children: ie ? s.overBudget : s.left(m(Math.max(0, j)), m(r.limitBytes)) }) : null
837
+ footer: /* @__PURE__ */ o("div", { className: "cms-file-picker__foot", children: [
838
+ /* @__PURE__ */ o("div", { className: "cms-file-picker__summary", "aria-live": "polite", children: [
839
+ H.length > 0 ? /* @__PURE__ */ e("span", { children: a.total(H.length, u(Y)) }) : null,
840
+ s !== void 0 && X !== null ? /* @__PURE__ */ e("span", { className: L(ee && "is-over"), children: ee ? a.overBudget : a.left(u(Math.max(0, X)), u(s.limitBytes)) }) : null
838
841
  ] }),
839
- /* @__PURE__ */ i("div", { className: "cms-file-picker__actions", children: [
840
- /* @__PURE__ */ e(te, { variant: "secondary", onClick: b, children: s.cancel }),
841
- /* @__PURE__ */ e(te, { variant: "primary", disabled: H.length === 0 || ie, onClick: () => h(H), children: s.confirm(H.length) })
842
+ /* @__PURE__ */ o("div", { className: "cms-file-picker__actions", children: [
843
+ /* @__PURE__ */ e(ce, { variant: "secondary", onClick: v, children: a.cancel }),
844
+ /* @__PURE__ */ e(ce, { variant: "primary", disabled: H.length === 0 || ee, onClick: () => m(H), children: a.confirm(H.length) })
842
845
  ] })
843
846
  ] }),
844
847
  children: [
845
- /* @__PURE__ */ i("div", { className: "cms-file-picker__top", children: [
846
- t.length > 1 ? /* @__PURE__ */ i("label", { className: "cms-file-picker__space", children: [
847
- /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: s.space }),
848
- /* @__PURE__ */ e("select", { className: "cms-input cms-select", value: o, onChange: (v) => {
849
- u(v.target.value), f("");
850
- }, children: t.map((v) => /* @__PURE__ */ e("option", { value: v.id, children: v.name }, v.id)) })
848
+ /* @__PURE__ */ o("div", { className: "cms-file-picker__top", children: [
849
+ t.length > 1 ? /* @__PURE__ */ o("label", { className: "cms-file-picker__space", children: [
850
+ /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: a.space }),
851
+ /* @__PURE__ */ e("select", { className: "cms-input cms-select", value: d, onChange: (g) => {
852
+ f(g.target.value), h("");
853
+ }, children: t.map((g) => /* @__PURE__ */ e("option", { value: g.id, children: g.name }, g.id)) })
851
854
  ] }) : null,
852
- /* @__PURE__ */ i("nav", { className: "cms-file-picker__path", "aria-label": s.path, children: [
853
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s.up, disabled: a === "", onClick: V, children: /* @__PURE__ */ e(A, { name: "chevron-left" }) }),
854
- /* @__PURE__ */ i("ol", { children: [
855
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": a === "" ? "location" : void 0, onClick: () => f(""), children: ye }) }),
856
- oe.map((v, k) => {
857
- const $ = oe.slice(0, k + 1).join("/");
858
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": $ === a ? "location" : void 0, onClick: () => f($), children: v }) }, $);
855
+ /* @__PURE__ */ o("nav", { className: "cms-file-picker__path", "aria-label": a.path, children: [
856
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": a.up, disabled: r === "", onClick: se, children: /* @__PURE__ */ e(D, { name: "chevron-left" }) }),
857
+ /* @__PURE__ */ o("ol", { children: [
858
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": r === "" ? "location" : void 0, onClick: () => h(""), children: K }) }),
859
+ I.map((g, S) => {
860
+ const R = I.slice(0, S + 1).join("/");
861
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": R === r ? "location" : void 0, onClick: () => h(R), children: g }) }, R);
859
862
  })
860
863
  ] })
861
864
  ] }),
862
- H.length > 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__chip", "aria-expanded": R, onClick: () => Q((v) => !v), children: s.selected(H.length) }) : null
865
+ H.length > 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__chip", "aria-expanded": T, onClick: () => U((g) => !g), children: a.selected(H.length) }) : null
863
866
  ] }),
864
- R && H.length > 0 ? /* @__PURE__ */ i("div", { className: "cms-file-picker__chosen", children: [
865
- /* @__PURE__ */ e("ul", { children: [...x.entries()].map(([v, k]) => /* @__PURE__ */ i("li", { children: [
866
- /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: k.name }),
867
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s.remove(k.name), onClick: () => ee(v), children: /* @__PURE__ */ e(U, { name: "close" }) })
868
- ] }, v)) }),
869
- /* @__PURE__ */ e(te, { variant: "secondary", onClick: () => {
870
- C(/* @__PURE__ */ new Map()), Q(!1);
871
- }, children: s.clear })
867
+ T && H.length > 0 ? /* @__PURE__ */ o("div", { className: "cms-file-picker__chosen", children: [
868
+ /* @__PURE__ */ e("ul", { children: [...C.entries()].map(([g, S]) => /* @__PURE__ */ o("li", { children: [
869
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: S.name }),
870
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": a.remove(S.name), onClick: () => ke(g), children: /* @__PURE__ */ e(V, { name: "close" }) })
871
+ ] }, g)) }),
872
+ /* @__PURE__ */ e(ce, { variant: "secondary", onClick: () => {
873
+ M(/* @__PURE__ */ new Map()), U(!1);
874
+ }, children: a.clear })
872
875
  ] }) : null,
873
- /* @__PURE__ */ i("div", { className: "cms-file-picker__list", onScroll: (v) => {
874
- const k = v.currentTarget;
875
- k.scrollTop + k.clientHeight >= k.scrollHeight - un && Z();
876
+ /* @__PURE__ */ o("div", { className: "cms-file-picker__list", onScroll: (g) => {
877
+ const S = g.currentTarget;
878
+ S.scrollTop + S.clientHeight >= S.scrollHeight - vn && z();
876
879
  }, children: [
877
- p.status === "loading" ? /* @__PURE__ */ e(le, { kind: "loading", title: s.loading, placement: "block" }) : null,
878
- p.status === "error" ? /* @__PURE__ */ e(le, { kind: "error", title: s.error, placement: "block", action: { label: s.retry, onAction: () => {
879
- w.current = !1, y((v) => v + 1);
880
+ p.status === "loading" ? /* @__PURE__ */ e(ie, { kind: "loading", title: a.loading, placement: "block" }) : null,
881
+ p.status === "error" ? /* @__PURE__ */ e(ie, { kind: "error", title: a.error, placement: "block", action: { label: a.retry, onAction: () => {
882
+ x.current = !1, y((g) => g + 1);
880
883
  } } }) : null,
881
- p.status === "denied" ? /* @__PURE__ */ e(le, { kind: "denied", title: s.denied, placement: "block" }) : null,
882
- p.status === "ready" && L.length === 0 ? /* @__PURE__ */ e(le, { kind: "empty", title: s.empty, placement: "block" }) : null,
883
- /* @__PURE__ */ i(
884
+ p.status === "denied" ? /* @__PURE__ */ e(ie, { kind: "denied", title: a.denied, placement: "block" }) : null,
885
+ p.status === "ready" && re.length === 0 ? /* @__PURE__ */ e(ie, { kind: "empty", title: a.empty, placement: "block" }) : null,
886
+ /* @__PURE__ */ o(
884
887
  "div",
885
888
  {
886
- ref: G,
889
+ ref: B,
887
890
  role: "listbox",
888
891
  "aria-multiselectable": "true",
889
- "aria-label": s.files,
890
- "aria-activedescendant": L.length > 0 ? me(S) : void 0,
892
+ "aria-label": a.files,
893
+ "aria-activedescendant": re.length > 0 ? ne(_) : void 0,
891
894
  tabIndex: 0,
892
895
  className: "cms-file-picker__entries",
893
- hidden: p.status !== "ready" || L.length === 0,
894
- onKeyDown: X,
896
+ hidden: p.status !== "ready" || re.length === 0,
897
+ onKeyDown: b,
895
898
  children: [
896
- L.map((v, k) => {
897
- const $ = v.kind === "file" && x.has(we(o, v.id)), K = ue(v);
898
- return /* @__PURE__ */ i(
899
+ re.map((g, S) => {
900
+ const R = g.kind === "file" && C.has(Me(d, g.id)), j = te(g);
901
+ return /* @__PURE__ */ o(
899
902
  "div",
900
903
  {
901
- id: me(k),
904
+ id: ne(S),
902
905
  role: "option",
903
- "aria-selected": v.kind === "file" ? $ : void 0,
904
- "aria-disabled": K !== null || void 0,
905
- className: T("cms-file-picker__entry", k === S && "is-active", $ && "is-ticked", K !== null && "is-disabled"),
906
+ "aria-selected": g.kind === "file" ? R : void 0,
907
+ "aria-disabled": j !== null || void 0,
908
+ className: L("cms-file-picker__entry", S === _ && "is-active", R && "is-ticked", j !== null && "is-disabled"),
906
909
  onClick: () => {
907
- F(k), v.kind === "folder" ? D(v) : g(v);
910
+ w(S), g.kind === "folder" ? ae(g) : q(g);
908
911
  },
909
912
  children: [
910
- /* @__PURE__ */ e("span", { className: "cms-file-picker__tick", "aria-hidden": "true", children: $ ? /* @__PURE__ */ e(A, { name: "check" }) : null }),
911
- /* @__PURE__ */ e(A, { name: v.kind === "folder" ? "folder" : "file" }),
912
- /* @__PURE__ */ i("span", { className: "cms-file-picker__text", children: [
913
- /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: v.name }),
914
- K !== null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__reason", children: K }) : null
913
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__tick", "aria-hidden": "true", children: R ? /* @__PURE__ */ e(D, { name: "check" }) : null }),
914
+ /* @__PURE__ */ e(D, { name: g.kind === "folder" ? "folder" : "file" }),
915
+ /* @__PURE__ */ o("span", { className: "cms-file-picker__text", children: [
916
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: g.name }),
917
+ j !== null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__reason", children: j }) : null
915
918
  ] }),
916
- v.kind === "file" && v.size != null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__size", children: m(v.size) }) : null
919
+ g.kind === "file" && g.size != null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__size", children: u(g.size) }) : null
917
920
  ]
918
921
  },
919
- v.id
922
+ g.id
920
923
  );
921
924
  }),
922
- p.status === "ready" && p.paging ? /* @__PURE__ */ e("div", { className: "cms-file-picker__paging", children: /* @__PURE__ */ e(le, { kind: "loading", title: s.loading, placement: "inline" }) }) : null
925
+ p.status === "ready" && p.paging ? /* @__PURE__ */ e("div", { className: "cms-file-picker__paging", children: /* @__PURE__ */ e(ie, { kind: "loading", title: a.loading, placement: "inline" }) }) : null
923
926
  ]
924
927
  }
925
928
  )
@@ -928,166 +931,166 @@ function jn(n) {
928
931
  }
929
932
  );
930
933
  }
931
- const xe = 64;
932
- function mn(n, l) {
934
+ const Se = 64;
935
+ function gn(n, l) {
933
936
  for (let t = n instanceof Element ? n : null; t !== null; t = t.parentElement) {
934
937
  if (t instanceof HTMLElement && t.scrollTop > 0) return !1;
935
938
  if (t === l) return !0;
936
939
  }
937
940
  return l.scrollTop <= 0;
938
941
  }
939
- function hn(n, l) {
940
- const [t, d] = E(0), c = I(l);
941
- return c.current = l, q(() => {
942
- const r = n.current;
943
- if (r === null) return;
944
- let m = null, s = 0;
945
- const h = (u) => {
946
- m = mn(u.target, r) && u.touches.length === 1 ? u.touches[0].clientY : null, s = 0;
947
- }, b = (u) => {
948
- if (m === null || c.current === null) return;
949
- const a = u.touches[0].clientY - m;
950
- if (a <= 0) {
951
- m = null, d(0);
942
+ function Nn(n, l) {
943
+ const [t, i] = A(0), c = O(l);
944
+ return c.current = l, J(() => {
945
+ const s = n.current;
946
+ if (s === null) return;
947
+ let u = null, a = 0;
948
+ const m = (f) => {
949
+ u = gn(f.target, s) && f.touches.length === 1 ? f.touches[0].clientY : null, a = 0;
950
+ }, v = (f) => {
951
+ if (u === null || c.current === null) return;
952
+ const r = f.touches[0].clientY - u;
953
+ if (r <= 0) {
954
+ u = null, i(0);
952
955
  return;
953
956
  }
954
- u.cancelable && u.preventDefault(), s = Math.min(a * 0.6, xe * 1.5), d(s);
955
- }, o = () => {
956
- var u;
957
- m !== null && s >= xe && ((u = c.current) == null || u.call(c)), m = null, s = 0, d(0);
957
+ f.cancelable && f.preventDefault(), a = Math.min(r * 0.6, Se * 1.5), i(a);
958
+ }, d = () => {
959
+ var f;
960
+ u !== null && a >= Se && ((f = c.current) == null || f.call(c)), u = null, a = 0, i(0);
958
961
  };
959
- return r.addEventListener("touchstart", h, { passive: !0 }), r.addEventListener("touchmove", b, { passive: !1 }), r.addEventListener("touchend", o), r.addEventListener("touchcancel", o), () => {
960
- r.removeEventListener("touchstart", h), r.removeEventListener("touchmove", b), r.removeEventListener("touchend", o), r.removeEventListener("touchcancel", o);
962
+ return s.addEventListener("touchstart", m, { passive: !0 }), s.addEventListener("touchmove", v, { passive: !1 }), s.addEventListener("touchend", d), s.addEventListener("touchcancel", d), () => {
963
+ s.removeEventListener("touchstart", m), s.removeEventListener("touchmove", v), s.removeEventListener("touchend", d), s.removeEventListener("touchcancel", d);
961
964
  };
962
965
  }, [n]), t;
963
966
  }
964
- const Re = Ue(null);
965
- function fn() {
966
- return Oe(Re);
967
- }
968
- function qn({ label: n, rows: l, error: t, onRetry: d, loadingText: c = "Loading", emptyTitle: r = "Nothing here yet", emptyHint: m, selected: s, onOpen: h, onRowMenu: b }) {
969
- const o = I([]), u = fn();
970
- if (t != null) return /* @__PURE__ */ e(Ge, { message: t, onRetry: d });
971
- if (l === null) return /* @__PURE__ */ e(qe, { what: c, layout: "block" });
972
- if (l.length === 0) return /* @__PURE__ */ e(Ye, { title: r, hint: m });
973
- const a = (f, p, _) => {
974
- var N;
975
- if (f.key === "ArrowDown" || f.key === "ArrowUp")
976
- f.preventDefault(), (N = o.current[Math.min(l.length - 1, Math.max(0, p + (f.key === "ArrowDown" ? 1 : -1)))]) == null || N.focus();
977
- else if (f.key === "Enter")
978
- h == null || h(_);
979
- else if ((f.key === "ContextMenu" || f.shiftKey && f.key === "F10") && b) {
980
- f.preventDefault();
981
- const y = f.currentTarget.getBoundingClientRect();
982
- b(_, { x: y.left + 16, y: y.bottom });
967
+ const Ze = Ye(null);
968
+ function wn() {
969
+ return qe(Ze);
970
+ }
971
+ function al({ label: n, rows: l, error: t, onRetry: i, loadingText: c = "Loading", emptyTitle: s = "Nothing here yet", emptyHint: u, selected: a, onOpen: m, onRowMenu: v }) {
972
+ const d = O([]), f = wn();
973
+ if (t != null) return /* @__PURE__ */ e(tn, { message: t, onRetry: i });
974
+ if (l === null) return /* @__PURE__ */ e(nn, { what: c, layout: "block" });
975
+ if (l.length === 0) return /* @__PURE__ */ e(ln, { title: s, hint: u });
976
+ const r = (h, p, N) => {
977
+ var k;
978
+ if (h.key === "ArrowDown" || h.key === "ArrowUp")
979
+ h.preventDefault(), (k = d.current[Math.min(l.length - 1, Math.max(0, p + (h.key === "ArrowDown" ? 1 : -1)))]) == null || k.focus();
980
+ else if (h.key === "Enter")
981
+ m == null || m(N);
982
+ else if ((h.key === "ContextMenu" || h.shiftKey && h.key === "F10") && v) {
983
+ h.preventDefault();
984
+ const y = h.currentTarget.getBoundingClientRect();
985
+ v(N, { x: y.left + 16, y: y.bottom });
983
986
  }
984
987
  };
985
- return /* @__PURE__ */ i(M, { children: [
986
- u !== null && (u.distance > 0 || u.refreshing) ? /* @__PURE__ */ i("div", { className: "cms-list__pull", role: "status", style: { height: u.refreshing ? void 0 : u.distance }, "data-ready": u.distance >= xe ? "" : void 0, children: [
987
- u.refreshing ? /* @__PURE__ */ e(U, { name: "spinner" }) : null,
988
- u.text != null ? /* @__PURE__ */ e("span", { className: "cms-list__pull-text", children: u.text }) : null
988
+ return /* @__PURE__ */ o(E, { children: [
989
+ f !== null && (f.distance > 0 || f.refreshing) ? /* @__PURE__ */ o("div", { className: "cms-list__pull", role: "status", style: { height: f.refreshing ? void 0 : f.distance }, "data-ready": f.distance >= Se ? "" : void 0, children: [
990
+ f.refreshing ? /* @__PURE__ */ e(V, { name: "spinner" }) : null,
991
+ f.text != null ? /* @__PURE__ */ e("span", { className: "cms-list__pull-text", children: f.text }) : null
989
992
  ] }) : null,
990
- /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": n, children: l.map((f, p) => {
991
- const _ = f.id === s;
992
- return /* @__PURE__ */ i(
993
+ /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": n, children: l.map((h, p) => {
994
+ const N = h.id === a;
995
+ return /* @__PURE__ */ o(
993
996
  "li",
994
997
  {
995
- ref: (N) => {
996
- o.current[p] = N;
998
+ ref: (k) => {
999
+ d.current[p] = k;
997
1000
  },
998
1001
  role: "option",
999
- "aria-selected": _,
1000
- tabIndex: _ || s == null && p === 0 ? 0 : -1,
1001
- className: T("cms-list__row", _ && "is-selected"),
1002
- onClick: () => h == null ? void 0 : h(f.id),
1003
- onKeyDown: (N) => a(N, p, f.id),
1004
- onContextMenu: b ? (N) => {
1005
- N.preventDefault(), b(f.id, { x: N.clientX, y: N.clientY });
1002
+ "aria-selected": N,
1003
+ tabIndex: N || a == null && p === 0 ? 0 : -1,
1004
+ className: L("cms-list__row", N && "is-selected"),
1005
+ onClick: () => m == null ? void 0 : m(h.id),
1006
+ onKeyDown: (k) => r(k, p, h.id),
1007
+ onContextMenu: v ? (k) => {
1008
+ k.preventDefault(), v(h.id, { x: k.clientX, y: k.clientY });
1006
1009
  } : void 0,
1007
1010
  children: [
1008
- f.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: f.lead }) : null,
1009
- /* @__PURE__ */ i("span", { className: "cms-list__text", children: [
1010
- /* @__PURE__ */ e("span", { className: T("cms-list__primary", f.unread === !0 && "is-unread"), children: f.primary }),
1011
- f.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: f.secondary }) : null
1011
+ h.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: h.lead }) : null,
1012
+ /* @__PURE__ */ o("span", { className: "cms-list__text", children: [
1013
+ /* @__PURE__ */ e("span", { className: L("cms-list__primary", h.unread === !0 && "is-unread"), children: h.primary }),
1014
+ h.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: h.secondary }) : null
1012
1015
  ] }),
1013
- f.meta != null || f.count !== void 0 ? /* @__PURE__ */ i("span", { className: "cms-list__end", children: [
1014
- f.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: f.meta }) : null,
1015
- f.count !== void 0 && f.count > 0 ? /* @__PURE__ */ e("span", { className: "cms-badge cms-list__count", children: f.count }) : null
1016
+ h.meta != null || h.count !== void 0 ? /* @__PURE__ */ o("span", { className: "cms-list__end", children: [
1017
+ h.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: h.meta }) : null,
1018
+ h.count !== void 0 && h.count > 0 ? /* @__PURE__ */ e("span", { className: "cms-badge cms-list__count", children: h.count }) : null
1016
1019
  ] }) : null
1017
1020
  ]
1018
1021
  },
1019
- f.id
1022
+ h.id
1020
1023
  );
1021
1024
  }) })
1022
1025
  ] });
1023
1026
  }
1024
- function ve({ at: n, items: l, onClose: t, label: d = "Actions", focus: c = "first" }) {
1025
- const r = I(null), m = I(null), s = Y(), [h, b] = E(n), o = l.filter((a) => a.offer.offered);
1026
- if (Ne(() => {
1027
+ function he({ at: n, items: l, onClose: t, label: i = "Actions", focus: c = "first" }) {
1028
+ const s = O(null), u = O(null), a = Q(), [m, v] = A(n), d = l.filter((r) => r.offer.offered);
1029
+ if (ve(() => {
1027
1030
  if (!n) return;
1028
- const a = r.current, f = (a == null ? void 0 : a.offsetWidth) ?? 0, p = (a == null ? void 0 : a.offsetHeight) ?? 0;
1029
- b({ x: Math.max(0, Math.min(n.x, window.innerWidth - f)), y: Math.max(0, Math.min(n.y, window.innerHeight - p)) });
1030
- }, [n]), q(() => {
1031
- var p, _;
1031
+ const r = s.current, h = (r == null ? void 0 : r.offsetWidth) ?? 0, p = (r == null ? void 0 : r.offsetHeight) ?? 0;
1032
+ v({ x: Math.max(0, Math.min(n.x, window.innerWidth - h)), y: Math.max(0, Math.min(n.y, window.innerHeight - p)) });
1033
+ }, [n]), J(() => {
1034
+ var p, N;
1032
1035
  if (!n) return;
1033
- m.current = document.activeElement;
1034
- const a = Array.from(((p = r.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) ?? []);
1035
- (_ = c === "last" ? a[a.length - 1] : a[0]) == null || _.focus();
1036
- const f = (N) => {
1036
+ u.current = document.activeElement;
1037
+ const r = Array.from(((p = s.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) ?? []);
1038
+ (N = c === "last" ? r[r.length - 1] : r[0]) == null || N.focus();
1039
+ const h = (k) => {
1037
1040
  var y;
1038
- (y = r.current) != null && y.contains(N.target) || t();
1041
+ (y = s.current) != null && y.contains(k.target) || t();
1039
1042
  };
1040
- return document.addEventListener("mousedown", f), () => {
1041
- var N, y;
1042
- document.removeEventListener("mousedown", f), (y = (N = m.current) == null ? void 0 : N.focus) == null || y.call(N);
1043
+ return document.addEventListener("mousedown", h), () => {
1044
+ var k, y;
1045
+ document.removeEventListener("mousedown", h), (y = (k = u.current) == null ? void 0 : k.focus) == null || y.call(k);
1043
1046
  };
1044
- }, [n, t, c]), !n || o.length === 0) return null;
1045
- const u = (a) => {
1046
- var _, N;
1047
- const f = Array.from(((_ = r.current) == null ? void 0 : _.querySelectorAll('[role="menuitem"]')) ?? []), p = f.indexOf(document.activeElement);
1048
- if (a.key === "Escape" || a.key === "Tab")
1049
- a.preventDefault(), t();
1050
- else if (a.key === "ArrowDown" || a.key === "ArrowUp") {
1051
- a.preventDefault();
1052
- const y = a.key === "ArrowDown" ? 1 : -1;
1053
- (N = f[(p + y + f.length) % f.length]) == null || N.focus();
1047
+ }, [n, t, c]), !n || d.length === 0) return null;
1048
+ const f = (r) => {
1049
+ var N, k;
1050
+ const h = Array.from(((N = s.current) == null ? void 0 : N.querySelectorAll('[role="menuitem"]')) ?? []), p = h.indexOf(document.activeElement);
1051
+ if (r.key === "Escape" || r.key === "Tab")
1052
+ r.preventDefault(), t();
1053
+ else if (r.key === "ArrowDown" || r.key === "ArrowUp") {
1054
+ r.preventDefault();
1055
+ const y = r.key === "ArrowDown" ? 1 : -1;
1056
+ (k = h[(p + y + h.length) % h.length]) == null || k.focus();
1054
1057
  }
1055
1058
  };
1056
- return Ce(
1059
+ return De(
1057
1060
  /* @__PURE__ */ e(
1058
1061
  "div",
1059
1062
  {
1060
- ref: r,
1063
+ ref: s,
1061
1064
  className: "cms-menu",
1062
1065
  role: "menu",
1063
- "aria-label": d,
1064
- style: { left: (h ?? n).x, top: (h ?? n).y },
1065
- onKeyDown: u,
1066
- onContextMenu: (a) => a.preventDefault(),
1067
- children: o.map((a) => {
1068
- const f = a.offer.refusal !== void 0;
1069
- return /* @__PURE__ */ i(
1066
+ "aria-label": i,
1067
+ style: { left: (m ?? n).x, top: (m ?? n).y },
1068
+ onKeyDown: f,
1069
+ onContextMenu: (r) => r.preventDefault(),
1070
+ children: d.map((r) => {
1071
+ const h = r.offer.refusal !== void 0;
1072
+ return /* @__PURE__ */ o(
1070
1073
  "div",
1071
1074
  {
1072
1075
  role: "menuitem",
1073
1076
  tabIndex: -1,
1074
- "aria-disabled": f || void 0,
1075
- "aria-describedby": f ? `${s}-${a.id}` : void 0,
1076
- title: f ? a.offer.refusal : void 0,
1077
- className: T("cms-menu__item", a.danger && "is-danger", a.offer.locked && "is-locked", f && "is-refused"),
1077
+ "aria-disabled": h || void 0,
1078
+ "aria-describedby": h ? `${a}-${r.id}` : void 0,
1079
+ title: h ? r.offer.refusal : void 0,
1080
+ className: L("cms-menu__item", r.danger && "is-danger", r.offer.locked && "is-locked", h && "is-refused"),
1078
1081
  onClick: () => {
1079
- f || (t(), a.onSelect());
1082
+ h || (t(), r.onSelect());
1080
1083
  },
1081
1084
  onKeyDown: (p) => {
1082
- (p.key === "Enter" || p.key === " ") && !f && (p.preventDefault(), t(), a.onSelect());
1085
+ (p.key === "Enter" || p.key === " ") && !h && (p.preventDefault(), t(), r.onSelect());
1083
1086
  },
1084
1087
  children: [
1085
- a.offer.locked ? /* @__PURE__ */ e(U, { name: "lock" }) : null,
1086
- /* @__PURE__ */ e("span", { className: "cms-menu__label", children: a.label }),
1087
- f ? /* @__PURE__ */ e("span", { id: `${s}-${a.id}`, className: "cms-menu__refusal", children: a.offer.refusal }) : null
1088
+ r.offer.locked ? /* @__PURE__ */ e(V, { name: "lock" }) : null,
1089
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: r.label }),
1090
+ h ? /* @__PURE__ */ e("span", { id: `${a}-${r.id}`, className: "cms-menu__refusal", children: r.offer.refusal }) : null
1088
1091
  ]
1089
1092
  },
1090
- a.id
1093
+ r.id
1091
1094
  );
1092
1095
  })
1093
1096
  }
@@ -1095,92 +1098,92 @@ function ve({ at: n, items: l, onClose: t, label: d = "Actions", focus: c = "fir
1095
1098
  document.body
1096
1099
  );
1097
1100
  }
1098
- function Yn({ title: n, icon: l, primary: t, more: d = [], moreLabel: c, context: r, fullWidth: m = !1 }) {
1099
- var p, _, N;
1100
- const [s, h] = E(null), b = Y(), o = d.filter((y) => y.offer.offered), u = (p = t == null ? void 0 : t.offer) == null ? void 0 : p.refusal, a = t !== void 0 && (((_ = t.offer) == null ? void 0 : _.offered) === !1 || u !== void 0), f = (y, x) => {
1101
- const C = x.getBoundingClientRect();
1102
- h((s == null ? void 0 : s.which) === y ? null : { which: y, x: C.left, y: C.bottom + 4 });
1101
+ function sl({ title: n, icon: l, primary: t, more: i = [], moreLabel: c, context: s, fullWidth: u = !1 }) {
1102
+ var k, y, C;
1103
+ const [a, m] = A(null), v = Q(), d = i.filter((M) => M.offer.offered), f = (k = t == null ? void 0 : t.offer) == null ? void 0 : k.refusal, r = t !== void 0 && (((y = t.offer) == null ? void 0 : y.offered) === !1 || f !== void 0), h = t !== void 0 && "menu" in t ? t.menu.filter((M) => M.offer.offered) : [], p = t !== void 0 && "menu" in t && h.length > 0 ? t : null, N = (M, _) => {
1104
+ const w = _.getBoundingClientRect();
1105
+ m((a == null ? void 0 : a.which) === M ? null : { which: M, x: w.left, y: w.bottom + 4 });
1103
1106
  };
1104
- return /* @__PURE__ */ i("header", { className: `cms-section-header${m ? " cms-section-header--full" : ""}`, children: [
1105
- /* @__PURE__ */ i("div", { className: "cms-section-header__row", "data-row": "1", children: [
1106
- l !== void 0 ? /* @__PURE__ */ e(A, { name: l }) : null,
1107
+ return /* @__PURE__ */ o("header", { className: `cms-section-header${u ? " cms-section-header--full" : ""}`, children: [
1108
+ /* @__PURE__ */ o("div", { className: "cms-section-header__row", "data-row": "1", children: [
1109
+ l !== void 0 ? /* @__PURE__ */ e(D, { name: l }) : null,
1107
1110
  /* @__PURE__ */ e("h1", { className: "cms-section-header__title", title: n, children: n }),
1108
- /* @__PURE__ */ i("div", { className: "cms-section-header__actions", children: [
1109
- t !== void 0 && ((N = t.offer) == null ? void 0 : N.offered) !== !1 ? /* @__PURE__ */ i("span", { className: `cms-section-header__primary${"menu" in t ? " cms-section-header__primary--split" : ""}`, children: [
1110
- /* @__PURE__ */ i(
1111
+ /* @__PURE__ */ o("div", { className: "cms-section-header__actions", children: [
1112
+ t !== void 0 && ((C = t.offer) == null ? void 0 : C.offered) !== !1 ? /* @__PURE__ */ o("span", { className: `cms-section-header__primary${p !== null ? " cms-section-header__primary--split" : ""}`, children: [
1113
+ /* @__PURE__ */ o(
1111
1114
  "button",
1112
1115
  {
1113
1116
  type: "button",
1114
1117
  className: "cms-button cms-button--primary",
1115
1118
  "data-action": "primary",
1116
- "aria-disabled": a ? "true" : void 0,
1117
- "aria-describedby": u !== void 0 ? b : void 0,
1118
- title: u,
1119
+ "aria-disabled": r ? "true" : void 0,
1120
+ "aria-describedby": f !== void 0 ? v : void 0,
1121
+ title: f,
1119
1122
  onClick: () => {
1120
- a || t.onPress();
1123
+ r || t.onPress();
1121
1124
  },
1122
1125
  children: [
1123
- /* @__PURE__ */ e(A, { name: t.icon }),
1126
+ /* @__PURE__ */ e(D, { name: t.icon }),
1124
1127
  " ",
1125
1128
  /* @__PURE__ */ e("span", { children: t.label })
1126
1129
  ]
1127
1130
  }
1128
1131
  ),
1129
- "menu" in t ? /* @__PURE__ */ e(
1132
+ p !== null ? /* @__PURE__ */ e(
1130
1133
  "button",
1131
1134
  {
1132
1135
  type: "button",
1133
1136
  className: "cms-button cms-button--primary cms-section-header__split",
1134
1137
  "data-action": "primary-menu",
1135
1138
  "aria-haspopup": "menu",
1136
- "aria-expanded": (s == null ? void 0 : s.which) === "primary",
1137
- "aria-label": t.menuLabel,
1138
- onClick: (y) => f("primary", y.currentTarget),
1139
- children: /* @__PURE__ */ e(A, { name: "chevron-down" })
1139
+ "aria-expanded": (a == null ? void 0 : a.which) === "primary",
1140
+ "aria-label": p.menuLabel,
1141
+ onClick: (M) => N("primary", M.currentTarget),
1142
+ children: /* @__PURE__ */ e(D, { name: "chevron-down" })
1140
1143
  }
1141
1144
  ) : null,
1142
- u !== void 0 ? /* @__PURE__ */ e("span", { id: b, className: "cms-visually-hidden", children: u }) : null
1145
+ f !== void 0 ? /* @__PURE__ */ e("span", { id: v, className: "cms-visually-hidden", children: f }) : null
1143
1146
  ] }) : null,
1144
- o.length > 0 ? /* @__PURE__ */ e(
1147
+ d.length > 0 ? /* @__PURE__ */ e(
1145
1148
  "button",
1146
1149
  {
1147
1150
  type: "button",
1148
1151
  className: "cms-section-header__more",
1149
1152
  "data-action": "more",
1150
1153
  "aria-haspopup": "menu",
1151
- "aria-expanded": (s == null ? void 0 : s.which) === "more",
1154
+ "aria-expanded": (a == null ? void 0 : a.which) === "more",
1152
1155
  "aria-label": c,
1153
1156
  title: c,
1154
- onClick: (y) => f("more", y.currentTarget),
1155
- children: /* @__PURE__ */ e(A, { name: "more" })
1157
+ onClick: (M) => N("more", M.currentTarget),
1158
+ children: /* @__PURE__ */ e(D, { name: "more" })
1156
1159
  }
1157
1160
  ) : null
1158
1161
  ] })
1159
1162
  ] }),
1160
- r != null ? /* @__PURE__ */ e("div", { className: "cms-section-header__context", "data-row": "2", children: r }) : null,
1161
- t !== void 0 && "menu" in t ? /* @__PURE__ */ e(ve, { at: (s == null ? void 0 : s.which) === "primary" ? s : null, items: t.menu, onClose: () => h(null), label: t.menuLabel }) : null,
1162
- /* @__PURE__ */ e(ve, { at: (s == null ? void 0 : s.which) === "more" ? s : null, items: d, onClose: () => h(null), label: c })
1163
+ s != null ? /* @__PURE__ */ e("div", { className: "cms-section-header__context", "data-row": "2", children: s }) : null,
1164
+ p !== null ? /* @__PURE__ */ e(he, { at: (a == null ? void 0 : a.which) === "primary" ? a : null, items: h, onClose: () => m(null), label: p.menuLabel }) : null,
1165
+ /* @__PURE__ */ e(he, { at: (a == null ? void 0 : a.which) === "more" ? a : null, items: i, onClose: () => m(null), label: c })
1163
1166
  ] });
1164
1167
  }
1165
- function Gn({ title: n, scope: l, actions: t, backLink: d }) {
1166
- return /* @__PURE__ */ i("header", { className: "cms-page-header", children: [
1167
- d ? /* @__PURE__ */ i(
1168
+ function rl({ title: n, scope: l, actions: t, backLink: i }) {
1169
+ return /* @__PURE__ */ o("header", { className: "cms-page-header", children: [
1170
+ i ? /* @__PURE__ */ o(
1168
1171
  "a",
1169
1172
  {
1170
1173
  className: "cms-page-header__back",
1171
- href: d.href ?? "#",
1174
+ href: i.href ?? "#",
1172
1175
  onClick: (c) => {
1173
- d.onBack && (c.preventDefault(), d.onBack());
1176
+ i.onBack && (c.preventDefault(), i.onBack());
1174
1177
  },
1175
1178
  children: [
1176
- /* @__PURE__ */ e(U, { name: "back" }),
1179
+ /* @__PURE__ */ e(V, { name: "back" }),
1177
1180
  " ",
1178
- d.label
1181
+ i.label
1179
1182
  ]
1180
1183
  }
1181
1184
  ) : null,
1182
- /* @__PURE__ */ i("div", { className: "cms-page-header__row", children: [
1183
- /* @__PURE__ */ i("div", { className: "cms-page-header__titles", children: [
1185
+ /* @__PURE__ */ o("div", { className: "cms-page-header__row", children: [
1186
+ /* @__PURE__ */ o("div", { className: "cms-page-header__titles", children: [
1184
1187
  /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: n }),
1185
1188
  l != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: l }) : null
1186
1189
  ] }),
@@ -1188,122 +1191,205 @@ function Gn({ title: n, scope: l, actions: t, backLink: d }) {
1188
1191
  ] })
1189
1192
  ] });
1190
1193
  }
1191
- function Xn({ tabs: n, active: l, onSelect: t, label: d }) {
1192
- const c = I([]), r = (m, s) => {
1193
- var u;
1194
- const h = n.length - 1, b = m.key === "ArrowRight" ? s === h ? 0 : s + 1 : m.key === "ArrowLeft" ? s === 0 ? h : s - 1 : m.key === "Home" ? 0 : m.key === "End" ? h : null;
1195
- if (b === null) return;
1196
- m.preventDefault();
1197
- const o = n[b];
1198
- o && (t(o.id), (u = c.current[b]) == null || u.focus());
1194
+ function il({ tabs: n, active: l, onSelect: t, label: i }) {
1195
+ const c = O([]), s = (u, a) => {
1196
+ var f;
1197
+ const m = n.length - 1, v = u.key === "ArrowRight" ? a === m ? 0 : a + 1 : u.key === "ArrowLeft" ? a === 0 ? m : a - 1 : u.key === "Home" ? 0 : u.key === "End" ? m : null;
1198
+ if (v === null) return;
1199
+ u.preventDefault();
1200
+ const d = n[v];
1201
+ d && (t(d.id), (f = c.current[v]) == null || f.focus());
1199
1202
  };
1200
- return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": d, children: n.map((m, s) => {
1201
- const h = m.id === l;
1202
- return /* @__PURE__ */ i(
1203
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": i, children: n.map((u, a) => {
1204
+ const m = u.id === l;
1205
+ return /* @__PURE__ */ o(
1203
1206
  "button",
1204
1207
  {
1205
- ref: (b) => {
1206
- c.current[s] = b;
1208
+ ref: (v) => {
1209
+ c.current[a] = v;
1207
1210
  },
1208
1211
  type: "button",
1209
1212
  role: "tab",
1210
- className: T("cms-tab", h && "is-active"),
1211
- "aria-selected": h,
1212
- tabIndex: h ? 0 : -1,
1213
- onClick: () => t(m.id),
1214
- onKeyDown: (b) => r(b, s),
1213
+ className: L("cms-tab", m && "is-active"),
1214
+ "aria-selected": m,
1215
+ tabIndex: m ? 0 : -1,
1216
+ onClick: () => t(u.id),
1217
+ onKeyDown: (v) => s(v, a),
1215
1218
  children: [
1216
- m.label,
1217
- m.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: m.count }) : null
1219
+ u.label,
1220
+ u.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: u.count }) : null
1218
1221
  ]
1219
1222
  },
1220
- m.id
1223
+ u.id
1221
1224
  );
1222
1225
  }) });
1223
1226
  }
1224
- function pn(n) {
1227
+ function yn(n) {
1225
1228
  const l = n.trim().replace(/\s+via\s+\S.*$/, "").split(/\s+/).filter(Boolean), t = (c) => {
1226
- var r;
1227
- return (r = c == null ? void 0 : c.match(/[\p{L}\p{N}]/u)) == null ? void 0 : r[0];
1229
+ var s;
1230
+ return (s = c == null ? void 0 : c.match(/[\p{L}\p{N}]/u)) == null ? void 0 : s[0];
1228
1231
  };
1229
1232
  return (l.length > 1 ? [t(l[0]), t(l[l.length - 1])] : [t(l[0])]).filter(Boolean).join("").toUpperCase();
1230
1233
  }
1231
- function bn(n) {
1234
+ function kn(n) {
1232
1235
  let l = 0;
1233
1236
  for (const t of n.trim().toLowerCase())
1234
1237
  l = l * 31 + (t.codePointAt(0) ?? 0) >>> 0;
1235
1238
  return l % 6 + 1;
1236
1239
  }
1237
- function ge({ name: n, pictureUrl: l, presence: t, connection: d, deleted: c = !1, size: r = 32 }) {
1238
- const m = d !== void 0 ? `is-${d.state === "offline" ? "disconnected" : d.state}` : t === void 0 ? null : `is-${t === "busy" ? "away" : t}`, s = d !== void 0 ? `${n}, ${d.label}` : t ? `${n}, ${t}` : n;
1239
- return /* @__PURE__ */ i(
1240
+ function ye({ name: n, pictureUrl: l, presence: t, connection: i, deleted: c = !1, size: s = 32 }) {
1241
+ const u = i !== void 0 ? `is-${i.state === "offline" ? "disconnected" : i.state}` : t === void 0 ? null : `is-${t === "busy" ? "away" : t}`, a = i !== void 0 ? `${n}, ${i.label}` : t ? `${n}, ${t}` : n;
1242
+ return /* @__PURE__ */ o(
1240
1243
  "span",
1241
1244
  {
1242
- className: T("cms-avatar", c ? "cms-avatar--deleted" : `cms-avatar--tint-${bn(n)}`),
1243
- style: { width: r, height: r, fontSize: Math.round(r * 0.4) },
1245
+ className: L("cms-avatar", c ? "cms-avatar--deleted" : `cms-avatar--tint-${kn(n)}`),
1246
+ style: { width: s, height: s, fontSize: Math.round(s * 0.4) },
1244
1247
  role: "img",
1245
- "aria-label": s,
1246
- ...d === void 0 ? {} : { title: d.label },
1248
+ "aria-label": a,
1249
+ ...i === void 0 ? {} : { title: i.label },
1247
1250
  children: [
1248
- c ? /* @__PURE__ */ e(A, { name: "user", size: Math.round(r * 0.6) }) : l ? /* @__PURE__ */ e("img", { src: l, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: pn(n) }),
1249
- m === null ? null : /* @__PURE__ */ e("span", { className: T("cms-avatar__presence", m), "aria-hidden": "true" })
1251
+ c ? /* @__PURE__ */ e(D, { name: "user", size: Math.round(s * 0.6) }) : l ? /* @__PURE__ */ e("img", { src: l, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: yn(n) }),
1252
+ u === null ? null : /* @__PURE__ */ e("span", { className: L("cms-avatar__presence", u), "aria-hidden": "true" })
1250
1253
  ]
1251
1254
  }
1252
1255
  );
1253
1256
  }
1254
- function _n({ count: n, label: l, max: t = 99 }) {
1255
- return n <= 0 ? null : /* @__PURE__ */ i("span", { className: "cms-badge", children: [
1257
+ const xn = 64, Ie = "cms-splitter:";
1258
+ function Ee(n) {
1259
+ try {
1260
+ const l = window.localStorage.getItem(Ie + n);
1261
+ if (l === null) return null;
1262
+ const t = Number(l);
1263
+ return Number.isFinite(t) ? t : null;
1264
+ } catch {
1265
+ return null;
1266
+ }
1267
+ }
1268
+ function Mn(n, l) {
1269
+ if (n !== void 0)
1270
+ try {
1271
+ window.localStorage.setItem(Ie + n, String(l));
1272
+ } catch {
1273
+ }
1274
+ }
1275
+ function Cn(n) {
1276
+ if (n !== void 0)
1277
+ try {
1278
+ window.localStorage.removeItem(Ie + n);
1279
+ } catch {
1280
+ }
1281
+ }
1282
+ function Sn({ storageKey: n, value: l, default: t, min: i, max: c, step: s = 16, label: u, onChange: a, className: m, style: v }) {
1283
+ const d = Math.max(i, c), f = (_) => Math.round(Math.min(Math.max(_, i), d)), [r, h] = A(() => {
1284
+ const _ = n === void 0 ? null : Ee(n);
1285
+ return f(_ ?? t);
1286
+ }), p = f(l ?? r), N = O(null), [k, y] = A(!1);
1287
+ ve(() => {
1288
+ if (n === void 0) return;
1289
+ const _ = Ee(n);
1290
+ if (_ === null) return;
1291
+ const w = f(_);
1292
+ (l === void 0 || w !== f(l)) && (h(w), a(w, !0));
1293
+ }, []), ve(() => {
1294
+ l !== void 0 && f(l) !== l && a(f(l), !0);
1295
+ }, [l, i, d]);
1296
+ const C = (_, w) => {
1297
+ const T = f(_);
1298
+ h(T), w && Mn(n, T), a(T, w);
1299
+ }, M = () => {
1300
+ const _ = N.current;
1301
+ N.current = null, y(!1), _ !== null && _.last !== _.from && C(_.last, !0);
1302
+ };
1303
+ return /* @__PURE__ */ e(
1304
+ "div",
1305
+ {
1306
+ role: "separator",
1307
+ tabIndex: 0,
1308
+ "aria-orientation": "vertical",
1309
+ "aria-label": u,
1310
+ "aria-valuenow": p,
1311
+ "aria-valuemin": i,
1312
+ "aria-valuemax": d,
1313
+ className: L("cms-splitter", k && "is-dragging", p <= i && "is-at-min", p >= d && "is-at-max", m),
1314
+ style: v,
1315
+ onPointerDown: (_) => {
1316
+ var T, U;
1317
+ if (_.button > 0) return;
1318
+ _.preventDefault(), (U = (T = _.currentTarget).setPointerCapture) == null || U.call(T, _.pointerId);
1319
+ const w = getComputedStyle(_.currentTarget).direction === "rtl" ? -1 : 1;
1320
+ N.current = { x: _.clientX, from: p, last: p, sign: w }, y(!0);
1321
+ },
1322
+ onPointerMove: (_) => {
1323
+ const w = N.current;
1324
+ w === null || !Number.isFinite(_.clientX) || (w.last = f(w.from + w.sign * (_.clientX - w.x)), C(w.last, !1));
1325
+ },
1326
+ onPointerUp: M,
1327
+ onPointerCancel: M,
1328
+ onDoubleClick: () => {
1329
+ Cn(n);
1330
+ const _ = f(t);
1331
+ h(_), a(_, !0);
1332
+ },
1333
+ onKeyDown: (_) => {
1334
+ const w = _.shiftKey ? xn : s, T = getComputedStyle(_.currentTarget).direction === "rtl" ? -1 : 1, U = _.key === "ArrowLeft" ? p - T * w : _.key === "ArrowRight" ? p + T * w : _.key === "Home" ? i : _.key === "End" ? d : null;
1335
+ U !== null && (_.preventDefault(), C(U, !0));
1336
+ }
1337
+ }
1338
+ );
1339
+ }
1340
+ function En({ count: n, label: l, max: t = 99 }) {
1341
+ return n <= 0 ? null : /* @__PURE__ */ o("span", { className: "cms-badge", children: [
1256
1342
  /* @__PURE__ */ e("span", { "aria-hidden": "true", children: n > t ? `${t}+` : n }),
1257
1343
  /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: l })
1258
1344
  ] });
1259
1345
  }
1260
- function Jn({ product: n, mark: l, rail: t, active: d, onNavigate: c, server: r, search: m, account: s, children: h, railLabel: b = "Sections" }) {
1261
- return /* @__PURE__ */ i("div", { className: "cms-shell", children: [
1262
- /* @__PURE__ */ i("nav", { className: "cms-shell__rail", "aria-label": b, children: [
1346
+ function cl({ product: n, mark: l, rail: t, active: i, onNavigate: c, server: s, search: u, account: a, children: m, railLabel: v = "Sections" }) {
1347
+ return /* @__PURE__ */ o("div", { className: "cms-shell", children: [
1348
+ /* @__PURE__ */ o("nav", { className: "cms-shell__rail", "aria-label": v, children: [
1263
1349
  /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: l }),
1264
- /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: t.map((o) => {
1265
- const u = o.id === d;
1266
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
1350
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: t.map((d) => {
1351
+ const f = d.id === i;
1352
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
1267
1353
  "a",
1268
1354
  {
1269
- href: o.href,
1270
- className: T("cms-shell__item", u && "is-active"),
1271
- "aria-current": u ? "page" : void 0,
1272
- title: o.label,
1273
- onClick: (a) => {
1274
- c && (a.preventDefault(), c(o.id));
1355
+ href: d.href,
1356
+ className: L("cms-shell__item", f && "is-active"),
1357
+ "aria-current": f ? "page" : void 0,
1358
+ title: d.label,
1359
+ onClick: (r) => {
1360
+ c && (r.preventDefault(), c(d.id));
1275
1361
  },
1276
1362
  children: [
1277
- /* @__PURE__ */ i("span", { className: "cms-shell__icon", children: [
1278
- /* @__PURE__ */ e(A, { name: o.icon, size: 22 }),
1279
- o.badge ? /* @__PURE__ */ e(_n, { count: o.badge.count, label: o.badge.label }) : null
1363
+ /* @__PURE__ */ o("span", { className: "cms-shell__icon", children: [
1364
+ /* @__PURE__ */ e(D, { name: d.icon, size: 22 }),
1365
+ d.badge ? /* @__PURE__ */ e(En, { count: d.badge.count, label: d.badge.label }) : null
1280
1366
  ] }),
1281
- /* @__PURE__ */ e("span", { className: "cms-shell__label", children: o.label })
1367
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: d.label })
1282
1368
  ]
1283
1369
  }
1284
- ) }, o.id);
1370
+ ) }, d.id);
1285
1371
  }) })
1286
1372
  ] }),
1287
- /* @__PURE__ */ i("header", { className: "cms-shell__top", children: [
1373
+ /* @__PURE__ */ o("header", { className: "cms-shell__top", children: [
1288
1374
  /* @__PURE__ */ e("span", { className: "cms-shell__product", children: n }),
1289
- r != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: r }) : null,
1290
- m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: m }) : null,
1291
- s != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: s }) : null
1375
+ s != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: s }) : null,
1376
+ u != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: u }) : null,
1377
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: a }) : null
1292
1378
  ] }),
1293
- /* @__PURE__ */ e("main", { className: "cms-shell__main", children: h })
1379
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: m })
1294
1380
  ] });
1295
1381
  }
1296
- function Qn({ label: n, placeholder: l, value: t, onChange: d, onSearch: c }) {
1297
- return /* @__PURE__ */ i(
1382
+ function ol({ label: n, placeholder: l, value: t, onChange: i, onSearch: c }) {
1383
+ return /* @__PURE__ */ o(
1298
1384
  "form",
1299
1385
  {
1300
1386
  role: "search",
1301
1387
  className: "cms-search",
1302
- onSubmit: (r) => {
1303
- r.preventDefault(), c == null || c(t);
1388
+ onSubmit: (s) => {
1389
+ s.preventDefault(), c == null || c(t);
1304
1390
  },
1305
1391
  children: [
1306
- /* @__PURE__ */ e(A, { name: "search", size: 18 }),
1392
+ /* @__PURE__ */ e(D, { name: "search", size: 18 }),
1307
1393
  /* @__PURE__ */ e(
1308
1394
  "input",
1309
1395
  {
@@ -1312,59 +1398,39 @@ function Qn({ label: n, placeholder: l, value: t, onChange: d, onSearch: c }) {
1312
1398
  "aria-label": n,
1313
1399
  placeholder: l,
1314
1400
  value: t,
1315
- onChange: (r) => d(r.target.value)
1401
+ onChange: (s) => i(s.target.value)
1316
1402
  }
1317
1403
  )
1318
1404
  ]
1319
1405
  }
1320
1406
  );
1321
1407
  }
1322
- function vn({ options: n, value: l, onChange: t, label: d }) {
1323
- const c = I([]), r = I(null), [m, s] = E({ start: !1, end: !1 }), h = () => {
1324
- const u = r.current;
1325
- if (u === null) return;
1326
- const a = Math.abs(u.scrollLeft), f = a > 1, p = a + u.clientWidth < u.scrollWidth - 1;
1327
- s((_) => _.start === f && _.end === p ? _ : { start: f, end: p });
1328
- };
1329
- Ne(() => {
1330
- h();
1331
- const u = r.current;
1332
- if (u === null || typeof ResizeObserver > "u") return;
1333
- const a = new ResizeObserver(h);
1334
- a.observe(u);
1335
- for (const f of c.current) f !== null && a.observe(f);
1336
- return () => a.disconnect();
1337
- }, [n]);
1338
- const b = (u) => {
1339
- var a, f;
1340
- return (f = (a = c.current[u]) == null ? void 0 : a.scrollIntoView) == null ? void 0 : f.call(a, { block: "nearest", inline: "nearest" });
1341
- }, o = (u, a) => {
1342
- var N;
1343
- const f = n.length - 1, p = u.key === "ArrowRight" || u.key === "ArrowDown" ? a === f ? 0 : a + 1 : u.key === "ArrowLeft" || u.key === "ArrowUp" ? a === 0 ? f : a - 1 : null;
1344
- if (p === null) return;
1408
+ function An({ options: n, value: l, onChange: t, label: i }) {
1409
+ const c = O([]), s = (u, a) => {
1410
+ var f;
1411
+ const m = n.length - 1, v = u.key === "ArrowRight" || u.key === "ArrowDown" ? a === m ? 0 : a + 1 : u.key === "ArrowLeft" || u.key === "ArrowUp" ? a === 0 ? m : a - 1 : null;
1412
+ if (v === null) return;
1345
1413
  u.preventDefault();
1346
- const _ = n[p];
1347
- _ && (t(_.id), (N = c.current[p]) == null || N.focus(), b(p));
1414
+ const d = n[v];
1415
+ d && (t(d.id), (f = c.current[v]) == null || f.focus());
1348
1416
  };
1349
- return /* @__PURE__ */ e("div", { ref: r, className: T("cms-chips", m.start && "is-past-start", m.end && "is-past-end"), role: "radiogroup", "aria-label": d, onScroll: h, "data-scrolls-sideways": "", children: n.map((u, a) => {
1350
- const f = u.id === l;
1351
- return /* @__PURE__ */ i(
1417
+ return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": i, children: n.map((u, a) => {
1418
+ const m = u.id === l;
1419
+ return /* @__PURE__ */ o(
1352
1420
  "button",
1353
1421
  {
1354
- ref: (p) => {
1355
- c.current[a] = p;
1422
+ ref: (v) => {
1423
+ c.current[a] = v;
1356
1424
  },
1357
1425
  type: "button",
1358
1426
  role: "radio",
1359
- "aria-checked": f,
1360
- tabIndex: f ? 0 : -1,
1361
- className: T("cms-chip", f && "is-on"),
1362
- onClick: () => {
1363
- t(u.id), b(a);
1364
- },
1365
- onKeyDown: (p) => o(p, a),
1427
+ "aria-checked": m,
1428
+ tabIndex: m ? 0 : -1,
1429
+ className: L("cms-chip", m && "is-on"),
1430
+ onClick: () => t(u.id),
1431
+ onKeyDown: (v) => s(v, a),
1366
1432
  children: [
1367
- f ? /* @__PURE__ */ e(A, { name: "check", size: 16 }) : null,
1433
+ m ? /* @__PURE__ */ e(D, { name: "check", size: 16 }) : null,
1368
1434
  u.label
1369
1435
  ]
1370
1436
  },
@@ -1372,148 +1438,117 @@ function vn({ options: n, value: l, onChange: t, label: d }) {
1372
1438
  );
1373
1439
  }) });
1374
1440
  }
1375
- const De = 16;
1376
- function gn(n, l, t) {
1377
- const d = n.map((r) => Math.min(Math.max(r.width, r.min), r.max));
1378
- let c = d.reduce((r, m) => r + m, 0) + t - l;
1379
- for (let r = d.length - 1; r >= 0 && c > 0; r -= 1) {
1380
- const m = Math.min(c, d[r] - n[r].min);
1381
- d[r] = d[r] - m, c -= m;
1441
+ function Tn(n, l, t) {
1442
+ const i = n.map((s) => Math.min(Math.max(s.width, s.min), s.max));
1443
+ let c = i.reduce((s, u) => s + u, 0) + t - l;
1444
+ for (let s = i.length - 1; s >= 0 && c > 0; s -= 1) {
1445
+ const u = Math.min(c, i[s] - n[s].min);
1446
+ i[s] = i[s] - u, c -= u;
1382
1447
  }
1383
- return d;
1384
- }
1385
- function Nn({ index: n, size: l, shown: t, others: d, room: c, lastMin: r, onResize: m }) {
1386
- const s = Math.max(l.min, Math.min(l.max, c > 0 ? c - d - r : l.max)), h = (u) => Math.round(Math.min(Math.max(u, l.min), s)), b = I(null), o = (u, a) => m == null ? void 0 : m(n, h(u), a);
1387
- return /* @__PURE__ */ e(
1388
- "div",
1389
- {
1390
- role: "separator",
1391
- tabIndex: 0,
1392
- "aria-orientation": "vertical",
1393
- "aria-label": l.label,
1394
- "aria-valuenow": t,
1395
- "aria-valuemin": l.min,
1396
- "aria-valuemax": s,
1397
- className: "cms-panes__splitter",
1398
- style: { "--split-at": `var(--split-pane-end-${String(n)})` },
1399
- onPointerDown: (u) => {
1400
- var a, f, p;
1401
- u.button > 0 || (u.preventDefault(), (f = (a = u.currentTarget).setPointerCapture) == null || f.call(a, u.pointerId), b.current = { x: u.clientX, from: t, last: t }, (p = u.currentTarget.closest(".cms-panes")) == null || p.classList.add("is-resizing"));
1402
- },
1403
- onPointerMove: (u) => {
1404
- const a = b.current;
1405
- a === null || !Number.isFinite(u.clientX) || (a.last = h(a.from + u.clientX - a.x), o(a.last, !1));
1406
- },
1407
- onPointerUp: (u) => {
1408
- var f;
1409
- const a = b.current;
1410
- a !== null && (b.current = null, (f = u.currentTarget.closest(".cms-panes")) == null || f.classList.remove("is-resizing"), o(a.last, !0));
1411
- },
1412
- onPointerCancel: (u) => {
1413
- var f;
1414
- const a = b.current;
1415
- b.current = null, (f = u.currentTarget.closest(".cms-panes")) == null || f.classList.remove("is-resizing"), a !== null && o(a.last, !0);
1416
- },
1417
- onDoubleClick: () => o(l.reset, !0),
1418
- onKeyDown: (u) => {
1419
- const a = u.key === "ArrowLeft" ? t - De : u.key === "ArrowRight" ? t + De : u.key === "Home" ? l.min : u.key === "End" ? s : u.key === "Enter" ? l.reset : null;
1420
- a !== null && (u.preventDefault(), o(a, !0));
1421
- }
1422
- }
1423
- );
1424
- }
1425
- function el({ panes: n, active: l, back: t, sizes: d, lastMin: c = 360, onResize: r }) {
1426
- const m = Math.min(Math.max(l ?? n.length - 1, 0), n.length - 1), s = I(null), [h, b] = E(0), o = (d ?? []).slice(0, n.length - 1), u = o.length === n.length - 1 && o.every((p) => p !== void 0);
1427
- Ne(() => {
1428
- const p = s.current;
1429
- if (p === null || !u) return;
1430
- const _ = () => b(p.clientWidth);
1431
- if (_(), typeof ResizeObserver > "u") return;
1432
- const N = new ResizeObserver(_);
1433
- return N.observe(p), () => N.disconnect();
1434
- }, [u]);
1435
- const a = u ? gn(o, h > 0 ? h : Number.POSITIVE_INFINITY, c) : [], f = u ? Object.fromEntries(a.flatMap((p, _) => [
1436
- [`--split-pane-${String(_)}`, `${String(p)}px`],
1437
- [`--split-pane-end-${String(_)}`, `${String(a.slice(0, _ + 1).reduce((N, y) => N + y, 0))}px`]
1448
+ return i;
1449
+ }
1450
+ function dl({ panes: n, active: l, back: t, sizes: i, lastMin: c = 360, onResize: s, storageKey: u }) {
1451
+ const a = Math.min(Math.max(l ?? n.length - 1, 0), n.length - 1), m = O(null), [v, d] = A(0), f = (i ?? []).slice(0, n.length - 1), [r, h] = A(() => u === void 0 ? [] : f.map((_, w) => Ee(`${u}:${String(w)}`) ?? void 0)), [p, N] = A(!1), k = f.map((_, w) => _ !== void 0 && r[w] !== void 0 ? { ..._, width: r[w] } : _), y = k.length === n.length - 1 && k.every((_) => _ !== void 0);
1452
+ ve(() => {
1453
+ const _ = m.current;
1454
+ if (_ === null || !y) return;
1455
+ const w = () => d(_.clientWidth);
1456
+ if (w(), typeof ResizeObserver > "u") return;
1457
+ const T = new ResizeObserver(w);
1458
+ return T.observe(_), () => T.disconnect();
1459
+ }, [y]);
1460
+ const C = y ? Tn(k, v > 0 ? v : Number.POSITIVE_INFINITY, c) : [], M = y ? Object.fromEntries(C.flatMap((_, w) => [
1461
+ [`--split-pane-${String(w)}`, `${String(_)}px`],
1462
+ [`--split-pane-end-${String(w)}`, `${String(C.slice(0, w + 1).reduce((T, U) => T + U, 0))}px`]
1438
1463
  ])) : void 0;
1439
- return /* @__PURE__ */ i(
1464
+ return /* @__PURE__ */ o(
1440
1465
  "div",
1441
1466
  {
1442
- ref: s,
1443
- className: T("cms-panes", n.length === 3 ? "cms-panes--three" : "cms-panes--two", u && "cms-panes--sized"),
1444
- "data-active": m,
1445
- style: f,
1467
+ ref: m,
1468
+ className: L("cms-panes", n.length === 3 ? "cms-panes--three" : "cms-panes--two", y && "cms-panes--sized", p && "is-resizing"),
1469
+ "data-active": a,
1470
+ style: M,
1446
1471
  children: [
1447
- n.map((p, _) => /* @__PURE__ */ i("section", { className: "cms-panes__pane", "aria-label": p.label, "data-offset": m - _, children: [
1448
- _ === m && t ? /* @__PURE__ */ i("a", { className: "cms-panes__back", href: t.href, children: [
1449
- /* @__PURE__ */ e(A, { name: "chevron-left", size: 18 }),
1472
+ n.map((_, w) => /* @__PURE__ */ o("section", { className: "cms-panes__pane", "aria-label": _.label, "data-offset": a - w, children: [
1473
+ w === a && t ? /* @__PURE__ */ o("a", { className: "cms-panes__back", href: t.href, children: [
1474
+ /* @__PURE__ */ e(D, { name: "chevron-left", size: 18 }),
1450
1475
  t.label
1451
1476
  ] }) : null,
1452
- p.content
1453
- ] }, p.label)),
1454
- u ? o.map((p, _) => /* @__PURE__ */ e(
1455
- Nn,
1456
- {
1457
- index: _,
1458
- size: p,
1459
- shown: a[_],
1460
- others: a.reduce((N, y, x) => x === _ ? N : N + y, 0),
1461
- room: h,
1462
- lastMin: c,
1463
- onResize: r
1464
- },
1465
- p.label
1466
- )) : null
1477
+ _.content
1478
+ ] }, _.label)),
1479
+ y ? k.map((_, w) => {
1480
+ const T = C.reduce((B, x, $) => $ === w ? B : B + x, 0), U = Math.max(_.min, Math.min(_.max, v > 0 ? v - T - c : _.max));
1481
+ return /* @__PURE__ */ e(
1482
+ Sn,
1483
+ {
1484
+ ...u === void 0 ? {} : { storageKey: `${u}:${String(w)}` },
1485
+ value: C[w],
1486
+ default: _.reset,
1487
+ min: _.min,
1488
+ max: U,
1489
+ label: _.label,
1490
+ className: "cms-panes__splitter",
1491
+ style: { "--split-at": `var(--split-pane-end-${String(w)})` },
1492
+ onChange: (B, x) => {
1493
+ u !== void 0 && h(($) => {
1494
+ const z = [...$];
1495
+ return z[w] = B, z;
1496
+ }), N(!x), s == null || s(w, B, x);
1497
+ }
1498
+ },
1499
+ _.label
1500
+ );
1501
+ }) : null
1467
1502
  ]
1468
1503
  }
1469
1504
  );
1470
1505
  }
1471
- const yn = { attachment: "Has an attachment", unread: "Unread" };
1472
- function nl({ from: n, subject: l, preview: t, time: d, unread: c, hasAttachment: r, selected: m, onOpen: s, check: h, selecting: b, labels: o }) {
1473
- const u = de(yn, o), a = /* @__PURE__ */ e(ge, { name: n, size: 40 });
1474
- return /* @__PURE__ */ i("div", { className: T("cms-mail-row", c && "is-unread", m && "is-selected", b && "is-selecting", (h == null ? void 0 : h.checked) && "is-checked"), children: [
1475
- h !== void 0 ? /* @__PURE__ */ i("span", { className: "cms-mail-row__lead", children: [
1476
- a,
1506
+ const Dn = { attachment: "Has an attachment", unread: "Unread" };
1507
+ function ul({ from: n, subject: l, preview: t, time: i, unread: c, hasAttachment: s, selected: u, onOpen: a, check: m, selecting: v, labels: d }) {
1508
+ const f = ge(Dn, d), r = /* @__PURE__ */ e(ye, { name: n, size: 40 });
1509
+ return /* @__PURE__ */ o("div", { className: L("cms-mail-row", c && "is-unread", u && "is-selected", v && "is-selecting", (m == null ? void 0 : m.checked) && "is-checked"), children: [
1510
+ m !== void 0 ? /* @__PURE__ */ o("span", { className: "cms-mail-row__lead", children: [
1511
+ r,
1477
1512
  /* @__PURE__ */ e(
1478
1513
  "input",
1479
1514
  {
1480
1515
  type: "checkbox",
1481
1516
  className: "cms-mail-row__check",
1482
- checked: h.checked,
1483
- disabled: h.disabled,
1484
- "aria-disabled": h.pending ? "true" : void 0,
1485
- "aria-busy": h.pending ? "true" : void 0,
1486
- "aria-label": h.label,
1517
+ checked: m.checked,
1518
+ disabled: m.disabled,
1519
+ "aria-disabled": m.pending ? "true" : void 0,
1520
+ "aria-busy": m.pending ? "true" : void 0,
1521
+ "aria-label": m.label,
1487
1522
  onChange: () => {
1488
1523
  },
1489
- onClick: (f) => {
1490
- if (f.stopPropagation(), h.pending) {
1491
- f.preventDefault();
1524
+ onClick: (h) => {
1525
+ if (h.stopPropagation(), m.pending) {
1526
+ h.preventDefault();
1492
1527
  return;
1493
1528
  }
1494
- h.onCheck({ shift: f.shiftKey, toggle: f.ctrlKey || f.metaKey });
1529
+ m.onCheck({ shift: h.shiftKey, toggle: h.ctrlKey || h.metaKey });
1495
1530
  }
1496
1531
  }
1497
1532
  )
1498
1533
  ] }) : null,
1499
- /* @__PURE__ */ i(
1534
+ /* @__PURE__ */ o(
1500
1535
  "button",
1501
1536
  {
1502
1537
  type: "button",
1503
1538
  className: "cms-mail-row__open",
1504
- "aria-current": m ? "true" : void 0,
1505
- onClick: s,
1539
+ "aria-current": u ? "true" : void 0,
1540
+ onClick: a,
1506
1541
  children: [
1507
- h === void 0 ? a : null,
1508
- /* @__PURE__ */ i("span", { className: "cms-mail-row__body", children: [
1509
- /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
1542
+ m === void 0 ? r : null,
1543
+ /* @__PURE__ */ o("span", { className: "cms-mail-row__body", children: [
1544
+ /* @__PURE__ */ o("span", { className: "cms-mail-row__line", children: [
1510
1545
  /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: n }),
1511
- r ? /* @__PURE__ */ e(A, { name: "paperclip", size: 16, label: u.attachment }) : null,
1512
- /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: d })
1546
+ s ? /* @__PURE__ */ e(D, { name: "paperclip", size: 16, label: f.attachment }) : null,
1547
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: i })
1513
1548
  ] }),
1514
- /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
1549
+ /* @__PURE__ */ o("span", { className: "cms-mail-row__line", children: [
1515
1550
  /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: l }),
1516
- c ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": u.unread }) : null
1551
+ c ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": f.unread }) : null
1517
1552
  ] }),
1518
1553
  /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: t })
1519
1554
  ] })
@@ -1522,49 +1557,49 @@ function nl({ from: n, subject: l, preview: t, time: d, unread: c, hasAttachment
1522
1557
  )
1523
1558
  ] });
1524
1559
  }
1525
- function ll({ direction: n, children: l, time: t, read: d, readLabel: c = "Read" }) {
1526
- return /* @__PURE__ */ i("div", { className: T("cms-bubble", `cms-bubble--${n}`), children: [
1560
+ function ml({ direction: n, children: l, time: t, read: i, readLabel: c = "Read" }) {
1561
+ return /* @__PURE__ */ o("div", { className: L("cms-bubble", `cms-bubble--${n}`), children: [
1527
1562
  /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: l }),
1528
- /* @__PURE__ */ i("div", { className: "cms-bubble__meta", children: [
1563
+ /* @__PURE__ */ o("div", { className: "cms-bubble__meta", children: [
1529
1564
  t,
1530
- n === "out" && d ? /* @__PURE__ */ i(M, { children: [
1565
+ n === "out" && i ? /* @__PURE__ */ o(E, { children: [
1531
1566
  " · ",
1532
1567
  c
1533
1568
  ] }) : null
1534
1569
  ] })
1535
1570
  ] });
1536
1571
  }
1537
- function tl({ label: n, value: l, onChange: t, onSend: d, onAttach: c, placeholder: r, variant: m = "chat", sendLabel: s = "Send", attachLabel: h = "Attach a file", leading: b, canSend: o }) {
1538
- const u = Y(), a = o ?? l.trim() !== "", f = (_) => {
1539
- _.preventDefault(), a && d();
1540
- }, p = c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": h, onClick: c, children: /* @__PURE__ */ e(A, { name: "paperclip" }) }) : null;
1541
- return /* @__PURE__ */ i("form", { className: T("cms-composer", `cms-composer--${m}`), onSubmit: f, children: [
1542
- /* @__PURE__ */ e("label", { htmlFor: u, className: m === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: n }),
1543
- m === "chat" ? p : null,
1572
+ function hl({ label: n, value: l, onChange: t, onSend: i, onAttach: c, placeholder: s, variant: u = "chat", sendLabel: a = "Send", attachLabel: m = "Attach a file", leading: v, canSend: d }) {
1573
+ const f = Q(), r = d ?? l.trim() !== "", h = (N) => {
1574
+ N.preventDefault(), r && i();
1575
+ }, p = c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": m, onClick: c, children: /* @__PURE__ */ e(D, { name: "paperclip" }) }) : null;
1576
+ return /* @__PURE__ */ o("form", { className: L("cms-composer", `cms-composer--${u}`), onSubmit: h, children: [
1577
+ /* @__PURE__ */ e("label", { htmlFor: f, className: u === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: n }),
1578
+ u === "chat" ? p : null,
1544
1579
  /* @__PURE__ */ e(
1545
1580
  "textarea",
1546
1581
  {
1547
- id: u,
1582
+ id: f,
1548
1583
  className: "cms-composer__input",
1549
- rows: m === "reply" ? 3 : 1,
1550
- placeholder: r,
1584
+ rows: u === "reply" ? 3 : 1,
1585
+ placeholder: s,
1551
1586
  value: l,
1552
- onChange: (_) => t(_.target.value),
1553
- onKeyDown: (_) => {
1554
- _.nativeEvent.isComposing || _.keyCode === 229 || m === "chat" && _.key === "Enter" && !_.shiftKey && (_.preventDefault(), a && d());
1587
+ onChange: (N) => t(N.target.value),
1588
+ onKeyDown: (N) => {
1589
+ N.nativeEvent.isComposing || N.keyCode === 229 || u === "chat" && N.key === "Enter" && !N.shiftKey && (N.preventDefault(), r && i());
1555
1590
  }
1556
1591
  }
1557
1592
  ),
1558
- m === "reply" && b !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-composer__leading", children: b }) : null,
1559
- m === "reply" ? p : null,
1560
- m === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": s, disabled: !a, children: /* @__PURE__ */ e(A, { name: "send" }) }) : /* @__PURE__ */ i("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: !a, children: [
1561
- s,
1593
+ u === "reply" && v !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-composer__leading", children: v }) : null,
1594
+ u === "reply" ? p : null,
1595
+ u === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": a, disabled: !r, children: /* @__PURE__ */ e(D, { name: "send" }) }) : /* @__PURE__ */ o("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: !r, children: [
1596
+ a,
1562
1597
  " ",
1563
- /* @__PURE__ */ e(A, { name: "send", size: 18 })
1598
+ /* @__PURE__ */ e(D, { name: "send", size: 18 })
1564
1599
  ] })
1565
1600
  ] });
1566
1601
  }
1567
- const Ae = {
1602
+ const Pe = {
1568
1603
  incomingAudio: "Incoming audio call",
1569
1604
  incomingVideo: "Incoming video call",
1570
1605
  incomingFrom: (n, l) => `${n} from ${l}`,
@@ -1585,91 +1620,91 @@ const Ae = {
1585
1620
  onCallWith: (n) => `On a call with ${n}`,
1586
1621
  returnToCall: "Return to call"
1587
1622
  };
1588
- function al({ name: n, media: l, onAccept: t, onDecline: d, labels: c }) {
1589
- const r = de(Ae, c), m = l === "video" ? r.incomingVideo : r.incomingAudio;
1590
- return /* @__PURE__ */ i("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": r.incomingFrom(m, n), children: [
1591
- /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(ge, { name: n, size: 112 }) }),
1623
+ function fl({ name: n, media: l, onAccept: t, onDecline: i, labels: c }) {
1624
+ const s = ge(Pe, c), u = l === "video" ? s.incomingVideo : s.incomingAudio;
1625
+ return /* @__PURE__ */ o("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": s.incomingFrom(u, n), children: [
1626
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(ye, { name: n, size: 112 }) }),
1592
1627
  /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: n }),
1593
- /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: m }),
1594
- /* @__PURE__ */ i("div", { className: "cms-call-incoming__actions", children: [
1595
- /* @__PURE__ */ e(se, { icon: "phone-off", label: r.decline, tone: "hang-up", onClick: d }),
1596
- /* @__PURE__ */ e(se, { icon: "phone", label: r.accept, tone: "accept", onClick: t })
1628
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: u }),
1629
+ /* @__PURE__ */ o("div", { className: "cms-call-incoming__actions", children: [
1630
+ /* @__PURE__ */ e(de, { icon: "phone-off", label: s.decline, tone: "hang-up", onClick: i }),
1631
+ /* @__PURE__ */ e(de, { icon: "phone", label: s.accept, tone: "accept", onClick: t })
1597
1632
  ] })
1598
1633
  ] });
1599
1634
  }
1600
- function se({ icon: n, label: l, onClick: t, tone: d = "plain", pressed: c }) {
1601
- return /* @__PURE__ */ i(
1635
+ function de({ icon: n, label: l, onClick: t, tone: i = "plain", pressed: c }) {
1636
+ return /* @__PURE__ */ o(
1602
1637
  "button",
1603
1638
  {
1604
1639
  type: "button",
1605
- className: T("cms-call-button", `cms-call-button--${d}`, c && "is-pressed"),
1640
+ className: L("cms-call-button", `cms-call-button--${i}`, c && "is-pressed"),
1606
1641
  "aria-pressed": c,
1607
1642
  onClick: t,
1608
1643
  children: [
1609
- /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(A, { name: n, size: 24 }) }),
1644
+ /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(D, { name: n, size: 24 }) }),
1610
1645
  /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: l })
1611
1646
  ]
1612
1647
  }
1613
1648
  );
1614
1649
  }
1615
- function sl({ name: n, duration: l, connection: t, you: d, muted: c, speaker: r, onToggleMute: m, onToggleSpeaker: s, onAddPerson: h, onChat: b, onHangUp: o, labels: u }) {
1616
- const a = de(Ae, u);
1617
- return /* @__PURE__ */ i("section", { className: "cms-call-panel", "aria-label": a.callWith(n), children: [
1618
- /* @__PURE__ */ i("div", { className: "cms-call-panel__head", children: [
1619
- /* @__PURE__ */ e(ge, { name: n, size: 64 }),
1620
- /* @__PURE__ */ i("div", { className: "cms-call-panel__who", children: [
1650
+ function pl({ name: n, duration: l, connection: t, you: i, muted: c, speaker: s, onToggleMute: u, onToggleSpeaker: a, onAddPerson: m, onChat: v, onHangUp: d, labels: f }) {
1651
+ const r = ge(Pe, f);
1652
+ return /* @__PURE__ */ o("section", { className: "cms-call-panel", "aria-label": r.callWith(n), children: [
1653
+ /* @__PURE__ */ o("div", { className: "cms-call-panel__head", children: [
1654
+ /* @__PURE__ */ e(ye, { name: n, size: 64 }),
1655
+ /* @__PURE__ */ o("div", { className: "cms-call-panel__who", children: [
1621
1656
  /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: n }),
1622
- /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": a.callTime(l), children: l })
1657
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": r.callTime(l), children: l })
1623
1658
  ] }),
1624
- /* @__PURE__ */ e("span", { className: T("cms-pill", t === "good" ? "cms-pill--success" : "cms-pill--warning"), children: t === "good" ? a.goodConnection : a.poorConnection })
1659
+ /* @__PURE__ */ e("span", { className: L("cms-pill", t === "good" ? "cms-pill--success" : "cms-pill--warning"), children: t === "good" ? r.goodConnection : r.poorConnection })
1625
1660
  ] }),
1626
- /* @__PURE__ */ i("div", { className: "cms-call-panel__you", children: [
1627
- /* @__PURE__ */ e(ge, { name: d.name, size: 36 }),
1628
- /* @__PURE__ */ e("span", { children: a.you }),
1629
- d.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": a.speaking }) : null
1661
+ /* @__PURE__ */ o("div", { className: "cms-call-panel__you", children: [
1662
+ /* @__PURE__ */ e(ye, { name: i.name, size: 36 }),
1663
+ /* @__PURE__ */ e("span", { children: r.you }),
1664
+ i.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": r.speaking }) : null
1630
1665
  ] }),
1631
- /* @__PURE__ */ i("div", { className: "cms-call-panel__controls", children: [
1632
- /* @__PURE__ */ e(se, { icon: "mic", label: c ? a.unmute : a.mute, pressed: c, onClick: m }),
1633
- /* @__PURE__ */ e(se, { icon: "speaker", label: a.speaker, pressed: r, onClick: s }),
1634
- h ? /* @__PURE__ */ e(se, { icon: "user-plus", label: a.addPerson, onClick: h }) : null,
1635
- b ? /* @__PURE__ */ e(se, { icon: "chat", label: a.chat, onClick: b }) : null,
1636
- /* @__PURE__ */ e(se, { icon: "phone-off", label: a.hangUp, tone: "hang-up", onClick: o })
1666
+ /* @__PURE__ */ o("div", { className: "cms-call-panel__controls", children: [
1667
+ /* @__PURE__ */ e(de, { icon: "mic", label: c ? r.unmute : r.mute, pressed: c, onClick: u }),
1668
+ /* @__PURE__ */ e(de, { icon: "speaker", label: r.speaker, pressed: s, onClick: a }),
1669
+ m ? /* @__PURE__ */ e(de, { icon: "user-plus", label: r.addPerson, onClick: m }) : null,
1670
+ v ? /* @__PURE__ */ e(de, { icon: "chat", label: r.chat, onClick: v }) : null,
1671
+ /* @__PURE__ */ e(de, { icon: "phone-off", label: r.hangUp, tone: "hang-up", onClick: d })
1637
1672
  ] })
1638
1673
  ] });
1639
1674
  }
1640
- function rl({ name: n, duration: l, muted: t, onToggleMute: d, onReturn: c, onHangUp: r, labels: m }) {
1641
- const s = de(Ae, m);
1642
- return /* @__PURE__ */ i("section", { className: "cms-call-bar", "aria-label": s.callWith(n), children: [
1675
+ function bl({ name: n, duration: l, muted: t, onToggleMute: i, onReturn: c, onHangUp: s, labels: u }) {
1676
+ const a = ge(Pe, u);
1677
+ return /* @__PURE__ */ o("section", { className: "cms-call-bar", "aria-label": a.callWith(n), children: [
1643
1678
  /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
1644
- /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: s.onCallWith(n) }),
1679
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: a.onCallWith(n) }),
1645
1680
  /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: l }),
1646
- /* @__PURE__ */ i("span", { className: "cms-call-bar__actions", children: [
1647
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": t ? s.unmute : s.mute, "aria-pressed": t, onClick: d, children: /* @__PURE__ */ e(A, { name: "mic" }) }),
1648
- /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: c, children: s.returnToCall }),
1649
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": s.hangUp, onClick: r, children: /* @__PURE__ */ e(A, { name: "phone-off" }) })
1681
+ /* @__PURE__ */ o("span", { className: "cms-call-bar__actions", children: [
1682
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": t ? a.unmute : a.mute, "aria-pressed": t, onClick: i, children: /* @__PURE__ */ e(D, { name: "mic" }) }),
1683
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: c, children: a.returnToCall }),
1684
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": a.hangUp, onClick: s, children: /* @__PURE__ */ e(D, { name: "phone-off" }) })
1650
1685
  ] })
1651
1686
  ] });
1652
1687
  }
1653
- function cl({ mark: n, product: l, headline: t, lead: d, features: c = [], children: r }) {
1654
- return /* @__PURE__ */ i("div", { className: "cms-signin", children: [
1655
- /* @__PURE__ */ i("aside", { className: "cms-signin__brand", children: [
1656
- /* @__PURE__ */ i("p", { className: "cms-signin__logo", children: [
1688
+ function _l({ mark: n, product: l, headline: t, lead: i, features: c = [], children: s }) {
1689
+ return /* @__PURE__ */ o("div", { className: "cms-signin", children: [
1690
+ /* @__PURE__ */ o("aside", { className: "cms-signin__brand", children: [
1691
+ /* @__PURE__ */ o("p", { className: "cms-signin__logo", children: [
1657
1692
  /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: n }),
1658
1693
  l
1659
1694
  ] }),
1660
- /* @__PURE__ */ i("div", { className: "cms-signin__pitch", children: [
1695
+ /* @__PURE__ */ o("div", { className: "cms-signin__pitch", children: [
1661
1696
  /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: t }),
1662
- /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: d }),
1663
- c.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: c.map((m) => /* @__PURE__ */ i("li", { children: [
1664
- /* @__PURE__ */ e(A, { name: m.icon, size: 18 }),
1665
- m.label
1666
- ] }, m.label)) }) : null
1697
+ /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: i }),
1698
+ c.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: c.map((u) => /* @__PURE__ */ o("li", { children: [
1699
+ /* @__PURE__ */ e(D, { name: u.icon, size: 18 }),
1700
+ u.label
1701
+ ] }, u.label)) }) : null
1667
1702
  ] })
1668
1703
  ] }),
1669
- /* @__PURE__ */ e("main", { className: "cms-signin__form", children: r })
1704
+ /* @__PURE__ */ e("main", { className: "cms-signin__form", children: s })
1670
1705
  ] });
1671
1706
  }
1672
- const wn = {
1707
+ const Ln = {
1673
1708
  title: "Sign in",
1674
1709
  identifier: "Email or username",
1675
1710
  identifierPlaceholder: "name@example.com",
@@ -1681,287 +1716,317 @@ const wn = {
1681
1716
  newHere: "New here?",
1682
1717
  create: "Create an account"
1683
1718
  };
1684
- function il({ server: n, onSubmit: l, forgotHref: t, createHref: d, error: c, busy: r, labels: m }) {
1685
- const s = de(wn, m), h = Y(), [b, o] = E(""), [u, a] = E(""), [f, p] = E(!1);
1686
- return /* @__PURE__ */ i("form", { className: "cms-signin-form", onSubmit: (N) => {
1687
- N.preventDefault(), l(b, u);
1688
- }, "aria-describedby": c ? `${h}-error` : void 0, children: [
1689
- /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: s.title }),
1690
- /* @__PURE__ */ i("p", { className: "cms-signin-form__server", children: [
1691
- /* @__PURE__ */ e(A, { name: "server", size: 18 }),
1719
+ function vl({ server: n, onSubmit: l, forgotHref: t, createHref: i, error: c, busy: s, labels: u }) {
1720
+ const a = ge(Ln, u), m = Q(), [v, d] = A(""), [f, r] = A(""), [h, p] = A(!1);
1721
+ return /* @__PURE__ */ o("form", { className: "cms-signin-form", onSubmit: (k) => {
1722
+ k.preventDefault(), l(v, f);
1723
+ }, "aria-describedby": c ? `${m}-error` : void 0, children: [
1724
+ /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: a.title }),
1725
+ /* @__PURE__ */ o("p", { className: "cms-signin-form__server", children: [
1726
+ /* @__PURE__ */ e(D, { name: "server", size: 18 }),
1692
1727
  n
1693
1728
  ] }),
1694
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${h}-identifier`, children: s.identifier }),
1729
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${m}-identifier`, children: a.identifier }),
1695
1730
  /* @__PURE__ */ e(
1696
1731
  "input",
1697
1732
  {
1698
- id: `${h}-identifier`,
1733
+ id: `${m}-identifier`,
1699
1734
  className: "cms-signin-form__input",
1700
1735
  type: "text",
1701
1736
  autoComplete: "username",
1702
- placeholder: s.identifierPlaceholder,
1703
- value: b,
1704
- onChange: (N) => o(N.target.value),
1737
+ placeholder: a.identifierPlaceholder,
1738
+ value: v,
1739
+ onChange: (k) => d(k.target.value),
1705
1740
  required: !0
1706
1741
  }
1707
1742
  ),
1708
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${h}-password`, children: s.password }),
1709
- /* @__PURE__ */ i("span", { className: "cms-signin-form__password", children: [
1743
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${m}-password`, children: a.password }),
1744
+ /* @__PURE__ */ o("span", { className: "cms-signin-form__password", children: [
1710
1745
  /* @__PURE__ */ e(
1711
1746
  "input",
1712
1747
  {
1713
- id: `${h}-password`,
1748
+ id: `${m}-password`,
1714
1749
  className: "cms-signin-form__input",
1715
- type: f ? "text" : "password",
1750
+ type: h ? "text" : "password",
1716
1751
  autoComplete: "current-password",
1717
- value: u,
1718
- onChange: (N) => a(N.target.value),
1752
+ value: f,
1753
+ onChange: (k) => r(k.target.value),
1719
1754
  required: !0
1720
1755
  }
1721
1756
  ),
1722
- /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": f, onClick: () => p((N) => !N), children: f ? s.hide : s.show })
1757
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": h, onClick: () => p((k) => !k), children: h ? a.hide : a.show })
1723
1758
  ] }),
1724
- t ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: t, children: s.forgot }) : null,
1725
- c ? /* @__PURE__ */ e("p", { id: `${h}-error`, className: "cms-signin-form__error", role: "alert", children: c }) : null,
1726
- /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: r, "aria-busy": r || void 0, children: s.submit }),
1727
- d ? /* @__PURE__ */ i(M, { children: [
1728
- /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: s.newHere }) }),
1729
- /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: d, children: s.create })
1759
+ t ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: t, children: a.forgot }) : null,
1760
+ c ? /* @__PURE__ */ e("p", { id: `${m}-error`, className: "cms-signin-form__error", role: "alert", children: c }) : null,
1761
+ /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: s, "aria-busy": s || void 0, children: a.submit }),
1762
+ i ? /* @__PURE__ */ o(E, { children: [
1763
+ /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: a.newHere }) }),
1764
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: i, children: a.create })
1730
1765
  ] }) : null
1731
1766
  ] });
1732
1767
  }
1733
- const $e = { bare: /* @__PURE__ */ new Set(), hidden: /* @__PURE__ */ new Set() }, Pe = (n, l) => n.size === l.size && [...n].every((t) => l.has(t));
1734
- function kn(n) {
1768
+ const Oe = { bare: /* @__PURE__ */ new Set(), hidden: /* @__PURE__ */ new Set() }, He = (n, l) => n.size === l.size && [...n].every((t) => l.has(t));
1769
+ function $n(n) {
1735
1770
  const l = /* @__PURE__ */ new Map();
1736
1771
  for (const t of n) l.set(t.group, [...l.get(t.group) ?? [], t]);
1737
1772
  return [...l.values()];
1738
1773
  }
1739
- function xn(n) {
1774
+ function In(n) {
1740
1775
  const l = /* @__PURE__ */ new Map();
1741
1776
  for (const t of n) t.overflow !== void 0 && t.overflow !== 0 && l.set(t.overflow, [...l.get(t.overflow) ?? [], t.id]);
1742
- return [...l.entries()].sort(([t], [d]) => t - d).map(([, t]) => t);
1743
- }
1744
- function ol({ label: n, actions: l, onAction: t, status: d, moreLabel: c, leading: r }) {
1745
- const m = I(null), s = I(null), [h, b] = E($e), [o, u] = E(null), [a, f] = E("first"), [p, _] = E(null), [N, y] = E(null), x = kn(l), C = xn(l), S = x.flat(), F = S.filter((g) => g.overflow === 0), R = S.filter((g) => g.overflow !== 0), Q = JSON.stringify([l.map((g) => [g.id, g.label, g.icon, g.group, g.overflow ?? null]), d ?? "", r !== void 0]), G = _e(() => {
1746
- const g = m.current, D = s.current;
1747
- if (g === null || D === null) return;
1748
- const V = getComputedStyle(g), ee = parseFloat(V.columnGap || "0") || 0, L = g.clientWidth - (parseFloat(V.paddingLeft) || 0) - (parseFloat(V.paddingRight) || 0), X = (P) => {
1749
- var O;
1750
- return ((O = D.querySelector(P)) == null ? void 0 : O.getBoundingClientRect().width) ?? 0;
1751
- }, oe = X('[data-measure="leading"]'), ye = X('[data-measure="separator"]'), me = X('[data-measure="more"]'), he = (P, O) => X(`[data-measure="${O ? "full" : "icon"}"][data-measure-action="${CSS.escape(P)}"]`), ne = (P, O) => {
1752
- const J = /* @__PURE__ */ new Set([...F.map((ae) => ae.id), ...O]), re = x.map((ae) => ae.filter((pe) => !J.has(pe.id))).filter((ae) => ae.length > 0), fe = re.flat(), He = fe.length + (re.length - 1) + (J.size > 0 ? 1 : 0) + (oe > 0 ? 1 : 0);
1753
- return oe + fe.reduce((ae, pe) => ae + he(pe.id, !P.has(pe.id)), 0) + ye * Math.max(0, re.length - 1) + (J.size > 0 ? me : 0) + ee * Math.max(0, He - 1);
1754
- }, v = R.filter((P) => !C.some((O) => O.includes(P.id))).map((P) => P.id), k = [...C, ...[...v].reverse().map((P) => [P])];
1755
- let $ = null;
1756
- if (ne(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()) <= L) $ = $e;
1777
+ return [...l.entries()].sort(([t], [i]) => t - i).map(([, t]) => t);
1778
+ }
1779
+ function gl({ label: n, actions: l, onAction: t, status: i, moreLabel: c, leading: s }) {
1780
+ const u = l.filter((b) => b.entries === void 0 || b.entries.length > 0), a = O(null), m = O(null), v = O(null), [d, f] = A(Oe), [r, h] = A(null), [p, N] = A("first"), [k, y] = A(null), [C, M] = A(null), _ = $n(u), w = In(u), T = _.flat(), U = T.filter((b) => b.overflow === 0), B = T.filter((b) => b.overflow !== 0), x = JSON.stringify([u.map((b) => [b.id, b.label, b.icon, b.group, b.overflow ?? null, b.entries !== void 0]), i ?? "", s !== void 0]), $ = _e(() => {
1781
+ const b = a.current, I = m.current;
1782
+ if (b === null || I === null) return;
1783
+ const K = getComputedStyle(b), ne = parseFloat(K.columnGap || "0") || 0, P = b.clientWidth - (parseFloat(K.paddingLeft) || 0) - (parseFloat(K.paddingRight) || 0), G = (F) => {
1784
+ var Z;
1785
+ return ((Z = I.querySelector(F)) == null ? void 0 : Z.getBoundingClientRect().width) ?? 0;
1786
+ }, g = G('[data-measure="leading"]'), S = G('[data-measure="separator"]'), R = G('[data-measure="more"]'), j = (F, Z) => G(`[data-measure="${Z ? "full" : "icon"}"][data-measure-action="${CSS.escape(F)}"]`), fe = (F, Z) => {
1787
+ const le = /* @__PURE__ */ new Set([...U.map((oe) => oe.id), ...Z]), ue = _.map((oe) => oe.filter((we) => !le.has(we.id))).filter((oe) => oe.length > 0), Ne = ue.flat(), We = Ne.length + (ue.length - 1) + (le.size > 0 ? 1 : 0) + (g > 0 ? 1 : 0);
1788
+ return g + Ne.reduce((oe, we) => oe + j(we.id, !F.has(we.id)), 0) + S * Math.max(0, ue.length - 1) + (le.size > 0 ? R : 0) + ne * Math.max(0, We - 1);
1789
+ }, Fe = B.filter((F) => !w.some((Z) => Z.includes(F.id))).map((F) => F.id), Ve = [...w, ...[...Fe].reverse().map((F) => [F])];
1790
+ let pe = null;
1791
+ if (fe(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()) <= P) pe = Oe;
1757
1792
  else {
1758
- const P = /* @__PURE__ */ new Set();
1759
- for (const O of k) {
1760
- for (const J of O) P.add(J);
1761
- if (ne(P, /* @__PURE__ */ new Set()) <= L) {
1762
- $ = { bare: P, hidden: /* @__PURE__ */ new Set() };
1793
+ const F = /* @__PURE__ */ new Set();
1794
+ for (const Z of Ve) {
1795
+ for (const le of Z) F.add(le);
1796
+ if (fe(F, /* @__PURE__ */ new Set()) <= P) {
1797
+ pe = { bare: F, hidden: /* @__PURE__ */ new Set() };
1763
1798
  break;
1764
1799
  }
1765
1800
  }
1766
1801
  }
1767
- if ($ === null) {
1768
- const P = new Set(R.map((J) => J.id)), O = /* @__PURE__ */ new Set();
1769
- for (const J of C) {
1770
- for (const re of J) R.some((fe) => fe.id === re) && O.add(re);
1771
- if (O.size >= 2 && ne(P, O) <= L) break;
1802
+ if (pe === null) {
1803
+ const F = new Set(B.map((le) => le.id)), Z = /* @__PURE__ */ new Set();
1804
+ for (const le of w) {
1805
+ for (const ue of le) B.some((Ne) => Ne.id === ue) && Z.add(ue);
1806
+ if (Z.size >= 2 && fe(F, Z) <= P) break;
1772
1807
  }
1773
- if (ne(P, O) > L) {
1774
- for (const J of [...v].reverse())
1775
- if (O.add(J), ne(P, O) <= L) break;
1808
+ if (fe(F, Z) > P) {
1809
+ for (const le of [...Fe].reverse())
1810
+ if (Z.add(le), fe(F, Z) <= P) break;
1776
1811
  }
1777
- $ = { bare: P, hidden: O };
1812
+ pe = { bare: F, hidden: Z };
1778
1813
  }
1779
- const K = $;
1780
- b((P) => Pe(P.bare, K.bare) && Pe(P.hidden, K.hidden) ? P : K);
1781
- }, [Q]);
1782
- Ne(G, [G]), q(() => {
1783
- const g = m.current;
1784
- if (g === null || typeof ResizeObserver > "u") return;
1785
- const D = new ResizeObserver(() => G());
1786
- return D.observe(g), () => D.disconnect();
1787
- }, [G]);
1788
- const w = /* @__PURE__ */ new Set([...F.map((g) => g.id), ...h.hidden]), Z = x.map((g) => g.filter((D) => !w.has(D.id))).filter((g) => g.length > 0).flat(), z = [
1789
- ...F,
1790
- ...C.flat().map((g) => S.find((D) => D.id === g)).filter((g) => g !== void 0 && h.hidden.has(g.id)),
1814
+ const xe = pe;
1815
+ f((F) => He(F.bare, xe.bare) && He(F.hidden, xe.hidden) ? F : xe);
1816
+ }, [x]);
1817
+ ve($, [$]), J(() => {
1818
+ const b = a.current;
1819
+ if (b === null || typeof ResizeObserver > "u") return;
1820
+ const I = new ResizeObserver(() => $());
1821
+ return I.observe(b), () => I.disconnect();
1822
+ }, [$]);
1823
+ const z = /* @__PURE__ */ new Set([...U.map((b) => b.id), ...d.hidden]), H = _.map((b) => b.filter((I) => !z.has(I.id))).filter((b) => b.length > 0).flat(), Y = [
1824
+ ...U,
1825
+ ...w.flat().map((b) => T.find((I) => I.id === b)).filter((b) => b !== void 0 && d.hidden.has(b.id)),
1791
1826
  // The pinned that a row too narrow for them sent behind ..., in the row's order.
1792
- ...R.filter((g) => h.hidden.has(g.id) && !C.some((D) => D.includes(g.id)))
1793
- ], H = new Set(R.filter((g) => !C.some((D) => D.includes(g.id))).map((g) => g.id)), W = [...Z.map((g) => g.id), ...z.length > 0 ? ["more"] : []], j = p !== null && W.includes(p) ? p : W[0] ?? null, ie = (g) => {
1794
- var L, X;
1795
- const D = W.indexOf(j ?? "");
1796
- let V = null;
1797
- if (g.key === "ArrowRight" ? V = Math.min(W.length - 1, D + 1) : g.key === "ArrowLeft" ? V = Math.max(0, D - 1) : g.key === "Home" ? V = 0 : g.key === "End" ? V = W.length - 1 : g.key === "Escape" && y(j), V === null) return;
1798
- g.preventDefault();
1799
- const ee = W[V] ?? null;
1800
- _(ee), (X = (L = m.current) == null ? void 0 : L.querySelector(`[data-stop="${CSS.escape(ee ?? "")}"]`)) == null || X.focus();
1801
- }, ue = z.map((g) => ({
1802
- id: g.id,
1803
- label: /* @__PURE__ */ i(M, { children: [
1804
- /* @__PURE__ */ e(be, { name: g.icon }),
1805
- g.label
1827
+ ...B.filter((b) => d.hidden.has(b.id) && !w.some((I) => I.includes(b.id)))
1828
+ ], X = new Set(B.filter((b) => !w.some((I) => I.includes(b.id))).map((b) => b.id)), ee = [...H.map((b) => b.id), ...Y.length > 0 ? ["more"] : []], te = k !== null && ee.includes(k) ? k : ee[0] ?? null, q = (b) => {
1829
+ var P, G;
1830
+ const I = ee.indexOf(te ?? "");
1831
+ let K = null;
1832
+ if (b.key === "ArrowRight" ? K = Math.min(ee.length - 1, I + 1) : b.key === "ArrowLeft" ? K = Math.max(0, I - 1) : b.key === "Home" ? K = 0 : b.key === "End" ? K = ee.length - 1 : b.key === "Escape" && M(te), K === null) return;
1833
+ b.preventDefault();
1834
+ const ne = ee[K] ?? null;
1835
+ y(ne), (G = (P = a.current) == null ? void 0 : P.querySelector(`[data-stop="${CSS.escape(ne ?? "")}"]`)) == null || G.focus();
1836
+ }, ae = Y.map((b) => ({
1837
+ id: b.id,
1838
+ label: /* @__PURE__ */ o(E, { children: [
1839
+ /* @__PURE__ */ e(be, { name: b.icon }),
1840
+ b.label
1841
+ ] }),
1842
+ offer: b.disabled ? { offered: !0, locked: !1, refusal: b.reason ?? "" } : { offered: !0, locked: !1 },
1843
+ ...b.danger ? { danger: !0 } : {},
1844
+ onSelect: () => {
1845
+ var K;
1846
+ if (b.disabled || b.busy) return;
1847
+ if (b.entries === void 0) {
1848
+ t(b.id);
1849
+ return;
1850
+ }
1851
+ const I = (K = v.current) == null ? void 0 : K.getBoundingClientRect();
1852
+ N("first"), h({ which: b.id, x: (I == null ? void 0 : I.left) ?? 0, y: (I == null ? void 0 : I.bottom) ?? 0 });
1853
+ }
1854
+ })), se = r === null || r.which === "more" ? void 0 : T.find((b) => b.id === r.which), ke = ((se == null ? void 0 : se.entries) ?? []).map((b) => ({
1855
+ id: b.id,
1856
+ label: /* @__PURE__ */ o(E, { children: [
1857
+ b.icon !== void 0 ? /* @__PURE__ */ e(be, { name: b.icon }) : null,
1858
+ b.label
1806
1859
  ] }),
1807
- offer: g.disabled ? { offered: !0, locked: !1, refusal: g.reason ?? "" } : { offered: !0, locked: !1 },
1808
- ...g.danger ? { danger: !0 } : {},
1860
+ offer: b.disabled ? { offered: !0, locked: !1, refusal: b.reason ?? "" } : { offered: !0, locked: !1 },
1861
+ ...b.danger ? { danger: !0 } : {},
1809
1862
  onSelect: () => {
1810
- !g.disabled && !g.busy && t(g.id);
1863
+ b.disabled || t(b.id);
1811
1864
  }
1812
- }));
1813
- return /* @__PURE__ */ i(
1865
+ })), re = (b, I, K) => {
1866
+ const ne = I.getBoundingClientRect();
1867
+ N(K), h({ which: b, x: ne.left, y: ne.bottom });
1868
+ };
1869
+ return /* @__PURE__ */ o(
1814
1870
  "div",
1815
1871
  {
1816
- ref: m,
1872
+ ref: a,
1817
1873
  role: "toolbar",
1818
1874
  "aria-label": n,
1819
- className: T(
1875
+ className: L(
1820
1876
  "cms-pane-toolbar",
1821
- R.length > 0 && h.bare.size >= R.length && "cms-pane-toolbar--labels-hidden",
1822
- h.bare.size > 0 && h.bare.size < R.length && "cms-pane-toolbar--labels-partly-hidden"
1877
+ B.length > 0 && d.bare.size >= B.length && "cms-pane-toolbar--labels-hidden",
1878
+ d.bare.size > 0 && d.bare.size < B.length && "cms-pane-toolbar--labels-partly-hidden"
1823
1879
  ),
1824
- onKeyDown: ie,
1880
+ onKeyDown: q,
1825
1881
  children: [
1826
- r !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__leading", children: r }) : null,
1827
- x.map((g, D) => {
1828
- const V = g.filter((L) => !w.has(L.id)), ee = x.slice(0, D).some((L) => L.some((X) => !w.has(X.id)));
1829
- return /* @__PURE__ */ i("div", { className: "cms-pane-toolbar__group-wrap", children: [
1830
- V.length > 0 && ee ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__separator", role: "separator", "aria-orientation": "vertical" }) : null,
1831
- /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__group", hidden: V.length === 0, children: g.map((L) => /* @__PURE__ */ e(
1832
- Mn,
1882
+ s !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__leading", children: s }) : null,
1883
+ _.map((b, I) => {
1884
+ const K = b.filter((P) => !z.has(P.id)), ne = _.slice(0, I).some((P) => P.some((G) => !z.has(G.id)));
1885
+ return /* @__PURE__ */ o("div", { className: "cms-pane-toolbar__group-wrap", children: [
1886
+ K.length > 0 && ne ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__separator", role: "separator", "aria-orientation": "vertical" }) : null,
1887
+ /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__group", hidden: K.length === 0, children: b.map((P) => /* @__PURE__ */ e(
1888
+ Pn,
1833
1889
  {
1834
- action: L,
1835
- labels: !h.bare.has(L.id),
1836
- overflowed: w.has(L.id),
1837
- pinned: H.has(L.id),
1838
- tabbable: j === L.id,
1839
- tipOff: N === L.id,
1840
- onChoose: () => t(L.id),
1890
+ action: P,
1891
+ labels: !d.bare.has(P.id),
1892
+ overflowed: z.has(P.id),
1893
+ pinned: X.has(P.id),
1894
+ tabbable: te === P.id,
1895
+ tipOff: C === P.id,
1896
+ menuOpen: (r == null ? void 0 : r.which) === P.id,
1897
+ onChoose: (G, g) => {
1898
+ P.entries === void 0 ? t(P.id) : (r == null ? void 0 : r.which) === P.id && g === null ? h(null) : re(P.id, G, g ?? "first");
1899
+ },
1841
1900
  onFocus: () => {
1842
- _(L.id), y(null);
1901
+ y(P.id), M(null);
1843
1902
  }
1844
1903
  },
1845
- L.id
1904
+ P.id
1846
1905
  )) })
1847
- ] }, D);
1906
+ ] }, I);
1848
1907
  }),
1849
- z.length > 0 ? /* @__PURE__ */ e(
1908
+ Y.length > 0 ? /* @__PURE__ */ e(
1850
1909
  "button",
1851
1910
  {
1911
+ ref: v,
1852
1912
  type: "button",
1853
1913
  className: "cms-icon-button cms-pane-toolbar__more",
1854
1914
  "data-stop": "more",
1855
1915
  "aria-label": c,
1856
1916
  title: c,
1857
1917
  "aria-haspopup": "menu",
1858
- "aria-expanded": o !== null,
1859
- tabIndex: j === "more" ? 0 : -1,
1860
- onFocus: () => _("more"),
1861
- onClick: (g) => {
1862
- const D = g.currentTarget.getBoundingClientRect();
1863
- f("first"), u(o === null ? { x: D.left, y: D.bottom } : null);
1918
+ "aria-expanded": (r == null ? void 0 : r.which) === "more",
1919
+ tabIndex: te === "more" ? 0 : -1,
1920
+ onFocus: () => y("more"),
1921
+ onClick: (b) => {
1922
+ (r == null ? void 0 : r.which) === "more" ? h(null) : re("more", b.currentTarget, "first");
1864
1923
  },
1865
- onKeyDown: (g) => {
1866
- if (g.key === "ArrowDown" || g.key === "ArrowUp") {
1867
- g.preventDefault(), g.stopPropagation();
1868
- const D = g.currentTarget.getBoundingClientRect();
1869
- f(g.key === "ArrowUp" ? "last" : "first"), u({ x: D.left, y: D.bottom });
1870
- }
1924
+ onKeyDown: (b) => {
1925
+ (b.key === "ArrowDown" || b.key === "ArrowUp") && (b.preventDefault(), b.stopPropagation(), re("more", b.currentTarget, b.key === "ArrowUp" ? "last" : "first"));
1871
1926
  },
1872
- children: /* @__PURE__ */ e(A, { name: "more" })
1927
+ children: /* @__PURE__ */ e(D, { name: "more" })
1873
1928
  }
1874
1929
  ) : null,
1875
- d !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__status", title: d, children: d }) : null,
1876
- /* @__PURE__ */ e(ve, { at: o, items: ue, onClose: () => u(null), label: c, focus: a }),
1877
- /* @__PURE__ */ i("div", { ref: s, className: "cms-pane-toolbar__measure", "aria-hidden": "true", children: [
1878
- r !== void 0 ? /* @__PURE__ */ e("div", { "data-measure": "leading", children: r }) : null,
1930
+ i !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__status", title: i, children: i }) : null,
1931
+ /* @__PURE__ */ e(he, { at: (r == null ? void 0 : r.which) === "more" ? r : null, items: ae, onClose: () => h(null), label: c, focus: p }),
1932
+ /* @__PURE__ */ e(he, { at: se !== void 0 ? r : null, items: ke, onClose: () => h(null), label: (se == null ? void 0 : se.label) ?? "", focus: p }),
1933
+ /* @__PURE__ */ o("div", { ref: m, className: "cms-pane-toolbar__measure", "aria-hidden": "true", children: [
1934
+ s !== void 0 ? /* @__PURE__ */ e("div", { "data-measure": "leading", children: s }) : null,
1879
1935
  /* @__PURE__ */ e("span", { "data-measure": "separator", className: "cms-pane-toolbar__separator" }),
1880
- /* @__PURE__ */ e("span", { "data-measure": "more", className: "cms-icon-button cms-pane-toolbar__more", children: /* @__PURE__ */ e(A, { name: "more" }) }),
1881
- S.map((g) => /* @__PURE__ */ i("span", { children: [
1882
- /* @__PURE__ */ i("span", { "data-measure": "full", "data-measure-action": g.id, className: "cms-pane-toolbar__action", children: [
1883
- /* @__PURE__ */ e(be, { name: g.icon }),
1884
- /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: g.label })
1936
+ /* @__PURE__ */ e("span", { "data-measure": "more", className: "cms-icon-button cms-pane-toolbar__more", children: /* @__PURE__ */ e(D, { name: "more" }) }),
1937
+ T.map((b) => /* @__PURE__ */ o("span", { children: [
1938
+ /* @__PURE__ */ o("span", { "data-measure": "full", "data-measure-action": b.id, className: L("cms-pane-toolbar__action", b.entries !== void 0 && "cms-pane-toolbar__action--menu"), children: [
1939
+ /* @__PURE__ */ e(be, { name: b.icon }),
1940
+ /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: b.label }),
1941
+ b.entries !== void 0 ? /* @__PURE__ */ e(Ae, {}) : null
1885
1942
  ] }),
1886
- /* @__PURE__ */ e("span", { "data-measure": "icon", "data-measure-action": g.id, className: T("cms-pane-toolbar__action", ce(g.icon) !== null && "cms-pane-toolbar__action--bare"), children: ce(g.icon) !== null ? /* @__PURE__ */ e(be, { name: g.icon }) : /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: g.label }) })
1887
- ] }, g.id))
1943
+ /* @__PURE__ */ o("span", { "data-measure": "icon", "data-measure-action": b.id, className: L("cms-pane-toolbar__action", me(b.icon) !== null && "cms-pane-toolbar__action--bare", b.entries !== void 0 && "cms-pane-toolbar__action--menu"), children: [
1944
+ me(b.icon) !== null ? /* @__PURE__ */ e(be, { name: b.icon }) : /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: b.label }),
1945
+ b.entries !== void 0 ? /* @__PURE__ */ e(Ae, {}) : null
1946
+ ] })
1947
+ ] }, b.id))
1888
1948
  ] })
1889
1949
  ]
1890
1950
  }
1891
1951
  );
1892
1952
  }
1893
- function Mn({ action: n, labels: l, overflowed: t, pinned: d, tabbable: c, tipOff: r, onChoose: m, onFocus: s }) {
1894
- const [h, b] = E(!1);
1895
- q(() => {
1953
+ function Pn({ action: n, labels: l, overflowed: t, pinned: i, tabbable: c, tipOff: s, menuOpen: u, onChoose: a, onFocus: m }) {
1954
+ const [v, d] = A(!1);
1955
+ J(() => {
1896
1956
  if (!n.busy) {
1897
- b(!1);
1957
+ d(!1);
1898
1958
  return;
1899
1959
  }
1900
- const y = setTimeout(() => b(!0), ke);
1901
- return () => clearTimeout(y);
1960
+ const M = setTimeout(() => d(!0), Ce);
1961
+ return () => clearTimeout(M);
1902
1962
  }, [n.busy]);
1903
- const o = ce(n.icon) === null, u = l || o, a = n.disabled && n.reason ? n.reason : null, f = a ?? (u ? null : n.label), p = Y(), [_, N] = E(!1);
1904
- return /* @__PURE__ */ i(
1963
+ const f = me(n.icon) === null, r = l || f, h = n.disabled && n.reason ? n.reason : null, p = h ?? (r ? null : n.label), N = Q(), [k, y] = A(!1), C = n.entries !== void 0;
1964
+ return /* @__PURE__ */ o(
1905
1965
  "button",
1906
1966
  {
1907
1967
  type: "button",
1908
- className: T("cms-pane-toolbar__action", !u && "cms-pane-toolbar__action--bare", o && "cms-pane-toolbar__action--text", n.danger && "is-danger"),
1968
+ className: L("cms-pane-toolbar__action", !r && "cms-pane-toolbar__action--bare", f && "cms-pane-toolbar__action--text", C && "cms-pane-toolbar__action--menu", n.danger && "is-danger"),
1909
1969
  "data-action": n.id,
1910
1970
  "data-stop": n.id,
1911
1971
  ...t ? { "data-overflowed": "" } : {},
1912
- ...d ? { "data-pinned": "" } : {},
1972
+ ...i ? { "data-pinned": "" } : {},
1913
1973
  hidden: t,
1914
1974
  "aria-label": n.label,
1915
1975
  "aria-disabled": n.disabled || void 0,
1916
1976
  "aria-busy": n.busy || void 0,
1917
- ...a === null ? {} : { "aria-describedby": p },
1918
- ..._ && a !== null ? { "data-reason-shown": "" } : {},
1977
+ ...C ? { "aria-haspopup": "menu", "aria-expanded": u } : {},
1978
+ ...h === null ? {} : { "aria-describedby": N },
1979
+ ...k && h !== null ? { "data-reason-shown": "" } : {},
1919
1980
  tabIndex: c ? 0 : -1,
1920
- onFocus: s,
1921
- onBlur: () => N(!1),
1922
- onKeyDown: (y) => {
1923
- y.key === "Escape" && N(!1);
1981
+ onFocus: m,
1982
+ onBlur: () => y(!1),
1983
+ onKeyDown: (M) => {
1984
+ M.key === "Escape" && y(!1), C && (M.key === "ArrowDown" || M.key === "ArrowUp") && (M.preventDefault(), h !== null ? y(!0) : !n.disabled && !n.busy && a(M.currentTarget, M.key === "ArrowUp" ? "last" : "first"));
1924
1985
  },
1925
- onClick: () => {
1926
- a !== null ? N(!0) : !n.disabled && !n.busy && m();
1986
+ onClick: (M) => {
1987
+ h !== null ? y(!0) : !n.disabled && !n.busy && a(M.currentTarget, null);
1927
1988
  },
1928
1989
  children: [
1929
- h ? /* @__PURE__ */ e(U, { name: "spinner" }) : /* @__PURE__ */ e(be, { name: n.icon }),
1930
- u ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", "aria-hidden": "true", children: n.label }) : null,
1931
- a !== null || f !== null && !r ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__tip", role: "tooltip", id: p, children: f }) : null
1990
+ v ? /* @__PURE__ */ e(V, { name: "spinner" }) : /* @__PURE__ */ e(be, { name: n.icon }),
1991
+ r ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", "aria-hidden": "true", children: n.label }) : null,
1992
+ C ? /* @__PURE__ */ e(Ae, {}) : null,
1993
+ h !== null || p !== null && !s ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__tip", role: "tooltip", id: N, children: p }) : null
1932
1994
  ]
1933
1995
  }
1934
1996
  );
1935
1997
  }
1998
+ function Ae() {
1999
+ return /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__chevron", "aria-hidden": "true", children: /* @__PURE__ */ e(D, { name: "chevron-down", size: 14 }) });
2000
+ }
1936
2001
  function be({ name: n }) {
1937
- const l = ce(n);
1938
- return l === null ? null : /* @__PURE__ */ e(A, { name: l, size: 18 });
2002
+ const l = me(n);
2003
+ return l === null ? null : /* @__PURE__ */ e(D, { name: l, size: 18 });
1939
2004
  }
1940
- function dl({ title: n, body: l = null, time: t = null, unread: d, unreadLabel: c, expandLabel: r, collapseLabel: m, action: s = null, onRead: h, leading: b }) {
1941
- const [o, u] = E(!1), a = Y(), f = () => {
1942
- d && h();
1943
- }, p = (s == null ? void 0 : s.presentation) === "row" && s.onAction !== void 0, _ = (s == null ? void 0 : s.presentation) === "button" && s.onAction !== void 0 ? s : null, N = () => {
2005
+ function Nl({ title: n, body: l = null, time: t = null, unread: i, unreadLabel: c, expandLabel: s, collapseLabel: u, action: a = null, onRead: m, leading: v }) {
2006
+ const [d, f] = A(!1), r = Q(), h = () => {
2007
+ i && m();
2008
+ }, p = (a == null ? void 0 : a.presentation) === "row" && a.onAction !== void 0, N = (a == null ? void 0 : a.presentation) === "button" && a.onAction !== void 0 ? a : null, k = () => {
1944
2009
  var y;
1945
- f(), p && ((y = s.onAction) == null || y.call(s));
2010
+ h(), p && ((y = a.onAction) == null || y.call(a));
1946
2011
  };
1947
- return /* @__PURE__ */ i("article", { className: T("cms-notification", d && "is-unread", o && "is-expanded", p && "is-row-action"), "data-state": d ? "unread" : "read", children: [
1948
- /* @__PURE__ */ i(
2012
+ return /* @__PURE__ */ o("article", { className: L("cms-notification", i && "is-unread", d && "is-expanded", p && "is-row-action"), "data-state": i ? "unread" : "read", children: [
2013
+ /* @__PURE__ */ o(
1949
2014
  "div",
1950
2015
  {
1951
2016
  className: "cms-notification__row",
1952
2017
  role: "button",
1953
2018
  tabIndex: 0,
1954
- "aria-describedby": l === null ? void 0 : a,
1955
- onClick: N,
2019
+ "aria-describedby": l === null ? void 0 : r,
2020
+ onClick: k,
1956
2021
  onKeyDown: (y) => {
1957
- y.target !== y.currentTarget || y.key !== "Enter" && y.key !== " " || (y.preventDefault(), N());
2022
+ y.target !== y.currentTarget || y.key !== "Enter" && y.key !== " " || (y.preventDefault(), k());
1958
2023
  },
1959
2024
  children: [
1960
- b != null ? /* @__PURE__ */ e("span", { className: "cms-notification__leading", children: b }) : null,
1961
- /* @__PURE__ */ i("span", { className: "cms-notification__text", children: [
1962
- /* @__PURE__ */ i("span", { className: "cms-notification__head", children: [
1963
- /* @__PURE__ */ i("span", { className: "cms-notification__title", children: [
1964
- d ? /* @__PURE__ */ i("span", { className: "cms-visually-hidden", children: [
2025
+ v != null ? /* @__PURE__ */ e("span", { className: "cms-notification__leading", children: v }) : null,
2026
+ /* @__PURE__ */ o("span", { className: "cms-notification__text", children: [
2027
+ /* @__PURE__ */ o("span", { className: "cms-notification__head", children: [
2028
+ /* @__PURE__ */ o("span", { className: "cms-notification__title", children: [
2029
+ i ? /* @__PURE__ */ o("span", { className: "cms-visually-hidden", children: [
1965
2030
  c,
1966
2031
  " "
1967
2032
  ] }) : null,
@@ -1969,9 +2034,9 @@ function dl({ title: n, body: l = null, time: t = null, unread: d, unreadLabel:
1969
2034
  ] }),
1970
2035
  t !== null ? /* @__PURE__ */ e("span", { className: "cms-notification__time", children: t }) : null
1971
2036
  ] }),
1972
- l !== null && l !== "" ? /* @__PURE__ */ e("span", { className: "cms-notification__body", id: a, children: l }) : null
2037
+ l !== null && l !== "" ? /* @__PURE__ */ e("span", { className: "cms-notification__body", id: r, children: l }) : null
1973
2038
  ] }),
1974
- d ? /* @__PURE__ */ e("span", { className: "cms-notification__dot", "aria-hidden": "true" }) : null
2039
+ i ? /* @__PURE__ */ e("span", { className: "cms-notification__dot", "aria-hidden": "true" }) : null
1975
2040
  ]
1976
2041
  }
1977
2042
  ),
@@ -1980,35 +2045,35 @@ function dl({ title: n, body: l = null, time: t = null, unread: d, unreadLabel:
1980
2045
  {
1981
2046
  type: "button",
1982
2047
  className: "cms-notification__chevron",
1983
- "aria-expanded": o,
1984
- "aria-controls": a,
1985
- "aria-label": o ? m : r,
1986
- title: o ? m : r,
2048
+ "aria-expanded": d,
2049
+ "aria-controls": r,
2050
+ "aria-label": d ? u : s,
2051
+ title: d ? u : s,
1987
2052
  onClick: () => {
1988
- o || f(), u((y) => !y);
2053
+ d || h(), f((y) => !y);
1989
2054
  },
1990
- children: /* @__PURE__ */ e(A, { name: "chevron-down", size: 18 })
2055
+ children: /* @__PURE__ */ e(D, { name: "chevron-down", size: 18 })
1991
2056
  }
1992
2057
  ) : null,
1993
- _ !== null ? /* @__PURE__ */ e(
2058
+ N !== null ? /* @__PURE__ */ e(
1994
2059
  "button",
1995
2060
  {
1996
2061
  type: "button",
1997
2062
  className: "cms-button cms-notification__action",
1998
2063
  onClick: () => {
1999
2064
  var y;
2000
- f(), (y = _.onAction) == null || y.call(_);
2065
+ h(), (y = N.onAction) == null || y.call(N);
2001
2066
  },
2002
- children: _.label
2067
+ children: N.label
2003
2068
  }
2004
2069
  ) : null
2005
2070
  ] });
2006
2071
  }
2007
- function Cn(n) {
2072
+ function Fn(n) {
2008
2073
  return n === "allowed" || n === "elevate" || n === "denied";
2009
2074
  }
2010
- function ul(n, l) {
2011
- if (!Cn(n))
2075
+ function wl(n, l) {
2076
+ if (!Fn(n))
2012
2077
  return l.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 };
2013
2078
  switch (n) {
2014
2079
  case "allowed":
@@ -2019,219 +2084,241 @@ function ul(n, l) {
2019
2084
  return l.showRefused ? { offered: !0, locked: !1, refusal: l.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
2020
2085
  }
2021
2086
  }
2022
- function Sn(n, l) {
2087
+ function Bn(n, l) {
2023
2088
  if (!n) return;
2024
2089
  if (typeof n.get == "function") return n.get(l) ?? void 0;
2025
- const t = n, d = Object.keys(t).find((c) => c.toLowerCase() === l.toLowerCase());
2026
- return d === void 0 ? void 0 : t[d];
2090
+ const t = n, i = Object.keys(t).find((c) => c.toLowerCase() === l.toLowerCase());
2091
+ return i === void 0 ? void 0 : t[i];
2027
2092
  }
2028
- function En(n) {
2093
+ function Rn(n) {
2029
2094
  if (n && typeof n == "object") {
2030
2095
  const l = n;
2031
2096
  if (typeof l.detail == "string" && l.detail !== "") return l.detail;
2032
2097
  if (typeof l.title == "string" && l.title !== "") return l.title;
2033
2098
  }
2034
2099
  }
2035
- function ml(n, l, t, d) {
2100
+ function yl(n, l, t, i) {
2036
2101
  if (n !== 403) return { kind: "none" };
2037
- const c = En(t);
2038
- return Sn(l, "X-Elevation-Required") !== void 0 ? d.elevates ? { kind: "elevation-required", message: c ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: c ?? "The server refused this." };
2039
- }
2040
- const Me = "coolms-kit:reread";
2041
- function hl() {
2042
- window.dispatchEvent(new Event(Me));
2043
- }
2044
- function fl(n) {
2045
- const [l, t] = E(void 0), [d, c] = E(void 0), [r, m] = E(!0), s = I(n);
2046
- s.current = n;
2047
- const h = I(0), b = _e(() => {
2048
- const o = ++h.current;
2049
- m(!0), s.current().then(
2050
- (u) => {
2051
- o === h.current && (t(u), c(void 0), m(!1));
2102
+ const c = Rn(t);
2103
+ return Bn(l, "X-Elevation-Required") !== void 0 ? i.elevates ? { kind: "elevation-required", message: c ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: c ?? "The server refused this." };
2104
+ }
2105
+ const Te = "coolms-kit:reread";
2106
+ function kl() {
2107
+ window.dispatchEvent(new Event(Te));
2108
+ }
2109
+ function xl(n) {
2110
+ const [l, t] = A(void 0), [i, c] = A(void 0), [s, u] = A(!0), a = O(n);
2111
+ a.current = n;
2112
+ const m = O(0), v = _e(() => {
2113
+ const d = ++m.current;
2114
+ u(!0), a.current().then(
2115
+ (f) => {
2116
+ d === m.current && (t(f), c(void 0), u(!1));
2052
2117
  },
2053
- (u) => {
2054
- o === h.current && (c(u), m(!1));
2118
+ (f) => {
2119
+ d === m.current && (c(f), u(!1));
2055
2120
  }
2056
2121
  );
2057
2122
  }, []);
2058
- return q(() => {
2059
- b();
2060
- const o = () => b();
2061
- return window.addEventListener("focus", o), window.addEventListener(Me, o), () => {
2062
- window.removeEventListener("focus", o), window.removeEventListener(Me, o);
2123
+ return J(() => {
2124
+ v();
2125
+ const d = () => v();
2126
+ return window.addEventListener("focus", d), window.addEventListener(Te, d), () => {
2127
+ window.removeEventListener("focus", d), window.removeEventListener(Te, d);
2063
2128
  };
2064
- }, [b]), { value: l, error: d, loading: r, reread: b };
2129
+ }, [v]), { value: l, error: i, loading: s, reread: v };
2065
2130
  }
2066
- function pl(n) {
2131
+ function Ml(n) {
2067
2132
  return n === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
2068
2133
  }
2069
- const An = "/errors/client-update-required";
2070
- function Tn(n, l) {
2071
- const t = n.split(".").map((c) => Number.parseInt(c, 10) || 0), d = l.split(".").map((c) => Number.parseInt(c, 10) || 0);
2072
- for (let c = 0; c < Math.max(t.length, d.length); c++) {
2073
- const r = t[c] ?? 0, m = d[c] ?? 0;
2074
- if (r !== m) return r < m;
2134
+ const On = "/errors/client-update-required";
2135
+ function Hn(n, l) {
2136
+ const t = n.split(".").map((c) => Number.parseInt(c, 10) || 0), i = l.split(".").map((c) => Number.parseInt(c, 10) || 0);
2137
+ for (let c = 0; c < Math.max(t.length, i.length); c++) {
2138
+ const s = t[c] ?? 0, u = i[c] ?? 0;
2139
+ if (s !== u) return s < u;
2075
2140
  }
2076
2141
  return !1;
2077
2142
  }
2078
- function bl(n) {
2079
- return n.problemType !== void 0 && n.problemType.endsWith(An) ? !0 : n.minimumVersion !== void 0 && Tn(n.version, n.minimumVersion);
2143
+ function Cl(n) {
2144
+ return n.problemType !== void 0 && n.problemType.endsWith(On) ? !0 : n.minimumVersion !== void 0 && Hn(n.version, n.minimumVersion);
2080
2145
  }
2081
- const Ie = 4, Ln = 48, Dn = 800, $n = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
2082
- function Pn(n, l) {
2083
- const [t, d] = E(!1);
2084
- return q(() => {
2146
+ const Ue = 4, Un = 48, zn = 800, Kn = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
2147
+ function Zn(n, l) {
2148
+ const [t, i] = A(!1);
2149
+ return J(() => {
2085
2150
  const c = n.current;
2086
2151
  if (c === null || !l) {
2087
- d(!1);
2152
+ i(!1);
2088
2153
  return;
2089
2154
  }
2090
- const r = /* @__PURE__ */ new WeakMap();
2091
- let m = Number.NEGATIVE_INFINITY, s = null;
2092
- const h = (a) => {
2093
- m = performance.now(), s = a.target;
2094
- }, b = (a) => {
2095
- const f = a.target;
2096
- !(f instanceof HTMLElement && (f.isContentEditable || f.closest("input, textarea, select") !== null)) && $n.has(a.key) && h(a);
2097
- }, o = (a) => {
2098
- const f = a.target;
2099
- if (!(f instanceof HTMLElement)) return;
2100
- const p = f.scrollTop, _ = r.get(f) ?? 0;
2101
- if (r.set(f, p), p <= 0) {
2102
- d(!1);
2155
+ const s = /* @__PURE__ */ new WeakMap();
2156
+ let u = Number.NEGATIVE_INFINITY, a = null;
2157
+ const m = (r) => {
2158
+ u = performance.now(), a = r.target;
2159
+ }, v = (r) => {
2160
+ const h = r.target;
2161
+ !(h instanceof HTMLElement && (h.isContentEditable || h.closest("input, textarea, select") !== null)) && Kn.has(r.key) && m(r);
2162
+ }, d = (r) => {
2163
+ const h = r.target;
2164
+ if (!(h instanceof HTMLElement)) return;
2165
+ const p = h.scrollTop, N = s.get(h) ?? 0;
2166
+ if (s.set(h, p), p <= 0) {
2167
+ i(!1);
2103
2168
  return;
2104
2169
  }
2105
- performance.now() - m > Dn || !(s === c || s === document.body || s instanceof Node && f.contains(s)) || (p < _ - Ie ? d(!1) : p > _ + Ie && p > Ln && d(!0));
2106
- }, u = [["wheel", h], ["touchmove", h], ["pointerdown", h], ["keydown", b]];
2107
- for (const [a, f] of u) c.addEventListener(a, f, { capture: !0, passive: !0 });
2108
- return c.addEventListener("scroll", o, { capture: !0, passive: !0 }), () => {
2109
- for (const [a, f] of u) c.removeEventListener(a, f, { capture: !0 });
2110
- c.removeEventListener("scroll", o, { capture: !0 });
2170
+ performance.now() - u > zn || !(a === c || a === document.body || a instanceof Node && h.contains(a)) || (p < N - Ue ? i(!1) : p > N + Ue && p > Un && i(!0));
2171
+ }, f = [["wheel", m], ["touchmove", m], ["pointerdown", m], ["keydown", v]];
2172
+ for (const [r, h] of f) c.addEventListener(r, h, { capture: !0, passive: !0 });
2173
+ return c.addEventListener("scroll", d, { capture: !0, passive: !0 }), () => {
2174
+ for (const [r, h] of f) c.removeEventListener(r, h, { capture: !0 });
2175
+ c.removeEventListener("scroll", d, { capture: !0 });
2111
2176
  };
2112
- }, [n, l]), [t, d];
2177
+ }, [n, l]), [t, i];
2113
2178
  }
2114
- function _l({ title: n, back: l, navigation: t, search: d, searching: c, globals: r, filters: m, primary: s, onRefresh: h, pullText: b, barHidden: o, children: u }) {
2115
- const a = I(null), f = I(null), [p, _] = E(!1), [N, y] = E(null), C = hn(f, h === void 0 ? null : () => {
2116
- p || (_(!0), h().finally(() => _(!1)));
2117
- }), S = h === void 0 ? null : { distance: C, refreshing: p, text: b ?? null }, F = c !== void 0 || C > 0 || p, [R, Q] = Pn(a, o === void 0 && !F), G = !F && (o ?? R);
2118
- return /* @__PURE__ */ i(
2179
+ function Sl({ title: n, back: l, navigation: t, search: i, searching: c, more: s = [], moreLabel: u = "More actions", globals: a, filters: m, primary: v, onRefresh: d, pullText: f, barHidden: r, children: h }) {
2180
+ const p = v !== void 0 && "menu" in v && !v.menu.some((q) => q.offer.offered) ? void 0 : v, N = O(null), k = O(null), [y, C] = A(!1), [M, _] = A(null), [w, T] = A(null), U = _e(() => T(null), []), B = O(!1), x = s.some((q) => q.offer.offered), $ = w !== null && x && c === void 0, W = Nn(k, d === void 0 ? null : () => {
2181
+ y || (C(!0), d().finally(() => C(!1)));
2182
+ }), H = d === void 0 ? null : { distance: W, refreshing: y, text: f ?? null }, Y = c !== void 0 || W > 0 || y || $, [X, ee] = Zn(N, r === void 0 && !Y), te = !Y && (r ?? X);
2183
+ return /* @__PURE__ */ o(
2119
2184
  "div",
2120
2185
  {
2121
- ref: a,
2122
- className: T("cms-screen", s !== void 0 && "cms-screen--with-primary"),
2123
- "data-bar-hidden": G ? "" : void 0,
2124
- onFocus: (w) => {
2125
- G && w.target instanceof Element && w.target.closest(".cms-screen__bar, .cms-screen__filters") !== null && Q(!1);
2186
+ ref: N,
2187
+ className: L("cms-screen", p !== void 0 && "cms-screen--with-primary"),
2188
+ "data-bar-hidden": te ? "" : void 0,
2189
+ onFocus: (q) => {
2190
+ te && q.target instanceof Element && q.target.closest(".cms-screen__bar, .cms-screen__filters") !== null && ee(!1);
2126
2191
  },
2127
2192
  children: [
2128
- c !== void 0 ? /* @__PURE__ */ i("header", { className: "cms-screen__bar cms-screen__bar--searching", children: [
2129
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-screen__icon", "aria-label": c.closeLabel, title: c.closeLabel, onClick: c.onClose, children: /* @__PURE__ */ e(A, { name: "chevron-left" }) }),
2193
+ c !== void 0 ? /* @__PURE__ */ o("header", { className: "cms-screen__bar cms-screen__bar--searching", children: [
2194
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-screen__icon", "aria-label": c.closeLabel, title: c.closeLabel, onClick: c.onClose, children: /* @__PURE__ */ e(D, { name: "chevron-left" }) }),
2130
2195
  /* @__PURE__ */ e("div", { className: "cms-screen__search", children: c.field })
2131
- ] }) : /* @__PURE__ */ i("header", { className: "cms-screen__bar", children: [
2132
- /* @__PURE__ */ e("div", { className: "cms-screen__leading", children: l !== void 0 ? l.href !== void 0 ? /* @__PURE__ */ i("a", { className: "cms-screen__back", href: l.href, onClick: l.onBack, children: [
2133
- /* @__PURE__ */ e(A, { name: "chevron-left" }),
2196
+ ] }) : /* @__PURE__ */ o("header", { className: "cms-screen__bar", children: [
2197
+ /* @__PURE__ */ e("div", { className: "cms-screen__leading", children: l !== void 0 ? l.href !== void 0 ? /* @__PURE__ */ o("a", { className: "cms-screen__back", href: l.href, onClick: l.onBack, children: [
2198
+ /* @__PURE__ */ e(D, { name: "chevron-left" }),
2134
2199
  /* @__PURE__ */ e("span", { className: "cms-screen__back-name", children: l.label })
2135
- ] }) : /* @__PURE__ */ i("button", { type: "button", className: "cms-screen__back", onClick: l.onBack, children: [
2136
- /* @__PURE__ */ e(A, { name: "chevron-left" }),
2200
+ ] }) : /* @__PURE__ */ o("button", { type: "button", className: "cms-screen__back", onClick: l.onBack, children: [
2201
+ /* @__PURE__ */ e(D, { name: "chevron-left" }),
2137
2202
  /* @__PURE__ */ e("span", { className: "cms-screen__back-name", children: l.label })
2138
2203
  ] }) : t }),
2139
2204
  /* @__PURE__ */ e("h1", { className: "cms-screen__title", title: n, children: n }),
2140
- /* @__PURE__ */ i("div", { className: "cms-screen__trailing", children: [
2141
- d !== void 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-screen__icon", "aria-label": d.label, title: d.label, onClick: d.onOpen, children: /* @__PURE__ */ e(A, { name: "search" }) }) : null,
2142
- r
2205
+ /* @__PURE__ */ o("div", { className: "cms-screen__trailing", children: [
2206
+ i !== void 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-screen__icon", "aria-label": i.label, title: i.label, onClick: i.onOpen, children: /* @__PURE__ */ e(D, { name: "search" }) }) : null,
2207
+ x ? /* @__PURE__ */ e(
2208
+ "button",
2209
+ {
2210
+ type: "button",
2211
+ className: "cms-icon-button cms-screen__icon",
2212
+ "data-action": "more",
2213
+ "aria-haspopup": "menu",
2214
+ "aria-expanded": $,
2215
+ "aria-label": u,
2216
+ title: u,
2217
+ onMouseDown: () => {
2218
+ B.current = $;
2219
+ },
2220
+ onClick: (q) => {
2221
+ const ae = q.currentTarget.getBoundingClientRect();
2222
+ T(B.current ? null : { x: ae.left, y: ae.bottom + 4 }), B.current = !1;
2223
+ },
2224
+ children: /* @__PURE__ */ e(D, { name: "more" })
2225
+ }
2226
+ ) : null,
2227
+ a
2143
2228
  ] })
2144
2229
  ] }),
2145
- m !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-screen__filters", children: /* @__PURE__ */ e(vn, { label: m.label, options: m.options, value: m.selected, onChange: m.onSelect }) }) : null,
2146
- /* @__PURE__ */ e("div", { ref: f, className: "cms-screen__content", "data-pulling": C > 0 ? "" : void 0, "data-refreshing": p ? "" : void 0, children: /* @__PURE__ */ e(Re.Provider, { value: S, children: u }) }),
2147
- s !== void 0 ? /* @__PURE__ */ e(
2230
+ m !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-screen__filters", children: /* @__PURE__ */ e(An, { label: m.label, options: m.options, value: m.selected, onChange: m.onSelect }) }) : null,
2231
+ /* @__PURE__ */ e("div", { ref: k, className: "cms-screen__content", "data-pulling": W > 0 ? "" : void 0, "data-refreshing": y ? "" : void 0, children: /* @__PURE__ */ e(Ze.Provider, { value: H, children: h }) }),
2232
+ p !== void 0 ? /* @__PURE__ */ e(
2148
2233
  "button",
2149
2234
  {
2150
2235
  type: "button",
2151
2236
  className: "cms-button cms-button--primary cms-screen__primary",
2152
- "aria-label": s.label,
2153
- title: s.label,
2154
- ..."menu" in s ? { "aria-haspopup": "menu", "aria-expanded": N !== null } : {},
2155
- onClick: (w) => {
2156
- if ("menu" in s) {
2157
- const B = w.currentTarget.getBoundingClientRect();
2158
- y(N === null ? { x: B.left, y: B.top } : null);
2237
+ "aria-label": p.label,
2238
+ title: p.label,
2239
+ ..."menu" in p ? { "aria-haspopup": "menu", "aria-expanded": M !== null } : {},
2240
+ onClick: (q) => {
2241
+ if ("menu" in p) {
2242
+ const ae = q.currentTarget.getBoundingClientRect();
2243
+ _(M === null ? { x: ae.left, y: ae.top } : null);
2159
2244
  } else
2160
- s.onPress();
2245
+ p.onPress();
2161
2246
  },
2162
- children: /* @__PURE__ */ e(A, { name: s.icon, size: 24 })
2247
+ children: /* @__PURE__ */ e(D, { name: p.icon, size: 24 })
2163
2248
  }
2164
2249
  ) : null,
2165
- s !== void 0 && "menu" in s ? /* @__PURE__ */ e(ve, { at: N, items: s.menu, onClose: () => y(null), label: s.label }) : null
2250
+ /* @__PURE__ */ e(he, { at: $ ? w : null, items: s, onClose: U, label: u }),
2251
+ p !== void 0 && "menu" in p ? /* @__PURE__ */ e(he, { at: M, items: p.menu, onClose: () => _(null), label: p.label }) : null
2166
2252
  ]
2167
2253
  }
2168
2254
  );
2169
2255
  }
2170
2256
  export {
2171
- Jn as AppShell,
2172
- ge as Avatar,
2173
- Te as BOOTSTRAP_ICONS,
2174
- _n as Badge,
2175
- te as Button,
2176
- Ae as CALL_LABELS,
2177
- An as CLIENT_UPDATE_REQUIRED,
2178
- rl as CallBar,
2179
- sl as CallPanel,
2180
- ll as ChatBubble,
2181
- tl as Composer,
2182
- Un as ConfirmDialog,
2183
- ve as ContextMenu,
2184
- Ye as EmptyState,
2185
- Ge as ErrorBanner,
2186
- jn as FilePicker,
2187
- cn as FilePickerDenied,
2188
- on as FilePickerRestart,
2189
- Wn as FileViewer,
2190
- vn as FilterChips,
2191
- Zn as ICON_NAMES,
2192
- A as Icon,
2193
- al as IncomingCall,
2194
- qn as List,
2195
- qe as Loading,
2196
- yn as MAIL_ROW_LABELS,
2197
- je as MODAL_CLOSE_MS,
2198
- nl as MailRow,
2199
- Be as Modal,
2200
- Je as NamedIcon,
2201
- dl as Notification,
2202
- xe as PULL_AT,
2203
- Gn as PageHeader,
2204
- ol as PaneToolbar,
2205
- wn as SIGN_IN_LABELS,
2206
- ke as STATE_DELAY_MS,
2207
- _l as ScreenShell,
2208
- Qn as SearchField,
2209
- Yn as SectionHeader,
2210
- Kn as Select,
2211
- il as SignInForm,
2212
- cl as SignInLayout,
2213
- el as SplitPanes,
2214
- le as State,
2215
- Xn as TabStrip,
2216
- Hn as TextArea,
2217
- Rn as TextField,
2218
- zn as Toast,
2219
- Vn as ToastRegion,
2220
- On as Toggle,
2221
- gn as fitPanes,
2222
- ce as iconForName,
2223
- pn as initialsOf,
2224
- Cn as isCapability,
2225
- bl as needsClientUpdate,
2226
- ul as offerFor,
2227
- pl as readConflict,
2228
- ml as readRefusal,
2229
- En as refusalText,
2230
- hl as rereadAll,
2231
- bn as tintOf,
2232
- hn as usePull,
2233
- fn as usePullState,
2234
- fl as useReread,
2235
- Tn as versionBelow,
2236
- Ze as writtenOut
2257
+ cl as AppShell,
2258
+ ye as Avatar,
2259
+ Be as BOOTSTRAP_ICONS,
2260
+ En as Badge,
2261
+ ce as Button,
2262
+ Pe as CALL_LABELS,
2263
+ On as CLIENT_UPDATE_REQUIRED,
2264
+ bl as CallBar,
2265
+ pl as CallPanel,
2266
+ ml as ChatBubble,
2267
+ hl as Composer,
2268
+ Jn as ConfirmDialog,
2269
+ he as ContextMenu,
2270
+ ln as EmptyState,
2271
+ tn as ErrorBanner,
2272
+ tl as FilePicker,
2273
+ pn as FilePickerDenied,
2274
+ bn as FilePickerRestart,
2275
+ ll as FileViewer,
2276
+ An as FilterChips,
2277
+ nl as ICON_NAMES,
2278
+ D as Icon,
2279
+ fl as IncomingCall,
2280
+ al as List,
2281
+ nn as Loading,
2282
+ Dn as MAIL_ROW_LABELS,
2283
+ en as MODAL_CLOSE_MS,
2284
+ ul as MailRow,
2285
+ ze as Modal,
2286
+ sn as NamedIcon,
2287
+ Nl as Notification,
2288
+ Se as PULL_AT,
2289
+ rl as PageHeader,
2290
+ gl as PaneToolbar,
2291
+ Ln as SIGN_IN_LABELS,
2292
+ Ce as STATE_DELAY_MS,
2293
+ Sl as ScreenShell,
2294
+ ol as SearchField,
2295
+ sl as SectionHeader,
2296
+ Gn as Select,
2297
+ vl as SignInForm,
2298
+ _l as SignInLayout,
2299
+ dl as SplitPanes,
2300
+ Sn as Splitter,
2301
+ ie as State,
2302
+ il as TabStrip,
2303
+ Yn as TextArea,
2304
+ qn as TextField,
2305
+ Qn as Toast,
2306
+ el as ToastRegion,
2307
+ Xn as Toggle,
2308
+ Tn as fitPanes,
2309
+ me as iconForName,
2310
+ yn as initialsOf,
2311
+ Fn as isCapability,
2312
+ Cl as needsClientUpdate,
2313
+ wl as offerFor,
2314
+ Ml as readConflict,
2315
+ yl as readRefusal,
2316
+ Rn as refusalText,
2317
+ kl as rereadAll,
2318
+ kn as tintOf,
2319
+ Nn as usePull,
2320
+ wn as usePullState,
2321
+ xl as useReread,
2322
+ Hn as versionBelow,
2323
+ Je as writtenOut
2237
2324
  };