@cloudlet/toast 1.2.0 → 1.4.0-rc.1

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +7 -3
  3. package/dist/agent.d.ts +334 -0
  4. package/dist/agent.d.ts.map +1 -0
  5. package/dist/agent.js +494 -0
  6. package/dist/agent.js.map +1 -0
  7. package/dist/contracts/events.d.ts +14 -0
  8. package/dist/contracts/events.d.ts.map +1 -1
  9. package/dist/contracts/internal.d.ts +16 -2
  10. package/dist/contracts/internal.d.ts.map +1 -1
  11. package/dist/contracts/notifications.d.ts +16 -0
  12. package/dist/contracts/notifications.d.ts.map +1 -1
  13. package/dist/contracts/snapshots.d.ts +8 -0
  14. package/dist/contracts/snapshots.d.ts.map +1 -1
  15. package/dist/core/actions.d.ts +69 -0
  16. package/dist/core/actions.d.ts.map +1 -0
  17. package/dist/core/actions.js +160 -0
  18. package/dist/core/actions.js.map +1 -0
  19. package/dist/core/agent-port.d.ts +116 -0
  20. package/dist/core/agent-port.d.ts.map +1 -0
  21. package/dist/core/agent-port.js +138 -0
  22. package/dist/core/agent-port.js.map +1 -0
  23. package/dist/core/bridge.d.ts.map +1 -1
  24. package/dist/core/bridge.js +120 -231
  25. package/dist/core/bridge.js.map +1 -1
  26. package/dist/core/controller.d.ts +44 -9
  27. package/dist/core/controller.d.ts.map +1 -1
  28. package/dist/core/controller.js +367 -292
  29. package/dist/core/controller.js.map +1 -1
  30. package/dist/core/validation.d.ts.map +1 -1
  31. package/dist/core/validation.js +103 -94
  32. package/dist/core/validation.js.map +1 -1
  33. package/dist/react/card.d.ts.map +1 -1
  34. package/dist/react/card.js +3 -3
  35. package/dist/react/card.js.map +1 -1
  36. package/dist/react/gestures.d.ts +6 -0
  37. package/dist/react/gestures.d.ts.map +1 -1
  38. package/dist/react/gestures.js +28 -15
  39. package/dist/react/gestures.js.map +1 -1
  40. package/dist/react/host.d.ts.map +1 -1
  41. package/dist/react/host.js +290 -270
  42. package/dist/react/host.js.map +1 -1
  43. package/dist/react.d.ts +9 -1
  44. package/dist/react.d.ts.map +1 -1
  45. package/dist/styles.css +1 -1
  46. package/package.json +3 -2
  47. package/src/agent.ts +879 -0
  48. package/src/contracts/events.ts +15 -0
  49. package/src/contracts/internal.ts +14 -1
  50. package/src/contracts/notifications.ts +16 -0
  51. package/src/contracts/snapshots.ts +8 -0
  52. package/src/core/actions.ts +149 -0
  53. package/src/core/agent-port.ts +237 -0
  54. package/src/core/bridge.ts +19 -105
  55. package/src/core/controller.ts +183 -56
  56. package/src/core/validation.ts +6 -3
  57. package/src/react/card.tsx +4 -3
  58. package/src/react/gestures.ts +45 -8
  59. package/src/react/host.tsx +48 -12
  60. package/src/react.ts +9 -1
@@ -16,7 +16,7 @@ function T(e) {
16
16
  return t;
17
17
  }
18
18
  var E = ".cloudlet-exit,.cloudlet-slide-out,.cloudlet-chrome-out,.cloudlet-heading-out,.cloudlet-body-out,.cloudlet-badge-out,.cloudlet-page-out", D = class extends y {
19
- #e = j(this);
19
+ #e = A(this);
20
20
  componentDidMount = this.#e.componentDidMount;
21
21
  getSnapshotBeforeUpdate = this.#e.getSnapshotBeforeUpdate;
22
22
  componentDidUpdate = this.#e.componentDidUpdate;
@@ -47,34 +47,34 @@ var E = ".cloudlet-exit,.cloudlet-slide-out,.cloudlet-chrome-out,.cloudlet-headi
47
47
  exitBg: " .cloudlet-stack > .cloudlet-exit > .cloudlet-shell > .cloudlet-bg",
48
48
  exitBadge: " .cloudlet-stack > .cloudlet-exit > .cloudlet-shell > .cloudlet-badge"
49
49
  }, ne = 3e3, O = (e) => Math.max(0, Math.min(1, e)), re = (e) => e?.setAttribute("inert", ""), k = (e) => `${Math.round(e * 100) / 100}px`, ie = (e, t) => t || e <= .01 ? "none" : `blur(${k(e)})`;
