@coolms/ui-react 0.1.0-alpha.1 → 0.1.0-alpha.11

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,445 +1,1268 @@
1
- import { jsx as t, jsxs as v, Fragment as S } from "react/jsx-runtime";
2
- import { useId as A, useState as k, useRef as w, useEffect as x, useLayoutEffect as B, useCallback as K } from "react";
3
- import { createPortal as C } from "react-dom";
4
- function _(...e) {
5
- return e.filter(Boolean).join(" ");
6
- }
7
- function N({ name: e }) {
8
- const n = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
9
- switch (e) {
1
+ import { jsx as e, jsxs as s, Fragment as x } from "react/jsx-runtime";
2
+ import { useId as ee, useState as D, useRef as O, useEffect as G, useCallback as _e, useMemo as Ie, useLayoutEffect as Ae } from "react";
3
+ import { createPortal as ke } from "react-dom";
4
+ function re(n, l) {
5
+ const a = { ...n };
6
+ for (const t of Object.keys(l ?? {})) {
7
+ const r = l == null ? void 0 : l[t];
8
+ r !== void 0 && (a[t] = r);
9
+ }
10
+ return a;
11
+ }
12
+ function C(...n) {
13
+ return n.filter(Boolean).join(" ");
14
+ }
15
+ function F({ name: n }) {
16
+ const l = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
17
+ switch (n) {
10
18
  case "lock":
11
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M5 7V5a3 3 0 1 1 6 0v2h.5A1.5 1.5 0 0 1 13 8.5v5A1.5 1.5 0 0 1 11.5 15h-7A1.5 1.5 0 0 1 3 13.5v-5A1.5 1.5 0 0 1 4.5 7H5Zm1.5 0h3V5a1.5 1.5 0 0 0-3 0v2Z" }) });
19
+ return /* @__PURE__ */ e("svg", { ...l, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M5 7V5a3 3 0 1 1 6 0v2h.5A1.5 1.5 0 0 1 13 8.5v5A1.5 1.5 0 0 1 11.5 15h-7A1.5 1.5 0 0 1 3 13.5v-5A1.5 1.5 0 0 1 4.5 7H5Zm1.5 0h3V5a1.5 1.5 0 0 0-3 0v2Z" }) });
12
20
  case "spinner":
13
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph cms-spinner", children: /* @__PURE__ */ t("circle", { cx: "8", cy: "8", r: "6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "28", strokeDashoffset: "10" }) });
21
+ return /* @__PURE__ */ e("svg", { ...l, className: "cms-glyph cms-spinner", children: /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "28", strokeDashoffset: "10" }) });
14
22
  case "back":
