@ai-ecoverse/slicc-spectrum 0.0.0 → 1.1.0

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 (87) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +173 -5
  3. package/dist/chunk-24WRGUXG.js +168 -0
  4. package/dist/chunk-24WRGUXG.js.map +7 -0
  5. package/dist/chunk-364Y2XOJ.js +28 -0
  6. package/dist/chunk-364Y2XOJ.js.map +7 -0
  7. package/dist/chunk-4RGMMAR4.js +18 -0
  8. package/dist/chunk-4RGMMAR4.js.map +7 -0
  9. package/dist/chunk-5OVGH7HO.js +28 -0
  10. package/dist/chunk-5OVGH7HO.js.map +7 -0
  11. package/dist/chunk-6A6NIESE.js +9 -0
  12. package/dist/chunk-6A6NIESE.js.map +7 -0
  13. package/dist/chunk-EN3XGF2M.js +26 -0
  14. package/dist/chunk-EN3XGF2M.js.map +7 -0
  15. package/dist/chunk-ER3HU7OE.js +22 -0
  16. package/dist/chunk-ER3HU7OE.js.map +7 -0
  17. package/dist/chunk-FN3Y2AYJ.js +17 -0
  18. package/dist/chunk-FN3Y2AYJ.js.map +7 -0
  19. package/dist/chunk-H5WU2XYY.js +8 -0
  20. package/dist/chunk-H5WU2XYY.js.map +7 -0
  21. package/dist/chunk-HBUX7E54.js +234 -0
  22. package/dist/chunk-HBUX7E54.js.map +7 -0
  23. package/dist/chunk-IBQ4O4NO.js +13 -0
  24. package/dist/chunk-IBQ4O4NO.js.map +7 -0
  25. package/dist/chunk-J45KH7MF.js +180 -0
  26. package/dist/chunk-J45KH7MF.js.map +7 -0
  27. package/dist/chunk-JASEW37G.js +411 -0
  28. package/dist/chunk-JASEW37G.js.map +7 -0
  29. package/dist/chunk-MR7SU4GJ.js +59 -0
  30. package/dist/chunk-MR7SU4GJ.js.map +7 -0
  31. package/dist/chunk-MTF6JFSL.js +1093 -0
  32. package/dist/chunk-MTF6JFSL.js.map +7 -0
  33. package/dist/chunk-Q4AC2O6Z.js +13 -0
  34. package/dist/chunk-Q4AC2O6Z.js.map +7 -0
  35. package/dist/chunk-SZ33GAVH.js +2638 -0
  36. package/dist/chunk-SZ33GAVH.js.map +7 -0
  37. package/dist/chunk-T5NHW4KC.js +23 -0
  38. package/dist/chunk-T5NHW4KC.js.map +7 -0
  39. package/dist/chunk-T5QFSUYQ.js +8 -0
  40. package/dist/chunk-T5QFSUYQ.js.map +7 -0
  41. package/dist/chunk-TS7SL372.js +687 -0
  42. package/dist/chunk-TS7SL372.js.map +7 -0
  43. package/dist/chunk-Y4Z7K443.js +64 -0
  44. package/dist/chunk-Y4Z7K443.js.map +7 -0
  45. package/dist/chunk-ZMBN6APP.js +11 -0
  46. package/dist/chunk-ZMBN6APP.js.map +7 -0
  47. package/dist/chunk-ZTPYBVZL.js +181 -0
  48. package/dist/chunk-ZTPYBVZL.js.map +7 -0
  49. package/dist/fonts/source-code-pro-latin-400-normal.woff2 +0 -0
  50. package/dist/fonts/source-code-pro-latin-600-normal.woff2 +0 -0
  51. package/dist/slicc-dummy.js +1393 -0
  52. package/dist/slicc-dummy.js.map +7 -0
  53. package/dist/slicc-terminal.js +5377 -0
  54. package/dist/slicc-terminal.js.map +7 -0
  55. package/dist/slicc-ui.js +22441 -0
  56. package/dist/slicc-ui.js.map +7 -0
  57. package/dist/types/app/agents.d.ts +11 -0
  58. package/dist/types/app/app.d.ts +40 -0
  59. package/dist/types/app/base.d.ts +27 -0
  60. package/dist/types/app/chat.d.ts +23 -0
  61. package/dist/types/app/fonts.d.ts +3 -0
  62. package/dist/types/app/markdown.d.ts +24 -0
  63. package/dist/types/app/panels.d.ts +31 -0
  64. package/dist/types/app/spectrum.d.ts +19 -0
  65. package/dist/types/backend.d.ts +19 -0
  66. package/dist/types/components/dock.d.ts +24 -0
  67. package/dist/types/components/sheets.d.ts +1 -0
  68. package/dist/types/dummy/agent.d.ts +14 -0
  69. package/dist/types/dummy/browser.d.ts +15 -0
  70. package/dist/types/dummy/clock.d.ts +5 -0
  71. package/dist/types/dummy/files.d.ts +14 -0
  72. package/dist/types/dummy/fixtures.d.ts +11 -0
  73. package/dist/types/dummy/index.d.ts +6 -0
  74. package/dist/types/dummy/script.d.ts +23 -0
  75. package/dist/types/dummy/settings.d.ts +13 -0
  76. package/dist/types/dummy/shell.d.ts +16 -0
  77. package/dist/types/dummy/terminals.d.ts +15 -0
  78. package/dist/types/dummy.d.ts +2 -0
  79. package/dist/types/index.d.ts +4 -0
  80. package/dist/types/kernel-backend.d.ts +24 -0
  81. package/dist/types/model/emitter.d.ts +9 -0
  82. package/dist/types/model/types.d.ts +183 -0
  83. package/dist/types/slicc-terminal.d.ts +23 -0
  84. package/dist/types/styles.d.ts +1 -0
  85. package/dist/types/ui.d.ts +15 -0
  86. package/dist/wterm.wasm +0 -0
  87. package/package.json +78 -2