50
- function A(e, t, n) {
50
+ function ae(e, t, n) {
51
51
  let r = parseFloat(e?.getPropertyValue(t) ?? "");
52
52
  return Number.isFinite(r) ? r : n;
53
53
  }
54
- function j(y) {
55
- let { bridge: x, lease: S, document: E } = y.props, D = E.defaultView, j = b(), se = b(), ce = b(), M = b(), N = b(), le = b(), ue = b(), P = b(), de = b(), fe = b(), F = s(x, S, E, () => y.props.options.announcements), pe = null, me = null, he = null, ge = !1, _e = null, I = {}, ve = !1, L = null, ye = !1, R = null, be = y.props.options.motion?.overrides, z = u(be), xe = () => {
54
+ function A(y) {
55
+ let { bridge: x, lease: S, document: E } = y.props, D = E.defaultView, A = b(), se = b(), ce = b(), M = b(), N = b(), le = b(), ue = b(), de = b(), fe = b(), pe = b(), me = s(x, S, E, () => y.props.options.announcements), he = null, P = null, ge = null, _e = !1, ve = null, F = {}, ye = !1, I = null, be = !1, L = null, xe = y.props.options.motion?.overrides, R = u(xe), Se = () => {
56
56
  let e = y.props.options.motion?.overrides;
57
- e !== be && (be = e, z = u(e), R?.setConstants(z));
58
- }, B = !1, Se = !1, V = null, H = {
57
+ e !== xe && (xe = e, R = u(e), L?.setConstants(R));
58
+ }, z = !1, Ce = null, we = !1, B = null, V = {
59
59
  width: 0,
60
60
  height: 0,
61
61
  bodyTop: 0
62
- }, Ce = 0, we = -Infinity, U = {
62
+ }, Te = 0, Ee = -Infinity, H = {
63
63
  tailOffset: 4,
64
64
  tailScale: .9,
65
65
  pillHeight: 44
66
- }, W = !1, Te = "instant", Ee = /* @__PURE__ */ new Set(), G = 0, De = 2, K = null, Oe = null, ke = !1, Ae = null, q = null, je = !1, J = null, Me = null, Y = null, X = !1, Ne, Pe = /* @__PURE__ */ new WeakSet(), Fe = [];
67
- function Ie(e, t, ...n) {
66
+ }, U = !1, De = "instant", Oe = /* @__PURE__ */ new Set(), W = 0, ke = 2, G = null, Ae = null, je = !1, Me = null, K = null, Ne = !1, q = null, Pe = null, J = null, Y = !1, Fe, Ie = /* @__PURE__ */ new WeakSet(), Le = [];
67
+ function X(e, t, ...n) {
68
68
  try {
69
69
  let t = e(...n);
70
70
  if (typeof t != "string") throw TypeError("Label formatter must return a string");
71
71
  return t;
72
72
  } catch (r) {
73
- return Pe.has(e) || (Pe.add(e), Fe.push(r)), t(...n);
73
+ return Ie.has(e) || (Ie.add(e), Le.push(r)), t(...n);
74
74
  }
75
75
  }
76
- function Le() {
77
- for (let e of Fe.splice(0)) x.reportDiagnostic(S, {
76
+ function Re() {
77
+ for (let e of Le.splice(0)) x.reportDiagnostic(S, {
78
78
  code: "formatter-error",
79
79
  source: "Toaster.labels",
80
80
  message: "A label formatter failed",
@@ -85,16 +85,16 @@ function j(y) {
85
85
  scope: "host",
86
86
  reason: e,
87
87
  active: t
88
- }), Re = (e) => {
89
- Se !== e && (Se = e, Z("hover", e), R?.setHover(e));
90
- }, ze = (e) => {
91
- if (Be(e), !(D && e instanceof D.HTMLElement && !e.closest(".cloudlet-slot") && Q(e)) && !Q(pe)) {
88
+ }), ze = (e) => {
89
+ we !== e && (we = e, Z("hover", e), L?.setHover(e));
90
+ }, Be = (e) => {
91
+ if (Ve(e), !(D && e instanceof D.HTMLElement && !e.closest(".cloudlet-slot") && Q(e)) && !Q(he)) {
92
92
  let e = E.activeElement;
93
- D && e instanceof D.HTMLElement && e.blur(), j.current?.focus({ preventScroll: !0 });
93
+ D && e instanceof D.HTMLElement && e.blur(), A.current?.focus({ preventScroll: !0 });
94
94
  }
95
95
  };
96
- function Be(e) {
97
- D && e instanceof D.HTMLElement && e !== E.body && !j.current?.contains(e) && (pe = e);
96
+ function Ve(e) {
97
+ D && e instanceof D.HTMLElement && e !== E.body && !A.current?.contains(e) && (he = e);
98
98
  }
99
99
  function Q(e) {
100
100
  if (!e?.isConnected || e.closest("[hidden],[inert],[aria-hidden=\"true\"]") || e.matches(":disabled")) return !1;
@@ -104,20 +104,20 @@ function j(y) {
104
104
  }
105
105
  return e.focus({ preventScroll: !0 }), E.activeElement === e;
106
106
  }
107
- function Ve() {
108
- if (Q(pe)) return !0;
107
+ function He() {
108
+ if (Q(he)) return !0;
109
109
  for (let e of E.querySelectorAll("button,a[href],input,select,textarea,summary,[tabindex]")) if (e.tabIndex >= 0 && !e.closest(".cloudlet-host") && Q(e)) return !0;
110
110
  let e = E.body.getAttribute("tabindex");
111
111
  E.body.setAttribute("tabindex", "-1");
112
112
  let t = Q(E.body);
113
113
  return e === null ? E.body.removeAttribute("tabindex") : E.body.setAttribute("tabindex", e), t;
114
114
  }
115
- let He = (e) => {
116
- let t = !!e && !!j.current?.contains(e);
115
+ let Ue = (e) => {
116
+ let t = !!e && !!A.current?.contains(e);
117
117
  Z("focus", t), x.setFocused(S, t ? x.getSnapshot().presentation?.handle ?? null : null);
118
118
  };
119
- function Ue() {
120
- if (!ve || !D) return;
119
+ function We() {
120
+ if (!ye || !D) return;
121
121
  let e = E.documentElement.clientWidth || D.innerWidth, t = E.documentElement.clientHeight || D.innerHeight, n = v(e, t, D.visualViewport);
122
122
  for (let e of [
123
123
  "top",
@@ -126,27 +126,30 @@ function j(y) {
126
126
  "left",
127
127
  "width",
128
128
  "height"
129
- ]) I.viewport?.setProperty(`--cloudlet-viewport-${e}`, `${n[e]}px`);
129
+ ]) F.viewport?.setProperty(`--cloudlet-viewport-${e}`, `${n[e]}px`);
130
130
  }
131
- let We = () => j.current?.dataset.edge === "bottom", Ge = () => We() ? 1 : -1;
132
- function Ke(e) {
133
- let t = I, { reduced: n } = e, r = Math.max(0, e.width), i = Math.max(0, e.height), a = Math.min(Math.max(0, e.radius), r / 2, i / 2), o = We(), s = o ? H.height - i : 0;
131
+ let Ge = () => A.current?.dataset.edge === "bottom", Ke = () => Ge() ? 1 : -1, qe = () => {
132
+ let e = A.current?.dataset.align;
133
+ return e === "left" ? 0 : e === "right" ? 1 : .5;
134
+ };
135
+ function Je(e) {
136
+ let t = F, { reduced: n } = e, r = Math.max(0, e.width), i = Math.max(0, e.height), a = Math.min(Math.max(0, e.radius), r / 2, i / 2), o = Ge(), s = o ? V.height - i : 0, c = qe(), l = `translateX(${-c * 100}%)`, u = (V.width - r) * c;
134
137
  t.shell && (t.shell.opacity = String(O(e.opacity)), t.shell.transform = n ? "none" : `translate(${k(e.dragX)}, ${k(e.y + e.dragY)}) scale(${e.scale})`);
135
- let c = le.current;
136
- if (c && (c.setAttribute("width", String(r)), c.setAttribute("height", String(i)), ue.current?.setAttribute("d", m(r, i, a))), t.bg && (t.bg.borderRadius = k(a), t.bg.top = "0px", t.bg.bottom = "auto", t.bg.transform = `translateX(-50%) translateY(${k(s)})`), t.clip && (t.clip.clipPath = `path("${m(r, i, a, (H.width - r) / 2, s)}")`), t.badge) {
137
- let i = n ? 1 : z.badge.scale + (1 - z.badge.scale) * e.badge, a = (r / 2 - 10) * (je ? -1 : 1);
138
+ let d = le.current;
139
+ if (d && (d.setAttribute("width", String(r)), d.setAttribute("height", String(i)), ue.current?.setAttribute("d", m(r, i, a))), t.bg && (t.bg.borderRadius = k(a), t.bg.top = "0px", t.bg.bottom = "auto", t.bg.transform = `${l} translateY(${k(s)})`), t.clip && (t.clip.clipPath = `path("${m(r, i, a, u, s)}")`), t.badge) {
140
+ let i = n ? 1 : R.badge.scale + (1 - R.badge.scale) * e.badge, a = (Ne ? u + 10 : u + r - 10) - V.width / 2;
138
141
  t.badge.opacity = String(O(e.badge)), t.badge.transform = `translate(calc(${k(a)} - 50%), ${o ? "6px" : "-6px"}) scale(${i})`;
139
142
  }
140
- let l = o ? -1 : 1;
143
+ let f = o ? -1 : 1;
141
144
  for (let n of [1, 2]) {
142
145
  let a = t[`tail${n}`];
143
146
  if (!a) continue;
144
147
  let o = e[`tail${n}`];
145
- a.width = k(r), a.height = k(Math.min(i, U.pillHeight)), a.opacity = String(O(e[`tail${n}Opacity`])), a.transform = `translateX(-50%) translateY(${k(l * o * (U.tailOffset + z.hoverLift * e.lift))}) scale(${U.tailScale ** +o})`;
148
+ a.width = k(r), a.height = k(Math.min(i, H.pillHeight)), a.opacity = String(O(e[`tail${n}Opacity`])), a.transform = `${l} translateY(${k(f * o * (H.tailOffset + R.hoverLift * e.lift))}) scale(${H.tailScale ** +o})`;
146
149
  }
147
- t.slideOut && (t.slideOut.transform = n ? "none" : `translateX(${k(e.slide - e.slideDirection * e.slideWidth)})`, t.slideOut.opacity = String(O(e.slideOut))), t.peek && (t.peek.width = k(H.width), t.peek.top = k(H.bodyTop), t.peek.transform = `translateX(${k(e.slide + (J?.side ?? 0) * H.width)})`);
148
- let u = n ? "none" : `translate(${k(e.headX)}, ${k(e.headY)})`;
149
- t.headerIn && (t.headerIn.transform = u), t.headerOut && (t.headerOut.transform = u);
150
+ t.slideOut && (t.slideOut.transform = n ? "none" : `translateX(${k(e.slide - e.slideDirection * e.slideWidth)})`, t.slideOut.opacity = String(O(e.slideOut))), t.peek && (t.peek.width = k(V.width), t.peek.top = k(V.bodyTop), t.peek.transform = `translateX(${k(e.slide + (q?.side ?? 0) * V.width)})`);
151
+ let p = n ? "none" : `translate(${k(e.headX)}, ${k(e.headY)})`;
152
+ t.headerIn && (t.headerIn.transform = p), t.headerOut && (t.headerOut.transform = p);
150
153
  for (let [r, i] of [
151
154
  [t.headerIn, e.headerIn],
152
155
  [t.headerOut, e.headerOut],
@@ -154,38 +157,38 @@ function j(y) {
154
157
  [t.badgeOut, e.badgeOut],
155
158
  [t.pageIn, e.pageIn],
156
159
  [t.pageOut, e.pageOut]
157
- ]) r && (r.opacity = String(O(i)), r.filter = ie((1 - O(i)) * z.blur, n));
158
- t.chrome && (t.chrome.opacity = String(O(e.chrome)), t.chrome.transform = n ? "none" : `translateY(${k((1 - O(e.chrome)) * z.chromeOffset)})`), t.chromeOut && (t.chromeOut.opacity = String(O(e.chromeOut))), t.body && (t.body.opacity = String(O(e.chrome) * O(e.bodyIn) * O(e.slideIn)), t.body.transform = n ? "none" : `translateX(${k(e.slide)}) translateY(${k((1 - O(e.chrome)) * z.chromeOffset + (1 - O(e.bodyIn)) * z.bodyOffset)})`), t.bodyOut && (t.bodyOut.opacity = String(O(e.bodyOut))), t.exit && (t.exit.opacity = String(O(e.exitOpacity)), t.exit.transform = n ? "translateX(-50%)" : `translateX(-50%) translate(${k(e.exitX)}, ${k(e.exitY)}) scale(${e.exitScale})`), ke && K?.isConnected && K.setAttribute("stroke-dasharray", `${Math.round(e.progress * 1e4) / 100} 100`);
160
+ ]) r && (r.opacity = String(O(i)), r.filter = ie((1 - O(i)) * R.blur, n));
161
+ t.chrome && (t.chrome.opacity = String(O(e.chrome)), t.chrome.transform = n ? "none" : `translateY(${k((1 - O(e.chrome)) * R.chromeOffset)})`), t.chromeOut && (t.chromeOut.opacity = String(O(e.chromeOut))), t.body && (t.body.opacity = String(O(e.chrome) * O(e.bodyIn) * O(e.slideIn)), t.body.transform = n ? "none" : `translateX(${k(e.slide)}) translateY(${k((1 - O(e.chrome)) * R.chromeOffset + (1 - O(e.bodyIn)) * R.bodyOffset)})`), t.bodyOut && (t.bodyOut.opacity = String(O(e.bodyOut))), t.exit && (t.exit.opacity = String(O(e.exitOpacity)), t.exit.transform = n ? l : `${l} translate(${k(e.exitX)}, ${k(e.exitY)}) scale(${e.exitScale})`), je && G?.isConnected && G.setAttribute("stroke-dasharray", `${Math.round(e.progress * 1e4) / 100} 100`);
159
162
  }
160
- function qe() {
163
+ function Ye() {
161
164
  let e = ce.current, t = N.current, n = _(y.props.snapshot).presented;
162
- if (!e || !t || !D || !R || !n) {
163
- W = !1;
165
+ if (!e || !t || !D || !L || !n) {
166
+ U = !1;
164
167
  return;
165
168
  }
166
169
  let r = e.getBoundingClientRect();
167
- if (W = r.width > 0 && r.height > 0, Ye(n), !W) return;
168
- let i = D.getComputedStyle(j.current);
169
- U = {
170
- tailOffset: A(i, "--cloudlet-tail-offset", 4),
171
- tailScale: A(i, "--cloudlet-tail-scale", .9),
172
- pillHeight: A(i, "--cloudlet-pill-height", 44)
170
+ if (U = r.width > 0 && r.height > 0, Ze(n), !U) return;
171
+ let i = D.getComputedStyle(A.current);
172
+ H = {
173
+ tailOffset: ae(i, "--cloudlet-tail-offset", 4),
174
+ tailScale: ae(i, "--cloudlet-tail-scale", .9),
175
+ pillHeight: ae(i, "--cloudlet-pill-height", 44)
173
176
  };
174
177
  let a = y.props.snapshot.island.open, o = parseFloat(D.getComputedStyle(t).borderTopLeftRadius), s = Math.min(Number.isFinite(o) ? o : a ? 24 : r.height / 2, r.height / 2, r.width / 2);
175
- H = {
178
+ V = {
176
179
  width: r.width,
177
180
  height: r.height,
178
181
  bodyTop: $()?.offsetTop ?? 0
179
- }, R.setShape({
182
+ }, L.setShape({
180
183
  width: r.width,
181
184
  height: r.height,
182
185
  radius: s
183
- }, Te), Te = "close", Je();
186
+ }, De), De = "close", Xe();
184
187
  }
185
- function Je() {
188
+ function Xe() {
186
189
  let e = $();
187
190
  if (!e) return;
188
- let t = nt()?.querySelector("[data-cloudlet-title]")?.id;
191
+ let t = it()?.querySelector("[data-cloudlet-title]")?.id;
189
192
  if (e.scrollHeight - e.clientHeight > 1 && t) e.tabIndex = 0, e.setAttribute("role", "group"), e.setAttribute("aria-labelledby", t);
190
193
  else for (let t of [
191
194
  "tabindex",
@@ -193,185 +196,185 @@ function j(y) {
193
196
  "aria-labelledby"
194
197
  ]) e.removeAttribute(t);
195
198
  }
196
- function Ye(e) {
197
- let t = e && !W && x.getSnapshot().presentation?.readable ? e.handle : null;
198
- t !== Ae && (Ae && x.setPause(S, {
199
+ function Ze(e) {
200
+ let t = e && !U && x.getSnapshot().presentation?.readable ? e.handle : null;
201
+ t !== Me && (Me && x.setPause(S, {
199
202
  scope: "notification",
200
- handle: Ae,
203
+ handle: Me,
201
204
  reason: "content-transition",
202
205
  active: !1
203
- }), Ae = t, t && x.setPause(S, {
206
+ }), Me = t, t && x.setPause(S, {
204
207
  scope: "notification",
205
208
  handle: t,
206
209
  reason: "content-transition",
207
210
  active: !0
208
211
  }));
209
212
  }
210
- function Xe() {
213
+ function Qe() {
211
214
  let e = x.getSnapshot().presentation;
212
- if (!e?.token || e.readable || Ee.size) return;
215
+ if (!e?.token || e.readable || Oe.size) return;
213
216
  let t = M.current?.querySelector(`[data-cloudlet-presented="${e.handle.generation}"]`), n = t?.getBoundingClientRect();
214
- t && W && n?.width && n.height && D?.getComputedStyle(t).visibility !== "hidden" && x.acknowledgePresentation(S, e.handle, e.token);
217
+ t && U && n?.width && n.height && D?.getComputedStyle(t).visibility !== "hidden" && x.acknowledgePresentation(S, e.handle, e.token);
215
218
  }
216
- let Ze = (e) => (Ee.add(e), () => {
217
- Ee.delete(e), Xe();
218
- }), Qe = () => {
219
- Ue(), qe(), Xe();
219
+ let $e = (e) => (Oe.add(e), () => {
220
+ Oe.delete(e), Qe();
221
+ }), et = () => {
222
+ We(), Ye(), Qe();
220
223
  };
221
- function $e() {
222
- let e = j.current;
224
+ function tt() {
225
+ let e = A.current;
223
226
  return (y.props.snapshot.island.open ? e?.querySelector(".cloudlet-slide [data-cloudlet-title]") : null) ?? e?.querySelector("[data-cloudlet-pill]") ?? null;
224
227
  }
225
- function et() {
228
+ function nt() {
226
229
  let e = y.props.snapshot.focusRequest;
227
230
  if (!e || x.getSnapshot().focusRequest?.token !== e.token) return;
228
- let t = j.current, n = e.target, r = null;
229
- n.kind === "anchor" ? r = t : n.kind === "overflow" ? r = t?.querySelector("[data-cloudlet-overflow]") ?? t?.querySelector("[data-cloudlet-pill]") ?? null : n.kind === "notification" && (r = M.current?.querySelector(`[data-cloudlet-presented="${n.handle.generation}"]`) ? n.control ? M.current.querySelector(`[data-cloudlet-control="${n.control}"]`) : $e() : null), Be(E.activeElement);
231
+ let t = A.current, n = e.target, r = null;
232
+ n.kind === "anchor" ? r = t : n.kind === "overflow" ? r = t?.querySelector("[data-cloudlet-overflow]") ?? t?.querySelector("[data-cloudlet-pill]") ?? null : n.kind === "notification" && (r = M.current?.querySelector(`[data-cloudlet-presented="${n.handle.generation}"]`) ? n.control ? M.current.querySelector(`[data-cloudlet-control="${n.control}"]`) : tt() : null), Ve(E.activeElement);
230
233
  let i = Q(r);
231
234
  x.acknowledgeFocus(S, e.token, i ? "focused" : "unavailable");
232
235
  }
233
- function tt(e) {
236
+ function rt(e) {
234
237
  e?.replaceChildren();
235
238
  }
236
- function nt() {
239
+ function it() {
237
240
  return M.current?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading") ?? null;
238
241
  }
239
242
  function $() {
240
243
  return M.current?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-body") ?? null;
241
244
  }
242
- function rt(e) {
245
+ function at(e) {
243
246
  let t = M.current, n = N.current;
244
- if (!t || !n || !W) return {};
247
+ if (!t || !n || !U) return {};
245
248
  let r = {};
246
- (e.presence === "exit" || e.presence === "rise" || e.presence === "replace") && (r.exit = T(t), I.exitClip && (I.exitClip.clipPath = I.clip?.clipPath ?? ""), I.exitBg && (I.exitBg.borderRadius = I.bg?.borderRadius ?? ""), I.exitBadge && (I.exitBadge.opacity = I.badge?.opacity ?? "", I.exitBadge.transform = I.badge?.transform ?? ""), I.exit && (I.exit.width = k(H.width)));
249
+ (e.presence === "exit" || e.presence === "rise" || e.presence === "replace") && (r.exit = T(t), F.exitClip && (F.exitClip.clipPath = F.clip?.clipPath ?? ""), F.exitBg && (F.exitBg.borderRadius = F.bg?.borderRadius ?? ""), F.exitBadge && (F.exitBadge.opacity = F.badge?.opacity ?? "", F.exitBadge.transform = F.badge?.transform ?? ""), F.exit && (F.exit.width = k(V.width)));
247
250
  let i = $();
248
- if (e.slide && i && (r.slide = T(i), Ce = i.offsetTop, I.slideOut && (I.slideOut.width = k(H.width))), e.morph === "close") {
251
+ if (e.slide && i && (r.slide = T(i), Te = i.offsetTop, F.slideOut && (F.slideOut.width = k(V.width))), e.morph === "close") {
249
252
  let e = T(n);
250
- e.querySelector(".cloudlet-header")?.classList.add("cloudlet-ghost"), r.chrome = e, I.chromeOut && (I.chromeOut.width = k(H.width));
253
+ e.querySelector(".cloudlet-header")?.classList.add("cloudlet-ghost"), r.chrome = e, F.chromeOut && (F.chromeOut.width = k(V.width));
251
254
  }
252
- let a = nt();
255
+ let a = it();
253
256
  e.header && a && (r.header = T(a));
254
- let o = $(), s = R?.now() ?? 0, c = e.body && s - we < (R?.constants.bodyQuiet ?? 0);
255
- e.body && (we = s), e.body && !e.slide && o && !c && !R?.swapping("body") && (r.body = T(o), I.bodyOut && (I.bodyOut.top = k(o.offsetTop)));
257
+ let o = $(), s = L?.now() ?? 0, c = e.body && s - Ee < (L?.constants.bodyQuiet ?? 0);
258
+ e.body && (Ee = s), e.body && !e.slide && o && !c && !L?.swapping("body") && (r.body = T(o), F.bodyOut && (F.bodyOut.top = k(o.offsetTop)));
256
259
  let l = t.querySelector(":scope > .cloudlet-badge > .cloudlet-badge-value");
257
260
  e.badge && l && (r.badge = T(l));
258
261
  let u = n.querySelector(":scope > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-value");
259
262
  return e.page && u && (r.page = T(u)), r;
260
263
  }
261
- function it(e, t) {
262
- let n = M.current, r = e === "exit" ? P.current : e === "slide" ? de.current : e === "chrome" ? fe.current : e === "header" ? n?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading-out") : e === "body" ? n?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-body-out") : e === "badge" ? n?.querySelector(":scope > .cloudlet-badge > .cloudlet-badge-out") : n?.querySelector(":scope > .cloudlet-clip > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-out");
264
+ function ot(e, t) {
265
+ let n = M.current, r = e === "exit" ? de.current : e === "slide" ? fe.current : e === "chrome" ? pe.current : e === "header" ? n?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-header > .cloudlet-heading-out") : e === "body" ? n?.querySelector(":scope > .cloudlet-clip > .cloudlet-slide > .cloudlet-body-out") : e === "badge" ? n?.querySelector(":scope > .cloudlet-badge > .cloudlet-badge-out") : n?.querySelector(":scope > .cloudlet-clip > .cloudlet-indicator > .cloudlet-page > .cloudlet-page-out");
263
266
  return r ? (r.setAttribute("inert", ""), r.replaceChildren(t), r) : null;
264
267
  }
265
- function at(e, t, n) {
266
- if (!R) return;
268
+ function st(e, t, n) {
269
+ if (!L) return;
267
270
  let r = n?.plan ?? g(e, t);
268
- ot(t);
271
+ ct(t);
269
272
  let i = {};
270
- for (let [e, t] of Object.entries(n?.clones ?? {})) i[e] = it(e, t);
271
- let a = (e) => () => tt(i[e]), o = () => {
272
- G && (G = 0, y.forceUpdate());
273
- }, s = () => tt(P.current);
274
- r.presence === "enter" ? Te = "instant" : r.morph === "open" && (Te = "open"), qe();
275
- let c = n?.heading, l = c && r.morph !== "none" ? nt()?.getBoundingClientRect() : null;
276
- c && l && R.shiftHeading(c.left - l.left, c.top - l.top, r.morph === "open" ? "open" : "close");
277
- let u = Ge(), d = Y && e.presented?.handle === Y.handle && !t.stack.includes(Y.handle) ? Y : void 0;
278
- Y && !t.stack.includes(Y.handle) && (Y = null), (r.presence === "exit" || r.presence === "rise" || r.presence === "replace") && (i.exit ? R.exit(u, s, d) : d && R.release("dragX", 0), r.presence === "exit" && R.hide()), (r.presence === "enter" || r.presence === "replace") && (R.enter(u, Ze("presence")), r.presence === "enter" && (R.setTails(t.depth, "settle", 0, o), t.open ? R.open() : R.setBadge(t.badge))), r.presence === "rise" && (R.rise(-u * U.tailOffset, U.tailScale, Ze("presence")), R.swap("header", Ze("header"), !0)), (r.tails === "arrival" || r.tails === "rise" || r.tails === "settle") && (t.depth < e.depth && (G = Math.max(G, e.depth)), R.setTails(t.depth, r.tails, e.depth, o)), r.morph === "open" ? (G = Math.max(G, e.depth), R.open(o)) : r.morph === "close" && R.collapse(t.depth, t.badge, {
273
+ for (let [e, t] of Object.entries(n?.clones ?? {})) i[e] = ot(e, t);
274
+ let a = (e) => () => rt(i[e]), o = () => {
275
+ W && (W = 0, y.forceUpdate());
276
+ }, s = () => rt(de.current);
277
+ r.presence === "enter" ? De = "instant" : r.morph === "open" && (De = "open"), Ye();
278
+ let c = n?.heading, l = c && r.morph !== "none" ? it()?.getBoundingClientRect() : null;
279
+ c && l && L.shiftHeading(c.left - l.left, c.top - l.top, r.morph === "open" ? "open" : "close");
280
+ let u = Ke(), d = J && e.presented?.handle === J.handle && !t.stack.includes(J.handle) ? J : void 0;
281
+ J && !t.stack.includes(J.handle) && (J = null), (r.presence === "exit" || r.presence === "rise" || r.presence === "replace") && (i.exit ? L.exit(u, s, d) : d && L.release("dragX", 0), r.presence === "exit" && L.hide()), (r.presence === "enter" || r.presence === "replace") && (L.enter(u, $e("presence")), r.presence === "enter" && (L.setTails(t.depth, "settle", 0, o), t.open ? L.open() : L.setBadge(t.badge))), r.presence === "rise" && (L.rise(-u * H.tailOffset, H.tailScale, $e("presence")), L.swap("header", $e("header"), !0)), (r.tails === "arrival" || r.tails === "rise" || r.tails === "settle") && (t.depth < e.depth && (W = Math.max(W, e.depth)), L.setTails(t.depth, r.tails, e.depth, o)), r.morph === "open" ? (W = Math.max(W, e.depth), L.open(o)) : r.morph === "close" && L.collapse(t.depth, t.badge, {
279
282
  chrome: a("chrome"),
280
283
  tails: o
281
284
  });
282
- let f = We() && n ? H.height - n.height : 0;
283
- if (I.slideOut && (I.slideOut.top = k(f + Ce)), I.chromeOut && i.chrome && (I.chromeOut.top = k(f)), r.slide) {
284
- let e = Ze("slide");
285
- R.slide(je ? -r.slide : r.slide, H.width, () => {
286
- tt(i.slide), e();
285
+ let f = Ge() && n ? V.height - n.height : 0;
286
+ if (F.slideOut && (F.slideOut.top = k(f + Te)), F.chromeOut && i.chrome && (F.chromeOut.top = k(f)), r.slide) {
287
+ let e = $e("slide");
288
+ L.slide(Ne ? -r.slide : r.slide, V.width, () => {
289
+ rt(i.slide), e();
287
290
  });
288
291
  }
289
292
  if (i.header) {
290
- let e = Ze("header");
291
- R.swap("header", () => {
292
- tt(i.header), e();
293
+ let e = $e("header");
294
+ L.swap("header", () => {
295
+ rt(i.header), e();
293
296
  });
294
297
  }
295
- i.body && R.swap("body", a("body")), i.badge && R.swap("badge", a("badge")), i.page && R.swap("page", a("page")), !t.open && e.presented && t.presented && r.morph === "none" && R.setBadge(t.badge);
298
+ i.body && L.swap("body", a("body")), i.badge && L.swap("badge", a("badge")), i.page && L.swap("page", a("page")), !t.open && e.presented && t.presented && r.morph === "none" && L.setBadge(t.badge);
296
299
  let p = x.getSnapshot().presentation;
297
300
  r.begin && r.header && t.presented && p?.token && p.readable && p.handle === t.presented.handle && x.beginPresentation(S, t.presented.handle, p.token);
298
301
  }
299
- function ot(e) {
300
- let t = e.presented, n = t?.content.progress, r = nt()?.querySelector(":scope > .cloudlet-icon > .cloudlet-ring > .cloudlet-progress-fill") ?? null, i = n?.kind === "determinate", a = r !== K || t?.handle !== Oe || !ke;
301
- K = r, Oe = t?.handle ?? null, ke = i && !!r, R?.setProgress(i ? n.value : null, a);
302
+ function ct(e) {
303
+ let t = e.presented, n = t?.content.progress, r = it()?.querySelector(":scope > .cloudlet-icon > .cloudlet-ring > .cloudlet-progress-fill") ?? null, i = n?.kind === "determinate", a = r !== G || t?.handle !== Ae || !je;
304
+ G = r, Ae = t?.handle ?? null, je = i && !!r, L?.setProgress(i ? n.value : null, a);
302
305
  }
303
- function st(e) {
304
- (J?.handle !== e?.handle || J?.side !== e?.side) && (J = e, y.forceUpdate());
306
+ function lt(e) {
307
+ (q?.handle !== e?.handle || q?.side !== e?.side) && (q = e, y.forceUpdate());
305
308
  }
306
- function ct(e) {
309
+ function ut(e) {
307
310
  return {
308
- move: (e) => R?.drag("dragX", e),
311
+ move: (e) => L?.drag("dragX", e),
309
312
  end: (t, n) => {
310
- let r = f(t, n, H.width, {
313
+ let r = f(t, n, V.width, {
311
314
  negative: !0,
312
315
  positive: !0
313
316
  });
314
317
  if (r) {
315
- if (Y = {
318
+ if (J = {
316
319
  handle: e,
317
320
  direction: r,
318
- distance: H.width,
321
+ distance: V.width,
319
322
  velocity: n * 1e3
320
323
  }, x.dismiss(S, e, "swipe").status === "applied") return;
321
- Y = null;
324
+ J = null;
322
325
  }
323
- R?.release("dragX", n * 1e3);
326
+ L?.release("dragX", n * 1e3);
324
327
  },
325
- cancel: () => R?.release("dragX", 0)
328
+ cancel: () => L?.release("dragX", 0)
326
329
  };
327
330
  }
328
- function lt(e, t) {
331
+ function dt(e, t) {
329
332
  let n = y.props.snapshot.stack, r = n.indexOf(e);
330
- return r < 0 ? null : n[r + t * (je ? -1 : 1)] ?? null;
333
+ return r < 0 ? null : n[r + t * (Ne ? -1 : 1)] ?? null;
331
334
  }
332
- function ut(e) {
335
+ function ft(e) {
333
336
  let t = (t) => {
334
- let n = t < 0 ? 1 : -1, r = t ? lt(e, n) : null;
335
- return st(r ? {
337
+ let n = t < 0 ? 1 : -1, r = t ? dt(e, n) : null;
338
+ return lt(r ? {
336
339
  handle: r,
337
340
  side: n
338
- } : null), r ? Math.max(-H.width, Math.min(H.width, t)) : p(t, H.width);
339
- }, n = (e) => R?.release("slide", e, () => st(null));
341
+ } : null), r ? Math.max(-V.width, Math.min(V.width, t)) : p(t, V.width);
342
+ }, n = (e) => L?.release("slide", e, () => lt(null));
340
343
  return {
341
- move: (e) => R?.drag("slide", t(e)),
344
+ move: (e) => L?.drag("slide", t(e)),
342
345
  end: (t, r) => {
343
- let i = f(t, r, H.width, {
344
- negative: !!lt(e, 1),
345
- positive: !!lt(e, -1)
346
- }), a = i ? lt(e, i < 0 ? 1 : -1) : null;
346
+ let i = f(t, r, V.width, {
347
+ negative: !!dt(e, 1),
348
+ positive: !!dt(e, -1)
349
+ }), a = i ? dt(e, i < 0 ? 1 : -1) : null;
347
350
  if (a) {
348
- let e = J;
349
- if (J = null, R?.fling("slide", r * 1e3), x.navigate(S, a).status === "applied") return;
350
- J = e;
351
+ let e = q;
352
+ if (q = null, L?.fling("slide", r * 1e3), x.navigate(S, a).status === "applied") return;
353
+ q = e;
351
354
  }
352
- n(J ? r * 1e3 : 0);
355
+ n(q ? r * 1e3 : 0);
353
356
  },
354
357
  cancel: () => n(0)
355
358
  };
356
359
  }
357
- function dt() {
358
- let e = We() ? 1 : -1, t = (t) => p(t, t * e > 0 ? H.height : c.swipe.minDistance);
360
+ function pt() {
361
+ let e = Ge() ? 1 : -1, t = (t) => p(t, t * e > 0 ? V.height : c.swipe.minDistance);
359
362
  return {
360
- move: (e) => R?.drag("dragY", t(e)),
363
+ move: (e) => L?.drag("dragY", t(e)),
361
364
  end: (t, n) => {
362
- R?.release("dragY", 0);
363
- let r = Math.min(H.height, c.swipe.edge / c.swipe.distance);
365
+ L?.release("dragY", 0);
366
+ let r = Math.min(V.height, c.swipe.edge / c.swipe.distance);
364
367
  f(t, n, r, {
365
368
  negative: e < 0,
366
369
  positive: e > 0
367
370
  }) && x.collapseIsland(S);
368
371
  },
369
- cancel: () => R?.release("dragY", 0)
372
+ cancel: () => L?.release("dragY", 0)
370
373
  };
371
374
  }
372
- function ft(e, t) {
375
+ function mt(e, t) {
373
376
  let n = M.current, r = N.current, { presented: i, open: a } = _(y.props.snapshot);
374
- if (B || !R || !W || !n || !r || !i || !n.contains(e)) return null;
377
+ if (z || !L || !U || !n || !r || !i || !n.contains(e)) return null;
375
378
  let o, s = !1;
376
379
  if (a ? (o = r.contains(e), s = o && t === "pointer" && !!e.closest(".cloudlet-clip > .cloudlet-slide > .cloudlet-header")) : o = t === "pointer" && !!e.closest("[data-cloudlet-pill]"), !o && !s) return null;
377
380
  let { handle: c } = i;
@@ -381,7 +384,7 @@ function j(y) {
381
384
  reason: "gesture",
382
385
  active: !0
383
386
  }).status === "rejected") return null;
384
- Me = {
387
+ Pe = {
385
388
  handle: c,
386
389
  open: a
387
390
  };
@@ -389,9 +392,9 @@ function j(y) {
389
392
  return {
390
393
  x: o,
391
394
  y: s,
392
- start: (e) => a ? e === "x" ? ut(c) : dt() : ct(c),
395
+ start: (e) => a ? e === "x" ? ft(c) : pt() : ut(c),
393
396
  release() {
394
- l || (l = !0, Me = null, x.setPause(S, {
397
+ l || (l = !0, Pe = null, x.setPause(S, {
395
398
  scope: "notification",
396
399
  handle: c,
397
400
  reason: "gesture",
@@ -400,45 +403,60 @@ function j(y) {
400
403
  }
401
404
  };
402
405
  }
403
- function pt() {
404
- let e = j.current, t = M.current;
406
+ function ht(e) {
407
+ let t = M.current;
408
+ return !!t && _(y.props.snapshot).open && t.contains(e);
409
+ }
410
+ function gt() {
411
+ let e = A.current, t = M.current;
405
412
  if (!e || !D || !t) return;
406
- ve = !0;
413
+ ye = !0;
407
414
  let n = se.current?.sheet, r = `[data-cloudlet-instance="${y.props.snapshot.controller}"]`;
408
415
  if (n) for (let [e, t] of Object.entries(te)) {
409
416
  let i = n.insertRule(`${r}${t} {}`, n.cssRules.length);
410
- I[e] = n.cssRules[i].style;
417
+ F[e] = n.cssRules[i].style;
411
418
  }
412
419
  for (let e of [
413
- P.current,
414
420
  de.current,
415
- fe.current
421
+ fe.current,
422
+ pe.current
416
423
  ]) e?.setAttribute("inert", "");
417
- F.mount(e), q = d(e, {
418
- begin: ft,
424
+ me.mount(e), K = d(e, {
425
+ begin: mt,
426
+ claimsWheel: ht,
419
427
  now: () => D.performance.now()
420
428
  });
421
- let i = D.matchMedia?.("(prefers-reduced-motion: reduce)");
422
- B = i?.matches ?? !1, e.dataset.reducedMotion = String(B), R = l({
429
+ let i = D.matchMedia?.("(prefers-reduced-motion: reduce)"), a = !!e.parentElement?.closest("[data-reduced-motion]"), o = () => (i?.matches ?? !1) || y.props.options.reducedMotion === !0 || a;
430
+ z = o(), e.dataset.reducedMotion = String(z), L = l({
423
431
  now: () => D.performance.now(),
424
432
  requestFrame: (e) => D.requestAnimationFrame(e),
425
433
  cancelFrame: (e) => D.cancelAnimationFrame(e),
426
- write: Ke,
427
- reducedMotion: B,
434
+ write: Je,
435
+ reducedMotion: z,
428
436
  timeScale: y.props.options.motion?.timeScale,
429
- constants: z
437
+ constants: R
430
438
  });
431
- let a = () => {
432
- B = i?.matches ?? !1, e.dataset.reducedMotion = String(B), B && q?.cancel(), R?.setReducedMotion(B);
433
- }, o = D.matchMedia?.("(min-width: 48rem)"), s = D.matchMedia?.("(prefers-color-scheme: dark)"), c = () => {
439
+ let s = () => {
440
+ let t = o();
441
+ t !== z && (z = t, e.dataset.reducedMotion = String(z), z && K?.cancel(), L?.setReducedMotion(z));
442
+ };
443
+ Ce = s;
444
+ let c = D.MutationObserver ? new D.MutationObserver(() => {
445
+ a = !!e.parentElement?.closest("[data-reduced-motion]"), s();
446
+ }) : null;
447
+ for (let t = e.parentElement; t && c; t = t.parentElement) c.observe(t, {
448
+ attributes: !0,
449
+ attributeFilter: ["data-reduced-motion"]
450
+ });
451
+ let u = D.matchMedia?.("(min-width: 48rem)"), f = D.matchMedia?.("(prefers-color-scheme: dark)"), p = () => {
434
452
  (y.props.options.theme ?? "system") === "system" && y.forceUpdate();
435
- }, u = () => {
436
- (y.props.options.position ?? "auto") === "auto" && (q?.cancel(), y.forceUpdate());
437
- }, f = () => Z("document-hidden", E.visibilityState === "hidden"), p = [
453
+ }, m = () => {
454
+ (y.props.options.position ?? "auto") === "auto" && (K?.cancel(), y.forceUpdate());
455
+ }, g = () => Z("document-hidden", E.visibilityState === "hidden"), v = [
438
456
  [
439
457
  E,
440
458
  "visibilitychange",
441
- f
459
+ g
442
460
  ],
443
461
  [
444
462
  E,
@@ -453,7 +471,7 @@ function j(y) {
453
471
  E,
454
472
  "pointerover",
455
473
  (t) => {
456
- Se && !(t.target instanceof D.Node && e.contains(t.target)) && Re(!1);
474
+ we && !(t.target instanceof D.Node && e.contains(t.target)) && ze(!1);
457
475
  },
458
476
  !0
459
477
  ],
@@ -470,81 +488,82 @@ function j(y) {
470
488
  [
471
489
  D,
472
490
  "resize",
473
- Qe
491
+ et
474
492
  ]
475
493
  ];
476
- i && p.push([
494
+ i && v.push([
477
495
  i,
478
496
  "change",
479
- a
480
- ]), o && p.push([
481
- o,
497
+ s
498
+ ]), u && v.push([
499
+ u,
482
500
  "change",
483
- u
484
- ]), s && p.push([
485
- s,
501
+ m
502
+ ]), f && v.push([
503
+ f,
486
504
  "change",
487
- c
488
- ]), D.visualViewport && p.push([
505
+ p
506
+ ]), D.visualViewport && v.push([
489
507
  D.visualViewport,
490
508
  "resize",
491
- Qe
509
+ et
492
510
  ], [
493
511
  D.visualViewport,
494
512
  "scroll",
495
- Ue
513
+ We
496
514
  ]);
497
- for (let [e, t, n, r] of p) e.addEventListener(t, n, r);
498
- _e = () => {
499
- for (let [e, t, n, r] of p) e.removeEventListener(t, n, r);
500
- }, V = D.ResizeObserver ? new D.ResizeObserver(() => {
501
- qe(), Xe();
502
- }) : null, N.current && V?.observe(N.current), V?.observe(e), f(), Z("window-blur", !E.hasFocus()), He(E.activeElement), Ue(), Le(), at(h, _(y.props.snapshot), null), Xe(), et();
503
- }
504
- function mt(e) {
515
+ for (let [e, t, n, r] of v) e.addEventListener(t, n, r);
516
+ ve = () => {
517
+ for (let [e, t, n, r] of v) e.removeEventListener(t, n, r);
518
+ c?.disconnect(), Ce = null;
519
+ }, B = D.ResizeObserver ? new D.ResizeObserver(() => {
520
+ Ye(), Qe();
521
+ }) : null, N.current && B?.observe(N.current), B?.observe(e), g(), Z("window-blur", !E.hasFocus()), Ue(E.activeElement), We(), Re(), st(h, _(y.props.snapshot), null), Qe(), nt();
522
+ }
523
+ function _t(e) {
505
524
  let t = _(e.snapshot), n = _(y.props.snapshot), r = g(t, n), i = {
506
525
  plan: r,
507
- clones: rt(r),
508
- heading: r.morph !== "none" && W ? nt()?.getBoundingClientRect() ?? null : null,
509
- height: H.height
510
- }, a = me;
511
- if (me = null, he = null, a && e.snapshot.notifications.some((e) => e.handle === a) && !y.props.snapshot.notifications.some((e) => e.handle === a)) return i;
512
- let o = j.current, s = E.activeElement;
513
- if (!o || !D || !(s instanceof D.HTMLElement) || s === o || !o.contains(s) || ae(e.snapshot) === ae(y.props.snapshot) && yt(e) === yt(y.props)) return i;
514
- he = s;
526
+ clones: at(r),
527
+ heading: r.morph !== "none" && U ? it()?.getBoundingClientRect() ?? null : null,
528
+ height: V.height
529
+ }, a = P;
530
+ if (P = null, ge = null, a && e.snapshot.notifications.some((e) => e.handle === a) && !y.props.snapshot.notifications.some((e) => e.handle === a)) return i;
531
+ let o = A.current, s = E.activeElement;
532
+ if (!o || !D || !(s instanceof D.HTMLElement) || s === o || !o.contains(s) || j(e.snapshot) === j(y.props.snapshot) && St(e) === St(y.props)) return i;
533
+ ge = s;
515
534
  let c = y.props.snapshot;
516
- return ge = !c.notifications.length && !c.overflow.pending, (!ge || !Ve()) && o.focus({ preventScroll: !0 }), i;
535
+ return _e = !c.notifications.length && !c.overflow.pending, (!_e || !He()) && o.focus({ preventScroll: !0 }), i;
517
536
  }
518
- function ht(e, t, n) {
519
- let r = he;
520
- he = null, ge ? (ge = !1, Ve()) : r && !Q(r) && (Q($e() ?? j.current?.querySelector("[data-cloudlet-overflow]") ?? null) || j.current?.focus({ preventScroll: !0 })), X && !yt(y.props) && _t(!1), R?.setTimeScale(y.props.options.motion?.timeScale), xe();
537
+ function vt(e, t, n) {
538
+ let r = ge;
539
+ ge = null, _e ? (_e = !1, He()) : r && !Q(r) && (Q(tt() ?? A.current?.querySelector("[data-cloudlet-overflow]") ?? null) || A.current?.focus({ preventScroll: !0 })), Y && !St(y.props) && bt(!1), L?.setTimeScale(y.props.options.motion?.timeScale), Se(), Ce?.();
521
540
  let i = _(y.props.snapshot);
522
- Me && (Me.handle !== i.presented?.handle || Me.open !== i.open) && q?.cancel(), J && (!i.open || !i.stack.includes(J.handle)) && (q?.cancel(), st(null)), e.snapshot === y.props.snapshot ? qe() : at(_(e.snapshot), i, n), Le(), Xe(), et(), He(E.activeElement);
541
+ Pe && (Pe.handle !== i.presented?.handle || Pe.open !== i.open) && K?.cancel(), q && (!i.open || !i.stack.includes(q.handle)) && (K?.cancel(), lt(null)), e.snapshot === y.props.snapshot ? Ye() : st(_(e.snapshot), i, n), Re(), Qe(), nt(), Ue(E.activeElement);
523
542
  }
524
- function gt() {
525
- q?.dispose(), q = null, J = null, Y = null, _t(!1), F.dispose(), ve = !1, _e?.(), _e = null, V?.disconnect(), V = null, R?.dispose(), R = null, Ee.clear();
543
+ function yt() {
544
+ K?.dispose(), K = null, q = null, J = null, bt(!1), me.dispose(), ye = !1, ve?.(), ve = null, B?.disconnect(), B = null, L?.dispose(), L = null, Oe.clear();
526
545
  let e = se.current?.sheet;
527
546
  if (e) for (; e.cssRules.length;) e.deleteRule(0);
528
- I = {};
547
+ F = {};
529
548
  for (let e of [
530
- P.current,
531
549
  de.current,
532
- fe.current
533
- ]) tt(e);
534
- K = null;
550
+ fe.current,
551
+ pe.current
552
+ ]) rt(e);
553
+ G = null;
535
554
  let t = E.activeElement;
536
- j.current?.contains(t) && !Ve() && t?.blur();
555
+ A.current?.contains(t) && !He() && t?.blur();
537
556
  }
538
- function _t(e = !0) {
539
- D?.clearTimeout(Ne), Ne = void 0, X && (X = !1, e && ve && y.forceUpdate());
557
+ function bt(e = !0) {
558
+ D?.clearTimeout(Fe), Fe = void 0, Y && (Y = !1, e && ye && y.forceUpdate());
540
559
  }
541
- function vt() {
542
- X ? (_t(), x.clearAll(S)) : (X = !0, Ne = D?.setTimeout(_t, ne), y.forceUpdate());
560
+ function xt() {
561
+ Y ? (bt(), x.clearAll(S)) : (Y = !0, Fe = D?.setTimeout(bt, ne), y.forceUpdate());
543
562
  }
544
- let yt = (e) => e.options.clearAll !== !1 && _(e.snapshot).open && e.snapshot.stack.length > 1, bt = (e) => {
545
- me = e, x.dismiss(S, e, "navigation").status !== "applied" && (me = null);
563
+ let St = (e) => e.options.clearAll !== !1 && _(e.snapshot).open && e.snapshot.stack.length > 1, Ct = (e) => {
564
+ P = e, x.dismiss(S, e, "navigation").status !== "applied" && (P = null);
546
565
  };
547
- function xt(e, t, n, r) {
566
+ function wt(e, t, n, r) {
548
567
  if (e.defaultPrevented) return;
549
568
  let i = null;
550
569
  if (e.nativeEvent.isComposing) return;
@@ -557,22 +576,22 @@ function j(y) {
557
576
  let a = i === null ? void 0 : t[i];
558
577
  a && (e.preventDefault(), x.navigate(S, a));
559
578
  }
560
- function St() {
579
+ function Tt() {
561
580
  let { snapshot: s, options: c } = y.props, l = {
562
581
  ...i,
563
582
  ...c.labels
564
583
  }, u = s.controller ?? "cloudlet", d = c.dir ?? (E.documentElement.dir === "rtl" ? "rtl" : "ltr"), f = c.theme ?? "system";
565
- je = d === "rtl";
584
+ Ne = d === "rtl";
566
585
  let p = `${u}-island`, m = _(s), { presented: h, open: g, total: v, index: b, missed: T } = m;
567
- m.badge && (De = m.count);
568
- let te = g && J ? s.notifications.find((e) => e.handle === J.handle) : void 0, ne = c.position ?? "auto", O = ne === "bottom-center" || ne === "auto" && D?.matchMedia?.("(min-width: 48rem)").matches === !1, k = Math.min(2, Math.max(m.depth, G)), ie = h ? o(x, S, h.handle, ze) : null, A = Ie(l.page, i.page, b + 1, v), ae = Ie(l.clearAllConfirm, i.clearAllConfirm, v), F = a(c.classNames);
586
+ m.badge && (ke = m.count);
587
+ let te = g && q ? s.notifications.find((e) => e.handle === q.handle) : void 0, ne = c.position ?? "auto", O = String(ne), k = O.startsWith("bottom-") || ne === "auto" && D?.matchMedia?.("(min-width: 48rem)").matches === !1, ie = O.endsWith("-left") ? "left" : O.endsWith("-right") ? "right" : "center", ae = Math.min(2, Math.max(m.depth, W)), j = h ? o(x, S, h.handle, Be) : null, me = X(l.page, i.page, b + 1, v), he = X(l.clearAllConfirm, i.clearAllConfirm, v), P = a(c.classNames);
569
588
  return /* @__PURE__ */ w(ee, { children: [c.offsets && /* @__PURE__ */ C(oe, {
570
589
  instance: u,
571
590
  offsets: c.offsets,
572
591
  nonce: c.nonce
573
592
  }, c.nonce ?? ""), /* @__PURE__ */ w("div", {
574
- ref: j,
575
- className: F("host", "cloudlet-host"),
593
+ ref: A,
594
+ className: P("host", "cloudlet-host"),
576
595
  role: "region",
577
596
  "aria-label": l.region,
578
597
  tabIndex: -1,
@@ -581,51 +600,52 @@ function j(y) {
581
600
  "data-theme": f,
582
601
  "data-resolved-theme": f === "system" ? D?.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light" : f,
583
602
  "data-position": ne,
584
- "data-edge": O ? "bottom" : "top",
603
+ "data-edge": k ? "bottom" : "top",
604
+ "data-align": ie,
585
605
  "data-state": g ? "island" : "stack",
586
606
  "data-island-reason": s.island.reason ?? void 0,
587
607
  "data-overflow": s.overflow.pending,
588
608
  dir: d,
589
609
  onPointerDownCapture: (e) => {
590
- L = e.target.closest("button");
610
+ I = e.target.closest("button");
591
611
  },
592
612
  onPointerCancelCapture: () => {
593
- L = null;
613
+ I = null;
594
614
  },
595
615
  onKeyDownCapture: (e) => {
596
- (e.key === "Enter" || e.key === " ") && e.target.closest("button") && (ye = e.repeat, e.repeat ? e.preventDefault() : L = e.target.closest("button"));
616
+ (e.key === "Enter" || e.key === " ") && e.target.closest("button") && (be = e.repeat, e.repeat ? e.preventDefault() : I = e.target.closest("button"));
597
617
  },
598
618
  onKeyUpCapture: () => {
599
- ye = !1;
619
+ be = !1;
600
620
  },
601
621
  onClickCapture: (e) => {
602
622
  let t = e.target.closest("button"), n = !!t?.matches("[data-cloudlet-control=\"action\"], [data-cloudlet-control=\"retry\"], [data-cloudlet-control=\"cancel\"], [data-cloudlet-control=\"clear\"]");
603
- t && (ye || n && e.detail > 1 || L && L !== t) && (e.preventDefault(), e.stopPropagation()), L = null;
623
+ t && (be || n && e.detail > 1 || I && I !== t) && (e.preventDefault(), e.stopPropagation()), I = null;
604
624
  },
605
625
  onFocus: (e) => {
606
- Be(e.relatedTarget), He(E.activeElement);
626
+ Ve(e.relatedTarget), Ue(E.activeElement);
607
627
  },
608
- onBlur: (e) => He(D && e.relatedTarget instanceof D.Element ? e.relatedTarget : null),
609
- onMouseEnter: () => Re(!0),
610
- onMouseLeave: () => Re(!1),
628
+ onBlur: (e) => Ue(D && e.relatedTarget instanceof D.Element ? e.relatedTarget : null),
629
+ onMouseEnter: () => ze(!0),
630
+ onMouseLeave: () => ze(!1),
611
631
  children: [/* @__PURE__ */ C("style", {
612
632
  ref: se,
613
633
  nonce: c.nonce,
614
634
  "data-cloudlet-motion": ""
615
635
  }), /* @__PURE__ */ w("div", {
616
636
  ref: ce,
617
- className: F("stack", "cloudlet-stack"),
637
+ className: P("stack", "cloudlet-stack"),
618
638
  "data-empty": !h,
619
639
  children: [
620
- [1, 2].filter((e) => e <= k).map((e) => /* @__PURE__ */ C("div", {
621
- className: F("tail", "cloudlet-tail"),
640
+ [1, 2].filter((e) => e <= ae).map((e) => /* @__PURE__ */ C("div", {
641
+ className: P("tail", "cloudlet-tail"),
622
642
  "data-cloudlet-tail": e,
623
643
  "aria-hidden": "true"
624
644
  }, e)),
625
645
  /* @__PURE__ */ w("div", {
626
646
  ref: M,
627
647
  id: p,
628
- className: F("island", "cloudlet-shell"),
648
+ className: P("island", "cloudlet-shell"),
629
649
  hidden: !h,
630
650
  "data-state": g ? "island" : "stack",
631
651
  "data-kind": h?.kind,
@@ -635,7 +655,7 @@ function j(y) {
635
655
  "aria-label": l.island,
636
656
  "aria-describedby": `${p}-hint`
637
657
  } : {},
638
- onKeyDown: g ? (e) => xt(e, s.stack, b, d === "rtl") : void 0,
658
+ onKeyDown: g ? (e) => wt(e, s.stack, b, d === "rtl") : void 0,
639
659
  children: [
640
660
  /* @__PURE__ */ C("svg", {
641
661
  ref: le,
@@ -649,11 +669,11 @@ function j(y) {
649
669
  className: "cloudlet-clip",
650
670
  children: [
651
671
  /* @__PURE__ */ C("div", {
652
- ref: de,
672
+ ref: fe,
653
673
  className: "cloudlet-slide-out",
654
674
  "aria-hidden": "true"
655
675
  }),
656
- h && ie && /* @__PURE__ */ w("div", {
676
+ h && j && /* @__PURE__ */ w("div", {
657
677
  className: "cloudlet-slide",
658
678
  "data-cloudlet-presented": h.handle.generation,
659
679
  "data-kind": h.kind,
@@ -661,16 +681,16 @@ function j(y) {
661
681
  ...g ? {
662
682
  role: "group",
663
683
  "aria-roledescription": l.slide,
664
- "aria-label": A
684
+ "aria-label": me
665
685
  } : {},
666
686
  children: [
667
687
  /* @__PURE__ */ w("div", {
668
- className: F("header", "cloudlet-header"),
688
+ className: P("header", "cloudlet-header"),
669
689
  "aria-hidden": g ? void 0 : "true",
670
690
  children: [/* @__PURE__ */ C(t, {
671
691
  notification: h,
672
- slot: ie,
673
- part: F,
692
+ slot: j,
693
+ part: P,
674
694
  titleId: `${p}-title`
675
695
  }), /* @__PURE__ */ C("div", {
676
696
  className: "cloudlet-heading-out",
@@ -683,9 +703,9 @@ function j(y) {
683
703
  bridge: x,
684
704
  lease: S,
685
705
  labels: l,
686
- navigate: bt,
687
- slot: ie,
688
- part: F,
706
+ navigate: Ct,
707
+ slot: j,
708
+ part: P,
689
709
  titleId: `${p}-title`
690
710
  }),
691
711
  /* @__PURE__ */ C("div", {
@@ -701,19 +721,19 @@ function j(y) {
701
721
  children: /* @__PURE__ */ C(n, {
702
722
  notification: te,
703
723
  labels: l,
704
- part: F
724
+ part: P
705
725
  })
706
726
  }),
707
- h && g && r(l, F, () => x.dismiss(S, h.handle, "close-button")),
727
+ h && g && r(l, P, () => x.dismiss(S, h.handle, "close-button")),
708
728
  g && (v > 1 || T > 0) && /* @__PURE__ */ w("div", {
709
- className: F("indicator", "cloudlet-indicator"),
729
+ className: P("indicator", "cloudlet-indicator"),
710
730
  children: [
711
731
  v > 5 ? /* @__PURE__ */ w("p", {
712
732
  className: "cloudlet-page",
713
733
  "aria-hidden": "true",
714
734
  children: [/* @__PURE__ */ C("span", {
715
735
  className: "cloudlet-page-value",
716
- children: A
736
+ children: me
717
737
  }), /* @__PURE__ */ C("span", { className: "cloudlet-page-out" })]
718
738
  }) : v > 1 && /* @__PURE__ */ C("div", {
719
739
  className: "cloudlet-dots",
@@ -721,7 +741,7 @@ function j(y) {
721
741
  type: "button",
722
742
  className: "cloudlet-dot-button",
723
743
  "aria-current": t === b ? "true" : void 0,
724
- "aria-label": Ie(l.page, i.page, t + 1, v),
744
+ "aria-label": X(l.page, i.page, t + 1, v),
725
745
  onClick: () => x.navigate(S, e),
726
746
  children: /* @__PURE__ */ C("span", {
727
747
  className: "cloudlet-dot",
@@ -729,28 +749,28 @@ function j(y) {
729
749
  })
730
750
  }, e.generation))
731
751
  }),
732
- yt(y.props) && /* @__PURE__ */ w(ee, { children: [/* @__PURE__ */ w("button", {
752
+ St(y.props) && /* @__PURE__ */ w(ee, { children: [/* @__PURE__ */ w("button", {
733
753
  type: "button",
734
- className: F("clear", "cloudlet-clear"),
754
+ className: P("clear", "cloudlet-clear"),
735
755
  "data-cloudlet-control": "clear",
736
- "data-armed": X,
737
- onClick: vt,
738
- onBlur: () => _t(),
756
+ "data-armed": Y,
757
+ onClick: xt,
758
+ onBlur: () => bt(),
739
759
  children: [/* @__PURE__ */ C("span", {
740
- "aria-hidden": X || void 0,
760
+ "aria-hidden": Y || void 0,
741
761
  children: l.clearAll
742
762
  }), /* @__PURE__ */ C("span", {
743
- "aria-hidden": !X || void 0,
744
- children: ae
763
+ "aria-hidden": !Y || void 0,
764
+ children: he
745
765
  })]
746
766
  }), /* @__PURE__ */ C("span", {
747
767
  role: "status",
748
768
  className: "cloudlet-live",
749
- children: X ? ae : ""
769
+ children: Y ? he : ""
750
770
  })] }),
751
771
  T > 0 && /* @__PURE__ */ w("div", {
752
- className: F("overflow", "cloudlet-overflow"),
753
- children: [/* @__PURE__ */ C("p", { children: Ie(l.overflowCount, i.overflowCount, T) }), /* @__PURE__ */ C("button", {
772
+ className: P("overflow", "cloudlet-overflow"),
773
+ children: [/* @__PURE__ */ C("p", { children: X(l.overflowCount, i.overflowCount, T) }), /* @__PURE__ */ C("button", {
754
774
  type: "button",
755
775
  "data-cloudlet-overflow": "",
756
776
  onClick: () => x.acknowledgeOverflow(S),
@@ -765,7 +785,7 @@ function j(y) {
765
785
  children: l.collapse
766
786
  }),
767
787
  /* @__PURE__ */ C("div", {
768
- ref: fe,
788
+ ref: pe,
769
789
  className: "cloudlet-chrome-out",
770
790
  "aria-hidden": "true"
771
791
  })
@@ -773,25 +793,25 @@ function j(y) {
773
793
  }),
774
794
  h && !g && /* @__PURE__ */ C("button", {
775
795
  type: "button",
776
- className: F("pill", "cloudlet-pill"),
796
+ className: P("pill", "cloudlet-pill"),
777
797
  "data-cloudlet-pill": "",
778
798
  "aria-expanded": "false",
779
799
  "aria-controls": p,
780
800
  onClick: () => x.openIsland(S, "user"),
781
- "aria-label": [Ie(l.stackSummary, i.stackSummary, h.content.title, v, T), ...h.draft ? [l.draft] : []].join(", ")
801
+ "aria-label": [X(l.stackSummary, i.stackSummary, h.content.title, v, T), ...h.draft ? [l.draft] : []].join(", ")
782
802
  }),
783
803
  /* @__PURE__ */ w("span", {
784
- className: F("badge", "cloudlet-badge"),
804
+ className: P("badge", "cloudlet-badge"),
785
805
  "aria-hidden": "true",
786
806
  children: [/* @__PURE__ */ C("span", {
787
807
  className: "cloudlet-badge-value",
788
- children: De
808
+ children: ke
789
809
  }), /* @__PURE__ */ C("span", { className: "cloudlet-badge-out" })]
790
810
  })
791
811
  ]
792
812
  }),
793
813
  /* @__PURE__ */ C("div", {
794
- ref: P,
814
+ ref: de,
795
815
  className: "cloudlet-exit",
796
816
  "aria-hidden": "true"
797
817
  })
@@ -800,14 +820,14 @@ function j(y) {
800
820
  })] });
801
821
  }
802
822
  return {
803
- componentDidMount: pt,
804
- getSnapshotBeforeUpdate: mt,
805
- componentDidUpdate: ht,
806
- componentWillUnmount: gt,
807
- render: St
823
+ componentDidMount: gt,
824
+ getSnapshotBeforeUpdate: _t,
825
+ componentDidUpdate: vt,
826
+ componentWillUnmount: yt,
827
+ render: Tt
808
828
  };
809
829
  }
810
- function ae(e) {
830
+ function j(e) {
811
831
  let t = e.notifications.find((e) => e.location === "current");
812
832
  return [
813
833
  e.island.open,