15
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M10.7 2.3a1 1 0 0 1 0 1.4L6.4 8l4.3 4.3a1 1 0 0 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 0Z" }) });
23
+ return /* @__PURE__ */ e("svg", { ...l, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M10.7 2.3a1 1 0 0 1 0 1.4L6.4 8l4.3 4.3a1 1 0 0 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 0Z" }) });
16
24
  case "close":
17
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M3.3 3.3a1 1 0 0 1 1.4 0L8 6.6l3.3-3.3a1 1 0 1 1 1.4 1.4L9.4 8l3.3 3.3a1 1 0 0 1-1.4 1.4L8 9.4l-3.3 3.3a1 1 0 0 1-1.4-1.4L6.6 8 3.3 4.7a1 1 0 0 1 0-1.4Z" }) });
25
+ return /* @__PURE__ */ e("svg", { ...l, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M3.3 3.3a1 1 0 0 1 1.4 0L8 6.6l3.3-3.3a1 1 0 1 1 1.4 1.4L9.4 8l3.3 3.3a1 1 0 0 1-1.4 1.4L8 9.4l-3.3 3.3a1 1 0 0 1-1.4-1.4L6.6 8 3.3 4.7a1 1 0 0 1 0-1.4Z" }) });
18
26
  case "warning":
19
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M8.9 1.5a1 1 0 0 0-1.8 0l-6 11A1 1 0 0 0 2 14h12a1 1 0 0 0 .9-1.5l-6-11ZM8 5a1 1 0 0 1 1 1v3a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1Zm0 7.5A1 1 0 1 1 8 10.5a1 1 0 0 1 0 2Z" }) });
27
+ return /* @__PURE__ */ e("svg", { ...l, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8.9 1.5a1 1 0 0 0-1.8 0l-6 11A1 1 0 0 0 2 14h12a1 1 0 0 0 .9-1.5l-6-11ZM8 5a1 1 0 0 1 1 1v3a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1Zm0 7.5A1 1 0 1 1 8 10.5a1 1 0 0 1 0 2Z" }) });
20
28
  case "check":
21
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M13.7 4.3a1 1 0 0 1 0 1.4l-6 6a1 1 0 0 1-1.4 0l-3-3a1 1 0 1 1 1.4-1.4L7 9.6l5.3-5.3a1 1 0 0 1 1.4 0Z" }) });
29
+ return /* @__PURE__ */ e("svg", { ...l, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M13.7 4.3a1 1 0 0 1 0 1.4l-6 6a1 1 0 0 1-1.4 0l-3-3a1 1 0 1 1 1.4-1.4L7 9.6l5.3-5.3a1 1 0 0 1 1.4 0Z" }) });
22
30
  case "info":
23
- return /* @__PURE__ */ t("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ t("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
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" }) });
24
32
  }
25
33
  }
26
- function E({
27
- variant: e = "secondary",
28
- busy: n = !1,
29
- busyLabel: l,
30
- locked: a = !1,
31
- lockedReason: s,
34
+ function Q({
35
+ variant: n = "secondary",
36
+ busy: l = !1,
37
+ busyLabel: a,
38
+ locked: t = !1,
39
+ lockedReason: r,
32
40
  icon: m,
33
- disabled: i,
34
- className: u,
35
- children: d,
36
- type: f = "button",
37
- title: r,
38
- ...o
41
+ disabled: o,
42
+ className: c,
43
+ children: u,
44
+ type: d = "button",
45
+ title: _,
46
+ ...h
39
47
  }) {
40
- const c = !!i || n;
41
- return /* @__PURE__ */ v(
48
+ const i = !!o || l;
49
+ return /* @__PURE__ */ s(
42
50
  "button",
43
51
  {
44
- ...o,
45
- type: f,
46
- className: _("cms-button", `cms-button--${e}`, n && "is-busy", a && "is-locked", u),
47
- disabled: c,
48
- "aria-busy": n || void 0,
49
- title: a ? s ?? r : r,
52
+ ...h,
53
+ type: d,
54
+ className: C("cms-button", `cms-button--${n}`, l && "is-busy", t && "is-locked", c),
55
+ disabled: i,
56
+ "aria-busy": l || void 0,
57
+ title: t ? r ?? _ : _,
50
58
  children: [
51
- n ? /* @__PURE__ */ t(N, { name: "spinner" }) : a ? /* @__PURE__ */ t(N, { name: "lock" }) : m,
52
- /* @__PURE__ */ t("span", { className: "cms-button__label", children: n && l !== void 0 ? l : d }),
53
- a && s ? /* @__PURE__ */ v("span", { className: "cms-visually-hidden", children: [
59
+ l ? /* @__PURE__ */ e(F, { name: "spinner" }) : t ? /* @__PURE__ */ e(F, { name: "lock" }) : m,
60
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: l && a !== void 0 ? a : u }),
61
+ t && r ? /* @__PURE__ */ s("span", { className: "cms-visually-hidden", children: [
54
62
  ", ",
55
- s
63
+ r
56
64
  ] }) : null
57
65
  ]
58
66
  }
59
67
  );
60
68
  }
61
- function L({ id: e, label: n, help: l, error: a, pinned: s, children: m }) {
62
- return /* @__PURE__ */ v("div", { className: _("cms-field", a != null && "is-invalid"), children: [
63
- /* @__PURE__ */ t("label", { className: "cms-field__label", htmlFor: e, children: n }),
69
+ function De({ id: n, label: l, help: a, error: t, pinned: r, children: m }) {
70
+ return /* @__PURE__ */ s("div", { className: C("cms-field", t != null && "is-invalid"), children: [
71
+ /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: n, children: l }),
64
72
  m,
65
- s != null ? /* @__PURE__ */ v("p", { className: "cms-field__pinned", id: `${e}-pinned`, children: [
66
- /* @__PURE__ */ t(N, { name: "lock" }),
73
+ r != null ? /* @__PURE__ */ s("p", { className: "cms-field__pinned", id: `${n}-pinned`, children: [
74
+ /* @__PURE__ */ e(F, { name: "lock" }),
67
75
  " ",
68
- s
76
+ r
69
77
  ] }) : null,
70
- a != null ? /* @__PURE__ */ t("p", { className: "cms-field__error", id: `${e}-error`, role: "alert", children: a }) : null,
71
- l != null ? /* @__PURE__ */ t("p", { className: "cms-field__help", id: `${e}-help`, children: l }) : null
78
+ t != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${n}-error`, role: "alert", children: t }) : null,
79
+ a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${n}-help`, children: a }) : null
72
80
  ] });
73
81
  }
74
- function $(e, n) {
75
- const l = [n.error != null && `${e}-error`, n.pinned != null && `${e}-pinned`, n.help != null && `${e}-help`].filter(Boolean).join(" ");
76
- return l === "" ? void 0 : l;
82
+ function Ee(n, l) {
83
+ const a = [l.error != null && `${n}-error`, l.pinned != null && `${n}-pinned`, l.help != null && `${n}-help`].filter(Boolean).join(" ");
84
+ return a === "" ? void 0 : a;
77
85
  }
78
- function Y({ label: e, help: n, error: l, disabled: a, readOnly: s, pinned: m, value: i, onChange: u, placeholder: d, type: f = "text", name: r }) {
79
- const o = A();
80
- return /* @__PURE__ */ t(L, { id: o, label: e, help: n, error: l, pinned: m, children: /* @__PURE__ */ t(
86
+ function hn({ label: n, help: l, error: a, disabled: t, readOnly: r, pinned: m, value: o, onChange: c, placeholder: u, type: d = "text", name: _ }) {
87
+ const h = ee();
88
+ return /* @__PURE__ */ e(De, { id: h, label: n, help: l, error: a, pinned: m, children: /* @__PURE__ */ e(
81
89
  "input",
82
90
  {
83
- id: o,
84
- name: r,
85
- type: f,
91
+ id: h,
92
+ name: _,
93
+ type: d,
86
94
  className: "cms-input",
87
- value: i,
88
- placeholder: d,
89
- disabled: a,
90
- readOnly: s || m != null,
91
- "aria-invalid": l != null || void 0,
92
- "aria-describedby": $(o, { help: n, error: l, pinned: m }),
93
- onChange: (c) => u == null ? void 0 : u(c.target.value)
95
+ value: o,
96
+ placeholder: u,
97
+ disabled: t,
98
+ readOnly: r || m != null,
99
+ "aria-invalid": a != null || void 0,
100
+ "aria-describedby": Ee(h, { help: l, error: a, pinned: m }),
101
+ onChange: (i) => c == null ? void 0 : c(i.target.value)
94
102
  }
95
103
  ) });
96
104
  }
97
- function J({ label: e, help: n, error: l, disabled: a, readOnly: s, value: m, options: i, onChange: u, emptyText: d = "Nothing to choose from yet.", name: f }) {
98
- const r = A(), o = i.length === 0;
99
- return /* @__PURE__ */ t(L, { id: r, label: e, help: o ? d : n, error: l, children: /* @__PURE__ */ t(
105
+ function pn({ label: n, help: l, error: a, disabled: t, readOnly: r, value: m, options: o, onChange: c, emptyText: u = "Nothing to choose from yet.", name: d }) {
106
+ const _ = ee(), h = o.length === 0;
107
+ return /* @__PURE__ */ e(De, { id: _, label: n, help: h ? u : l, error: a, children: /* @__PURE__ */ e(
100
108
  "select",
101
109
  {
102
- id: r,
103
- name: f,
110
+ id: _,
111
+ name: d,
104
112
  className: "cms-input cms-select",
105
113
  value: m,
106
- disabled: a || o,
107
- "aria-readonly": s || void 0,
108
- "aria-invalid": l != null || void 0,
109
- "aria-describedby": $(r, { help: o ? d : n, error: l }),
110
- onChange: (c) => {
111
- s || u == null || u(c.target.value);
114
+ disabled: t || h,
115
+ "aria-readonly": r || void 0,
116
+ "aria-invalid": a != null || void 0,
117
+ "aria-describedby": Ee(_, { help: h ? u : l, error: a }),
118
+ onChange: (i) => {
119
+ r || c == null || c(i.target.value);
112
120
  },
113
- children: i.map((c) => /* @__PURE__ */ t("option", { value: c.value, disabled: s && c.value !== m, children: c.label }, c.value))
121
+ children: o.map((i) => /* @__PURE__ */ e("option", { value: i.value, disabled: r && i.value !== m, children: i.label }, i.value))
114
122
  }
115
123
  ) });
116
124
  }
117
- function z({ label: e, checked: n, onChange: l, disabled: a, readOnly: s, help: m }) {
118
- const i = A();
119
- return /* @__PURE__ */ v("div", { className: "cms-toggle-row", children: [
120
- /* @__PURE__ */ t(
125
+ function fn({ label: n, checked: l, onChange: a, disabled: t, readOnly: r, help: m }) {
126
+ const o = ee();
127
+ return /* @__PURE__ */ s("div", { className: "cms-toggle-row", children: [
128
+ /* @__PURE__ */ e(
121
129
  "button",
122
130
  {
123
- id: i,
131
+ id: o,
124
132
  type: "button",
125
133
  role: "switch",
126
- className: _("cms-toggle", n && "is-on"),
127
- "aria-checked": n,
128
- "aria-readonly": s || void 0,
129
- "aria-describedby": m != null ? `${i}-help` : void 0,
130
- disabled: a,
134
+ className: C("cms-toggle", l && "is-on"),
135
+ "aria-checked": l,
136
+ "aria-readonly": r || void 0,
137
+ "aria-describedby": m != null ? `${o}-help` : void 0,
138
+ disabled: t,
131
139
  onClick: () => {
132
- s || l == null || l(!n);
140
+ r || a == null || a(!l);
133
141
  },
134
- children: /* @__PURE__ */ t("span", { className: "cms-toggle__thumb" })
142
+ children: /* @__PURE__ */ e("span", { className: "cms-toggle__thumb" })
135
143
  }
136
144
  ),
137
- /* @__PURE__ */ t("label", { className: "cms-toggle__label", htmlFor: i, children: e }),
138
- m != null ? /* @__PURE__ */ t("p", { className: "cms-field__help", id: `${i}-help`, children: m }) : null
145
+ /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: o, children: n }),
146
+ m != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${o}-help`, children: m }) : null
139
147
  ] });
140
148
  }
141
- const Z = 150;
142
- function I({ open: e, title: n, onClose: l, dirty: a = !1, onDirtyClose: s, children: m, footer: i }) {
143
- const [u, d] = k(e), [f, r] = k(!1), o = w(null), c = w(null), g = A();
144
- if (x(() => {
145
- if (e) {
146
- c.current = document.activeElement, d(!0), r(!1);
149
+ const Pe = 150;
150
+ function Le({ open: n, title: l, onClose: a, dirty: t = !1, onDirtyClose: r, children: m, footer: o, closeLabel: c = "Close", initialFocus: u, className: d }) {
151
+ const [_, h] = D(n), [i, v] = D(!1), y = O(null), g = O(null), k = ee();
152
+ if (G(() => {
153
+ if (n) {
154
+ g.current = document.activeElement, h(!0), v(!1);
147
155
  return;
148
156
  }
149
- if (!u) return;
150
- r(!0);
151
- const h = window.setTimeout(() => {
152
- var y, b;
153
- d(!1), r(!1), (b = (y = c.current) == null ? void 0 : y.focus) == null || b.call(y);
154
- }, Z);
155
- return () => window.clearTimeout(h);
156
- }, [e, u]), x(() => {
157
- var h, y;
158
- if (e && u) {
159
- const b = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
160
- (y = ((h = o.current) == null ? void 0 : h.querySelector(`.cms-modal__body :is(${b}), .cms-modal__foot :is(${b})`)) ?? o.current) == null || y.focus();
157
+ if (!_) return;
158
+ v(!0);
159
+ const w = window.setTimeout(() => {
160
+ var S, A;
161
+ h(!1), v(!1), (A = (S = g.current) == null ? void 0 : S.focus) == null || A.call(S);
162
+ }, Pe);
163
+ return () => window.clearTimeout(w);
164
+ }, [n, _]), G(() => {
165
+ var w, S;
166
+ if (n && _) {
167
+ const A = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
168
+ (S = (u == null ? void 0 : u.current) ?? ((w = y.current) == null ? void 0 : w.querySelector(`.cms-modal__body :is(${A}), .cms-modal__foot :is(${A})`)) ?? y.current) == null || S.focus();
161
169
  }
162
- }, [e, u]), !u) return null;
163
- const p = () => {
164
- a ? s == null || s() : l();
170
+ }, [n, _, u]), !_) return null;
171
+ const q = () => {
172
+ t ? r == null || r() : a();
165
173
  };
166
- return C(
167
- /* @__PURE__ */ t("div", { className: _("cms-modal-scrim", f && "is-closing"), onMouseDown: (h) => {
168
- h.target === h.currentTarget && p();
169
- }, children: /* @__PURE__ */ v(
174
+ return ke(
175
+ /* @__PURE__ */ e("div", { className: C("cms-modal-scrim", i && "is-closing"), onMouseDown: (w) => {
176
+ w.target === w.currentTarget && q();
177
+ }, children: /* @__PURE__ */ s(
170
178
  "div",
171
179
  {
172
- ref: o,
173
- className: _("cms-modal", f && "is-closing", a && "is-dirty"),
180
+ ref: y,
181
+ className: C("cms-modal", d, i && "is-closing", t && "is-dirty"),
174
182
  role: "dialog",
175
183
  "aria-modal": "true",
176
- "aria-labelledby": g,
184
+ "aria-labelledby": k,
177
185
  tabIndex: -1,
178
- onKeyDown: (h) => {
179
- var y;
180
- if (h.key === "Escape")
181
- h.stopPropagation(), p();
182
- else if (h.key === "Tab") {
183
- const b = (y = o.current) == null ? void 0 : y.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
184
- if (!b || b.length === 0) return;
185
- const D = b[0], M = b[b.length - 1];
186
- h.shiftKey && document.activeElement === D ? (h.preventDefault(), M.focus()) : !h.shiftKey && document.activeElement === M && (h.preventDefault(), D.focus());
186
+ onKeyDown: (w) => {
187
+ var S;
188
+ if (w.key === "Escape")
189
+ w.stopPropagation(), q();
190
+ else if (w.key === "Tab") {
191
+ const A = (S = y.current) == null ? void 0 : S.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
192
+ if (!A || A.length === 0) return;
193
+ const V = A[0], H = A[A.length - 1];
194
+ w.shiftKey && document.activeElement === V ? (w.preventDefault(), H.focus()) : !w.shiftKey && document.activeElement === H && (w.preventDefault(), V.focus());
187
195
  }
188
196
  },
189
197
  children: [
190
- /* @__PURE__ */ v("header", { className: "cms-modal__head", children: [
191
- /* @__PURE__ */ t("h2", { className: "cms-modal__title", id: g, children: n }),
192
- /* @__PURE__ */ t("button", { type: "button", className: "cms-icon-button", "aria-label": "Close", onClick: p, children: /* @__PURE__ */ t(N, { name: "close" }) })
198
+ /* @__PURE__ */ s("header", { className: "cms-modal__head", children: [
199
+ /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: k, children: l }),
200
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": c, onClick: q, children: /* @__PURE__ */ e(F, { name: "close" }) })
193
201
  ] }),
194
- /* @__PURE__ */ t("div", { className: "cms-modal__body", children: m }),
195
- i != null ? /* @__PURE__ */ t("footer", { className: "cms-modal__foot", children: i }) : null
202
+ /* @__PURE__ */ e("div", { className: "cms-modal__body", children: m }),
203
+ o != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: o }) : null
196
204
  ]
197
205
  }
198
206
  ) }),
199
207
  document.body
200
208
  );
201
209
  }
202
- function O({ open: e, title: n, message: l, kind: a = "default", confirmLabel: s, cancelLabel: m, onConfirm: i, onCancel: u }) {
203
- const d = a === "discard-changes";
204
- return /* @__PURE__ */ t(
205
- I,
210
+ function _n({ open: n, title: l, message: a, kind: t = "default", confirmLabel: r, cancelLabel: m, closeLabel: o, onConfirm: c, onCancel: u }) {
211
+ const d = t === "discard-changes";
212
+ return /* @__PURE__ */ e(
213
+ Le,
206
214
  {
207
- open: e,
208
- title: n,
215
+ open: n,
216
+ title: l,
209
217
  onClose: u,
210
- footer: /* @__PURE__ */ v(S, { children: [
211
- /* @__PURE__ */ t(E, { onClick: u, children: m ?? (d ? "Keep editing" : "Cancel") }),
212
- /* @__PURE__ */ t(E, { variant: a === "default" ? "primary" : "danger", onClick: i, children: s ?? (d ? "Discard changes" : "Confirm") })
218
+ ...o === void 0 ? {} : { closeLabel: o },
219
+ footer: /* @__PURE__ */ s(x, { children: [
220
+ /* @__PURE__ */ e(Q, { onClick: u, children: m ?? (d ? "Keep editing" : "Cancel") }),
221
+ /* @__PURE__ */ e(Q, { variant: t === "default" ? "primary" : "danger", onClick: c, children: r ?? (d ? "Discard changes" : "Confirm") })
213
222
  ] }),
214
- children: a !== "default" ? /* @__PURE__ */ v("p", { className: "cms-confirm__warning", children: [
215
- /* @__PURE__ */ t(N, { name: "warning" }),
223
+ children: t !== "default" ? /* @__PURE__ */ s("p", { className: "cms-confirm__warning", children: [
224
+ /* @__PURE__ */ e(F, { name: "warning" }),
216
225
  " ",
217
- l
218
- ] }) : /* @__PURE__ */ t("p", { children: l })
226
+ a
227
+ ] }) : /* @__PURE__ */ e("p", { children: a })
219
228
  }
220
229
  );
221
230
  }
222
- function ee({ kind: e, message: n, action: l, onDismiss: a }) {
223
- return /* @__PURE__ */ v("div", { className: _("cms-toast", `cms-toast--${e}`), role: e === "error" ? "alert" : "status", children: [
224
- /* @__PURE__ */ t(N, { name: e === "success" ? "check" : e === "error" ? "warning" : "info" }),
225
- /* @__PURE__ */ t("span", { className: "cms-toast__message", children: n }),
226
- l ? /* @__PURE__ */ t(E, { className: "cms-toast__action", onClick: l.onAction, children: l.label }) : null,
227
- a ? /* @__PURE__ */ t("button", { type: "button", className: "cms-icon-button", "aria-label": "Dismiss", onClick: a, children: /* @__PURE__ */ t(N, { name: "close" }) }) : null
231
+ function bn({ kind: n, message: l, action: a, onDismiss: t, dismissLabel: r = "Dismiss" }) {
232
+ return /* @__PURE__ */ s("div", { className: C("cms-toast", `cms-toast--${n}`), role: n === "error" ? "alert" : "status", children: [
233
+ /* @__PURE__ */ e(F, { name: n === "success" ? "check" : n === "error" ? "warning" : "info" }),
234
+ /* @__PURE__ */ e("span", { className: "cms-toast__message", children: l }),
235
+ a ? /* @__PURE__ */ e(Q, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
236
+ t ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": r, onClick: t, children: /* @__PURE__ */ e(F, { name: "close" }) }) : null
228
237
  ] });
229
238
  }
230
- function ne({ children: e }) {
231
- return /* @__PURE__ */ t("div", { className: "cms-toast-region", children: e });
239
+ function vn({ children: n }) {
240
+ return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: n });
232
241
  }
233
- function q({ what: e, layout: n = "inline" }) {
234
- return /* @__PURE__ */ v("div", { className: _("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
235
- /* @__PURE__ */ t(N, { name: "spinner" }),
236
- /* @__PURE__ */ t("span", { children: e })
242
+ function Be({ what: n, layout: l = "inline" }) {
243
+ return /* @__PURE__ */ s("div", { className: C("cms-loading", `cms-loading--${l}`), role: "status", "aria-live": "polite", children: [
244
+ /* @__PURE__ */ e(F, { name: "spinner" }),
245
+ /* @__PURE__ */ e("span", { children: n })
237
246
  ] });
238
247
  }
239
- function F({ title: e, hint: n, action: l }) {
240
- return /* @__PURE__ */ v("div", { className: "cms-empty", children: [
241
- /* @__PURE__ */ t("p", { className: "cms-empty__title", children: e }),
242
- n != null ? /* @__PURE__ */ t("p", { className: "cms-empty__hint", children: n }) : null,
243
- l != null ? /* @__PURE__ */ t("div", { className: "cms-empty__action", children: l }) : null
248
+ function Fe({ title: n, hint: l, action: a }) {
249
+ return /* @__PURE__ */ s("div", { className: "cms-empty", children: [
250
+ /* @__PURE__ */ e("p", { className: "cms-empty__title", children: n }),
251
+ l != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: l }) : null,
252
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: a }) : null
244
253
  ] });
245
254
  }
246
- function R({ message: e, onRetry: n }) {
247
- return /* @__PURE__ */ v("div", { className: "cms-error-banner", role: "alert", children: [
248
- /* @__PURE__ */ t(N, { name: "warning" }),
249
- /* @__PURE__ */ t("span", { className: "cms-error-banner__message", children: e }),
250
- n ? /* @__PURE__ */ t(E, { onClick: n, children: "Try again" }) : null
255
+ function ze({ message: n, onRetry: l, retryLabel: a = "Try again" }) {
256
+ return /* @__PURE__ */ s("div", { className: "cms-error-banner", role: "alert", children: [
257
+ /* @__PURE__ */ e(F, { name: "warning" }),
258
+ /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: n }),
259
+ l ? /* @__PURE__ */ e(Q, { onClick: l, children: a }) : null
251
260
  ] });
252
261
  }
253
- function te({ title: e, scope: n, actions: l, backLink: a }) {
254
- return /* @__PURE__ */ v("header", { className: "cms-page-header", children: [
255
- a ? /* @__PURE__ */ v(
262
+ const ye = 300;
263
+ function Ke() {
264
+ if (typeof window > "u" || typeof getComputedStyle != "function") return ye;
265
+ 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;
266
+ return Number.isFinite(l) && l >= 0 ? l : ye;
267
+ }
268
+ function He() {
269
+ return /* @__PURE__ */ s("svg", { className: "cms-state__spinner", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
270
+ /* @__PURE__ */ e("circle", { className: "cms-state__track", cx: "12", cy: "12", r: "10", fill: "none" }),
271
+ /* @__PURE__ */ e("circle", { className: "cms-state__arc", cx: "12", cy: "12", r: "10", fill: "none", pathLength: "100", strokeDasharray: "28 72" })
272
+ ] });
273
+ }
274
+ function te({ kind: n, title: l, description: a, action: t, placement: r = "block" }) {
275
+ const [m, o] = D(n !== "loading");
276
+ return G(() => {
277
+ if (n !== "loading") {
278
+ o(!0);
279
+ return;
280
+ }
281
+ o(!1);
282
+ const c = window.setTimeout(() => o(!0), Ke());
283
+ return () => window.clearTimeout(c);
284
+ }, [n]), /* @__PURE__ */ s(
285
+ "div",
286
+ {
287
+ className: C("cms-state", `cms-state--${n}`, `cms-state--${r}`, !m && "is-waiting"),
288
+ role: "status",
289
+ "aria-live": "polite",
290
+ "data-kind": n,
291
+ children: [
292
+ n === "loading" ? /* @__PURE__ */ e(He, {}) : null,
293
+ n === "error" || n === "denied" ? /* @__PURE__ */ e(F, { name: n === "error" ? "warning" : "lock" }) : null,
294
+ /* @__PURE__ */ s("span", { className: "cms-state__text", children: [
295
+ /* @__PURE__ */ e("span", { className: "cms-state__title", children: l }),
296
+ a !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-state__description", children: a }) : null
297
+ ] }),
298
+ t !== void 0 && n !== "denied" ? /* @__PURE__ */ e(Q, { className: "cms-state__action", onClick: t.onAction, children: t.label }) : null
299
+ ]
300
+ }
301
+ );
302
+ }
303
+ const $e = {
304
+ mail: /* @__PURE__ */ s(x, { children: [
305
+ /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
306
+ /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
307
+ ] }),
308
+ chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
309
+ 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" }),
310
+ calendar: /* @__PURE__ */ s(x, { children: [
311
+ /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
312
+ /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
313
+ ] }),
314
+ file: /* @__PURE__ */ s(x, { children: [
315
+ /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
316
+ /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
317
+ ] }),
318
+ // The file, with code's angle brackets in place of its lines: a message's source.
319
+ "file-code": /* @__PURE__ */ s(x, { children: [
320
+ /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
321
+ /* @__PURE__ */ e("path", { d: "M14 3v6h6" }),
322
+ /* @__PURE__ */ e("path", { d: "m10 12-2 2.5 2 2.5M14 12l2 2.5-2 2.5" })
323
+ ] }),
324
+ image: /* @__PURE__ */ s(x, { children: [
325
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
326
+ /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
327
+ /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
328
+ ] }),
329
+ search: /* @__PURE__ */ s(x, { children: [
330
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
331
+ /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
332
+ ] }),
333
+ bell: /* @__PURE__ */ s(x, { children: [
334
+ /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
335
+ /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
336
+ ] }),
337
+ pencil: /* @__PURE__ */ s(x, { children: [
338
+ /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
339
+ /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
340
+ ] }),
341
+ download: /* @__PURE__ */ s(x, { children: [
342
+ /* @__PURE__ */ e("path", { d: "M12 4v11" }),
343
+ /* @__PURE__ */ e("path", { d: "m7 11 5 5 5-5" }),
344
+ /* @__PURE__ */ e("path", { d: "M4 20h16" })
345
+ ] }),
346
+ print: /* @__PURE__ */ s(x, { children: [
347
+ /* @__PURE__ */ e("path", { d: "M7 8V4h10v4" }),
348
+ /* @__PURE__ */ e("rect", { x: "3", y: "8", width: "18", height: "8", rx: "2" }),
349
+ /* @__PURE__ */ e("path", { d: "M7 14h10v6H7Z" })
350
+ ] }),
351
+ "open-separately": /* @__PURE__ */ s(x, { children: [
352
+ /* @__PURE__ */ e("path", { d: "M14 4h6v6" }),
353
+ /* @__PURE__ */ e("path", { d: "m20 4-9 9" }),
354
+ /* @__PURE__ */ e("path", { d: "M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5" })
355
+ ] }),
356
+ 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" }),
357
+ send: /* @__PURE__ */ s(x, { children: [
358
+ /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
359
+ /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
360
+ ] }),
361
+ inbox: /* @__PURE__ */ s(x, { children: [
362
+ /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
363
+ /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
364
+ ] }),
365
+ archive: /* @__PURE__ */ s(x, { children: [
366
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
367
+ /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
368
+ ] }),
369
+ trash: /* @__PURE__ */ s(x, { children: [
370
+ /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
371
+ /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
372
+ ] }),
373
+ 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" }),
374
+ mic: /* @__PURE__ */ s(x, { children: [
375
+ /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
376
+ /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
377
+ ] }),
378
+ speaker: /* @__PURE__ */ s(x, { children: [
379
+ /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
380
+ /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
381
+ ] }),
382
+ "user-plus": /* @__PURE__ */ s(x, { children: [
383
+ /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
384
+ /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
385
+ ] }),
386
+ "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" }),
387
+ video: /* @__PURE__ */ s(x, { children: [
388
+ /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
389
+ /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
390
+ ] }),
391
+ info: /* @__PURE__ */ s(x, { children: [
392
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
393
+ /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
394
+ ] }),
395
+ "chevron-down": /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }),
396
+ "chevron-left": /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }),
397
+ plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
398
+ 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" }),
399
+ check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
400
+ server: /* @__PURE__ */ s(x, { children: [
401
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
402
+ /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
403
+ /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
404
+ ] }),
405
+ reply: /* @__PURE__ */ e("path", { d: "M10 8 4 13l6 5M4 13h11a5 5 0 0 1 5 5" }),
406
+ // Reply's mirror: the arrow leaves to the right.
407
+ forward: /* @__PURE__ */ e("path", { d: "m14 8 6 5-6 5M20 13H9a5 5 0 0 0-5 5" }),
408
+ refresh: /* @__PURE__ */ e("path", { d: "M20 11a8 8 0 1 0-2.3 5.7M20 5v6h-6" }),
409
+ more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" }),
410
+ important: /* @__PURE__ */ e("path", { d: "M4 6h11l5 6-5 6H4l4-6-4-6Z" })
411
+ };
412
+ function P({ name: n, size: l = 20, label: a }) {
413
+ return /* @__PURE__ */ e(
414
+ "svg",
415
+ {
416
+ className: "cms-icon",
417
+ width: l,
418
+ height: l,
419
+ viewBox: "0 0 24 24",
420
+ fill: "none",
421
+ stroke: "currentColor",
422
+ strokeWidth: n === "more" ? 3 : 1.75,
423
+ strokeLinecap: "round",
424
+ strokeLinejoin: "round",
425
+ focusable: !1,
426
+ ...a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 },
427
+ children: $e[n]
428
+ }
429
+ );
430
+ }
431
+ const gn = Object.keys($e), Me = {
432
+ reply: "reply",
433
+ "reply-all": "reply",
434
+ forward: "forward",
435
+ envelope: "mail",
436
+ "envelope-open": "mail",
437
+ star: "star",
438
+ "star-fill": "star",
439
+ "folder-symlink": "folder",
440
+ folder: "folder",
441
+ trash: "trash",
442
+ archive: "archive",
443
+ "arrow-clockwise": "refresh",
444
+ download: "download",
445
+ printer: "print",
446
+ "file-earmark-code": "file-code",
447
+ "three-dots": "more"
448
+ };
449
+ function be(n) {
450
+ return Object.prototype.hasOwnProperty.call(Me, n) ? Me[n] : null;
451
+ }
452
+ const Re = 'input, select, textarea, button:not([disabled]), iframe, [href], [tabindex]:not([tabindex="-1"])', Oe = 60;
453
+ function Ze(n) {
454
+ return n instanceof Element && n.closest('input, select, textarea, [contenteditable="true"], [data-viewer-keys]') !== null;
455
+ }
456
+ function Ve(n) {
457
+ return n instanceof Element && n.closest("[data-viewer-gestures]") !== null;
458
+ }
459
+ function Ue(n) {
460
+ return n.getClientRects().length > 0;
461
+ }
462
+ function Nn(n) {
463
+ const { name: l, badge: a, closeLabel: t, onClose: r, actions: m = [], moreLabel: o = "More", edit: c, editing: u, siblings: d, bar: _, thumbnails: h, strip: i, onZoom: v, children: y } = n, g = O(null), k = O(null), q = ee(), [w, S] = D(!1), A = O(null);
464
+ G(() => {
465
+ var U;
466
+ const b = document.activeElement, E = document.body.style.overflow;
467
+ return document.body.style.overflow = "hidden", (U = k.current) == null || U.focus(), () => {
468
+ var Z;
469
+ document.body.style.overflow = E, (Z = b == null ? void 0 : b.focus) == null || Z.call(b);
470
+ };
471
+ }, []);
472
+ const V = () => {
473
+ u != null && u.dirty ? u.onDirtyClose() : r();
474
+ }, H = (b) => {
475
+ const E = b.touches.length === 1 ? b.touches[0] : void 0;
476
+ A.current = E === void 0 || u !== void 0 || Ve(b.target) ? null : { x: E.clientX, y: E.clientY };
477
+ }, ne = (b) => {
478
+ var L, X;
479
+ const E = A.current, U = b.changedTouches[0];
480
+ if (A.current = null, E === null || U === void 0) return;
481
+ const Z = U.clientX - E.x;
482
+ Math.abs(Z) < Oe || Math.abs(Z) < Math.abs(U.clientY - E.y) || (Z > 0 ? (L = d == null ? void 0 : d.onPrevious) == null || L.call(d) : (X = d == null ? void 0 : d.onNext) == null || X.call(d));
483
+ };
484
+ return ke(
485
+ /* @__PURE__ */ s(
486
+ "div",
487
+ {
488
+ ref: g,
489
+ className: C("cms-viewer", u !== void 0 && "is-editing"),
490
+ role: "dialog",
491
+ "aria-modal": "true",
492
+ "aria-labelledby": q,
493
+ tabIndex: -1,
494
+ onKeyDown: (b) => {
495
+ var E, U, Z;
496
+ if (b.key === "Escape") {
497
+ if (u !== void 0) return;
498
+ b.stopPropagation(), w ? S(!1) : r();
499
+ } else if (b.key === "Tab") {
500
+ const L = Array.from(((E = g.current) == null ? void 0 : E.querySelectorAll(Re)) ?? []).filter(Ue);
501
+ if (L.length === 0) return;
502
+ const X = L[0], z = L[L.length - 1];
503
+ b.shiftKey && document.activeElement === X ? (b.preventDefault(), z.focus()) : !b.shiftKey && document.activeElement === z && (b.preventDefault(), X.focus());
504
+ } else u === void 0 && !Ze(b.target) && !b.ctrlKey && !b.metaKey && !b.altKey && (b.key === "ArrowLeft" ? (U = d == null ? void 0 : d.onPrevious) == null || U.call(d) : b.key === "ArrowRight" ? (Z = d == null ? void 0 : d.onNext) == null || Z.call(d) : b.key === "+" || b.key === "=" ? v == null || v("in") : b.key === "-" ? v == null || v("out") : b.key === "0" && (v == null || v("reset")));
505
+ },
506
+ children: [
507
+ d !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${l}, ${d.position}` }) : null,
508
+ /* @__PURE__ */ s("header", { className: "cms-viewer__top", children: [
509
+ /* @__PURE__ */ e("button", { ref: k, type: "button", className: "cms-viewer__icon", "aria-label": t, onClick: V, children: /* @__PURE__ */ e(F, { name: "close" }) }),
510
+ /* @__PURE__ */ e("span", { className: "cms-viewer__badge", children: a }),
511
+ /* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: q, title: l, children: l }),
512
+ d !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-viewer__position", children: d.position }) : null,
513
+ /* @__PURE__ */ e("span", { className: "cms-viewer__space" }),
514
+ u !== void 0 ? /* @__PURE__ */ s(x, { children: [
515
+ /* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: u.status }),
516
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: u.onDone, children: u.doneLabel })
517
+ ] }) : /* @__PURE__ */ s(x, { children: [
518
+ /* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: m.map((b) => /* @__PURE__ */ s("button", { type: "button", className: "cms-viewer__button", onClick: b.onSelect, children: [
519
+ b.icon,
520
+ b.label
521
+ ] }, b.label)) }),
522
+ c !== void 0 ? /* @__PURE__ */ s("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": c.label, onClick: c.onEdit, children: [
523
+ c.icon,
524
+ /* @__PURE__ */ e("span", { className: "cms-viewer__wide", children: c.label })
525
+ ] }) : null,
526
+ m.length > 0 ? /* @__PURE__ */ s("span", { className: "cms-viewer__more", children: [
527
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": o, "aria-expanded": w, onClick: () => S((b) => !b), children: /* @__PURE__ */ e(P, { name: "more" }) }),
528
+ w ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: m.map((b) => /* @__PURE__ */ s(
529
+ "button",
530
+ {
531
+ type: "button",
532
+ className: "cms-viewer__button",
533
+ onClick: () => {
534
+ S(!1), b.onSelect();
535
+ },
536
+ children: [
537
+ b.icon,
538
+ b.label
539
+ ]
540
+ },
541
+ b.label
542
+ )) }) : null
543
+ ] }) : null
544
+ ] })
545
+ ] }),
546
+ /* @__PURE__ */ s("div", { className: "cms-viewer__body", children: [
547
+ h != null && u === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: h }) : null,
548
+ /* @__PURE__ */ s("div", { className: "cms-viewer__content", onTouchStart: H, onTouchEnd: ne, children: [
549
+ y,
550
+ u === void 0 && (d != null && d.onPrevious) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--previous", "aria-label": d.previousLabel, onClick: d.onPrevious, children: /* @__PURE__ */ e(F, { name: "back" }) }) : null,
551
+ u === void 0 && (d != null && d.onNext) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--next", "aria-label": d.nextLabel, onClick: d.onNext, children: /* @__PURE__ */ e(F, { name: "back" }) }) : null,
552
+ u === void 0 && d !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(d.total, 7) }, (b, E) => /* @__PURE__ */ e("i", { className: E === Math.min(d.index, 6) ? "is-current" : void 0 }, E)) }) : null
553
+ ] })
554
+ ] }),
555
+ u === void 0 && i != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: i }) : null,
556
+ _ != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: _ }) : null
557
+ ]
558
+ }
559
+ ),
560
+ document.body
561
+ );
562
+ }
563
+ class We extends Error {
564
+ constructor(l = "denied") {
565
+ super(l), this.name = "FilePickerDenied";
566
+ }
567
+ }
568
+ const Ne = (n, l) => `${n}
569
+ ${l}`, je = (n, l) => n === "" ? l : `${n}/${l}`, qe = 48;
570
+ function yn(n) {
571
+ var me, ue;
572
+ const { open: l, spaces: a, list: t, disabledReason: r, budget: m, formatSize: o, labels: c, onConfirm: u, onCancel: d } = n, [_, h] = D(((me = a[0]) == null ? void 0 : me.id) ?? ""), [i, v] = D(""), [y, g] = D({ status: "loading" }), [k, q] = D(0), [w, S] = D(/* @__PURE__ */ new Map()), [A, V] = D(0), [H, ne] = D(!1), b = O(null), E = ee();
573
+ G(() => {
574
+ var p;
575
+ l && (h(((p = a[0]) == null ? void 0 : p.id) ?? ""), v(""), S(/* @__PURE__ */ new Map()), ne(!1));
576
+ }, [l]), G(() => {
577
+ if (!l || _ === "") return;
578
+ let p = !0;
579
+ return g({ status: "loading" }), V(0), t(_, i).then(
580
+ (N) => p && g({ status: "ready", entries: N.entries, next: N.next ?? null, paging: !1 }),
581
+ (N) => p && g({ status: N instanceof We ? "denied" : "error" })
582
+ ), () => {
583
+ p = !1;
584
+ };
585
+ }, [l, _, i, t, k]);
586
+ const U = _e(() => {
587
+ if (y.status !== "ready" || y.next === null || y.paging) return;
588
+ const p = y.next, N = y.entries;
589
+ g({ ...y, paging: !0 }), t(_, i, p).then(
590
+ (I) => g({ status: "ready", entries: [...N, ...I.entries], next: I.next ?? null, paging: !1 }),
591
+ () => g({ status: "ready", entries: N, next: p, paging: !1 })
592
+ );
593
+ }, [y, t, _, i]), Z = _e((p) => {
594
+ var N;
595
+ return ((N = m == null ? void 0 : m.cost) == null ? void 0 : N.call(m, p)) ?? p.size ?? 0;
596
+ }, [m]), L = Ie(() => [...w.values()], [w]), X = L.reduce((p, N) => p + (N.size ?? 0), 0), z = m === void 0 ? null : m.limitBytes - m.usedBytes - L.reduce((p, N) => p + Z(N), 0), J = z !== null && z < 0, ce = (p) => {
597
+ if (p.kind !== "file") return null;
598
+ const N = r == null ? void 0 : r(p);
599
+ return N || (z !== null && !w.has(Ne(_, p.id)) && Z(p) > z ? c.overBudget : null);
600
+ }, ie = (p) => {
601
+ const N = Ne(_, p.id);
602
+ !w.has(N) && ce(p) !== null || S((I) => {
603
+ const B = new Map(I);
604
+ return B.has(N) ? B.delete(N) : B.set(N, { ...p, space: _, path: i }), B;
605
+ });
606
+ }, f = (p) => v(je(i, p.name)), M = () => v(i.includes("/") ? i.slice(0, i.lastIndexOf("/")) : ""), R = (p) => S((N) => {
607
+ const I = new Map(N);
608
+ return I.delete(p), I;
609
+ }), W = y.status === "ready" ? y.entries : [], $ = (p) => {
610
+ const N = W[A];
611
+ if (p.key === "ArrowDown" || p.key === "ArrowUp" || p.key === "Home" || p.key === "End") {
612
+ p.preventDefault();
613
+ const I = W.length - 1, B = p.key === "Home" ? 0 : p.key === "End" ? I : Math.min(I, Math.max(0, A + (p.key === "ArrowDown" ? 1 : -1)));
614
+ V(B), B >= I - 1 && U();
615
+ } else p.key === "Enter" && (N == null ? void 0 : N.kind) === "folder" ? (p.preventDefault(), f(N)) : p.key === " " && (N == null ? void 0 : N.kind) === "file" ? (p.preventDefault(), ie(N)) : p.key === "Backspace" && i !== "" && (p.preventDefault(), M());
616
+ }, j = i === "" ? [] : i.split("/"), oe = ((ue = a.find((p) => p.id === _)) == null ? void 0 : ue.name) ?? "", de = (p) => `${E}-entry-${String(p)}`;
617
+ return /* @__PURE__ */ s(
618
+ Le,
619
+ {
620
+ open: l,
621
+ title: c.title,
622
+ onClose: d,
623
+ closeLabel: c.close,
624
+ initialFocus: b,
625
+ className: "cms-file-picker",
626
+ footer: /* @__PURE__ */ s("div", { className: "cms-file-picker__foot", children: [
627
+ /* @__PURE__ */ s("div", { className: "cms-file-picker__summary", "aria-live": "polite", children: [
628
+ L.length > 0 ? /* @__PURE__ */ e("span", { children: c.total(L.length, o(X)) }) : null,
629
+ m !== void 0 && z !== null ? /* @__PURE__ */ e("span", { className: C(J && "is-over"), children: J ? c.overBudget : c.left(o(Math.max(0, z)), o(m.limitBytes)) }) : null
630
+ ] }),
631
+ /* @__PURE__ */ s("div", { className: "cms-file-picker__actions", children: [
632
+ /* @__PURE__ */ e(Q, { variant: "secondary", onClick: d, children: c.cancel }),
633
+ /* @__PURE__ */ e(Q, { variant: "primary", disabled: L.length === 0 || J, onClick: () => u(L), children: c.confirm(L.length) })
634
+ ] })
635
+ ] }),
636
+ children: [
637
+ /* @__PURE__ */ s("div", { className: "cms-file-picker__top", children: [
638
+ a.length > 1 ? /* @__PURE__ */ s("label", { className: "cms-file-picker__space", children: [
639
+ /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: c.space }),
640
+ /* @__PURE__ */ e("select", { className: "cms-input cms-select", value: _, onChange: (p) => {
641
+ h(p.target.value), v("");
642
+ }, children: a.map((p) => /* @__PURE__ */ e("option", { value: p.id, children: p.name }, p.id)) })
643
+ ] }) : null,
644
+ /* @__PURE__ */ s("nav", { className: "cms-file-picker__path", "aria-label": c.path, children: [
645
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": c.up, disabled: i === "", onClick: M, children: /* @__PURE__ */ e(P, { name: "chevron-left" }) }),
646
+ /* @__PURE__ */ s("ol", { children: [
647
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": i === "" ? "location" : void 0, onClick: () => v(""), children: oe }) }),
648
+ j.map((p, N) => {
649
+ const I = j.slice(0, N + 1).join("/");
650
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": I === i ? "location" : void 0, onClick: () => v(I), children: p }) }, I);
651
+ })
652
+ ] })
653
+ ] }),
654
+ L.length > 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__chip", "aria-expanded": H, onClick: () => ne((p) => !p), children: c.selected(L.length) }) : null
655
+ ] }),
656
+ H && L.length > 0 ? /* @__PURE__ */ s("div", { className: "cms-file-picker__chosen", children: [
657
+ /* @__PURE__ */ e("ul", { children: [...w.entries()].map(([p, N]) => /* @__PURE__ */ s("li", { children: [
658
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: N.name }),
659
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": c.remove(N.name), onClick: () => R(p), children: /* @__PURE__ */ e(F, { name: "close" }) })
660
+ ] }, p)) }),
661
+ /* @__PURE__ */ e(Q, { variant: "secondary", onClick: () => {
662
+ S(/* @__PURE__ */ new Map()), ne(!1);
663
+ }, children: c.clear })
664
+ ] }) : null,
665
+ /* @__PURE__ */ s("div", { className: "cms-file-picker__list", onScroll: (p) => {
666
+ const N = p.currentTarget;
667
+ N.scrollTop + N.clientHeight >= N.scrollHeight - qe && U();
668
+ }, children: [
669
+ y.status === "loading" ? /* @__PURE__ */ e(te, { kind: "loading", title: c.loading, placement: "block" }) : null,
670
+ y.status === "error" ? /* @__PURE__ */ e(te, { kind: "error", title: c.error, placement: "block", action: { label: c.retry, onAction: () => q((p) => p + 1) } }) : null,
671
+ y.status === "denied" ? /* @__PURE__ */ e(te, { kind: "denied", title: c.denied, placement: "block" }) : null,
672
+ y.status === "ready" && W.length === 0 ? /* @__PURE__ */ e(te, { kind: "empty", title: c.empty, placement: "block" }) : null,
673
+ /* @__PURE__ */ s(
674
+ "div",
675
+ {
676
+ ref: b,
677
+ role: "listbox",
678
+ "aria-multiselectable": "true",
679
+ "aria-label": c.files,
680
+ "aria-activedescendant": W.length > 0 ? de(A) : void 0,
681
+ tabIndex: 0,
682
+ className: "cms-file-picker__entries",
683
+ hidden: y.status !== "ready" || W.length === 0,
684
+ onKeyDown: $,
685
+ children: [
686
+ W.map((p, N) => {
687
+ const I = p.kind === "file" && w.has(Ne(_, p.id)), B = ce(p);
688
+ return /* @__PURE__ */ s(
689
+ "div",
690
+ {
691
+ id: de(N),
692
+ role: "option",
693
+ "aria-selected": p.kind === "file" ? I : void 0,
694
+ "aria-disabled": B !== null || void 0,
695
+ className: C("cms-file-picker__entry", N === A && "is-active", I && "is-ticked", B !== null && "is-disabled"),
696
+ onClick: () => {
697
+ V(N), p.kind === "folder" ? f(p) : ie(p);
698
+ },
699
+ children: [
700
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__tick", "aria-hidden": "true", children: I ? /* @__PURE__ */ e(P, { name: "check" }) : null }),
701
+ /* @__PURE__ */ e(P, { name: p.kind === "folder" ? "folder" : "file" }),
702
+ /* @__PURE__ */ s("span", { className: "cms-file-picker__text", children: [
703
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: p.name }),
704
+ B !== null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__reason", children: B }) : null
705
+ ] }),
706
+ p.kind === "file" && p.size != null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__size", children: o(p.size) }) : null
707
+ ]
708
+ },
709
+ p.id
710
+ );
711
+ }),
712
+ y.status === "ready" && y.paging ? /* @__PURE__ */ e("div", { className: "cms-file-picker__paging", children: /* @__PURE__ */ e(te, { kind: "loading", title: c.loading, placement: "inline" }) }) : null
713
+ ]
714
+ }
715
+ )
716
+ ] })
717
+ ]
718
+ }
719
+ );
720
+ }
721
+ function wn({ title: n, scope: l, actions: a, backLink: t }) {
722
+ return /* @__PURE__ */ s("header", { className: "cms-page-header", children: [
723
+ t ? /* @__PURE__ */ s(
256
724
  "a",
257
725
  {
258
726
  className: "cms-page-header__back",
259
- href: a.href ?? "#",
260
- onClick: (s) => {
261
- a.onBack && (s.preventDefault(), a.onBack());
727
+ href: t.href ?? "#",
728
+ onClick: (r) => {
729
+ t.onBack && (r.preventDefault(), t.onBack());
262
730
  },
263
731
  children: [
264
- /* @__PURE__ */ t(N, { name: "back" }),
732
+ /* @__PURE__ */ e(F, { name: "back" }),
265
733
  " ",
266
- a.label
734
+ t.label
267
735
  ]
268
736
  }
269
737
  ) : null,
270
- /* @__PURE__ */ v("div", { className: "cms-page-header__row", children: [
271
- /* @__PURE__ */ v("div", { className: "cms-page-header__titles", children: [
272
- /* @__PURE__ */ t("h1", { className: "cms-page-header__title", children: e }),
273
- n != null ? /* @__PURE__ */ t("p", { className: "cms-page-header__scope", children: n }) : null
738
+ /* @__PURE__ */ s("div", { className: "cms-page-header__row", children: [
739
+ /* @__PURE__ */ s("div", { className: "cms-page-header__titles", children: [
740
+ /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: n }),
741
+ l != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: l }) : null
274
742
  ] }),
275
- l != null ? /* @__PURE__ */ t("div", { className: "cms-page-header__actions", children: l }) : null
743
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-page-header__actions", children: a }) : null
276
744
  ] })
277
745
  ] });
278
746
  }
279
- function le({ tabs: e, active: n, onSelect: l, label: a }) {
280
- const s = w([]), m = (i, u) => {
281
- var o;
282
- const d = e.length - 1, f = i.key === "ArrowRight" ? u === d ? 0 : u + 1 : i.key === "ArrowLeft" ? u === 0 ? d : u - 1 : i.key === "Home" ? 0 : i.key === "End" ? d : null;
283
- if (f === null) return;
284
- i.preventDefault();
285
- const r = e[f];
286
- r && (l(r.id), (o = s.current[f]) == null || o.focus());
747
+ function kn({ tabs: n, active: l, onSelect: a, label: t }) {
748
+ const r = O([]), m = (o, c) => {
749
+ var h;
750
+ const u = n.length - 1, d = o.key === "ArrowRight" ? c === u ? 0 : c + 1 : o.key === "ArrowLeft" ? c === 0 ? u : c - 1 : o.key === "Home" ? 0 : o.key === "End" ? u : null;
751
+ if (d === null) return;
752
+ o.preventDefault();
753
+ const _ = n[d];
754
+ _ && (a(_.id), (h = r.current[d]) == null || h.focus());
287
755
  };
288
- return /* @__PURE__ */ t("div", { className: "cms-tabs", role: "tablist", "aria-label": a, children: e.map((i, u) => {
289
- const d = i.id === n;
290
- return /* @__PURE__ */ v(
756
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": t, children: n.map((o, c) => {
757
+ const u = o.id === l;
758
+ return /* @__PURE__ */ s(
291
759
  "button",
292
760
  {
293
- ref: (f) => {
294
- s.current[u] = f;
761
+ ref: (d) => {
762
+ r.current[c] = d;
295
763
  },
296
764
  type: "button",
297
765
  role: "tab",
298
- className: _("cms-tab", d && "is-active"),
299
- "aria-selected": d,
300
- tabIndex: d ? 0 : -1,
301
- onClick: () => l(i.id),
302
- onKeyDown: (f) => m(f, u),
766
+ className: C("cms-tab", u && "is-active"),
767
+ "aria-selected": u,
768
+ tabIndex: u ? 0 : -1,
769
+ onClick: () => a(o.id),
770
+ onKeyDown: (d) => m(d, c),
303
771
  children: [
304
- i.label,
305
- i.count !== void 0 ? /* @__PURE__ */ t("span", { className: "cms-tab__count", children: i.count }) : null
772
+ o.label,
773
+ o.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: o.count }) : null
306
774
  ]
307
775
  },
308
- i.id
776
+ o.id
309
777
  );
310
778
  }) });
311
779
  }
312
- function V(e) {
313
- var a;
314
- const n = e.trim().split(/\s+/).filter(Boolean);
315
- return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(a = n[0]) == null ? void 0 : a[0]]).filter(Boolean).join("").toUpperCase();
780
+ function Ge(n) {
781
+ var t;
782
+ const l = n.trim().split(/\s+/).filter(Boolean);
783
+ return (l.length > 1 ? [l[0][0], l[l.length - 1][0]] : [(t = l[0]) == null ? void 0 : t[0]]).filter(Boolean).join("").toUpperCase();
316
784
  }
317
- function re({ name: e, pictureUrl: n, presence: l, size: a = 32 }) {
318
- return /* @__PURE__ */ v(
785
+ function Xe(n) {
786
+ let l = 0;
787
+ for (const a of n.trim().toLowerCase())
788
+ l = l * 31 + (a.codePointAt(0) ?? 0) >>> 0;
789
+ return l % 6 + 1;
790
+ }
791
+ function ve({ name: n, pictureUrl: l, presence: a, size: t = 32 }) {
792
+ return /* @__PURE__ */ s(
319
793
  "span",
320
794
  {
321
- className: "cms-avatar",
322
- style: { width: a, height: a, fontSize: Math.round(a * 0.4) },
795
+ className: `cms-avatar cms-avatar--tint-${Xe(n)}`,
796
+ style: { width: t, height: t, fontSize: Math.round(t * 0.4) },
323
797
  role: "img",
324
- "aria-label": l ? `${e}, ${l}` : e,
798
+ "aria-label": a ? `${n}, ${a}` : n,
799
+ children: [
800
+ l ? /* @__PURE__ */ e("img", { src: l, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: Ge(n) }),
801
+ a ? /* @__PURE__ */ e("span", { className: C("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
802
+ ]
803
+ }
804
+ );
805
+ }
806
+ function Ye({ count: n, label: l, max: a = 99 }) {
807
+ return n <= 0 ? null : /* @__PURE__ */ s("span", { className: "cms-badge", children: [
808
+ /* @__PURE__ */ e("span", { "aria-hidden": "true", children: n > a ? `${a}+` : n }),
809
+ /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: l })
810
+ ] });
811
+ }
812
+ function xn({ product: n, mark: l, rail: a, active: t, onNavigate: r, server: m, search: o, account: c, children: u, railLabel: d = "Sections" }) {
813
+ return /* @__PURE__ */ s("div", { className: "cms-shell", children: [
814
+ /* @__PURE__ */ s("nav", { className: "cms-shell__rail", "aria-label": d, children: [
815
+ /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: l }),
816
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((_) => {
817
+ const h = _.id === t;
818
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
819
+ "a",
820
+ {
821
+ href: _.href,
822
+ className: C("cms-shell__item", h && "is-active"),
823
+ "aria-current": h ? "page" : void 0,
824
+ title: _.label,
825
+ onClick: (i) => {
826
+ r && (i.preventDefault(), r(_.id));
827
+ },
828
+ children: [
829
+ /* @__PURE__ */ s("span", { className: "cms-shell__icon", children: [
830
+ /* @__PURE__ */ e(P, { name: _.icon, size: 22 }),
831
+ _.badge ? /* @__PURE__ */ e(Ye, { count: _.badge.count, label: _.badge.label }) : null
832
+ ] }),
833
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: _.label })
834
+ ]
835
+ }
836
+ ) }, _.id);
837
+ }) })
838
+ ] }),
839
+ /* @__PURE__ */ s("header", { className: "cms-shell__top", children: [
840
+ /* @__PURE__ */ e("span", { className: "cms-shell__product", children: n }),
841
+ m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: m }) : null,
842
+ o != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: o }) : null,
843
+ c != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: c }) : null
844
+ ] }),
845
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: u })
846
+ ] });
847
+ }
848
+ function Mn({ label: n, placeholder: l, value: a, onChange: t, onSearch: r }) {
849
+ return /* @__PURE__ */ s(
850
+ "form",
851
+ {
852
+ role: "search",
853
+ className: "cms-search",
854
+ onSubmit: (m) => {
855
+ m.preventDefault(), r == null || r(a);
856
+ },
325
857
  children: [
326
- n ? /* @__PURE__ */ t("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ t("span", { "aria-hidden": "true", children: V(e) }),
327
- l ? /* @__PURE__ */ t("span", { className: _("cms-avatar__presence", `is-${l}`), "aria-hidden": "true" }) : null
858
+ /* @__PURE__ */ e(P, { name: "search", size: 18 }),
859
+ /* @__PURE__ */ e(
860
+ "input",
861
+ {
862
+ className: "cms-search__input",
863
+ type: "search",
864
+ "aria-label": n,
865
+ placeholder: l,
866
+ value: a,
867
+ onChange: (m) => t(m.target.value)
868
+ }
869
+ )
328
870
  ]
329
871
  }
330
872
  );
331
873
  }
332
- function ae({ label: e, rows: n, error: l, onRetry: a, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: i, selected: u, onOpen: d, onRowMenu: f }) {
333
- const r = w([]);
334
- if (l != null) return /* @__PURE__ */ t(R, { message: l, onRetry: a });
335
- if (n === null) return /* @__PURE__ */ t(q, { what: s, layout: "block" });
336
- if (n.length === 0) return /* @__PURE__ */ t(F, { title: m, hint: i });
337
- const o = (c, g, p) => {
874
+ function Cn({ options: n, value: l, onChange: a, label: t }) {
875
+ const r = O([]), m = (o, c) => {
338
876
  var h;
339
- if (c.key === "ArrowDown" || c.key === "ArrowUp")
340
- c.preventDefault(), (h = r.current[Math.min(n.length - 1, Math.max(0, g + (c.key === "ArrowDown" ? 1 : -1)))]) == null || h.focus();
341
- else if (c.key === "Enter")
342
- d == null || d(p);
343
- else if ((c.key === "ContextMenu" || c.shiftKey && c.key === "F10") && f) {
344
- c.preventDefault();
345
- const y = c.currentTarget.getBoundingClientRect();
346
- f(p, { x: y.left + 16, y: y.bottom });
877
+ const u = n.length - 1, d = o.key === "ArrowRight" || o.key === "ArrowDown" ? c === u ? 0 : c + 1 : o.key === "ArrowLeft" || o.key === "ArrowUp" ? c === 0 ? u : c - 1 : null;
878
+ if (d === null) return;
879
+ o.preventDefault();
880
+ const _ = n[d];
881
+ _ && (a(_.id), (h = r.current[d]) == null || h.focus());
882
+ };
883
+ return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": t, children: n.map((o, c) => {
884
+ const u = o.id === l;
885
+ return /* @__PURE__ */ s(
886
+ "button",
887
+ {
888
+ ref: (d) => {
889
+ r.current[c] = d;
890
+ },
891
+ type: "button",
892
+ role: "radio",
893
+ "aria-checked": u,
894
+ tabIndex: u ? 0 : -1,
895
+ className: C("cms-chip", u && "is-on"),
896
+ onClick: () => a(o.id),
897
+ onKeyDown: (d) => m(d, c),
898
+ children: [
899
+ u ? /* @__PURE__ */ e(P, { name: "check", size: 16 }) : null,
900
+ o.label
901
+ ]
902
+ },
903
+ o.id
904
+ );
905
+ }) });
906
+ }
907
+ function Sn({ panes: n, active: l, back: a }) {
908
+ const t = Math.min(Math.max(l ?? n.length - 1, 0), n.length - 1);
909
+ return /* @__PURE__ */ e("div", { className: C("cms-panes", n.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": t, children: n.map((r, m) => /* @__PURE__ */ s("section", { className: "cms-panes__pane", "aria-label": r.label, "data-offset": t - m, children: [
910
+ m === t && a ? /* @__PURE__ */ s("a", { className: "cms-panes__back", href: a.href, children: [
911
+ /* @__PURE__ */ e(P, { name: "chevron-left", size: 18 }),
912
+ a.label
913
+ ] }) : null,
914
+ r.content
915
+ ] }, r.label)) });
916
+ }
917
+ const Je = { attachment: "Has an attachment", unread: "Unread" };
918
+ function An({ from: n, subject: l, preview: a, time: t, unread: r, hasAttachment: m, selected: o, onOpen: c, labels: u }) {
919
+ const d = re(Je, u);
920
+ return /* @__PURE__ */ s(
921
+ "button",
922
+ {
923
+ type: "button",
924
+ className: C("cms-mail-row", r && "is-unread", o && "is-selected"),
925
+ "aria-current": o ? "true" : void 0,
926
+ onClick: c,
927
+ children: [
928
+ /* @__PURE__ */ e(ve, { name: n, size: 40 }),
929
+ /* @__PURE__ */ s("span", { className: "cms-mail-row__body", children: [
930
+ /* @__PURE__ */ s("span", { className: "cms-mail-row__line", children: [
931
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: n }),
932
+ m ? /* @__PURE__ */ e(P, { name: "paperclip", size: 16, label: d.attachment }) : null,
933
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: t })
934
+ ] }),
935
+ /* @__PURE__ */ s("span", { className: "cms-mail-row__line", children: [
936
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: l }),
937
+ r ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": d.unread }) : null
938
+ ] }),
939
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: a })
940
+ ] })
941
+ ]
942
+ }
943
+ );
944
+ }
945
+ function Dn({ direction: n, children: l, time: a, read: t, readLabel: r = "Read" }) {
946
+ return /* @__PURE__ */ s("div", { className: C("cms-bubble", `cms-bubble--${n}`), children: [
947
+ /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: l }),
948
+ /* @__PURE__ */ s("div", { className: "cms-bubble__meta", children: [
949
+ a,
950
+ n === "out" && t ? /* @__PURE__ */ s(x, { children: [
951
+ " · ",
952
+ r
953
+ ] }) : null
954
+ ] })
955
+ ] });
956
+ }
957
+ function En({ label: n, value: l, onChange: a, onSend: t, onAttach: r, placeholder: m, variant: o = "chat", sendLabel: c = "Send", attachLabel: u = "Attach a file", leading: d, canSend: _ }) {
958
+ const h = ee(), i = _ ?? l.trim() !== "", v = (g) => {
959
+ g.preventDefault(), i && t();
960
+ }, y = r ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": u, onClick: r, children: /* @__PURE__ */ e(P, { name: "paperclip" }) }) : null;
961
+ return /* @__PURE__ */ s("form", { className: C("cms-composer", `cms-composer--${o}`), onSubmit: v, children: [
962
+ /* @__PURE__ */ e("label", { htmlFor: h, className: o === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: n }),
963
+ o === "chat" ? y : null,
964
+ /* @__PURE__ */ e(
965
+ "textarea",
966
+ {
967
+ id: h,
968
+ className: "cms-composer__input",
969
+ rows: o === "reply" ? 3 : 1,
970
+ placeholder: m,
971
+ value: l,
972
+ onChange: (g) => a(g.target.value),
973
+ onKeyDown: (g) => {
974
+ g.nativeEvent.isComposing || g.keyCode === 229 || o === "chat" && g.key === "Enter" && !g.shiftKey && (g.preventDefault(), i && t());
975
+ }
976
+ }
977
+ ),
978
+ o === "reply" && d !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-composer__leading", children: d }) : null,
979
+ o === "reply" ? y : null,
980
+ o === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": c, disabled: !i, children: /* @__PURE__ */ e(P, { name: "send" }) }) : /* @__PURE__ */ s("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: !i, children: [
981
+ c,
982
+ " ",
983
+ /* @__PURE__ */ e(P, { name: "send", size: 18 })
984
+ ] })
985
+ ] });
986
+ }
987
+ const xe = {
988
+ incomingAudio: "Incoming audio call",
989
+ incomingVideo: "Incoming video call",
990
+ incomingFrom: (n, l) => `${n} from ${l}`,
991
+ accept: "Accept",
992
+ decline: "Decline",
993
+ callWith: (n) => `Call with ${n}`,
994
+ callTime: (n) => `Call time ${n}`,
995
+ goodConnection: "Good connection",
996
+ poorConnection: "Poor connection",
997
+ you: "You",
998
+ speaking: "Speaking",
999
+ mute: "Mute",
1000
+ unmute: "Unmute",
1001
+ speaker: "Speaker",
1002
+ addPerson: "Add person",
1003
+ chat: "Chat",
1004
+ hangUp: "Hang up",
1005
+ onCallWith: (n) => `On a call with ${n}`,
1006
+ returnToCall: "Return to call"
1007
+ };
1008
+ function Ln({ name: n, media: l, onAccept: a, onDecline: t, labels: r }) {
1009
+ const m = re(xe, r), o = l === "video" ? m.incomingVideo : m.incomingAudio;
1010
+ return /* @__PURE__ */ s("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": m.incomingFrom(o, n), children: [
1011
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(ve, { name: n, size: 112 }) }),
1012
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: n }),
1013
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: o }),
1014
+ /* @__PURE__ */ s("div", { className: "cms-call-incoming__actions", children: [
1015
+ /* @__PURE__ */ e(ae, { icon: "phone-off", label: m.decline, tone: "hang-up", onClick: t }),
1016
+ /* @__PURE__ */ e(ae, { icon: "phone", label: m.accept, tone: "accept", onClick: a })
1017
+ ] })
1018
+ ] });
1019
+ }
1020
+ function ae({ icon: n, label: l, onClick: a, tone: t = "plain", pressed: r }) {
1021
+ return /* @__PURE__ */ s(
1022
+ "button",
1023
+ {
1024
+ type: "button",
1025
+ className: C("cms-call-button", `cms-call-button--${t}`, r && "is-pressed"),
1026
+ "aria-pressed": r,
1027
+ onClick: a,
1028
+ children: [
1029
+ /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(P, { name: n, size: 24 }) }),
1030
+ /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: l })
1031
+ ]
1032
+ }
1033
+ );
1034
+ }
1035
+ function $n({ name: n, duration: l, connection: a, you: t, muted: r, speaker: m, onToggleMute: o, onToggleSpeaker: c, onAddPerson: u, onChat: d, onHangUp: _, labels: h }) {
1036
+ const i = re(xe, h);
1037
+ return /* @__PURE__ */ s("section", { className: "cms-call-panel", "aria-label": i.callWith(n), children: [
1038
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__head", children: [
1039
+ /* @__PURE__ */ e(ve, { name: n, size: 64 }),
1040
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__who", children: [
1041
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: n }),
1042
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": i.callTime(l), children: l })
1043
+ ] }),
1044
+ /* @__PURE__ */ e("span", { className: C("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? i.goodConnection : i.poorConnection })
1045
+ ] }),
1046
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__you", children: [
1047
+ /* @__PURE__ */ e(ve, { name: t.name, size: 36 }),
1048
+ /* @__PURE__ */ e("span", { children: i.you }),
1049
+ t.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": i.speaking }) : null
1050
+ ] }),
1051
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__controls", children: [
1052
+ /* @__PURE__ */ e(ae, { icon: "mic", label: r ? i.unmute : i.mute, pressed: r, onClick: o }),
1053
+ /* @__PURE__ */ e(ae, { icon: "speaker", label: i.speaker, pressed: m, onClick: c }),
1054
+ u ? /* @__PURE__ */ e(ae, { icon: "user-plus", label: i.addPerson, onClick: u }) : null,
1055
+ d ? /* @__PURE__ */ e(ae, { icon: "chat", label: i.chat, onClick: d }) : null,
1056
+ /* @__PURE__ */ e(ae, { icon: "phone-off", label: i.hangUp, tone: "hang-up", onClick: _ })
1057
+ ] })
1058
+ ] });
1059
+ }
1060
+ function Tn({ name: n, duration: l, muted: a, onToggleMute: t, onReturn: r, onHangUp: m, labels: o }) {
1061
+ const c = re(xe, o);
1062
+ return /* @__PURE__ */ s("section", { className: "cms-call-bar", "aria-label": c.callWith(n), children: [
1063
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
1064
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: c.onCallWith(n) }),
1065
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: l }),
1066
+ /* @__PURE__ */ s("span", { className: "cms-call-bar__actions", children: [
1067
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? c.unmute : c.mute, "aria-pressed": a, onClick: t, children: /* @__PURE__ */ e(P, { name: "mic" }) }),
1068
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: r, children: c.returnToCall }),
1069
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": c.hangUp, onClick: m, children: /* @__PURE__ */ e(P, { name: "phone-off" }) })
1070
+ ] })
1071
+ ] });
1072
+ }
1073
+ function In({ mark: n, product: l, headline: a, lead: t, features: r = [], children: m }) {
1074
+ return /* @__PURE__ */ s("div", { className: "cms-signin", children: [
1075
+ /* @__PURE__ */ s("aside", { className: "cms-signin__brand", children: [
1076
+ /* @__PURE__ */ s("p", { className: "cms-signin__logo", children: [
1077
+ /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: n }),
1078
+ l
1079
+ ] }),
1080
+ /* @__PURE__ */ s("div", { className: "cms-signin__pitch", children: [
1081
+ /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
1082
+ /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: t }),
1083
+ r.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: r.map((o) => /* @__PURE__ */ s("li", { children: [
1084
+ /* @__PURE__ */ e(P, { name: o.icon, size: 18 }),
1085
+ o.label
1086
+ ] }, o.label)) }) : null
1087
+ ] })
1088
+ ] }),
1089
+ /* @__PURE__ */ e("main", { className: "cms-signin__form", children: m })
1090
+ ] });
1091
+ }
1092
+ const Qe = {
1093
+ title: "Sign in",
1094
+ identifier: "Email or username",
1095
+ identifierPlaceholder: "name@example.com",
1096
+ password: "Password",
1097
+ show: "Show",
1098
+ hide: "Hide",
1099
+ forgot: "Forgot password?",
1100
+ submit: "Sign in",
1101
+ newHere: "New here?",
1102
+ create: "Create an account"
1103
+ };
1104
+ function Pn({ server: n, onSubmit: l, forgotHref: a, createHref: t, error: r, busy: m, labels: o }) {
1105
+ const c = re(Qe, o), u = ee(), [d, _] = D(""), [h, i] = D(""), [v, y] = D(!1);
1106
+ return /* @__PURE__ */ s("form", { className: "cms-signin-form", onSubmit: (k) => {
1107
+ k.preventDefault(), l(d, h);
1108
+ }, "aria-describedby": r ? `${u}-error` : void 0, children: [
1109
+ /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: c.title }),
1110
+ /* @__PURE__ */ s("p", { className: "cms-signin-form__server", children: [
1111
+ /* @__PURE__ */ e(P, { name: "server", size: 18 }),
1112
+ n
1113
+ ] }),
1114
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-identifier`, children: c.identifier }),
1115
+ /* @__PURE__ */ e(
1116
+ "input",
1117
+ {
1118
+ id: `${u}-identifier`,
1119
+ className: "cms-signin-form__input",
1120
+ type: "text",
1121
+ autoComplete: "username",
1122
+ placeholder: c.identifierPlaceholder,
1123
+ value: d,
1124
+ onChange: (k) => _(k.target.value),
1125
+ required: !0
1126
+ }
1127
+ ),
1128
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-password`, children: c.password }),
1129
+ /* @__PURE__ */ s("span", { className: "cms-signin-form__password", children: [
1130
+ /* @__PURE__ */ e(
1131
+ "input",
1132
+ {
1133
+ id: `${u}-password`,
1134
+ className: "cms-signin-form__input",
1135
+ type: v ? "text" : "password",
1136
+ autoComplete: "current-password",
1137
+ value: h,
1138
+ onChange: (k) => i(k.target.value),
1139
+ required: !0
1140
+ }
1141
+ ),
1142
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": v, onClick: () => y((k) => !k), children: v ? c.hide : c.show })
1143
+ ] }),
1144
+ a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: c.forgot }) : null,
1145
+ r ? /* @__PURE__ */ e("p", { id: `${u}-error`, className: "cms-signin-form__error", role: "alert", children: r }) : null,
1146
+ /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: m, "aria-busy": m || void 0, children: c.submit }),
1147
+ t ? /* @__PURE__ */ s(x, { children: [
1148
+ /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: c.newHere }) }),
1149
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: t, children: c.create })
1150
+ ] }) : null
1151
+ ] });
1152
+ }
1153
+ function Bn({ label: n, rows: l, error: a, onRetry: t, loadingText: r = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: o, selected: c, onOpen: u, onRowMenu: d }) {
1154
+ const _ = O([]);
1155
+ if (a != null) return /* @__PURE__ */ e(ze, { message: a, onRetry: t });
1156
+ if (l === null) return /* @__PURE__ */ e(Be, { what: r, layout: "block" });
1157
+ if (l.length === 0) return /* @__PURE__ */ e(Fe, { title: m, hint: o });
1158
+ const h = (i, v, y) => {
1159
+ var g;
1160
+ if (i.key === "ArrowDown" || i.key === "ArrowUp")
1161
+ i.preventDefault(), (g = _.current[Math.min(l.length - 1, Math.max(0, v + (i.key === "ArrowDown" ? 1 : -1)))]) == null || g.focus();
1162
+ else if (i.key === "Enter")
1163
+ u == null || u(y);
1164
+ else if ((i.key === "ContextMenu" || i.shiftKey && i.key === "F10") && d) {
1165
+ i.preventDefault();
1166
+ const k = i.currentTarget.getBoundingClientRect();
1167
+ d(y, { x: k.left + 16, y: k.bottom });
347
1168
  }
348
1169
  };
349
- return /* @__PURE__ */ t("ul", { className: "cms-list", role: "listbox", "aria-label": e, children: n.map((c, g) => {
350
- const p = c.id === u;
351
- return /* @__PURE__ */ v(
1170
+ return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": n, children: l.map((i, v) => {
1171
+ const y = i.id === c;
1172
+ return /* @__PURE__ */ s(
352
1173
  "li",
353
1174
  {
354
- ref: (h) => {
355
- r.current[g] = h;
1175
+ ref: (g) => {
1176
+ _.current[v] = g;
356
1177
  },
357
1178
  role: "option",
358
- "aria-selected": p,
359
- tabIndex: p || u == null && g === 0 ? 0 : -1,
360
- className: _("cms-list__row", p && "is-selected"),
361
- onClick: () => d == null ? void 0 : d(c.id),
362
- onKeyDown: (h) => o(h, g, c.id),
363
- onContextMenu: f ? (h) => {
364
- h.preventDefault(), f(c.id, { x: h.clientX, y: h.clientY });
1179
+ "aria-selected": y,
1180
+ tabIndex: y || c == null && v === 0 ? 0 : -1,
1181
+ className: C("cms-list__row", y && "is-selected"),
1182
+ onClick: () => u == null ? void 0 : u(i.id),
1183
+ onKeyDown: (g) => h(g, v, i.id),
1184
+ onContextMenu: d ? (g) => {
1185
+ g.preventDefault(), d(i.id, { x: g.clientX, y: g.clientY });
365
1186
  } : void 0,
366
1187
  children: [
367
- c.lead != null ? /* @__PURE__ */ t("span", { className: "cms-list__lead", children: c.lead }) : null,
368
- /* @__PURE__ */ v("span", { className: "cms-list__text", children: [
369
- /* @__PURE__ */ t("span", { className: "cms-list__primary", children: c.primary }),
370
- c.secondary != null ? /* @__PURE__ */ t("span", { className: "cms-list__secondary", children: c.secondary }) : null
1188
+ i.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: i.lead }) : null,
1189
+ /* @__PURE__ */ s("span", { className: "cms-list__text", children: [
1190
+ /* @__PURE__ */ e("span", { className: "cms-list__primary", children: i.primary }),
1191
+ i.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: i.secondary }) : null
371
1192
  ] }),
372
- c.meta != null ? /* @__PURE__ */ t("span", { className: "cms-list__meta", children: c.meta }) : null
1193
+ i.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: i.meta }) : null
373
1194
  ]
374
1195
  },
375
- c.id
1196
+ i.id
376
1197
  );
377
1198
  }) });
378
1199
  }