@@ -0,0 +1,2638 @@
1
+ import {
2
+ firstFocusableIn,
3
+ firstFocusableSlottedIn
4
+ } from "./chunk-IBQ4O4NO.js";
5
+ import {
6
+ userFocusableSelector
7
+ } from "./chunk-ZMBN6APP.js";
8
+ import {
9
+ SlottableRequestEvent,
10
+ conditionAttributeWithId,
11
+ isAndroid,
12
+ isIOS,
13
+ isWebKit,
14
+ randomID,
15
+ removeSlottableRequest
16
+ } from "./chunk-Y4Z7K443.js";
17
+ import {
18
+ o
19
+ } from "./chunk-364Y2XOJ.js";
20
+ import {
21
+ r
22
+ } from "./chunk-ER3HU7OE.js";
23
+ import {
24
+ o as o2,
25
+ o2 as o3
26
+ } from "./chunk-JASEW37G.js";
27
+ import {
28
+ A,
29
+ SpectrumElement,
30
+ b,
31
+ e2 as e,
32
+ i,
33
+ n
34
+ } from "./chunk-TS7SL372.js";
35
+
36
+ // node_modules/@spectrum-web-components/reactive-controllers/src/ElementResolution.js
37
+ var elementResolverUpdatedSymbol = /* @__PURE__ */ Symbol("element resolver updated");
38
+ var ElementResolutionController = class {
39
+ constructor(e2, { selector: t } = { selector: "" }) {
40
+ this._element = null;
41
+ this._selector = "";
42
+ this.mutationCallback = (e3) => {
43
+ let t2 = false;
44
+ e3.forEach((s3) => {
45
+ if (!t2) {
46
+ if (s3.type === "childList") {
47
+ const r3 = this.element && [...s3.removedNodes].includes(this.element), l2 = !!this.selector && [...s3.addedNodes].some(this.elementIsSelected);
48
+ t2 = t2 || r3 || l2;
49
+ }
50
+ if (s3.type === "attributes") {
51
+ const r3 = s3.target === this.element, l2 = !!this.selector && this.elementIsSelected(s3.target);
52
+ t2 = t2 || r3 || l2;
53
+ }
54
+ }
55
+ }), t2 && this.resolveElement();
56
+ };
57
+ this.elementIsSelected = (e3) => {
58
+ var t2;
59
+ return this.selectorIsId ? (e3 == null ? void 0 : e3.id) === this.selectorAsId : (t2 = e3 == null ? void 0 : e3.matches) == null ? void 0 : t2.call(e3, this.selector);
60
+ };
61
+ this.host = e2, this.selector = t, this.observer = new MutationObserver(this.mutationCallback), this.host.addController(this);
62
+ }
63
+ get element() {
64
+ return this._element;
65
+ }
66
+ set element(e2) {
67
+ if (e2 === this.element) return;
68
+ const t = this.element;
69
+ this._element = e2, this.host.requestUpdate(elementResolverUpdatedSymbol, t);
70
+ }
71
+ get selector() {
72
+ return this._selector;
73
+ }
74
+ set selector(e2) {
75
+ e2 !== this.selector && (this.releaseElement(), this._selector = e2, this.resolveElement());
76
+ }
77
+ get selectorAsId() {
78
+ return this.selector.slice(1);
79
+ }
80
+ get selectorIsId() {
81
+ return !!this.selector && this.selector.startsWith("#");
82
+ }
83
+ hostConnected() {
84
+ this.resolveElement(), this.observer.observe(this.host.getRootNode(), { subtree: true, childList: true, attributes: true });
85
+ }
86
+ hostDisconnected() {
87
+ this.releaseElement(), this.observer.disconnect();
88
+ }
89
+ resolveElement() {
90
+ if (!this.selector) {
91
+ this.releaseElement();
92
+ return;
93
+ }
94
+ const e2 = this.host.getRootNode();
95
+ this.element = this.selectorIsId ? e2.getElementById(this.selectorAsId) : e2.querySelector(this.selector);
96
+ }
97
+ releaseElement() {
98
+ this.element = null;
99
+ }
100
+ };
101
+
102
+ // node_modules/@spectrum-web-components/shared/src/reparent-children.js
103
+ function T(o5, i2, l2 = []) {
104
+ for (let e2 = 0; e2 < i2.length; ++e2) {
105
+ const n2 = i2[e2], r3 = o5[e2], t = r3.parentElement || r3.getRootNode();
106
+ l2[e2] && l2[e2](n2), t && t !== r3 && t.replaceChild(n2, r3), delete o5[e2];
107
+ }
108
+ return i2;
109
+ }
110
+ var reparentChildren = (o5, i2, { position: l2, prepareCallback: e2 } = { position: "beforeend" }) => {
111
+ let { length: n2 } = o5;
112
+ if (n2 === 0) return () => o5;
113
+ let r3 = 1, t = 0;
114
+ (l2 === "afterbegin" || l2 === "afterend") && (r3 = -1, t = n2 - 1);
115
+ const a = new Array(n2), c = new Array(n2), p = document.createComment("placeholder for reparented element");
116
+ do {
117
+ const d2 = o5[t];
118
+ e2 && (c[t] = e2(d2)), a[t] = p.cloneNode();
119
+ const m = d2.parentElement || d2.getRootNode();
120
+ m && m !== d2 && m.replaceChild(a[t], d2), i2.insertAdjacentElement(l2, d2), t += r3;
121
+ } while (--n2 > 0);
122
+ return function() {
123
+ return T(a, o5, c);
124
+ };
125
+ };
126
+
127
+ // node_modules/@spectrum-web-components/overlay/src/overlay-timer.js
128
+ var OverlayTimer = class {
129
+ constructor(e2 = {}) {
130
+ this.warmUpDelay = 1e3;
131
+ this.coolDownDelay = 1e3;
132
+ this.isWarm = false;
133
+ this.timeout = 0;
134
+ Object.assign(this, e2);
135
+ }
136
+ async openTimer(e2) {
137
+ if (this.cancelCooldownTimer(), !this.component || e2 !== this.component) return this.component && (this.close(this.component), this.cancelCooldownTimer()), this.component = e2, this.isWarm ? false : (this.promise = new Promise((o5) => {
138
+ this.resolve = o5, this.timeout = window.setTimeout(() => {
139
+ this.resolve && (this.resolve(false), this.isWarm = true);
140
+ }, this.warmUpDelay);
141
+ }), this.promise);
142
+ if (this.promise) return this.promise;
143
+ throw new Error("Inconsistent state");
144
+ }
145
+ close(e2) {
146
+ this.component && this.component === e2 && (this.resetCooldownTimer(), this.timeout > 0 && (clearTimeout(this.timeout), this.timeout = 0), this.resolve && (this.resolve(true), delete this.resolve), delete this.promise, delete this.component);
147
+ }
148
+ resetCooldownTimer() {
149
+ this.isWarm && (this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), this.cooldownTimeout = window.setTimeout(() => {
150
+ this.isWarm = false, delete this.cooldownTimeout;
151
+ }, this.coolDownDelay));
152
+ }
153
+ cancelCooldownTimer() {
154
+ this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), delete this.cooldownTimeout;
155
+ }
156
+ };
157
+
158
+ // node_modules/@spectrum-web-components/overlay/src/AbstractOverlay.js
159
+ var overlayTimer = new OverlayTimer();
160
+ var noop = () => {
161
+ };
162
+ var guaranteedAllTransitionend = (i2, v, e2) => {
163
+ const r3 = new AbortController(), n2 = /* @__PURE__ */ new Map(), a = () => {
164
+ r3.abort(), e2();
165
+ };
166
+ let m, l2;
167
+ const t = requestAnimationFrame(() => {
168
+ m = requestAnimationFrame(() => {
169
+ l2 = requestAnimationFrame(() => {
170
+ a();
171
+ });
172
+ });
173
+ }), p = (o5) => {
174
+ o5.target === i2 && (n2.set(o5.propertyName, n2.get(o5.propertyName) - 1), n2.get(o5.propertyName) || n2.delete(o5.propertyName), n2.size === 0 && a());
175
+ }, d2 = (o5) => {
176
+ o5.target === i2 && (n2.has(o5.propertyName) || n2.set(o5.propertyName, 0), n2.set(o5.propertyName, n2.get(o5.propertyName) + 1), cancelAnimationFrame(t), cancelAnimationFrame(m), cancelAnimationFrame(l2));
177
+ };
178
+ i2.addEventListener("transitionrun", d2, { signal: r3.signal }), i2.addEventListener("transitionend", p, { signal: r3.signal }), i2.addEventListener("transitioncancel", p, { signal: r3.signal }), v();
179
+ };
180
+ function nextFrame() {
181
+ return new Promise((i2) => requestAnimationFrame(() => i2()));
182
+ }
183
+ var AbstractOverlay = class _AbstractOverlay extends SpectrumElement {
184
+ constructor() {
185
+ super(...arguments);
186
+ this.dispose = noop;
187
+ this.offset = 0;
188
+ this.willPreventClose = false;
189
+ }
190
+ async applyFocus(e2, r3) {
191
+ }
192
+ get delayed() {
193
+ return false;
194
+ }
195
+ set delayed(e2) {
196
+ }
197
+ get disabled() {
198
+ return false;
199
+ }
200
+ set disabled(e2) {
201
+ }
202
+ get elementResolver() {
203
+ return this._elementResolver;
204
+ }
205
+ set elementResolver(e2) {
206
+ this._elementResolver = e2;
207
+ }
208
+ async ensureOnDOM(e2) {
209
+ }
210
+ async makeTransition(e2) {
211
+ return null;
212
+ }
213
+ async manageDelay(e2) {
214
+ }
215
+ async managePopoverOpen() {
216
+ }
217
+ managePosition() {
218
+ }
219
+ get open() {
220
+ return false;
221
+ }
222
+ set open(e2) {
223
+ }
224
+ get placementController() {
225
+ return this._placementController;
226
+ }
227
+ set placementController(e2) {
228
+ this._placementController = e2;
229
+ }
230
+ requestSlottable() {
231
+ }
232
+ returnFocus() {
233
+ }
234
+ get state() {
235
+ return "closed";
236
+ }
237
+ set state(e2) {
238
+ }
239
+ manuallyKeepOpen() {
240
+ }
241
+ static update() {
242
+ const e2 = new CustomEvent("sp-update-overlays", { bubbles: true, composed: true, cancelable: true });
243
+ document.dispatchEvent(e2);
244
+ }
245
+ static async open(e2, r3, n2, a) {
246
+ await import("./chunk-4RGMMAR4.js");
247
+ const m = arguments.length === 2, l2 = n2 || e2, t = new this();
248
+ let p = false;
249
+ t.dispose = () => {
250
+ t.addEventListener("sp-closed", () => {
251
+ p || (d2(), p = true), requestAnimationFrame(() => {
252
+ t.remove();
253
+ });
254
+ }), t.open = false, t.dispose = noop;
255
+ };
256
+ const d2 = reparentChildren([l2], t, { position: "beforeend", prepareCallback: (s3) => {
257
+ const c = s3.slot;
258
+ return s3.removeAttribute("slot"), () => {
259
+ s3.slot = c;
260
+ };
261
+ } });
262
+ if (!m && l2 && a) {
263
+ const s3 = e2, c = r3, u3 = a;
264
+ return _AbstractOverlay.applyOptions(t, { ...u3, delayed: u3.delayed || l2.hasAttribute("delayed"), trigger: u3.virtualTrigger || s3, type: c === "modal" ? "modal" : c === "hover" ? "hint" : "auto" }), s3.insertAdjacentElement("afterend", t), await t.updateComplete, t.open = true, t.dispose;
265
+ }
266
+ const y2 = r3;
267
+ return t.append(l2), _AbstractOverlay.applyOptions(t, { ...y2, delayed: y2.delayed || l2.hasAttribute("delayed") }), t.updateComplete.then(() => {
268
+ t.open = true;
269
+ }), t;
270
+ }
271
+ static applyOptions(e2, r3) {
272
+ var n2, a;
273
+ e2.delayed = !!r3.delayed, e2.receivesFocus = (n2 = r3.receivesFocus) != null ? n2 : "auto", e2.triggerElement = r3.trigger || null, e2.type = r3.type || "modal", e2.offset = (a = r3.offset) != null ? a : 0, e2.placement = r3.placement, e2.willPreventClose = !!r3.notImmediatelyClosable;
274
+ }
275
+ disconnectedCallback() {
276
+ super.disconnectedCallback();
277
+ }
278
+ };
279
+
280
+ // node_modules/@spectrum-web-components/overlay/src/events.js
281
+ var BeforetoggleClosedEvent = class extends Event {
282
+ constructor() {
283
+ super("beforetoggle", { bubbles: false, composed: false });
284
+ this.currentState = "open";
285
+ this.newState = "closed";
286
+ }
287
+ };
288
+ var BeforetoggleOpenEvent = class extends Event {
289
+ constructor() {
290
+ super("beforetoggle", { bubbles: false, composed: false });
291
+ this.currentState = "closed";
292
+ this.newState = "open";
293
+ }
294
+ };
295
+ var OverlayStateEvent = class extends Event {
296
+ constructor(r3, l2, { publish: o5, interaction: s3, reason: n2 }) {
297
+ super(r3, { bubbles: o5, composed: o5 });
298
+ this.overlay = l2;
299
+ this.detail = { interaction: s3, reason: n2 };
300
+ }
301
+ };
302
+
303
+ // node_modules/@spectrum-web-components/overlay/src/VirtualTrigger.js
304
+ var VirtualTrigger = class {
305
+ constructor(t, i2) {
306
+ this.x = 0;
307
+ this.y = 0;
308
+ this.x = t, this.y = i2;
309
+ }
310
+ updateBoundingClientRect(t, i2) {
311
+ this.x = t, this.y = i2, AbstractOverlay.update();
312
+ }
313
+ getBoundingClientRect() {
314
+ return { width: 0, height: 0, top: this.y, right: this.x, y: this.y, x: this.x, bottom: this.y, left: this.x, toJSON() {
315
+ } };
316
+ }
317
+ };
318
+
319
+ // node_modules/@spectrum-web-components/overlay/src/OverlayNoPopover.js
320
+ function OverlayNoPopover(a) {
321
+ class m extends a {
322
+ async managePopoverOpen() {
323
+ await this.managePosition();
324
+ }
325
+ async manageDelay(e2) {
326
+ if (e2 === false || e2 !== this.open) {
327
+ overlayTimer.close(this);
328
+ return;
329
+ }
330
+ this.delayed && await overlayTimer.openTimer(this) && (this.open = !e2);
331
+ }
332
+ async ensureOnDOM(e2) {
333
+ document.body.offsetHeight;
334
+ }
335
+ async makeTransition(e2) {
336
+ if (this.open !== e2) return null;
337
+ let o5 = null;
338
+ const h = (t, r3) => () => {
339
+ if (e2 !== this.open) return;
340
+ if (t.open = e2, r3 === 0) {
341
+ const i2 = e2 ? BeforetoggleOpenEvent : BeforetoggleClosedEvent;
342
+ this.dispatchEvent(new i2());
343
+ }
344
+ if (e2 !== true || (t.matches(userFocusableSelector) && (o5 = t), o5 = o5 || firstFocusableIn(t), o5)) return;
345
+ t.querySelectorAll("slot").forEach((i2) => {
346
+ o5 || (o5 = firstFocusableSlottedIn(i2));
347
+ });
348
+ }, u3 = (t, r3) => async () => {
349
+ if (this.open !== e2) return;
350
+ const n2 = e2 ? "sp-opened" : "sp-closed";
351
+ if (t.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type })), r3 > 0) return;
352
+ const i2 = this.triggerElement instanceof VirtualTrigger;
353
+ this.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type, publish: i2 })), this.triggerElement && !i2 && this.triggerElement.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type, publish: true })), this.state = e2 ? "opened" : "closed", this.returnFocus(), await nextFrame(), await nextFrame(), e2 === this.open && e2 === false && this.requestSlottable();
354
+ };
355
+ return this.elements.forEach((t, r3) => {
356
+ guaranteedAllTransitionend(t, h(t, r3), u3(t, r3));
357
+ }), o5;
358
+ }
359
+ }
360
+ return m;
361
+ }
362
+
363
+ // node_modules/@spectrum-web-components/overlay/src/OverlayPopover.js
364
+ var C = CSS.supports("(overlay: auto)");
365
+ function f(l2) {
366
+ let a = false;
367
+ try {
368
+ a = l2.matches(":popover-open");
369
+ } catch (e2) {
370
+ }
371
+ let p = false;
372
+ try {
373
+ p = l2.matches(":open");
374
+ } catch (e2) {
375
+ }
376
+ return a || p;
377
+ }
378
+ function OverlayPopover(l2) {
379
+ class a extends l2 {
380
+ async manageDelay(e2) {
381
+ if (e2 === false || e2 !== this.open) {
382
+ overlayTimer.close(this);
383
+ return;
384
+ }
385
+ this.delayed && await overlayTimer.openTimer(this) && (this.open = !e2);
386
+ }
387
+ async shouldHidePopover(e2) {
388
+ if (e2 && this.open !== e2) return;
389
+ const o5 = async ({ newState: i2 } = {}) => {
390
+ i2 !== "open" && await this.placementController.resetOverlayPosition();
391
+ };
392
+ if (!f(this.dialogEl)) {
393
+ o5();
394
+ return;
395
+ }
396
+ this.dialogEl.addEventListener("toggle", o5, { once: true });
397
+ }
398
+ shouldShowPopover(e2) {
399
+ let o5 = false;
400
+ try {
401
+ o5 = this.dialogEl.matches(":popover-open");
402
+ } catch (u3) {
403
+ }
404
+ let i2 = false;
405
+ try {
406
+ i2 = this.dialogEl.matches(":open");
407
+ } catch (u3) {
408
+ }
409
+ e2 && this.open === e2 && !o5 && !i2 && this.isConnected && (this.dialogEl.showPopover(), this.managePosition());
410
+ }
411
+ async ensureOnDOM(e2) {
412
+ C || await this.shouldHidePopover(e2), this.shouldShowPopover(e2), await nextFrame();
413
+ }
414
+ async makeTransition(e2) {
415
+ if (this.open !== e2) return null;
416
+ let o5 = null;
417
+ const i2 = (t, s3) => () => {
418
+ if (t.open = e2, s3 === 0) {
419
+ const r3 = e2 ? BeforetoggleOpenEvent : BeforetoggleClosedEvent;
420
+ this.dispatchEvent(new r3());
421
+ }
422
+ if (!e2 || (t.matches(userFocusableSelector) && (o5 = t), o5 = o5 || firstFocusableIn(t), o5)) return;
423
+ t.querySelectorAll("slot").forEach((r3) => {
424
+ o5 || (o5 = firstFocusableSlottedIn(r3));
425
+ });
426
+ }, u3 = (t, s3) => async () => {
427
+ if (this.open !== e2) return;
428
+ const n2 = e2 ? "sp-opened" : "sp-closed";
429
+ if (s3 > 0) {
430
+ t.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type, publish: false }));
431
+ return;
432
+ }
433
+ const r3 = async () => {
434
+ if (this.open !== e2) return;
435
+ await nextFrame();
436
+ const d2 = this.triggerElement instanceof VirtualTrigger;
437
+ this.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type, publish: d2 })), t.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type, publish: false })), this.triggerElement && !d2 && this.triggerElement.dispatchEvent(new OverlayStateEvent(n2, this, { interaction: this.type, publish: true })), this.state = e2 ? "opened" : "closed", this.returnFocus(), await nextFrame(), await nextFrame(), e2 === this.open && e2 === false && this.requestSlottable();
438
+ };
439
+ if (this.open !== e2) return;
440
+ const v = f(this.dialogEl);
441
+ e2 !== true && v && this.isConnected ? (this.dialogEl.addEventListener("beforetoggle", () => {
442
+ r3();
443
+ }, { once: true }), this.dialogEl.hidePopover()) : r3();
444
+ };
445
+ return this.elements.forEach((t, s3) => {
446
+ guaranteedAllTransitionend(t, i2(t, s3), u3(t, s3));
447
+ }), o5;
448
+ }
449
+ }
450
+ return a;
451
+ }
452
+
453
+ // node_modules/@spectrum-web-components/overlay/src/OverlayStack.js
454
+ var l = "showPopover" in document.createElement("div");
455
+ var d = class {
456
+ constructor() {
457
+ this.root = document.body;
458
+ this.stack = [];
459
+ this.originalBodyOverflow = "";
460
+ this.bodyScrollBlocked = false;
461
+ this.handleScroll = (t) => {
462
+ t.target !== document && t.target !== document.documentElement && t.target !== document.body || this.stack.forEach((e2) => {
463
+ e2.open && (e2.type === "auto" && e2.triggerElement instanceof HTMLElement && e2.triggerElement.closest("sp-picker, sp-action-menu") && t.stopPropagation(), document.dispatchEvent(new CustomEvent("sp-update-overlays", { bubbles: true, composed: true, cancelable: true })));
464
+ });
465
+ };
466
+ this.handlePointerdown = (t) => {
467
+ if (!this.stack.length) return;
468
+ const e2 = t.composedPath(), s3 = this.stack.filter((o5) => o5.open && o5.type === "page");
469
+ if (s3.length > 0 && !this.isEventInsideModal(e2, s3)) {
470
+ t.preventDefault(), t.stopImmediatePropagation();
471
+ return;
472
+ }
473
+ this.pointerdownPath = e2, this.lastOverlay = this.stack[this.stack.length - 1];
474
+ };
475
+ this.handleClick = (t) => {
476
+ if (!this.stack.length) return;
477
+ const e2 = this.getModalOverlays();
478
+ if (!e2.length) return;
479
+ const s3 = e2.filter((r3) => r3.type === "page");
480
+ if (!s3.length) return;
481
+ const o5 = t.composedPath();
482
+ this.isEventInsideModal(o5, s3) || (t.stopImmediatePropagation(), t.preventDefault());
483
+ };
484
+ this.handlePointerup = () => {
485
+ const t = this.pointerdownPath;
486
+ if (this.pointerdownPath = void 0, !this.stack.length || !(t != null && t.length)) return;
487
+ const e2 = this.lastOverlay;
488
+ this.lastOverlay = void 0;
489
+ const s3 = this.stack.length - 1;
490
+ if (this.stack.some((n2) => n2.open && (n2.type === "modal" || n2.type === "page")) && t.some((i2) => i2 instanceof HTMLDivElement && i2.classList.contains("modal-backdrop"))) {
491
+ const i2 = this.stack[this.stack.length - 1];
492
+ (i2 == null ? void 0 : i2.type) === "modal" && this.closeOverlay(i2);
493
+ return;
494
+ }
495
+ const r3 = this.stack.filter((n2, i2) => !t.find((c) => c === n2 || c === (n2 == null ? void 0 : n2.triggerElement) && (n2 == null ? void 0 : n2.type) === "hint" || i2 === s3 && n2 !== e2 && n2.triggerInteraction === "longpress") && !n2.shouldPreventClose() && n2.type !== "manual" && !(n2.type === "modal" && e2 !== n2));
496
+ r3.reverse(), r3.forEach((n2) => {
497
+ this.closeOverlay(n2);
498
+ let i2 = n2.parentOverlayToForceClose;
499
+ for (; i2; ) this.closeOverlay(i2), i2 = i2.parentOverlayToForceClose;
500
+ });
501
+ };
502
+ this.handleBeforetoggle = (t) => {
503
+ const { target: e2, newState: s3 } = t;
504
+ s3 !== "open" && this.closeOverlay(e2);
505
+ };
506
+ this.handleKeydown = (t) => {
507
+ if (t.code !== "Escape" || !this.stack.length) return;
508
+ const e2 = this.stack[this.stack.length - 1];
509
+ if ((e2 == null ? void 0 : e2.type) === "hint") {
510
+ t.preventDefault(), t.stopPropagation(), this.closeOverlay(e2);
511
+ return;
512
+ }
513
+ if ((e2 == null ? void 0 : e2.type) === "page") {
514
+ t.preventDefault();
515
+ return;
516
+ }
517
+ if ((e2 == null ? void 0 : e2.type) === "manual") {
518
+ this.closeOverlay(e2);
519
+ return;
520
+ }
521
+ if ((e2 == null ? void 0 : e2.type) === "modal") {
522
+ this.closeOverlay(e2);
523
+ return;
524
+ }
525
+ l || e2 && this.closeOverlay(e2);
526
+ };
527
+ this.bindEvents();
528
+ }
529
+ get document() {
530
+ return this.root.ownerDocument || document;
531
+ }
532
+ bindEvents() {
533
+ this.document.addEventListener("pointerdown", this.handlePointerdown, { capture: true }), this.document.addEventListener("pointerup", this.handlePointerup), this.document.addEventListener("click", this.handleClick, { capture: true }), this.document.addEventListener("keydown", this.handleKeydown), this.document.addEventListener("scroll", this.handleScroll, { capture: true });
534
+ }
535
+ closeOverlay(t) {
536
+ const e2 = this.stack.indexOf(t);
537
+ e2 > -1 && this.stack.splice(e2, 1), t.open = false, this.manageBodyScroll();
538
+ }
539
+ manageBodyScroll() {
540
+ const t = this.stack.some((e2) => e2.type === "modal" || e2.type === "page");
541
+ t && !this.bodyScrollBlocked ? (this.originalBodyOverflow = document.body.style.overflow || "", document.body.style.overflow = "hidden", this.bodyScrollBlocked = true) : !t && this.bodyScrollBlocked && (document.body.style.overflow = this.originalBodyOverflow, this.bodyScrollBlocked = false);
542
+ }
543
+ getModalOverlays() {
544
+ return this.stack.filter((t) => t.open && (t.type === "modal" || t.type === "page"));
545
+ }
546
+ isEventInsideModal(t, e2) {
547
+ for (const s3 of e2) {
548
+ if (t.includes(s3)) return true;
549
+ const o5 = s3.dialogEl;
550
+ if (o5) {
551
+ if (t.includes(o5)) return true;
552
+ for (const r3 of t) if (r3 instanceof Node && o5.contains(r3)) return true;
553
+ }
554
+ }
555
+ return false;
556
+ }
557
+ overlaysByTriggerElement(t) {
558
+ return this.stack.filter((e2) => e2.triggerElement === t);
559
+ }
560
+ add(t) {
561
+ if (this.stack.includes(t)) {
562
+ const e2 = this.stack.indexOf(t);
563
+ e2 > -1 && (this.stack.splice(e2, 1), this.stack.push(t));
564
+ return;
565
+ }
566
+ if (t.type === "auto" || t.type === "modal" || t.type === "page") {
567
+ const e2 = "sp-overlay-query-path", s3 = new Event(e2, { composed: true, bubbles: true });
568
+ t.addEventListener(e2, (o5) => {
569
+ const r3 = o5.composedPath();
570
+ this.stack.forEach((n2) => {
571
+ !r3.find((a) => a === n2) && n2.type !== "manual" && n2.type !== "modal" && this.closeOverlay(n2);
572
+ });
573
+ }, { once: true }), t.dispatchEvent(s3);
574
+ } else if (t.type === "hint") {
575
+ if (this.stack.some((s3) => s3.type !== "manual" && s3.triggerElement && s3.triggerElement === t.triggerElement)) {
576
+ t.open = false;
577
+ return;
578
+ }
579
+ this.stack.forEach((s3) => {
580
+ s3.type === "hint" && this.closeOverlay(s3);
581
+ });
582
+ }
583
+ requestAnimationFrame(() => {
584
+ this.stack.push(t), t.addEventListener("beforetoggle", this.handleBeforetoggle, { once: true }), this.manageBodyScroll();
585
+ });
586
+ }
587
+ remove(t) {
588
+ this.closeOverlay(t);
589
+ }
590
+ };
591
+ var overlayStack = new d();
592
+
593
+ // node_modules/@floating-ui/core/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
594
+ var min = Math.min;
595
+ var max = Math.max;
596
+ var oppositeSideMap = {
597
+ left: "right",
598
+ right: "left",
599
+ bottom: "top",
600
+ top: "bottom"
601
+ };
602
+ function clamp(start, value, end) {
603
+ return max(start, min(value, end));
604
+ }
605
+ function evaluate(value, param) {
606
+ return typeof value === "function" ? value(param) : value;
607
+ }
608
+ function getSide(placement) {
609
+ return placement.split("-")[0];
610
+ }
611
+ function getAlignment(placement) {
612
+ return placement.split("-")[1];
613
+ }
614
+ function getOppositeAxis(axis) {
615
+ return axis === "x" ? "y" : "x";
616
+ }
617
+ function getAxisLength(axis) {
618
+ return axis === "y" ? "height" : "width";
619
+ }
620
+ function getSideAxis(placement) {
621
+ const firstChar = placement[0];
622
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
623
+ }
624
+ function getAlignmentAxis(placement) {
625
+ return getOppositeAxis(getSideAxis(placement));
626
+ }
627
+ function getAlignmentSides(placement, rects, rtl) {
628
+ if (rtl === void 0) {
629
+ rtl = false;
630
+ }
631
+ const alignment = getAlignment(placement);
632
+ const alignmentAxis = getAlignmentAxis(placement);
633
+ const length = getAxisLength(alignmentAxis);
634
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
635
+ if (rects.reference[length] > rects.floating[length]) {
636
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
637
+ }
638
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
639
+ }
640
+ function getExpandedPlacements(placement) {
641
+ const oppositePlacement = getOppositePlacement(placement);
642
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
643
+ }
644
+ function getOppositeAlignmentPlacement(placement) {
645
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
646
+ }
647
+ var lrPlacement = ["left", "right"];
648
+ var rlPlacement = ["right", "left"];
649
+ var tbPlacement = ["top", "bottom"];
650
+ var btPlacement = ["bottom", "top"];
651
+ function getSideList(side, isStart, rtl) {
652
+ switch (side) {
653
+ case "top":
654
+ case "bottom":
655
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
656
+ return isStart ? lrPlacement : rlPlacement;
657
+ case "left":
658
+ case "right":
659
+ return isStart ? tbPlacement : btPlacement;
660
+ default:
661
+ return [];
662
+ }
663
+ }
664
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
665
+ const alignment = getAlignment(placement);
666
+ let list = getSideList(getSide(placement), direction === "start", rtl);
667
+ if (alignment) {
668
+ list = list.map((side) => side + "-" + alignment);
669
+ if (flipAlignment) {
670
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
671
+ }
672
+ }
673
+ return list;
674
+ }
675
+ function getOppositePlacement(placement) {
676
+ const side = getSide(placement);
677
+ return oppositeSideMap[side] + placement.slice(side.length);
678
+ }
679
+ function expandPaddingObject(padding) {
680
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
681
+ return {
682
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
683
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
684
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
685
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
686
+ };
687
+ }
688
+ function getPaddingObject(padding) {
689
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
690
+ top: padding,
691
+ right: padding,
692
+ bottom: padding,
693
+ left: padding
694
+ };
695
+ }
696
+ function rectToClientRect(rect) {
697
+ const {
698
+ x,
699
+ y: y2,
700
+ width,
701
+ height
702
+ } = rect;
703
+ return {
704
+ width,
705
+ height,
706
+ top: y2,
707
+ left: x,
708
+ right: x + width,
709
+ bottom: y2 + height,
710
+ x,
711
+ y: y2
712
+ };
713
+ }
714
+
715
+ // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
716
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
717
+ let {
718
+ reference,
719
+ floating
720
+ } = _ref;
721
+ const sideAxis = getSideAxis(placement);
722
+ const alignmentAxis = getAlignmentAxis(placement);
723
+ const alignLength = getAxisLength(alignmentAxis);
724
+ const side = getSide(placement);
725
+ const isVertical = sideAxis === "y";
726
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
727
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
728
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
729
+ let coords;
730
+ switch (side) {
731
+ case "top":
732
+ coords = {
733
+ x: commonX,
734
+ y: reference.y - floating.height
735
+ };
736
+ break;
737
+ case "bottom":
738
+ coords = {
739
+ x: commonX,
740
+ y: reference.y + reference.height
741
+ };
742
+ break;
743
+ case "right":
744
+ coords = {
745
+ x: reference.x + reference.width,
746
+ y: commonY
747
+ };
748
+ break;
749
+ case "left":
750
+ coords = {
751
+ x: reference.x - floating.width,
752
+ y: commonY
753
+ };
754
+ break;
755
+ default:
756
+ coords = {
757
+ x: reference.x,
758
+ y: reference.y
759
+ };
760
+ }
761
+ const alignment = getAlignment(placement);
762
+ if (alignment) {
763
+ coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
764
+ }
765
+ return coords;
766
+ }
767
+ async function detectOverflow(state, options) {
768
+ var _await$platform$isEle;
769
+ if (options === void 0) {
770
+ options = {};
771
+ }
772
+ const {
773
+ x,
774
+ y: y2,
775
+ platform: platform2,
776
+ rects,
777
+ elements,
778
+ strategy
779
+ } = state;
780
+ const {
781
+ boundary = "clippingAncestors",
782
+ rootBoundary = "viewport",
783
+ elementContext = "floating",
784
+ altBoundary = false,
785
+ padding = 0
786
+ } = evaluate(options, state);
787
+ const paddingObject = getPaddingObject(padding);
788
+ const altContext = elementContext === "floating" ? "reference" : "floating";
789
+ const element = elements[altBoundary ? altContext : elementContext];
790
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
791
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
792
+ boundary,
793
+ rootBoundary,
794
+ strategy
795
+ }));
796
+ const rect = elementContext === "floating" ? {
797
+ x,
798
+ y: y2,
799
+ width: rects.floating.width,
800
+ height: rects.floating.height
801
+ } : rects.reference;
802
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
803
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) && await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
804
+ x: 1,
805
+ y: 1
806
+ };
807
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
808
+ elements,
809
+ rect,
810
+ offsetParent,
811
+ strategy
812
+ }) : rect);
813
+ return {
814
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
815
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
816
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
817
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
818
+ };
819
+ }
820
+ var MAX_RESET_COUNT = 50;
821
+ var computePosition = async (reference, floating, config) => {
822
+ const {
823
+ placement = "bottom",
824
+ strategy = "absolute",
825
+ middleware = [],
826
+ platform: platform2
827
+ } = config;
828
+ const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
829
+ ...platform2,
830
+ detectOverflow
831
+ };
832
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
833
+ let rects = await platform2.getElementRects({
834
+ reference,
835
+ floating,
836
+ strategy
837
+ });
838
+ let {
839
+ x,
840
+ y: y2
841
+ } = computeCoordsFromPlacement(rects, placement, rtl);
842
+ let statefulPlacement = placement;
843
+ let resetCount = 0;
844
+ const middlewareData = {};
845
+ for (let i2 = 0; i2 < middleware.length; i2++) {
846
+ const currentMiddleware = middleware[i2];
847
+ if (!currentMiddleware) {
848
+ continue;
849
+ }
850
+ const {
851
+ name,
852
+ fn
853
+ } = currentMiddleware;
854
+ const {
855
+ x: nextX,
856
+ y: nextY,
857
+ data,
858
+ reset
859
+ } = await fn({
860
+ x,
861
+ y: y2,
862
+ initialPlacement: placement,
863
+ placement: statefulPlacement,
864
+ strategy,
865
+ middlewareData,
866
+ rects,
867
+ platform: platformWithDetectOverflow,
868
+ elements: {
869
+ reference,
870
+ floating
871
+ }
872
+ });
873
+ x = nextX != null ? nextX : x;
874
+ y2 = nextY != null ? nextY : y2;
875
+ middlewareData[name] = {
876
+ ...middlewareData[name],
877
+ ...data
878
+ };
879
+ if (reset && resetCount < MAX_RESET_COUNT) {
880
+ resetCount++;
881
+ if (typeof reset === "object") {
882
+ if (reset.placement) {
883
+ statefulPlacement = reset.placement;
884
+ }
885
+ if (reset.rects) {
886
+ rects = reset.rects === true ? await platform2.getElementRects({
887
+ reference,
888
+ floating,
889
+ strategy
890
+ }) : reset.rects;
891
+ }
892
+ ({
893
+ x,
894
+ y: y2
895
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
896
+ }
897
+ i2 = -1;
898
+ }
899
+ }
900
+ return {
901
+ x,
902
+ y: y2,
903
+ placement: statefulPlacement,
904
+ strategy,
905
+ middlewareData
906
+ };
907
+ };
908
+ var arrow = (options) => ({
909
+ name: "arrow",
910
+ options,
911
+ async fn(state) {
912
+ const {
913
+ x,
914
+ y: y2,
915
+ placement,
916
+ rects,
917
+ platform: platform2,
918
+ elements,
919
+ middlewareData
920
+ } = state;
921
+ const {
922
+ element,
923
+ padding = 0
924
+ } = evaluate(options, state) || {};
925
+ if (element == null) {
926
+ return {};
927
+ }
928
+ const paddingObject = getPaddingObject(padding);
929
+ const coords = {
930
+ x,
931
+ y: y2
932
+ };
933
+ const axis = getAlignmentAxis(placement);
934
+ const length = getAxisLength(axis);
935
+ const arrowDimensions = await platform2.getDimensions(element);
936
+ const isYAxis = axis === "y";
937
+ const minProp = isYAxis ? "top" : "left";
938
+ const maxProp = isYAxis ? "bottom" : "right";
939
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
940
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
941
+ const startDiff = coords[axis] - rects.reference[axis];
942
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
943
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
944
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
945
+ clientSize = elements.floating[clientProp] || rects.floating[length];
946
+ }
947
+ const centerToReference = endDiff / 2 - startDiff / 2;
948
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
949
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
950
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
951
+ const max3 = clientSize - arrowDimensions[length] - maxPadding;
952
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
953
+ const offset3 = clamp(minPadding, center, max3);
954
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset3 && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
955
+ const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max3 : 0;
956
+ return {
957
+ [axis]: coords[axis] + alignmentOffset,
958
+ data: {
959
+ [axis]: offset3,
960
+ centerOffset: center - offset3 - alignmentOffset,
961
+ ...shouldAddOffset && {
962
+ alignmentOffset
963
+ }
964
+ },
965
+ reset: shouldAddOffset
966
+ };
967
+ }
968
+ });
969
+ var flip = function(options) {
970
+ if (options === void 0) {
971
+ options = {};
972
+ }
973
+ return {
974
+ name: "flip",
975
+ options,
976
+ async fn(state) {
977
+ var _middlewareData$arrow, _middlewareData$flip;
978
+ const {
979
+ placement,
980
+ middlewareData,
981
+ rects,
982
+ initialPlacement,
983
+ platform: platform2,
984
+ elements
985
+ } = state;
986
+ const {
987
+ mainAxis: checkMainAxis = true,
988
+ crossAxis: checkCrossAxis = true,
989
+ fallbackPlacements: specifiedFallbackPlacements,
990
+ fallbackStrategy = "bestFit",
991
+ fallbackAxisSideDirection = "none",
992
+ flipAlignment = true,
993
+ ...detectOverflowOptions
994
+ } = evaluate(options, state);
995
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
996
+ return {};
997
+ }
998
+ const side = getSide(placement);
999
+ const initialSideAxis = getSideAxis(initialPlacement);
1000
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1001
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1002
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1003
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
1004
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1005
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1006
+ }
1007
+ const placements2 = [initialPlacement, ...fallbackPlacements];
1008
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1009
+ const overflows = [];
1010
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1011
+ if (checkMainAxis) {
1012
+ overflows.push(overflow[side]);
1013
+ }
1014
+ if (checkCrossAxis) {
1015
+ const sides2 = getAlignmentSides(placement, rects, rtl);
1016
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
1017
+ }
1018
+ overflowsData = [...overflowsData, {
1019
+ placement,
1020
+ overflows
1021
+ }];
1022
+ if (!overflows.every((side2) => side2 <= 0)) {
1023
+ var _middlewareData$flip2, _overflowsData$filter;
1024
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1025
+ const nextPlacement = placements2[nextIndex];
1026
+ if (nextPlacement) {
1027
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
1028
+ if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
1029
+ // overflows the main axis.
1030
+ overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) {
1031
+ return {
1032
+ data: {
1033
+ index: nextIndex,
1034
+ overflows: overflowsData
1035
+ },
1036
+ reset: {
1037
+ placement: nextPlacement
1038
+ }
1039
+ };
1040
+ }
1041
+ }
1042
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a, b3) => a.overflows[1] - b3.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1043
+ if (!resetPlacement) {
1044
+ switch (fallbackStrategy) {
1045
+ case "bestFit": {
1046
+ var _overflowsData$filter2;
1047
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
1048
+ if (hasFallbackAxisSideDirection) {
1049
+ const currentSideAxis = getSideAxis(d2.placement);
1050
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
1051
+ // reading directions favoring greater width.
1052
+ currentSideAxis === "y";
1053
+ }
1054
+ return true;
1055
+ }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b3) => a[1] - b3[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
1056
+ if (placement2) {
1057
+ resetPlacement = placement2;
1058
+ }
1059
+ break;
1060
+ }
1061
+ case "initialPlacement":
1062
+ resetPlacement = initialPlacement;
1063
+ break;
1064
+ }
1065
+ }
1066
+ if (placement !== resetPlacement) {
1067
+ return {
1068
+ reset: {
1069
+ placement: resetPlacement
1070
+ }
1071
+ };
1072
+ }
1073
+ }
1074
+ return {};
1075
+ }
1076
+ };
1077
+ };
1078
+ var originSides = /* @__PURE__ */ new Set(["left", "top"]);
1079
+ async function convertValueToCoords(state, options) {
1080
+ const {
1081
+ placement,
1082
+ platform: platform2,
1083
+ elements
1084
+ } = state;
1085
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1086
+ const side = getSide(placement);
1087
+ const alignment = getAlignment(placement);
1088
+ const isVertical = getSideAxis(placement) === "y";
1089
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
1090
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1091
+ const rawValue = evaluate(options, state);
1092
+ let {
1093
+ mainAxis,
1094
+ crossAxis,
1095
+ alignmentAxis
1096
+ } = typeof rawValue === "number" ? {
1097
+ mainAxis: rawValue,
1098
+ crossAxis: 0,
1099
+ alignmentAxis: null
1100
+ } : {
1101
+ mainAxis: rawValue.mainAxis || 0,
1102
+ crossAxis: rawValue.crossAxis || 0,
1103
+ alignmentAxis: rawValue.alignmentAxis
1104
+ };
1105
+ if (alignment && typeof alignmentAxis === "number") {
1106
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1107
+ }
1108
+ return isVertical ? {
1109
+ x: crossAxis * crossAxisMulti,
1110
+ y: mainAxis * mainAxisMulti
1111
+ } : {
1112
+ x: mainAxis * mainAxisMulti,
1113
+ y: crossAxis * crossAxisMulti
1114
+ };
1115
+ }
1116
+ var offset = function(options) {
1117
+ if (options === void 0) {
1118
+ options = 0;
1119
+ }
1120
+ return {
1121
+ name: "offset",
1122
+ options,
1123
+ async fn(state) {
1124
+ var _middlewareData$offse, _middlewareData$arrow;
1125
+ const {
1126
+ x,
1127
+ y: y2,
1128
+ placement,
1129
+ middlewareData
1130
+ } = state;
1131
+ const diffCoords = await convertValueToCoords(state, options);
1132
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1133
+ return {};
1134
+ }
1135
+ return {
1136
+ x: x + diffCoords.x,
1137
+ y: y2 + diffCoords.y,
1138
+ data: {
1139
+ ...diffCoords,
1140
+ placement
1141
+ }
1142
+ };
1143
+ }
1144
+ };
1145
+ };
1146
+ var shift = function(options) {
1147
+ if (options === void 0) {
1148
+ options = {};
1149
+ }
1150
+ return {
1151
+ name: "shift",
1152
+ options,
1153
+ async fn(state) {
1154
+ const {
1155
+ x,
1156
+ y: y2,
1157
+ placement,
1158
+ platform: platform2
1159
+ } = state;
1160
+ const {
1161
+ mainAxis: checkMainAxis = true,
1162
+ crossAxis: checkCrossAxis = false,
1163
+ limiter = {
1164
+ fn: (_ref) => {
1165
+ let {
1166
+ x: x2,
1167
+ y: y3
1168
+ } = _ref;
1169
+ return {
1170
+ x: x2,
1171
+ y: y3
1172
+ };
1173
+ }
1174
+ },
1175
+ ...detectOverflowOptions
1176
+ } = evaluate(options, state);
1177
+ const coords = {
1178
+ x,
1179
+ y: y2
1180
+ };
1181
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1182
+ const crossAxis = getSideAxis(placement);
1183
+ const mainAxis = getOppositeAxis(crossAxis);
1184
+ let mainAxisCoord = coords[mainAxis];
1185
+ let crossAxisCoord = coords[crossAxis];
1186
+ const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
1187
+ if (checkMainAxis) {
1188
+ mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
1189
+ }
1190
+ if (checkCrossAxis) {
1191
+ crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
1192
+ }
1193
+ const limitedCoords = limiter.fn({
1194
+ ...state,
1195
+ [mainAxis]: mainAxisCoord,
1196
+ [crossAxis]: crossAxisCoord
1197
+ });
1198
+ return {
1199
+ ...limitedCoords,
1200
+ data: {
1201
+ x: limitedCoords.x - x,
1202
+ y: limitedCoords.y - y2,
1203
+ enabled: {
1204
+ [mainAxis]: checkMainAxis,
1205
+ [crossAxis]: checkCrossAxis
1206
+ }
1207
+ }
1208
+ };
1209
+ }
1210
+ };
1211
+ };
1212
+ var size = function(options) {
1213
+ if (options === void 0) {
1214
+ options = {};
1215
+ }
1216
+ return {
1217
+ name: "size",
1218
+ options,
1219
+ async fn(state) {
1220
+ const {
1221
+ placement,
1222
+ rects,
1223
+ platform: platform2,
1224
+ elements
1225
+ } = state;
1226
+ const {
1227
+ apply = () => {
1228
+ },
1229
+ ...detectOverflowOptions
1230
+ } = evaluate(options, state);
1231
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1232
+ const side = getSide(placement);
1233
+ const alignment = getAlignment(placement);
1234
+ const isYAxis = getSideAxis(placement) === "y";
1235
+ const {
1236
+ width,
1237
+ height
1238
+ } = rects.floating;
1239
+ let heightSide;
1240
+ let widthSide;
1241
+ if (side === "top" || side === "bottom") {
1242
+ heightSide = side;
1243
+ widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
1244
+ } else {
1245
+ widthSide = side;
1246
+ heightSide = alignment === "end" ? "top" : "bottom";
1247
+ }
1248
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1249
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1250
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1251
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1252
+ const shiftData = state.middlewareData.shift;
1253
+ const noShift = !shiftData;
1254
+ let availableHeight = overflowAvailableHeight;
1255
+ let availableWidth = overflowAvailableWidth;
1256
+ if (shiftData != null && shiftData.enabled.x) {
1257
+ availableWidth = maximumClippingWidth;
1258
+ }
1259
+ if (shiftData != null && shiftData.enabled.y) {
1260
+ availableHeight = maximumClippingHeight;
1261
+ }
1262
+ if (noShift && !alignment) {
1263
+ if (isYAxis) {
1264
+ availableWidth = width - 2 * max(overflow.left, overflow.right);
1265
+ } else {
1266
+ availableHeight = height - 2 * max(overflow.top, overflow.bottom);
1267
+ }
1268
+ }
1269
+ await apply({
1270
+ ...state,
1271
+ availableWidth,
1272
+ availableHeight
1273
+ });
1274
+ const nextDimensions = await platform2.getDimensions(elements.floating);
1275
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1276
+ return {
1277
+ reset: {
1278
+ rects: true
1279
+ }
1280
+ };
1281
+ }
1282
+ return {};
1283
+ }
1284
+ };
1285
+ };
1286
+
1287
+ // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
1288
+ var min2 = Math.min;
1289
+ var max2 = Math.max;
1290
+ var round = Math.round;
1291
+ var floor = Math.floor;
1292
+ var createCoords = (v) => ({
1293
+ x: v,
1294
+ y: v
1295
+ });
1296
+
1297
+ // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1298
+ function hasWindow() {
1299
+ return typeof window !== "undefined";
1300
+ }
1301
+ function getNodeName(node) {
1302
+ if (isNode(node)) {
1303
+ return (node.nodeName || "").toLowerCase();
1304
+ }
1305
+ return "#document";
1306
+ }
1307
+ function getWindow(node) {
1308
+ var _node$ownerDocument;
1309
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1310
+ }
1311
+ function getDocumentElement(node) {
1312
+ var _ref;
1313
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1314
+ }
1315
+ function isNode(value) {
1316
+ if (!hasWindow()) {
1317
+ return false;
1318
+ }
1319
+ return value instanceof Node || value instanceof getWindow(value).Node;
1320
+ }
1321
+ function isElement(value) {
1322
+ if (!hasWindow()) {
1323
+ return false;
1324
+ }
1325
+ return value instanceof Element || value instanceof getWindow(value).Element;
1326
+ }
1327
+ function isHTMLElement(value) {
1328
+ if (!hasWindow()) {
1329
+ return false;
1330
+ }
1331
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1332
+ }
1333
+ function isShadowRoot(value) {
1334
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
1335
+ return false;
1336
+ }
1337
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1338
+ }
1339
+ var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
1340
+ function isOverflowElement(element) {
1341
+ const {
1342
+ overflow,
1343
+ overflowX,
1344
+ overflowY,
1345
+ display
1346
+ } = getComputedStyle2(element);
1347
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
1348
+ }
1349
+ var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
1350
+ function isTableElement(element) {
1351
+ return tableElements.has(getNodeName(element));
1352
+ }
1353
+ var topLayerSelectors = [":popover-open", ":modal"];
1354
+ function isTopLayer(element) {
1355
+ return topLayerSelectors.some((selector) => {
1356
+ try {
1357
+ return element.matches(selector);
1358
+ } catch (_e) {
1359
+ return false;
1360
+ }
1361
+ });
1362
+ }
1363
+ var transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
1364
+ var willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
1365
+ var containValues = ["paint", "layout", "strict", "content"];
1366
+ function isContainingBlock(elementOrCss) {
1367
+ const webkit = isWebKit2();
1368
+ const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1369
+ return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
1370
+ }
1371
+ function getContainingBlock(element) {
1372
+ let currentNode = getParentNode(element);
1373
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1374
+ if (isContainingBlock(currentNode)) {
1375
+ return currentNode;
1376
+ } else if (isTopLayer(currentNode)) {
1377
+ return null;
1378
+ }
1379
+ currentNode = getParentNode(currentNode);
1380
+ }
1381
+ return null;
1382
+ }
1383
+ function isWebKit2() {
1384
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
1385
+ return CSS.supports("-webkit-backdrop-filter", "none");
1386
+ }
1387
+ var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1388
+ function isLastTraversableNode(node) {
1389
+ return lastTraversableNodeNames.has(getNodeName(node));
1390
+ }
1391
+ function getComputedStyle2(element) {
1392
+ return getWindow(element).getComputedStyle(element);
1393
+ }
1394
+ function getNodeScroll(element) {
1395
+ if (isElement(element)) {
1396
+ return {
1397
+ scrollLeft: element.scrollLeft,
1398
+ scrollTop: element.scrollTop
1399
+ };
1400
+ }
1401
+ return {
1402
+ scrollLeft: element.scrollX,
1403
+ scrollTop: element.scrollY
1404
+ };
1405
+ }
1406
+ function getParentNode(node) {
1407
+ if (getNodeName(node) === "html") {
1408
+ return node;
1409
+ }
1410
+ const result = (
1411
+ // Step into the shadow DOM of the parent of a slotted node.
1412
+ node.assignedSlot || // DOM Element detected.
1413
+ node.parentNode || // ShadowRoot detected.
1414
+ isShadowRoot(node) && node.host || // Fallback.
1415
+ getDocumentElement(node)
1416
+ );
1417
+ return isShadowRoot(result) ? result.host : result;
1418
+ }
1419
+ function getNearestOverflowAncestor(node) {
1420
+ const parentNode = getParentNode(node);
1421
+ if (isLastTraversableNode(parentNode)) {
1422
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1423
+ }
1424
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1425
+ return parentNode;
1426
+ }
1427
+ return getNearestOverflowAncestor(parentNode);
1428
+ }
1429
+ function getOverflowAncestors(node, list, traverseIframes) {
1430
+ var _node$ownerDocument2;
1431
+ if (list === void 0) {
1432
+ list = [];
1433
+ }
1434
+ if (traverseIframes === void 0) {
1435
+ traverseIframes = true;
1436
+ }
1437
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1438
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1439
+ const win = getWindow(scrollableAncestor);
1440
+ if (isBody) {
1441
+ const frameElement = getFrameElement(win);
1442
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1443
+ }
1444
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1445
+ }
1446
+ function getFrameElement(win) {
1447
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1448
+ }
1449
+
1450
+ // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
1451
+ function getCssDimensions(element) {
1452
+ const css = getComputedStyle2(element);
1453
+ let width = parseFloat(css.width) || 0;
1454
+ let height = parseFloat(css.height) || 0;
1455
+ const hasOffset = isHTMLElement(element);
1456
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1457
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1458
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1459
+ if (shouldFallback) {
1460
+ width = offsetWidth;
1461
+ height = offsetHeight;
1462
+ }
1463
+ return {
1464
+ width,
1465
+ height,
1466
+ $: shouldFallback
1467
+ };
1468
+ }
1469
+ function unwrapElement(element) {
1470
+ return !isElement(element) ? element.contextElement : element;
1471
+ }
1472
+ function getScale(element) {
1473
+ const domElement = unwrapElement(element);
1474
+ if (!isHTMLElement(domElement)) {
1475
+ return createCoords(1);
1476
+ }
1477
+ const rect = domElement.getBoundingClientRect();
1478
+ const {
1479
+ width,
1480
+ height,
1481
+ $
1482
+ } = getCssDimensions(domElement);
1483
+ let x = ($ ? round(rect.width) : rect.width) / width;
1484
+ let y2 = ($ ? round(rect.height) : rect.height) / height;
1485
+ if (!x || !Number.isFinite(x)) {
1486
+ x = 1;
1487
+ }
1488
+ if (!y2 || !Number.isFinite(y2)) {
1489
+ y2 = 1;
1490
+ }
1491
+ return {
1492
+ x,
1493
+ y: y2
1494
+ };
1495
+ }
1496
+ var noOffsets = /* @__PURE__ */ createCoords(0);
1497
+ function getVisualOffsets(element) {
1498
+ const win = getWindow(element);
1499
+ if (!isWebKit2() || !win.visualViewport) {
1500
+ return noOffsets;
1501
+ }
1502
+ return {
1503
+ x: win.visualViewport.offsetLeft,
1504
+ y: win.visualViewport.offsetTop
1505
+ };
1506
+ }
1507
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1508
+ if (isFixed === void 0) {
1509
+ isFixed = false;
1510
+ }
1511
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1512
+ return false;
1513
+ }
1514
+ return isFixed;
1515
+ }
1516
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1517
+ if (includeScale === void 0) {
1518
+ includeScale = false;
1519
+ }
1520
+ if (isFixedStrategy === void 0) {
1521
+ isFixedStrategy = false;
1522
+ }
1523
+ const clientRect = element.getBoundingClientRect();
1524
+ const domElement = unwrapElement(element);
1525
+ let scale = createCoords(1);
1526
+ if (includeScale) {
1527
+ if (offsetParent) {
1528
+ if (isElement(offsetParent)) {
1529
+ scale = getScale(offsetParent);
1530
+ }
1531
+ } else {
1532
+ scale = getScale(element);
1533
+ }
1534
+ }
1535
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1536
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1537
+ let y2 = (clientRect.top + visualOffsets.y) / scale.y;
1538
+ let width = clientRect.width / scale.x;
1539
+ let height = clientRect.height / scale.y;
1540
+ if (domElement) {
1541
+ const win = getWindow(domElement);
1542
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1543
+ let currentWin = win;
1544
+ let currentIFrame = getFrameElement(currentWin);
1545
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1546
+ const iframeScale = getScale(currentIFrame);
1547
+ const iframeRect = currentIFrame.getBoundingClientRect();
1548
+ const css = getComputedStyle2(currentIFrame);
1549
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1550
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1551
+ x *= iframeScale.x;
1552
+ y2 *= iframeScale.y;
1553
+ width *= iframeScale.x;
1554
+ height *= iframeScale.y;
1555
+ x += left;
1556
+ y2 += top;
1557
+ currentWin = getWindow(currentIFrame);
1558
+ currentIFrame = getFrameElement(currentWin);
1559
+ }
1560
+ }
1561
+ return rectToClientRect({
1562
+ width,
1563
+ height,
1564
+ x,
1565
+ y: y2
1566
+ });
1567
+ }
1568
+ function getWindowScrollBarX(element, rect) {
1569
+ const leftScroll = getNodeScroll(element).scrollLeft;
1570
+ if (!rect) {
1571
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1572
+ }
1573
+ return rect.left + leftScroll;
1574
+ }
1575
+ function getHTMLOffset(documentElement, scroll) {
1576
+ const htmlRect = documentElement.getBoundingClientRect();
1577
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1578
+ const y2 = htmlRect.top + scroll.scrollTop;
1579
+ return {
1580
+ x,
1581
+ y: y2
1582
+ };
1583
+ }
1584
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1585
+ let {
1586
+ elements,
1587
+ rect,
1588
+ offsetParent,
1589
+ strategy
1590
+ } = _ref;
1591
+ const isFixed = strategy === "fixed";
1592
+ const documentElement = getDocumentElement(offsetParent);
1593
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1594
+ if (offsetParent === documentElement || topLayer && isFixed) {
1595
+ return rect;
1596
+ }
1597
+ let scroll = {
1598
+ scrollLeft: 0,
1599
+ scrollTop: 0
1600
+ };
1601
+ let scale = createCoords(1);
1602
+ const offsets = createCoords(0);
1603
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1604
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1605
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1606
+ scroll = getNodeScroll(offsetParent);
1607
+ }
1608
+ if (isHTMLElement(offsetParent)) {
1609
+ const offsetRect = getBoundingClientRect(offsetParent);
1610
+ scale = getScale(offsetParent);
1611
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1612
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1613
+ }
1614
+ }
1615
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1616
+ return {
1617
+ width: rect.width * scale.x,
1618
+ height: rect.height * scale.y,
1619
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1620
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1621
+ };
1622
+ }
1623
+ function getClientRects(element) {
1624
+ return Array.from(element.getClientRects());
1625
+ }
1626
+ function getDocumentRect(element) {
1627
+ const html = getDocumentElement(element);
1628
+ const scroll = getNodeScroll(element);
1629
+ const body = element.ownerDocument.body;
1630
+ const width = max2(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1631
+ const height = max2(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1632
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1633
+ const y2 = -scroll.scrollTop;
1634
+ if (getComputedStyle2(body).direction === "rtl") {
1635
+ x += max2(html.clientWidth, body.clientWidth) - width;
1636
+ }
1637
+ return {
1638
+ width,
1639
+ height,
1640
+ x,
1641
+ y: y2
1642
+ };
1643
+ }
1644
+ var SCROLLBAR_MAX = 25;
1645
+ function getViewportRect(element, strategy) {
1646
+ const win = getWindow(element);
1647
+ const html = getDocumentElement(element);
1648
+ const visualViewport = win.visualViewport;
1649
+ let width = html.clientWidth;
1650
+ let height = html.clientHeight;
1651
+ let x = 0;
1652
+ let y2 = 0;
1653
+ if (visualViewport) {
1654
+ width = visualViewport.width;
1655
+ height = visualViewport.height;
1656
+ const visualViewportBased = isWebKit2();
1657
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1658
+ x = visualViewport.offsetLeft;
1659
+ y2 = visualViewport.offsetTop;
1660
+ }
1661
+ }
1662
+ const windowScrollbarX = getWindowScrollBarX(html);
1663
+ if (windowScrollbarX <= 0) {
1664
+ const doc = html.ownerDocument;
1665
+ const body = doc.body;
1666
+ const bodyStyles = getComputedStyle(body);
1667
+ const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1668
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1669
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1670
+ width -= clippingStableScrollbarWidth;
1671
+ }
1672
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1673
+ width += windowScrollbarX;
1674
+ }
1675
+ return {
1676
+ width,
1677
+ height,
1678
+ x,
1679
+ y: y2
1680
+ };
1681
+ }
1682
+ var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1683
+ function getInnerBoundingClientRect(element, strategy) {
1684
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1685
+ const top = clientRect.top + element.clientTop;
1686
+ const left = clientRect.left + element.clientLeft;
1687
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1688
+ const width = element.clientWidth * scale.x;
1689
+ const height = element.clientHeight * scale.y;
1690
+ const x = left * scale.x;
1691
+ const y2 = top * scale.y;
1692
+ return {
1693
+ width,
1694
+ height,
1695
+ x,
1696
+ y: y2
1697
+ };
1698
+ }
1699
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1700
+ let rect;
1701
+ if (clippingAncestor === "viewport") {
1702
+ rect = getViewportRect(element, strategy);
1703
+ } else if (clippingAncestor === "document") {
1704
+ rect = getDocumentRect(getDocumentElement(element));
1705
+ } else if (isElement(clippingAncestor)) {
1706
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1707
+ } else {
1708
+ const visualOffsets = getVisualOffsets(element);
1709
+ rect = {
1710
+ x: clippingAncestor.x - visualOffsets.x,
1711
+ y: clippingAncestor.y - visualOffsets.y,
1712
+ width: clippingAncestor.width,
1713
+ height: clippingAncestor.height
1714
+ };
1715
+ }
1716
+ return rectToClientRect(rect);
1717
+ }
1718
+ function hasFixedPositionAncestor(element, stopNode) {
1719
+ const parentNode = getParentNode(element);
1720
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1721
+ return false;
1722
+ }
1723
+ return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1724
+ }
1725
+ function getClippingElementAncestors(element, cache) {
1726
+ const cachedResult = cache.get(element);
1727
+ if (cachedResult) {
1728
+ return cachedResult;
1729
+ }
1730
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1731
+ let currentContainingBlockComputedStyle = null;
1732
+ const elementIsFixed = getComputedStyle2(element).position === "fixed";
1733
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1734
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1735
+ const computedStyle = getComputedStyle2(currentNode);
1736
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1737
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1738
+ currentContainingBlockComputedStyle = null;
1739
+ }
1740
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1741
+ if (shouldDropCurrentNode) {
1742
+ result = result.filter((ancestor) => ancestor !== currentNode);
1743
+ } else {
1744
+ currentContainingBlockComputedStyle = computedStyle;
1745
+ }
1746
+ currentNode = getParentNode(currentNode);
1747
+ }
1748
+ cache.set(element, result);
1749
+ return result;
1750
+ }
1751
+ function getClippingRect(_ref) {
1752
+ let {
1753
+ element,
1754
+ boundary,
1755
+ rootBoundary,
1756
+ strategy
1757
+ } = _ref;
1758
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1759
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1760
+ const firstClippingAncestor = clippingAncestors[0];
1761
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1762
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1763
+ accRect.top = max2(rect.top, accRect.top);
1764
+ accRect.right = min2(rect.right, accRect.right);
1765
+ accRect.bottom = min2(rect.bottom, accRect.bottom);
1766
+ accRect.left = max2(rect.left, accRect.left);
1767
+ return accRect;
1768
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1769
+ return {
1770
+ width: clippingRect.right - clippingRect.left,
1771
+ height: clippingRect.bottom - clippingRect.top,
1772
+ x: clippingRect.left,
1773
+ y: clippingRect.top
1774
+ };
1775
+ }
1776
+ function getDimensions(element) {
1777
+ const {
1778
+ width,
1779
+ height
1780
+ } = getCssDimensions(element);
1781
+ return {
1782
+ width,
1783
+ height
1784
+ };
1785
+ }
1786
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1787
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1788
+ const documentElement = getDocumentElement(offsetParent);
1789
+ const isFixed = strategy === "fixed";
1790
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1791
+ let scroll = {
1792
+ scrollLeft: 0,
1793
+ scrollTop: 0
1794
+ };
1795
+ const offsets = createCoords(0);
1796
+ function setLeftRTLScrollbarOffset() {
1797
+ offsets.x = getWindowScrollBarX(documentElement);
1798
+ }
1799
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1800
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1801
+ scroll = getNodeScroll(offsetParent);
1802
+ }
1803
+ if (isOffsetParentAnElement) {
1804
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1805
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1806
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1807
+ } else if (documentElement) {
1808
+ setLeftRTLScrollbarOffset();
1809
+ }
1810
+ }
1811
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1812
+ setLeftRTLScrollbarOffset();
1813
+ }
1814
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1815
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1816
+ const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1817
+ return {
1818
+ x,
1819
+ y: y2,
1820
+ width: rect.width,
1821
+ height: rect.height
1822
+ };
1823
+ }
1824
+ function isStaticPositioned(element) {
1825
+ return getComputedStyle2(element).position === "static";
1826
+ }
1827
+ function getTrueOffsetParent(element, polyfill) {
1828
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
1829
+ return null;
1830
+ }
1831
+ if (polyfill) {
1832
+ return polyfill(element);
1833
+ }
1834
+ let rawOffsetParent = element.offsetParent;
1835
+ if (getDocumentElement(element) === rawOffsetParent) {
1836
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1837
+ }
1838
+ return rawOffsetParent;
1839
+ }
1840
+ function getOffsetParent(element, polyfill) {
1841
+ const win = getWindow(element);
1842
+ if (isTopLayer(element)) {
1843
+ return win;
1844
+ }
1845
+ if (!isHTMLElement(element)) {
1846
+ let svgOffsetParent = getParentNode(element);
1847
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1848
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1849
+ return svgOffsetParent;
1850
+ }
1851
+ svgOffsetParent = getParentNode(svgOffsetParent);
1852
+ }
1853
+ return win;
1854
+ }
1855
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1856
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1857
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1858
+ }
1859
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1860
+ return win;
1861
+ }
1862
+ return offsetParent || getContainingBlock(element) || win;
1863
+ }
1864
+ var getElementRects = async function(data) {
1865
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1866
+ const getDimensionsFn = this.getDimensions;
1867
+ const floatingDimensions = await getDimensionsFn(data.floating);
1868
+ return {
1869
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1870
+ floating: {
1871
+ x: 0,
1872
+ y: 0,
1873
+ width: floatingDimensions.width,
1874
+ height: floatingDimensions.height
1875
+ }
1876
+ };
1877
+ };
1878
+ function isRTL(element) {
1879
+ return getComputedStyle2(element).direction === "rtl";
1880
+ }
1881
+ var platform = {
1882
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1883
+ getDocumentElement,
1884
+ getClippingRect,
1885
+ getOffsetParent,
1886
+ getElementRects,
1887
+ getClientRects,
1888
+ getDimensions,
1889
+ getScale,
1890
+ isElement,
1891
+ isRTL
1892
+ };
1893
+ function rectsAreEqual(a, b3) {
1894
+ return a.x === b3.x && a.y === b3.y && a.width === b3.width && a.height === b3.height;
1895
+ }
1896
+ function observeMove(element, onMove) {
1897
+ let io = null;
1898
+ let timeoutId;
1899
+ const root = getDocumentElement(element);
1900
+ function cleanup() {
1901
+ var _io;
1902
+ clearTimeout(timeoutId);
1903
+ (_io = io) == null || _io.disconnect();
1904
+ io = null;
1905
+ }
1906
+ function refresh(skip, threshold) {
1907
+ if (skip === void 0) {
1908
+ skip = false;
1909
+ }
1910
+ if (threshold === void 0) {
1911
+ threshold = 1;
1912
+ }
1913
+ cleanup();
1914
+ const elementRectForRootMargin = element.getBoundingClientRect();
1915
+ const {
1916
+ left,
1917
+ top,
1918
+ width,
1919
+ height
1920
+ } = elementRectForRootMargin;
1921
+ if (!skip) {
1922
+ onMove();
1923
+ }
1924
+ if (!width || !height) {
1925
+ return;
1926
+ }
1927
+ const insetTop = floor(top);
1928
+ const insetRight = floor(root.clientWidth - (left + width));
1929
+ const insetBottom = floor(root.clientHeight - (top + height));
1930
+ const insetLeft = floor(left);
1931
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1932
+ const options = {
1933
+ rootMargin,
1934
+ threshold: max2(0, min2(1, threshold)) || 1
1935
+ };
1936
+ let isFirstUpdate = true;
1937
+ function handleObserve(entries) {
1938
+ const ratio = entries[0].intersectionRatio;
1939
+ if (ratio !== threshold) {
1940
+ if (!isFirstUpdate) {
1941
+ return refresh();
1942
+ }
1943
+ if (!ratio) {
1944
+ timeoutId = setTimeout(() => {
1945
+ refresh(false, 1e-7);
1946
+ }, 1e3);
1947
+ } else {
1948
+ refresh(false, ratio);
1949
+ }
1950
+ }
1951
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1952
+ refresh();
1953
+ }
1954
+ isFirstUpdate = false;
1955
+ }
1956
+ try {
1957
+ io = new IntersectionObserver(handleObserve, {
1958
+ ...options,
1959
+ // Handle <iframe>s
1960
+ root: root.ownerDocument
1961
+ });
1962
+ } catch (_e) {
1963
+ io = new IntersectionObserver(handleObserve, options);
1964
+ }
1965
+ io.observe(element);
1966
+ }
1967
+ refresh(true);
1968
+ return cleanup;
1969
+ }
1970
+ function autoUpdate(reference, floating, update, options) {
1971
+ if (options === void 0) {
1972
+ options = {};
1973
+ }
1974
+ const {
1975
+ ancestorScroll = true,
1976
+ ancestorResize = true,
1977
+ elementResize = typeof ResizeObserver === "function",
1978
+ layoutShift = typeof IntersectionObserver === "function",
1979
+ animationFrame = false
1980
+ } = options;
1981
+ const referenceEl = unwrapElement(reference);
1982
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
1983
+ ancestors.forEach((ancestor) => {
1984
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
1985
+ passive: true
1986
+ });
1987
+ ancestorResize && ancestor.addEventListener("resize", update);
1988
+ });
1989
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1990
+ let reobserveFrame = -1;
1991
+ let resizeObserver = null;
1992
+ if (elementResize) {
1993
+ resizeObserver = new ResizeObserver((_ref) => {
1994
+ let [firstEntry] = _ref;
1995
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1996
+ resizeObserver.unobserve(floating);
1997
+ cancelAnimationFrame(reobserveFrame);
1998
+ reobserveFrame = requestAnimationFrame(() => {
1999
+ var _resizeObserver;
2000
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2001
+ });
2002
+ }
2003
+ update();
2004
+ });
2005
+ if (referenceEl && !animationFrame) {
2006
+ resizeObserver.observe(referenceEl);
2007
+ }
2008
+ resizeObserver.observe(floating);
2009
+ }
2010
+ let frameId;
2011
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2012
+ if (animationFrame) {
2013
+ frameLoop();
2014
+ }
2015
+ function frameLoop() {
2016
+ const nextRefRect = getBoundingClientRect(reference);
2017
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
2018
+ update();
2019
+ }
2020
+ prevRefRect = nextRefRect;
2021
+ frameId = requestAnimationFrame(frameLoop);
2022
+ }
2023
+ update();
2024
+ return () => {
2025
+ var _resizeObserver2;
2026
+ ancestors.forEach((ancestor) => {
2027
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
2028
+ ancestorResize && ancestor.removeEventListener("resize", update);
2029
+ });
2030
+ cleanupIo == null || cleanupIo();
2031
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2032
+ resizeObserver = null;
2033
+ if (animationFrame) {
2034
+ cancelAnimationFrame(frameId);
2035
+ }
2036
+ };
2037
+ }
2038
+ var offset2 = offset;
2039
+ var shift2 = shift;
2040
+ var flip2 = flip;
2041
+ var size2 = size;
2042
+ var arrow2 = arrow;
2043
+ var computePosition2 = (reference, floating, options) => {
2044
+ const cache = /* @__PURE__ */ new Map();
2045
+ const mergedOptions = {
2046
+ platform,
2047
+ ...options
2048
+ };
2049
+ const platformWithCache = {
2050
+ ...mergedOptions.platform,
2051
+ _c: cache
2052
+ };
2053
+ return computePosition(reference, floating, {
2054
+ ...mergedOptions,
2055
+ platform: platformWithCache
2056
+ });
2057
+ };
2058
+
2059
+ // node_modules/@spectrum-web-components/overlay/src/PlacementController.js
2060
+ function u(l2) {
2061
+ if (typeof l2 == "undefined") return 0;
2062
+ const t = window.devicePixelRatio || 1;
2063
+ return Math.round(l2 * t) / t;
2064
+ }
2065
+ var g = 8;
2066
+ var F = 100;
2067
+ var S = (l2) => {
2068
+ var e2;
2069
+ return (e2 = { left: ["right", "bottom", "top"], "left-start": ["right-start", "bottom", "top"], "left-end": ["right-end", "bottom", "top"], right: ["left", "bottom", "top"], "right-start": ["left-start", "bottom", "top"], "right-end": ["left-end", "bottom", "top"], top: ["bottom", "left", "right"], "top-start": ["bottom-start", "left", "right"], "top-end": ["bottom-end", "left", "right"], bottom: ["top", "left", "right"], "bottom-start": ["top-start", "left", "right"], "bottom-end": ["top-end", "left", "right"] }[l2]) != null ? e2 : [l2];
2070
+ };
2071
+ var PlacementController = class {
2072
+ constructor(t) {
2073
+ this.originalPlacements = /* @__PURE__ */ new WeakMap();
2074
+ this.placementGeneration = 0;
2075
+ this.allowPlacementUpdate = false;
2076
+ this.closeForAncestorUpdate = () => {
2077
+ !this.allowPlacementUpdate && this.options.type !== "modal" && this.cleanup && this.target.dispatchEvent(new Event("close", { bubbles: true })), this.allowPlacementUpdate = false;
2078
+ };
2079
+ this.updatePlacement = () => {
2080
+ this.computePlacement();
2081
+ };
2082
+ this.resetOverlayPosition = () => {
2083
+ !this.target || !this.options || (this.clearOverlayPosition(), this.host.offsetHeight, this.computePlacement());
2084
+ };
2085
+ this.host = t, this.host.addController(this);
2086
+ }
2087
+ async placeOverlay(t = this.target, e2 = this.options) {
2088
+ var m;
2089
+ if ((m = this.cleanup) == null || m.call(this), this.cleanup = void 0, this.target = t, this.options = e2, !t || !e2) return;
2090
+ const v = autoUpdate(e2.trigger, t, this.closeForAncestorUpdate, { ancestorResize: false, elementResize: false, layoutShift: false }), r3 = autoUpdate(e2.trigger, t, this.updatePlacement, { ancestorScroll: false }), n2 = window.visualViewport;
2091
+ let o5 = 0, c = false;
2092
+ const a = () => {
2093
+ c || o5 || (o5 = requestAnimationFrame(() => {
2094
+ o5 = 0, !c && this.updatePlacement();
2095
+ }));
2096
+ };
2097
+ n2 && isWebKit() && (n2.addEventListener("resize", a, { passive: true }), n2.addEventListener("scroll", a, { passive: true })), this.cleanup = () => {
2098
+ var h;
2099
+ this.placementGeneration += 1, c = true, (h = this.host.elements) == null || h.forEach((p) => {
2100
+ p.addEventListener("sp-closed", () => {
2101
+ const s3 = this.originalPlacements.get(p);
2102
+ s3 && p.setAttribute("placement", s3), this.originalPlacements.delete(p);
2103
+ }, { once: true });
2104
+ }), v(), r3(), n2 && isWebKit() && (n2.removeEventListener("resize", a), n2.removeEventListener("scroll", a), o5 && (cancelAnimationFrame(o5), o5 = 0));
2105
+ };
2106
+ }
2107
+ async computePlacement() {
2108
+ var x, O;
2109
+ const { options: t, target: e2 } = this, v = this.placementGeneration, r3 = () => this.host.open && this.placementGeneration === v && !!this.target && this.target === e2;
2110
+ if (await (document.fonts ? document.fonts.ready : Promise.resolve()), !r3() || (isWebKit() && await new Promise((i2) => requestAnimationFrame(i2)), !r3())) return;
2111
+ const n2 = t.trigger instanceof HTMLElement ? flip2() : flip2({ padding: g, fallbackPlacements: S(t.placement) }), [o5 = 0, c = 0] = Array.isArray(t == null ? void 0 : t.offset) ? t.offset : [t.offset, 0], a = (x = this.host.elements.find((i2) => i2.tipElement)) == null ? void 0 : x.tipElement, m = [offset2({ mainAxis: o5, crossAxis: c }), shift2({ padding: g }), n2, size2({ padding: g, apply: ({ availableWidth: i2, availableHeight: y2, rects: { floating: V } }) => {
2112
+ const H = Math.max(F, Math.floor(y2)), d2 = V.height;
2113
+ this.initialHeight = this.isConstrained && this.initialHeight || d2, this.isConstrained = d2 < this.initialHeight || H <= d2;
2114
+ const L = this.isConstrained ? `${H}px` : "";
2115
+ Object.assign(e2.style, { maxWidth: `${Math.floor(i2)}px`, maxHeight: L });
2116
+ } }), ...a ? [arrow2({ element: a, padding: t.tipPadding || g })] : []], { x: h, y: p, placement: s3, middlewareData: P } = await computePosition2(t.trigger, e2, { placement: t.placement, middleware: m, strategy: "fixed" });
2117
+ if (!r3()) return;
2118
+ let E = h, w2 = p;
2119
+ const b3 = window.visualViewport;
2120
+ if (b3 && isWebKit() && (E -= b3.offsetLeft, w2 -= b3.offsetTop), !!r3() && (Object.assign(e2.style, { top: "0px", left: "0px", translate: `${u(E)}px ${u(w2)}px` }), e2.setAttribute("actual-placement", s3), (O = this.host.elements) == null || O.forEach((i2) => {
2121
+ this.originalPlacements.has(i2) || this.originalPlacements.set(i2, i2.getAttribute("placement")), i2.setAttribute("placement", s3);
2122
+ }), !!r3() && a && P.arrow)) {
2123
+ const { x: i2, y: y2 } = P.arrow;
2124
+ Object.assign(a.style, { top: s3.startsWith("right") || s3.startsWith("left") ? "0px" : "", left: s3.startsWith("bottom") || s3.startsWith("top") ? "0px" : "", translate: `${u(i2)}px ${u(y2)}px` });
2125
+ }
2126
+ }
2127
+ clearOverlayPosition() {
2128
+ this.target && (this.target.style.removeProperty("max-height"), this.target.style.removeProperty("max-width"), this.initialHeight = void 0, this.isConstrained = false);
2129
+ }
2130
+ hostConnected() {
2131
+ document.addEventListener("sp-update-overlays", this.resetOverlayPosition);
2132
+ }
2133
+ hostUpdated() {
2134
+ var t;
2135
+ this.host.open || ((t = this.cleanup) == null || t.call(this), this.cleanup = void 0);
2136
+ }
2137
+ hostDisconnected() {
2138
+ var t;
2139
+ (t = this.cleanup) == null || t.call(this), this.cleanup = void 0, document.removeEventListener("sp-update-overlays", this.resetOverlayPosition);
2140
+ }
2141
+ };
2142
+
2143
+ // node_modules/@spectrum-web-components/overlay/src/InteractionController.js
2144
+ var InteractionTypes = ((r3) => (r3.click = "click", r3.hover = "hover", r3.longpress = "longpress", r3))(InteractionTypes || {});
2145
+ var lastInteractionType = /* @__PURE__ */ Symbol("lastInteractionType");
2146
+ var InteractionController = class {
2147
+ constructor(e2, { overlay: t, isPersistent: r3, handleOverlayReady: i2 }) {
2148
+ this.target = e2;
2149
+ this.isLazilyOpen = false;
2150
+ this.isPersistent = false;
2151
+ this.isPersistent = !!r3, this.handleOverlayReady = i2, this.isPersistent && this.init(), this.overlay = t;
2152
+ }
2153
+ get activelyOpening() {
2154
+ return false;
2155
+ }
2156
+ get open() {
2157
+ var e2, t;
2158
+ return (t = (e2 = this.overlay) == null ? void 0 : e2.open) != null ? t : this.isLazilyOpen;
2159
+ }
2160
+ set open(e2) {
2161
+ if (e2 !== this.open) {
2162
+ if (this.isLazilyOpen = e2, this.overlay) {
2163
+ this.overlay.open = e2, this.target[lastInteractionType] = this.type;
2164
+ return;
2165
+ }
2166
+ e2 && (customElements.whenDefined("sp-overlay").then(async () => {
2167
+ const { Overlay: t } = await import("./chunk-FN3Y2AYJ.js");
2168
+ this.overlay = new t(), this.overlay.open = true, this.target[lastInteractionType] = this.type;
2169
+ }), import("./chunk-4RGMMAR4.js"));
2170
+ }
2171
+ }
2172
+ get overlay() {
2173
+ return this._overlay;
2174
+ }
2175
+ set overlay(e2) {
2176
+ var t;
2177
+ e2 && this._overlay !== e2 && (this._overlay && this._overlay.removeController(this), this._overlay = e2, e2.addController(this), this.initOverlay(), this.prepareDescription(this.target), (t = this.handleOverlayReady) == null || t.call(this, e2));
2178
+ }
2179
+ clearOverlay() {
2180
+ this._overlay && this._overlay.removeController(this), this._overlay = void 0;
2181
+ }
2182
+ prepareDescription(e2) {
2183
+ }
2184
+ releaseDescription() {
2185
+ }
2186
+ shouldCompleteOpen() {
2187
+ }
2188
+ init() {
2189
+ }
2190
+ initOverlay() {
2191
+ }
2192
+ abort() {
2193
+ var e2;
2194
+ this.releaseDescription(), (e2 = this.abortController) == null || e2.abort();
2195
+ }
2196
+ hostConnected() {
2197
+ this.init();
2198
+ }
2199
+ hostDisconnected() {
2200
+ this.isPersistent || this.abort();
2201
+ }
2202
+ };
2203
+
2204
+ // node_modules/@spectrum-web-components/overlay/src/LongpressController.js
2205
+ var u2 = 300;
2206
+ var LONGPRESS_INSTRUCTIONS = { touch: "Double tap and long press for additional options", keyboard: "Press Space or Alt+Down Arrow for additional options", mouse: "Click and hold for additional options" };
2207
+ var LongpressController = class extends InteractionController {
2208
+ constructor() {
2209
+ super(...arguments);
2210
+ this.type = InteractionTypes.longpress;
2211
+ this.longpressState = null;
2212
+ this.releaseDescription = noop;
2213
+ this.handlePointerup = () => {
2214
+ var e2;
2215
+ clearTimeout(this.timeout), this.target && (this.longpressState = ((e2 = this.overlay) == null ? void 0 : e2.state) === "opening" ? "pressed" : null, document.removeEventListener("pointerup", this.handlePointerup), document.removeEventListener("pointercancel", this.handlePointerup));
2216
+ };
2217
+ }
2218
+ get activelyOpening() {
2219
+ return this.longpressState === "opening" || this.longpressState === "pressed";
2220
+ }
2221
+ handleLongpress() {
2222
+ this.open = true, this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
2223
+ }
2224
+ handlePointerdown(e2) {
2225
+ !this.target || e2.button !== 0 || (this.longpressState = "potential", document.addEventListener("pointerup", this.handlePointerup), document.addEventListener("pointercancel", this.handlePointerup), "holdAffordance" in this.target) || (this.timeout = setTimeout(() => {
2226
+ this.target && this.target.dispatchEvent(new CustomEvent("longpress", { bubbles: true, composed: true, detail: { source: "pointer" } }));
2227
+ }, u2));
2228
+ }
2229
+ handleKeydown(e2) {
2230
+ const { code: o5, altKey: t } = e2;
2231
+ t && o5 === "ArrowDown" && e2.stopImmediatePropagation();
2232
+ }
2233
+ handleKeyup(e2) {
2234
+ const { code: o5, altKey: t } = e2;
2235
+ if (o5 === "Space" || t && o5 === "ArrowDown") {
2236
+ if (!this.target) return;
2237
+ e2.stopPropagation(), this.target.dispatchEvent(new CustomEvent("longpress", { bubbles: true, composed: true, detail: { source: "keyboard" } })), setTimeout(() => {
2238
+ this.longpressState = null;
2239
+ });
2240
+ }
2241
+ }
2242
+ prepareDescription(e2) {
2243
+ if (this.releaseDescription !== noop || !this.overlay || !this.overlay.elements.length || this.overlay.describeTrigger === "none") return;
2244
+ const t = document.createElement("div");
2245
+ t.id = `longpress-describedby-descriptor-${randomID()}`;
2246
+ const s3 = isIOS() || isAndroid() ? "touch" : "keyboard";
2247
+ t.textContent = LONGPRESS_INSTRUCTIONS[s3], t.slot = "longpress-describedby-descriptor";
2248
+ const n2 = e2.getRootNode(), i2 = this.overlay.getRootNode();
2249
+ n2 === i2 ? this.overlay.append(t) : (t.hidden = !("host" in n2), e2.insertAdjacentElement("afterend", t));
2250
+ const a = conditionAttributeWithId(e2, "aria-describedby", [t.id]);
2251
+ this.releaseDescription = () => {
2252
+ a(), t.remove(), this.releaseDescription = noop;
2253
+ };
2254
+ }
2255
+ shouldCompleteOpen() {
2256
+ this.longpressState = this.longpressState === "pressed" ? null : this.longpressState;
2257
+ }
2258
+ init() {
2259
+ var o5;
2260
+ (o5 = this.abortController) == null || o5.abort(), this.abortController = new AbortController();
2261
+ const { signal: e2 } = this.abortController;
2262
+ this.target.addEventListener("longpress", () => this.handleLongpress(), { signal: e2 }), this.target.addEventListener("pointerdown", (t) => this.handlePointerdown(t), { signal: e2 }), this.prepareDescription(this.target), !this.target.holdAffordance && (this.target.addEventListener("keydown", (t) => this.handleKeydown(t), { signal: e2 }), this.target.addEventListener("keyup", (t) => this.handleKeyup(t), { signal: e2 }));
2263
+ }
2264
+ };
2265
+
2266
+ // node_modules/@spectrum-web-components/overlay/src/overlay.css.js
2267
+ var o4 = i`
2268
+ :host{pointer-events:none;--swc-overlay-animation-distance:var(--spectrum-spacing-100);display:contents}:host(:has(>sp-tooltip)){--swc-overlay-animation-distance:var(--spectrum-tooltip-animation-distance)}.dialog{box-sizing:border-box;--sp-overlay-open:true;background:0 0;border:0;max-width:calc(100vw - 16px);height:auto;max-height:calc(100dvh - 16px);margin:0;padding:0;display:flex;position:fixed;inset:0 auto auto 0;overflow:visible;opacity:1!important}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";position:absolute;inset:-999em;pointer-events:auto!important}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{padding-block:var(--swc-overlay-animation-distance);margin-top:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{padding-inline:var(--swc-overlay-animation-distance);margin-left:calc(-1*var(--swc-overlay-animation-distance))}.dialog:not([actual-placement])[placement*=bottom]{padding-block:var(--swc-overlay-animation-distance);margin-top:calc(-1*var(--swc-overlay-animation-distance))}.dialog:not([actual-placement])[placement*=left]{padding-inline:var(--swc-overlay-animation-distance);margin-left:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{padding-block:var(--swc-overlay-animation-distance);margin-top:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{padding-inline:var(--swc-overlay-animation-distance);margin-left:calc(-1*var(--swc-overlay-animation-distance))}.dialog[actual-placement*=bottom]{padding-block:var(--swc-overlay-animation-distance);margin-top:calc(-1*var(--swc-overlay-animation-distance))}.dialog[actual-placement*=left]{padding-inline:var(--swc-overlay-animation-distance);margin-left:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}.modal-backdrop{z-index:999998;pointer-events:auto;background:0 0;position:fixed;inset:0}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--mod-popover-filter:var(--spectrum-popover-filter)}}@supports (overlay:auto){.dialog{transition:all var(--mod-overlay-animation-duration,var(--spectrum-animation-duration-100,.13s)),translate 0s,display var(--mod-overlay-animation-duration,var(--spectrum-animation-duration-100,.13s));transition-behavior:allow-discrete;display:none}.dialog:popover-open{display:flex}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base,1000) + var(--swc-overlay-open-count))}}
2269
+ `;
2270
+ var overlay_css_default = o4;
2271
+
2272
+ // node_modules/@spectrum-web-components/overlay/src/ClickController.js
2273
+ var ClickController = class extends InteractionController {
2274
+ constructor() {
2275
+ super(...arguments);
2276
+ this.type = InteractionTypes.click;
2277
+ this.preventNextToggle = false;
2278
+ }
2279
+ handleClick() {
2280
+ this.preventNextToggle || (this.open = !this.open), this.preventNextToggle = false;
2281
+ }
2282
+ handlePointerdown() {
2283
+ this.preventNextToggle = this.open;
2284
+ }
2285
+ init() {
2286
+ var t;
2287
+ (t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
2288
+ const { signal: e2 } = this.abortController;
2289
+ this.target.addEventListener("click", () => this.handleClick(), { signal: e2 }), this.target.addEventListener("pointerdown", () => this.handlePointerdown(), { signal: e2 });
2290
+ }
2291
+ };
2292
+
2293
+ // node_modules/@spectrum-web-components/overlay/src/HoverController.js
2294
+ var HoverController = class extends InteractionController {
2295
+ constructor() {
2296
+ super(...arguments);
2297
+ this.type = InteractionTypes.hover;
2298
+ this.elementIds = [];
2299
+ this.targetFocused = false;
2300
+ this.hovering = false;
2301
+ this.overlayFocused = false;
2302
+ }
2303
+ handleKeyup(e2) {
2304
+ e2.code === "Tab" ? this.open = true : e2.code === "Escape" && this.open && (e2.preventDefault(), e2.stopPropagation(), this.open = false, this.target && this.target.focus());
2305
+ }
2306
+ handleTargetFocusin() {
2307
+ this.target.matches(":focus-visible") && this.target[lastInteractionType] !== InteractionTypes.click && (this.open = true, this.targetFocused = true);
2308
+ }
2309
+ handleTargetFocusout() {
2310
+ this.targetFocused = false, !this.hovering && this.doFocusleave();
2311
+ }
2312
+ clearCloseTimeout() {
2313
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0);
2314
+ }
2315
+ handleTargetPointerenter() {
2316
+ var e2;
2317
+ this.clearCloseTimeout(), !((e2 = this.overlay) != null && e2.disabled) && (this.open = true, this.hovering = true);
2318
+ }
2319
+ handleTargetPointerleave() {
2320
+ this.doPointerleave();
2321
+ }
2322
+ handleHostPointerenter() {
2323
+ this.clearCloseTimeout();
2324
+ }
2325
+ handleHostPointerleave() {
2326
+ this.doPointerleave();
2327
+ }
2328
+ handleOverlayFocusin() {
2329
+ this.overlayFocused = true, this.clearCloseTimeout();
2330
+ }
2331
+ handleOverlayFocusout() {
2332
+ this.overlayFocused = false, !this.hovering && (this.targetFocused && this.target.matches(":focus-visible") || this.doFocusleave());
2333
+ }
2334
+ prepareDescription() {
2335
+ if (!this.overlay || !this.overlay.elements.length || this.overlay.describeTrigger === "none") return;
2336
+ const t = this.target.getRootNode(), r3 = this.overlay.elements[0].getRootNode(), o5 = this.overlay.getRootNode();
2337
+ t === o5 ? this.prepareOverlayRelativeDescription() : t === r3 && this.prepareContentRelativeDescription();
2338
+ }
2339
+ prepareOverlayRelativeDescription() {
2340
+ if (!this.overlay) return;
2341
+ const e2 = conditionAttributeWithId(this.target, "aria-describedby", [this.overlay.id]);
2342
+ this.releaseDescription = () => {
2343
+ e2(), this.releaseDescription = noop;
2344
+ };
2345
+ }
2346
+ prepareContentRelativeDescription() {
2347
+ if (!this.overlay) return;
2348
+ const e2 = this.overlay, t = [], r3 = e2.elements.map((i2) => (t.push(i2.id), i2.id || (i2.id = `${e2.tagName.toLowerCase()}-helper-${randomID()}`), i2.id));
2349
+ this.elementIds = t;
2350
+ const o5 = conditionAttributeWithId(this.target, "aria-describedby", r3);
2351
+ this.releaseDescription = () => {
2352
+ o5(), e2.elements.map((i2, l2) => {
2353
+ i2.id = this.elementIds[l2];
2354
+ }), this.releaseDescription = noop;
2355
+ };
2356
+ }
2357
+ scheduleClose() {
2358
+ this.hoverTimeout = setTimeout(() => {
2359
+ this.open = false;
2360
+ }, 300);
2361
+ }
2362
+ doPointerleave() {
2363
+ this.hovering = false;
2364
+ const e2 = this.target;
2365
+ this.targetFocused && e2.matches(":focus-visible") || this.overlayFocused || this.scheduleClose();
2366
+ }
2367
+ doFocusleave() {
2368
+ this.clearCloseTimeout(), !this.targetFocused && !this.overlayFocused && !this.hovering && this.scheduleClose();
2369
+ }
2370
+ init() {
2371
+ var t;
2372
+ (t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
2373
+ const { signal: e2 } = this.abortController;
2374
+ this.target.addEventListener("keyup", (r3) => this.handleKeyup(r3), { signal: e2 }), this.target.addEventListener("focusin", () => this.handleTargetFocusin(), { signal: e2 }), this.target.addEventListener("focusout", () => this.handleTargetFocusout(), { signal: e2 }), this.target.addEventListener("pointerenter", () => this.handleTargetPointerenter(), { signal: e2 }), this.target.addEventListener("pointerleave", () => this.handleTargetPointerleave(), { signal: e2 }), this.overlay && this.initOverlay();
2375
+ }
2376
+ initOverlay() {
2377
+ if (!this.abortController || !this.overlay) return;
2378
+ const { signal: e2 } = this.abortController;
2379
+ this.overlay.addEventListener("pointerenter", () => this.handleHostPointerenter(), { signal: e2 }), this.overlay.addEventListener("pointerleave", () => this.handleHostPointerleave(), { signal: e2 }), this.overlay.addEventListener("focusin", () => this.handleOverlayFocusin(), { signal: e2 }), this.overlay.addEventListener("focusout", () => this.handleOverlayFocusout(), { signal: e2 }), this.overlay.addEventListener("keyup", (t) => this.handleKeyup(t), { signal: e2 });
2380
+ }
2381
+ };
2382
+
2383
+ // node_modules/@spectrum-web-components/overlay/src/strategies.js
2384
+ var strategies = { click: ClickController, longpress: LongpressController, hover: HoverController };
2385
+
2386
+ // node_modules/@spectrum-web-components/overlay/src/Overlay.js
2387
+ var y = Object.defineProperty;
2388
+ var w = Object.getOwnPropertyDescriptor;
2389
+ var r2 = (u3, l2, e2, t) => {
2390
+ for (var i2 = t > 1 ? void 0 : t ? w(l2, e2) : l2, o5 = u3.length - 1, a; o5 >= 0; o5--) (a = u3[o5]) && (i2 = (t ? a(l2, e2, i2) : a(i2)) || i2);
2391
+ return t && i2 && y(l2, e2, i2), i2;
2392
+ };
2393
+ var q = "showPopover" in document.createElement("div");
2394
+ var b2 = OverlayPopover(AbstractOverlay);
2395
+ q || (b2 = OverlayNoPopover(AbstractOverlay));
2396
+ var s = class s2 extends b2 {
2397
+ constructor() {
2398
+ super(...arguments);
2399
+ this._delayed = false;
2400
+ this._disabled = false;
2401
+ this.offset = 0;
2402
+ this._open = false;
2403
+ this.lastRequestSlottableState = false;
2404
+ this.receivesFocus = "auto";
2405
+ this.allowOutsideClick = false;
2406
+ this._state = "closed";
2407
+ this.triggerElement = null;
2408
+ this.describeTrigger = "auto";
2409
+ this.type = "auto";
2410
+ this.wasOpen = false;
2411
+ this._focusTrap = null;
2412
+ this.lastPointerdownTarget = null;
2413
+ this.trackPointerdownOrigin = (e2) => {
2414
+ const t = e2.composedPath();
2415
+ this.lastPointerdownTarget = t.includes(this) ? t[0] : null;
2416
+ };
2417
+ this.clearPointerdownOrigin = () => {
2418
+ this.lastPointerdownTarget = null;
2419
+ };
2420
+ this.closeOnFocusOut = (e2) => {
2421
+ const t = this.lastPointerdownTarget;
2422
+ this.lastPointerdownTarget = null, e2.relatedTarget && (t && this.isShadowIncludingAncestor(t, e2.relatedTarget) || this.isShadowIncludingAncestor(e2.relatedTarget, this) || (this.open = false));
2423
+ };
2424
+ this.closeOnCancelEvent = () => {
2425
+ this.open = false;
2426
+ };
2427
+ }
2428
+ get delayed() {
2429
+ const e2 = this.elements[this.elements.length - 1];
2430
+ return (e2 == null ? void 0 : e2.hasAttribute("delayed")) || this._delayed;
2431
+ }
2432
+ set delayed(e2) {
2433
+ this._delayed = e2;
2434
+ }
2435
+ get disabled() {
2436
+ return this._disabled;
2437
+ }
2438
+ set disabled(e2) {
2439
+ var t;
2440
+ this._disabled = e2, e2 ? ((t = this.strategy) == null || t.abort(), this.wasOpen = this.open, this.open = false) : (this.bindEvents(), this.open = this.open || this.wasOpen, this.wasOpen = false);
2441
+ }
2442
+ get hasNonVirtualTrigger() {
2443
+ return !!this.triggerElement && !(this.triggerElement instanceof VirtualTrigger);
2444
+ }
2445
+ get placementController() {
2446
+ return this._placementController || (this._placementController = new PlacementController(this)), this._placementController;
2447
+ }
2448
+ get open() {
2449
+ return this._open;
2450
+ }
2451
+ set open(e2) {
2452
+ var t;
2453
+ e2 && this.disabled || e2 !== this.open && ((t = this.strategy) != null && t.activelyOpening && !e2 || (this._open = e2, this.open && (s2.openCount += 1), this.requestUpdate("open", !this.open), this.open && this.requestSlottable()));
2454
+ }
2455
+ get state() {
2456
+ return this._state;
2457
+ }
2458
+ set state(e2) {
2459
+ var i2;
2460
+ if (e2 === this.state) return;
2461
+ const t = this.state;
2462
+ this._state = e2, (this.state === "opened" || this.state === "closed") && ((i2 = this.strategy) == null || i2.shouldCompleteOpen()), this.requestUpdate("state", t);
2463
+ }
2464
+ get elementResolver() {
2465
+ return this._elementResolver || (this._elementResolver = new ElementResolutionController(this)), this._elementResolver;
2466
+ }
2467
+ get popoverValue() {
2468
+ if ("popover" in this) switch (this.type) {
2469
+ case "modal":
2470
+ return "manual";
2471
+ case "page":
2472
+ return "manual";
2473
+ case "hint":
2474
+ return "manual";
2475
+ default:
2476
+ return this.type;
2477
+ }
2478
+ }
2479
+ get requiresPositioning() {
2480
+ return !(this.type === "page" || !this.open || !this.triggerElement || !this.placement && this.type !== "hint");
2481
+ }
2482
+ get needsModalBackdrop() {
2483
+ return this.open && (this.type === "modal" || this.type === "page");
2484
+ }
2485
+ managePosition() {
2486
+ if (!this.requiresPositioning || !this.open) return;
2487
+ const e2 = this.offset || 0, t = this.triggerElement, i2 = this.placement || "right", o5 = this.tipPadding;
2488
+ this.placementController.placeOverlay(this.dialogEl, { offset: e2, placement: i2, tipPadding: o5, trigger: t, type: this.type });
2489
+ }
2490
+ async managePopoverOpen() {
2491
+ super.managePopoverOpen();
2492
+ const e2 = this.open;
2493
+ if (this.open !== e2 || (await this.manageDelay(e2), this.open !== e2) || (this.triggerInteraction === "longpress" && await nextFrame(), await this.ensureOnDOM(e2), this.open !== e2)) return;
2494
+ const t = await this.makeTransition(e2);
2495
+ if (this.open === e2) {
2496
+ if (e2) {
2497
+ const i2 = await import("./chunk-MTF6JFSL.js"), o5 = this.receivesFocus === "false" ? false : t || void 0;
2498
+ this._focusTrap = i2.createFocusTrap(this.dialogEl, { initialFocus: o5, tabbableOptions: { getShadowRoot: true }, fallbackFocus: () => (this.dialogEl.setAttribute("tabIndex", "-1"), this.dialogEl), escapeDeactivates: false, allowOutsideClick: this.allowOutsideClick }), (this.type === "modal" || this.type === "page") && this._focusTrap.activate();
2499
+ }
2500
+ await this.applyFocus(e2, t);
2501
+ }
2502
+ }
2503
+ async applyFocus(e2, t) {
2504
+ if (!(this.receivesFocus === "false" || this.type === "hint")) {
2505
+ if (await nextFrame(), await nextFrame(), e2 === this.open && !this.open) {
2506
+ this.hasNonVirtualTrigger && this.contains(this.getRootNode().activeElement) && this.triggerElement.focus();
2507
+ return;
2508
+ }
2509
+ t == null || t.focus();
2510
+ }
2511
+ }
2512
+ returnFocus() {
2513
+ var t;
2514
+ if (this.open || this.type === "hint") return;
2515
+ const e2 = () => {
2516
+ var a, m;
2517
+ const i2 = [];
2518
+ let o5 = document.activeElement;
2519
+ for (; (a = o5 == null ? void 0 : o5.shadowRoot) != null && a.activeElement; ) o5 = o5.shadowRoot.activeElement;
2520
+ for (; o5; ) {
2521
+ const c = o5.assignedSlot || o5.parentElement || ((m = o5.getRootNode()) == null ? void 0 : m.host);
2522
+ c && i2.push(c), o5 = c;
2523
+ }
2524
+ return i2;
2525
+ };
2526
+ this.receivesFocus !== "false" && ((t = this.triggerElement) != null && t.focus) && (this.contains(this.getRootNode().activeElement) || e2().includes(this) || document.activeElement === document.body) && this.triggerElement.focus();
2527
+ }
2528
+ isShadowIncludingAncestor(e2, t) {
2529
+ const i2 = new Event("overlay-relation-query", { bubbles: true, composed: true });
2530
+ let o5 = false;
2531
+ return e2.addEventListener(i2.type, (a) => {
2532
+ o5 = a.composedPath().includes(t);
2533
+ }, { once: true }), e2.dispatchEvent(i2), o5;
2534
+ }
2535
+ async manageOpen(e2) {
2536
+ var i2;
2537
+ if (!this.isConnected && this.open) return;
2538
+ this.hasUpdated || await this.updateComplete, this.open ? (overlayStack.add(this), this.willPreventClose && (document.addEventListener("pointerup", () => {
2539
+ this.dialogEl.classList.toggle("not-immediately-closable", false), this.willPreventClose = false;
2540
+ }, { once: true }), this.dialogEl.classList.toggle("not-immediately-closable", true))) : (e2 && ((i2 = this._focusTrap) == null || i2.deactivate(), this._focusTrap = null, this.dispose()), overlayStack.remove(this)), this.open && this.state !== "opened" ? this.state = "opening" : !this.open && this.state !== "closed" && (this.state = "closing"), this.managePopoverOpen();
2541
+ const t = this.getRootNode();
2542
+ this.type === "auto" && (this.open ? (t.addEventListener("pointerdown", this.trackPointerdownOrigin, { capture: true }), t.addEventListener("pointerup", this.clearPointerdownOrigin, { capture: true }), t.addEventListener("pointercancel", this.clearPointerdownOrigin, { capture: true }), t.addEventListener("focusout", this.closeOnFocusOut, { capture: true })) : (t.removeEventListener("pointerdown", this.trackPointerdownOrigin, { capture: true }), t.removeEventListener("pointerup", this.clearPointerdownOrigin, { capture: true }), t.removeEventListener("pointercancel", this.clearPointerdownOrigin, { capture: true }), t.removeEventListener("focusout", this.closeOnFocusOut, { capture: true }), this.lastPointerdownTarget = null)), (this.type === "modal" || this.type === "page") && (this.open ? t.addEventListener("cancel", this.closeOnCancelEvent, { capture: true }) : t.removeEventListener("cancel", this.closeOnCancelEvent, { capture: true }));
2543
+ }
2544
+ bindEvents() {
2545
+ var e2;
2546
+ (e2 = this.strategy) == null || e2.abort(), this.strategy = void 0, this.hasNonVirtualTrigger && this.triggerInteraction && (this.strategy = new strategies[this.triggerInteraction](this.triggerElement, { overlay: this }));
2547
+ }
2548
+ handleBeforetoggle(e2) {
2549
+ e2.newState !== "open" && this.handleBrowserClose(e2);
2550
+ }
2551
+ handleBrowserClose(e2) {
2552
+ var t;
2553
+ if (e2.stopPropagation(), !((t = this.strategy) != null && t.activelyOpening)) {
2554
+ this.open = false;
2555
+ return;
2556
+ }
2557
+ this.manuallyKeepOpen();
2558
+ }
2559
+ manuallyKeepOpen() {
2560
+ this.open = true, this.placementController.allowPlacementUpdate = true, this.manageOpen(false);
2561
+ }
2562
+ handleSlotchange() {
2563
+ var e2, t;
2564
+ this.elements.length ? this.hasNonVirtualTrigger && ((t = this.strategy) == null || t.prepareDescription(this.triggerElement)) : (e2 = this.strategy) == null || e2.releaseDescription();
2565
+ }
2566
+ handleClose() {
2567
+ this.open = false;
2568
+ }
2569
+ shouldPreventClose() {
2570
+ const e2 = this.willPreventClose;
2571
+ return this.willPreventClose = false, e2;
2572
+ }
2573
+ requestSlottable() {
2574
+ this.lastRequestSlottableState !== this.open && (this.open || document.body.offsetHeight, this.dispatchEvent(new SlottableRequestEvent("overlay-content", this.open ? {} : removeSlottableRequest)), this.lastRequestSlottableState = this.open);
2575
+ }
2576
+ willUpdate(e2) {
2577
+ var i2;
2578
+ if (this.hasAttribute("id") || this.setAttribute("id", `${this.tagName.toLowerCase()}-${randomID()}`), e2.has("allowOutsideClick") && this.allowOutsideClick && console.warn(`[${this.localName}] The "allow-outside-click" attribute has been deprecated and will be removed in a future release. We do not recommend using this attribute for accessibility reasons. It allows clicks outside the overlay to close it, which can cause unexpected behavior and accessibility issues.`), e2.has("open") && (this.hasUpdated || this.open) && this.manageOpen(e2.get("open")), e2.has("trigger")) {
2579
+ const [o5, a] = ((i2 = this.trigger) == null ? void 0 : i2.split("@")) || [];
2580
+ this.elementResolver.selector = o5 ? `#${o5}` : "", this.triggerInteraction = a;
2581
+ }
2582
+ let t = false;
2583
+ e2.has(elementResolverUpdatedSymbol) && (t = this.triggerElement, this.triggerElement = this.elementResolver.element), e2.has("triggerElement") && (t = e2.get("triggerElement")), t !== false && this.bindEvents();
2584
+ }
2585
+ updated(e2) {
2586
+ super.updated(e2), e2.has("placement") && (this.placement ? this.dialogEl.setAttribute("actual-placement", this.placement) : this.dialogEl.removeAttribute("actual-placement"), this.open && typeof e2.get("placement") != "undefined" && this.placementController.resetOverlayPosition()), e2.has("state") && this.state === "closed" && typeof e2.get("state") != "undefined" && this.placementController.clearOverlayPosition();
2587
+ }
2588
+ renderContent() {
2589
+ return b`
2590
+ <slot @slotchange=${this.handleSlotchange}></slot>
2591
+ `;
2592
+ }
2593
+ get dialogStyleMap() {
2594
+ return { "--swc-overlay-open-count": s2.openCount.toString() };
2595
+ }
2596
+ renderPopover() {
2597
+ return b`
2598
+ ${this.needsModalBackdrop ? b`
2599
+ <div class="modal-backdrop"></div>
2600
+ ` : A}
2601
+ <div
2602
+ class="dialog"
2603
+ part="dialog"
2604
+ role=${o2(this.type === "modal" || this.type === "page" ? "dialog" : void 0)}
2605
+ aria-modal=${o2(this.type === "modal" || this.type === "page" ? "true" : void 0)}
2606
+ placement=${o2(this.requiresPositioning ? this.placement || "right" : void 0)}
2607
+ popover=${o2(this.popoverValue)}
2608
+ style=${o3(this.dialogStyleMap)}
2609
+ @beforetoggle=${this.handleBeforetoggle}
2610
+ @close=${this.handleBrowserClose}
2611
+ ?is-visible=${this.state !== "closed"}
2612
+ >
2613
+ ${this.renderContent()}
2614
+ </div>
2615
+ `;
2616
+ }
2617
+ render() {
2618
+ return b`
2619
+ ${this.renderPopover()}
2620
+ <slot name="longpress-describedby-descriptor"></slot>
2621
+ `;
2622
+ }
2623
+ connectedCallback() {
2624
+ super.connectedCallback(), this.addEventListener("close", this.handleClose), this.hasUpdated && this.bindEvents();
2625
+ }
2626
+ disconnectedCallback() {
2627
+ var e2;
2628
+ (e2 = this.strategy) == null || e2.releaseDescription(), this.open = false, this.removeEventListener("close", this.handleClose), super.disconnectedCallback();
2629
+ }
2630
+ };
2631
+ s.styles = [overlay_css_default], s.openCount = 1, r2([n({ type: Boolean })], s.prototype, "delayed", 1), r2([e(".dialog")], s.prototype, "dialogEl", 2), r2([n({ type: Boolean })], s.prototype, "disabled", 1), r2([o({ flatten: true, selector: ':not([slot="longpress-describedby-descriptor"], slot)' })], s.prototype, "elements", 2), r2([n({ type: Number })], s.prototype, "offset", 2), r2([n({ type: Boolean, reflect: true })], s.prototype, "open", 1), r2([n()], s.prototype, "placement", 2), r2([n({ attribute: "receives-focus" })], s.prototype, "receivesFocus", 2), r2([n({ type: Boolean, attribute: "allow-outside-click" })], s.prototype, "allowOutsideClick", 2), r2([e("slot")], s.prototype, "slotEl", 2), r2([r()], s.prototype, "state", 1), r2([n({ type: Number, attribute: "tip-padding" })], s.prototype, "tipPadding", 2), r2([n()], s.prototype, "trigger", 2), r2([n({ attribute: false })], s.prototype, "triggerElement", 2), r2([n({ attribute: false })], s.prototype, "triggerInteraction", 2), r2([n({ attribute: false })], s.prototype, "describeTrigger", 2), r2([n()], s.prototype, "type", 2);
2632
+ var Overlay = s;
2633
+
2634
+ export {
2635
+ LONGPRESS_INSTRUCTIONS,
2636
+ Overlay
2637
+ };
2638
+ //# sourceMappingURL=chunk-SZ33GAVH.js.map