379
- function se({ at: e, items: n, onClose: l, label: a = "Actions" }) {
380
- const s = w(null), m = w(null), [i, u] = k(e), d = n.filter((r) => r.offer.offered);
381
- if (B(() => {
382
- if (!e) return;
383
- const r = s.current, o = (r == null ? void 0 : r.offsetWidth) ?? 0, c = (r == null ? void 0 : r.offsetHeight) ?? 0;
384
- u({ x: Math.max(0, Math.min(e.x, window.innerWidth - o)), y: Math.max(0, Math.min(e.y, window.innerHeight - c)) });
385
- }, [e]), x(() => {
386
- var o, c;
387
- if (!e) return;
388
- m.current = document.activeElement, (c = (o = s.current) == null ? void 0 : o.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || c.focus();
389
- const r = (g) => {
390
- var p;
391
- (p = s.current) != null && p.contains(g.target) || l();
1200
+ function en({ at: n, items: l, onClose: a, label: t = "Actions", focus: r = "first" }) {
1201
+ const m = O(null), o = O(null), [c, u] = D(n), d = l.filter((h) => h.offer.offered);
1202
+ if (Ae(() => {
1203
+ if (!n) return;
1204
+ const h = m.current, i = (h == null ? void 0 : h.offsetWidth) ?? 0, v = (h == null ? void 0 : h.offsetHeight) ?? 0;
1205
+ u({ x: Math.max(0, Math.min(n.x, window.innerWidth - i)), y: Math.max(0, Math.min(n.y, window.innerHeight - v)) });
1206
+ }, [n]), G(() => {
1207
+ var v, y;
1208
+ if (!n) return;
1209
+ o.current = document.activeElement;
1210
+ const h = Array.from(((v = m.current) == null ? void 0 : v.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) ?? []);
1211
+ (y = r === "last" ? h[h.length - 1] : h[0]) == null || y.focus();
1212
+ const i = (g) => {
1213
+ var k;
1214
+ (k = m.current) != null && k.contains(g.target) || a();
392
1215
  };
393
- return document.addEventListener("mousedown", r), () => {
394
- var g, p;
395
- document.removeEventListener("mousedown", r), (p = (g = m.current) == null ? void 0 : g.focus) == null || p.call(g);
1216
+ return document.addEventListener("mousedown", i), () => {
1217
+ var g, k;
1218
+ document.removeEventListener("mousedown", i), (k = (g = o.current) == null ? void 0 : g.focus) == null || k.call(g);
396
1219
  };
397
- }, [e, l]), !e || d.length === 0) return null;
398
- const f = (r) => {
399
- var g, p;
400
- const o = Array.from(((g = s.current) == null ? void 0 : g.querySelectorAll('[role="menuitem"]')) ?? []), c = o.indexOf(document.activeElement);
401
- if (r.key === "Escape" || r.key === "Tab")
402
- r.preventDefault(), l();
403
- else if (r.key === "ArrowDown" || r.key === "ArrowUp") {
404
- r.preventDefault();
405
- const h = r.key === "ArrowDown" ? 1 : -1;
406
- (p = o[(c + h + o.length) % o.length]) == null || p.focus();
1220
+ }, [n, a, r]), !n || d.length === 0) return null;
1221
+ const _ = (h) => {
1222
+ var y, g;
1223
+ const i = Array.from(((y = m.current) == null ? void 0 : y.querySelectorAll('[role="menuitem"]')) ?? []), v = i.indexOf(document.activeElement);
1224
+ if (h.key === "Escape" || h.key === "Tab")
1225
+ h.preventDefault(), a();
1226
+ else if (h.key === "ArrowDown" || h.key === "ArrowUp") {
1227
+ h.preventDefault();
1228
+ const k = h.key === "ArrowDown" ? 1 : -1;
1229
+ (g = i[(v + k + i.length) % i.length]) == null || g.focus();
407
1230
  }
408
1231
  };
409
- return C(
410
- /* @__PURE__ */ t(
1232
+ return ke(
1233
+ /* @__PURE__ */ e(
411
1234
  "div",
412
1235
  {
413
- ref: s,
1236
+ ref: m,
414
1237
  className: "cms-menu",
415
1238
  role: "menu",
416
- "aria-label": a,
417
- style: { left: (i ?? e).x, top: (i ?? e).y },
418
- onKeyDown: f,
419
- onContextMenu: (r) => r.preventDefault(),
420
- children: d.map((r) => {
421
- const o = r.offer.refusal !== void 0;
422
- return /* @__PURE__ */ v(
1239
+ "aria-label": t,
1240
+ style: { left: (c ?? n).x, top: (c ?? n).y },
1241
+ onKeyDown: _,
1242
+ onContextMenu: (h) => h.preventDefault(),
1243
+ children: d.map((h) => {
1244
+ const i = h.offer.refusal !== void 0;
1245
+ return /* @__PURE__ */ s(
423
1246
  "div",
424
1247
  {
425
1248
  role: "menuitem",
426
1249
  tabIndex: -1,
427
- "aria-disabled": o || void 0,
428
- title: o ? r.offer.refusal : void 0,
429
- className: _("cms-menu__item", r.danger && "is-danger", r.offer.locked && "is-locked", o && "is-refused"),
1250
+ "aria-disabled": i || void 0,
1251
+ title: i ? h.offer.refusal : void 0,
1252
+ className: C("cms-menu__item", h.danger && "is-danger", h.offer.locked && "is-locked", i && "is-refused"),
430
1253
  onClick: () => {
431
- o || (l(), r.onSelect());
1254
+ i || (a(), h.onSelect());
432
1255
  },
433
- onKeyDown: (c) => {
434
- (c.key === "Enter" || c.key === " ") && !o && (c.preventDefault(), l(), r.onSelect());
1256
+ onKeyDown: (v) => {
1257
+ (v.key === "Enter" || v.key === " ") && !i && (v.preventDefault(), a(), h.onSelect());
435
1258
  },
436
1259
  children: [
437
- r.offer.locked ? /* @__PURE__ */ t(N, { name: "lock" }) : null,
438
- /* @__PURE__ */ t("span", { className: "cms-menu__label", children: r.label }),
439
- o ? /* @__PURE__ */ t("span", { className: "cms-menu__refusal", children: r.offer.refusal }) : null
1260
+ h.offer.locked ? /* @__PURE__ */ e(F, { name: "lock" }) : null,
1261
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: h.label }),
1262
+ i ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: h.offer.refusal }) : null
440
1263
  ]
441
1264
  },
442
- r.id
1265
+ h.id
443
1266
  );
444
1267
  })
445
1268
  }
@@ -447,107 +1270,329 @@ function se({ at: e, items: n, onClose: l, label: a = "Actions" }) {
447
1270
  document.body
448
1271
  );
449
1272
  }
450
- function j(e) {
451
- return e === "allowed" || e === "elevate" || e === "denied";
1273
+ const Ce = { bare: /* @__PURE__ */ new Set(), hidden: /* @__PURE__ */ new Set() }, Se = (n, l) => n.size === l.size && [...n].every((a) => l.has(a));
1274
+ function nn(n) {
1275
+ const l = /* @__PURE__ */ new Map();
1276
+ for (const a of n) l.set(a.group, [...l.get(a.group) ?? [], a]);
1277
+ return [...l.values()];
1278
+ }
1279
+ function ln(n) {
1280
+ const l = /* @__PURE__ */ new Map();
1281
+ for (const a of n) a.overflow !== void 0 && a.overflow !== 0 && l.set(a.overflow, [...l.get(a.overflow) ?? [], a.id]);
1282
+ return [...l.entries()].sort(([a], [t]) => a - t).map(([, a]) => a);
1283
+ }
1284
+ function Fn({ label: n, actions: l, onAction: a, status: t, moreLabel: r, leading: m }) {
1285
+ const o = O(null), c = O(null), [u, d] = D(Ce), [_, h] = D(null), [i, v] = D("first"), [y, g] = D(null), [k, q] = D(null), w = nn(l), S = ln(l), A = w.flat(), V = A.filter((f) => f.overflow === 0), H = A.filter((f) => f.overflow !== 0), ne = JSON.stringify([l.map((f) => [f.id, f.label, f.icon, f.group, f.overflow ?? null]), t ?? "", m !== void 0]), b = _e(() => {
1286
+ const f = o.current, M = c.current;
1287
+ if (f === null || M === null) return;
1288
+ const R = getComputedStyle(f), W = parseFloat(R.columnGap || "0") || 0, $ = f.clientWidth - (parseFloat(R.paddingLeft) || 0) - (parseFloat(R.paddingRight) || 0), j = (T) => {
1289
+ var K;
1290
+ return ((K = M.querySelector(T)) == null ? void 0 : K.getBoundingClientRect().width) ?? 0;
1291
+ }, oe = j('[data-measure="leading"]'), de = j('[data-measure="separator"]'), me = j('[data-measure="more"]'), ue = (T, K) => j(`[data-measure="${K ? "full" : "icon"}"][data-measure-action="${CSS.escape(T)}"]`), p = (T, K) => {
1292
+ const Y = /* @__PURE__ */ new Set([...V.map((le) => le.id), ...K]), se = w.map((le) => le.filter((pe) => !Y.has(pe.id))).filter((le) => le.length > 0), he = se.flat(), Te = he.length + (se.length - 1) + (Y.size > 0 ? 1 : 0) + (oe > 0 ? 1 : 0);
1293
+ return oe + he.reduce((le, pe) => le + ue(pe.id, !T.has(pe.id)), 0) + de * Math.max(0, se.length - 1) + (Y.size > 0 ? me : 0) + W * Math.max(0, Te - 1);
1294
+ }, N = H.filter((T) => !S.some((K) => K.includes(T.id))).map((T) => T.id), I = [...S, ...[...N].reverse().map((T) => [T])];
1295
+ let B = null;
1296
+ if (p(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()) <= $) B = Ce;
1297
+ else {
1298
+ const T = /* @__PURE__ */ new Set();
1299
+ for (const K of I) {
1300
+ for (const Y of K) T.add(Y);
1301
+ if (p(T, /* @__PURE__ */ new Set()) <= $) {
1302
+ B = { bare: T, hidden: /* @__PURE__ */ new Set() };
1303
+ break;
1304
+ }
1305
+ }
1306
+ }
1307
+ if (B === null) {
1308
+ const T = new Set(H.map((Y) => Y.id)), K = /* @__PURE__ */ new Set();
1309
+ for (const Y of S) {
1310
+ for (const se of Y) H.some((he) => he.id === se) && K.add(se);
1311
+ if (K.size >= 2 && p(T, K) <= $) break;
1312
+ }
1313
+ B = { bare: T, hidden: K.size >= 2 ? K : /* @__PURE__ */ new Set() };
1314
+ }
1315
+ const ge = B;
1316
+ d((T) => Se(T.bare, ge.bare) && Se(T.hidden, ge.hidden) ? T : ge);
1317
+ }, [ne]);
1318
+ Ae(b, [b]), G(() => {
1319
+ const f = o.current;
1320
+ if (f === null || typeof ResizeObserver > "u") return;
1321
+ const M = new ResizeObserver(() => b());
1322
+ return M.observe(f), () => M.disconnect();
1323
+ }, [b]);
1324
+ const E = /* @__PURE__ */ new Set([...V.map((f) => f.id), ...u.hidden]), Z = w.map((f) => f.filter((M) => !E.has(M.id))).filter((f) => f.length > 0).flat(), L = [
1325
+ ...V,
1326
+ ...S.flat().map((f) => A.find((M) => M.id === f)).filter((f) => f !== void 0 && u.hidden.has(f.id))
1327
+ ], X = new Set(H.filter((f) => !S.some((M) => M.includes(f.id))).map((f) => f.id)), z = [...Z.map((f) => f.id), ...L.length > 0 ? ["more"] : []], J = y !== null && z.includes(y) ? y : z[0] ?? null, ce = (f) => {
1328
+ var $, j;
1329
+ const M = z.indexOf(J ?? "");
1330
+ let R = null;
1331
+ if (f.key === "ArrowRight" ? R = Math.min(z.length - 1, M + 1) : f.key === "ArrowLeft" ? R = Math.max(0, M - 1) : f.key === "Home" ? R = 0 : f.key === "End" ? R = z.length - 1 : f.key === "Escape" && q(J), R === null) return;
1332
+ f.preventDefault();
1333
+ const W = z[R] ?? null;
1334
+ g(W), (j = ($ = o.current) == null ? void 0 : $.querySelector(`[data-stop="${CSS.escape(W ?? "")}"]`)) == null || j.focus();
1335
+ }, ie = L.map((f) => ({
1336
+ id: f.id,
1337
+ label: /* @__PURE__ */ s(x, { children: [
1338
+ /* @__PURE__ */ e(fe, { name: f.icon }),
1339
+ f.label
1340
+ ] }),
1341
+ offer: f.disabled ? { offered: !0, locked: !1, refusal: f.reason ?? "" } : { offered: !0, locked: !1 },
1342
+ ...f.danger ? { danger: !0 } : {},
1343
+ onSelect: () => {
1344
+ !f.disabled && !f.busy && a(f.id);
1345
+ }
1346
+ }));
1347
+ return /* @__PURE__ */ s(
1348
+ "div",
1349
+ {
1350
+ ref: o,
1351
+ role: "toolbar",
1352
+ "aria-label": n,
1353
+ className: C(
1354
+ "cms-pane-toolbar",
1355
+ H.length > 0 && u.bare.size >= H.length && "cms-pane-toolbar--labels-hidden",
1356
+ u.bare.size > 0 && u.bare.size < H.length && "cms-pane-toolbar--labels-partly-hidden"
1357
+ ),
1358
+ onKeyDown: ce,
1359
+ children: [
1360
+ m !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__leading", children: m }) : null,
1361
+ w.map((f, M) => {
1362
+ const R = f.filter(($) => !E.has($.id)), W = w.slice(0, M).some(($) => $.some((j) => !E.has(j.id)));
1363
+ return /* @__PURE__ */ s("div", { className: "cms-pane-toolbar__group-wrap", children: [
1364
+ R.length > 0 && W ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__separator", role: "separator", "aria-orientation": "vertical" }) : null,
1365
+ /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__group", hidden: R.length === 0, children: f.map(($) => /* @__PURE__ */ e(
1366
+ an,
1367
+ {
1368
+ action: $,
1369
+ labels: !u.bare.has($.id),
1370
+ overflowed: E.has($.id),
1371
+ pinned: X.has($.id),
1372
+ tabbable: J === $.id,
1373
+ tipOff: k === $.id,
1374
+ onChoose: () => a($.id),
1375
+ onFocus: () => {
1376
+ g($.id), q(null);
1377
+ }
1378
+ },
1379
+ $.id
1380
+ )) })
1381
+ ] }, M);
1382
+ }),
1383
+ L.length > 0 ? /* @__PURE__ */ e(
1384
+ "button",
1385
+ {
1386
+ type: "button",
1387
+ className: "cms-icon-button cms-pane-toolbar__more",
1388
+ "data-stop": "more",
1389
+ "aria-label": r,
1390
+ title: r,
1391
+ "aria-haspopup": "menu",
1392
+ "aria-expanded": _ !== null,
1393
+ tabIndex: J === "more" ? 0 : -1,
1394
+ onFocus: () => g("more"),
1395
+ onClick: (f) => {
1396
+ const M = f.currentTarget.getBoundingClientRect();
1397
+ v("first"), h(_ === null ? { x: M.left, y: M.bottom } : null);
1398
+ },
1399
+ onKeyDown: (f) => {
1400
+ if (f.key === "ArrowDown" || f.key === "ArrowUp") {
1401
+ f.preventDefault(), f.stopPropagation();
1402
+ const M = f.currentTarget.getBoundingClientRect();
1403
+ v(f.key === "ArrowUp" ? "last" : "first"), h({ x: M.left, y: M.bottom });
1404
+ }
1405
+ },
1406
+ children: /* @__PURE__ */ e(P, { name: "more" })
1407
+ }
1408
+ ) : null,
1409
+ t !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__status", title: t, children: t }) : null,
1410
+ /* @__PURE__ */ e(en, { at: _, items: ie, onClose: () => h(null), label: r, focus: i }),
1411
+ /* @__PURE__ */ s("div", { ref: c, className: "cms-pane-toolbar__measure", "aria-hidden": "true", children: [
1412
+ m !== void 0 ? /* @__PURE__ */ e("div", { "data-measure": "leading", children: m }) : null,
1413
+ /* @__PURE__ */ e("span", { "data-measure": "separator", className: "cms-pane-toolbar__separator" }),
1414
+ /* @__PURE__ */ e("span", { "data-measure": "more", className: "cms-icon-button cms-pane-toolbar__more", children: /* @__PURE__ */ e(P, { name: "more" }) }),
1415
+ A.map((f) => /* @__PURE__ */ s("span", { children: [
1416
+ /* @__PURE__ */ s("span", { "data-measure": "full", "data-measure-action": f.id, className: "cms-pane-toolbar__action", children: [
1417
+ /* @__PURE__ */ e(fe, { name: f.icon }),
1418
+ /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: f.label })
1419
+ ] }),
1420
+ /* @__PURE__ */ e("span", { "data-measure": "icon", "data-measure-action": f.id, className: C("cms-pane-toolbar__action", be(f.icon) !== null && "cms-pane-toolbar__action--bare"), children: be(f.icon) !== null ? /* @__PURE__ */ e(fe, { name: f.icon }) : /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: f.label }) })
1421
+ ] }, f.id))
1422
+ ] })
1423
+ ]
1424
+ }
1425
+ );
1426
+ }
1427
+ function an({ action: n, labels: l, overflowed: a, pinned: t, tabbable: r, tipOff: m, onChoose: o, onFocus: c }) {
1428
+ const [u, d] = D(!1);
1429
+ G(() => {
1430
+ if (!n.busy) {
1431
+ d(!1);
1432
+ return;
1433
+ }
1434
+ const v = setTimeout(() => d(!0), ye);
1435
+ return () => clearTimeout(v);
1436
+ }, [n.busy]);
1437
+ const _ = be(n.icon) === null, h = l || _, i = n.disabled && n.reason ? n.reason : h ? null : n.label;
1438
+ return /* @__PURE__ */ s(
1439
+ "button",
1440
+ {
1441
+ type: "button",
1442
+ className: C("cms-pane-toolbar__action", !h && "cms-pane-toolbar__action--bare", _ && "cms-pane-toolbar__action--text", n.danger && "is-danger"),
1443
+ "data-action": n.id,
1444
+ "data-stop": n.id,
1445
+ ...a ? { "data-overflowed": "" } : {},
1446
+ ...t ? { "data-pinned": "" } : {},
1447
+ hidden: a,
1448
+ "aria-label": n.label,
1449
+ "aria-disabled": n.disabled || void 0,
1450
+ "aria-busy": n.busy || void 0,
1451
+ tabIndex: r ? 0 : -1,
1452
+ onFocus: c,
1453
+ onClick: () => {
1454
+ !n.disabled && !n.busy && o();
1455
+ },
1456
+ children: [
1457
+ u ? /* @__PURE__ */ e(F, { name: "spinner" }) : /* @__PURE__ */ e(fe, { name: n.icon }),
1458
+ h ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", "aria-hidden": "true", children: n.label }) : null,
1459
+ i !== null && !m ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__tip", role: "tooltip", children: i }) : null
1460
+ ]
1461
+ }
1462
+ );
452
1463
  }
453
- function ce(e, n) {
454
- if (!j(e))
455
- return n.showRefused ? { offered: !0, locked: !1, refusal: "not available: the server gave an answer this app does not know", unknown: !0 } : { offered: !1, locked: !1, unknown: !0 };
456
- switch (e) {
1464
+ function fe({ name: n }) {
1465
+ const l = be(n);
1466
+ return l === null ? null : /* @__PURE__ */ e(P, { name: l, size: 18 });
1467
+ }
1468
+ function sn(n) {
1469
+ return n === "allowed" || n === "elevate" || n === "denied";
1470
+ }
1471
+ function zn(n, l) {
1472
+ if (!sn(n))
1473
+ 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 };
1474
+ switch (n) {
457
1475
  case "allowed":
458
1476
  return { offered: !0, locked: !1 };
459
1477
  case "elevate":
460
- return n.elevates ? { offered: !0, locked: !0 } : { offered: !1, locked: !1 };
1478
+ return l.elevates ? { offered: !0, locked: !0 } : { offered: !1, locked: !1 };
461
1479
  case "denied":
462
- return n.showRefused ? { offered: !0, locked: !1, refusal: n.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
1480
+ return l.showRefused ? { offered: !0, locked: !1, refusal: l.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
463
1481
  }
464
1482
  }
465
- function H(e, n) {
466
- if (!e) return;
467
- if (typeof e.get == "function") return e.get(n) ?? void 0;
468
- const l = e, a = Object.keys(l).find((s) => s.toLowerCase() === n.toLowerCase());
469
- return a === void 0 ? void 0 : l[a];
470
- }
471
- function P(e) {
472
- if (e && typeof e == "object") {
473
- const n = e;
474
- if (typeof n.detail == "string" && n.detail !== "") return n.detail;
475
- if (typeof n.title == "string" && n.title !== "") return n.title;
1483
+ function tn(n, l) {
1484
+ if (!n) return;
1485
+ if (typeof n.get == "function") return n.get(l) ?? void 0;
1486
+ const a = n, t = Object.keys(a).find((r) => r.toLowerCase() === l.toLowerCase());
1487
+ return t === void 0 ? void 0 : a[t];
1488
+ }
1489
+ function rn(n) {
1490
+ if (n && typeof n == "object") {
1491
+ const l = n;
1492
+ if (typeof l.detail == "string" && l.detail !== "") return l.detail;
1493
+ if (typeof l.title == "string" && l.title !== "") return l.title;
476
1494
  }
477
1495
  }
478
- function ie(e, n, l, a) {
479
- if (e !== 403) return { kind: "none" };
480
- const s = P(l);
481
- return H(n, "X-Elevation-Required") !== void 0 ? a.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
482
- }
483
- const T = "coolms-kit:reread";
484
- function oe() {
485
- window.dispatchEvent(new Event(T));
486
- }
487
- function ue(e) {
488
- const [n, l] = k(void 0), [a, s] = k(void 0), [m, i] = k(!0), u = w(e);
489
- u.current = e;
490
- const d = w(0), f = K(() => {
491
- const r = ++d.current;
492
- i(!0), u.current().then(
493
- (o) => {
494
- r === d.current && (l(o), s(void 0), i(!1));
1496
+ function Kn(n, l, a, t) {
1497
+ if (n !== 403) return { kind: "none" };
1498
+ const r = rn(a);
1499
+ return tn(l, "X-Elevation-Required") !== void 0 ? t.elevates ? { kind: "elevation-required", message: r ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: r ?? "The server refused this." };
1500
+ }
1501
+ const we = "coolms-kit:reread";
1502
+ function Hn() {
1503
+ window.dispatchEvent(new Event(we));
1504
+ }
1505
+ function Rn(n) {
1506
+ const [l, a] = D(void 0), [t, r] = D(void 0), [m, o] = D(!0), c = O(n);
1507
+ c.current = n;
1508
+ const u = O(0), d = _e(() => {
1509
+ const _ = ++u.current;
1510
+ o(!0), c.current().then(
1511
+ (h) => {
1512
+ _ === u.current && (a(h), r(void 0), o(!1));
495
1513
  },
496
- (o) => {
497
- r === d.current && (s(o), i(!1));
1514
+ (h) => {
1515
+ _ === u.current && (r(h), o(!1));
498
1516
  }
499
1517
  );
500
1518
  }, []);
501
- return x(() => {
502
- f();
503
- const r = () => f();
504
- return window.addEventListener("focus", r), window.addEventListener(T, r), () => {
505
- window.removeEventListener("focus", r), window.removeEventListener(T, r);
1519
+ return G(() => {
1520
+ d();
1521
+ const _ = () => d();
1522
+ return window.addEventListener("focus", _), window.addEventListener(we, _), () => {
1523
+ window.removeEventListener("focus", _), window.removeEventListener(we, _);
506
1524
  };
507
- }, [f]), { value: n, error: a, loading: m, reread: f };
1525
+ }, [d]), { value: l, error: t, loading: m, reread: d };
508
1526
  }
509
- function de(e) {
510
- return e === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
1527
+ function On(n) {
1528
+ 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 };
511
1529
  }
512
- const U = "/errors/client-update-required";
513
- function W(e, n) {
514
- const l = e.split(".").map((s) => Number.parseInt(s, 10) || 0), a = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
515
- for (let s = 0; s < Math.max(l.length, a.length); s++) {
516
- const m = l[s] ?? 0, i = a[s] ?? 0;
517
- if (m !== i) return m < i;
1530
+ const cn = "/errors/client-update-required";
1531
+ function on(n, l) {
1532
+ const a = n.split(".").map((r) => Number.parseInt(r, 10) || 0), t = l.split(".").map((r) => Number.parseInt(r, 10) || 0);
1533
+ for (let r = 0; r < Math.max(a.length, t.length); r++) {
1534
+ const m = a[r] ?? 0, o = t[r] ?? 0;
1535
+ if (m !== o) return m < o;
518
1536
  }
519
1537
  return !1;
520
1538
  }
521
- function me(e) {
522
- return e.problemType !== void 0 && e.problemType.endsWith(U) ? !0 : e.minimumVersion !== void 0 && W(e.version, e.minimumVersion);
1539
+ function Zn(n) {
1540
+ return n.problemType !== void 0 && n.problemType.endsWith(cn) ? !0 : n.minimumVersion !== void 0 && on(n.version, n.minimumVersion);
523
1541
  }
524
1542
  export {
525
- re as Avatar,
526
- E as Button,
527
- U as CLIENT_UPDATE_REQUIRED,
528
- O as ConfirmDialog,
529
- se as ContextMenu,
530
- F as EmptyState,
531
- R as ErrorBanner,
532
- ae as List,
533
- q as Loading,
534
- Z as MODAL_CLOSE_MS,
535
- I as Modal,
536
- te as PageHeader,
537
- J as Select,
538
- le as TabStrip,
539
- Y as TextField,
540
- ee as Toast,
541
- ne as ToastRegion,
542
- z as Toggle,
543
- V as initialsOf,
544
- j as isCapability,
545
- me as needsClientUpdate,
546
- ce as offerFor,
547
- de as readConflict,
548
- ie as readRefusal,
549
- P as refusalText,
550
- oe as rereadAll,
551
- ue as useReread,
552
- W as versionBelow
1543
+ xn as AppShell,
1544
+ ve as Avatar,
1545
+ Me as BOOTSTRAP_ICONS,
1546
+ Ye as Badge,
1547
+ Q as Button,
1548
+ xe as CALL_LABELS,
1549
+ cn as CLIENT_UPDATE_REQUIRED,
1550
+ Tn as CallBar,
1551
+ $n as CallPanel,
1552
+ Dn as ChatBubble,
1553
+ En as Composer,
1554
+ _n as ConfirmDialog,
1555
+ en as ContextMenu,
1556
+ Fe as EmptyState,
1557
+ ze as ErrorBanner,
1558
+ yn as FilePicker,
1559
+ We as FilePickerDenied,
1560
+ Nn as FileViewer,
1561
+ Cn as FilterChips,
1562
+ gn as ICON_NAMES,
1563
+ P as Icon,
1564
+ Ln as IncomingCall,
1565
+ Bn as List,
1566
+ Be as Loading,
1567
+ Je as MAIL_ROW_LABELS,
1568
+ Pe as MODAL_CLOSE_MS,
1569
+ An as MailRow,
1570
+ Le as Modal,
1571
+ wn as PageHeader,
1572
+ Fn as PaneToolbar,
1573
+ Qe as SIGN_IN_LABELS,
1574
+ ye as STATE_DELAY_MS,
1575
+ Mn as SearchField,
1576
+ pn as Select,
1577
+ Pn as SignInForm,
1578
+ In as SignInLayout,
1579
+ Sn as SplitPanes,
1580
+ te as State,
1581
+ kn as TabStrip,
1582
+ hn as TextField,
1583
+ bn as Toast,
1584
+ vn as ToastRegion,
1585
+ fn as Toggle,
1586
+ be as iconForName,
1587
+ Ge as initialsOf,
1588
+ sn as isCapability,
1589
+ Zn as needsClientUpdate,
1590
+ zn as offerFor,
1591
+ On as readConflict,
1592
+ Kn as readRefusal,
1593
+ rn as refusalText,
1594
+ Hn as rereadAll,
1595
+ Xe as tintOf,
1596
+ Rn as useReread,
1597
+ on as versionBelow
553
1598
  };